| | |
| | | vo.setSerialNumber(oneData.get(0)); |
| | | } |
| | | //姓名和身份证都为空,为空户,无需操作,否则就解析年龄,性别,出生年月日 |
| | | if(StringUtils.isNotEmpty(oneData.get(3)) || StringUtils.isNotEmpty(oneData.get(4))){ |
| | | if(StringUtils.isEmpty(oneData.get(3))){ |
| | | ComMngPopulationVeteransMistakeExcelVO mistake = new ComMngPopulationVeteransMistakeExcelVO(); |
| | | index++; |
| | | setVeteransMistake(oneData, mistake); |
| | | mistake.setMistake("名字不可为空,请填写姓名"); |
| | | mistakes.add(mistake); |
| | | continue; |
| | | } |
| | | vo.setName(oneData.get(3)); |
| | | if(StringUtils.isEmpty(oneData.get(4))){ |
| | | ComMngPopulationVeteransMistakeExcelVO mistake = new ComMngPopulationVeteransMistakeExcelVO(); |
| | | index++; |
| | | setVeteransMistake(oneData, mistake); |
| | | mistake.setMistake("身份证号不可为空,请填写身份证"); |
| | | mistakes.add(mistake); |
| | | continue; |
| | | } |
| | | if(StringUtils.isEmpty(oneData.get(3))){ |
| | | ComMngPopulationVeteransMistakeExcelVO mistake = new ComMngPopulationVeteransMistakeExcelVO(); |
| | | index++; |
| | | setVeteransMistake(oneData, mistake); |
| | | mistake.setMistake("名字不可为空,请填写姓名"); |
| | | mistakes.add(mistake); |
| | | continue; |
| | | } |
| | | vo.setName(oneData.get(3)); |
| | | if(StringUtils.isEmpty(oneData.get(4))){ |
| | | ComMngPopulationVeteransMistakeExcelVO mistake = new ComMngPopulationVeteransMistakeExcelVO(); |
| | | index++; |
| | | setVeteransMistake(oneData, mistake); |
| | | mistake.setMistake("身份证号不可为空,请填写身份证"); |
| | | mistakes.add(mistake); |
| | | continue; |
| | | } |
| | | |
| | | //判断身份证号码位数 |
| | | if(oneData.get(4).length() != 18){ |
| | | ComMngPopulationVeteransMistakeExcelVO mistake = new ComMngPopulationVeteransMistakeExcelVO(); |
| | | index++; |
| | | setVeteransMistake(oneData, mistake); |
| | | mistake.setMistake("身份证号位数有误,请检查身份证号码是否正确"); |
| | | mistakes.add(mistake); |
| | | continue; |
| | | } |
| | | vo.setCardNo(oneData.get(4).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(4).length() != 18){ |
| | | ComMngPopulationVeteransMistakeExcelVO mistake = new ComMngPopulationVeteransMistakeExcelVO(); |
| | | index++; |
| | | setVeteransMistake(oneData, mistake); |
| | | mistake.setMistake("身份证号位数有误,请检查身份证号码是否正确"); |
| | | mistakes.add(mistake); |
| | | continue; |
| | | } |
| | | vo.setCardNo(oneData.get(4).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(1))){ |
| | | vo.setPersonStatus(oneData.get(1)); |
| | | } |
| | |
| | | index++; |
| | | ComMngPopulationVeteransMistakeExcelVO mistake = new ComMngPopulationVeteransMistakeExcelVO(); |
| | | setVeteransMistake(oneData, mistake); |
| | | mistake.setMistake("您填写的政治面貌有误"); |
| | | mistake.setMistake("您填写的婚姻关系·有误"); |
| | | mistakes.add(mistake); |
| | | continue; |
| | | } |