diff --git a/src/main/java/cn/com/tenlion/commonpopulation/service/basepopulationinfo/impl/BasePopulationInfoServiceImpl.java b/src/main/java/cn/com/tenlion/commonpopulation/service/basepopulationinfo/impl/BasePopulationInfoServiceImpl.java index e1edecc..cf94af8 100644 --- a/src/main/java/cn/com/tenlion/commonpopulation/service/basepopulationinfo/impl/BasePopulationInfoServiceImpl.java +++ b/src/main/java/cn/com/tenlion/commonpopulation/service/basepopulationinfo/impl/BasePopulationInfoServiceImpl.java @@ -593,65 +593,69 @@ public class BasePopulationInfoServiceImpl extends DefaultBaseService implements List fullList = basePopulationInfoDao.listBasePopulationInfo(null); int forIndex = 0; for(BasePopulationInfoDTO item : fullList){ - jObj.put("uid", item.getBasePopulationInfoId()); - PopulationInfo info = new PopulationInfo(); - info.setfull_name(item.getFullName()); - info.setname_used_before(item.getNameUsedBefore()); - String gender = IdCardVerifyUtil.getIdCardGender(item.getIdCardNumber()); - info.setgender("1".equals(gender) ? "男" : "女"); - //info.setage(IdCardVerifyUtil.getAgeFromIdCardNumber(item.getIdCardNumber())); - info.setage(15); - if(item.getNation() != null && !"".equals(item.getNation())){ - DataDTO dataDTO = mongoDataService.get(item.getNation()); - info.setnation(dataDTO == null ? "" : dataDTO.getDataName()); + try { + jObj.put("uid", item.getBasePopulationInfoId()); + PopulationInfo info = new PopulationInfo(); + info.setfull_name(item.getFullName()); + info.setname_used_before(item.getNameUsedBefore()); + String gender = IdCardVerifyUtil.getIdCardGender(item.getIdCardNumber()); + info.setgender("1".equals(gender) ? "男" : "女"); + info.setage(IdCardVerifyUtil.getAgeFromIdCardNumber(item.getIdCardNumber())); + //info.setage(15); + if(item.getNation() != null && !"".equals(item.getNation())){ + DataDTO dataDTO = mongoDataService.get(item.getNation()); + info.setnation(dataDTO == null ? "" : dataDTO.getDataName()); + } + if(item.getReligion() != null && !"".equals(item.getReligion())){ + DataDTO dataDTO = mongoDataService.get(item.getReligion()); + info.setreligion(dataDTO == null ? "" : dataDTO.getDataName()); + } + if(item.getEducation() != null && !"".equals(item.getEducation())){ + DataDTO dataDTO = mongoDataService.get(item.getEducation()); + info.seteducation(dataDTO == null ? "" : dataDTO.getDataName()); + } + if(item.getPoliticalStatus() != null && !"".equals(item.getPoliticalStatus())){ + DataDTO dataDTO = mongoDataService.get(item.getPoliticalStatus()); + info.setpolitical_status(dataDTO == null ? "" : dataDTO.getDataName()); + } + if(item.getMaritalStatus() != null && !"".equals(item.getMaritalStatus())){ + DataDTO dataDTO = mongoDataService.get(item.getMaritalStatus()); + info.setmarital_status(dataDTO == null ? "" : dataDTO.getDataName()); + } + if(item.getOccupationCategory() != null && !"".equals(item.getOccupationCategory())){ + DataDTO dataDTO = mongoDataService.get(item.getOccupationCategory()); + info.setoccupation_category(dataDTO == null ? "" : dataDTO.getDataName()); + } + info.setoccupation(item.getOccupation() == null ? "" : item.getOccupation()); + info.setlocation_all(item.getAreaNames() == null ? "" : item.getAreaNames()); + info.setlocation_code(item.getAreaCode() == null ? "" : item.getAreaCode()); + if(item.getAreaCode() != null && !"".equals(item.getAreaCode())){ + AreaDTO areaDTO = mongoAreaService.getByCode(item.getAreaCode()); + info.setlocation_area(areaDTO == null ? "" : areaDTO.getAreaName()); + } + info.setis_key_teenager("否"); + info.setkey_teenager_time(""); + info.setis_addicts("否"); + info.setaddicts_time(""); + info.setis_aids("否"); + info.setaids_time(""); + info.setis_community_correction("否"); + info.setcommunity_correction_time(""); + info.setis_mental_disorders("否"); + info.setmental_disorders_time(""); + info.setis_release_after_sentence("否"); + info.setrelease_after_sentence_time(""); + info.setgrid_code(item.getGridId() == null ? "" : item.getGridId()); + info.setgrid_name(item.getGridName() == null ? "" : item.getGridName()); + jObj.put("data", info.saveCheckToJson()); + kafkaTemplate.send("tableSync", jObj.toJSONString()); + if(forIndex != 0 && forIndex % 5000 == 0){ + System.out.println("================= PULL_COUNT_" + forIndex + " ================="); + } + forIndex++; + } catch (Exception e){ + System.out.println(item); } - if(item.getReligion() != null && !"".equals(item.getReligion())){ - DataDTO dataDTO = mongoDataService.get(item.getReligion()); - info.setreligion(dataDTO == null ? "" : dataDTO.getDataName()); - } - if(item.getEducation() != null && !"".equals(item.getEducation())){ - DataDTO dataDTO = mongoDataService.get(item.getEducation()); - info.seteducation(dataDTO == null ? "" : dataDTO.getDataName()); - } - if(item.getPoliticalStatus() != null && !"".equals(item.getPoliticalStatus())){ - DataDTO dataDTO = mongoDataService.get(item.getPoliticalStatus()); - info.setpolitical_status(dataDTO == null ? "" : dataDTO.getDataName()); - } - if(item.getMaritalStatus() != null && !"".equals(item.getMaritalStatus())){ - DataDTO dataDTO = mongoDataService.get(item.getMaritalStatus()); - info.setmarital_status(dataDTO == null ? "" : dataDTO.getDataName()); - } - if(item.getOccupationCategory() != null && !"".equals(item.getOccupationCategory())){ - DataDTO dataDTO = mongoDataService.get(item.getOccupationCategory()); - info.setoccupation_category(dataDTO == null ? "" : dataDTO.getDataName()); - } - info.setoccupation(item.getOccupation() == null ? "" : item.getOccupation()); - info.setlocation_all(item.getAreaNames() == null ? "" : item.getAreaNames()); - info.setlocation_code(item.getAreaCode() == null ? "" : item.getAreaCode()); - if(item.getAreaCode() != null && !"".equals(item.getAreaCode())){ - AreaDTO areaDTO = mongoAreaService.getByCode(item.getAreaCode()); - info.setlocation_area(areaDTO == null ? "" : areaDTO.getAreaName()); - } - info.setis_key_teenager("否"); - info.setkey_teenager_time(""); - info.setis_addicts("否"); - info.setaddicts_time(""); - info.setis_aids("否"); - info.setaids_time(""); - info.setis_community_correction("否"); - info.setcommunity_correction_time(""); - info.setis_mental_disorders("否"); - info.setmental_disorders_time(""); - info.setis_release_after_sentence("否"); - info.setrelease_after_sentence_time(""); - info.setgrid_code(item.getGridId() == null ? "" : item.getGridId()); - info.setgrid_name(item.getGridName() == null ? "" : item.getGridName()); - jObj.put("data", info.saveCheckToJson()); - kafkaTemplate.send("tableSync", jObj.toJSONString()); - if(forIndex != 0 && forIndex % 5000 == 0){ - System.out.println("================= PULL_COUNT_" + forIndex + " ================="); - } - forIndex++; } }