Commit b45cc95f by lcx

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

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