From 83dbb3db7b1601f3c14b8f8f9892916aa4848e40 Mon Sep 17 00:00:00 2001 From: wans <747101512@qq.com> Date: Mon, 10 Jan 2022 11:15:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E5=8A=A8=E4=BA=BA=E5=8F=A3=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E6=B7=BB=E5=8A=A0=E8=BA=AB=E4=BB=BD=E8=AF=81=E5=8F=B7?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kafkaObject/FloatingPopulation.java | 16 ++++++++++++++++ .../impl/FloatingPopulationServiceImpl.java | 16 ++++++++-------- 2 files changed, 24 insertions(+), 8 deletions(-) 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());