CeDo
2021-04-15 ae30ebfc3e4a38aed0d91a42da4a1544dbd87ba3
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java
@@ -250,39 +250,7 @@
            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()));
@@ -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);
    }
}