From 2eea3290641657d2ee13edd90d27f8b2ec01c209 Mon Sep 17 00:00:00 2001
From: 罗yu 元桥 <2376770955@qq.com>
Date: 星期六, 08 五月 2021 18:23:48 +0800
Subject: [PATCH] Merge branch 'test' into 'master'

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java |   83 ++++++++++++++++++++++++++++++++++++++---
 1 files changed, 77 insertions(+), 6 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 e86f969..27f2053 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
@@ -10,12 +10,16 @@
 import com.panzhihua.common.exceptions.ServiceException;
 import com.panzhihua.common.model.dtos.community.ComMngPopulationDTO;
 import com.panzhihua.common.model.dtos.community.ComMngPopulationTagDTO;
+import com.panzhihua.common.model.dtos.user.PageInputUserDTO;
 import com.panzhihua.common.model.helper.AESUtil;
 import com.panzhihua.common.model.dtos.community.PageComActDTO;
 import com.panzhihua.common.model.helper.AESUtil;
 import com.panzhihua.common.model.vos.R;
 import com.panzhihua.common.model.vos.community.*;
 import com.panzhihua.common.model.vos.user.ComHouseMemberVo;
+import com.panzhihua.common.model.vos.user.ComMngFamilyInfoVO;
+import com.panzhihua.common.model.vos.user.InputUserInfoVO;
+import com.panzhihua.common.model.vos.user.UserElectronicFileVO;
 import com.panzhihua.service_community.dao.ComActDAO;
 import com.panzhihua.service_community.dao.ComActVillageDAO;
 import com.panzhihua.service_community.dao.ComMngPopulationDAO;
@@ -29,6 +33,7 @@
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 import org.springframework.stereotype.Service;
 import org.springframework.util.ObjectUtils;
+import org.springframework.util.StringUtils;
 
 import javax.annotation.Resource;
 import javax.crypto.BadPaddingException;
@@ -122,15 +127,28 @@
     public R detailPopulation(Long populationId) {
         ComMngPopulationDO comMngPopulationDO = populationDAO.selectById(populationId);
         if (ObjectUtils.isEmpty(comMngPopulationDO)) {
-            return R.fail();
+            return R.fail("用户信息不存在");
         }
         ComMngPopulationVO comMngPopulationVO = new ComMngPopulationVO();
         BeanUtils.copyProperties(comMngPopulationDO, comMngPopulationVO);
 
-        //查询房屋成员信息
+        //查询户主关系信息
         List<ComHouseMemberVo> comMngFamilyInfoVOS = populationDAO.listHouseMermberByUserId(comMngPopulationDO);
         if (!comMngFamilyInfoVOS.isEmpty()) {
             comMngPopulationVO.setComMngFamilyInfoVOS(comMngFamilyInfoVOS);
+        }
+
+        //查询当前用户电子档信息
+        if(!StringUtils.isEmpty(comMngPopulationDO.getCardNo())){
+            UserElectronicFileVO electronicFileVO = populationDAO.getSysUserElectronicFile(comMngPopulationDO.getCardNo());
+            if(electronicFileVO != null){
+                comMngPopulationVO.setUserElectronicFileVO(electronicFileVO);
+                //查询家庭成员信息
+                List<ComMngFamilyInfoVO> familyInfoVOList = populationDAO.listFamilyByUserId(electronicFileVO.getUserId());
+                if(!familyInfoVOList.isEmpty()){
+                    comMngPopulationVO.setFamilyInfoVOList(familyInfoVOList);
+                }
+            }
         }
         return R.ok(comMngPopulationVO);
     }
@@ -207,7 +225,7 @@
             if (result) {
                 ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO();
                 importErrorVO.setErrorMsg("导入实有人口已存在(" + vo.getCardNo() + ")");
-                importErrorVO.setErrorPosition("第" + index + "行,第2列");
+                importErrorVO.setErrorPosition("第" + index + "行,第2列");
                 populationImportErrorVOList.add(importErrorVO);
                 index++;
                 continue;
@@ -222,7 +240,7 @@
             if (comMngVillageDO == null) {
                 ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO();
                 importErrorVO.setErrorMsg("查无:" + vo.getRoad() + "小区/房租地址,请先新建地址");
-                importErrorVO.setErrorPosition("第" + index + "行,第7,8列");
+                importErrorVO.setErrorPosition("第" + index + "行,第7、8列");
                 populationImportErrorVOList.add(importErrorVO);
                 index++;
                 continue;
@@ -237,11 +255,16 @@
             index++;
         }
         //如果有错误,返回错误
+        //暂时注释,等客户完成任务需要恢复
+        /*if(!populationImportErrorVOList.isEmpty()){
+            return R.fail(JSON.toJSONString(populationImportErrorVOList));
+        }
+        this.saveBatch(populationDOList);*/
+
+        this.saveBatch(populationDOList);
         if(!populationImportErrorVOList.isEmpty()){
             return R.fail(JSON.toJSONString(populationImportErrorVOList));
         }
-
-        this.saveBatch(populationDOList);
         return R.ok("共计导入实有人口数量:" + populationDOList.size());
     }
 
@@ -424,4 +447,52 @@
         this.updateById(populationDO);
         return R.ok();
     }
+
+    @Override
+    public R specialInputUser(PageInputUserDTO pageInputUserDTO){
+        IPage<InputUserInfoVO> iPage = populationDAO.specialInputUser(new Page<>(pageInputUserDTO.getPageNum()
+                ,pageInputUserDTO.getPageSize()), pageInputUserDTO);
+        return R.ok(iPage);
+    }
+
+    /**
+     * 删除特殊群体人员
+     * @param id    特殊群体id
+     * @return  删除结果
+     */
+    @Override
+    public R deleteSpecialInputUser(Long id){
+        //查询特殊群体人员
+        ComMngPopulationDO populationDO = this.baseMapper.selectById(id);
+        if(populationDO == null){
+            return R.fail("未查询到该记录");
+        }
+        populationDO.setLabel(null);
+        if(this.baseMapper.updateById(populationDO) > 0){
+            return R.ok();
+        }else{
+            return R.fail();
+        }
+    }
+
+    /**
+     * 查询实有人口电子档信息
+     * @param populationId  实有人口id
+     * @return  实有人口电子档信息
+     */
+    @Override
+    public R electronicArchivesPopulation(Long populationId){
+        ComMngPopulationDO comMngPopulationDO = populationDAO.selectById(populationId);
+        if (ObjectUtils.isEmpty(comMngPopulationDO)) {
+            return R.fail("用户信息不存在");
+        }
+        //查询当前用户电子档信息
+        if(!StringUtils.isEmpty(comMngPopulationDO.getCardNo())){
+            UserElectronicFileVO electronicFileVO = populationDAO.getSysUserElectronicFile(comMngPopulationDO.getCardNo());
+            if(electronicFileVO != null){
+                return R.ok(electronicFileVO);
+            }
+        }
+        return R.ok();
+    }
 }

--
Gitblit v1.7.1