Commit ebc7135c by lcx

抽取时4.1及5.*补充科室修改,优先抽取4.1,兼容核算单元类别写入,nolg配置修改,优化抽取跳过抽取数据全为0的科室

parent 4ce6a08f
......@@ -6,8 +6,8 @@ public class JobRegistry : Registry
{
public JobRegistry()
{
Schedule<ExtractDataJob>().ToRunNow().AndEvery(1).Days().At(23, 0);
//Schedule<ExtractDataJob>().ToRunEvery(1).Days().At(23, 0);
//Schedule<ExtractDataJob>().ToRunNow().AndEvery(1).Days().At(23, 0);
Schedule<ExtractDataJob>().ToRunEvery(1).Days().At(23, 0);
}
}
}
......@@ -69,7 +69,7 @@
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
<Content Update="nlog.config">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\Performance.Api.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
......
......@@ -15,7 +15,19 @@ public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
var logger = NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger();
try
{
CreateWebHostBuilder(args).Build().Run();
}
catch (Exception ex)
{
logger.Error(ex, "Stopped program because of exception");
}
finally
{
NLog.LogManager.Shutdown();
}
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
......@@ -25,9 +37,14 @@ public static void Main(string[] args)
var env = context.HostingEnvironment;
config.AddJsonFile("appsettings.json", true, true);
config.AddJsonFile($"appsettings.{env.EnvironmentName}.json", true, true);
env.ConfigureNLog("nlog.config");
})
.UseUrls("http://*:5001")
.ConfigureLogging(logging =>
{
logging.ClearProviders();
logging.SetMinimumLevel(LogLevel.Trace);
})
.UseNLog()
.UseStartup<Startup>();
}
}
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!--
此文件由 Web 项目的发布/打包过程使用。可以通过编辑此 MSBuild 文件
自定义此过程的行为。为了解与此相关的更多内容,请访问 https://go.microsoft.com/fwlink/?LinkID=208121。
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<PublishProvider>FileSystem</PublishProvider>
<DeleteExistingFiles>True</DeleteExistingFiles>
<ExcludeApp_Data>False</ExcludeApp_Data>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>bin\Release\netcoreapp2.2\publish\</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<TargetFramework>netcoreapp2.2</TargetFramework>
<ProjectGuid>3ae00ff5-f0ba-4d72-a23b-770186309327</ProjectGuid>
<SelfContained>false</SelfContained>
<_IsPortable>true</_IsPortable>
<publishUrl>E:\release\jx.suvalue.com</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
</PropertyGroup>
</Project>
\ No newline at end of file
......@@ -215,9 +215,8 @@ public void ConfigureServices(IServiceCollection services)
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
loggerFactory.AddNLog();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
......@@ -248,8 +247,6 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
app.UseCors("SignalrCore");
app.UseSignalR(routes => routes.MapHub<AllotLogHub>("/performance/allotLogHub"));
loggerFactory.CreateLogger<Startup>().LogDebug(env.EnvironmentName);
app.UseMvc();
}
}
......
......@@ -1325,13 +1325,13 @@
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.SecondAllotController.WorkTypeList(Performance.DtoModels.WorkloadRequest)">
<member name="M:Performance.Api.Controllers.SecondAllotController.WorkTypeList(Performance.DtoModels.WorkloadRequest,System.Int32)">
<summary>
二次绩效工作量类型列表
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.SecondAllotController.SingleSave(Performance.EntityModels.ag_workload_type)">
<member name="M:Performance.Api.Controllers.SecondAllotController.SingleSave(Performance.EntityModels.ag_workload_type,System.Int32)">
<summary>
保存二次绩效工作量类型
</summary>
......
......@@ -132,7 +132,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
if (string.IsNullOrEmpty(department)) continue;
var deptData = data.Where(t => t.Department == department);
if (deptData == null || !deptData.Any()) continue;
if (deptData == null || !deptData.Any(t => t.Value.HasValue && t.Value != 0)) continue;
#region 写入数据
......@@ -354,7 +354,7 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
if (string.IsNullOrEmpty(department)) continue;
var deptData = data.Where(t => t.Department == department);
if (deptData == null || !deptData.Any()) continue;
if (deptData == null || !deptData.Any(t => !string.IsNullOrEmpty(t.CellValue))) continue;
#region 写入数据
......
......@@ -41,6 +41,8 @@ PerforPerallotRepository perallotRepository
public void Execute()
{
logger.LogInformation("Initial ExtractJobService");
var hospitals = hospitalRepository.GetEntities(w => w.IsOpenTimedTasks == 1);
if (hospitals == null || !hospitals.Any()) return;
......
......@@ -141,14 +141,41 @@ private void WriteDataToFile(IWorkbook workbook, per_allot allot, Dictionary<ExD
WriteDataFactory factory = new WriteDataFactory();
var types = new List<SheetType> { SheetType.OtherIncome, SheetType.Income, SheetType.Expend, SheetType.Workload, SheetType.OtherWorkload/*, SheetType.AccountBasic*/ };
decimal ratio = 60m;
string accountBasicSheetName = "";
for (int sheetIndex = 0; sheetIndex < workbook.NumberOfSheets; sheetIndex++)
{
var sheetName = workbook.GetSheetAt(sheetIndex).SheetName;
if (!sheetName.StartsWith("4.1"))
continue;
accountBasicSheetName = sheetName;
break;
}
var accountBasicSheet = workbook.GetSheet(accountBasicSheetName);
HandleSheet(workbook, allot, exdict, extractDto, groupName, isSingle, accountBasicSheet, ratio, types, factory, style, employeeDict, collectData);
for (int sheetIndex = 0; sheetIndex < workbook.NumberOfSheets; sheetIndex++)
{
var sheet = workbook.GetSheetAt(sheetIndex);
HandleSheet(workbook, allot, exdict, extractDto, groupName, isSingle, sheet, ratio, types, factory, style, employeeDict, collectData);
}
}
private void HandleSheet(IWorkbook workbook, per_allot allot, Dictionary<ExDataDict, object> exdict, List<ExtractTransDto> extractDto, string groupName, bool isSingle,
ISheet sheet, decimal ratio, List<SheetType> types, WriteDataFactory factory, ExcelStyle style, List<per_employee> employeeDict, List<collect_data> collectData)
{
try
{
if (sheet == null) return;
string sheetName = sheet.SheetName.NoBlank();
ratio += 40m / workbook.NumberOfSheets;
var sheetType = perSheetService.GetSheetType(sheet.SheetName);
if (sheetType == SheetType.Unidentifiable) continue;
if (sheetType == SheetType.Unidentifiable) return;
logService.ReturnTheLog(allot.ID, groupName, 3, "", ratio > 99 ? 99 : ratio, 1, isSingle);
logService.ReturnTheLog(allot.ID, groupName, 2, "写入数据", $"sheet“{sheet.SheetName}”开始写入数据", 1, isSingle);
......@@ -179,6 +206,10 @@ private void WriteDataToFile(IWorkbook workbook, per_allot allot, Dictionary<ExD
logService.ReturnTheLog(allot.ID, groupName, 2, "写入数据", $"sheet“{sheet.SheetName}”已完成数据写入", 1, isSingle);
}
catch (Exception ex)
{
logger.LogError("写入数据时发生异常:" + ex);
}
}
private object GetDataBySheetType(int hospitalId, SheetType sheetType, List<ExtractTransDto> extractDto, List<per_employee> employeeDict)
......
......@@ -143,6 +143,8 @@ private void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheet
private static readonly Dictionary<string, Func<Account, string>> collectExtra = new Dictionary<string, Func<Account, string>>
{
{ "核算单元类型", (dto) => dto.UnitType },
{ "核算组别", (dto) => dto.UnitType },
{ "核算单元分类", (dto) => dto.UnitType },
{ "核算单元", (dto) => dto.AccountingUnit },
};
}
......
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