From ae30ebfc3e4a38aed0d91a42da4a1544dbd87ba3 Mon Sep 17 00:00:00 2001
From: CeDo <cedoogle@gmail.com>
Date: 星期四, 15 四月 2021 12:10:06 +0800
Subject: [PATCH] 社会调查问卷添加默认参数

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 55 insertions(+), 2 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 411e239..0b07a35 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
@@ -27,6 +27,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 java.util.ArrayList;
@@ -249,14 +250,14 @@
             if (comMngVillageDO == null) {
                 throw new ServiceException("街道巷:" + vo.getRoad() + "不存在!");
             }
-            comMngPopulationDO.setActId(comMngVillageDO.getVillageId());
+            comMngPopulationDO.setVillageId(comMngVillageDO.getVillageId());
             comMngPopulationDO.setActId(comActDO.getCommunityId());
             comMngPopulationDO.setStreetId(comActDO.getStreetId());
             comMngPopulationDO.setLabel(Joiner.on(",").join(vo.getUserTagStr()));
             comMngPopulationDO.setVillageName(comMngVillageDO.getGroupAt());
             populationDOList.add(comMngPopulationDO);
         });
-        //this.saveBatch(populationDOList);
+        this.saveBatch(populationDOList);
         return R.ok("共计导入实有人口数量:" + populationDOList.size());
     }
 
@@ -289,4 +290,56 @@
         }
         return R.ok();
     }
+
+    /**
+     * 批量删除实有人口
+     * @param Ids
+     * @return
+     */
+    @Override
+    public R deletePopulations(List<Long> Ids) {
+        int delete = populationDAO.deleteBatchIds(Ids);
+        if (delete > 0) {
+            return R.ok();
+        }
+        return R.fail();
+    }
+
+    /**
+     * 根据社区id查询所有实有人口
+     * @param communityId   社区id
+     * @return  查询结果
+     */
+    @Override
+    public R getPopulationListByCommunityId(Long communityId) {
+        List<ComMngPopulationDO> list = populationDAO.selectList(new QueryWrapper<ComMngPopulationDO>().eq("act_id",communityId));
+        List<ComMngPopulationVO> resultList = new ArrayList<>();
+        if(list.size() > 0){
+            list.forEach(populationDO -> {
+                ComMngPopulationVO populationVO=new ComMngPopulationVO();
+                BeanUtils.copyProperties(populationDO,populationVO);
+                resultList.add(populationVO);
+            });
+        }
+        return R.ok(resultList);
+    }
+
+    /**
+     * 根据id集合查询实有人口
+     * @param Ids   实有人口id集合
+     * @return  查询结果
+     */
+    @Override
+    public R getPopulationLists(List<Long> Ids) {
+        List<ComMngPopulationDO> list = populationDAO.selectBatchIds(Ids);
+        List<ComMngPopulationVO> resultList = new ArrayList<>();
+        if(list.size() > 0){
+            list.forEach(populationDO -> {
+                ComMngPopulationVO populationVO = new ComMngPopulationVO();
+                BeanUtils.copyProperties(populationDO,populationVO);
+                resultList.add(populationVO);
+            });
+        }
+        return R.ok(resultList);
+    }
 }

--
Gitblit v1.7.1