| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | 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)); |
| | |
| | | index++; |
| | | continue; |
| | | } |
| | | vo.setHouseStatus(isOk); |
| | | vo.setControlStatus(isOk); |
| | | } |
| | | |
| | | if(StringUtils.isNotEmpty(oneData.get(16))){ |
| | |
| | | vo.setHealthy(oneData.get(20).trim()); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(21))){ |
| | | vo.setWorkCompany(oneData.get(21).trim()); |
| | | vo.setBloodType(oneData.get(21).trim()); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(22))){ |
| | | Integer isOk = PopulOutOrLocalEnum.getCodeByName(oneData.get(22)); |
| | | vo.setReligion(oneData.get(22).trim()); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(23))){ |
| | | vo.setProfession(oneData.get(23).trim()); |
| | | } |
| | | |
| | | if(StringUtils.isNotEmpty(oneData.get(24))){ |
| | | vo.setWorkCompany(oneData.get(24).trim()); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(25))){ |
| | | Integer isOk = PopulOutOrLocalEnum.getCodeByName(oneData.get(25)); |
| | | if(isOk.equals(-1)){ |
| | | ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | importErrorVO.setErrorPosition("第" + index + "行,第23列"); |
| | | importErrorVO.setErrorMsg("您填写的外地or本地有误"); |
| | | importErrorVO.setErrorPosition("第" + index + "行,第26列"); |
| | | importErrorVO.setErrorMsg("您填写的本地/外地有误"); |
| | | populationImportErrorVOList.add(importErrorVO); |
| | | index++; |
| | | continue; |
| | | } |
| | | vo.setOutOrLocal(isOk); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(23))){ |
| | | vo.setCensusRegister(oneData.get(23).trim()); |
| | | if(StringUtils.isNotEmpty(oneData.get(26))){ |
| | | vo.setCensusRegister(oneData.get(26).trim()); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(24))){ |
| | | vo.setRemark(oneData.get(24).trim()); |
| | | if(StringUtils.isEmpty(oneData.get(27))){ |
| | | vo.setResidence(0); |
| | | }else{ |
| | | vo.setResidence(PopulIsOkEnum.getCodeByName(oneData.get(27).trim())); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(28))){ |
| | | vo.setAddress(oneData.get(28).trim()); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(29))){ |
| | | Integer isOk = PopulPersonTypeEnum.getCodeByName(oneData.get(29)); |
| | | if(isOk.equals(-1)){ |
| | | ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | importErrorVO.setErrorPosition("第" + index + "行,第30列"); |
| | | importErrorVO.setErrorMsg("您填写的人员类型有误"); |
| | | populationImportErrorVOList.add(importErrorVO); |
| | | index++; |
| | | continue; |
| | | } |
| | | vo.setPersonType(isOk); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(30))){ |
| | | vo.setCountry(oneData.get(30).trim()); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(31))){ |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("YYYY-dd-MM HH:mm:ss"); |
| | | vo.setDateOfDeparture(simpleDateFormat.parse(oneData.get(31))); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(32))){ |
| | | vo.setPersonStatus(oneData.get(32).trim()); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(33))){ |
| | | vo.setMonthlyIncome(oneData.get(33).trim()); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(34))){ |
| | | vo.setFamilyStatus(oneData.get(34).trim()); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(35))){ |
| | | vo.setGoalInChina(oneData.get(35).trim()); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(36))){ |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("YYYY-dd-MM HH:mm:ss"); |
| | | vo.setDateOfArrival(simpleDateFormat.parse(oneData.get(36))); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(37))){ |
| | | vo.setRemark(oneData.get(37).trim()); |
| | | } |
| | | |
| | | if(StringUtils.isNotEmpty(oneData.get(25))){ |
| | | vo.setIdCardPositive(oneData.get(25).trim()); |
| | | if(StringUtils.isNotEmpty(oneData.get(38))){ |
| | | vo.setIdCardPositive(oneData.get(38).trim()); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(26))){ |
| | | vo.setIdCardBack(oneData.get(26).trim()); |
| | | if(StringUtils.isNotEmpty(oneData.get(39))){ |
| | | vo.setIdCardBack(oneData.get(39).trim()); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(27))){ |
| | | vo.setHouseHold(oneData.get(27).trim()); |
| | | if(StringUtils.isNotEmpty(oneData.get(40))){ |
| | | vo.setHouseHold(oneData.get(40).trim()); |
| | | } |
| | | if(StringUtils.isEmpty(oneData.get(28))){ |
| | | vo.setIsResidence(0); |
| | | if(StringUtils.isEmpty(oneData.get(41))){ |
| | | vo.setDeath(0); |
| | | }else{ |
| | | vo.setIsResidence(PopulIsOkEnum.getCodeByName(oneData.get(28).trim())); |
| | | vo.setDeath(PopulIsOkEnum.getCodeByName(oneData.get(41).trim())); |
| | | } |
| | | for (int i = 29; i < headSize; i++) { |
| | | for (int i = 42; i < headSize; i++) { |
| | | if (oneData.get(i) != null && oneData.get(i).equals("是")) { |
| | | vo.getUserTagStr().add(headData.get(i).substring(0,headData.get(i).indexOf("("))); |
| | | } |
| | |
| | | importErrorVO.setErrorMsg("数据格式有误,请检查文档内数据"); |
| | | populationImportErrorVOList.add(importErrorVO); |
| | | throw new ServiceException("500", JSON.toJSONString(populationImportErrorVOList)); |
| | | } catch (ParseException e1) { |
| | | e1.printStackTrace(); |
| | | List<ComMngPopulationImportErrorVO> populationImportErrorVOList = new ArrayList<>(); |
| | | ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | importErrorVO.setErrorPosition("第" + index + "行"); |
| | | importErrorVO.setErrorMsg("数据格式有误,请检查文档内数据"); |
| | | populationImportErrorVOList.add(importErrorVO); |
| | | throw new ServiceException("500", JSON.toJSONString(populationImportErrorVOList)); |
| | | } |
| | | } |
| | | |
| | |
| | | }else if(Objects.equals(ra,"长男") || ra.contains("长子")){ |
| | | ra = "长子"; |
| | | }else if(Objects.equals(ra,"非亲属") || ra.contains("女友") || ra.contains("女朋友") |
| | | || ra.contains("男友") || ra.contains("男朋友")){ |
| | | || ra.contains("男友") || ra.contains("男朋友")){ |
| | | ra = "其他"; |
| | | }else if(Objects.equals(ra,"姐")){ |
| | | ra = "姐姐"; |