Browse Source

fix 交付范围 关系交付 添加

lvxianyun 2 years ago
parent
commit
2c0fbbce69

+ 1 - 1
adm-business/adm-middleware/src/main/java/com/persagy/proxy/calculation/model/AdmRelationAddRequest.java

@@ -35,6 +35,6 @@ public class AdmRelationAddRequest implements Serializable {
     private String graphicType;
 
     /** 是否仅查看项目交付范围内数据:0/null-否 1-是 **/
-    private Integer deliveryType;
+    private Integer isDelivery;
 
 }

+ 10 - 7
adm-business/adm-middleware/src/main/java/com/persagy/proxy/calculation/service/impl/AdmManualRelCalServiceImpl.java

@@ -156,7 +156,7 @@ public class AdmManualRelCalServiceImpl implements AdmManualRelCalService {
             }
         }
         //验证 项目交付范围
-        Integer flag = validRelCollect(context, relationTypeEnum, request.getDeliveryType(), mainResultData, fromResultData);
+        Integer flag = validRelCollect(context, relationTypeEnum, request.getIsDelivery(), mainResultData, fromResultData);
         switch (flag){
             case 1 : return AdmCreateResponse.failure(mainResultData +":不存在","1");
             case 2 : return AdmCreateResponse.failure(fromResultData +":不存在","2");
@@ -518,22 +518,23 @@ public class AdmManualRelCalServiceImpl implements AdmManualRelCalService {
      * @param fromResultData 从对象
      * @return 0 成功; 1 主对象为空; 2 从对象为空; 3 不在项目交付范围内
      **/
-    private Integer validRelCollect(InstanceUrlParam context, AdmRelationTypeEnum relationTypeEnum , Integer deliveryType, List<ObjectNode> mainResultData, List<ObjectNode> fromResultData){
+    private Integer validRelCollect(InstanceUrlParam context, AdmRelationTypeEnum relationTypeEnum , Integer isDelivery, List<ObjectNode> mainResultData, List<ObjectNode> fromResultData){
         if(CollUtil.isEmpty(mainResultData)){
             return 1;
         }
         if(CollUtil.isEmpty(fromResultData)){
             return 2;
         }
-        if(deliveryType != null){
+        if(isDelivery != null && isDelivery == 1){
             QueryCriteria queryCriteria = new QueryCriteria();
             ObjectNode objectNode = JsonNodeFactory.instance.objectNode();
             objectNode.put("projectId", context.getProjectId());
             objectNode.put("relCode", relationTypeEnum.getRelCode());
             objectNode.put("graphCode", relationTypeEnum.getGraphCode());
-            objectNode.put("deliveryType",deliveryType);
+            objectNode.put("deliveryType",0);
+            objectNode.put("valid",1);
             queryCriteria.setCriteria(objectNode);
-            List<RelationDefineCollect> relationDefineCollects = relationReportService.doQueryRelationDefineCollectList(context, queryCriteria);
+             List<RelationDefineCollect> relationDefineCollects = relationReportService.doQueryRelationDefineCollectList(context, queryCriteria);
             if(CollUtil.isEmpty(relationDefineCollects)){
                 return 3;
             }
@@ -558,13 +559,15 @@ public class AdmManualRelCalServiceImpl implements AdmManualRelCalService {
                 ArrayNode endTypeCodes = collect.getEndTypeCodes();
                 Set<String> endTypeCodeSet = CollUtil.newHashSet();
                 endTypeCodes.forEach(classCode -> endTypeCodeSet.add(classCode.isTextual() ? classCode.asText() : ""));
-                if(sourceTypeCodeSet.contains(mainSet) && endTypeCodeSet.contains(endTypeCodeSet)){
+                if(sourceTypeCodeSet.containsAll(mainSet) && endTypeCodeSet.containsAll(fromSet)){
                     return 0;
                 }
-                if(sourceTypeCodeSet.contains(endTypeCodes) && endTypeCodeSet.contains(mainSet)){
+                if(sourceTypeCodeSet.containsAll(fromSet) && endTypeCodeSet.containsAll(mainSet)){
                     return 0;
                 }
             }
+        }else{
+            return 0;
         }
         return 3;
     }