Commit b9a18025 by 李承祥

bug修改

parent d78b8a80
......@@ -327,7 +327,7 @@ public ApiResponse SaveFile([FromForm] IFormCollection form, int allotId, int ho
var allot = allotService.GetAllot(allotId);
allot.ExtractPath = path;
allot.IsExtracting = 2;
if (string.IsNullOrEmpty(path) || FileHelper.IsExistFile(path))
if (string.IsNullOrEmpty(path) || !FileHelper.IsExistFile(path))
{
LogHelper.Information($"文件未保存成功,保存文件不存在!", "保存提取文件");
return new ApiResponse(ResponseType.Fail, "上传成功!");
......
......@@ -121,21 +121,21 @@ public void ExtractData([CustomizeValidator, FromBody]ExtractRequest request)
string filePath = newExtractService.ExtractData(request.AllotId, request.Email, request.HospitalId);
if (!string.IsNullOrEmpty(filePath) && FileHelper.IsExistFile(filePath))
{
LogHelper.Information("请求路径:" + url.ImportFile, "保存提取文件");
LogHelper.Information("请求路径:" + url.ImportFile + ",请求参数" + JsonHelper.Serialize(new { allotId = request.AllotId, hospitalId = request.HospitalId }), "保存提取文件");
int i = 1;
while (i <= 5)
{
string retJson = HttpHelper.HttpClient(url.ImportFile + $"?allotId={request.AllotId}&hospitalId={request.HospitalId}", filePath);
if (i == 5)
LogHelper.Information($"保存文件失败,已尝试执行五次,请联系开发人员!", "保存提取文件");
else
LogHelper.Information($"正在尝试第{i}次保存!", "保存提取文件");
//保存文件
string retJson = HttpHelper.HttpClient(url.ImportFile + $"?allotId={request.AllotId}&hospitalId={request.HospitalId}", filePath);
LogHelper.Information("返回结果:" + JsonHelper.Serialize(retJson), "保存提取文件");
logger.LogInformation(retJson);
var ret = JsonHelper.Deserialize<ApiResponse>(retJson);
if ((int)ret.State == 1)
if (ret != null && (int)ret.State == 1)
{
LogHelper.Information("保存成功!", "保存提取文件");
break;
......
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