丢失代码找回

parent 120f42dd
......@@ -115,6 +115,21 @@ public ApiResponse<List<UserResponse>> List([FromBody]ApiRequest request)
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("insert")]
[HttpPost]
public ApiResponse<UserResponse> Insert([CustomizeValidator(RuleSet = "Insert"), FromBody]UserRequest request)
{
var userIdentity = _claim.At(request.Token);
var user = _userService.Insert(request, userIdentity.UserID);
user.Role = request.Role;
return new ApiResponse<UserResponse>(ResponseType.OK, user);
}
/// <summary>
/// 新增用户
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("delete")]
[HttpPost]
public ApiResponse Delete([CustomizeValidator(RuleSet = "Delete"), FromBody]UserRequest request)
......
......@@ -74,6 +74,13 @@ public bool Update(TEntity entity)
return context.SaveChanges() > 0;
}
public bool Update(TEntity entity, Action<TEntity> action)
{
action?.Invoke(entity);
context.Set<TEntity>().Update(entity);
return context.SaveChanges() > 0;
}
public List<TEntity> GetEntities()
{
return context.Set<TEntity>().ToList();
......
......@@ -44,7 +44,8 @@ public int DelAgain(int againid)
{
"ag_data",
"ag_employee",
"ag_header"
"ag_header",
"ag_againsituation"
};
string sql = "";
tableArray.ForEach(t => sql += $"delete from {t} where againallotid=@againid;");
......
......@@ -71,9 +71,12 @@ public bool Generate(AgainAllotRequest request, UserIdentity user)
if (againAllot == null || againAllot.ID == 0)
throw new PerformanceException("绩效二次分配不存在");
perforPeragainallotRepository.Update(againAllot, p => { p.States = 2; });
//清理二次绩效无用数据
configService.ClearAgain(againAllot.ID);
try
{
#region 基础信息
//获取基础配置信息
var config = perforCofagainRepository.GetEntities(t => t.AgainAllotID == againAllot.ID);
......@@ -211,6 +214,12 @@ public bool Generate(AgainAllotRequest request, UserIdentity user)
perforAgdataRepository.AddRange(dataList.ToArray());
#endregion
}
catch (Exception ex)
{
perforPeragainallotRepository.Update(againAllot, p => { p.States = 4; p.Remark = ex.ToString(); });
}
perforPeragainallotRepository.Update(againAllot, p => { p.States = 3; });
return true;
//return SheetFormat(perAgainExcel, situation);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment