日志

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