diff --git a/src/main/java/cn/com/tenlion/commonpopulation/kafkaObject/FloatingPopulation.java b/src/main/java/cn/com/tenlion/commonpopulation/kafkaObject/FloatingPopulation.java index 306cd07..fc341eb 100644 --- a/src/main/java/cn/com/tenlion/commonpopulation/kafkaObject/FloatingPopulation.java +++ b/src/main/java/cn/com/tenlion/commonpopulation/kafkaObject/FloatingPopulation.java @@ -11,6 +11,8 @@ import org.apache.commons.lang3.StringUtils; */ public class FloatingPopulation { + // 身份证号 + private String id_card_number; // 姓名 private String full_name; // 流入原因 @@ -24,6 +26,14 @@ public class FloatingPopulation { // 住所类型 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() { return full_name; } @@ -75,6 +85,12 @@ public class FloatingPopulation { // 保存校验并转Json 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)) { throw new ParamsException("姓名名不能为空"); } diff --git a/src/main/java/cn/com/tenlion/commonpopulation/service/floatingpopulation/impl/FloatingPopulationServiceImpl.java b/src/main/java/cn/com/tenlion/commonpopulation/service/floatingpopulation/impl/FloatingPopulationServiceImpl.java index c4be8db..824079e 100644 --- a/src/main/java/cn/com/tenlion/commonpopulation/service/floatingpopulation/impl/FloatingPopulationServiceImpl.java +++ b/src/main/java/cn/com/tenlion/commonpopulation/service/floatingpopulation/impl/FloatingPopulationServiceImpl.java @@ -327,6 +327,7 @@ public class FloatingPopulationServiceImpl extends DefaultBaseService implements jObj.put("uid", params.get("floatingPopulationId").toString()); jObj.put("action", action); 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.setinflow_reason(params.get("inflowReason") == null ? "" : 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()); info.setresidence_type(dataDTO == null ? "" : dataDTO.getDataName()); } - if(params.get("keyOfFollow") == null){ - info.setcard_expire_date("否"); - } else { - info.setcard_expire_date("1".equals(params.get("keyOfFollow").toString()) ? "是" : "否"); + info.setkey_of_follow("否"); + if("1".equals(params.get("keyOfFollow").toString())){ + info.setkey_of_follow("是"); } jObj.put("data", info.saveCheckToJson()); kafkaTemplate.send("tableSync", jObj.toJSONString()); @@ -355,6 +355,7 @@ public class FloatingPopulationServiceImpl extends DefaultBaseService implements jObj.put("uid", params.get("floatingPopulationId").toString()); jObj.put("action", action); 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.setinflow_reason(params.get("inflowReason") == null ? null : 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()); info.setresidence_type(dataDTO == null ? null : dataDTO.getDataName()); } - if(params.get("keyOfFollow") == null){ - info.setcard_expire_date("否"); - } else { - info.setcard_expire_date("1".equals(params.get("keyOfFollow").toString()) ? "是" : "否"); + info.setkey_of_follow("否"); + if("1".equals(params.get("keyOfFollow").toString())){ + info.setkey_of_follow("是"); } jObj.put("data", info.updateToJson()); kafkaTemplate.send("tableSync", jObj.toJSONString());