From 8555f974846ca5b4f4734f52b51e39cd4502df44 Mon Sep 17 00:00:00 2001
From: DESKTOP-71BH0QO\L、ming <172680469@qq.com>
Date: 星期五, 02 四月 2021 15:46:30 +0800
Subject: [PATCH] fix:修改bug

---
 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