From b26057afa8d0e4528908e48eea3aeadcc2d678b3 Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期三, 02 六月 2021 10:26:11 +0800
Subject: [PATCH] 修改bug

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java |   56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 55 insertions(+), 1 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 03a3485..9b8501a 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
@@ -198,6 +198,42 @@
         }
         page.setSize(pageSize);
         page.setCurrent(pageNum);
+
+        if(comMngPopulationVO.getHouseId() != null){
+            ComMngPopulationHouseDO houseDO = comMngPopulationHouseDAO.selectById(comMngPopulationVO.getHouseId());
+            if(houseDO != null){
+                switch (comMngPopulationVO.getLevel()){
+                    case 1:
+                        comMngPopulationVO.setRoad(houseDO.getAlley());
+                        break;
+                    case 2:
+                        comMngPopulationVO.setRoad(houseDO.getAlley());
+                        comMngPopulationVO.setDoorNo(houseDO.getHouseNum());
+                        break;
+                    case 3:
+                        comMngPopulationVO.setRoad(houseDO.getAlley());
+                        comMngPopulationVO.setDoorNo(houseDO.getHouseNum());
+                        comMngPopulationVO.setFloor(houseDO.getFloor());
+                        break;
+                    case 4:
+                        comMngPopulationVO.setRoad(houseDO.getAlley());
+                        comMngPopulationVO.setDoorNo(houseDO.getHouseNum());
+                        comMngPopulationVO.setFloor(houseDO.getFloor());
+                        comMngPopulationVO.setUnitNo(houseDO.getUnitNo());
+                        break;
+                    case 5:
+                        comMngPopulationVO.setRoad(houseDO.getAlley());
+                        comMngPopulationVO.setDoorNo(houseDO.getHouseNum());
+                        comMngPopulationVO.setFloor(houseDO.getFloor());
+                        comMngPopulationVO.setUnitNo(houseDO.getUnitNo());
+                        comMngPopulationVO.setHouseNo(houseDO.getHouseNo());
+                        break;
+                    default:
+                        break;
+                }
+            }
+        }
+
         IPage<ComMngPopulationVO> iPage = populationDAO.pagePopulation(page, comMngPopulationVO);
         if(!iPage.getRecords().isEmpty()){
             iPage.getRecords().forEach(populDO -> {
@@ -276,8 +312,12 @@
                 continue;
             }
 
+            if(!comMngVillageDO.getHouseNum().contains("号")){
+                comMngVillageDO.setHouseNum(comMngVillageDO.getHouseNum() + "号");
+            }
+
             address = areaAddressVO.getProvince() + areaAddressVO.getCity()
-                    + areaAddressVO.getDistrict() + street + comMngVillageDO.getAlley() + comMngVillageDO.getHouseNum() + "号"
+                    + areaAddressVO.getDistrict() + street + comMngVillageDO.getAlley() + comMngVillageDO.getHouseNum()
                     + vo.getFloor() + vo.getUnitNo() + vo.getHouseNo();
             vo.setAddress(address);
 
@@ -308,6 +348,7 @@
                     populationHouseDO.setUnitNo(vo.getUnitNo());
                     populationHouseDO.setHouseNo(vo.getHouseNo());
                     populationHouseDO.setAddress(address);
+                    populationHouseDO.setUpdateAt(new Date());
                     if(StringUtils.isEmpty(vo.getName()) && StringUtils.isEmpty(vo.getCardNo())){
                         populationHouseDO.setIsEmpty(PopulIsOksEnum.YES.getCode());
                     }
@@ -527,7 +568,14 @@
      * @return
      */
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public R deletePopulations(List<Long> Ids) {
+        if(!Ids.isEmpty()){
+            Ids.forEach(id -> {
+                //清除用户房屋居住信息
+                comMngPopulationHouseUserDAO.deletePopulationHouseByUserId(id);
+            });
+        }
         int delete = populationDAO.deleteBatchIds(Ids);
         if (delete > 0) {
             return R.ok();
@@ -580,6 +628,12 @@
             return R.fail();
         }
         BeanUtils.copyProperties(vo,populationDO);
+        if(StringUtils.isEmpty(vo.getLabel())){
+            populationDO.setLabel(null);
+        }
+        if(StringUtils.isEmpty(vo.getRemark())){
+            populationDO.setRemark(null);
+        }
         populationDO.setCardNo(null);
         populationDO.setPhone(AESUtil.encrypt128(vo.getPhone(), aesKey));
 

--
Gitblit v1.7.1