流动人口推送添加身份证号字段

This commit is contained in:
wans 2022-01-10 11:15:19 +08:00
parent 586185350f
commit 83dbb3db7b
2 changed files with 24 additions and 8 deletions

View File

@ -11,6 +11,8 @@ import org.apache.commons.lang3.StringUtils;
*/ */
public class FloatingPopulation { public class FloatingPopulation {
// 身份证号
private String id_card_number;
// 姓名 // 姓名
private String full_name; private String full_name;
// 流入原因 // 流入原因
@ -24,6 +26,14 @@ public class FloatingPopulation {
// 住所类型 // 住所类型
private String residence_type; private String residence_type;
public String getid_card_number() {
return id_card_number;
}
public void setid_card_number(String id_card_number) {
this.id_card_number = id_card_number;
}
public String getfull_name() { public String getfull_name() {
return full_name; return full_name;
} }
@ -75,6 +85,12 @@ public class FloatingPopulation {
// 保存校验并转Json // 保存校验并转Json
public String saveCheckToJson() { public String saveCheckToJson() {
if(StringUtils.isEmpty(id_card_number)) {
throw new ParamsException("身份证号名不能为空");
}
if(id_card_number != null && id_card_number.length() > 20 ) {
throw new ParamsException("身份证号超出长度");
}
if(StringUtils.isEmpty(full_name)) { if(StringUtils.isEmpty(full_name)) {
throw new ParamsException("姓名名不能为空"); throw new ParamsException("姓名名不能为空");
} }

View File

@ -327,6 +327,7 @@ public class FloatingPopulationServiceImpl extends DefaultBaseService implements
jObj.put("uid", params.get("floatingPopulationId").toString()); jObj.put("uid", params.get("floatingPopulationId").toString());
jObj.put("action", action); jObj.put("action", action);
FloatingPopulation info = new FloatingPopulation(); FloatingPopulation info = new FloatingPopulation();
info.setid_card_number(params.get("idCardNumber") == null ? "" : params.get("idCardNumber").toString());
info.setfull_name(params.get("fullName") == null ? "" : params.get("fullName").toString()); info.setfull_name(params.get("fullName") == null ? "" : params.get("fullName").toString());
info.setinflow_reason(params.get("inflowReason") == null ? "" : params.get("inflowReason").toString()); info.setinflow_reason(params.get("inflowReason") == null ? "" : params.get("inflowReason").toString());
if(params.get("inflowReason") != null && !"".equals(params.get("inflowReason").toString())){ if(params.get("inflowReason") != null && !"".equals(params.get("inflowReason").toString())){
@ -339,10 +340,9 @@ public class FloatingPopulationServiceImpl extends DefaultBaseService implements
DataDTO dataDTO = dataService.get(params.get("residenceType").toString()); DataDTO dataDTO = dataService.get(params.get("residenceType").toString());
info.setresidence_type(dataDTO == null ? "" : dataDTO.getDataName()); info.setresidence_type(dataDTO == null ? "" : dataDTO.getDataName());
} }
if(params.get("keyOfFollow") == null){ info.setkey_of_follow("");
info.setcard_expire_date(""); if("1".equals(params.get("keyOfFollow").toString())){
} else { info.setkey_of_follow("");
info.setcard_expire_date("1".equals(params.get("keyOfFollow").toString()) ? "" : "");
} }
jObj.put("data", info.saveCheckToJson()); jObj.put("data", info.saveCheckToJson());
kafkaTemplate.send("tableSync", jObj.toJSONString()); kafkaTemplate.send("tableSync", jObj.toJSONString());
@ -355,6 +355,7 @@ public class FloatingPopulationServiceImpl extends DefaultBaseService implements
jObj.put("uid", params.get("floatingPopulationId").toString()); jObj.put("uid", params.get("floatingPopulationId").toString());
jObj.put("action", action); jObj.put("action", action);
FloatingPopulation info = new FloatingPopulation(); FloatingPopulation info = new FloatingPopulation();
info.setid_card_number(params.get("idCardNumber") == null ? null : params.get("idCardNumber").toString());
info.setfull_name(params.get("fullName") == null ? "" : params.get("fullName").toString()); info.setfull_name(params.get("fullName") == null ? "" : params.get("fullName").toString());
info.setinflow_reason(params.get("inflowReason") == null ? null : params.get("inflowReason").toString()); info.setinflow_reason(params.get("inflowReason") == null ? null : params.get("inflowReason").toString());
if(params.get("inflowReason") != null && !"".equals(params.get("inflowReason").toString())){ if(params.get("inflowReason") != null && !"".equals(params.get("inflowReason").toString())){
@ -367,10 +368,9 @@ public class FloatingPopulationServiceImpl extends DefaultBaseService implements
DataDTO dataDTO = dataService.get(params.get("residenceType").toString()); DataDTO dataDTO = dataService.get(params.get("residenceType").toString());
info.setresidence_type(dataDTO == null ? null : dataDTO.getDataName()); info.setresidence_type(dataDTO == null ? null : dataDTO.getDataName());
} }
if(params.get("keyOfFollow") == null){ info.setkey_of_follow("");
info.setcard_expire_date(""); if("1".equals(params.get("keyOfFollow").toString())){
} else { info.setkey_of_follow("");
info.setcard_expire_date("1".equals(params.get("keyOfFollow").toString()) ? "" : "");
} }
jObj.put("data", info.updateToJson()); jObj.put("data", info.updateToJson());
kafkaTemplate.send("tableSync", jObj.toJSONString()); kafkaTemplate.send("tableSync", jObj.toJSONString());