Commit 4de40ffa by lcx

抽取日志

parent e1cd454b
......@@ -248,7 +248,7 @@ public ApiResponse AllotLog([CustomizeValidator(RuleSet = "Delete"), FromBody] A
var allot = _allotService.GetAllot(request.ID);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
var list = _allotService.AllotLog(allot);
var list = _allotService.AllotLog(allot, 1);
return new ApiResponse(ResponseType.OK, list);
}
......
......@@ -368,7 +368,7 @@ public ApiResponse AgainDelete([CustomizeValidator(RuleSet = "Delete"), FromBody
[HttpPost]
public ApiResponse<List<cof_workitem>> GetWorkItems([CustomizeValidator(RuleSet = "Select"), FromBody] WorkItemRequest request)
{
var list = _configService.GetWorkItems(request.AllotID);
var list = _configService.GetWorkItems(request.AllotID, request.Type);
return new ApiResponse<List<cof_workitem>>(ResponseType.OK, "ok", list);
}
......
......@@ -31,6 +31,7 @@ public class TemplateController : Controller
private Application application;
private WebapiUrl url;
private readonly AllotService allotService;
private readonly LogManageService logService;
private readonly ILogger<ExceptionsFilter> logger;
public TemplateController(TemplateService templateService,
......@@ -41,6 +42,7 @@ public class TemplateController : Controller
IOptions<Application> options,
IOptions<WebapiUrl> url,
AllotService allotService,
LogManageService logService,
ILogger<ExceptionsFilter> logger)
{
this.templateService = templateService;
......@@ -51,6 +53,7 @@ public class TemplateController : Controller
this.application = options.Value;
this.url = url.Value;
this.allotService = allotService;
this.logService = logService;
this.logger = logger;
}
......@@ -212,7 +215,7 @@ public ApiResponse Import([FromForm] IFormCollection form)
/// <returns></returns>
[Route("NewExtractData")]
[HttpPost]
public ApiResponse NewExtractData([CustomizeValidator, FromBody]ExtractRequest request)
public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest request)
{
var allot = allotService.GetAllot(request.AllotId);
if (allot == null)
......@@ -220,13 +223,13 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody]ExtractRequest r
// 判断是那种抽取
try
{
string message = extractService.Judge(request.AllotId, request.HospitalId, request.UseScheme, out string filePath);
string message = extractService.Judge(request.AllotId, request.HospitalId, request.UseScheme, out string filePath);
if (!string.IsNullOrEmpty(message))
return new ApiResponse(ResponseType.Fail, message);
allot.IsExtracting = allot.IsExtracting ?? 0;
if (allot.IsExtracting == 1)
return new ApiResponse(ResponseType.OK, "正在提取数据,请稍等!");
return new ApiResponse(ResponseType.OK, "正在提取数据,请稍等!", new { IsExtracting = true });
allot.IsExtracting = 1;
allotService.Update(allot);
......@@ -235,11 +238,11 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody]ExtractRequest r
//HttpHelper.HttpPostNoRequest(url.HttpPost + "/extract/extract", JsonHelper.Serialize(request), true);
if (string.IsNullOrEmpty(filePath))
HttpHelper.HttpPostNoRequest(url.HttpPost + $"/extract/extract?allotId={request.AllotId}&hospitalId={request.HospitalId}&email={claim.GetUserClaim(JwtClaimTypes.Mail)}", "");
HttpHelper.HttpPostNoRequest(url.HttpPost + $"/extract/extract?allotId={request.AllotId}&hospitalId={request.HospitalId}&email={claim.GetUserClaim(JwtClaimTypes.Mail)}&groupName = {request.GroupName}", "");
else
HttpHelper.HttpClient(url.HttpPost + $"/extract/extract?allotId={request.AllotId}&hospitalId={request.HospitalId}&email={claim.GetUserClaim(JwtClaimTypes.Mail)}", filePath, true);
HttpHelper.HttpClient(url.HttpPost + $"/extract/extract?allotId={request.AllotId}&hospitalId={request.HospitalId}&email={claim.GetUserClaim(JwtClaimTypes.Mail)}&groupName = {request.GroupName}", filePath, true);
return new ApiResponse(ResponseType.OK, "HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!");
return new ApiResponse(ResponseType.OK, "HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!", new { IsExtracting = false });
}
catch (Exception ex)
{
......@@ -269,7 +272,7 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody]ExtractRequest r
[Route("down")]
[AllowAnonymous]
[HttpGet]
public IActionResult DownFile([FromQuery]AllotRequest request)
public IActionResult DownFile([FromQuery] AllotRequest request)
{
var allot = allotService.GetAllot(request.ID);
if (allot == null || string.IsNullOrWhiteSpace(allot.ExtractPath) || !FileHelper.IsExistFile(allot.ExtractPath))
......@@ -350,5 +353,57 @@ public ApiResponse SaveFile([FromForm] IFormCollection form, int allotId, int ho
return new ApiResponse(ResponseType.Error, ex.Message);
}
}
/// <summary>
/// 返回日志
/// </summary>
/// <param name="allotId">绩效Id</param>
/// <param name="type">1 进度条 2 信息</param>
/// <param name="tag"></param>
/// <param name="message"></param>
/// <param name="level"></param>
/// <param name="success"></param>
[Route("returnlog")]
[HttpPost]
[AllowAnonymous]
public void ReturnLog(int allotId, int type, string tag, string message, int level = 1, bool success = false)
{
if (type == 3)
{
logService.Schedule(allotId, ConvertHelper.To<decimal>(message), level, success);
}
else
{
logService.ExtractLog(allotId, tag, message, level);
}
}
/// <summary>
/// 返回日志
/// </summary>
[Route("extractlog")]
[HttpPost]
public ApiResponse ReturnLog([FromBody] log_dbug request)
{
var allot = allotService.GetAllot(request.AllotID.Value);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
var list = allotService.AllotLog(allot, 2);
return new ApiResponse(ResponseType.OK, list);
}
/// <summary>
/// 返回日志
/// </summary>
[Route("schedule")]
[HttpPost]
public ApiResponse Schedule([FromBody] log_dbug request)
{
var allot = allotService.GetAllot(request.AllotID.Value);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
var ratio = allotService.AllotLog(allot, 3)?.Max(t => ConvertHelper.TryDecimal(t.Message)) ?? 0;
return new ApiResponse(ResponseType.OK, new { ratio });
}
}
}
\ No newline at end of file
......@@ -1190,6 +1190,27 @@
<param name="hospitalId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.TemplateController.ReturnLog(System.Int32,System.Int32,System.String,System.String,System.Int32,System.Boolean)">
<summary>
返回日志
</summary>
<param name="allotId">绩效Id</param>
<param name="type">1 进度条 2 信息</param>
<param name="tag"></param>
<param name="message"></param>
<param name="level"></param>
<param name="success"></param>
</member>
<member name="M:Performance.Api.Controllers.TemplateController.ReturnLog(Performance.EntityModels.log_dbug)">
<summary>
返回日志
</summary>
</member>
<member name="M:Performance.Api.Controllers.TemplateController.Schedule(Performance.EntityModels.log_dbug)">
<summary>
返回日志
</summary>
</member>
<member name="M:Performance.Api.ClaimService.GetUserId">
<summary>
获取当前请求登录ID
......
......@@ -2601,6 +2601,11 @@
1、信息(info)2、警告(warn)3、错误(error)4、异常(exception)5、成功(success)
</summary>
</member>
<member name="P:Performance.EntityModels.log_dbug.Type">
<summary>
1、绩效生成日志 2、绩效提取日志 3、绩效提取进度
</summary>
</member>
<member name="T:Performance.EntityModels.mod_dic">
<summary>
部分公共数据抽取SQL
......
......@@ -26,6 +26,8 @@ public class ExtractRequest
/// 邮箱
/// </summary>
public string Email { get; set; }
public string GroupName { get; set; }
}
......
......@@ -45,5 +45,10 @@ public class log_dbug
/// 1、信息(info)2、警告(warn)3、错误(error)4、异常(exception)5、成功(success)
/// </summary>
public Nullable<int> Level { get; set; }
/// <summary>
/// 1、绩效生成日志 2、绩效提取日志 3、绩效提取进度
/// </summary>
public Nullable<int> Type { get; set; }
}
}
......@@ -169,7 +169,7 @@ public void ExtractData([FromForm] IFormCollection form, int allotId, int hospit
logger.LogInformation($"正在尝试第{i}次保存!");
//保存文件
string retJson = HttpHelper.HttpClient(url.ImportFile + $"?allotId={allotId}&hospitalId={hospitalId}", filePath);
string retJson = HttpHelper.HttpClient(url.ImportFile + $"/template/savefile?allotId={allotId}&hospitalId={hospitalId}", filePath);
logger.LogInformation("保存提取文件返回结果:" + JsonHelper.Serialize(retJson));
logger.LogInformation(retJson);
var ret = JsonHelper.Deserialize<ApiResponse>(retJson);
......
......@@ -9,8 +9,8 @@
"AllowedHosts": "*",
//连接字符串
"AppConnection": {
//"PerformanceConnectionString": "server=192.168.18.166;database=db_performance;uid=root;pwd=1234qwer;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;",
"PerformanceConnectionString": "server=116.62.245.55;database=db_performance;uid=bigdata;pwd=Suvalue@abc;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;",
"PerformanceConnectionString": "server=192.168.18.166;database=db_performance;uid=root;pwd=1234qwer;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;",
//"PerformanceConnectionString": "server=116.62.245.55;database=db_performance;uid=bigdata;pwd=Suvalue@abc;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;",
"HangfireConnectionString": "server=192.168.18.166;database=db_hangfire;uid=root;pwd=1234qwer;port=3306;allow user variables=true;",
"RedisConnectionString": "116.62.245.55:6379,defaultDatabase=2"
},
......@@ -36,11 +36,11 @@
//邮件指定接收人
"Receiver": [ "chengxiang.li@suvalue.com", "486035085@qq.com" ],
"AbsolutePath": "E:\\wwwroot\\testjx.suvalue.com",
"HttpPath": "http://testjx.suvalue.com:81"
"HttpPath": "http://testjx.suvalue.com:81"
},
"WebapiUrl": {
"ImportFirst": "",
"ExtractData": "",
"ImportFile": "http://localhost:5001/api/template/savefile"
"ImportFile": "http://localhost:5001/api"
}
}
......@@ -35,10 +35,10 @@ public int DeleteData(int allotId)
"res_compute",
"res_specialunit",
"log_check",
"log_dbug",
};
string sql = "";
tableArray.ForEach(t => sql += $"delete from {t} where allotid=@allotId;");
sql += "delete from log_dbug where allotid=@allotId and source=1;";
return Execute(sql, new { allotId });
}
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Performance.Repository
......@@ -13,9 +14,19 @@ public partial class PerforLogdbugRepository
/// <param name="title"></param>
/// <param name="message"></param>
/// <returns></returns>
public bool Add(int allotId, string title, string message, int level)
public bool Add(int allotId, string title, string message, int level, int type)
{
return Add(new EntityModels.log_dbug { AllotID = allotId, CreateTime = DateTime.Now, Title = title, Message = message, Level = level });
return Add(new EntityModels.log_dbug { AllotID = allotId, CreateTime = DateTime.Now, Title = title, Message = message, Level = level, Type = type });
}
public bool ClearExtractLog(int allotId)
{
var entities = GetEntities(t => t.AllotID == allotId && new int[] { 2, 3 }.Contains(t.Type.Value));
if (entities != null && entities.Any())
return RemoveRange(entities.ToArray());
return true;
}
}
}
......@@ -377,7 +377,7 @@ public void Generate(per_allot allot, string mail)
catch (Exception ex)
{
logManageService.WriteMsg("绩效生成失败", "程序异常,请重新尝试。", 4, allot.ID, "ReceiveMessage");
logdbug.Add(allot.ID, "绩效开始执行", ex.ToString(), 4);
logdbug.Add(allot.ID, "绩效生成失败", ex.ToString(), 4, 1);
UpdateAllotStates(allot.ID, (int)AllotStates.GenerateFail, EnumHelper.GetDescription(AllotStates.GenerateFail));
//SendEmail(allot, mail, 2, time);
//throw ex;
......@@ -477,9 +477,9 @@ public List<log_check> AllotCheckResult(per_allot allot)
/// </summary>
/// <param name="allot"></param>
/// <returns></returns>
public List<log_dbug> AllotLog(per_allot allot)
public List<log_dbug> AllotLog(per_allot allot, int type)
{
var list = logdbug.GetEntities(t => t.AllotID == allot.ID);
var list = logdbug.GetEntities(t => t.AllotID == allot.ID && t.Type == type);
if (list != null)
list = list.OrderBy(t => t.CreateTime).ToList();
return list;
......
......@@ -643,6 +643,10 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId)
return dto;
}).ToList();
if (sheet.SheetType == (int)SheetType.OtherIncome)
items = items.Where(t => (t.ItemValue ?? 0) != 0).ToList();
}
if (headerData != null && headerData.Any())
......
......@@ -373,9 +373,9 @@ public bool DrugtypeDelete(DrugpropRequest request)
/// 获取cof_workitem列表
/// </summary>
/// <returns></returns>
public List<cof_workitem> GetWorkItems(int allotId)
public List<cof_workitem> GetWorkItems(int allotId, int type)
{
var list = _workitemRepository.GetEntities(t => t.AllotID == allotId);
var list = _workitemRepository.GetEntities(t => t.AllotID == allotId && t.Type == type);
return Mapper.Map<List<cof_workitem>>(list);
}
......
......@@ -41,12 +41,14 @@ public class DFExtractService : IAutoInjection
private readonly PerforPerdeptdicRepository perforPerdeptdicRepository;
private readonly PerforPeremployeeRepository perforPeremployeeRepository;
private readonly PersonService personService;
private readonly LogManageService logManage;
private IWorkbook workbook = null;
private ICellStyle style;
private per_allot Allot;
private const string specialname = "4.2 特殊核算单元绩效测算表";
private DateTime? CreateTime = null;
private decimal ratio = 5;
public DFExtractService(ILogger<DFExtractService> logger,
IEmailService emailService,
......@@ -66,7 +68,8 @@ public class DFExtractService : IAutoInjection
PerforPerdeptdicRepository perforPerdeptdicRepository,
PerforPeremployeeRepository perforPeremployeeRepository,
PersonService personService)
PersonService personService,
LogManageService logManage)
{
this.logger = logger;
this.emailService = emailService;
......@@ -87,6 +90,7 @@ public class DFExtractService : IAutoInjection
this.perforPerdeptdicRepository = perforPerdeptdicRepository;
this.perforPeremployeeRepository = perforPeremployeeRepository;
this.personService = personService;
this.logManage = logManage;
}
#endregion
......@@ -97,6 +101,9 @@ public string ExtractData(int allotId, string email, int hospitalId, string file
var hospital = perforHospitalRepository.GetEntity(t => t.ID == hospitalId);
try
{
logManage.ClearExtractLog(allotId);
logManage.ReturnTheLog(allotId, 2, "等待提取", $"确认配置信息是否可完成数据提取...");
var allot = perforPerallotRepository.GetEntity(t => t.ID == allotId);
Allot = allot ?? throw new PerformanceException("");
......@@ -125,7 +132,11 @@ public string ExtractData(int allotId, string email, int hospitalId, string file
typeIds = typeIds.Distinct().ToList();
var data = new List<ex_result>();
var scripts = perforExscriptRepository.GetEntities(t => typeIds.Contains(t.TypeId));
logManage.ReturnTheLog(allotId, 3, "", 5);
ClearHistData(allot);
CreateTime = DateTime.Now;
var otherItems = items.Where(t => modules.Where(m => m.SheetType != (int)SheetType.Income).Select(m => m.Id).Contains(t.ModuleId.Value)).ToList();
if (scripts != null && scripts.Any())
......@@ -142,6 +153,8 @@ public string ExtractData(int allotId, string email, int hospitalId, string file
}
catch (Exception ex)
{
logManage.ReturnTheLog(allotId, 2, "发生异常", $"提取绩效数据异常", 4);
logManage.ReturnTheLog(allotId, 3, "", ratio, 4);
logger.LogError($"提取绩效数据异常 数据写入出现异常{ex.ToString()}");
//SendEmail(email, "", $"{hospital.HosName}HIS数据提取失败", $"{hospital.HosName}提取数据过程中出现异常情况,我们将尽快解决问题。给您带来的不便我们深感歉意!");
throw ex;
......@@ -153,6 +166,8 @@ public string ExtractData(int allotId, string email, int hospitalId, string file
if (workbook != null)
workbook.Close();
GC.Collect();
logManage.ReturnTheLog(allotId, 2, "提取完成", $"绩效数据提取成功", 5);
logManage.ReturnTheLog(allotId, 3, "", 100, 5, true);
}
}
......@@ -175,8 +190,12 @@ private List<ex_result> ExtractIncome<TEntity>(List<TEntity> entities, List<ex_s
if (modules == null || !modules.Any(t => t.SheetType == (int)SheetType.Income && t.TypeId > 0))
return data;
foreach (var module in modules.Where(t => t.TypeId > 0))
var incomemodules = modules.Where(t => t.SheetType == (int)SheetType.Income && t.TypeId > 0);
foreach (var module in incomemodules)
{
logManage.ReturnTheLog(Allot.ID, 2, "提取数据", $"开始提取模块“{module.ModuleName}”的数据");
ratio += 15 / incomemodules.Count();
logManage.ReturnTheLog(Allot.ID, 3, "", ratio);
foreach (var config in configs)
{
var item = scripts.FirstOrDefault(t => t.TypeId == module.TypeId && t.DatabaseType == config.DataBaseType);
......@@ -188,6 +207,12 @@ private List<ex_result> ExtractIncome<TEntity>(List<TEntity> entities, List<ex_s
data.AddRange(querydata);
}
}
logManage.ReturnTheLog(Allot.ID, 2, "提取数据", $"模块“{module.ModuleName}”的数据已完成提取");
}
if (Math.Round(ratio) < 20)
{
ratio = 20;
logManage.ReturnTheLog(Allot.ID, 3, "", ratio);
}
return data;
......@@ -212,6 +237,9 @@ private List<ex_result> ExtractItems<TEntity>(List<TEntity> entities, List<ex_sc
foreach (var exitem in items.Where(t => t.TypeId > 0))
{
logManage.ReturnTheLog(Allot.ID, 2, "提取数据", $"开始提取项目“{exitem.ItemName}”的数据");
ratio += 30 / items.Where(t => t.TypeId > 0).Count();
logManage.ReturnTheLog(Allot.ID, 3, "", ratio);
var module = modules.FirstOrDefault(t => t.Id == exitem.ModuleId);
foreach (var config in configs)
{
......@@ -230,6 +258,12 @@ private List<ex_result> ExtractItems<TEntity>(List<TEntity> entities, List<ex_sc
data.AddRange(result);
}
}
logManage.ReturnTheLog(Allot.ID, 2, "提取数据", $"项目“{exitem.ItemName}”的数据已完成提取");
}
if (Math.Round(ratio) < 50)
{
ratio = 50;
logManage.ReturnTheLog(Allot.ID, 3, "", ratio);
}
return data;
......@@ -253,6 +287,9 @@ private List<ex_result> ExtractSpcial<TEntity>(List<TEntity> entities, List<ex_s
foreach (var special in specials.Where(t => t.TypeId > 0))
{
logManage.ReturnTheLog(Allot.ID, 2, "提取数据", $"开始提取特殊核算项“{special.Target}”的数据");
ratio += 10 / specials.Where(t => t.TypeId > 0).Count();
logManage.ReturnTheLog(Allot.ID, 3, "", ratio);
foreach (var config in configs)
{
var item = scripts.FirstOrDefault(t => t.TypeId == special.TypeId && t.DatabaseType == config.DataBaseType);
......@@ -266,6 +303,12 @@ private List<ex_result> ExtractSpcial<TEntity>(List<TEntity> entities, List<ex_s
});
data.AddRange(result);
}
logManage.ReturnTheLog(Allot.ID, 2, "提取数据", $"特殊核算项“{special.Target}”的数据已完成提取");
}
if (Math.Round(ratio) < 60)
{
ratio = 60;
logManage.ReturnTheLog(Allot.ID, 3, "", ratio);
}
if (data != null && data.Any())
perforExresultRepository.AddRange(data.ToArray());
......@@ -328,6 +371,10 @@ public string TemplateExecute(string email, sys_hospital hospital, List<sys_hosp
var sheetType = perSheetService.GetSheetType(sheet.SheetName);
if (sheetType == SheetType.Unidentifiable) continue;
logManage.ReturnTheLog(Allot.ID, 2, "写入数据", $"sheet“{sheet.SheetName}”开始写入数据");
ratio += 40 / 8;
logManage.ReturnTheLog(Allot.ID, 3, "", ratio);
var sheetRead = PerSheetDataFactory.GetDataRead(sheetType);
switch (sheetType)
{
......@@ -356,6 +403,7 @@ public string TemplateExecute(string email, sys_hospital hospital, List<sys_hosp
WriteSpecialUnit(sheet, sheetRead, specials, data);
break;
}
logManage.ReturnTheLog(Allot.ID, 2, "写入数据", $"sheet“{sheet.SheetName}”已完成数据写入");
}
using (FileStream file = new FileStream(newPath, FileMode.OpenOrCreate))
{
......@@ -404,6 +452,11 @@ public string AlllotExecute(string email, sys_hospital hospital, List<sys_hospit
{
var sheet = workbook.GetSheetAt(i);
var sheetType = perSheetService.GetSheetType(sheet.SheetName);
if (sheetType == SheetType.Unidentifiable) continue;
logManage.ReturnTheLog(Allot.ID, 2, "写入数据", $"sheet“{sheet.SheetName}”开始写入数据");
ratio += 40 / 8;
logManage.ReturnTheLog(Allot.ID, 3, "", ratio);
var sheetRead = PerSheetDataFactory.GetDataRead(sheetType);
switch (sheetType)
......@@ -438,6 +491,7 @@ public string AlllotExecute(string email, sys_hospital hospital, List<sys_hospit
WriteSpecialUnit(sheet, sheetRead, specials, extracts, lastAllot, false);
break;
}
logManage.ReturnTheLog(Allot.ID, 2, "写入数据", $"sheet“{sheet.SheetName}”已完成数据写入");
}
using (FileStream file = new FileStream(newPath, FileMode.OpenOrCreate))
{
......
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Performance.DtoModels.AppSettings;
using Performance.Infrastructure;
using Performance.Repository;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace Performance.Services
{
......@@ -12,14 +16,18 @@ public class LogManageService : IAutoInjection
{
private readonly ILogger<LogManageService> logger;
private readonly IHubContext<AllotLogHub> hubContext;
private readonly WebapiUrl url;
private PerforLogdbugRepository logdbug;
public LogManageService(
ILogger<LogManageService> logger,
IHubContext<AllotLogHub> hubContext,
IOptions<WebapiUrl> url,
PerforLogdbugRepository logdbug)
{
this.logger = logger;
this.hubContext = hubContext;
this.url = url.Value;
this.logdbug = logdbug;
}
......@@ -37,8 +45,48 @@ public void WriteMsg(string tag, string message, int level, int allotId, string
hubContext.Clients.Group(allotId.ToString()).SendAsync(method, tag, message, level);
if (isDebug)
{
logdbug.Add(allotId, tag, message, level);
logdbug.Add(allotId, tag, message, level, 1);
}
}
/// <summary>
/// 抽取进度
/// </summary>
/// <param name="allotId"></param>
/// <param name="ratio"></param>
/// <param name="level">等级1、信息(info)2、警告(warn)3、错误(error)4、异常(exception)5、成功(success)</param>
/// <param name="success"></param>
public void Schedule(int allotId, decimal ratio, int level = 1, bool success = false)
{
if (!success && ratio > 100) ratio = 99;
if (success && ratio != 100) ratio = 100;
hubContext.Clients.Group($"Extract{allotId}").SendAsync("Schedule", ratio, level);
}
/// <summary>
/// 抽取日志
/// </summary>
/// <param name="allotId"></param>
/// <param name="tag"></param>
/// <param name="message"></param>
/// <param name="level">等级1、信息(info)2、警告(warn)3、错误(error)4、异常(exception)5、成功(success)</param>
public void ExtractLog(int allotId, string tag, string message, int level = 1)
{
hubContext.Clients.Group($"Extract{allotId}").SendAsync("ExtractLog", tag, message, level);
}
public void ReturnTheLog(int allotId, int type, string tag, object message, int level = 1, bool success = false)
{
logdbug.Add(allotId, tag, message.ToString(), level, type);
HttpHelper.HttpPostNoRequest(url.ImportFile + $"/template/returnlog?allotId={allotId}&type={type}&tag={tag}&message={message}&level={level}&success={success}", "");
}
public bool ClearExtractLog(int allotId)
{
return logdbug.ClearExtractLog(allotId);
}
}
}
......@@ -573,7 +573,7 @@ private SheetExportResponse AddFactor(SheetExportResponse response, Row row, Lis
string[] array = new string[] { "核算单元", "科室名称" };
foreach (var header in headList.Where(t => !t.ParentID.HasValue || t.ParentID.Value == 0))
{
if (!array.Contains(header.CellValue))
if (!array.Contains(header.CellValue) && dataList != null && dataList.Any())
{
var value = dataList.FirstOrDefault(t => t.AllotID == header.AllotID && t.SheetID == header.SheetID && t.IsFactor == 1
&& t.TypeName == header.CellValue);
......@@ -586,7 +586,7 @@ private SheetExportResponse AddFactor(SheetExportResponse response, Row row, Lis
string[] array = new string[] { "核算单元(医技组)", "核算单元(医生组)", "核算单元(护理组)", "科室名称" };
foreach (var header in headList.Where(t => !t.ParentID.HasValue || t.ParentID.Value == 0))
{
if (!array.Contains(header.CellValue))
if (!array.Contains(header.CellValue) && dataList != null && dataList.Any())
{
var value = dataList.FirstOrDefault(t => t.AllotID == header.AllotID && t.SheetID == header.SheetID && t.IsFactor == 1
&& t.TypeName == header.CellValue && t.UnitType == (int)unitType);
......
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