Răsfoiți Sursa

Merge branch 'master' of http://39.98.38.2:13000/dumingliang/sh-model-platform

Hua 2 luni în urmă
părinte
comite
4c8d910c17

+ 7 - 13
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/controller/PtServiceController.java

@@ -56,7 +56,7 @@ public class PtServiceController extends BaseController {
     private IPtServiceRunLogService serviceRunLogService;
 
     @Autowired
-    private IMdModelInfoService  mdModelInfoService;
+    private IMdModelInfoService mdModelInfoService;
 
     private static final Logger log = LoggerFactory.getLogger(PtServiceController.class);
 
@@ -80,11 +80,11 @@ public class PtServiceController extends BaseController {
         boolean save = ptServiceService.save(ptService);
 
         MdModelInfo mdModelInfo = mdModelInfoService.selectMdModelInfoByMdid(ptService.getMdid());
-        if ("1".equals(mdModelInfo.getAudit())){ //模型以审核通过
+        if ("1".equals(mdModelInfo.getAudit())) { //模型以审核通过
             mdModelInfo.setAudit("3");
             mdModelInfoService.audit(mdModelInfo);
         }
-        if ("1".equals(mdModelInfo.getPublish())){ //模型以更新通过
+        if ("1".equals(mdModelInfo.getPublish())) { //模型以更新通过
             mdModelInfo.setPublish("3");
             mdModelInfoService.publish(mdModelInfo);
         }
@@ -197,7 +197,7 @@ public class PtServiceController extends BaseController {
     }
 
     @GetMapping("/state")
-    public AjaxResult state(PtService service){
+    public AjaxResult state(PtService service) {
         return success(ptServiceService.state(service));
     }
 
@@ -208,7 +208,7 @@ public class PtServiceController extends BaseController {
         PtService service = Optional.ofNullable(ptServicePage.getData()).orElse(new PtService());
         service.setStatus("1");
         List<PtService> list = ptServiceMapper.selectAllPublic(ptServicePage.getData());
-        list.forEach(p->{
+        list.forEach(p -> {
             p.setDevelopContacter(sm4Util.decrypt(p.getDevelopContacter()));
             p.setMaintainContacer(sm4Util.decrypt(p.getMaintainContacer()));
             p.setAdName(sm4Util.decrypt(p.getAdName()));
@@ -238,15 +238,14 @@ public class PtServiceController extends BaseController {
         ptService.setAdName(sm4Util.encrypt(ptService.getAdName()));
 
 
-
         MdModelInfo mdModelInfo = mdModelInfoService.selectMdModelInfoByMdid(ptService.getMdid());
 
 
-        if ("1".equals(mdModelInfo.getAudit())){ //模型以审核通过
+        if ("1".equals(mdModelInfo.getAudit())) { //模型以审核通过
             mdModelInfo.setAudit("3");
             mdModelInfoService.audit(mdModelInfo);
         }
-        if ("1".equals(mdModelInfo.getPublish())){ //模型以审核通过
+        if ("1".equals(mdModelInfo.getPublish())) { //模型以审核通过
             mdModelInfo.setPublish("3");
             mdModelInfoService.publish(mdModelInfo);
         }
@@ -281,11 +280,6 @@ public class PtServiceController extends BaseController {
         ptServiceLog.setExecTm(
                 DateUtils.getNowDate().getTime() - nowDate.getTime());
         ptServiceLog.setReturnData(map.get("result"));
-        if (null == map.get("status") || !map.get("status").equals("200")) {
-            ptServiceLog.setSenState("0");
-            serviceRunLogService.insertPtServiceRunLog(ptServiceLog);
-            return new AjaxResult(HttpStatus.HTTP_ERROR, "测试出错,请检查参数与路由");
-        }
         ptServiceLog.setSenState("1");
         serviceRunLogService.insertPtServiceRunLog(ptServiceLog);
         return success(map.get("result"));

+ 2 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/controller/PtTreeCateController.java

@@ -162,11 +162,13 @@ public class PtTreeCateController extends BaseController {
         ptTreeCate.setTreeType("APP");
         String level = StringUtils.isNull(ptTreeCate.getParams().get("level")) ? "3" : ptTreeCate.getParams().get("level").toString();
         String devkind = StringUtils.isNull(ptTreeCate.getParams().get("devkind")) ? null : ptTreeCate.getParams().get("devkind").toString();
+        String mdAudit = StringUtils.isNull(ptTreeCate.getParams().get("mdAudit")) ? null : ptTreeCate.getParams().get("mdAudit").toString();
 
         List<PtTreeCate> ptTreeCates = ptTreeCateService.selectPtTreeCateList(ptTreeCate).stream().peek(item -> item.setNodeType("TREE")).collect(Collectors.toList());
         if (level.equals("2") || level.equals("3")) {
             MdModelInfo modelPar = new MdModelInfo();
             modelPar.setDevkind(devkind);
+            modelPar.setAudit(mdAudit);
             List<MdModelInfo> mdModelInfos = mdModelInfoService.selectMdModelInfoList(modelPar);
             for (MdModelInfo mdModelInfo : mdModelInfos) {
                 if (StringUtils.isNotNull(mdModelInfo.getMdid()) && StringUtils.isNotNull(mdModelInfo.getCateid())

+ 6 - 5
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/impl/MdModelInfoServiceImpl.java

@@ -42,11 +42,12 @@ public class MdModelInfoServiceImpl implements IMdModelInfoService {
     @Override
     public MdModelInfo selectMdModelInfoByMdid(String mdid) {
         MdModelInfo mdModelInfo = mdModelInfoMapper.selectMdModelInfoByMdid(mdid);
-        mdModelInfo.setEnname(sm4Util.decrypt(mdModelInfo.getEnname()));
-        mdModelInfo.setMdContact(sm4Util.decrypt(mdModelInfo.getMdContact()));
-        mdModelInfo.setDevUnit(sm4Util.decrypt(mdModelInfo.getDevUnit()));
-        mdModelInfo.setDevContact(sm4Util.decrypt(mdModelInfo.getDevContact()));
-
+        if (StringUtils.isNotNull(mdModelInfo)) {
+            mdModelInfo.setEnname(sm4Util.decrypt(mdModelInfo.getEnname()));
+            mdModelInfo.setMdContact(sm4Util.decrypt(mdModelInfo.getMdContact()));
+            mdModelInfo.setDevUnit(sm4Util.decrypt(mdModelInfo.getDevUnit()));
+            mdModelInfo.setDevContact(sm4Util.decrypt(mdModelInfo.getDevContact()));
+        }
         return mdModelInfo;
     }
 

+ 26 - 23
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/impl/PtServiceServiceImpl.java

@@ -3,25 +3,26 @@ package com.ruoyi.interfaces.service.impl;
 import com.alibaba.fastjson2.JSON;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.config.RuoYiConfig;
-import com.ruoyi.common.constant.Constants;
 import com.ruoyi.common.utils.*;
-import com.ruoyi.common.utils.http.HttpUtils;
 import com.ruoyi.common.utils.uuid.IdUtils;
-import com.ruoyi.interfaces.domain.*;
+import com.ruoyi.interfaces.domain.GatewayRoutes;
+import com.ruoyi.interfaces.domain.PtService;
+import com.ruoyi.interfaces.domain.PtServiceParam;
 import com.ruoyi.interfaces.domain.vo.MdModelInfoVo;
 import com.ruoyi.interfaces.mapper.PtServiceMapper;
 import com.ruoyi.interfaces.mapper.PtServiceParamMapper;
 import com.ruoyi.interfaces.service.GatewayRoutesService;
 import com.ruoyi.interfaces.service.IMdModelInfoService;
-import com.ruoyi.interfaces.service.PtAppService;
 import com.ruoyi.interfaces.service.PtServiceService;
 import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.io.IOException;
-import java.util.*;
-import java.util.stream.Collectors;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author LinQiLong
@@ -114,7 +115,7 @@ public class PtServiceServiceImpl extends ServiceImpl<PtServiceMapper, PtService
     @Override
     public MdModelInfoVo modelService(MdModelInfoVo par) {
         MdModelInfoVo mdModelInfoVo = ptServiceMapper.selectModelService(par);
-        if (StringUtils.isNotNull(mdModelInfoVo)){
+        if (StringUtils.isNotNull(mdModelInfoVo)) {
             mdModelInfoVo.setMdContact(sm4Util.decrypt(mdModelInfoVo.getMdContact()));
             mdModelInfoVo.setEnname(sm4Util.decrypt(mdModelInfoVo.getEnname()));
             mdModelInfoVo.setDevUnit(sm4Util.decrypt(mdModelInfoVo.getDevUnit()));
@@ -150,6 +151,7 @@ public class PtServiceServiceImpl extends ServiceImpl<PtServiceMapper, PtService
 
     @Autowired
     private GatewayRoutesService gatewayRoutesService;
+
     @Override
     public HashMap<String, String> testRun(PtService ptService) throws IOException {
 
@@ -157,25 +159,26 @@ public class PtServiceServiceImpl extends ServiceImpl<PtServiceMapper, PtService
         String url = RuoYiConfig.getGatewayUrl() + gatewayRoutes.getPredicates() + ptService.getUrl();
         System.out.println(url);
         //String url = ptService.getUrl();
-        HashMap<String, String> headers = new HashMap<>();
+        HashMap<String, Object> headers = new HashMap<>();
         List<PtServiceParam> params = ptService.getParams();
-        HttpUtils.setGatewayHeaders(headers);
+//        HttpUtils.setGatewayHeaders(headers);
         String paramString = "";
-        switch (ptService.getRqtype()) {
-            case "POST":
-                HashMap<String, Object> parMap = new HashMap<>();
-                for (PtServiceParam param : params) {
-                    parMap.put(param.getParamCode(), param.getParamObject());
-                }
-                return HttpUtils.sendBodyPost(url, parMap, headers);
-            case "GET":
-
-                for (PtServiceParam param : params) {
-                    paramString += (param.getParamCode() + "=" + param.getParamValue()) + "&";
-                }
-                return HttpUtils.sendHttpGet(url, paramString, headers);
+        HashMap<String, Object> parMap = new HashMap<>();
+        for (PtServiceParam param : params) {
+            parMap.put(param.getParamCode(), param.getParamObject());
         }
-        return null;
+
+        String responseString = OkHttpUtils.executeRequest(
+                url,
+                ptService.getRqtype(),
+                parMap,
+                JsonUtils.objectToJson(parMap),
+                null,
+                headers
+        );
+        HashMap<String, String> result = new HashMap<>();
+        result.put("result", responseString);
+        return result;
     }
 
     @Override

+ 1 - 2
ruoyi-api-patform/src/main/resources/mapper/interfaces/MdDataSetFileMapper.xml

@@ -38,7 +38,7 @@
         DC_CODE,
         FILE_PATH,
         ORIGINAL_FILENAME,
-        FILE_TYPE
+        FILE_TYPE,
         create_by,
         create_time
         from md_data_set_file_log
@@ -78,7 +78,6 @@
             <if test="fileType != null">FILE_TYPE,</if>
             <if test="createBy != null">create_by,</if>
             create_time,
-
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="dcCode != null">#{dcCode},</if>

+ 1 - 0
ruoyi-api-patform/src/main/resources/mapper/interfaces/MdModelPargroupMapper.xml

@@ -22,6 +22,7 @@
     <select id="selectMdModelPargroupList" parameterType="com.ruoyi.interfaces.domain.MdModelPargroup" resultMap="MdModelPargroupResult">
         <include refid="selectMdModelPargroupVo"/>
         <where>
+            <if test="mdid != null  and mdid != ''"> and mdid = #{mdid}</if>
             <if test="parGroupCode != null  and parGroupCode != ''"> and PAR_GROUP_CODE = #{parGroupCode}</if>
             <if test="parGroupNote != null  and parGroupNote != ''"> and PAR_GROUP_NOTE = #{parGroupNote}</if>
             <if test="createby != null "> and CREATEBY = #{createby}</if>

+ 1 - 1
ruoyi-api-patform/src/main/resources/mapper/interfaces/SnailJobMapper.xml

@@ -61,7 +61,7 @@
                description,
                ext_attrs,
                deleted
-        from SNAIL_JOB.sj_job
+        from SNAIL_JOB.SJ_JOB
     </sql>
     <select id="selectJobList" resultType="com.ruoyi.interfaces.domain.Job">
         <include refid="selectJobVo"></include>