Browse Source

实现查询正/逆交付范围接口逻辑

lijie 3 years ago
parent
commit
bd6f3b7af9

+ 4 - 4
adm-business/adm-diagram/src/main/resources/bootstrap.yml

@@ -39,10 +39,10 @@ persagy:
 #        slf4j:
 #          enabled: true
 
-config:
-  file:
-    absolute:
-      path: ${CONFIG_FILE_PATH:D:\SpringCloud}
+#config:
+#  file:
+#    absolute:
+#      path: ${CONFIG_FILE_PATH:D:\SpringCloud}
 #feign:
 #  compression:
 #    request:

+ 6 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/constant/AdmServerConstant.java

@@ -11,6 +11,12 @@ public interface AdmServerConstant {
     String BUILD_SEQUENCE_ID="buildSequenceID";
     /**建筑id的信息点key值*/
     String BUILDING_ID="buildingId";
+    /**正逆向交付方式,0-逆向,1-正向*/
+    String DELIVERY_WAY="deliveryWay";
+    /**交付类型:0-项目交付 1-现场交付*/
+    String DELIVERY_TYPE="deliveryType";
+    /**是否交付 0-否 1-是*/
+    String IS_DELIVERY="isDelivery";
 
 
 }

+ 35 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/constant/DeliveryWayEnum.java

