| | |
| | | int index = 2; |
| | | try { |
| | | ArrayList<ComMngPopulationServeExcelVO> voList = Lists.newArrayList(); |
| | | List<ComMngPopulationImportErrorVO> populationImportErrorVOList = new ArrayList<>(); |
| | | // List<ComMngPopulationImportErrorVO> populationImportErrorVOList = new ArrayList<>(); |
| | | ArrayList<ComMngPopulationMistakeExcelVO> mistakes = Lists.newArrayList(); |
| | | for (Map<Integer, String> oneData : list) { |
| | | ComMngPopulationServeExcelVO vo = new ComMngPopulationServeExcelVO(); |
| | |
| | | if(StringUtils.isNotEmpty(oneData.get(0)) || StringUtils.isNotEmpty(oneData.get(1))){ |
| | | if(StringUtils.isEmpty(oneData.get(0))){ |
| | | ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO(); |
| | | ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | importErrorVO.setErrorPosition("第" + index + "行,第1列"); |
| | | importErrorVO.setErrorMsg("名字不可为空,请填写姓名"); |
| | | populationImportErrorVOList.add(importErrorVO); |
| | | // ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | // importErrorVO.setErrorPosition("第" + index + "行,第1列"); |
| | | // importErrorVO.setErrorMsg("名字不可为空,请填写姓名"); |
| | | // populationImportErrorVOList.add(importErrorVO); |
| | | index++; |
| | | setMistake(oneData, mistake); |
| | | mistake.setMistake("名字不可为空,请填写姓名"); |
| | |
| | | } |
| | | vo.setName(oneData.get(0)); |
| | | if(StringUtils.isEmpty(oneData.get(1))){ |
| | | ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | // ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO(); |
| | | importErrorVO.setErrorPosition("第" + index + "行,第2列"+oneData.get(1)); |
| | | importErrorVO.setErrorMsg("身份证号不可为空,请填写身份证号"); |
| | | populationImportErrorVOList.add(importErrorVO); |
| | | // importErrorVO.setErrorPosition("第" + index + "行,第2列"+oneData.get(1)); |
| | | // importErrorVO.setErrorMsg("身份证号不可为空,请填写身份证号"); |
| | | // populationImportErrorVOList.add(importErrorVO); |
| | | index++; |
| | | setMistake(oneData, mistake); |
| | | mistake.setMistake("身份证号不可为空,请填写身份证号"); |
| | |
| | | |
| | | //判断身份证号码位数 |
| | | if(oneData.get(1).length() != 18){ |
| | | ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | importErrorVO.setErrorPosition("第" + index + "行,第2列"+oneData.get(1)); |
| | | importErrorVO.setErrorMsg("身份证号位数有误,请检查身份证号码是否正确"); |
| | | populationImportErrorVOList.add(importErrorVO); |
| | | // ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | // importErrorVO.setErrorPosition("第" + index + "行,第2列"+oneData.get(1)); |
| | | // importErrorVO.setErrorMsg("身份证号位数有误,请检查身份证号码是否正确"); |
| | | // populationImportErrorVOList.add(importErrorVO); |
| | | index++; |
| | | ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO(); |
| | | setMistake(oneData, mistake); |
| | |
| | | vo.setPoliticalOutlook(PopulPoliticalOutlookEnum.getCodeByName(oneData.get(3))); |
| | | Integer isOk = PopulPoliticalOutlookEnum.getCodeByName(oneData.get(3)); |
| | | if(isOk.equals(-1)){ |
| | | ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | importErrorVO.setErrorPosition("第" + index + "行,第4列"); |
| | | importErrorVO.setErrorMsg("您填写的政治面貌有误"); |
| | | populationImportErrorVOList.add(importErrorVO); |
| | | // ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | // importErrorVO.setErrorPosition("第" + index + "行,第4列"); |
| | | // importErrorVO.setErrorMsg("您填写的政治面貌有误"); |
| | | // populationImportErrorVOList.add(importErrorVO); |
| | | index++; |
| | | ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO(); |
| | | setMistake(oneData, mistake); |
| | |
| | | if(StringUtils.isNotEmpty(oneData.get(4))){ |
| | | Integer isOk = PopulHouseUseEnum.getCodeByName(oneData.get(4)); |
| | | if(isOk.equals(-1)){ |
| | | ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | importErrorVO.setErrorPosition("第" + index + "行,第5列"); |
| | | importErrorVO.setErrorMsg("您填写的是否租住有误"); |
| | | populationImportErrorVOList.add(importErrorVO); |
| | | // ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | // importErrorVO.setErrorPosition("第" + index + "行,第5列"); |
| | | // importErrorVO.setErrorMsg("您填写的是否租住有误"); |
| | | // populationImportErrorVOList.add(importErrorVO); |
| | | index++; |
| | | ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO(); |
| | | setMistake(oneData, mistake); |
| | |
| | | |
| | | if(isOk.equals(-1)){ |
| | | // vo.setMarriageStr(ma); |
| | | ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | importErrorVO.setErrorPosition("第" + index + "行,第6列"); |
| | | importErrorVO.setErrorMsg("您填写的与户主关系有误"); |
| | | populationImportErrorVOList.add(importErrorVO); |
| | | // ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | // importErrorVO.setErrorPosition("第" + index + "行,第6列"); |
| | | // importErrorVO.setErrorMsg("您填写的与户主关系有误"); |
| | | // populationImportErrorVOList.add(importErrorVO); |
| | | index++; |
| | | ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO(); |
| | | setMistake(oneData, mistake); |
| | |
| | | } |
| | | } |
| | | if(StringUtils.isEmpty(oneData.get(6))){ |
| | | ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | importErrorVO.setErrorPosition("第" + index + "行,第7列"); |
| | | importErrorVO.setErrorMsg("街路巷不可为空"); |
| | | populationImportErrorVOList.add(importErrorVO); |
| | | // ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | // importErrorVO.setErrorPosition("第" + index + "行,第7列"); |
| | | // importErrorVO.setErrorMsg("街路巷不可为空"); |
| | | // populationImportErrorVOList.add(importErrorVO); |
| | | index++; |
| | | ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO(); |
| | | setMistake(oneData, mistake); |
| | |
| | | } |
| | | vo.setRoad(oneData.get(6)); |
| | | if(StringUtils.isEmpty(oneData.get(7))){ |
| | | ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | importErrorVO.setErrorPosition("第" + index + "行,第8列"); |
| | | importErrorVO.setErrorMsg("小区号不可为空"); |
| | | populationImportErrorVOList.add(importErrorVO); |
| | | // ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | // importErrorVO.setErrorPosition("第" + index + "行,第8列"); |
| | | // importErrorVO.setErrorMsg("小区号不可为空"); |
| | | // populationImportErrorVOList.add(importErrorVO); |
| | | index++; |
| | | ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO(); |
| | | setMistake(oneData, mistake); |
| | |
| | | } |
| | | vo.setDoorNo(oneData.get(7).trim()); |
| | | if(StringUtils.isEmpty(oneData.get(8))){ |
| | | ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | importErrorVO.setErrorPosition("第" + index + "行,第9列"); |
| | | importErrorVO.setErrorMsg("楼排号不可为空"); |
| | | populationImportErrorVOList.add(importErrorVO); |
| | | // ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | // importErrorVO.setErrorPosition("第" + index + "行,第9列"); |
| | | // importErrorVO.setErrorMsg("楼排号不可为空"); |
| | | // populationImportErrorVOList.add(importErrorVO); |
| | | index++; |
| | | ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO(); |
| | | setMistake(oneData, mistake); |
| | |
| | | } |
| | | vo.setFloor(oneData.get(8).trim()); |
| | | if(StringUtils.isEmpty(oneData.get(9))){ |
| | | ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | importErrorVO.setErrorPosition("第" + index + "行,第10列"); |
| | | importErrorVO.setErrorMsg("单元号不可为空"); |
| | | populationImportErrorVOList.add(importErrorVO); |
| | | // ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | // importErrorVO.setErrorPosition("第" + index + "行,第10列"); |
| | | // importErrorVO.setErrorMsg("单元号不可为空"); |
| | | // populationImportErrorVOList.add(importErrorVO); |
| | | index++; |
| | | ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO(); |
| | | setMistake(oneData, mistake); |
| | |
| | | } |
| | | vo.setUnitNo(oneData.get(9).trim()); |
| | | if(StringUtils.isEmpty(oneData.get(10))){ |
| | | ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | importErrorVO.setErrorPosition("第" + index + "行,第11列"); |
| | | importErrorVO.setErrorMsg("户室不可为空"); |
| | | populationImportErrorVOList.add(importErrorVO); |
| | | // ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | // importErrorVO.setErrorPosition("第" + index + "行,第11列"); |
| | | // importErrorVO.setErrorMsg("户室不可为空"); |
| | | // populationImportErrorVOList.add(importErrorVO); |
| | | index++; |
| | | ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO(); |
| | | setMistake(oneData, mistake); |
| | |
| | | if(StringUtils.isNotEmpty(oneData.get(13))){ |
| | | Integer isOk = PopulHouseStatusEnum.getCodeByName(oneData.get(13).trim()); |
| | | if(isOk.equals(-1)){ |
| | | ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | importErrorVO.setErrorPosition("第" + index + "行,第14列"); |
| | | importErrorVO.setErrorMsg("您填写的房屋状态有误"); |
| | | populationImportErrorVOList.add(importErrorVO); |
| | | // ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | // importErrorVO.setErrorPosition("第" + index + "行,第14列"); |
| | | // importErrorVO.setErrorMsg("您填写的房屋状态有误"); |
| | | // populationImportErrorVOList.add(importErrorVO); |
| | | index++; |
| | | ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO(); |
| | | setMistake(oneData, mistake); |
| | |
| | | if(StringUtils.isNotEmpty(oneData.get(14))){ |
| | | Integer isOk = PopulHousePurposeEnum.getCodeByName(oneData.get(14).trim()); |
| | | if(isOk.equals(-1)){ |
| | | ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | importErrorVO.setErrorPosition("第" + index + "行,第15列"); |
| | | importErrorVO.setErrorMsg("您填写的房屋用途有误"); |
| | | populationImportErrorVOList.add(importErrorVO); |
| | | // ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | // importErrorVO.setErrorPosition("第" + index + "行,第15列"); |
| | | // importErrorVO.setErrorMsg("您填写的房屋用途有误"); |
| | | // populationImportErrorVOList.add(importErrorVO); |
| | | index++; |
| | | ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO(); |
| | | setMistake(oneData, mistake); |
| | |
| | | if(StringUtils.isNotEmpty(oneData.get(15))){ |
| | | Integer isOk = PopulHouseControlStatusEnum.getCodeByName(oneData.get(15)); |
| | | if(isOk.equals(-1)){ |
| | | ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | importErrorVO.setErrorPosition("第" + index + "行,第16列"); |
| | | importErrorVO.setErrorMsg("您填写的管控状态有误"); |
| | | populationImportErrorVOList.add(importErrorVO); |
| | | // ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | // importErrorVO.setErrorPosition("第" + index + "行,第16列"); |
| | | // importErrorVO.setErrorMsg("您填写的管控状态有误"); |
| | | // populationImportErrorVOList.add(importErrorVO); |
| | | index++; |
| | | ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO(); |
| | | setMistake(oneData, mistake); |
| | |
| | | vo.setCultureLevel(PopulCultureLevelEnum.getCodeByName(oneData.get(18))); |
| | | Integer isOk = PopulCultureLevelEnum.getCodeByName(oneData.get(18)); |
| | | if(isOk.equals(-1)){ |
| | | ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | importErrorVO.setErrorPosition("第" + index + "行,第19列"); |
| | | importErrorVO.setErrorMsg("您填写的文化程度有误"); |
| | | populationImportErrorVOList.add(importErrorVO); |
| | | // ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | // importErrorVO.setErrorPosition("第" + index + "行,第19列"); |
| | | // importErrorVO.setErrorMsg("您填写的文化程度有误"); |
| | | // populationImportErrorVOList.add(importErrorVO); |
| | | index++; |
| | | ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO(); |
| | | setMistake(oneData, mistake); |
| | |
| | | Integer isOk = PopulMarriageEnum.getCodeByName(oneData.get(19)); |
| | | if(isOk.equals(-1)){ |
| | | // vo.setMarriageStr(ma); |
| | | ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | importErrorVO.setErrorPosition("第" + index + "行,第20列"); |
| | | importErrorVO.setErrorMsg("您填写的婚姻状况有误"); |
| | | populationImportErrorVOList.add(importErrorVO); |
| | | // ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | // importErrorVO.setErrorPosition("第" + index + "行,第20列"); |
| | | // importErrorVO.setErrorMsg("您填写的婚姻状况有误"); |
| | | // populationImportErrorVOList.add(importErrorVO); |
| | | index++; |
| | | ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO(); |
| | | setMistake(oneData, mistake); |
| | |
| | | if(StringUtils.isNotEmpty(oneData.get(25))){ |
| | | Integer isOk = PopulOutOrLocalEnum.getCodeByName(oneData.get(25)); |
| | | if(isOk.equals(-1)){ |
| | | ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | importErrorVO.setErrorPosition("第" + index + "行,第26列"); |
| | | importErrorVO.setErrorMsg("您填写的本地/外地有误"); |
| | | populationImportErrorVOList.add(importErrorVO); |
| | | // ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | // importErrorVO.setErrorPosition("第" + index + "行,第26列"); |
| | | // importErrorVO.setErrorMsg("您填写的本地/外地有误"); |
| | | // populationImportErrorVOList.add(importErrorVO); |
| | | index++; |
| | | ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO(); |
| | | setMistake(oneData, mistake); |
| | |
| | | if(StringUtils.isNotEmpty(oneData.get(28))){ |
| | | Integer isOk = PopulPersonTypeEnum.getCodeByName(oneData.get(28)); |
| | | if(isOk.equals(-1)){ |
| | | ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | importErrorVO.setErrorPosition("第" + index + "行,第29列"); |
| | | importErrorVO.setErrorMsg("您填写的人员类型有误"); |
| | | populationImportErrorVOList.add(importErrorVO); |
| | | // ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | // importErrorVO.setErrorPosition("第" + index + "行,第29列"); |
| | | // importErrorVO.setErrorMsg("您填写的人员类型有误"); |
| | | // populationImportErrorVOList.add(importErrorVO); |
| | | index++; |
| | | ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO(); |
| | | setMistake(oneData, mistake); |
| | |
| | | R r = communityService.listSavePopulationServeExcelVO(newVoList, communityId); |
| | | if (!R.isOk(r)) { |
| | | List<ComMngPopulationMistakeExcelVO> list = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), ComMngPopulationMistakeExcelVO.class); |
| | | String errMsg = r.getMsg(); |
| | | List<ComMngPopulationImportErrorVO> errorList = JSON.parseArray(errMsg,ComMngPopulationImportErrorVO.class); |
| | | if(!errorList.isEmpty()){ |
| | | populationImportErrorVOList.addAll(errorList); |
| | | } |
| | | // String errMsg = r.getMsg(); |
| | | // List<ComMngPopulationImportErrorVO> errorList = JSON.parseArray(errMsg,ComMngPopulationImportErrorVO.class); |
| | | // if(!errorList.isEmpty()){ |
| | | // populationImportErrorVOList.addAll(errorList); |
| | | // } |
| | | mistakes.addAll(list); |
| | | R result = mistakeExportPopulation(mistakes); |
| | | loadUrl = (String)result.getData(); |
| | | ComMngPopulationImportErrorVO comMngPopulationImportErrorVO = new ComMngPopulationImportErrorVO(); |
| | | comMngPopulationImportErrorVO.setErrorPosition("loadUrl"); |
| | | comMngPopulationImportErrorVO.setErrorMsg(loadUrl); |
| | | populationImportErrorVOList.add(comMngPopulationImportErrorVO); |
| | | throw new ServiceException("500", JSON.toJSONString(populationImportErrorVOList)); |
| | | throw new ServiceException("500", JSON.toJSONString(mistakes)); |
| | | }else{ |
| | | // mistakes.addAll((List<ComMngPopulationMistakeExcelVO>)r.getData()); |
| | | R result = mistakeExportPopulation(mistakes); |
| | | loadUrl = (String)result.getData(); |
| | | if(!populationImportErrorVOList.isEmpty()){ |
| | | ComMngPopulationImportErrorVO comMngPopulationImportErrorVO = new ComMngPopulationImportErrorVO(); |
| | | comMngPopulationImportErrorVO.setErrorPosition("loadUrl"); |
| | | comMngPopulationImportErrorVO.setErrorMsg(loadUrl); |
| | | populationImportErrorVOList.add(comMngPopulationImportErrorVO); |
| | | throw new ServiceException("500", JSON.toJSONString(populationImportErrorVOList)); |
| | | if(!mistakes.isEmpty()){ |
| | | throw new ServiceException("500", JSON.toJSONString(mistakes)); |
| | | } |
| | | } |
| | | } catch (NumberFormatException e) { |
| | | e.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)); |
| | | // List<ComMngPopulationImportErrorVO> populationImportErrorVOList = new ArrayList<>(); |
| | | // ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | // importErrorVO.setErrorPosition("第" + index + "行"); |
| | | // importErrorVO.setErrorMsg("数据格式有误,请检查文档内数据"); |
| | | // populationImportErrorVOList.add(importErrorVO); |
| | | throw new ServiceException("500", "导入失败"); |
| | | } 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)); |
| | | // List<ComMngPopulationImportErrorVO> populationImportErrorVOList = new ArrayList<>(); |
| | | // ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | // importErrorVO.setErrorPosition("第" + index + "行"); |
| | | // importErrorVO.setErrorMsg("数据格式有误,请检查文档内数据"); |
| | | // populationImportErrorVOList.add(importErrorVO); |
| | | throw new ServiceException("500", "导入失败"); |
| | | } |
| | | } |
| | | |