From 2e6ae80c0271e5e45faa399ce94cd44678cce43f Mon Sep 17 00:00:00 2001 From: huanghongfa <huanghongfa123456> Date: 星期五, 13 八月 2021 22:58:55 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationSentenceExcelListen.java | 87 +++++++++++++++++++++---------------------- 1 files changed, 43 insertions(+), 44 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationSentenceExcelListen.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationSentenceExcelListen.java index abf12fb..9c2c0e3 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationSentenceExcelListen.java +++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationSentenceExcelListen.java @@ -141,54 +141,53 @@ vo.setSerialNumber(oneData.get(0)); } //姓名和身份证都为空,为空户,无需操作,否则就解析年龄,性别,出生年月日 - if(StringUtils.isNotEmpty(oneData.get(1)) || StringUtils.isNotEmpty(oneData.get(3))){ - if(StringUtils.isEmpty(oneData.get(1))){ - ComMngPopulationSentenceMistakeExcelVO mistake = new ComMngPopulationSentenceMistakeExcelVO(); - index++; - setSentenceMistake(oneData, mistake); - mistake.setMistake("名字不可为空,请填写姓名"); - mistakes.add(mistake); - continue; - } - vo.setName(oneData.get(1)); - if(StringUtils.isEmpty(oneData.get(3))){ - ComMngPopulationSentenceMistakeExcelVO mistake = new ComMngPopulationSentenceMistakeExcelVO(); - index++; - setSentenceMistake(oneData, mistake); - mistake.setMistake("身份证号不可为空,请填写身份证"); - mistakes.add(mistake); - continue; - } + if(StringUtils.isEmpty(oneData.get(1))){ + ComMngPopulationSentenceMistakeExcelVO mistake = new ComMngPopulationSentenceMistakeExcelVO(); + index++; + setSentenceMistake(oneData, mistake); + mistake.setMistake("名字不可为空,请填写姓名"); + mistakes.add(mistake); + continue; + } + vo.setName(oneData.get(1)); + if(StringUtils.isEmpty(oneData.get(3))){ + ComMngPopulationSentenceMistakeExcelVO mistake = new ComMngPopulationSentenceMistakeExcelVO(); + index++; + setSentenceMistake(oneData, mistake); + mistake.setMistake("身份证号不可为空,请填写身份证"); + mistakes.add(mistake); + continue; + } - //判断身份证号码位数 - if(oneData.get(3).length() != 18){ - ComMngPopulationSentenceMistakeExcelVO mistake = new ComMngPopulationSentenceMistakeExcelVO(); - index++; - setSentenceMistake(oneData, mistake); - mistake.setMistake("身份证号位数有误,请检查身份证号码是否正确"); - mistakes.add(mistake); - continue; - } - vo.setCardNo(oneData.get(3).toUpperCase()); - //根据身份证号码解析年龄以及性别 - //获取用户生日 - String birthday = vo.getCardNo().substring(6, 14); - if(StringUtils.isNotEmpty(birthday)){ - String year = birthday.substring(0,4); - String month = birthday.substring(4,6); - String day = birthday.substring(6,8); - vo.setBirthday(year + "-" + month + "-" + day); - } + //判断身份证号码位数 + if(oneData.get(3).length() != 18){ + ComMngPopulationSentenceMistakeExcelVO mistake = new ComMngPopulationSentenceMistakeExcelVO(); + index++; + setSentenceMistake(oneData, mistake); + mistake.setMistake("身份证号位数有误,请检查身份证号码是否正确"); + mistakes.add(mistake); + continue; + } + vo.setCardNo(oneData.get(3).toUpperCase()); + //根据身份证号码解析年龄以及性别 + //获取用户生日 + String birthday = vo.getCardNo().substring(6, 14); + if(StringUtils.isNotEmpty(birthday)){ + String year = birthday.substring(0,4); + String month = birthday.substring(4,6); + String day = birthday.substring(6,8); + vo.setBirthday(year + "-" + month + "-" + day); + } // //设置用户年龄 // vo.setAge(AgeUtils.getAgeFromBirthTime(birthday)); - //获取用户性别 - int sex = Integer.parseInt(vo.getCardNo().substring(16, 17)); - if(sex%2 == 1){ - vo.setSex(PopulSexEnum.nan.getCode()); - }else{ - vo.setSex(PopulSexEnum.nv.getCode()); - } + //获取用户性别 + int sex = Integer.parseInt(vo.getCardNo().substring(16, 17)); + if(sex%2 == 1){ + vo.setSex(PopulSexEnum.nan.getCode()); + }else{ + vo.setSex(PopulSexEnum.nv.getCode()); } + if(StringUtils.isNotEmpty(oneData.get(2))){ vo.setNation(oneData.get(2)); } -- Gitblit v1.7.1