数据全量更新方法

This commit is contained in:
wans 2022-01-26 16:26:02 +08:00
parent f5b3d49573
commit f8f5ea74a8
3 changed files with 83 additions and 1 deletions

View File

@ -182,4 +182,6 @@ public interface IBasePopulationInfoService {
List<Map<String, Object>> getDefaultPageEducation(Map<String, Object> params); List<Map<String, Object>> getDefaultPageEducation(Map<String, Object> params);
List<Map<String, Object>> getDefaultPageNation(Map<String, Object> params); List<Map<String, Object>> getDefaultPageNation(Map<String, Object> params);
void kafkaFullPullSync(String tableNumber);
} }

View File

@ -585,4 +585,68 @@ public class BasePopulationInfoServiceImpl extends DefaultBaseService implements
kafkaTemplate.send("tableSync", jObj.toJSONString()); kafkaTemplate.send("tableSync", jObj.toJSONString());
} }
@Override
public void kafkaFullPullSync(String tableNumber) {
JSONObject jObj = new JSONObject();
jObj.put("tableNumber", tableNumber);
jObj.put("action", "save");
List<BasePopulationInfoDTO> fullList = basePopulationInfoDao.listBasePopulationInfo(null);
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()));
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());
}
}
} }

View File

@ -233,10 +233,26 @@ public class IdCardVerifyUtil {
return split; return split;
} }
public static String sensitiveDataReplace(String str){
if(str == null || str.length() == 0){
return "******";
}
Integer strLen = str.length();
if(strLen > 6){
String newStr = str.substring(0,str.length() - 6);
return newStr + "******";
}
if(strLen > 3){
String newStr = str.substring(0,str.length() - 3);
return newStr + "***";
}
return "***";
}
public static void main(String[] args) { public static void main(String[] args) {
//boolean isTrue = isIDCard("330622810725323"); //boolean isTrue = isIDCard("330622810725323");
System.out.println(getAgeFromIdCardNumber("152822199310146919")); System.out.println(sensitiveDataReplace("152822199310146919"));
} }
} }