修改kafka数据推送字段不全的问题

This commit is contained in:
wans 2022-01-26 11:12:12 +08:00
parent c57a0c4ae6
commit b870df75e0
4 changed files with 133 additions and 11 deletions

View File

@ -5,16 +5,23 @@ import ink.wgink.exceptions.ParamsException;
import org.apache.commons.lang3.StringUtils;
/**
* {tableNumber: '表单编号', uid:'主键', action'delete或update或save', data: {需要保存或修改的数据}, keyId:'批量删除自定义字段名(可为空)', keyValue:'批量删除自定义字段值(可为空)'}
* 编号:C0009
* 表名:floating_population
* 名称:流动人口
*/
public class FloatingPopulation {
// 身份证号
private String id_card_number;
// 姓名
private String full_name;
// 身份证号
private String id_card_number;
// 区域全名称(/隔开)
private String location_all;
// 区域编码
private String location_code;
// 区域旗县区名称
private String location_area;
// 流入原因
private String inflow_reason;
// 登记日期
@ -26,6 +33,14 @@ public class FloatingPopulation {
// 住所类型
private String residence_type;
public String getfull_name() {
return full_name;
}
public void setfull_name(String full_name) {
this.full_name = full_name;
}
public String getid_card_number() {
return id_card_number;
}
@ -34,12 +49,28 @@ public class FloatingPopulation {
this.id_card_number = id_card_number;
}
public String getfull_name() {
return full_name;
public String getlocation_all() {
return location_all;
}
public void setfull_name(String full_name) {
this.full_name = full_name;
public void setlocation_all(String location_all) {
this.location_all = location_all;
}
public String getlocation_code() {
return location_code;
}
public void setlocation_code(String location_code) {
this.location_code = location_code;
}
public String getlocation_area() {
return location_area;
}
public void setlocation_area(String location_area) {
this.location_area = location_area;
}
public String getinflow_reason() {
@ -85,17 +116,35 @@ public class FloatingPopulation {
// 保存校验并转Json
public String saveCheckToJson() {
if(StringUtils.isEmpty(full_name)) {
throw new ParamsException("姓名名不能为空");
}
if(full_name != null && full_name.length() > 255 ) {
throw new ParamsException("姓名超出长度");
}
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("姓名名不能为空");
if(StringUtils.isEmpty(location_all)) {
throw new ParamsException("区域全名称(/隔开)名不能为空");
}
if(full_name != null && full_name.length() > 255 ) {
throw new ParamsException("姓名超出长度");
if(location_all != null && location_all.length() > 255 ) {
throw new ParamsException("区域全名称(/隔开)超出长度");
}
if(StringUtils.isEmpty(location_code)) {
throw new ParamsException("区域编码名不能为空");
}
if(location_code != null && location_code.length() > 100 ) {
throw new ParamsException("区域编码超出长度");
}
if(StringUtils.isEmpty(location_area)) {
throw new ParamsException("区域旗县区名称名不能为空");
}
if(location_area != null && location_area.length() > 100 ) {
throw new ParamsException("区域旗县区名称超出长度");
}
if(inflow_reason != null && inflow_reason.length() > 255 ) {
throw new ParamsException("流入原因超出长度");

View File

@ -5,12 +5,19 @@ import ink.wgink.exceptions.ParamsException;
import org.apache.commons.lang3.StringUtils;
/**
* {tableNumber: '表单编号', uid:'主键', action'delete或update或save', data: {需要保存或修改的数据}, keyId:'批量删除自定义字段名(可为空)', keyValue:'批量删除自定义字段值(可为空)'}
* 编号:C0008
* 表名:overseas_personnel
* 名称:境外人员
*/
public class OverseasPersonnel {
// 区域旗县区名称
private String location_area;
// 区域编码
private String location_code;
// 区域全名称(/隔开)
private String location_all;
// 外文名
private String family_name;
// 外文姓
@ -26,6 +33,30 @@ public class OverseasPersonnel {
// 是否重点关注人员(/)
private String key_of_follow;
public String getlocation_area() {
return location_area;
}
public void setlocation_area(String location_area) {
this.location_area = location_area;
}
public String getlocation_code() {
return location_code;
}
public void setlocation_code(String location_code) {
this.location_code = location_code;
}
public String getlocation_all() {
return location_all;
}
public void setlocation_all(String location_all) {
this.location_all = location_all;
}
public String getfamily_name() {
return family_name;
}
@ -85,6 +116,24 @@ public class OverseasPersonnel {
// 保存校验并转Json
public String saveCheckToJson() {
if(StringUtils.isEmpty(location_area)) {
throw new ParamsException("区域旗县区名称名不能为空");
}
if(location_area != null && location_area.length() > 100 ) {
throw new ParamsException("区域旗县区名称超出长度");
}
if(StringUtils.isEmpty(location_code)) {
throw new ParamsException("区域编码名不能为空");
}
if(location_code != null && location_code.length() > 100 ) {
throw new ParamsException("区域编码超出长度");
}
if(StringUtils.isEmpty(location_all)) {
throw new ParamsException("区域全名称(/隔开)名不能为空");
}
if(location_all != null && location_all.length() > 255 ) {
throw new ParamsException("区域全名称(/隔开)超出长度");
}
if(StringUtils.isEmpty(family_name)) {
throw new ParamsException("外文名名不能为空");
}

View File

@ -329,6 +329,12 @@ public class FloatingPopulationServiceImpl extends DefaultBaseService implements
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.setlocation_all(params.get("areaNames") == null ? "" : params.get("areaNames").toString());
info.setlocation_code(params.get("areaCode") == null ? "" : params.get("areaCode").toString());
if(params.get("areaCode") != null && !"".equals(params.get("areaCode").toString())){
AreaDTO areaDTO = areaService.getByCode(params.get("areaCode").toString());
info.setlocation_area(areaDTO == null ? "" : areaDTO.getAreaName());
}
info.setinflow_reason(params.get("inflowReason") == null ? "" : params.get("inflowReason").toString());
if(params.get("inflowReason") != null && !"".equals(params.get("inflowReason").toString())){
DataDTO dataDTO = dataService.get(params.get("inflowReason").toString());
@ -345,7 +351,7 @@ public class FloatingPopulationServiceImpl extends DefaultBaseService implements
info.setkey_of_follow("");
}
jObj.put("data", info.saveCheckToJson());
kafkaTemplate.send("tableSync", jObj.toJSONString());
//kafkaTemplate.send("tableSync", jObj.toJSONString());
}
@Override
@ -357,6 +363,12 @@ public class FloatingPopulationServiceImpl extends DefaultBaseService implements
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.setlocation_all(params.get("areaNames") == null ? null : params.get("areaNames").toString());
info.setlocation_code(params.get("areaCode") == null ? null : params.get("areaCode").toString());
if(params.get("areaCode") != null && !"".equals(params.get("areaCode").toString())){
AreaDTO areaDTO = areaService.getByCode(params.get("areaCode").toString());
info.setlocation_area(areaDTO == null ? null : areaDTO.getAreaName());
}
info.setinflow_reason(params.get("inflowReason") == null ? null : params.get("inflowReason").toString());
if(params.get("inflowReason") != null && !"".equals(params.get("inflowReason").toString())){
DataDTO dataDTO = dataService.get(params.get("inflowReason").toString());

View File

@ -297,6 +297,12 @@ public class OverseasPersonnelServiceImpl extends DefaultBaseService implements
jObj.put("uid", params.get("overseasPersonnelId").toString());
jObj.put("action", action);
OverseasPersonnel info = new OverseasPersonnel();
info.setlocation_all(params.get("areaNames") == null ? "" : params.get("areaNames").toString());
info.setlocation_code(params.get("areaCode") == null ? "" : params.get("areaCode").toString());
if(params.get("areaCode") != null && !"".equals(params.get("areaCode").toString())){
AreaDTO areaDTO = areaService.getByCode(params.get("areaCode").toString());
info.setlocation_area(areaDTO == null ? "" : areaDTO.getAreaName());
}
info.setfamily_name(params.get("familyName") == null ? "" : params.get("familyName").toString());
info.setgiven_name(params.get("givenName") == null ? "" : params.get("givenName").toString());
info.setchinese_name(params.get("chineseName") == null ? "" : params.get("chineseName").toString());
@ -322,6 +328,12 @@ public class OverseasPersonnelServiceImpl extends DefaultBaseService implements
jObj.put("uid", params.get("overseasPersonnelId").toString());
jObj.put("action", action);
OverseasPersonnel info = new OverseasPersonnel();
info.setlocation_all(params.get("areaNames") == null ? null : params.get("areaNames").toString());
info.setlocation_code(params.get("areaCode") == null ? null : params.get("areaCode").toString());
if(params.get("areaCode") != null && !"".equals(params.get("areaCode").toString())){
AreaDTO areaDTO = areaService.getByCode(params.get("areaCode").toString());
info.setlocation_area(areaDTO == null ? null : areaDTO.getAreaName());
}
info.setfamily_name(params.get("familyName") == null ? null : params.get("familyName").toString());
info.setgiven_name(params.get("givenName") == null ? null : params.get("givenName").toString());
info.setchinese_name(params.get("chineseName") == null ? null : params.get("chineseName").toString());