Просмотр исходного кода

fix bug:调整接口/calc_special/获取参数问题

lijie 3 лет назад
Родитель
Сommit
a7d1e81c9e

+ 5 - 23
src/main/java/com/persagy/proxy/calculation/controller/AdmCalcSpecialController.java

@@ -6,6 +6,7 @@ import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.adm.constant.BusinessErrorRwdCode;
 import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.calculation.service.AdmCalcSpecialService;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import lombok.RequiredArgsConstructor;
@@ -27,12 +28,8 @@ public class AdmCalcSpecialController {
 
     private final AdmCalcSpecialService admCalcSpecialService;
 
-    @Value("${middleware.group.code}")
-    private String groupCode;
-
     /***
      * Description: 管网系统设备分块  +  计算流向
-     * @param projectId : 项目id
      * @param relationType : 关系类型
      * @return : com.persagy.proxy.adm.request.AdmResponse
      * @author : lijie
@@ -40,15 +37,9 @@ public class AdmCalcSpecialController {
      * Update By lijie 2021/9/29 11:12
      */
     @PostMapping("sys-block")
-    public AdmResponse sysBolck(@RequestParam("projectId") String projectId,
-                                @RequestParam("groupCode") String groupCode,
-                                @RequestParam("appId") String appId,
-                                @RequestParam("userId") String userId,
-                                @RequestParam("relationType ") String relationType) throws Exception {
+    public AdmResponse sysBolck(@RequestParam("relationType") String relationType) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(StrUtil.isNotBlank(groupCode)?groupCode:this.groupCode,
-                null, projectId, StrUtil.isNotBlank(appId)?appId:AdmCommonConstant.APP_ID,
-                StrUtil.isNotBlank(userId)?userId:AdmCommonConstant.USER_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         Map<String, AdmRelationTypeEnum> relationTypeMap = AdmRelationTypeEnum.getRelationTypeMap();
         if (!relationTypeMap.containsKey(relationType)){
             throw new BusinessException(BusinessErrorRwdCode.A7201.getCode(),BusinessErrorRwdCode.A7201.getDesc());
@@ -57,24 +48,15 @@ public class AdmCalcSpecialController {
     }
     /***
      * Description: 管网计算
-     * @param projectId : 项目id
-     * @param groupCode : 集团编码
-     * @param appId : APP的id
-     * @param userId : 用户id
      * @return : com.persagy.proxy.adm.request.AdmResponse
      * @author : lijie
      * @date :2021/9/29 11:58
      * Update By lijie 2021/9/29 11:58
      */
     @GetMapping("calcNetworks")
-    public AdmResponse calcNetworks(@RequestParam("projectId") String projectId,
-                                    @RequestParam("groupCode") String groupCode,
-                                    @RequestParam("appId") String appId,
-                                    @RequestParam("userId") String userId) throws Exception {
+    public AdmResponse calcNetworks() throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(StrUtil.isNotBlank(groupCode)?groupCode:this.groupCode,
-                null, projectId, StrUtil.isNotBlank(appId)?appId:AdmCommonConstant.APP_ID,
-                StrUtil.isNotBlank(userId)?userId:AdmCommonConstant.USER_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         return admCalcSpecialService.calcNetworks(context);
     }