From 051a7ddfc147d61285544e3f2d9eae057f2c774b Mon Sep 17 00:00:00 2001
From: 罗元桥 <2376770955@qq.com>
Date: 星期日, 01 八月 2021 15:21:54 +0800
Subject: [PATCH] Merge branch 'test' into 'master'

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java |   42 ++++++++++++++++++++++++------------------
 1 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java
index 4699ff0..d47096b 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java
@@ -365,20 +365,26 @@
     public R listSavePopulation(List<ComMngPopulationServeExcelVO> list, Long communityId) throws Exception {
         List<ComMngPopulationMistakeExcelVO> mistakes = new ArrayList<>();
 //        List<ComMngPopulationImportErrorVO> populationImportErrorVOList = new ArrayList<>();
-        //查询该社区
-        ComActDO comActDO = comActDAO.selectById(communityId);
-        //查询该社区的省市区地址
-        AreaAddressVO areaAddressVO = populationDAO.getAreaAddress(comActDO.getProvinceCode(), comActDO.getCityCode(), comActDO.getAreaCode());
-        //查询社区上街道信息
-        String streetName = "";
-        if (comActDO.getStreetId() != null) {
-            ComStreetDO streetDO = comStreetDAO.selectById(comActDO.getStreetId());
-            if (streetDO != null) {
-                streetName = streetDO.getName();
-            }
+        //查询社区信息
+        ComPopulationActVO populationActVO = comActDAO.getPopulationActById(communityId);
+        if(populationActVO == null){
+            log.error("未查询到社区信息");
+            return R.fail("未查询到社区信息");
         }
+        //查询该社区
+//        ComActDO comActDO = comActDAO.selectById(communityId);
+        //查询该社区的省市区地址
+//        AreaAddressVO areaAddressVO = populationDAO.getAreaAddress(comActDO.getProvinceCode(), comActDO.getCityCode(), comActDO.getAreaCode());
+        //查询社区上街道信息
+        String streetName = populationActVO.getStreetName();
+//        if (comActDO.getStreetId() != null) {
+//            ComStreetDO streetDO = comStreetDAO.selectById(comActDO.getStreetId());
+//            if (streetDO != null) {
+//                streetName = streetDO.getName();
+//            }
+//        }
         StringBuilder areaPath = new StringBuilder();
-        areaPath.append(areaAddressVO.getProvince()).append(">").append(areaAddressVO.getCity()).append(">").append(areaAddressVO.getDistrict()).append(">");
+        areaPath.append(populationActVO.getProvinceName()).append(">").append(populationActVO.getCityName()).append(">").append(populationActVO.getDistrictName()).append(">");
         //处理实有人口信息
         for (ComMngPopulationServeExcelVO vo : list) {
             if (vo.getDoorNo().contains("号")) {
@@ -410,7 +416,7 @@
             }
 
             StringBuilder address = new StringBuilder();
-            address.append(areaAddressVO.getProvince()).append(areaAddressVO.getCity()).append(areaAddressVO.getDistrict())
+            address.append(populationActVO.getProvinceName()).append(populationActVO.getCityName()).append(populationActVO.getDistrictName())
                     .append(streetName).append(comMngVillageDO.getAlley()).append(vo.getDoorNo()).append("号").append(vo.getFloor()).append("栋")
                     .append(vo.getUnitNo()).append("单元").append(vo.getHouseNo()).append("号");
 
@@ -424,7 +430,7 @@
                     .eq(ComMngPopulationHouseDO::getHouseNo, vo.getHouseNo()));
             if (populationHouseDO == null) {
                 //房屋信息不存在建立房屋信息
-                populationHouseDO = savePopulationHouse(vo, comMngVillageDO, communityId, areaPath, comActDO.getName());
+                populationHouseDO = savePopulationHouse(vo, comMngVillageDO, communityId, areaPath, populationActVO.getName());
                 vo.setHouseId(populationHouseDO.getId());
             }
 
@@ -440,14 +446,14 @@
 
             if (populationDOList.isEmpty()) {
                 //不存在实有人口,则新增
-                populationDO = savePopulationDO(vo, comActDO, comMngVillageDO);
+                populationDO = savePopulationDO(vo, populationActVO, comMngVillageDO);
 //                ComMngPopulationHouseUserDO comMngPopulationHouseUserDO = savePopulationHouseUser(vo, populationDO, populationHouseDO);
             } else {
                 //如果存在人口信息,且是自用房,则更新人口默认的房屋信息
 //                if (vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())) {
 //                    populationDO = updatePopulationDO(vo, populationDO);
 //                }
-                populationDO = updatePopulationDO(vo, comActDO, populationDOList.get(0));
+                populationDO = updatePopulationDO(vo, populationActVO, populationDOList.get(0));
             }
 
             //处理实有人口房屋居住信息
@@ -480,7 +486,7 @@
         return R.ok();
     }
 
-    private ComMngPopulationDO updatePopulationDO(ComMngPopulationServeExcelVO vo, ComActDO comActDO, ComMngPopulationDO populationDO) throws Exception {
+    private ComMngPopulationDO updatePopulationDO(ComMngPopulationServeExcelVO vo, ComPopulationActVO comActDO, ComMngPopulationDO populationDO) throws Exception {
         UpdateWrapper<ComMngPopulationDO> updateWrapper = new UpdateWrapper<>();
         updateWrapper.eq("id",populationDO.getId());
         ComMngPopulationDO update = new ComMngPopulationDO();
@@ -515,7 +521,7 @@
         return populationDO;
     }
 
-    private ComMngPopulationDO savePopulationDO(ComMngPopulationServeExcelVO vo, ComActDO comActDO, ComMngVillageDO comMngVillageDO) {
+    private ComMngPopulationDO savePopulationDO(ComMngPopulationServeExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO) {
         ComMngPopulationDO populationDO = new ComMngPopulationDO();
         BeanUtils.copyProperties(vo, populationDO);
         populationDO.setId(Snowflake.getId());

--
Gitblit v1.7.1