备注说明

parent f89c2766
...@@ -48,6 +48,18 @@ public Startup(IConfiguration configuration) ...@@ -48,6 +48,18 @@ public Startup(IConfiguration configuration)
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
#region appsetting注入
services
.Configure<AppConnection>(Configuration.GetSection("AppConnection"))
.Configure<Application>(Configuration.GetSection("Application"))
.Configure<HuyiSmsConfig>(Configuration.GetSection("HuyiSmsConfig"))
.Configure<EmailOptions>(Configuration.GetSection("EmailOptions"));
#endregion
var connection = services.BuildServiceProvider().GetService<IOptions<AppConnection>>();
#region json & fluentvalidation & filter
services services
//筛选器配置 //筛选器配置
.AddMvc(option => .AddMvc(option =>
...@@ -81,32 +93,37 @@ public void ConfigureServices(IServiceCollection services) ...@@ -81,32 +93,37 @@ public void ConfigureServices(IServiceCollection services)
fv.RegisterValidatorsFromAssemblyContaining(type.GetType()); fv.RegisterValidatorsFromAssemblyContaining(type.GetType());
} }
}); });
#endregion
//automapper 配置 #region automapper
Mapper.Initialize(cfg => cfg.AddProfile<AutoMapperConfigs>()); Mapper.Initialize(cfg => cfg.AddProfile<AutoMapperConfigs>());
services.AddAutoMapper(); services.AddAutoMapper();
#endregion
//service注入 repoitory注入 #region service注入 repoitory注入
services services
.AddPerformanceService() .AddPerformanceService()
.AddPerformanceRepoitory(); .AddPerformanceRepoitory();
#endregion
//appsetting注入 #region swagger
services
.Configure<AppConnection>(Configuration.GetSection("AppConnection"))
.Configure<Application>(Configuration.GetSection("Application"))
.Configure<HuyiSmsConfig>(Configuration.GetSection("HuyiSmsConfig"))
.Configure<EmailOptions>(Configuration.GetSection("EmailOptions"));
//services.AddSwaggerGen(c => //services.AddSwaggerGen(c =>
//{ //{
// c.SwaggerDoc("v1", new Info { Title = "My API", Version = "v1" }); // c.SwaggerDoc("v1", new Info { Title = "My API", Version = "v1" });
//}); //});
#endregion
#region custom util
//huyi短信发送注入 //huyi短信发送注入
services.AddScoped<HuyiSmsNotify>(); services.AddScoped<HuyiSmsNotify>();
//用户身份信息服务 //用户身份信息服务
services.AddScoped<ClaimService>(); services.AddScoped<ClaimService>();
#endregion
#region email
//阿里邮箱配置 //阿里邮箱配置
var emailOption = services.BuildServiceProvider().GetService<IOptions<EmailOptions>>(); var emailOption = services.BuildServiceProvider().GetService<IOptions<EmailOptions>>();
//邮件发送 //邮件发送
...@@ -117,24 +134,27 @@ public void ConfigureServices(IServiceCollection services) ...@@ -117,24 +134,27 @@ public void ConfigureServices(IServiceCollection services)
options.SmtpServer = emailOption.Value.SmtpServer; options.SmtpServer = emailOption.Value.SmtpServer;
}); });
//ef配置 #endregion
var connection = services.BuildServiceProvider().GetService<IOptions<AppConnection>>();
//redis #region redis
var csredis = new CSRedis.CSRedisClient(connection.Value.RedisConnectionString); var csredis = new CSRedis.CSRedisClient(connection.Value.RedisConnectionString);
RedisHelper.Initialization(csredis); RedisHelper.Initialization(csredis);
#endregion
//后台任务调度 #region hangfire
services.AddHangfire(config => services.AddHangfire(config =>
{ {
config.UseFilter(new AutomaticRetryAttribute { Attempts = 0 }); config.UseFilter(new AutomaticRetryAttribute { Attempts = 0 });
config.UseStorage(new MySqlStorage(connection.Value.HangfireConnectionString)); config.UseStorage(new MySqlStorage(connection.Value.HangfireConnectionString));
}); });
#endregion
#region //ef配置
services.AddDbContext<PerformanceDbContext>(options => services.AddDbContext<PerformanceDbContext>(options =>
{ {
options.UseMySQL(connection.Value.PerformanceConnectionString); options.UseMySQL(connection.Value.PerformanceConnectionString);
}); });
#endregion
} }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
...@@ -160,13 +180,20 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF ...@@ -160,13 +180,20 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
// c.RoutePrefix = string.Empty; // c.RoutePrefix = string.Empty;
//}); //});
#region hangfire
app.UseHangfireServer(); app.UseHangfireServer();
app.UseHangfireDashboard("/hangfire", new DashboardOptions { Authorization = new[] { new HangfireAuthorizationFilter() } }); app.UseHangfireDashboard("/hangfire", new DashboardOptions { Authorization = new[] { new HangfireAuthorizationFilter() } });
#endregion
loggerFactory.CreateLogger<Startup>().LogDebug(env.EnvironmentName); loggerFactory.CreateLogger<Startup>().LogDebug(env.EnvironmentName);
app.UseMvc(); app.UseMvc();
} }
} }
#region hangfire 权限
public class HangfireAuthorizationFilter : Hangfire.Dashboard.IDashboardAuthorizationFilter public class HangfireAuthorizationFilter : Hangfire.Dashboard.IDashboardAuthorizationFilter
{ {
//这里需要配置权限规则 //这里需要配置权限规则
...@@ -175,4 +202,5 @@ public bool Authorize(Hangfire.Dashboard.DashboardContext context) ...@@ -175,4 +202,5 @@ public bool Authorize(Hangfire.Dashboard.DashboardContext context)
return true; return true;
} }
} }
#endregion
} }
...@@ -10,7 +10,19 @@ public class CheckDataService : IAutoInjection ...@@ -10,7 +10,19 @@ public class CheckDataService : IAutoInjection
{ {
internal bool Check(PerExcel excel, per_allot allot) internal bool Check(PerExcel excel, per_allot allot)
{ {
//sheet页名称分类
//空行数据警告
//科室收入项 总费用相等 校验
//匹配绩效参考标准
return true; return true;
} }
} }
} }
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
namespace Performance.Services.AllotCompute namespace Performance.Services.AllotCompute
{ {
/// <summary>
/// 导入excel数据并保持
/// </summary>
public class ImportDataService : IAutoInjection public class ImportDataService : IAutoInjection
{ {
private PerSheetService perSheetService; private PerSheetService perSheetService;
......
...@@ -9,6 +9,9 @@ ...@@ -9,6 +9,9 @@
namespace Performance.Services.AllotCompute namespace Performance.Services.AllotCompute
{ {
/// <summary>
/// 对excel导入数据进行合并、计算 并保存
/// </summary>
public class ProcessComputService : IAutoInjection public class ProcessComputService : IAutoInjection
{ {
private PerforCofincomeRepository perforCofincomeRepository; private PerforCofincomeRepository perforCofincomeRepository;
...@@ -38,6 +41,12 @@ public class ProcessComputService : IAutoInjection ...@@ -38,6 +41,12 @@ public class ProcessComputService : IAutoInjection
this.perforResAccountnurseRepository = perforResAccountnurseRepository; this.perforResAccountnurseRepository = perforResAccountnurseRepository;
} }
/// <summary>
/// 合并计算并保存
/// </summary>
/// <param name="excel"></param>
/// <param name="allot"></param>
/// <returns></returns>
public List<PerSheet> MergeAndSave(PerExcel excel, per_allot allot) public List<PerSheet> MergeAndSave(PerExcel excel, per_allot allot)
{ {
List<PerSheet> list = MergeCompute(excel); List<PerSheet> list = MergeCompute(excel);
...@@ -45,6 +54,7 @@ public List<PerSheet> MergeAndSave(PerExcel excel, per_allot allot) ...@@ -45,6 +54,7 @@ public List<PerSheet> MergeAndSave(PerExcel excel, per_allot allot)
return list; return list;
} }
#region save
/// <summary> /// <summary>
/// 保存计算后的医生组绩效 /// 保存计算后的医生组绩效
/// </summary> /// </summary>
...@@ -159,7 +169,9 @@ private void Save(List<PerSheet> perSheets, int allotId) ...@@ -159,7 +169,9 @@ private void Save(List<PerSheet> perSheets, int allotId)
} }
} }
} }
#endregion
#region compute
/// <summary> /// <summary>
/// 合并计算 /// 合并计算
/// </summary> /// </summary>
...@@ -263,5 +275,6 @@ private List<CofDrugProp> GetDrugConfig(PerExcel excel) ...@@ -263,5 +275,6 @@ private List<CofDrugProp> GetDrugConfig(PerExcel excel)
} }
return cofs; return cofs;
} }
#endregion
} }
} }
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
namespace Performance.Services.AllotCompute namespace Performance.Services.AllotCompute
{ {
/// <summary>
/// 最终绩效计算
/// </summary>
public class ResultComputeService : IAutoInjection public class ResultComputeService : IAutoInjection
{ {
private ComputeDirector computeDirector; private ComputeDirector computeDirector;
......
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