Ver código fonte

服务调用更新

ZhuDeKang 3 meses atrás
pai
commit
462d58b440

+ 1 - 1
ruoyi-admin/src/main/resources/application.yml

@@ -12,7 +12,7 @@ ruoyi:
   addressEnabled: false
   # 验证码类型 math 数字计算 char 字符验证
   captchaType: math
-  gatewayUrl: http://localhost:8080
+  gatewayUrl: http://localhost:8081
 
 # 开发环境配置
 server:

+ 4 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/domain/PtService.java

@@ -80,6 +80,10 @@ public class PtService implements Serializable {
     private String proxyAddress;
     @ApiModelProperty("代理路径")
     private String proxyPath;
+    /**
+     * 网管代理id
+     */
+    private String gatewayId;
     @ApiModelProperty("示例")
     private String example;
 

+ 7 - 4
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/impl/PtServiceServiceImpl.java

@@ -7,13 +7,13 @@ 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.PtService;
-import com.ruoyi.interfaces.domain.PtServiceLog;
-import com.ruoyi.interfaces.domain.PtServiceParam;
+import com.ruoyi.interfaces.domain.*;
 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;
@@ -141,10 +141,13 @@ public class PtServiceServiceImpl extends ServiceImpl<PtServiceMapper, PtService
     }
 
 
