no message

parent aba86203
...@@ -32,13 +32,13 @@ public class AgainAllotController : Controller ...@@ -32,13 +32,13 @@ public class AgainAllotController : Controller
private ComputeService computeService; private ComputeService computeService;
private ClaimService claimService; private ClaimService claimService;
private AllotService allotService; private AllotService allotService;
private IHostingEnvironment evn; private IHostingEnvironment env;
private ConfigService configService; private ConfigService configService;
private Application application; private Application application;
public AgainAllotController(AgainAllotService againAllotService, public AgainAllotController(AgainAllotService againAllotService,
ClaimService claimService, ClaimService claimService,
AllotService allotService, AllotService allotService,
IHostingEnvironment evn, IHostingEnvironment env,
ConfigService configService, ConfigService configService,
ComputeService computeService, ComputeService computeService,
IOptions<Application> options) IOptions<Application> options)
...@@ -46,7 +46,7 @@ public class AgainAllotController : Controller ...@@ -46,7 +46,7 @@ public class AgainAllotController : Controller
this.againAllotService = againAllotService; this.againAllotService = againAllotService;
this.claimService = claimService; this.claimService = claimService;
this.allotService = allotService; this.allotService = allotService;
this.evn = evn; this.env = env;
this.configService = configService; this.configService = configService;
this.computeService = computeService; this.computeService = computeService;
this.application = options.Value; this.application = options.Value;
...@@ -91,7 +91,7 @@ public ApiResponse Import([FromForm] IFormCollection form) ...@@ -91,7 +91,7 @@ public ApiResponse Import([FromForm] IFormCollection form)
var name = FileHelper.GetFileNameNoExtension(file.FileName) + DateTime.Now.ToString("yyyyMMddHHmmssfff"); var name = FileHelper.GetFileNameNoExtension(file.FileName) + DateTime.Now.ToString("yyyyMMddHHmmssfff");
var ext = FileHelper.GetExtension(file.FileName); var ext = FileHelper.GetExtension(file.FileName);
var dpath = Path.Combine(evn.ContentRootPath, "Files", $"{allot.HospitalId}", $"{allot.Year}{allot.Month.ToString().PadLeft(2, '0')}"); var dpath = Path.Combine(env.ContentRootPath.Substring(0, env.ContentRootPath.LastIndexOf("\\")), "Files", $"{allot.HospitalId}", $"{allot.Year}{allot.Month.ToString().PadLeft(2, '0')}");
FileHelper.CreateDirectory(dpath); FileHelper.CreateDirectory(dpath);
var path = Path.Combine(dpath, $"{name}{ext}"); var path = Path.Combine(dpath, $"{name}{ext}");
......
...@@ -120,7 +120,7 @@ public ApiResponse Import([FromForm] IFormCollection form) ...@@ -120,7 +120,7 @@ public ApiResponse Import([FromForm] IFormCollection form)
var name = FileHelper.GetFileNameNoExtension(file.FileName) + DateTime.Now.ToString("yyyyMMddHHmmssfff"); var name = FileHelper.GetFileNameNoExtension(file.FileName) + DateTime.Now.ToString("yyyyMMddHHmmssfff");
var ext = FileHelper.GetExtension(file.FileName); var ext = FileHelper.GetExtension(file.FileName);
var dpath = Path.Combine(_evn.ContentRootPath, "Files", $"{allot.HospitalId}", $"{allot.Year}{allot.Month.ToString().PadLeft(2, '0')}"); var dpath = Path.Combine(_evn.ContentRootPath.Substring(0, _evn.ContentRootPath.LastIndexOf("\\")), "Files", $"{allot.HospitalId}", $"{allot.Year}{allot.Month.ToString().PadLeft(2, '0')}");
FileHelper.CreateDirectory(dpath); FileHelper.CreateDirectory(dpath);
var path = Path.Combine(dpath, $"{name}{ext}"); var path = Path.Combine(dpath, $"{name}{ext}");
......
...@@ -69,7 +69,7 @@ public ApiResponse Import([FromForm] IFormCollection form) ...@@ -69,7 +69,7 @@ public ApiResponse Import([FromForm] IFormCollection form)
var name = FileHelper.GetFileNameNoExtension(file.FileName) + DateTime.Now.ToString("yyyyMMddHHmmssfff"); var name = FileHelper.GetFileNameNoExtension(file.FileName) + DateTime.Now.ToString("yyyyMMddHHmmssfff");
var ext = FileHelper.GetExtension(file.FileName); var ext = FileHelper.GetExtension(file.FileName);
var dpath = Path.Combine(evn.ContentRootPath, "Files", $"{hospitalid}", "first"); var dpath = Path.Combine(evn.ContentRootPath.Substring(0, evn.ContentRootPath.LastIndexOf("\\")), "Files", $"{hospitalid}", "first");
FileHelper.CreateDirectory(dpath); FileHelper.CreateDirectory(dpath);
var path = Path.Combine(dpath, $"{name}{ext}"); var path = Path.Combine(dpath, $"{name}{ext}");
...@@ -133,11 +133,17 @@ public IActionResult DownFile([FromQuery]AllotRequest request) ...@@ -133,11 +133,17 @@ public IActionResult DownFile([FromQuery]AllotRequest request)
{ {
return new ObjectResult(new ApiResponse(ResponseType.Fail, "文件不存在")); return new ObjectResult(new ApiResponse(ResponseType.Fail, "文件不存在"));
} }
var stream = new FileStream(allot.ExtractPath, FileMode.Open);
var memoryStream = new MemoryStream();
using (var stream = new FileStream(allot.ExtractPath, FileMode.Open))
{
stream.CopyToAsync(memoryStream).Wait();
}
memoryStream.Seek(0, SeekOrigin.Begin);
string fileExt = Path.GetExtension(allot.ExtractPath); string fileExt = Path.GetExtension(allot.ExtractPath);
var provider = new FileExtensionContentTypeProvider(); var provider = new FileExtensionContentTypeProvider();
var memi = provider.Mappings[fileExt]; var memi = provider.Mappings[fileExt];
return File(stream, memi, Path.GetFileName(allot.ExtractPath)); return File(memoryStream, memi, Path.GetFileName(allot.ExtractPath));
} }
} }
} }
\ No newline at end of file
...@@ -85,6 +85,7 @@ public ActionsFilter(ILoggerFactory factory, IMemoryCache cache, IHostingEnviron ...@@ -85,6 +85,7 @@ public ActionsFilter(ILoggerFactory factory, IMemoryCache cache, IHostingEnviron
if (executedContext.Result is ObjectResult) if (executedContext.Result is ObjectResult)
{ {
LogHelper.Information(JsonHelper.Serialize(executedContext.Result), "响应结果");
var objectResult = (ObjectResult)executedContext.Result; var objectResult = (ObjectResult)executedContext.Result;
var jsonData = JsonHelper.Serialize(objectResult.Value); var jsonData = JsonHelper.Serialize(objectResult.Value);
_logger.LogInformation($"响应结果:{jsonData}"); _logger.LogInformation($"响应结果:{jsonData}");
......
...@@ -187,7 +187,6 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF ...@@ -187,7 +187,6 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
app.UseHangfireDashboard("/hangfire", new DashboardOptions { Authorization = new[] { new HangfireAuthorizationFilter() } }); app.UseHangfireDashboard("/hangfire", new DashboardOptions { Authorization = new[] { new HangfireAuthorizationFilter() } });
#endregion #endregion
loggerFactory.CreateLogger<Startup>().LogDebug(env.EnvironmentName); loggerFactory.CreateLogger<Startup>().LogDebug(env.EnvironmentName);
app.UseMvc(); app.UseMvc();
} }
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
//护士长二次绩效管理员 //护士长二次绩效管理员
"NurseRole": "3", "NurseRole": "3",
//科主任二次绩效管理员 //科主任二次绩效管理员
"DirectorRole": "4" "DirectorRole": "4",
"AbsolutePath": "E:\\wwwroot\\testjx.suvalue.com",
"HttpPath": "http://testjx.suvalue.com:81"
} }
} }
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
//科主任二次绩效管理员 //科主任二次绩效管理员
"DirectorRole": "4", "DirectorRole": "4",
//邮件指定接收人 //邮件指定接收人
"Receiver": [ "chengxiang.li@suvalue.com", "486035085@qq.com" ] "Receiver": [ "chengxiang.li@suvalue.com", "486035085@qq.com" ],
"AbsolutePath": "E:\\wwwroot\\testjx.suvalue.com",
"HttpPath": "http://testjx.suvalue.com:81"
} }
} }
...@@ -30,5 +30,13 @@ public class Application ...@@ -30,5 +30,13 @@ public class Application
/// 邮件指定接收人 /// 邮件指定接收人
/// </summary> /// </summary>
public string[] Receiver { get; set; } public string[] Receiver { get; set; }
/// <summary>
/// 绝对路径
/// </summary>
public string AbsolutePath { get; set; }
/// <summary>
/// 相对
/// </summary>
public string HttpPath { get; set; }
} }
} }
...@@ -7,38 +7,38 @@ ...@@ -7,38 +7,38 @@
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("sys_extract")] [Table("sys_extract")]
public class sys_extract public class sys_extract
{ {
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
[Key] [Key]
public int Id { get; set; } public int Id { get; set; }
/// <summary> /// <summary>
/// 医院ID /// 医院ID
/// </summary> /// </summary>
public Nullable<int> HospitalId { get; set; } public Nullable<int> HospitalId { get; set; }
/// <summary> /// <summary>
/// EXCEL中SHEET名称 /// EXCEL中SHEET名称
/// </summary> /// </summary>
public string SheetName { get; set; } public string SheetName { get; set; }
/// <summary> /// <summary>
/// 执行脚本 /// 执行脚本
/// </summary> /// </summary>
public string ExecuteScript { get; set; } public string ExecuteScript { get; set; }
/// <summary> /// <summary>
/// 是否可用 1 可用 2 不可用 /// 是否可用 1 可用 2 不可用
/// </summary> /// </summary>
public string IsEnable { get; set; } public Nullable<int> IsEnable { get; set; }
} }
} }
...@@ -65,7 +65,7 @@ private static void WriteLog(string message, string[] tag, LogLevel logLevel) ...@@ -65,7 +65,7 @@ private static void WriteLog(string message, string[] tag, LogLevel logLevel)
{ {
try try
{ {
if (_contextAccessor.HttpContext == null) if (_contextAccessor.HttpContext == null || string.IsNullOrEmpty(_contextAccessor.HttpContext.TraceIdentifier))
{ {
if (string.IsNullOrEmpty(_asyncLocal.Value)) if (string.IsNullOrEmpty(_asyncLocal.Value))
lock (_lockObject) lock (_lockObject)
......
using AutoMapper; using AutoMapper;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Performance.DtoModels; using Performance.DtoModels;
using Performance.DtoModels.AppSettings;
using Performance.EntityModels; using Performance.EntityModels;
using Performance.Infrastructure; using Performance.Infrastructure;
using Performance.Repository; using Performance.Repository;
...@@ -28,6 +30,7 @@ public class AllotService : IAutoInjection ...@@ -28,6 +30,7 @@ public class AllotService : IAutoInjection
private ILogger<AllotService> _logger; private ILogger<AllotService> _logger;
private PerforPerallotRepository _allotRepository; private PerforPerallotRepository _allotRepository;
private IEmailService emailService; private IEmailService emailService;
private readonly IOptions<Application> options;
private PerforPeragainallotRepository _againallotRepository; private PerforPeragainallotRepository _againallotRepository;
private PerforLogcheckRepository perforLogcheckRepository; private PerforLogcheckRepository perforLogcheckRepository;
private readonly PerforHospitalRepository perforHospitalRepository; private readonly PerforHospitalRepository perforHospitalRepository;
...@@ -42,6 +45,7 @@ public class AllotService : IAutoInjection ...@@ -42,6 +45,7 @@ public class AllotService : IAutoInjection
PerforLogdbugRepository logdbug, PerforLogdbugRepository logdbug,
IHostingEnvironment evn, ILogger<AllotService> logger, IHostingEnvironment evn, ILogger<AllotService> logger,
IEmailService emailService, IEmailService emailService,
IOptions<Application> options,
PerforPeragainallotRepository againallotRepository, PerforPeragainallotRepository againallotRepository,
PerforLogcheckRepository perforLogcheckRepository, PerforLogcheckRepository perforLogcheckRepository,
PerforHospitalRepository perforHospitalRepository) PerforHospitalRepository perforHospitalRepository)
...@@ -56,6 +60,7 @@ public class AllotService : IAutoInjection ...@@ -56,6 +60,7 @@ public class AllotService : IAutoInjection
this.processComputService = processComputService; this.processComputService = processComputService;
this.resultComputeService = resultComputeService; this.resultComputeService = resultComputeService;
this.emailService = emailService; this.emailService = emailService;
this.options = options;
this.configService = configService; this.configService = configService;
this.logdbug = logdbug; this.logdbug = logdbug;
this.perforLogcheckRepository = perforLogcheckRepository; this.perforLogcheckRepository = perforLogcheckRepository;
...@@ -75,7 +80,12 @@ public List<AllotResponse> GetAllotList(int? hospitalId) ...@@ -75,7 +80,12 @@ public List<AllotResponse> GetAllotList(int? hospitalId)
var allotList = _allotRepository.GetEntities(t => t.HospitalId == hospitalId); var allotList = _allotRepository.GetEntities(t => t.HospitalId == hospitalId);
allotList = allotList == null ? allotList : allotList.OrderByDescending(t => t.ID).ToList(); allotList = allotList == null ? allotList : allotList.OrderByDescending(t => t.ID).ToList();
var reuslt = Mapper.Map<List<AllotResponse>>(allotList); var reuslt = Mapper.Map<List<AllotResponse>>(allotList);
reuslt.ForEach(t => t.IsDown = !string.IsNullOrEmpty(t.ExtractPath)); reuslt.ForEach(t =>
{
t.IsDown = !string.IsNullOrEmpty(t.ExtractPath);
if (!string.IsNullOrEmpty(t.ExtractPath))
t.ExtractPath = t.ExtractPath.Replace(options.Value.AbsolutePath, options.Value.HttpPath).Replace("\\", "/");
});
return reuslt; return reuslt;
} }
......
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