Commit b45cc95f by lcx

bug - 数据抽取时无法获取参数

parent e940a7c2
...@@ -214,18 +214,18 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest ...@@ -214,18 +214,18 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
else else
{ {
var http = new RestSharpHelper(); var http = new RestSharpHelper();
string endpoint = "extract/extract"; var extractUrl = http.SetUrl(url.HttpPost, "extract/extract");
var extractUrl = http.SetUrl(url.HttpPost, endpoint);
var obj = new var obj = new ExtractRequest
{ {
allotId = request.AllotId, AllotId = request.AllotId,
hospitalId = request.HospitalId, HospitalId = request.HospitalId,
email = email, Email = email,
userId = claim.GetUserId() UserId = claim.GetUserId()
}; };
string json = JsonHelper.Serialize(obj); string json = JsonHelper.Serialize(obj);
logger.LogInformation("提取绩效数据参数:" + json);
var parameter = JsonHelper.Deserialize<Dictionary<string, object>>(json); var parameter = JsonHelper.Deserialize<Dictionary<string, object>>(json);
var restRequest = string.IsNullOrEmpty(filePath) ? http.CreatePostRequest(json) : http.CreateFileRequest(new string[] { filePath }, parameter); var restRequest = string.IsNullOrEmpty(filePath) ? http.CreatePostRequest(json) : http.CreateFileRequest(new string[] { filePath }, parameter);
Task.Run(() => http.GetResponse(extractUrl, restRequest)); Task.Run(() => http.GetResponse(extractUrl, restRequest));
...@@ -290,12 +290,7 @@ public IActionResult DownFile([FromQuery] AllotRequest request) ...@@ -290,12 +290,7 @@ public IActionResult DownFile([FromQuery] AllotRequest request)
[AllowAnonymous] [AllowAnonymous]
public ApiResponse SaveFile() public ApiResponse SaveFile()
{ {
Dictionary<string, object> dict = new Dictionary<string, object>(); string json = JsonHelper.Serialize(Request.Form.ToDictionary());
foreach (var key in Request.Form.Keys)
{
dict.Add(key, Request.Form[key]);
}
string json = JsonHelper.Serialize(dict);
var request = JsonHelper.Deserialize<ExtractRequest>(json); var request = JsonHelper.Deserialize<ExtractRequest>(json);
if (Request.Form.Files == null || !Request.Form.Files.Any()) if (Request.Form.Files == null || !Request.Form.Files.Any())
......
...@@ -44,16 +44,11 @@ public class ExtractController : Controller ...@@ -44,16 +44,11 @@ public class ExtractController : Controller
[HttpPost] [HttpPost]
public void ExtractData() public void ExtractData()
{ {
Dictionary<string, object> dict = new Dictionary<string, object>(); string json = JsonHelper.Serialize(Request.Form.ToDictionary());
foreach (var key in Request.Form.Keys)
{
dict.Add(key, Request.Form[key]);
}
string json = JsonHelper.Serialize(dict);
var request = JsonHelper.Deserialize<ExtractRequest>(json);
logger.LogInformation("提取绩效数据请求参数:" + json); logger.LogInformation("提取绩效数据请求参数:" + json);
var request = JsonHelper.Deserialize<ExtractRequest>(json);
if (request == null || request.AllotId == 0 || request.HospitalId == 0) if (request == null || request.AllotId == 0 || request.HospitalId == 0)
return; return;
...@@ -109,8 +104,7 @@ private string SaveFileAsTemplate(IFormFile file, int hospitalId) ...@@ -109,8 +104,7 @@ private string SaveFileAsTemplate(IFormFile file, int hospitalId)
private void ImportFileAsAllotExtractFile(int allotId, int hospitalId, string filePath) private void ImportFileAsAllotExtractFile(int allotId, int hospitalId, string filePath)
{ {
var http = new RestSharpHelper(); var http = new RestSharpHelper();
string endpoint = "template/savefile"; var importUrl = http.SetUrl(options.ImportFile, "template/savefile");
var importUrl = http.SetUrl(options.ImportFile, endpoint);
var obj = new { allotId, hospitalId }; var obj = new { allotId, hospitalId };
......
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