+    @Autowired
+    private GatewayRoutesService gatewayRoutesService;
     @Override
     public HashMap<String, String> testRun(PtService ptService) throws IOException {
 
-        String url = RuoYiConfig.getGatewayUrl() + ptService.getProxyPath() + ptService.getUrl();
+        GatewayRoutes gatewayRoutes = gatewayRoutesService.getById(ptService.getGatewayId());
+        String url = RuoYiConfig.getGatewayUrl() + gatewayRoutes.getPredicates() + ptService.getUrl();
         System.out.println(url);
         //String url = ptService.getUrl();
         HashMap<String, String> headers = new HashMap<>();

+ 4 - 0
ruoyi-api-patform/src/main/resources/mapper/interfaces/MdModelInfoMapper.xml

@@ -217,6 +217,10 @@
             <if test="publish != null and publish != ''">
                 and PUBLISH = #{publish}
             </if>
+            <if test="params.toPublish != null">
+                and "AUDIT" is not null
+                and "AUDIT" not in ('0','2')
+            </if>
         </where>
         order by SORT
     </select>

+ 10 - 2
ruoyi-api-patform/src/main/resources/mapper/interfaces/PtServiceMapper.xml

@@ -19,6 +19,7 @@
         <result column="EXAMPLE" jdbcType="CLOB" property="example"/>
         <result column="PROXY_ADDRESS" jdbcType="VARCHAR" property="proxyAddress"/>
         <result column="PROXY_PATH" jdbcType="VARCHAR" property="proxyPath"/>
+        <result column="gateway_id" jdbcType="VARCHAR" property="gatewayId"/>
         <result column="SERVICE_SOURCE" jdbcType="VARCHAR" property="serviceSource"/>
         <result property="serviceDept" column="SERVICE_DEPT" jdbcType="VARCHAR"/>
         <result property="manageName" column="MANAGE_NAME" jdbcType="VARCHAR"/>
@@ -50,7 +51,7 @@
     <resultMap id="AuthVoResultMap" type="com.ruoyi.interfaces.domain.vo.PtServiceVo">
         <result property="id" jdbcType="VARCHAR" column="ID"/>
         <result property="deadline" column="DEADLINE"/>
-        <result property="appId" jdbcType="VARCHAR" column="APP_ID"/>
+        <result property="gatewayId" jdbcType="VARCHAR" column="gateway_id"/>
         <result property="srvId" jdbcType="VARCHAR" column="SRV_ID"/>
         <result property="userId" jdbcType="VARCHAR" column="USER_ID"/>
         <result column="SRV_ID" jdbcType="VARCHAR" property="srvId"/>
@@ -69,6 +70,7 @@
         <result column="EXAMPLE" jdbcType="CLOB" property="example"/>
         <result column="PROXY_ADDRESS" jdbcType="VARCHAR" property="proxyAddress"/>
         <result column="PROXY_PATH" jdbcType="VARCHAR" property="proxyPath"/>
+        <result column="gateway_id" jdbcType="VARCHAR" property="gatewayId"/>
         <result column="SERVICE_SOURCE" jdbcType="VARCHAR" property="serviceSource"/>
         <result property="serviceDept" column="SERVICE_DEPT" jdbcType="VARCHAR"/>
         <result property="manageName" column="MANAGE_NAME" jdbcType="VARCHAR"/>
@@ -200,6 +202,7 @@ PUBLISH_TIME
         #{tm, jdbcType=DATE},
         #{proxyAddress,jdbcType=VARCHAR},
         #{proxyPath,jdbcType=VARCHAR},
+        #{gatewayId,jdbcType=VARCHAR},
         #{serviceSource,jdbcType=VARCHAR},
         #{serviceDept,jdbcType=VARCHAR},
         #{manageName,jdbcType=VARCHAR},
@@ -301,6 +304,9 @@ PUBLISH_TIME
             <if test="proxyPath != null and proxyPath != ''">
                 and PROXY_PATH = #{proxyPath}
             </if>
+            <if test="gatewayId != null and gatewayId != ''">
+                and gateway_id = #{gatewayId}
+            </if>
             <if test="serviceSource != null and serviceSource != ''">
                 and SERVICE_SOURCE = #{serviceSource}
             </if>
@@ -432,6 +438,7 @@ PUBLISH_TIME
             <if test="userId != null and userId != ''">USER_ID = #{userId},</if>
             <if test="proxyAddress != null and proxyAddress != ''">PROXY_ADDRESS = #{proxyAddress},</if>
             <if test="proxyPath != null and proxyPath != ''">PROXY_PATH = #{proxyPath},</if>
+            <if test="gatewayId != null and gatewayId != ''">gateway_id = #{gatewayId},</if>
             <if test="serviceSource != null and serviceSource != ''">SERVICE_SOURCE = #{serviceSource},</if>
             <if test="serviceDept != null and serviceDept != ''">SERVICE_DEPT = #{serviceDept},</if>
             <if test="manageName != null and manageName != ''">MANAGE_NAME = #{manageName},</if>
@@ -499,7 +506,7 @@ PUBLISH_TIME
     <select id="listByUserService" resultMap="AuthVoResultMap">
         SELECT A.ID,
                A.DEADLINE,
-               A.APP_ID,
+               A.gateway_id,
                A.USER_ID,
                P.UP_CYCL,
                P.OPEN_CNDTN,
@@ -620,6 +627,7 @@ PUBLISH_TIME
         <result column="EXAMPLE" jdbcType="CLOB" property="example"/>
         <result column="PROXY_ADDRESS" jdbcType="VARCHAR" property="proxyAddress"/>
         <result column="PROXY_PATH" jdbcType="VARCHAR" property="proxyPath"/>
+        <result column="gateway_id" jdbcType="VARCHAR" property="gatewayId"/>
         <result column="SERVICE_SOURCE" jdbcType="VARCHAR" property="serviceSource"/>
         <result property="serviceDept" column="SERVICE_DEPT" jdbcType="VARCHAR"/>
         <result property="manageName" column="MANAGE_NAME" jdbcType="VARCHAR"/>

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

@@ -618,6 +618,6 @@ public class HttpUtils {
     }
 
     public static void setGatewayHeaders(HashMap<String, String> hashMap) {
-        hashMap.put("Authorization", "1478702065085063169");
+        hashMap.put("Authorization", "f8d39ab1da75466e9340ac331bd9520b");
     }
 }