huanghongfa
2021-08-13 2e6ae80c0271e5e45faa399ce94cd44678cce43f
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationKeyExcelListen.java
@@ -139,54 +139,53 @@
                        vo.setSerialNumber(oneData.get(0));
                    }
                    //姓名和身份证都为空,为空户,无需操作,否则就解析年龄,性别,出生年月日
                    if(StringUtils.isNotEmpty(oneData.get(1)) || StringUtils.isNotEmpty(oneData.get(3))){
                        if(StringUtils.isEmpty(oneData.get(1))){
                            ComMngPopulationKeyMistakeExcelVO mistake = new ComMngPopulationKeyMistakeExcelVO();
                            index++;
                            setKeyMistake(oneData, mistake);
                            mistake.setMistake("名字不可为空,请填写姓名");
                            mistakes.add(mistake);
                            continue;
                        }
                        vo.setName(oneData.get(1));
                        if(StringUtils.isEmpty(oneData.get(3))){
                            ComMngPopulationKeyMistakeExcelVO mistake = new ComMngPopulationKeyMistakeExcelVO();
                            index++;
                            setKeyMistake(oneData, mistake);
                            mistake.setMistake("身份证号不可为空,请填写身份证");
                            mistakes.add(mistake);
                            continue;
                        }
                    if(StringUtils.isEmpty(oneData.get(1))){
                        ComMngPopulationKeyMistakeExcelVO mistake = new ComMngPopulationKeyMistakeExcelVO();
                        index++;
                        setKeyMistake(oneData, mistake);
                        mistake.setMistake("名字不可为空,请填写姓名");
                        mistakes.add(mistake);
                        continue;
                    }
                    vo.setName(oneData.get(1));
                    if(StringUtils.isEmpty(oneData.get(3))){
                        ComMngPopulationKeyMistakeExcelVO mistake = new ComMngPopulationKeyMistakeExcelVO();
                        index++;
                        setKeyMistake(oneData, mistake);
                        mistake.setMistake("身份证号不可为空,请填写身份证");
                        mistakes.add(mistake);
                        continue;
                    }
                        //判断身份证号码位数
                        if(oneData.get(3).length() != 18){
                            ComMngPopulationKeyMistakeExcelVO mistake = new ComMngPopulationKeyMistakeExcelVO();
                            index++;
                            setKeyMistake(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){
                        ComMngPopulationKeyMistakeExcelVO mistake = new ComMngPopulationKeyMistakeExcelVO();
                        index++;
                        setKeyMistake(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));
                    }
@@ -317,7 +316,7 @@
                    if(StringUtils.isNotEmpty(oneData.get(17))){
                        vo.setRemark(oneData.get(17).trim());
                    }
                    vo.getUserTagStr().add("重点上访人员");
                    vo.getUserTagStr().add("重点人员");
                    for (int i = 18; i < headSize; i++) {
                        if (oneData.get(i) != null && oneData.get(i).equals("是")) {
                            vo.getUserTagStr().add(headData.get(i).substring(0,headData.get(i).indexOf("(")));