From c3ce38cb41d4e4a7d036576b7be52ec2d8c3e724 Mon Sep 17 00:00:00 2001
From: CeDo <cedoogle@gmail.com>
Date: 星期一, 12 四月 2021 16:07:46 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java |   83 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 81 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 a7f6b43..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
@@ -9,22 +9,29 @@
 import com.google.common.collect.Lists;
 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.community.PageComActDTO;
 import com.panzhihua.common.model.vos.R;
 import com.panzhihua.common.model.vos.community.*;
 import com.panzhihua.common.model.vos.user.ComMngFamilyInfoVO;
+import com.panzhihua.service_community.dao.ComActActivityDAO;
 import com.panzhihua.service_community.dao.ComActDAO;
 import com.panzhihua.service_community.dao.ComActVillageDAO;
 import com.panzhihua.service_community.dao.ComMngPopulationDAO;
+import com.panzhihua.service_community.model.dos.ComActActivityDO;
 import com.panzhihua.service_community.model.dos.ComActDO;
 import com.panzhihua.service_community.model.dos.ComMngPopulationDO;
 import com.panzhihua.service_community.model.dos.ComMngVillageDO;
 import com.panzhihua.service_community.service.ComMngPopulationService;
 import org.springframework.beans.BeanUtils;
+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;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -243,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());
     }
 
@@ -263,4 +270,76 @@
         }
         return true;
     }
+
+    /**
+     * 根据id修改实有人口标签
+     * @param populationTagDTO 请求参数
+     * @return 修改结果
+     */
+    @Override
+    public R editTagPopulation(ComMngPopulationTagDTO populationTagDTO) {
+        ComMngPopulationDO comMngPopulationDO = populationDAO.selectById(populationTagDTO.getId());
+        if (comMngPopulationDO == null) {
+            return R.fail("未查询到人口记录");
+        }
+        BeanUtils.copyProperties(populationTagDTO,comMngPopulationDO);
+
+        int nub = populationDAO.updateById(comMngPopulationDO);
+        if(nub < 1){
+            return R.fail();
+        }
+        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