From a8bb61ea692006fc3ad8747c0ac0832c7ec8f3be Mon Sep 17 00:00:00 2001
From: tangxiaobao <303826152@qq.com>
Date: 星期四, 29 七月 2021 18:01:18 +0800
Subject: [PATCH] 防火防汛接口开发

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 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 a5aa7e2..a2ea07c 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
@@ -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()));
+    }
+
 }
\ No newline at end of file

--
Gitblit v1.7.1