From a218ccaadff80203bcf82f251f0d448449858ac5 Mon Sep 17 00:00:00 2001
From: DESKTOP-71BH0QO\L、ming <172680469@qq.com>
Date: 星期五, 02 四月 2021 09:41:49 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationServeExcelListen.java |   29 +++++++++++++++++++++++++----
 1 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationServeExcelListen.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationServeExcelListen.java
index 0f0458c..7e874ab 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationServeExcelListen.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationServeExcelListen.java
@@ -4,6 +4,9 @@
 import com.alibaba.excel.event.AnalysisEventListener;
 import com.alibaba.fastjson.JSONObject;
 import com.google.common.collect.Lists;
+import com.panzhihua.common.enums.PopulIsOkEnum;
+import com.panzhihua.common.enums.PopulPoliticalOutlookEnum;
+import com.panzhihua.common.enums.PopulSexEnum;
 import com.panzhihua.common.exceptions.ServiceException;
 import com.panzhihua.common.model.vos.R;
 import com.panzhihua.common.model.vos.community.ComMngPopulationServeExcelVO;
@@ -80,16 +83,34 @@
             for (Map<Integer, String> oneData : list) {
                 ComMngPopulationServeExcelVO vo = new ComMngPopulationServeExcelVO();
                 vo.setName(oneData.get(0));
-                vo.setSex(oneData.get(1));
+                vo.setSex(PopulSexEnum.getCodeByName(oneData.get(1)));
+                if(oneData.get(2) == null){
+                    throw new ServiceException("500", "年龄不可为空:第" + index + "行,第3列");
+                }
                 vo.setAge(Integer.valueOf(oneData.get(2)));
-                vo.setIsRent(oneData.get(3));
+                if(oneData.get(3) == null){
+                    throw new ServiceException("500", "是否租住不可为空:第" + index + "行,第4列");
+                }
+                vo.setIsRent(PopulIsOkEnum.getCodeByName(oneData.get(3)));
                 vo.setRoad(oneData.get(4));
+                if(oneData.get(5) == null){
+                    throw new ServiceException("500", "门牌号不可为空:第" + index + "行,第6列");
+                }
                 vo.setDoorNo(Integer.valueOf(oneData.get(5)));
                 vo.setFloor(oneData.get(6));
+                if(oneData.get(7) == null){
+                    throw new ServiceException("500", "单元号不可为空:第" + index + "行,第8列");
+                }
                 vo.setUnitNo(Integer.valueOf(oneData.get(7)));
+                if(oneData.get(8) == null){
+                    throw new ServiceException("500", "户室不可为空:第" + index + "行,第9列");
+                }
                 vo.setHouseNo(Integer.valueOf(oneData.get(8)));
                 vo.setNation(oneData.get(9));
-                vo.setPoliticalOutlook(oneData.get(10));
+                if(oneData.get(10) == null){
+                    throw new ServiceException("500", "政治面貌不可为空:第" + index + "行,第11列");
+                }
+                vo.setPoliticalOutlook(PopulPoliticalOutlookEnum.getCodeByName(oneData.get(10)));
                 vo.setCardNo(oneData.get(11));
                 vo.setPhone(oneData.get(12));
                 vo.setNativePlace(oneData.get(13));
@@ -107,7 +128,7 @@
                 throw new ServiceException(r.getMsg());
             }
         } catch (NumberFormatException e) {
-            throw new ServiceException("500", "填写数据类型错误:第" + index + "行" + e.getMessage());
+            throw new ServiceException("500", "填写数据格式错误:第" + index + "行" + e.getMessage());
         }
     }
 }

--
Gitblit v1.7.1