DESKTOP-71BH0QO\L、ming
2021-04-02 8555f974846ca5b4f4734f52b51e39cd4502df44
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java
@@ -250,46 +250,14 @@
            if (comMngVillageDO == null) {
                throw new ServiceException("街道巷:" + vo.getRoad() + "不存在!");
            }
            //性别判断
            if(!StringUtils.isEmpty(vo.getSex())){
                if(vo.getSex().equals(ComMngPopulationServeExcelVO.sex.nan)){
                    comMngPopulationDO.setSex(ComMngPopulationDO.sex.nan);
                }else if(vo.getSex().equals(ComMngPopulationServeExcelVO.sex.nv)){
                    comMngPopulationDO.setSex(ComMngPopulationDO.sex.nv);
                }else{
                    comMngPopulationDO.setSex(ComMngPopulationDO.sex.no);
                }
            }
            //是否租住判断
            if(!StringUtils.isEmpty(vo.getIsRent())){
                if(vo.getIsRent().equals(ComMngPopulationServeExcelVO.isOk.no)){
                    comMngPopulationDO.setIsRent(ComMngPopulationDO.isOk.no);
                }else{
                    comMngPopulationDO.setIsRent(ComMngPopulationDO.isOk.yes);
                }
            }
            //政治面貌判断
            if(!StringUtils.isEmpty(vo.getPoliticalOutlook())){
                if(vo.getPoliticalOutlook().equals(ComMngPopulationServeExcelVO.politicalOutlook.qun)){
                    comMngPopulationDO.setPoliticalOutlook(ComMngPopulationDO.politicalOutlook.qun);
                }else if(vo.getPoliticalOutlook().equals(ComMngPopulationServeExcelVO.politicalOutlook.tuan)){
                    comMngPopulationDO.setPoliticalOutlook(ComMngPopulationDO.politicalOutlook.tuan);
                }else if(vo.getPoliticalOutlook().equals(ComMngPopulationServeExcelVO.politicalOutlook.dang)){
                    comMngPopulationDO.setPoliticalOutlook(ComMngPopulationDO.politicalOutlook.dang);
                }else if(vo.getPoliticalOutlook().equals(ComMngPopulationServeExcelVO.politicalOutlook.wu)){
                    comMngPopulationDO.setPoliticalOutlook(ComMngPopulationDO.politicalOutlook.wu);
                }else{
                    comMngPopulationDO.setPoliticalOutlook(ComMngPopulationDO.politicalOutlook.no);
                }
            }
            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());
    }
@@ -336,4 +304,42 @@
        }
        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);
    }
}