From a2c792ee79e69224d71dc6204c6cc01f92b9384e Mon Sep 17 00:00:00 2001
From: manailin <261030956@qq.com>
Date: 星期一, 23 八月 2021 16:14:46 +0800
Subject: [PATCH] [新增]整理代码规范

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActBuildingServiceImpl.java |   52 +++++++++++++++++++++++++++++++---------------------
 1 files changed, 31 insertions(+), 21 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActBuildingServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActBuildingServiceImpl.java
index cfc284c..039d939 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActBuildingServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActBuildingServiceImpl.java
@@ -1,5 +1,14 @@
 package com.panzhihua.service_community.service.impl;
 
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -18,20 +27,14 @@
 import com.panzhihua.service_community.model.dos.GridBuildRelationDO;
 import com.panzhihua.service_community.service.ComActBuildingService;
 import com.panzhihua.service_community.service.GridBuildRelationService;
-import org.springframework.beans.BeanUtils;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
 
 /**
  * @author xyh
  * @date 2021/6/10 13:46
  */
 @Service
-public class ComActBuildingServiceImpl extends ServiceImpl<ComMngBuildingDAO, ComMngBuildingDO> implements ComActBuildingService {
+public class ComActBuildingServiceImpl extends ServiceImpl<ComMngBuildingDAO, ComMngBuildingDO>
+    implements ComActBuildingService {
 
     @Resource
     private ComActVillageDAO comActVillageDAO;
@@ -48,36 +51,42 @@
         ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO();
         importErrorVO.setErrorMsg("重复楼栋");
         StringBuilder sb = new StringBuilder();
-        for(ComMngBuildingExcelVO vo:newVoList){
-            ComMngVillageDO comMngVillageDO = comActVillageDAO.selectOne(new QueryWrapper<ComMngVillageDO>().eq("alley",vo.getAlley()).eq("house_num",vo.getDoorNo()).eq("community_id",communityId));
-            if(comMngVillageDO == null){
+        for (ComMngBuildingExcelVO vo : newVoList) {
+            ComMngVillageDO comMngVillageDO = comActVillageDAO.selectOne(new QueryWrapper<ComMngVillageDO>()
+                .eq("alley", vo.getAlley()).eq("house_num", vo.getDoorNo()).eq("community_id", communityId));
+            if (comMngVillageDO == null) {
                 continue;
             }
-            vo.setName(vo.getName().replace("栋",""));
-            List<ComMngBuildingDO> buildingDOList = this.baseMapper.selectList(new QueryWrapper<ComMngBuildingDO>().eq("street_id",comMngVillageDO.getStreetId()).eq("act_id",communityId).eq("village_id",comMngVillageDO.getVillageId()).eq("name",vo.getName()));
-            if(buildingDOList.size() > 0){
-                sb.append("街路巷:").append(vo.getAlley()).append(",门牌号:").append(vo.getDoorNo()).append(",楼栋号:").append(vo.getName()).append(";");
+            vo.setName(vo.getName().replace("栋", ""));
+            List<ComMngBuildingDO> buildingDOList = this.baseMapper.selectList(new QueryWrapper<ComMngBuildingDO>()
+                .eq("street_id", comMngVillageDO.getStreetId()).eq("act_id", communityId)
+                .eq("village_id", comMngVillageDO.getVillageId()).eq("name", vo.getName()));
+            if (buildingDOList.size() > 0) {
+                sb.append("街路巷:").append(vo.getAlley()).append(",门牌号:").append(vo.getDoorNo()).append(",楼栋号:")
+                    .append(vo.getName()).append(";");
                 continue;
             }
             ComMngBuildingDO comMngBuildingDO = new ComMngBuildingDO();
-            BeanUtils.copyProperties(vo,comMngBuildingDO);
+            BeanUtils.copyProperties(vo, comMngBuildingDO);
             comMngBuildingDO.setActId(comMngVillageDO.getCommunityId());
             comMngBuildingDO.setStreetId(comMngVillageDO.getStreetId());
             comMngBuildingDO.setVillageId(comMngVillageDO.getVillageId());
             ComActDO actDO = comActDAO.selectById(comMngVillageDO.getCommunityId());
             StringBuilder path = new StringBuilder();
-            path.append(vo.getAlley()).append(">").append(actDO.getName()).append(comMngVillageDO.getName()).append(">").append(vo.getName());
+            path.append(vo.getAlley()).append(">").append(actDO.getName()).append(comMngVillageDO.getName()).append(">")
+                .append(vo.getName());
             comMngBuildingDO.setPath(path.toString());
             comMngBuildingDO.setGridId(vo.getGridId());
             list.add(comMngBuildingDO);
-            GridBuildRelationDO gridBuildRelation = getGridBuildRelationDO(communityId, comMngVillageDO.getStreetId(), vo, comMngBuildingDO);
+            GridBuildRelationDO gridBuildRelation =
+                getGridBuildRelationDO(communityId, comMngVillageDO.getStreetId(), vo, comMngBuildingDO);
             keyList.add(gridBuildRelation);
         }
 
-        if(list.size()>0){
+        if (list.size() > 0) {
             this.saveBatch(list);
         }
-        if(sb.length() > 0 && !StringUtils.isEmpty(sb.toString())){
+        if (sb.length() > 0 && !StringUtils.isEmpty(sb.toString())) {
             errorList.add(importErrorVO);
             return R.fail(JSON.toJSONString(errorList));
         }
@@ -86,7 +95,8 @@
         return R.ok();
     }
 
-    public GridBuildRelationDO getGridBuildRelationDO(Long communityId, Long streetId, ComMngBuildingExcelVO vo, ComMngBuildingDO comMngBuildingDO) {
+    public GridBuildRelationDO getGridBuildRelationDO(Long communityId, Long streetId, ComMngBuildingExcelVO vo,
+        ComMngBuildingDO comMngBuildingDO) {
         GridBuildRelationDO gridBuildRelation = new GridBuildRelationDO();
         gridBuildRelation.setId(Snowflake.getId());
         gridBuildRelation.setBuildId(comMngBuildingDO.getId());

--
Gitblit v1.7.1