fix .
This commit is contained in:
@@ -51,15 +51,9 @@ public class WorkGridsController : ControllerBase
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("save")]
|
[HttpPost("save")]
|
||||||
[Transactional]
|
[Transactional]
|
||||||
public async Task<DefaultApiResult> SaveWorkGridsAsync(List<WorkGridSaveRequest> requests)
|
public async Task SaveWorkGridsAsync(List<WorkGridSaveRequest> requests)
|
||||||
{
|
{
|
||||||
var msg = await _workGridService.SaveAsync(requests);
|
await _workGridService.SaveAsync(requests);
|
||||||
return new DefaultApiResult
|
|
||||||
{
|
|
||||||
Msg = msg,
|
|
||||||
Data = null,
|
|
||||||
Code = ApiStateCode.Success
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -122,15 +116,9 @@ public class WorkGridsController : ControllerBase
|
|||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("user/assign")]
|
[HttpPost("user/assign")]
|
||||||
public async Task<DefaultApiResult> AssignUsersToWorkGridAsync(WorkGridUserAssignRequest request)
|
public async Task AssignUsersToWorkGridAsync(WorkGridUserAssignRequest request)
|
||||||
{
|
{
|
||||||
var msg = await _workGridService.AssignAsync(request);
|
await _workGridService.AssignAsync(request);
|
||||||
return new DefaultApiResult
|
|
||||||
{
|
|
||||||
Msg = msg,
|
|
||||||
Data = null,
|
|
||||||
Code = ApiStateCode.Success
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -153,7 +141,7 @@ public class WorkGridsController : ControllerBase
|
|||||||
[Transactional]
|
[Transactional]
|
||||||
public async Task SaveScheduleAsync(WorkGridScheduleSaveRequest request)
|
public async Task SaveScheduleAsync(WorkGridScheduleSaveRequest request)
|
||||||
{
|
{
|
||||||
await _workGridScheduleService.SaveAsync(request);
|
await _workGridScheduleService.SaveAsync(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -19,11 +19,17 @@ public class WorkGridSaveRequest
|
|||||||
/// 备注
|
/// 备注
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Remark { get; set; }
|
public string Remark { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 最大用户数
|
/// 排班用户数提醒
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Range(1, int.MaxValue, ErrorMessage = "请设置最大用户数")]
|
[Range(1, int.MaxValue, ErrorMessage = "请设置排班用户数提醒")]
|
||||||
public int MaxUserCount { get; set; }
|
public int MaxUserTipCount { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 连续排班数提醒
|
||||||
|
/// </summary>
|
||||||
|
[Range(1, int.MaxValue, ErrorMessage = "请设置连续排班数提醒")]
|
||||||
|
public int MaxConsecutiveTipCount { get; set; }
|
||||||
}
|
}
|
||||||
@@ -37,5 +37,7 @@ public class WorkGridPageResponse
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 最大用户数设置
|
/// 最大用户数设置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int MaxUserCount { get; set; }
|
public int MaxUserTipCount { get; set; }
|
||||||
|
|
||||||
|
public int MaxConsecutiveTipCount { get; set; }
|
||||||
}
|
}
|
||||||
@@ -23,11 +23,16 @@ public class WorkGridUserPageResponse
|
|||||||
/// 员工数
|
/// 员工数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int UserCount { get; set; }
|
public int UserCount { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 最大用户数设置
|
/// 最大用户数设置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int MaxUserCount { get; set; }
|
public int MaxUserTipCount { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 请设置连续排班数提醒
|
||||||
|
/// </summary>
|
||||||
|
public int MaxConsecutiveTipCount { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 员工明细
|
/// 员工明细
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public interface IWorkGridService : IScopeDependency
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="requests"></param>
|
/// <param name="requests"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<string> SaveAsync(List<WorkGridSaveRequest> requests);
|
Task SaveAsync(List<WorkGridSaveRequest> requests);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// /网格分页
|
/// /网格分页
|
||||||
@@ -48,7 +48,7 @@ public interface IWorkGridService : IScopeDependency
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<string> AssignAsync(WorkGridUserAssignRequest request);
|
Task AssignAsync(WorkGridUserAssignRequest request);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 移除人员
|
/// 移除人员
|
||||||
|
|||||||
@@ -74,11 +74,10 @@ public class WorkGridService : IWorkGridService
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public async Task<string> SaveAsync(List<WorkGridSaveRequest> requests)
|
public async Task SaveAsync(List<WorkGridSaveRequest> requests)
|
||||||
{
|
{
|
||||||
var insertGrids = new List<string>();
|
var insertGrids = new List<string>();
|
||||||
var updateGrids = new List<string>();
|
var updateGrids = new List<string>();
|
||||||
var tips = new List<string>();
|
|
||||||
|
|
||||||
var leaderUserCodes = requests.Select(x => x.LeaderUserCode).Distinct().ToList();
|
var leaderUserCodes = requests.Select(x => x.LeaderUserCode).Distinct().ToList();
|
||||||
var existsUserCodes = await _dbContext.Queryable<GainfoEntity>().Where(x => leaderUserCodes.Contains(x.Code)).Select(x => x.Code).ToListAsync();
|
var existsUserCodes = await _dbContext.Queryable<GainfoEntity>().Where(x => leaderUserCodes.Contains(x.Code)).Select(x => x.Code).ToListAsync();
|
||||||
@@ -107,23 +106,14 @@ public class WorkGridService : IWorkGridService
|
|||||||
entity.LeaderUserCode = request.LeaderUserCode;
|
entity.LeaderUserCode = request.LeaderUserCode;
|
||||||
|
|
||||||
await _dbContext.InsertAsync(entity);
|
await _dbContext.InsertAsync(entity);
|
||||||
insertGrids.Add($"{entity.Name}({entity.LeaderUserCode}),最大用户数:{entity.MaxUserCount}");
|
insertGrids.Add($"{entity.Name}({entity.LeaderUserCode}),最大用户数:{entity.MaxUserTipCount}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var entity = await _dbContext.Queryable<WorkGridEntity>().Where(x => x.Id == request.Id).SingleAsync();
|
var entity = await _dbContext.Queryable<WorkGridEntity>().Where(x => x.Id == request.Id).SingleAsync();
|
||||||
entity.ThrowIfNull("网格不存在");
|
entity.ThrowIfNull("网格不存在");
|
||||||
|
|
||||||
updateGrids.Add($"{entity.Name}->{request.Name},{entity.MaxUserCount}->{request.MaxUserCount}");
|
updateGrids.Add($"{entity.Name}->{request.Name},排版用户数{entity.MaxUserTipCount}->{request.MaxUserTipCount},连续排班天数:{entity.MaxConsecutiveTipCount}->{request.MaxConsecutiveTipCount}");
|
||||||
if (request.MaxUserCount < entity.MaxUserCount)
|
|
||||||
{
|
|
||||||
var userCount = await _dbContext.Queryable<WorkGridUserEntity>().Where(x => x.WorkGridCode == entity.Code).CountAsync();
|
|
||||||
if (userCount > request.MaxUserCount)
|
|
||||||
{
|
|
||||||
tips.Add($"{request.Name}人员{userCount}超出最大人数设置{request.MaxUserCount}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
request.Adapt(entity);
|
request.Adapt(entity);
|
||||||
|
|
||||||
await _dbContext.UpdateAsync(entity);
|
await _dbContext.UpdateAsync(entity);
|
||||||
@@ -132,9 +122,6 @@ public class WorkGridService : IWorkGridService
|
|||||||
|
|
||||||
await _operateLog.LogAsync(OperateLogType.WorkGrid, "创建网格:" + insertGrids.Join("\r\n"));
|
await _operateLog.LogAsync(OperateLogType.WorkGrid, "创建网格:" + insertGrids.Join("\r\n"));
|
||||||
await _operateLog.LogAsync(OperateLogType.WorkGrid, "修改网格:" + updateGrids.Join("\r\n"));
|
await _operateLog.LogAsync(OperateLogType.WorkGrid, "修改网格:" + updateGrids.Join("\r\n"));
|
||||||
|
|
||||||
|
|
||||||
return tips.Any() ? tips.Join("\r\n") : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -158,7 +145,8 @@ public class WorkGridService : IWorkGridService
|
|||||||
LeaderUserCode = x.LeaderUserCode,
|
LeaderUserCode = x.LeaderUserCode,
|
||||||
UserName = ga.Name,
|
UserName = ga.Name,
|
||||||
Remark = x.Remark,
|
Remark = x.Remark,
|
||||||
MaxUserCount = x.MaxUserCount,
|
MaxUserTipCount = x.MaxUserTipCount,
|
||||||
|
MaxConsecutiveTipCount = x.MaxConsecutiveTipCount,
|
||||||
UserCount = SqlFunc.Subqueryable<WorkGridUserEntity>().Where(p => p.WorkGridCode == x.Code && p.IsDeleted == false).Count()
|
UserCount = SqlFunc.Subqueryable<WorkGridUserEntity>().Where(p => p.WorkGridCode == x.Code && p.IsDeleted == false).Count()
|
||||||
})
|
})
|
||||||
.ToPageListAsync(request);
|
.ToPageListAsync(request);
|
||||||
@@ -197,7 +185,8 @@ public class WorkGridService : IWorkGridService
|
|||||||
Code = x.Code,
|
Code = x.Code,
|
||||||
Name = x.Name,
|
Name = x.Name,
|
||||||
Remark = x.Remark,
|
Remark = x.Remark,
|
||||||
MaxUserCount = x.MaxUserCount
|
MaxUserTipCount = x.MaxUserTipCount,
|
||||||
|
MaxConsecutiveTipCount = x.MaxConsecutiveTipCount
|
||||||
})
|
})
|
||||||
.SingleAsync();
|
.SingleAsync();
|
||||||
|
|
||||||
@@ -230,7 +219,7 @@ public class WorkGridService : IWorkGridService
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public async Task<string> AssignAsync(WorkGridUserAssignRequest request)
|
public async Task AssignAsync(WorkGridUserAssignRequest request)
|
||||||
{
|
{
|
||||||
var currentFactory = _currentUser.GetStringTenantId();
|
var currentFactory = _currentUser.GetStringTenantId();
|
||||||
var role = _currentUser.GetRole();
|
var role = _currentUser.GetRole();
|
||||||
@@ -264,12 +253,7 @@ public class WorkGridService : IWorkGridService
|
|||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
await _dbContext.InsertAsync(dataToInserts);
|
await _dbContext.InsertAsync(dataToInserts);
|
||||||
var userCount = await _dbContext.Queryable<WorkGridUserEntity>().Where(x => x.WorkGridCode == myWorkGrid.Code).CountAsync();
|
|
||||||
await _operateLog.LogAsync(OperateLogType.WorkGrid, $"分配人员到网格({myWorkGrid.Name}),人员:{dataToInserts.Select(x => x.UserCode).Join(",")}");
|
await _operateLog.LogAsync(OperateLogType.WorkGrid, $"分配人员到网格({myWorkGrid.Name}),人员:{dataToInserts.Select(x => x.UserCode).Join(",")}");
|
||||||
|
|
||||||
return userCount > myWorkGrid.MaxUserCount
|
|
||||||
? $"{myWorkGrid.Name}人员{userCount}超出最大人数设置{myWorkGrid.MaxUserCount}"
|
|
||||||
: null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
"Timeout": 30,
|
"Timeout": 30,
|
||||||
"SlowSqlTime": 1,
|
"SlowSqlTime": 1,
|
||||||
"EnableSqlLog": true,
|
"EnableSqlLog": true,
|
||||||
"Generate": false
|
"Generate": true
|
||||||
},
|
},
|
||||||
"SwaggerOptions": {
|
"SwaggerOptions": {
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"RedisOptions": {
|
"RedisOptions": {
|
||||||
"ConnectionString": "192.168.199.30:30115,defaultDatabase=1,password=dlhis123"
|
"ConnectionString": "192.168.199.124:6379,defaultDatabase=1,password=dlhis123"
|
||||||
},
|
},
|
||||||
"IdentityServerOptions": {
|
"IdentityServerOptions": {
|
||||||
"Authority": "http://identity.oauth.svc.cluster.local",
|
"Authority": "http://identity.oauth.svc.cluster.local",
|
||||||
|
|||||||
@@ -36,12 +36,18 @@ public class WorkGridEntity : SugarBaseEntity, ISoftDeleted
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(IsNullable = true, ColumnDescription = "备注")]
|
[SugarColumn(IsNullable = true, ColumnDescription = "备注")]
|
||||||
public string Remark { get; set; }
|
public string Remark { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 最大用户数
|
/// 最大排班用户数提醒
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(IsNullable = false, ColumnDescription = "最大用户数")]
|
[SugarColumn(IsNullable = false, ColumnDescription = "最大排班用户数提醒")]
|
||||||
public int MaxUserCount { get; set; }
|
public int MaxUserTipCount { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 最大排班连续天数提醒
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = false, ColumnDescription = "最大排班连续天数提醒")]
|
||||||
|
public int MaxConsecutiveTipCount { get; set; }
|
||||||
|
|
||||||
public bool IsDeleted { get; set; }
|
public bool IsDeleted { get; set; }
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user