ZhuDeKang 5 luni în urmă
părinte
comite
5dc4131ab1

+ 4 - 3
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/controller/MdAppFlowController.java

@@ -38,11 +38,10 @@ public class MdAppFlowController extends BaseController
      * 查询模型应用流程列表
      */
     @GetMapping("/list")
-    public TableDataInfo list(MdAppFlow mdAppFlow)
+    public AjaxResult list(MdAppFlow mdAppFlow)
     {
-        startPage();
         List<MdAppFlow> list = mdAppFlowService.selectMdAppFlowList(mdAppFlow);
-        return getDataTable(list);
+        return success(list);
     }
 
     /**
@@ -57,6 +56,8 @@ public class MdAppFlowController extends BaseController
         util.exportExcel(response, list, "模型应用流程数据");
     }
 
+
+
     /**
      * 获取模型应用流程详细信息
      */

+ 2 - 1
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/controller/PtServiceController.java

@@ -22,6 +22,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.io.IOException;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -181,7 +182,7 @@ public class PtServiceController extends BaseController {
     }
 
     @PostMapping("/testRun")
-    public AjaxResult testRun(@RequestBody PtService ptService){
+    public AjaxResult testRun(@RequestBody PtService ptService) throws IOException {
 
         return success(ptServiceService.testRun(ptService));
     }

+ 23 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/domain/PtServiceParam.java

@@ -89,4 +89,27 @@ public class PtServiceParam extends PtServiceParamKey implements Serializable {
     }
 
 
+    public Object getParamObject() {
+        try {
+            switch (this.paramType) {
+                case "int":
+                    return Integer.parseInt(this.paramValue);
+                case "double":
+                    return Double.parseDouble(this.paramValue);
+                case "boolean":
+                    return Boolean.parseBoolean(this.paramValue);
+                case "long":
+                    return Long.parseLong(this.paramValue);
+                case "float":
+                    return Float.parseFloat(this.paramValue);
+                case "string":
+                    return this.paramValue; // 直接返回字符串
+                default:
+                    throw new IllegalArgumentException("Unsupported data type: " + this.paramType);
+            }
+        } catch (NumberFormatException e) {
+            throw new RuntimeException("Failed to convert value: " + this.paramValue + " to type: " + this.paramType, e);
+        }
+    }
+
 }

+ 2 - 1
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/PtServiceService.java

@@ -5,6 +5,7 @@ import com.ruoyi.interfaces.domain.MdModelInfo;
 import com.ruoyi.interfaces.domain.PtService;
 import com.ruoyi.interfaces.domain.vo.MdModelInfoVo;
 
+import java.io.IOException;
 import java.util.List;
 import java.util.Map;
 
@@ -53,5 +54,5 @@ public interface PtServiceService extends IService<PtService> {
 
     int put(PtService ptService);
 
-    String testRun(PtService ptService);
+    String testRun(PtService ptService) throws IOException;
 }

+ 11 - 9
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/impl/PtServiceServiceImpl.java

@@ -141,10 +141,10 @@ public class PtServiceServiceImpl extends ServiceImpl<PtServiceMapper, PtService
     }
 
     @Override
-    public String testRun(PtService ptService) {
+    public String testRun(PtService ptService) throws IOException {
 
 
-        String tokenUrl = "http://localhost:9002/sh-api/login";
+    /*    String tokenUrl = "http://localhost:9002/sh-api/login";
         String bodyPar = "{\n" +
                 "  \"username\": \"admin\",\n" +
                 "  \"password\": \"Gw#$1601\"\n" +
@@ -158,18 +158,20 @@ public class PtServiceServiceImpl extends ServiceImpl<PtServiceMapper, PtService
             throw new RuntimeException(e);
         }
         HashMap hashMap = JsonUtils.jsonToPojo(token, HashMap.class);
-        String token1 = hashMap.get("token").toString();
-        System.out.println(token1);
-        HashMap<String, String> map = new HashMap<>();
-        map.put("authorization",token1);
+        String token1 = hashMap.get("token").toString();*/
+        HashMap<String, String> headers = new HashMap<>();
         //List<PtServiceParam> ptServiceParams = ptServiceParamMapper.selectAll(ptService.getSrvId());
         //String paramString = ptServiceParams.stream().map(p -> p.getParamCode() + "=" + p.getParamValue()).collect(Collectors.joining());
-        String paramString = "pageNum=1&pageSize=20";
+        List<PtServiceParam> params = ptService.getParams();
         switch (ptService.getRqtype()) {
             case "POST":
-            return HttpUtils.sendPost(ptService.getUrl(),paramString);
+                HashMap<String, Object> parMap = new HashMap<>();
+                for (PtServiceParam param : params) {
+                    parMap.put(param.getParamCode(),param.getParamObject());
+                }
+               return HttpUtils.sendBodyPost(ptService.getUrl(),parMap,headers);
             case "GET":
-                return HttpUtils.sendGet(ptService.getUrl(),paramString,map);
+                return HttpUtils.sendGet(ptService.getUrl(),"",headers);
         }
         return null;
     }

+ 6 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java

@@ -16,6 +16,7 @@ import javax.net.ssl.SSLSession;
 import javax.net.ssl.TrustManager;
 import javax.net.ssl.X509TrustManager;
 
+import com.ruoyi.common.utils.JsonUtils;
 import org.apache.http.HttpEntity;
 import org.apache.http.NameValuePair;
 import org.apache.http.client.methods.CloseableHttpResponse;
@@ -301,6 +302,11 @@ public class HttpUtils {
         return result.toString();
     }
 
+    public static String sendBodyPost(String url, Object body, HashMap<String, String> headers) throws IOException {
+        String bodyJson = JsonUtils.objectToJson(body);
+
+        return sendBodyPostTest( url,  bodyJson, headers);
+    }
 
     public static String sendBodyPostTest(String url, String param, HashMap<String, String> headers) throws IOException {
         if (url == null || param == null) {