Commit 738cc72f by lcx

Merge branch 'v2020income' into v2020calculate

parents c557bb9a 30c73c61
...@@ -25,6 +25,7 @@ public class TemplateController : Controller ...@@ -25,6 +25,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 HospitalService hospitalService; private HospitalService hospitalService;
private IHostingEnvironment env; private IHostingEnvironment env;
private ClaimService claim; private ClaimService claim;
...@@ -37,6 +38,7 @@ public class TemplateController : Controller ...@@ -37,6 +38,7 @@ public class TemplateController : Controller
public TemplateController(TemplateService templateService, public TemplateController(TemplateService templateService,
HospitalService hospitalService, HospitalService hospitalService,
DFExtractService extractService, DFExtractService extractService,
ExtractIncomeService extractIncomeService,
IHostingEnvironment env, IHostingEnvironment env,
ClaimService claim, ClaimService claim,
IOptions<Application> options, IOptions<Application> options,
...@@ -47,6 +49,7 @@ public class TemplateController : Controller ...@@ -47,6 +49,7 @@ public class TemplateController : Controller
{ {
this.templateService = templateService; this.templateService = templateService;
this.extractService = extractService; this.extractService = extractService;
this.extractIncomeService = extractIncomeService;
this.hospitalService = hospitalService; this.hospitalService = hospitalService;
this.env = env; this.env = env;
this.claim = claim; this.claim = claim;
...@@ -407,5 +410,24 @@ public ApiResponse Schedule([FromBody] log_dbug request) ...@@ -407,5 +410,24 @@ public ApiResponse Schedule([FromBody] log_dbug request)
var ratio = allotService.AllotLog(allot, 3)?.Max(t => ConvertHelper.TryDecimal(t.Message)) ?? 0; var ratio = allotService.AllotLog(allot, 3)?.Max(t => ConvertHelper.TryDecimal(t.Message)) ?? 0;
return new ApiResponse(ResponseType.OK, new { ratio }); return new ApiResponse(ResponseType.OK, new { ratio });
} }
[Route("extract/income/{allotId}")]
[AllowAnonymous]
[HttpGet]
public IActionResult ExtractIncome(int allotId)
{
string filepath = extractIncomeService.Execture(allotId);
var memoryStream = new MemoryStream();
using (var stream = new FileStream(filepath, FileMode.Open))
{
stream.CopyToAsync(memoryStream).Wait();
}
memoryStream.Seek(0, SeekOrigin.Begin);
string fileExt = Path.GetExtension(filepath);
var provider = new FileExtensionContentTypeProvider();
var memi = provider.Mappings[fileExt];
return File(memoryStream, memi, Path.GetFileName(filepath));
}
} }
} }
\ No newline at end of file
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