| | |
| | | log.info("开始导入服刑人员数据"); |
| | | log.info("表格总数据:" + list.size()); |
| | | if (list.size() == 0) { |
| | | throw new ServiceException("500", "导入数据为空!"); |
| | | throw new ServiceException("000", "导入数据为空!"); |
| | | } |
| | | ValueOperations<String, String> valueOperations = stringRedisTemplate.opsForValue(); |
| | | String Sentence = Constants.SENTENCE_POPULATION_ERROR_LIST + communityId; |
| | | String Sentence = Constants.SENTENCE_POPULATION_ERROR_LIST; |
| | | |
| | | Map<String,String> dictMap = dictionaryR.getData().stream().collect(Collectors.toMap(BcDictionaryVO::getDictName,BcDictionaryVO::getDictValue)); |
| | | // Map<String,Integer> dictMap = new HashMap<>(); |
| | |
| | | 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)); |
| | | } |
| | |
| | | continue; |
| | | } |
| | | vo.setDoorNo(oneData.get(8).trim()); |
| | | if(StringUtils.isEmpty(oneData.get(9))){ |
| | | index++; |
| | | ComMngPopulationSentenceMistakeExcelVO mistake = new ComMngPopulationSentenceMistakeExcelVO(); |
| | | setSentenceMistake(oneData, mistake); |
| | | mistake.setMistake("楼排号不可为空"); |
| | | mistakes.add(mistake); |
| | | continue; |
| | | // if(StringUtils.isEmpty(oneData.get(9))){ |
| | | // index++; |
| | | // ComMngPopulationSentenceMistakeExcelVO mistake = new ComMngPopulationSentenceMistakeExcelVO(); |
| | | // setSentenceMistake(oneData, mistake); |
| | | // mistake.setMistake("楼排号不可为空"); |
| | | // mistakes.add(mistake); |
| | | // continue; |
| | | // } |
| | | if(StringUtils.isNotEmpty(oneData.get(9))) { |
| | | vo.setFloor(oneData.get(9).trim()); |
| | | } |
| | | vo.setFloor(oneData.get(9).trim()); |
| | | if(StringUtils.isEmpty(oneData.get(10))){ |
| | | index++; |
| | | ComMngPopulationSentenceMistakeExcelVO mistake = new ComMngPopulationSentenceMistakeExcelVO(); |
| | | setSentenceMistake(oneData, mistake); |
| | | mistake.setMistake("单元号不可为空"); |
| | | mistakes.add(mistake); |
| | | continue; |
| | | // if(StringUtils.isEmpty(oneData.get(10))){ |
| | | // index++; |
| | | // ComMngPopulationSentenceMistakeExcelVO mistake = new ComMngPopulationSentenceMistakeExcelVO(); |
| | | // setSentenceMistake(oneData, mistake); |
| | | // mistake.setMistake("单元号不可为空"); |
| | | // mistakes.add(mistake); |
| | | // continue; |
| | | // } |
| | | if(StringUtils.isNotEmpty(oneData.get(10))) { |
| | | vo.setUnitNo(oneData.get(10).trim()); |
| | | } |
| | | vo.setUnitNo(oneData.get(10).trim()); |
| | | if(StringUtils.isEmpty(oneData.get(11))){ |
| | | index++; |
| | | ComMngPopulationSentenceMistakeExcelVO mistake = new ComMngPopulationSentenceMistakeExcelVO(); |
| | | setSentenceMistake(oneData, mistake); |
| | | mistake.setMistake("户室不可为空"); |
| | | mistakes.add(mistake); |
| | | continue; |
| | | // if(StringUtils.isEmpty(oneData.get(11))){ |
| | | // index++; |
| | | // ComMngPopulationSentenceMistakeExcelVO mistake = new ComMngPopulationSentenceMistakeExcelVO(); |
| | | // setSentenceMistake(oneData, mistake); |
| | | // mistake.setMistake("户室不可为空"); |
| | | // mistakes.add(mistake); |
| | | // continue; |
| | | // } |
| | | if(StringUtils.isNotEmpty(oneData.get(11))) { |
| | | vo.setHouseNo(oneData.get(11).trim()); |
| | | } |
| | | vo.setHouseNo(oneData.get(11).trim()); |
| | | if(StringUtils.isNotEmpty(oneData.get(12))){ |
| | | Integer isOk = PopulHouseUseEnum.getCodeByName(oneData.get(12)); |
| | | if(isOk.equals(-1)){ |