Commit 173a1b4c by lcx

二次绩效添加日志,同项目配置抽取

parent e75d6f96
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
using Performance.EntityModels; using Performance.EntityModels;
using Performance.Infrastructure; using Performance.Infrastructure;
using Performance.Services; using Performance.Services;
using Performance.Services.ExtractExcelService;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
...@@ -26,6 +27,7 @@ public class TemplateController : Controller ...@@ -26,6 +27,7 @@ public class TemplateController : Controller
private readonly TemplateService templateService; private readonly TemplateService templateService;
private readonly DFExtractService extractService; private readonly DFExtractService extractService;
private readonly ExtractIncomeService extractIncomeService; private readonly ExtractIncomeService extractIncomeService;
private readonly ExtractService extractEService;
private HospitalService hospitalService; private HospitalService hospitalService;
private IHostingEnvironment env; private IHostingEnvironment env;
private ClaimService claim; private ClaimService claim;
...@@ -39,6 +41,7 @@ public class TemplateController : Controller ...@@ -39,6 +41,7 @@ public class TemplateController : Controller
HospitalService hospitalService, HospitalService hospitalService,
DFExtractService extractService, DFExtractService extractService,
ExtractIncomeService extractIncomeService, ExtractIncomeService extractIncomeService,
ExtractService extractEService,
IHostingEnvironment env, IHostingEnvironment env,
ClaimService claim, ClaimService claim,
IOptions<Application> options, IOptions<Application> options,
...@@ -50,6 +53,7 @@ public class TemplateController : Controller ...@@ -50,6 +53,7 @@ public class TemplateController : Controller
this.templateService = templateService; this.templateService = templateService;
this.extractService = extractService; this.extractService = extractService;
this.extractIncomeService = extractIncomeService; this.extractIncomeService = extractIncomeService;
this.extractEService = extractEService;
this.hospitalService = hospitalService; this.hospitalService = hospitalService;
this.env = env; this.env = env;
this.claim = claim; this.claim = claim;
...@@ -232,7 +236,8 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest ...@@ -232,7 +236,8 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
// 判断是那种抽取 // 判断是那种抽取
try try
{ {
string message = extractService.Judge(request.AllotId, request.HospitalId, request.UseScheme, out string filePath); bool isSingle = false;
string message = extractService.Judge(request.AllotId, request.HospitalId, request.UseScheme, ref isSingle, out string filePath);
if (!string.IsNullOrEmpty(message)) if (!string.IsNullOrEmpty(message))
return new ApiResponse(ResponseType.Fail, message); return new ApiResponse(ResponseType.Fail, message);
...@@ -241,15 +246,20 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest ...@@ -241,15 +246,20 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
return new ApiResponse(ResponseType.OK, "正在提取数据,请稍等!", new { IsExtracting = true }); return new ApiResponse(ResponseType.OK, "正在提取数据,请稍等!", new { IsExtracting = true });
allot.IsExtracting = 1; allot.IsExtracting = 1;
allotService.Update(allot); allotService.Update(allot);
string email = claim.GetUserClaim(JwtClaimTypes.Mail);
//request.Email = claim.GetUserClaim(JwtClaimTypes.Mail); if (isSingle)
logger.LogInformation("提取绩效数据请求路径:" + url.HttpPost + "/extract/extract"); {
//HttpHelper.HttpPostNoRequest(url.HttpPost + "/extract/extract", JsonHelper.Serialize(request), true); extractEService.Main(allot.ID, allot.HospitalId, email, "User" + claim.GetUserId(), filePath, true);
}
if (string.IsNullOrEmpty(filePath))
HttpHelper.HttpPostNoRequest(url.HttpPost + $"/extract/extract?allotId={request.AllotId}&hospitalId={request.HospitalId}&email={claim.GetUserClaim(JwtClaimTypes.Mail)}&userId={claim.GetUserId()}", "");
else else
HttpHelper.HttpClient(url.HttpPost + $"/extract/extract?allotId={request.AllotId}&hospitalId={request.HospitalId}&email={claim.GetUserClaim(JwtClaimTypes.Mail)}&userId={claim.GetUserId()}", filePath, true); {
logger.LogInformation("提取绩效数据请求路径:" + url.HttpPost + "/extract/extract");
if (string.IsNullOrEmpty(filePath))
HttpHelper.HttpPostNoRequest(url.HttpPost + $"/extract/extract?allotId={request.AllotId}&hospitalId={request.HospitalId}&email={email}&userId={claim.GetUserId()}", "");
else
HttpHelper.HttpClient(url.HttpPost + $"/extract/extract?allotId={request.AllotId}&hospitalId={request.HospitalId}&email={email}&userId={claim.GetUserId()}", filePath, true);
}
return new ApiResponse(ResponseType.OK, "HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!", new { IsExtracting = false }); return new ApiResponse(ResponseType.OK, "HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!", new { IsExtracting = false });
} }
......
...@@ -105,5 +105,10 @@ public class sys_hospital ...@@ -105,5 +105,10 @@ public class sys_hospital
/// 是否开启行政后勤二次绩效分配 1 启用 2 禁用 /// 是否开启行政后勤二次绩效分配 1 启用 2 禁用
/// </summary> /// </summary>
public Nullable<int> IsOpenLogisticsSecondAllot { get; set; } public Nullable<int> IsOpenLogisticsSecondAllot { get; set; }
/// <summary>
/// 抽取项目是否在同一环境 1 是 2 否
/// </summary>
public Nullable<int> IsSingleProject { get; set; }
} }
} }
...@@ -153,8 +153,8 @@ public void ExtractData([FromForm] IFormCollection form, int allotId, int hospit ...@@ -153,8 +153,8 @@ public void ExtractData([FromForm] IFormCollection form, int allotId, int hospit
#endregion #endregion
//string filePath = newExtractService.ExtractData(allotId, request.Email, hospitalId); //string filePath = newExtractService.ExtractData(allotId, request.Email, hospitalId);
string filePath = extractService.ExtractData(allotId, email, hospitalId, "User" + userId, path); //抽取 //string filePath = extractService.ExtractData(allotId, email, hospitalId, "User" + userId, path); //抽取
//string filePath = extractService1.Main(allotId, hospitalId, email, "User" + userId, path); string filePath = extractService1.Main(allotId, hospitalId, email, "User" + userId, path);
#region 保存文件到网站下 #region 保存文件到网站下
......
...@@ -77,7 +77,8 @@ public IEnumerable<CollectPermission> GetCollectContent(int hospitalId, int user ...@@ -77,7 +77,8 @@ public IEnumerable<CollectPermission> GetCollectContent(int hospitalId, int user
var types = new[] { (int)SheetType.Employee, (int)SheetType.OtherIncome, (int)SheetType.Expend, (int)SheetType.Workload, var types = new[] { (int)SheetType.Employee, (int)SheetType.OtherIncome, (int)SheetType.Expend, (int)SheetType.Workload,
(int)SheetType.ClinicEmployee, (int)SheetType.AccountExtra, (int)SheetType.PersonExtra, (int)SheetType.LogisticsEmployee, (int)SheetType.ClinicEmployee, (int)SheetType.AccountExtra, (int)SheetType.PersonExtra, (int)SheetType.LogisticsEmployee,
(int)SheetType.AccountDrugAssess, (int)SheetType.AccountMaterialsAssess}; (int)SheetType.AccountDrugAssess, (int)SheetType.AccountMaterialsAssess, (int)SheetType.AccountScoreAverage,
(int)SheetType.BudgetRatio, (int)SheetType.AssessBeforeOtherFee };
var sheets = perforPersheetRepository.GetEntities(w => w.AllotID == allot.ID && types.Contains((w.SheetType ?? 0))); var sheets = perforPersheetRepository.GetEntities(w => w.AllotID == allot.ID && types.Contains((w.SheetType ?? 0)));
var headers = perforImheaderRepository.GetEntities(w => w.AllotID == allot.ID); var headers = perforImheaderRepository.GetEntities(w => w.AllotID == allot.ID);
......
...@@ -2443,7 +2443,7 @@ public void OutToExcelCell<T>(ICell cell, object obj, T defaultValue = default) ...@@ -2443,7 +2443,7 @@ public void OutToExcelCell<T>(ICell cell, object obj, T defaultValue = default)
/// <param name="allotId"></param> /// <param name="allotId"></param>
/// <param name="hospitalId"></param> /// <param name="hospitalId"></param>
/// <param name="useTemplate"></param> /// <param name="useTemplate"></param>
public string Judge(int allotId, int hospitalId, int useTemplate, out string filePath) public string Judge(int allotId, int hospitalId, int useTemplate, ref bool isSingle, out string filePath)
{ {
string result = null; string result = null;
filePath = ""; filePath = "";
...@@ -2457,6 +2457,7 @@ public string Judge(int allotId, int hospitalId, int useTemplate, out string fil ...@@ -2457,6 +2457,7 @@ public string Judge(int allotId, int hospitalId, int useTemplate, out string fil
var hospital = perforHospitalRepository.GetEntity(t => t.ID == hospitalId); var hospital = perforHospitalRepository.GetEntity(t => t.ID == hospitalId);
if (hospital == null) if (hospital == null)
throw new PerformanceException("医院ID错误"); throw new PerformanceException("医院ID错误");
isSingle = (hospital.IsSingleProject ?? 2) == 1;
// 获取医院配置信息 // 获取医院配置信息
var hospitalConfigList = perforHospitalconfigRepository.GetEntities(t => t.HospitalId == hospitalId); var hospitalConfigList = perforHospitalconfigRepository.GetEntities(t => t.HospitalId == hospitalId);
if (hospitalConfigList == null || hospitalConfigList.Count == 0) if (hospitalConfigList == null || hospitalConfigList.Count == 0)
......
...@@ -376,7 +376,7 @@ public bool Audit(int allotId) ...@@ -376,7 +376,7 @@ public bool Audit(int allotId)
public List<per_apr_amount> GetAprList(int allotId) public List<per_apr_amount> GetAprList(int allotId)
{ {
var list = perapramountRepository.GetEntities(t => t.AllotId == allotId && t.Amount != 0); var list = perapramountRepository.GetEntities(t => t.AllotId == allotId && (t.Amount ?? 0) != 0);
if (list != null && list.Any()) if (list != null && list.Any())
list = list.OrderBy(t => t.DoctorName).ToList(); list = list.OrderBy(t => t.DoctorName).ToList();
...@@ -385,7 +385,7 @@ public List<per_apr_amount> GetAprList(int allotId) ...@@ -385,7 +385,7 @@ public List<per_apr_amount> GetAprList(int allotId)
public List<per_apr_amount> GetAprList(int allotId, string accountingUnit, string department) public List<per_apr_amount> GetAprList(int allotId, string accountingUnit, string department)
{ {
var list = perapramountRepository.GetEntities(t => t.AllotId == allotId && t.Amount != 0 && (t.AccountingUnit ?? "") == accountingUnit && (t.TypeInDepartment ?? "") == department); var list = perapramountRepository.GetEntities(t => t.AllotId == allotId && (t.Amount ?? 0) != 0 && (t.AccountingUnit ?? "") == accountingUnit && (t.TypeInDepartment ?? "") == department);
if (list != null && list.Any()) if (list != null && list.Any())
list = list.OrderBy(t => t.DoctorName).ToList(); list = list.OrderBy(t => t.DoctorName).ToList();
......
...@@ -55,42 +55,48 @@ PerforPeremployeeRepository peremployeeRepository ...@@ -55,42 +55,48 @@ PerforPeremployeeRepository peremployeeRepository
/// <param name="email">邮箱地址</param> /// <param name="email">邮箱地址</param>
/// <param name="groupName">即时日志分组名称</param> /// <param name="groupName">即时日志分组名称</param>
/// <param name="filePath">历史提交文件地址</param> /// <param name="filePath">历史提交文件地址</param>
public string Main(int allotId, int hospitalId, string email, string groupName = null, string filePath = null) /// <param name="isSingle">抽取是否在同一项目</param>
public string Main(int allotId, int hospitalId, string email, string groupName, string filePath = null, bool isSingle = false)
{ {
string extractFilePath = ""; string extractFilePath = "";
IWorkbook workbook = null; IWorkbook workbook = null;
try try
{ {
logService.ClearExtractLog(allotId); logService.ReturnTheLog(allotId, groupName, 2, "等待提取", $"确认配置信息是否可完成数据提取...", 1, isSingle);
var hospital = hospitalRepository.GetEntity(t => t.ID == hospitalId); logService.ClearExtractLog(allotId);
var allots = perallotRepository.GetEntities(t => t.HospitalId == hospitalId); var allots = perallotRepository.GetEntities(t => t.HospitalId == hospitalId);
if (allots == null || !allots.Any(t => t.ID == allotId)) throw new Exception("绩效不存在"); if (allots == null || !allots.Any(t => t.ID == allotId)) throw new Exception("绩效不存在");
var allot = allots.First(t => t.ID == allotId); var allot = allots.First(t => t.ID == allotId);
var dict = new Dictionary<ExDataDict, object>(); var dict = new Dictionary<ExDataDict, object>();
var data = queryService.Handler(hospitalId, allot, ref dict);
logService.ReturnTheLog(allotId, groupName, 3, "", 5, 1, isSingle);
var data = queryService.Handler(hospitalId, allot, groupName, isSingle, ref dict);
var standData = StandDataFormat(hospitalId, data); var standData = StandDataFormat(hospitalId, data);
var statesArray = new int[] { (int)AllotStates.GenerateSucceed, (int)AllotStates.Archive }; var statesArray = new int[] { (int)AllotStates.GenerateSucceed, (int)AllotStates.Archive };
var templateFilePath = ExtractHelper.GetExtractFile(hospitalId, ref extractFilePath, filePath); var templateFilePath = ExtractHelper.GetExtractFile(hospitalId, ref extractFilePath, filePath);
logService.ReturnTheLog(allotId, groupName, 2, "创建文件", $"模板文件: {templateFilePath}", 1, isSingle);
if (!FileHelper.IsExistFile(templateFilePath)) throw new PerformanceException("抽取文件创建失败"); if (!FileHelper.IsExistFile(templateFilePath)) throw new PerformanceException("抽取文件创建失败");
workbook = ExcelHelper.GetWorkbook(templateFilePath); workbook = ExcelHelper.GetWorkbook(templateFilePath);
if (workbook == null) throw new PerformanceException("文件读取失败"); if (workbook == null) throw new PerformanceException("文件读取失败");
WriteDataToFile(workbook, allotId, dict, standData); WriteDataToFile(workbook, allotId, dict, standData, groupName, isSingle);
logService.ReturnTheLog(allotId, groupName, 2, "提取完成", $"绩效数据提取成功", 5, isSingle);
} }
catch (Exception ex) catch (Exception ex)
{ {
logService.ReturnTheLog(allotId, groupName, 2, "提取完成", $"绩效数据提取失败", 4, isSingle);
logger.LogError("提取数据中发生异常: " + ex.ToString()); logger.LogError("提取数据中发生异常: " + ex.ToString());
} }
finally finally
{ {
logService.ReturnTheLog(allotId, groupName, 3, "", 100, 5, isSingle);
using (FileStream file = new FileStream(extractFilePath, FileMode.OpenOrCreate)) using (FileStream file = new FileStream(extractFilePath, FileMode.OpenOrCreate))
{ {
workbook.Write(file); workbook.Write(file);
...@@ -100,7 +106,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName = ...@@ -100,7 +106,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName =
return extractFilePath; return extractFilePath;
} }
private void WriteDataToFile(IWorkbook workbook, int allotId, Dictionary<ExDataDict, object> exdict, List<ExtractTransDto> extractDto) private void WriteDataToFile(IWorkbook workbook, int allotId, Dictionary<ExDataDict, object> exdict, List<ExtractTransDto> extractDto, string groupName, bool isSingle)
{ {
ExcelStyle style = new ExcelStyle(workbook); ExcelStyle style = new ExcelStyle(workbook);
...@@ -111,15 +117,22 @@ private void WriteDataToFile(IWorkbook workbook, int allotId, Dictionary<ExDataD ...@@ -111,15 +117,22 @@ private void WriteDataToFile(IWorkbook workbook, int allotId, Dictionary<ExDataD
var collectData = collectdataRepository.GetEntities(t => t.AllotID == allotId); var collectData = collectdataRepository.GetEntities(t => t.AllotID == allotId);
WriteDataFactory factory = new WriteDataFactory(); WriteDataFactory factory = new WriteDataFactory();
var types = new List<SheetType> { SheetType.OtherIncome, SheetType.Income, SheetType.Expend, SheetType.Workload }; var types = new List<SheetType> { SheetType.OtherIncome, SheetType.Income, SheetType.Expend, SheetType.Workload, SheetType.OtherWorkload };
decimal ratio = 60m;
for (int sheetIndex = 0; sheetIndex < workbook.NumberOfSheets; sheetIndex++) for (int sheetIndex = 0; sheetIndex < workbook.NumberOfSheets; sheetIndex++)
{ {
var sheet = workbook.GetSheetAt(sheetIndex); var sheet = workbook.GetSheetAt(sheetIndex);
ratio += 40m / workbook.NumberOfSheets;
var sheetType = perSheetService.GetSheetType(sheet.SheetName); var sheetType = perSheetService.GetSheetType(sheet.SheetName);
if (sheetType == SheetType.Unidentifiable) continue; if (sheetType == SheetType.Unidentifiable) continue;
logService.ReturnTheLog(allotId, groupName, 3, "", ratio > 99 ? 99 : ratio, 1, isSingle);
logService.ReturnTheLog(allotId, groupName, 2, "写入数据", $"sheet“{sheet.SheetName}”开始写入数据", 1, isSingle);
var point = PerSheetDataFactory.GetDataRead(sheetType)?.Point; var point = PerSheetDataFactory.GetDataRead(sheetType)?.Point;
if (sheetType == SheetType.OtherWorkload) point = PerSheetDataFactory.GetDataRead(SheetType.Workload)?.Point;
if (types.Contains(sheetType) && point != null && point.DataFirstCellNum.HasValue) if (types.Contains(sheetType) && point != null && point.DataFirstCellNum.HasValue)
ExtractHelper.ClearSheetPartialData(sheet, point, sheetType); ExtractHelper.ClearSheetPartialData(sheet, point, sheetType);
...@@ -135,6 +148,8 @@ private void WriteDataToFile(IWorkbook workbook, int allotId, Dictionary<ExDataD ...@@ -135,6 +148,8 @@ private void WriteDataToFile(IWorkbook workbook, int allotId, Dictionary<ExDataD
var data = GetDataBySheetType(sheetType, exdata, employeeDict); var data = GetDataBySheetType(sheetType, exdata, employeeDict);
customer.WriteSheetData(sheet, point, sheetType, style, data, exdict); customer.WriteSheetData(sheet, point, sheetType, style, data, exdict);
} }
logService.ReturnTheLog(allotId, groupName, 2, "写入数据", $"sheet“{sheet.SheetName}”已完成数据写入", 1, isSingle);
} }
} }
...@@ -215,22 +230,5 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re ...@@ -215,22 +230,5 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re
return groupdata.ToList(); return groupdata.ToList();
} }
//public void ProgressBar(int allotId, decimal ratio, int level = 1)
//{
// if (!string.IsNullOrEmpty(GroupName))
// {
// logService.ReturnTheLog(allotId, GroupName, 3, "", Math.Round(ratio, 2, MidpointRounding.AwayFromZero), level);
// }
//}
//public void Message(int allotId, string tag, string message, int level = 1)
//{
// if (!string.IsNullOrEmpty(GroupName))
// {
// logService.ReturnTheLog(allotId, GroupName, 2, tag, message, level);
// }
//}
} }
} }
using NPOI.SS.UserModel;
using Performance.DtoModels;
using Performance.EntityModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Performance.Services.ExtractExcelService.SheetDataWrite
{
public class OtherWorkloadDataWrite : ISheetDataWrite
{
public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, List<collect_data> collects)
{
if (collects == null || !collects.Any(t => !string.IsNullOrEmpty(t.TypeName))) return;
var columns = collects.Where(t => !string.IsNullOrEmpty(t.TypeName)).Select(t => t.TypeName).Distinct().OrderBy(t => t).ToList();
var headers = columns.Select(t => new ExcelHeader
{
ColumnName = t.Trim(),
DoctorFactor = 0,
NurseFactor = 0,
TechnicianFactor = 0
}).ToList();
WriteDataHelper.WriteSheetHeader(sheet, point, sheetType, style, headers);
WriteDataHelper.WriteCollectData(sheet, point, sheetType, style, columns, collects);
}
public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, object data, Dictionary<ExDataDict, object> exdict = null)
{
var modules = exdict[ExDataDict.ExModule] as List<ex_module>;
var module = modules?.FirstOrDefault(t => t.SheetType == (int)sheetType && t.ModuleName.NoBlank() == sheet.SheetName.NoBlank());
if (module == null) return;
var items = exdict[ExDataDict.ExItem] as List<ex_item>;
var modelItems = items?.Where(t => t.ModuleId == module.Id);
if (modelItems == null || !modelItems.Any()) return;
var headers = modelItems.Select(t => new ExcelHeader
{
ColumnName = t.ItemName,
WorkloadFactor = t.FactorValue1 ?? 0
}).ToList();
WriteDataHelper.WriteSheetHeader(sheet, point, sheetType, style, headers);
if (data is List<ExtractTransDto> extractDto && extractDto.Any())
{
var columns = headers.Select(t => t.ColumnName).Intersect(extractDto.Select(t => t.Category))?.ToList();
WriteDataHelper.WriteSheetData(sheet, point, sheetType, style, columns, extractDto);
}
}
}
}
...@@ -54,12 +54,6 @@ public void WriteMsg(string tag, string message, int level, int allotId, string ...@@ -54,12 +54,6 @@ public void WriteMsg(string tag, string message, int level, int allotId, string
/// <param name="success"></param> /// <param name="success"></param>
public void Schedule(string groupName, decimal ratio, int level) public void Schedule(string groupName, decimal ratio, int level)
{ {
ratio = Math.Round(ratio);
if (level != 5 && ratio > 100) ratio = 99;
if (level == 5 && ratio != 100) ratio = 100;
hubContext.Clients.Group(groupName).SendAsync("Schedule", ratio, level); hubContext.Clients.Group(groupName).SendAsync("Schedule", ratio, level);
} }
...@@ -72,18 +66,45 @@ public void Schedule(string groupName, decimal ratio, int level) ...@@ -72,18 +66,45 @@ public void Schedule(string groupName, decimal ratio, int level)
/// <param name="level">等级1、信息(info)2、警告(warn)3、错误(error)4、异常(exception)5、成功(success)</param> /// <param name="level">等级1、信息(info)2、警告(warn)3、错误(error)4、异常(exception)5、成功(success)</param>
public void ExtractLog(string groupName, string tag, string message, int level) public void ExtractLog(string groupName, string tag, string message, int level)
{ {
hubContext.Clients.Group(groupName).SendAsync("ExtractLog", tag, message, level); hubContext.Clients.Group(groupName).SendAsync("ExtractLog", tag, message, level);
} }
public void ReturnTheLog(int allotId, string groupName, int type, string tag, object message, int level = 1) /// <summary>
///
/// </summary>
/// <param name="allotId"></param>
/// <param name="groupName"></param>
/// <param name="type">1、绩效生成日志 2、绩效提取日志 3、绩效提取进度</param>
/// <param name="tag"></param>
/// <param name="message"></param>
/// <param name="level">1、信息(info)2、警告(warn)3、错误(error)4、异常(exception)5、成功(success)</param>
/// <param name="isSingle"></param>
public void ReturnTheLog(int allotId, string groupName, int type, string tag, object message, int level = 1, bool isSingle = false)
{ {
try try
{ {
var http = url.ImportFile + $"/template/returnlog?type={type}&tag={tag}&message={message}&level={level}&groupName={groupName}"; string content = ""; decimal ratio = 0;
//logger.LogInformation("发送日志:" + http); if (type == 2)
logdbug.Add(allotId, tag, message.ToString(), level, type); {
HttpHelper.HttpPost(http); ratio = Math.Round(Convert.ToDecimal(message), 2, MidpointRounding.AwayFromZero);
if (level != 5 && ratio > 100) ratio = 99;
if (level == 5 && ratio != 100) ratio = 100;
content = ratio.ToString();
if (isSingle) hubContext.Clients.Group(groupName).SendAsync("Schedule", ratio, level);
}
else if (type == 3)
{
content = message.ToString();
logger.LogInformation(content);
if (isSingle) hubContext.Clients.Group(groupName).SendAsync("ExtractLog", tag, content, level);
}
logdbug.Add(allotId, tag, content, level, type);
if (!isSingle)
{
var http = url.ImportFile + $"/template/returnlog?type={type}&tag={tag}&message={content}&level={level}&groupName={groupName}";
HttpHelper.HttpPost(http);
}
} }
catch (Exception ex) catch (Exception ex)
{ {
......
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