From 83479607bc5ffea9ad5e9be36088c7f742ba00d9 Mon Sep 17 00:00:00 2001
From: xyh <18782104331@139.com>
Date: 星期二, 29 六月 2021 11:03:17 +0800
Subject: [PATCH] 实有人口导入,走访导出

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 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 dbdc78e..cdbf2fb 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
@@ -358,6 +358,7 @@
                     + vo.getFloor() + vo.getUnitNo() + vo.getHouseNo();
             vo.setAddress(address);
 
+            //todo 后期优化改为批量
             //先判断房屋是否存在
             ComMngPopulationHouseDO populationHouseDO = comMngPopulationHouseDAO.selectOne(new QueryWrapper<ComMngPopulationHouseDO>().lambda()
                     .eq(ComMngPopulationHouseDO::getCommunityId, communityId).eq(ComMngPopulationHouseDO::getVillageId, comMngVillageDO.getVillageId())
@@ -366,6 +367,7 @@
             if (populationHouseDO == null) {
                 //房屋信息不存在建立房屋信息
                 populationHouseDO = savePopulationHouse(vo, comMngVillageDO, communityId, address, areaPath, comActDO.getName());
+                vo.setHouseId(populationHouseDO.getId());
             }
 
             if (StringUtils.isEmpty(vo.getName()) && StringUtils.isEmpty(vo.getCardNo())) {
@@ -382,7 +384,7 @@
             } else {
                 //如果存在人口信息,且是自用房,则更新人口默认的房屋信息
                 if (vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())) {
-                    populationDO = updatePopulationHouseUse(vo, populationDO);
+                    populationDO = updatePopulationDO(vo, populationDO);
                 }
             }
 
@@ -415,7 +417,7 @@
         return R.ok();
     }
 
-    private ComMngPopulationDO updatePopulationHouseUse(ComMngPopulationServeExcelVO vo, ComMngPopulationDO populationDO) throws Exception {
+    private ComMngPopulationDO updatePopulationDO(ComMngPopulationServeExcelVO vo, ComMngPopulationDO populationDO) throws Exception {
         populationDO.setRoad(vo.getRoad());
         populationDO.setDoorNo(vo.getDoorNo());
         populationDO.setFloor(vo.getFloor());
@@ -423,8 +425,10 @@
         populationDO.setHouseNo(vo.getHouseNo());
         populationDO.setCardNo(vo.getCardNo());
         populationDO.setCardNoStr(vo.getCardNo());
+        if(vo.getIsResidence().intValue() == 1){
+            populationDO.setHouseId(vo.getHouseId());
+        }
         if (StringUtils.isNotEmpty(populationDO.getPhone())) {
-//            populationDO.setPhone(AESUtil.encrypt128(populationDO.getPhone(), aesKey));
             populationDO.setPhone(populationDO.getPhone());
         }
         this.baseMapper.updateById(populationDO);
@@ -444,6 +448,9 @@
         populationDO.setCardNo(vo.getCardNo());
         populationDO.setCardNoStr(vo.getCardNo());
         populationDO.setUpdateAt(new Date());
+        if(vo.getIsResidence().intValue() == 1){
+            populationDO.setHouseId(vo.getHouseId());
+        }
         this.baseMapper.insert(populationDO);
         return populationDO;
     }

--
Gitblit v1.7.1