Commit 99f87bfd by lcx

控制器返回文件

parent 429480d1
......@@ -413,10 +413,20 @@ public ApiResponse Schedule([FromBody] log_dbug request)
[Route("extract/income/{allotId}")]
[HttpPost]
public ApiResponse ExtractIncome(int allotId)
public IActionResult ExtractIncome(int allotId)
{
string filepath = extractIncomeService.Execture(allotId);
return new ApiResponse(ResponseType.OK);
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
......@@ -52,6 +52,7 @@ public string Execture(int allotId)
if (string.IsNullOrEmpty(filepath) || !FileHelper.IsExistFile(filepath))
throw new PerformanceException("抽取文件错误");
logger.LogInformation("医生收入文件: " + filepath);
return filepath;
}
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