|
@@ -3,6 +3,8 @@ package com.phm.manage.controller;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
|
+import com.phm.manage.service.IModelService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
@@ -10,7 +12,11 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import com.phm.common.annotation.Anonymous;
|
|
|
import com.phm.common.core.controller.BaseController;
|
|
|
import com.phm.manage.domain.common.CommonResult;
|
|
|
-import com.phm.manage.http.HttpClientUtils;
|
|
|
+import com.phm.manage.util.HttpClientUtils;
|
|
|
+import com.phm.manage.util.JsonUtils;
|
|
|
+
|
|
|
+import cn.hutool.json.JSONObject;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
|
|
|
/**
|
|
|
* @Description ApiController 模型算法调用API
|
|
@@ -19,17 +25,12 @@ import com.phm.manage.http.HttpClientUtils;
|
|
|
*/
|
|
|
@Anonymous
|
|
|
@RestController
|
|
|
-@RequestMapping("/modelApi")
|
|
|
-public class ApiController extends BaseController {
|
|
|
+@RequestMapping("/model_api")
|
|
|
+public class ModelApiController extends BaseController {
|
|
|
+ @Autowired
|
|
|
+ private IModelService modelService;
|
|
|
@PostMapping("/execute")
|
|
|
- public CommonResult<String> test() {
|
|
|
-
|
|
|
- Map<String, String> parms = new HashMap<>();
|
|
|
- parms.put("data_url", "http://192.168.0.101:8080/profile/upload/2023/11/13" + "/origin.csv");
|
|
|
- String reslut = HttpClientUtils.postJson("http://127.0.0.1:8858/add", parms);
|
|
|
- // UnicodeUtil.toString(reslut);
|
|
|
- // System.out.println("====================" + UnicodeUtil.toString(reslut));
|
|
|
- return CommonResult.success(reslut);
|
|
|
+ public CommonResult<String> executeModel(Long modelId) {
|
|
|
+ return CommonResult.success(modelService.executeModel(modelId));
|
|
|
}
|
|
|
-
|
|
|
}
|