Przeglądaj źródła

规约:按阿里规约调整部分代码

lijie 3 lat temu
rodzic
commit
ef74a2c59b

+ 12 - 12
dmp-business/dmp-rwd-plus/src/main/java/com/persagy/dmp/rwd/version/service/impl/IObjectRelationHistoryServiceImpl.java

@@ -27,14 +27,14 @@ import java.util.List;
 public class IObjectRelationHistoryServiceImpl extends ServiceImpl<ObjectRelationHistoryMapper, ObjectRelationHistory>  implements IObjectRelationHistoryService {
 
     @Autowired
-    private ObjectRelationHistoryMapper ObjectRelationHistoryMapper;
+    private ObjectRelationHistoryMapper objectRelationHistoryMapper;
 
     /**
      * 数量统计对象关系历史数据
      */
     @Override
     public Integer queryCount(Wrapper<ObjectRelationHistory> queryWrapper) {
-        return ObjectRelationHistoryMapper.selectCount(queryWrapper);
+        return objectRelationHistoryMapper.selectCount(queryWrapper);
     }
 
     /**
@@ -44,7 +44,7 @@ public class IObjectRelationHistoryServiceImpl extends ServiceImpl<ObjectRelatio
      */
     @Override
     public List<ObjectRelationHistory> queryByCondition(Wrapper<ObjectRelationHistory> queryWrapper) {
-        return ObjectRelationHistoryMapper.selectList(queryWrapper);
+        return objectRelationHistoryMapper.selectList(queryWrapper);
     }
 
     /**
@@ -55,7 +55,7 @@ public class IObjectRelationHistoryServiceImpl extends ServiceImpl<ObjectRelatio
      */
     @Override
     public Page queryByCondition(Page page, Wrapper<ObjectRelationHistory> queryWrapper) {
-        return ObjectRelationHistoryMapper.selectPage(page, queryWrapper);
+        return objectRelationHistoryMapper.selectPage(page, queryWrapper);
     }
 
     /**
@@ -67,15 +67,15 @@ public class IObjectRelationHistoryServiceImpl extends ServiceImpl<ObjectRelatio
     @Override
     public ObjectRelationHistory insert(ObjectRelation vo) throws Exception {
         //设置对象历史信息
-        ObjectRelationHistory ObjectRelationHistory = new ObjectRelationHistory();
-        BeanUtils.copyProperties(vo,ObjectRelationHistory);
-        ObjectRelationHistory.setRelId(vo.getId());
-        ObjectRelationHistory.setId(null);
-        ObjectRelationHistory.setLastFlag(true);
-        ObjectRelationHistory.setStartTime(vo.getCreationTime());
+        ObjectRelationHistory objectRelationHistory = new ObjectRelationHistory();
+        BeanUtils.copyProperties(vo,objectRelationHistory);
+        objectRelationHistory.setRelId(vo.getId());
+        objectRelationHistory.setId(null);
+        objectRelationHistory.setLastFlag(true);
+        objectRelationHistory.setStartTime(vo.getCreationTime());
         //保存对象历史记录
-        save(ObjectRelationHistory);
-        return ObjectRelationHistory;
+        save(objectRelationHistory);
+        return objectRelationHistory;
     }
 
     /**

+ 19 - 20
dmp-business/dmp-rwd/src/main/java/com/persagy/dmp/rwd/digital/service/calstrategy/SpaceConnectionRelCalculateServiceImpl.java

@@ -11,7 +11,6 @@ import com.persagy.dmp.basic.dto.RelationCalRuleDTO;
 import com.persagy.dmp.common.helper.SpringHelper;
 import com.persagy.dmp.digital.entity.ObjectRelation;
 import com.persagy.dmp.rwd.basic.constant.EquipmentTypeEnum;
-import com.persagy.dmp.rwd.basic.utils.DigitalCommonUtils;
 import com.persagy.dmp.rwd.basic.utils.GeoToolsUtil;
 import com.persagy.dmp.rwd.digital.dao.ObjectDigitalMapper;
 import com.persagy.dmp.rwd.digital.dao.ObjectRelationMapper;
@@ -59,27 +58,27 @@ public class SpaceConnectionRelCalculateServiceImpl implements CalculateService
     @Override
     public void calculateRelation(RelationCalRuleDTO calRule, CalculatingDTO calculatingDTO) {
         // 1.获取有所在楼层的所有业务空间, 并按照所在楼层和业务空间类型排序
-        List<SpaceCalDTO> spaceCalDTOS = objectRelationMapper.querySpacesByProjectId(calculatingDTO);
-        if (CollUtil.isEmpty(spaceCalDTOS)){
+        List<SpaceCalDTO> spaceCalDtoS = objectRelationMapper.querySpacesByProjectId(calculatingDTO);
+        if (CollUtil.isEmpty(spaceCalDtoS)){
             return;
         }
         // 1.1 获得[[space,space]]的二维数组
-        Map<String,List<SpaceCalDTO>> spaceMap = spaceCalDTOS.stream()
+        Map<String,List<SpaceCalDTO>> spaceMap = spaceCalDtoS.stream()
                 .collect(Collectors.groupingBy(spaceCalDTO -> spaceCalDTO.getFloorId()+StrUtil.UNDERLINE+spaceCalDTO.getClassCode()));
 
         // 存储的关系列表
         List<ObjectRelation> resultList = new ArrayList<>();
         // 2.门的计算
-        calculateRelationInternal(resultList,spaceCalDTOS,calculatingDTO,spaceMap, EquipmentTypeEnum.CFBEDR.name(),
+        calculateRelationInternal(resultList,spaceCalDtoS,calculatingDTO,spaceMap, EquipmentTypeEnum.CFBEDR.name(),
                 calRule.getSpaceConnectionCal().getDoorCalFlag());
         // 3.窗的计算
-        calculateRelationInternal(resultList,spaceCalDTOS,calculatingDTO,spaceMap,EquipmentTypeEnum.CFBEWN.name(),
+        calculateRelationInternal(resultList,spaceCalDtoS,calculatingDTO,spaceMap,EquipmentTypeEnum.CFBEWN.name(),
                 calRule.getSpaceConnectionCal().getWindowCalFlag());
         // 4.虚拟墙的计算(暂时没有虚拟墙的概念,先置为false)
-        calculateRelationInternal(resultList,spaceCalDTOS,calculatingDTO,spaceMap,EquipmentTypeEnum.CFBEXX.name(),
+        calculateRelationInternal(resultList,spaceCalDtoS,calculatingDTO,spaceMap,EquipmentTypeEnum.CFBEXX.name(),
                 calRule.getSpaceConnectionCal().getVirtualWindowCalFlag());
         // 5.元空间的计算
-        ispaceCalculateRelationInternal(resultList,spaceCalDTOS,calculatingDTO,spaceMap,
+        ispaceCalculateRelationInternal(resultList,spaceCalDtoS,calculatingDTO,spaceMap,
                 calRule.getSpaceConnectionCal().getIspaceCalFlag());
         if (CollUtil.isNotEmpty(resultList)){
             // 3.根据图类型编码,边类型编码,relValue,项目id,集团编码删除关系
@@ -91,7 +90,7 @@ public class SpaceConnectionRelCalculateServiceImpl implements CalculateService
     /***
      * Description: 元空间的计算
      * @param resultList : 结果集
-     * @param spaceCalDTOS : 空间数据
+     * @param spaceCalDtoS : 空间数据
      * @param calculatingDTO : 请求参数
      * @param spaceMap:{floorId_classCode:空间对象}
      * @param calFlag : 是否计算的标记
@@ -100,7 +99,7 @@ public class SpaceConnectionRelCalculateServiceImpl implements CalculateService
      * @date :2021/10/11 22:06
      * Update By lijie 2021/10/11 22:06
      */
-    private void ispaceCalculateRelationInternal(List<ObjectRelation> resultList, List<SpaceCalDTO> spaceCalDTOS,
+    private void ispaceCalculateRelationInternal(List<ObjectRelation> resultList, List<SpaceCalDTO> spaceCalDtoS,
                                                  CalculatingDTO calculatingDTO,
                                                  Map<String, List<SpaceCalDTO>> spaceMap,
                                                  Boolean calFlag) {
@@ -108,7 +107,7 @@ public class SpaceConnectionRelCalculateServiceImpl implements CalculateService
             return;
         }
         // 1.根据modelId批量查询门
-        List<SpaceCalDTO> ispaces = objectDigitalMapper.queryIspacesByModelIds(spaceCalDTOS.stream()
+        List<SpaceCalDTO> ispaces = objectDigitalMapper.queryIspacesByModelIds(spaceCalDtoS.stream()
                 .map(SpaceCalDTO::getFloorModelId).collect(Collectors.toSet()),calculatingDTO);
         if (CollUtil.isEmpty(ispaces)){
             return;
@@ -155,7 +154,7 @@ public class SpaceConnectionRelCalculateServiceImpl implements CalculateService
     /***
      * Description: 通过门计算空间连通性
      * @param resultList : 结果集
-     * @param spaceCalDTOS : 空间数据
+     * @param spaceCalDtoS : 空间数据
      * @param calculatingDTO : 请求参数
      * @param spaceMap:{floorId_classCode:空间对象}
      * @return : void
@@ -164,7 +163,7 @@ public class SpaceConnectionRelCalculateServiceImpl implements CalculateService
      * Update By lijie 2021/10/11 17:44
      */
     private void calculateRelationInternal(List<ObjectRelation> resultList,
-                                       List<SpaceCalDTO> spaceCalDTOS,
+                                       List<SpaceCalDTO> spaceCalDtoS,
                                        CalculatingDTO calculatingDTO,
                                        Map<String, List<SpaceCalDTO>> spaceMap,
                                        String classCode,Boolean calFlag) {
@@ -172,7 +171,7 @@ public class SpaceConnectionRelCalculateServiceImpl implements CalculateService
             return;
         }
         // 1.根据modelId批量查询门
-        List<SpaceCalDTO> doors = objectDigitalMapper.queryEquipmentsByModelIds(spaceCalDTOS.stream()
+        List<SpaceCalDTO> doors = objectDigitalMapper.queryEquipmentsByModelIds(spaceCalDtoS.stream()
                 .map(SpaceCalDTO::getFloorModelId).collect(Collectors.toSet()),calculatingDTO,classCode);
         if (CollUtil.isEmpty(doors)){
             return;
@@ -297,13 +296,13 @@ public class SpaceConnectionRelCalculateServiceImpl implements CalculateService
         double distance = getSegmentDistance(closedFirstX, closedFirstY, closedSecondX, closedSecondY);
         // 2.计算该直线的斜率
         Double k=null;
-        if(closedFirstX!=closedSecondX){
+        if(Double.compare(closedFirstX,closedSecondX)!=0){
             k=(closedFirstY-closedSecondY)/(closedFirstX-closedSecondX);
         }
         // 2.1 获得垂直线的斜率
         Double verticalK = getVerticalK(k);
         // 2.2 获得当前直线的a
-        Double closedA = getAByPointAndK(closedFirstX,closedFirstY,k);
+        Double closedA = getAbyPointAndK(closedFirstX,closedFirstY,k);
         List<OpenPointDTO> result = new ArrayList<>();
         if (distance>deltaDistance){
             // 距离大于delta_distance, 则足够开两个门
@@ -311,8 +310,8 @@ public class SpaceConnectionRelCalculateServiceImpl implements CalculateService
                     k,closedA,deltaDistance,closedSecondX,closedSecondY);
             OpenPointDTO secondSegOpenPoint = getPointByDistanceOnSegment(closedSecondX,closedSecondY,
                     k,closedA,deltaDistance,closedFirstX,closedFirstY);
-            Double firstA = getAByPointAndK(firstSegOpenPoint.getDestX(), firstSegOpenPoint.getDestY(), verticalK);
-            Double secondA = getAByPointAndK(secondSegOpenPoint.getDestX(), secondSegOpenPoint.getDestY(), verticalK);
+            Double firstA = getAbyPointAndK(firstSegOpenPoint.getDestX(), firstSegOpenPoint.getDestY(), verticalK);
+            Double secondA = getAbyPointAndK(secondSegOpenPoint.getDestX(), secondSegOpenPoint.getDestY(), verticalK);
             OpenPointDTO firstDistance = getPointByDistance(firstSegOpenPoint.getDestX(), firstSegOpenPoint.getDestY(), verticalK, firstA, doorLength);
             OpenPointDTO secondDistance = getPointByDistance(secondSegOpenPoint.getDestX(), secondSegOpenPoint.getDestY(), verticalK, secondA, doorLength);
             result.add(OpenPointDTO.builder().destX(firstDistance.getFirstX()).destY(firstDistance.getFirstY()).build());
@@ -324,7 +323,7 @@ public class SpaceConnectionRelCalculateServiceImpl implements CalculateService
         // 中间开门
         OpenPointDTO openPoint = getPointByDistanceOnSegment(closedFirstX, closedFirstY,
                 k, closedA, distance / 2, closedSecondX, closedSecondY);
-        Double verticalA = getAByPointAndK(openPoint.getDestX(), openPoint.getDestY(), verticalK);
+        Double verticalA = getAbyPointAndK(openPoint.getDestX(), openPoint.getDestY(), verticalK);
         OpenPointDTO firstDistance = getPointByDistance(openPoint.getDestX(), openPoint.getDestY(), verticalK, verticalA, doorLength);
         result.add(OpenPointDTO.builder().destX(firstDistance.getFirstX()).destY(firstDistance.getFirstY()).build());
         result.add(OpenPointDTO.builder().destX(firstDistance.getSecondX()).destY(firstDistance.getSecondY()).build());
@@ -398,7 +397,7 @@ public class SpaceConnectionRelCalculateServiceImpl implements CalculateService
      * @date :2021/10/11 20:34
      * Update By lijie 2021/10/11 20:34
      */
-    private Double getAByPointAndK(double x, double y, Double k) {
+    private Double getAbyPointAndK(double x, double y, Double k) {
         if (null==k){
             return 0.0;
         }

+ 8 - 8
dmp-business/dmp-rwd/src/main/java/com/persagy/dmp/rwd/digital/service/impl/ObjectDigitalServiceImpl.java

@@ -594,14 +594,14 @@ public class ObjectDigitalServiceImpl extends ServiceImpl<ObjectDigitalMapper, O
         if (CollUtil.isEmpty(objIds)){
             return;
         }
-        List<ObjectDigital> relVOs = relationService.queryRelatedObjects(objIds, CollUtil
+        List<ObjectDigital> relVos = relationService.queryRelatedObjects(objIds, CollUtil
                 .newHashSet(DigitalRelCode.EQ_2_EC.getIndex(), DigitalRelCode.BD_2_FL.getIndex(),
                         DigitalRelCode.BD_2_SP.getIndex(), DigitalRelCode.SY_2_BD.getIndex(),
                         DigitalRelCode.EQ_2_BD.getIndex(),DigitalRelCode.BD_2_SH.getIndex()));
-        if (CollUtil.isEmpty(relVOs)){
+        if (CollUtil.isEmpty(relVos)){
             return;
         }
-        Map<String, ObjectDigital> digitalMap = relVOs.stream()
+        Map<String, ObjectDigital> digitalMap = relVos.stream()
                 .collect(Collectors.toMap(ObjectDigital::getId, relVO -> relVO, (k1, k2) -> k1));
         for (ObjectDigital vo : vos) {
             if (!digitalMap.containsKey(vo.getId())){
@@ -741,24 +741,24 @@ public class ObjectDigitalServiceImpl extends ServiceImpl<ObjectDigitalMapper, O
      * @return Map<id, Set<RemoveColumn>>
      */
     private Map<String, Set<String>> convertRemoveInfo(List<ObjectDigital> voList){
-        final String REMOVE_FIELD = "$remove";
+        final String removeField = "$remove";
         Map<String, Set<String>> removeMap = new HashMap<>(16);
         for (ObjectDigital vo : voList) {
             ObjectNode infos = vo.getInfos();
             // 没有此列时不处理
-            if(infos == null || infos.size() <= 0 || infos.get(REMOVE_FIELD) == null
-                || !infos.get(REMOVE_FIELD).isArray()) {
+            if(infos == null || infos.size() <= 0 || infos.get(removeField) == null
+                || !infos.get(removeField).isArray()) {
                 continue;
             }
             // 收集删除列
-            ArrayNode removeNode = infos.withArray(REMOVE_FIELD);
+            ArrayNode removeNode = infos.withArray(removeField);
             Set<String> removeSet = new HashSet<>();
             removeMap.put(vo.getId(), removeSet);
             for(int i = 0,j = removeNode.size();i < j;i++) {
                 removeSet.add(removeNode.get(i).textValue());
             }
             // 处理完后,删除此项
-            infos.remove(REMOVE_FIELD);
+            infos.remove(removeField);
         }
         return removeMap;
     }

+ 8 - 8
dmp-cloud/dmp-file/src/main/java/com/persagy/dmp/file/service/IFileStorageService.java

@@ -109,24 +109,24 @@ public interface IFileStorageService {
     /***
      * Description: 批量创建分片上传外链
      * @param bucketName : 存储桶名称
-     * @param objectMD5 : 欲上传分片文件主文件的MD5
+     * @param objectMd5 : 欲上传分片文件主文件的MD5
      * @param chunkCount : 分片数量
      * @return : uploadChunkUrls
      * @author : lijie
      * Update By lijie 2021/10/16 14:43
      */
-    List<String> createUploadChunkUrlList(String bucketName, String objectMD5, Integer chunkCount);
+    List<String> createUploadChunkUrlList(String bucketName, String objectMd5, Integer chunkCount);
 
     /***
      * Description: 创建指定序号的分片文件上传外链
      * @param bucketName : 存储桶名称
-     * @param objectMD5 : 欲上传分片文件主文件的MD5
+     * @param objectMd5 : 欲上传分片文件主文件的MD5
      * @param partNumber : 分片序号
      * @return : uploadChunkUrl
      * @author : lijie
      * Update By lijie 2021/10/16 14:44
      */
-    String createUploadChunkUrl(String bucketName, String objectMD5, Integer partNumber);
+    String createUploadChunkUrl(String bucketName, String objectMd5, Integer partNumber);
 
     /***
      * Description: 获取对象文件名称列表
@@ -152,22 +152,22 @@ public interface IFileStorageService {
     /***
      * Description: 获取分片文件名称列表
      * @param bucketName : 存储桶名称
-     * @param ObjectMd5 : 对象Md5
+     * @param objectMd5 : 对象Md5
      * @return : objectChunkNames
      * @author : lijie
      * Update By lijie 2021/10/16 14:48
      */
-    List<String> listChunkObjectNames(String bucketName, String ObjectMd5);
+    List<String> listChunkObjectNames(String bucketName, String objectMd5);
 
     /***
      * Description: 获取分片名称地址HashMap key=分片序号 value=分片文件地址
      * @param bucketName : 存储桶名称
-     * @param ObjectMd5 : 对象Md5
+     * @param objectMd5 : 对象Md5
      * @return : objectChunkNameMap
      * @author : lijie
      * Update By lijie 2021/10/16 14:49
      */
-    Map<Integer, String> mapChunkObjectNames(String bucketName, String ObjectMd5);
+    Map<Integer, String> mapChunkObjectNames(String bucketName, String objectMd5);
 
     /***
      * Description: 合并分片文件成对象文件

+ 4 - 4
dmp-cloud/dmp-file/src/main/java/com/persagy/dmp/file/service/impl/HdfsStorageServiceImpl.java

@@ -209,12 +209,12 @@ public class HdfsStorageServiceImpl implements IFileStorageService {
     }
 
     @Override
-    public List<String> createUploadChunkUrlList(String bucketName, String objectMD5, Integer chunkCount) {
+    public List<String> createUploadChunkUrlList(String bucketName, String objectMd5, Integer chunkCount) {
         return null;
     }
 
     @Override
-    public String createUploadChunkUrl(String bucketName, String objectMD5, Integer partNumber) {
+    public String createUploadChunkUrl(String bucketName, String objectMd5, Integer partNumber) {
         return null;
     }
 
@@ -229,12 +229,12 @@ public class HdfsStorageServiceImpl implements IFileStorageService {
     }
 
     @Override
-    public List<String> listChunkObjectNames(String bucketName, String ObjectMd5) {
+    public List<String> listChunkObjectNames(String bucketName, String objectMd5) {
         return null;
     }
 
     @Override
-    public Map<Integer, String> mapChunkObjectNames(String bucketName, String ObjectMd5) {
+    public Map<Integer, String> mapChunkObjectNames(String bucketName, String objectMd5) {
         return null;
     }
 

+ 10 - 10
dmp-cloud/dmp-file/src/main/java/com/persagy/dmp/file/service/impl/MinioStorageServiceImpl.java

@@ -277,27 +277,27 @@ public class MinioStorageServiceImpl implements IFileStorageService, Initializin
     /***
      * Description: 批量创建分片上传外链
      * @param bucketName : 存储桶名称
-     * @param objectMD5 : 欲上传分片文件主文件的MD5
+     * @param objectMd5 : 欲上传分片文件主文件的MD5
      * @param chunkCount : 分片数量
      * @return : uploadChunkUrls
      * @author : lijie
      * Update By lijie 2021/10/16 14:43
      */
     @Override
-    public List<String> createUploadChunkUrlList(String bucketName, String objectMD5, Integer chunkCount){
+    public List<String> createUploadChunkUrlList(String bucketName, String objectMd5, Integer chunkCount){
         if (StrUtil.isBlank(bucketName)){
             bucketName = chunkBucKet;
         }
-        if (StrUtil.isBlank(objectMD5)){
+        if (StrUtil.isBlank(objectMd5)){
             return null;
         }
-        objectMD5 += "/";
+        objectMd5 += "/";
         if(null == chunkCount || 0 == chunkCount){
             return null;
         }
         List<String> urlList = new ArrayList<>(chunkCount);
         for (int i = 1; i <= chunkCount; i++){
-            String objectName = objectMD5 + i + ".chunk";
+            String objectName = objectMd5 + i + ".chunk";
             urlList.add(createUploadUrl(bucketName,objectName,DEFAULT_EXPIRY));
         }
         return urlList;
@@ -306,22 +306,22 @@ public class MinioStorageServiceImpl implements IFileStorageService, Initializin
     /***
      * Description: 创建指定序号的分片文件上传外链
      * @param bucketName : 存储桶名称
-     * @param objectMD5 : 欲上传分片文件主文件的MD5
+     * @param objectMd5 : 欲上传分片文件主文件的MD5
      * @param partNumber : 分片序号
      * @return : uploadChunkUrl
      * @author : lijie
      * Update By lijie 2021/10/16 14:44
      */
     @Override
-    public String createUploadChunkUrl(String bucketName, String objectMD5, Integer partNumber){
+    public String createUploadChunkUrl(String bucketName, String objectMd5, Integer partNumber){
         if (StrUtil.isBlank(bucketName)){
             bucketName = chunkBucKet;
         }
-        if (StrUtil.isBlank(objectMD5)){
+        if (StrUtil.isBlank(objectMd5)){
             return null;
         }
-        objectMD5 += "/" + partNumber + ".chunk";
-        return createUploadUrl(bucketName,objectMD5,DEFAULT_EXPIRY);
+        objectMd5 += "/" + partNumber + ".chunk";
+        return createUploadUrl(bucketName,objectMd5,DEFAULT_EXPIRY);
     }
 
     /***