@@ -0,0 +1,35 @@
+package com.persagy.adm.server.algorithm.constant;
+
+import lombok.Getter;
+
+/**
+ * 正逆向交付方式枚举类
+ * @author : lijie
+ * Update By 2022/1/20 16:05
+ */
+@Getter
+public enum DeliveryWayEnum {
+
+    /**逆向*/
+    REVERSE("0", "逆向"),
+    /**正向*/
+    POSITIVE("1", "正向");
+
+    private String value;
+    private String desc;
+
+    DeliveryWayEnum(String value, String desc) {
+        this.value = value;
+        this.desc = desc;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+
+}

+ 26 - 6
adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/controller/AdmModelController.java

@@ -4,15 +4,15 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
 import com.persagy.adm.server.algorithm.constant.AdmServerConstant;
-import com.persagy.adm.server.algorithm.domain.BuildingVo;
-import com.persagy.adm.server.algorithm.domain.ModelFileVo;
-import com.persagy.adm.server.algorithm.domain.QueryModelFileVo;
+import com.persagy.adm.server.algorithm.domain.*;
 import com.persagy.adm.server.algorithm.entity.AdmModelFile;
 import com.persagy.adm.server.algorithm.service.AdmModelService;
 import com.persagy.dmp.common.constant.DigitalObjectType;
 import com.persagy.dmp.common.context.AppContext;
 import com.persagy.dmp.common.model.response.CommonResult;
 import com.persagy.dmp.common.utils.ResultHelper;
+import com.persagy.dmp.delivery.dto.ObjectTypeCollectDTO;
+import com.persagy.dmp.delivery.entity.ObjectTypeCollect;
 import com.persagy.dmp.digital.entity.ObjectDigital;
 import lombok.RequiredArgsConstructor;
 import org.springframework.validation.annotation.Validated;
@@ -135,16 +135,36 @@ public class AdmModelController {
      */
     @PostMapping(value = "/saveModelFile")
     public CommonResult<List<Void>> saveModelFile(@Validated @RequestBody ModelFileVo modelFileVo) {
-        Map<String, AdmModelFile> modelFileMap = admModelService.queryCurrentModelFileByFloorIds(CollUtil.newArrayList(modelFileVo.getFloorId()));
-        AdmModelFile admModelFile = modelFileMap.get(modelFileVo.getFloorId());
         AdmModelFile modelFile = BeanUtil.copyProperties(modelFileVo, AdmModelFile.class);
         modelFile.setGroupCode(AppContext.getContext().getGroupCode());
         modelFile.setProjectId(AppContext.getContext().getProjectId());
         modelFile.setCreator(AppContext.getContext().getAccountId());
         modelFile.setModifier(AppContext.getContext().getAccountId());
         admModelService.saveModelFile(modelFile);
-
         return ResultHelper.multi(new ArrayList<>());
     }
+    /**
+     * 010103-模型文件-查询正向/逆向交付范围
+     * @param queryVo : 查询条件
+     * @return : com.persagy.dmp.common.model.response.CommonResult<java.lang.Void>
+     * @author : lijie
+     * Update By 2022/1/12 16:54
+     * @undone
+     */
+    @PostMapping(value = "/queryScopeOfDeliver")
+    public CommonResult<List<ScopeOfDeliverVo>> queryScopeOfDeliver(@Validated @RequestBody QueryScopeOfDeliverVo queryVo) {
+        // 1.查询对象类型交付范围
+        List<ObjectTypeCollect> typeCollects = admModelService.queryObjectTypeCollectByDeliveryWay(queryVo.getDeliveryWay());
+        if (CollUtil.isEmpty(typeCollects)){
+            return ResultHelper.multi(new ArrayList<>());
+        }
+        List<ScopeOfDeliverVo> result = new ArrayList<>();
+        for (ObjectTypeCollect typeCollect : typeCollects) {
+            result.add(BeanUtil.toBean(typeCollect,ScopeOfDeliverVo.class));
+        }
+        // 2.查询对象信息点交付范围
+        // 3.查询对象关系交付范围
+        return ResultHelper.multi(result);
+    }
 
 }

+ 1 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/domain/DeliverPlanVo.java

@@ -33,6 +33,7 @@ public class DeliverPlanVo {
      * */
     @NotBlank
     private String deliverPlanName;
+
     /**商品编码集合*/
     @NotEmpty
     private Set<String> skuCodes;

+ 25 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/domain/QueryScopeOfDeliverVo.java

@@ -0,0 +1,25 @@
+package com.persagy.adm.server.algorithm.domain;
+
+import com.persagy.adm.server.algorithm.constant.DeliveryWayEnum;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * 查询交付范围VO类
+ * @author : lijie
+ * Update By 2022/1/20 15:58
+ */
+@Data
+public class QueryScopeOfDeliverVo {
+    /**
+     * 正逆向交付方式
+     * @see DeliveryWayEnum#value
+     * @mock 1
+     */
+    @NotNull
+    private Integer deliveryWay;
+
+
+
+}

+ 21 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/domain/ScopeOfDeliverVo.java

@@ -0,0 +1,21 @@
+package com.persagy.adm.server.algorithm.domain;
+
+import com.persagy.dmp.delivery.dto.ObjectInfoCollectDTO;
+import com.persagy.dmp.delivery.dto.ObjectTypeCollectDTO;
+import com.persagy.dmp.delivery.dto.RelationDefineCollectDTO;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 交付范围VO类
+ * @author : lijie
+ * Update By 2022/1/14 16:26
+ */
+@Data
+public class ScopeOfDeliverVo extends ObjectTypeCollectDTO{
+    /**对象类型下需交付的信息点.暂无,后续根据业务再调整*/
+    List<ObjectInfoCollectDTO> objectInfoDefines;
+    /**对象类型下需交付的关系数据.暂无,后续根据业务再调整*/
+    List<RelationDefineCollectDTO> relationDefines;
+}

+ 10 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/service/AdmModelService.java

@@ -2,6 +2,8 @@ package com.persagy.adm.server.algorithm.service;
 
 import com.persagy.adm.server.algorithm.domain.DeliverPlanVo;
 import com.persagy.adm.server.algorithm.entity.AdmModelFile;
+import com.persagy.dmp.delivery.dto.ObjectTypeCollectDTO;
+import com.persagy.dmp.delivery.entity.ObjectTypeCollect;
 import com.persagy.dmp.digital.entity.ObjectDigital;
 
 import java.util.List;
@@ -37,4 +39,12 @@ public interface AdmModelService {
      * Update By 2022/1/19 17:54
      */
     void saveModelFile(AdmModelFile modelFile);
+    /**
+     * 根据正逆向交付查询对象类型交付范围
+     * @param deliveryWay : 正逆向交付方式,0-逆向,1-正向
+     * @return : java.util.List<com.persagy.dmp.delivery.dto.ObjectTypeCollectDTO>
+     * @author : lijie
+     * Update By 2022/1/20 18:26
+     */
+    List<ObjectTypeCollect> queryObjectTypeCollectByDeliveryWay(Integer deliveryWay);
 }

+ 41 - 14
adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/service/impl/AdmModelServiceImpl.java

@@ -18,7 +18,11 @@ import com.persagy.dmp.common.constant.RelCodeEnum;
 import com.persagy.dmp.common.context.AppContext;
 import com.persagy.dmp.common.exception.BusinessException;
 import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.dmp.common.model.entity.AuditableEntity;
 import com.persagy.dmp.common.model.response.CommonResult;
+import com.persagy.dmp.delivery.client.DigitalObjectTypeCollectFacade;
+import com.persagy.dmp.delivery.dto.ObjectTypeCollectDTO;
+import com.persagy.dmp.delivery.entity.ObjectTypeCollect;
 import com.persagy.dmp.digital.client.DigitalObjectFacade;
 import com.persagy.dmp.digital.entity.ObjectDigital;
 import com.persagy.dmp.digital.entity.ObjectRelation;
@@ -101,23 +105,46 @@ public class AdmModelServiceImpl implements AdmModelService {
     public void saveModelFile(AdmModelFile modelFile) {
         admModelFileMapper.insertEntity(modelFile);
     }
-
     /**
-     * 创建关系查询对象
-     * @param objectMapper : objectMapper
-     * @param graphCode : 图类型编码
-     * @param relCode : 边类型编码
-     * @param buildingIds : 建筑id
-     * @return : com.fasterxml.jackson.databind.node.ObjectNode
+     * 根据正逆向交付查询对象类型交付范围
+     * @param deliveryWay : 正逆向交付方式,0-逆向,1-正向
+     * @return : java.util.List<com.persagy.dmp.delivery.dto.ObjectTypeCollectDTO>
      * @author : lijie
-     * Update By 2022/1/19 14:18
+     * Update By 2022/1/20 18:26
      */
-    private ObjectNode createRelationQueryNode(ObjectMapper objectMapper, String graphCode, String relCode,
-                                               Set<String> buildingIds) {
+    @Override
+    public List<ObjectTypeCollect> queryObjectTypeCollectByDeliveryWay(Integer deliveryWay) {
+        if (null==deliveryWay){
+            return new ArrayList<>();
+        }
+        QueryCriteria queryCriteria = new QueryCriteria();
+        ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
         ObjectNode objectNode = objectMapper.createObjectNode();
-        objectNode.put(ObjectRelation.GRAPH_CODE_HUM,graphCode);
-        objectNode.put(ObjectRelation.REL_CODE_HUM,relCode);
-        objectNode.putPOJO(ObjectRelation.OBJ_FROM_HUM,buildingIds);
-        return objectNode;
+        objectNode.put(AuditableEntity.PROP_VALID,Boolean.TRUE);
+        objectNode.put(CommonConstant.QUERY_PROJECTID,AppContext.getContext().getProjectId());
+        objectNode.put(CommonConstant.QUERY_GROUPCODE,AppContext.getContext().getGroupCode());
+        objectNode.put(AdmServerConstant.DELIVERY_WAY,deliveryWay);
+        objectNode.put(AdmServerConstant.DELIVERY_TYPE,"0");
+        objectNode.put(AdmServerConstant.IS_DELIVERY,"1");
+        queryCriteria.setCriteria(objectNode);
+        CommonResult<List<ObjectTypeCollect>> commonResult = DigitalObjectTypeCollectFacade
+                .queryPrototype(AppContext.getContext().getGroupCode(), AppContext.getContext().getProjectId(),
+                        AppContext.getContext().getAppId(), AppContext.getContext().getAccountId(), queryCriteria);
+        if (!CommonConstant.QUERY_SUCCESS.equals(commonResult.getResult())){
+            throw new BusinessException(commonResult.getResult(),commonResult.getMessage());
+        }
+        if (CollUtil.isNotEmpty(commonResult.getData())){
+            return commonResult.getData();
+        }
+        // 暂时加个逻辑,如果没有就查询0
+        objectNode.put(CommonConstant.QUERY_PROJECTID,CommonConstant.DEFAULT_ID);
+        objectNode.put(CommonConstant.QUERY_GROUPCODE,CommonConstant.DEFAULT_ID);
+        CommonResult<List<ObjectTypeCollect>> zeroCommonResult = DigitalObjectTypeCollectFacade
+                .queryPrototype(AppContext.getContext().getGroupCode(), AppContext.getContext().getProjectId(),
+                        AppContext.getContext().getAppId(), AppContext.getContext().getAccountId(), queryCriteria);
+        if (!CommonConstant.QUERY_SUCCESS.equals(zeroCommonResult.getResult())){
+            throw new BusinessException(zeroCommonResult.getResult(),zeroCommonResult.getMessage());
+        }
+        return zeroCommonResult.getData();
     }
 }

+ 4 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/auth/domain/LoginVo.java

@@ -18,15 +18,18 @@ public class LoginVo {
     /**
      * 登录设备类型
      * @see DeviceTypeEnum#type
+     * @mock 1
      */
     private String loginDeviceType;
     /**
      * 登录方式
      * @see LoginTypeEnum#type
+     * @mock 2
      */
     private String loginType;
     /**
      * 登录密码
+     * @mock 123456
      */
     private String passWord;
     /**
@@ -35,6 +38,7 @@ public class LoginVo {
     private String dingdingCode;
     /**
      * 手机号
+     * @mock 17337681032
      */
     private String phone;
     /**