Commit 5bbc5a35 by 799284587@qq.com

优化

parent d286df15
......@@ -156,8 +156,18 @@ public ApiResponse Generate([CustomizeValidator(RuleSet = "Delete"), FromBody]Al
if (null == allot || string.IsNullOrEmpty(allot.Path))
throw new PerformanceException("当前绩效记录不存在或没有上传数据文件");
var email = _claim.GetUserClaim(JwtClaimTypes.Mail);
_allotService.Generate(allot, email);
//BackgroundJob.Enqueue(() => _allotService.Generate(allot, email));
if (allot.States == (int)AllotStates.Wait)
return new ApiResponse(ResponseType.OK, "当前绩效正在等待生成");
if (_evn.IsEnvironment("Localhost"))
_allotService.Generate(allot, email);
else
BackgroundJob.Enqueue(() => _allotService.Generate(allot, email));
_allotService.UpdateAllotStates(allot.ID, (int)AllotStates.Wait, EnumHelper.GetDescription(AllotStates.Wait));
//_allotService.Generate(allot, email);
////BackgroundJob.Enqueue(() => _allotService.Generate(allot, email));
return new ApiResponse(ResponseType.OK);
}
......
......@@ -582,6 +582,8 @@
保存提取文件
</summary>
<param name="form"></param>
<param name="allotId"></param>
<param name="hospitalId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.ClaimService.GetUserId">
......
......@@ -52,5 +52,8 @@ public enum AllotStates
/// <summary> 归档 </summary>
[Description("归档")]
Archive = 8,
/// <summary> 归档 </summary>
[Description("等待")]
Wait = 9,
}
}
......@@ -193,6 +193,10 @@ public bool Update(per_allot allot)
}
#endregion
public void UpdateAllotStates(int allotId, int states, string remark)
{
_allotRepository.UpdateAllotStates(allotId, states, remark);
}
/// <summary>
/// 生成绩效
/// </summary>
......@@ -205,17 +209,17 @@ public void Generate(per_allot allot, string mail)
{
logdbug.Add(allot.ID, "绩效开始执行", JsonHelper.Serialize(allot));
configService.Clear(allot.ID);
_allotRepository.UpdateAllotStates(allot.ID, (int)AllotStates.InCheckData, EnumHelper.GetDescription(AllotStates.InCheckData));
UpdateAllotStates(allot.ID, (int)AllotStates.InCheckData, EnumHelper.GetDescription(AllotStates.InCheckData));
// 导出数据
var excel = importDataService.ReadDataAndSave(allot);
if (!checkDataService.Check(excel, allot))
{
_allotRepository.UpdateAllotStates(allot.ID, (int)AllotStates.CheckFail, EnumHelper.GetDescription(AllotStates.CheckFail));
UpdateAllotStates(allot.ID, (int)AllotStates.CheckFail, EnumHelper.GetDescription(AllotStates.CheckFail));
SendEmail(allot, mail, 3, time);
logdbug.Add(allot.ID, "绩效数据校验失败", JsonHelper.Serialize(allot));
return;
}
_allotRepository.UpdateAllotStates(allot.ID, (int)AllotStates.InGenerate, EnumHelper.GetDescription(AllotStates.InGenerate));
UpdateAllotStates(allot.ID, (int)AllotStates.InGenerate, EnumHelper.GetDescription(AllotStates.InGenerate));
// 计算合并数据
logdbug.Add(allot.ID, "计算合并数据", JsonHelper.Serialize(allot));
List<PerSheet> list = processComputService.MergeAndSave(excel, allot);
......@@ -227,14 +231,14 @@ public void Generate(per_allot allot, string mail)
var baiscnormList = resultComputeService.Compute(allot, excel, list);
resultComputeService.SpecialUnitCompute(excel, allot, baiscnormList);
_allotRepository.UpdateAllotStates(allot.ID, (int)AllotStates.GenerateSucceed, EnumHelper.GetDescription(AllotStates.GenerateSucceed));
UpdateAllotStates(allot.ID, (int)AllotStates.GenerateSucceed, EnumHelper.GetDescription(AllotStates.GenerateSucceed));
//发送邮件
SendEmail(allot, mail, 1, time);
logdbug.Add(allot.ID, "绩效开始执行", "绩效生成成功");
}
catch (Exception ex)
{
_allotRepository.UpdateAllotStates(allot.ID, (int)AllotStates.GenerateFail, EnumHelper.GetDescription(AllotStates.GenerateFail));
UpdateAllotStates(allot.ID, (int)AllotStates.GenerateFail, EnumHelper.GetDescription(AllotStates.GenerateFail));
SendEmail(allot, mail, 2, time);
logdbug.Add(allot.ID, "绩效开始执行", ex.ToString());
//throw ex;
......
......@@ -301,7 +301,7 @@ public res_compute UpdateRealfee(ComputerRequest request, int userId, string rea
/// <returns></returns>
public List<res_baiscnorm> GetBaiscnorm(int allotId)
{
return perforResbaiscnormRepository.GetEntities(t => t.AllotID == allotId);
return perforResbaiscnormRepository.GetEntities(t => t.AllotID == allotId).OrderBy(t => t.PositionName).ToList();
}
}
}
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