日志

parent 8957169e
......@@ -8,35 +8,35 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
namespace Performance.EntityModels
{
/// <summary>
///
/// </summary>
[Table("log_dbug")]
public class log_dbug
public class log_dbug
{
/// <summary>
///
/// </summary>
[Key]
public int ID { get; set; }
public int ID { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> AllotID { get; set; }
/// <summary>
///
/// </summary>
public Nullable<DateTime> CreateTime { get; set; }
/// <summary>
///
/// </summary>
public string Titile { get; set; }
/// <summary>
///
/// </summary>
......
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.Repository
{
public partial class PerforLogdbugRepository
{
/// <summary>
/// 绩效生成专用
/// </summary>
/// <param name="allotId"></param>
/// <param name="title"></param>
/// <param name="message"></param>
/// <returns></returns>
public bool Add(int allotId, string title, string message)
{
return Add(new EntityModels.log_dbug { AllotID = allotId, CreateTime = DateTime.Now, Titile = title, Message = message });
}
}
}
......@@ -26,13 +26,15 @@ public class ImportDataService : IAutoInjection
private PerforImemployeeRepository perforImEmployeeRepository;
private PerforImaccountbasicRepository perforImaccountbasicRepository;
private PerforImspecialunitRepository perforImspecialunitRepository;
private PerforLogdbugRepository logdbug;
public ImportDataService(PerSheetService perSheetService,
PerforPersheetRepository perforPerSheetRepository,
PerforImdataRepository perforImDataRepository,
PerforImheaderRepository perforImHeaderRepository,
PerforImemployeeRepository perforImEmployeeRepository,
PerforImaccountbasicRepository perforImaccountbasicRepository,
PerforImspecialunitRepository perforImspecialunitRepository)
PerforImspecialunitRepository perforImspecialunitRepository,
PerforLogdbugRepository logdbug)
{
this.perSheetService = perSheetService;
this.perforPerSheetRepository = perforPerSheetRepository;
......@@ -41,6 +43,7 @@ public class ImportDataService : IAutoInjection
this.perforImEmployeeRepository = perforImEmployeeRepository;
this.perforImaccountbasicRepository = perforImaccountbasicRepository;
this.perforImspecialunitRepository = perforImspecialunitRepository;
this.logdbug = logdbug;
}
/// <summary>
......@@ -50,7 +53,7 @@ public class ImportDataService : IAutoInjection
/// <returns></returns>
public PerExcel ReadDataAndSave(per_allot allot)
{
var excel = Import(allot.Path);
var excel = Import(allot);
Save(excel, allot.ID);
return excel;
}
......@@ -60,8 +63,9 @@ public PerExcel ReadDataAndSave(per_allot allot)
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
private PerExcel Import(string path)
private PerExcel Import(per_allot allot)
{
var path = allot.Path;
PerExcel excel = new PerExcel
{
Path = path,
......@@ -77,7 +81,10 @@ private PerExcel Import(string path)
for (int i = 0; i < workbook.NumberOfSheets; i++)
{
var sheet = workbook.GetSheetAt(i);
if (SheetType.Unidentifiable != perSheetService.GetSheetType(sheet.SheetName))
var sheetType = perSheetService.GetSheetType(sheet.SheetName);
logdbug.Add(allot.ID, "开始读取excel文件", JsonHelper.Serialize(new { sheetType, Description = EnumHelper.GetDescription(sheetType), name = sheet.SheetName }));
if (SheetType.Unidentifiable != sheetType)
{
var st = perSheetService.Sheet(sheet);
excel.PerSheet.Add(st);
......@@ -206,18 +213,22 @@ private bool Save(PerExcel excel, int allotId)
{
if (sheet.SheetType == SheetType.Employee)
{
logdbug.Add(allotId, "开始保存人员数据数据", sheet.SheetName));
SaveEmployee(sheet, allotId);
}
else if (sheet.SheetType == SheetType.AccountBasic)
{
logdbug.Add(allotId, "开始保存临床科室医护绩效测算基础数据", sheet.SheetName));
SaveAccountBasic(sheet, allotId);
}
else if (sheet.SheetType == SheetType.SpecialUnit)
{
logdbug.Add(allotId, "开始保存特殊核算单元数据", sheet.SheetName));
SaveSpecialUnit(sheet, allotId);
}
else
{
logdbug.Add(allotId, "开始保存统一格式数据", sheet.SheetName));
SaveCommon(sheet, allotId);
}
}
......
......@@ -21,6 +21,7 @@ public class AllotService : IAutoInjection
private ImportDataService importDataService;
private ProcessComputService processComputService;
private ResultComputeService resultComputeService;
private PerforLogdbugRepository logdbug;
private ConfigService configService;
private IHostingEnvironment _evn;
......@@ -35,6 +36,7 @@ public class AllotService : IAutoInjection
ProcessComputService processComputService,
ResultComputeService resultComputeService,
ConfigService configService,
PerforLogdbugRepository logdbug,
IHostingEnvironment evn, ILogger<AllotService> logger,
IEmailService emailService)
{
......@@ -48,6 +50,7 @@ public class AllotService : IAutoInjection
this.resultComputeService = resultComputeService;
this.emailService = emailService;
this.configService = configService;
this.logdbug = logdbug;
}
#region 基础功能
......@@ -178,6 +181,7 @@ public void Generate(per_allot allot, UserIdentity user)
{
try
{
logdbug.Add(allot.ID, "绩效开始执行", JsonHelper.Serialize(allot));
configService.Clear(allot.ID);
_allotRepository.UpdateAllotStates(allot.ID, (int)AllotStates.InCheckData, EnumHelper.GetDescription(AllotStates.InCheckData));
// 导出数据
......@@ -186,26 +190,31 @@ public void Generate(per_allot allot, UserIdentity user)
{
_allotRepository.UpdateAllotStates(allot.ID, (int)AllotStates.CheckFail, EnumHelper.GetDescription(AllotStates.CheckFail));
SendEmail(allot, user.Mail, "数值健康,绩效数据校验失败", "绩效数据校验失败");
logdbug.Add(allot.ID, "绩效数据校验失败", JsonHelper.Serialize(allot));
return;
}
_allotRepository.UpdateAllotStates(allot.ID, (int)AllotStates.InGenerate, EnumHelper.GetDescription(AllotStates.InGenerate));
// 计算合并数据
// 计算合并数据
logdbug.Add(allot.ID, "计算合并数据", JsonHelper.Serialize(allot));
List<PerSheet> list = processComputService.MergeAndSave(excel, allot);
var baiscnorm = baiscNormService.NurseBaiscnorm(list);
logdbug.Add(allot.ID, "护士平均绩效", JsonHelper.Serialize(baiscnorm));
// 计算最总数据
logdbug.Add(allot.ID, "绩效结果计算数据开始", "");
var baiscnormList = resultComputeService.Compute(allot, excel, baiscnorm);
resultComputeService.SpecialUnitCompute(excel, allot, baiscnormList);
_allotRepository.UpdateAllotStates(allot.ID, (int)AllotStates.GenerateSucceed, EnumHelper.GetDescription(AllotStates.GenerateSucceed));
//发送邮件
SendEmail(allot, user.Mail, "绩效生成成功", "绩效生成成功");
logdbug.Add(allot.ID, "绩效开始执行", "绩效生成成功");
}
catch (Exception ex)
{
_allotRepository.UpdateAllotStates(allot.ID, (int)AllotStates.GenerateFail, EnumHelper.GetDescription(AllotStates.GenerateFail));
SendEmail(allot, user.Mail, "绩效生成失败", ex.ToString());
logdbug.Add(allot.ID, "绩效开始执行", ex.ToString());
throw ex;
}
}
......
......@@ -17,17 +17,20 @@ public class ConfigService : IAutoInjection
private PerforCofincomeRepository _incomeRepository;
private PerforCofworkyearRepository _workyearRepository;
private PerforPerallotRepository perforPerAllotRepository;
private PerforLogdbugRepository logdbug;
public ConfigService(PerforCofdirectorRepository cofdirectorRepository,
PerforCofdrugpropRepository cofdrugpropRepository,
PerforCofincomeRepository cofincomeRepository,
PerforCofworkyearRepository cofworkyearRepository,
PerforPerallotRepository perforPerAllotRepository)
PerforPerallotRepository perforPerAllotRepository,
PerforLogdbugRepository logdbug)
{
this._directorRepository = cofdirectorRepository;
this._drugpropRepository = cofdrugpropRepository;
this._incomeRepository = cofincomeRepository;
this._workyearRepository = cofworkyearRepository;
this.perforPerAllotRepository = perforPerAllotRepository;
this.logdbug = logdbug;
}
#region cof_director
......@@ -272,7 +275,8 @@ public bool WorkDelete(WorkyearRequest request)
/// <param name="allotId"></param>
public void Clear(int allotId)
{
_directorRepository.DeleteData(allotId);
var count = _directorRepository.DeleteData(allotId);
logdbug.Add(allotId, "清理无效数据", $"受影响行数:{count}");
}
......
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