huanghongfa
2021-07-30 c7450a8e1724528046af3683d49eaf0a06785130
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java
@@ -363,6 +363,7 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R listSavePopulation(List<ComMngPopulationServeExcelVO> list, Long communityId) throws Exception {
        List<ComMngPopulationMistakeExcelVO> mistakes = new ArrayList<>();
        List<ComMngPopulationImportErrorVO> populationImportErrorVOList = new ArrayList<>();
        //查询该社区
        ComActDO comActDO = comActDAO.selectById(communityId);
@@ -400,6 +401,11 @@
                importErrorVO.setErrorPosition("街路巷:" + vo.getRoad() + ",小区号:" + vo.getDoorNo());
                populationImportErrorVOList.add(importErrorVO);
//                index++;
                ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO();
                BeanUtils.copyProperties(vo,mistake);
                setMistake(mistake, vo);
                mistake.setMistake("街路巷或小区号不存在,请先在“小区管理”中添加该小区:街路巷:"+ vo.getRoad() +",小区号:" + vo.getDoorNo());
                mistakes.add(mistake);
                continue;
            }
@@ -467,7 +473,7 @@
        this.saveBatch(populationDOList);*/
        if (!populationImportErrorVOList.isEmpty()) {
            return R.fail(JSON.toJSONString(populationImportErrorVOList));
            return R.fail(mistakes,JSON.toJSONString(populationImportErrorVOList));
        }
        return R.ok();
    }
@@ -1908,4 +1914,19 @@
        return R.ok(this.baseMapper.getVillagePopulationAdmin(new Page(villagePopulationDTO.getPageNum(),villagePopulationDTO.getPageSize()),villagePopulationDTO));
    }
    private void setMistake(ComMngPopulationMistakeExcelVO mvo, ComMngPopulationServeExcelVO vo){
        mvo.setPoliticalOutlook(PopulPoliticalOutlookEnum.getCnDescByName(vo.getPoliticalOutlook()));
        mvo.setIsRent(PopulHouseUseEnum.getCnDescByName(vo.getIsRent()));
        mvo.setRelation(PopulRelationEnum.getCnDescByName(vo.getRelation()));
        mvo.setHouseStatus(PopulHouseStatusEnum.getCnDescByName(vo.getHouseStatus()));
        mvo.setHousePurpose(PopulHousePurposeEnum.getCnDescByName(vo.getHousePurpose()));
        mvo.setControlStatus(PopulHouseControlStatusEnum.getCnDescByName(vo.getControlStatus()));
        mvo.setCultureLevel(PopulCultureLevelEnum.getCnDescByName(vo.getCultureLevel()));
        mvo.setMarriage(PopulMarriageEnum.getCnDescByName(vo.getMarriage()));
        mvo.setOutOrLocal(PopulOutOrLocalEnum.getCnDescByName(vo.getOutOrLocal()));
        mvo.setResidence(PopulRelationEnum.getCnDescByName(vo.getResidence()));
        mvo.setPersonType(PopulPersonTypeEnum.getCnDescByName(vo.getPersonType()));
        mvo.setDeath(PopulOutOrLocalEnum.getCnDescByName(vo.getDeath()));
    }
}