Browse Source

同步 死亡和残疾数据

master
jianjun 3 years ago
parent
commit
7e6c0c6bb9
  1. 28
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtDataSyncResDTO.java
  2. 144
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/YtHsResUtils.java
  3. 6
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/NatInfoScanTask.java
  4. 145
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncRecordDeathDTO.java
  5. 145
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncRecordDisabilityDTO.java
  6. 42
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DataSyncTaskParam.java
  7. 21
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/NatInfoScanTaskFormDTO.java
  8. 40
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/dataSync/QueryIcResiUserFormDTO.java
  9. 11
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatUserInfoResultDTO.java
  10. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  11. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  12. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncConfigController.java
  13. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncConfigDao.java
  14. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncRecordDeathDao.java
  15. 17
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncRecordDisabilityDao.java
  16. 111
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncRecordDeathEntity.java
  17. 111
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncRecordDisabilityEntity.java
  18. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncConfigService.java
  19. 78
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncRecordDeathService.java
  20. 81
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncRecordDisabilityService.java
  21. 529
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncConfigServiceImpl.java
  22. 87
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncRecordDeathServiceImpl.java
  23. 94
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncRecordDisabilityServiceImpl.java
  24. 24
      epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncConfigDao.xml
  25. 35
      epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncRecordDeathDao.xml
  26. 95
      epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncRecordDisabilityDao.xml

28
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtDataSyncResDTO.java

@ -0,0 +1,28 @@
package com.epmet.commons.tools.dto.result;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Description
* @Author yzm
* @Date 2022/9/26 17:04
*/
@NoArgsConstructor
@Data
public class YtDataSyncResDTO {
private int code = 200;
private String msg = "请求成功";
/**
* 响应数据
*/
private String data;
private int total;
public YtDataSyncResDTO(int code, String msg, String data) {
this.code = code;
this.msg = msg;
this.data = data;
}
}

144
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/YtHsResUtils.java

@ -1,6 +1,8 @@
package com.epmet.commons.tools.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.epmet.commons.tools.dto.result.YtDataSyncResDTO;
import com.epmet.commons.tools.dto.result.YtHsjcResDTO;
import lombok.extern.slf4j.Slf4j;
@ -15,12 +17,15 @@ import java.util.Map;
*/
@Slf4j
public class YtHsResUtils {
private static String URL = "http://10.2.2.60:8191/sjzt/server/hsjcxx";
private static String SERVER_URL = "http://10.2.2.60:8191/sjzt/server/";
private static final String APP_KEY_VALUE = "DR4jF5Be7sCsqDmCamq2tmYCl";
private static final String APP_KEY = "appkey";
private static final String CARD_NO = "card_no";
private static final String USER_NAME = "name";
private static final String ROW_NUM = "ROWNUM";
private static final String PAGE_SIZE = "PAGESIZE";
private static final String START = "ROWNUM";
private static final String LIMIT = "PAGESIZE";
/**
* desc:图片同步扫描
*
@ -36,18 +41,151 @@ public class YtHsResUtils {
param.put(ROW_NUM,rowNum);
param.put(PAGE_SIZE,pageSize);
log.info("hsjc api param:{}",param);
Result<String> result = HttpClientManager.getInstance().sendGet(URL, param);
Result<String> result = HttpClientManager.getInstance().sendGet(SERVER_URL+"hsjcxx", param);
log.info("hsjc api result:{}",JSON.toJSONString(result));
if (result.success()) {
return JSON.parseObject(result.getData(), YtHsjcResDTO.class);
}
} catch (Exception e) {
e.printStackTrace();
log.warn(String.format("烟台核酸检测结果查询异常cardNo:%s,异常信息:%s", cardNo, e.getMessage()));
}
YtHsjcResDTO resultResult = new YtHsjcResDTO();
resultResult.setData(new ArrayList<>());
return resultResult;
}
/**
* desc:死亡数据同步
*
* @return
*/
public static YtDataSyncResDTO siWang(String cardNo, String userName) {
try {
// 1)appkey秘钥
// 2)name姓名 必填
// 3)idcard身份证号 必填
// 4)start开始默认0
// 5)limit每页记录数
Map<String,Object> param = new HashMap<>();
param.put(APP_KEY,APP_KEY_VALUE);
param.put("id_card",cardNo);
param.put("name",userName);
param.put("start",0);
param.put("limit",1);
log.info("siWang api param:{}",param);
//todo 放开他
//Result<String> result = HttpClientManager.getInstance().sendGet(SERVER_URL+"mzt_hhrysj1", param);
String mockData2 = "{\"code\":200,\"data\":\"{\\\"data\\\":[{\\\"AGE\\\":\\\"73\\\",\\\"CARD_TYPE\\\":\\\"9\\\",\\\"CREATE_ORGAN_NAME\\\":\\\"菏泽市巨野县殡仪馆\\\",\\\"CREMATION_TIME\\\":\\\"2014-04-17 14:46\\\",\\\"DEAD_ID\\\":\\\"SZ-371724-2012-1006560\\\",\\\"DEATH_DATE\\\":\\\"2014-04-17\\\",\\\"FAMILY_ADD\\\":\\\"菏泽市巨野县开发区马庄村\\\",\\\"FOLK\\\":\\\"01\\\",\\\"ID_CARD\\\":\\\"1\\\",\\\"NAME\\\":\\\"郭**\\\",\\\"NATION\\\":\\\"156\\\",\\\"POPULACE\\\":\\\"3381C3014B60439FE05319003C0A0897\\\",\\\"POPULACE_NAME\\\":\\\"菏泽市巨野县开发区马庄村\\\",\\\"RECORD_ID\\\":\\\"E-371724-2012-100000000000407849\\\",\\\"RN\\\":\\\"1\\\",\\\"SEX\\\":\\\"1\\\"}],\\\"fields\\\":[\\\"RN\\\",\\\"RECORD_ID\\\",\\\"DEAD_ID\\\",\\\"NAME\\\",\\\"SEX\\\",\\\"CARD_TYPE\\\",\\\"ID_CARD\\\",\\\"BIRTHDAY\\\",\\\"AGE\\\",\\\"NATION\\\",\\\"FOLK\\\",\\\"IF_LOCAL\\\",\\\"POPULACE\\\",\\\"FAMILY_ADD\\\",\\\"WORK_NAME\\\",\\\"DEATH_DATE\\\",\\\"CREMATION_TIME\\\",\\\"CREATE_ORGAN_NAME\\\",\\\"POPULACE_NAME\\\"],\\\"total\\\":\\\"4903\\\"}\",\"message\":\"\"}";
String mockData = "{\"code\":200,\"data\":\"{\\\"data\\\":[],\\\"fields\\\":[\\\"RN\\\",\\\"RECORD_ID\\\",\\\"DEAD_ID\\\",\\\"NAME\\\",\\\"SEX\\\",\\\"CARD_TYPE\\\",\\\"ID_CARD\\\",\\\"BIRTHDAY\\\",\\\"AGE\\\",\\\"NATION\\\",\\\"FOLK\\\",\\\"IF_LOCAL\\\",\\\"POPULACE\\\",\\\"FAMILY_ADD\\\",\\\"WORK_NAME\\\",\\\"DEATH_DATE\\\",\\\"CREMATION_TIME\\\",\\\"CREATE_ORGAN_NAME\\\",\\\"POPULACE_NAME\\\"],\\\"total\\\":\\\"4903\\\"}\",\"message\":\"\"}";
Result<String> result = new Result<String>().ok(mockData);
log.info("siWang api result:{}",JSON.toJSONString(result));
String data = result.getData();
JSONObject jsonObject = JSON.parseObject(data);
//他们的结果是成功的
if (jsonObject!= null && "200".equals(jsonObject.getString("code"))){
//第一层data
JSONObject realObject = JSON.parseObject(jsonObject.getString("data"));
if (realObject!= null&& realObject.getJSONArray("data") != null) {
//第二层 data
Object thirdData = realObject.getJSONArray("data").get(0);
YtDataSyncResDTO ytDataSyncResDTO = new YtDataSyncResDTO(200,"",thirdData.toString());
return ytDataSyncResDTO;
}else {
log.warn("canji 调用蓝图接口成功但是蓝图的结果中 省平台失败");
}
}else {
log.warn("canji 调用蓝图接口败");
}
} catch (Exception e) {
log.warn(String.format("烟台siWang结果查询异常cardNo:%s,异常信息:%s", cardNo, e.getMessage()));
}
return new YtDataSyncResDTO();
}
/**
* desc:残疾数据同步
* @remark默认失败 因为一旦成功没有数据 会影响残疾人的数据 接口失败数据不做任何处理
* @return
*/
public static YtDataSyncResDTO canji(String idCard, String userName) {
YtDataSyncResDTO failResult = new YtDataSyncResDTO();
failResult.setCode(500);
failResult.setMsg("默认错误");
try {
// 1)appkey
// 2)name姓名
// 3)citizenId身份证号
Map<String,Object> param = new HashMap<>();
param.put(APP_KEY,APP_KEY_VALUE);
param.put("citizenId",idCard);
param.put("name",userName);
log.info("canji api param:{}",param);
//todo 上线放开她
//Result<String> result = HttpClientManager.getInstance().sendGet(SERVER_URL+"sdcl_xxzx_czcjr1", param);
String mockData = "{\"code\":\"200\",\"msg\":\"请求成功\",\"data\":\"{\\\"code\\\":200,\\\"data\\\":{\\\"result\\\":true,\\\"errorcode\\\":0,\\\"msg\\\":\\\"获取成功\\\",\\\"data\\\":{\\\"isNewRecord\\\":\\\"true\\\",\\\"delFlag\\\":\\\"0\\\",\\\"pageNo\\\":\\\"0\\\",\\\"pageSize\\\":\\\"0\\\",\\\"name\\\":\\\"姓名\\\",\\\"genderName\\\":\\\"性别\\\",\\\"citizenId\\\":\\\"身份证号\\\",\\\"cardNum\\\":\\\"残疾证号\\\",\\\"idtKindName\\\":\\\"残疾类别\\\",\\\"idtLevelName\\\":\\\"残疾等级\\\",\\\"eduLevelName\\\":\\\"教育程度\\\",\\\"marriagerName\\\":\\\"婚姻状况\\\",\\\"guardian\\\":\\\"监护人\\\",\\\"guardianPhone\\\":\\\"监护人联系方式\\\",\\\"residentAdd\\\":\\\"户籍地址\\\",\\\"nowAdd\\\":\\\"现居住地\\\",\\\"phoneNo\\\":\\\"联系电话\\\"}},\\\"message\\\":\\\"\\\"}\",\"total\":0}";
Result<String> result = new Result<String>().ok(mockData);
log.info("canji api result:{}",JSON.toJSONString(result));
if (result.success()) {
/*返回示例
{
"code":"200",
"msg":"请求成功",
"data":"{
\"code\":200,
\"data\":{
\\\"result\\\":true,
\\\"errorcode\\\":0,
\\\"msg\\\":\\\"获取成功\\\",
\\\"data\\\":{
\\\"isNewRecord\\\":\\\"true\\\",
}
}
\"message\":\"\"
}",
"total":0
}
*/
String data = result.getData();
JSONObject jsonObject = JSON.parseObject(data);
//他们的结果是成功的
if (jsonObject!= null && "200".equals(jsonObject.getString("code"))){
//第一层data
JSONObject realObject = JSON.parseObject(jsonObject.getString("data"));
if (realObject!= null && "200".equals(realObject.getString("code"))) {
//第二层 data
String thirdData = realObject.getString("data");
YtDataSyncResDTO ytDataSyncResDTO = JSON.parseObject(thirdData, YtDataSyncResDTO.class);
return ytDataSyncResDTO;
}else {
log.warn("canji 调用蓝图接口成功但是蓝图的结果中 省平台失败");
}
}else {
log.warn("canji 调用蓝图接口败");
}
}
} catch (Exception e) {
log.warn(String.format("烟台canji结果查询异常cardNo:%s,异常信息:%s", idCard, e.getMessage()));
}
return failResult;
}
public static void main(String[] args) {
YtDataSyncResDTO canji = canji("123", "123");
System.out.println("残疾结果:"+JSON.toJSON(canji));
YtDataSyncResDTO siwang = siWang("1213", "!23");
System.out.println("死亡结果:"+JSON.toJSON(siwang));
}
}

6
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/NatInfoScanTask.java

@ -3,7 +3,7 @@ package com.epmet.task;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.NatInfoScanTaskFormDTO;
import com.epmet.dto.form.DataSyncTaskParam;
import com.epmet.feign.EpmetUserOpenFeignClient;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@ -26,9 +26,9 @@ public class NatInfoScanTask implements ITask {
@Override
public void run(String params) {
NatInfoScanTaskFormDTO formDTO = new NatInfoScanTaskFormDTO();
DataSyncTaskParam formDTO = new DataSyncTaskParam();
if (StringUtils.isNotBlank(params)) {
formDTO = JSON.parseObject(params, NatInfoScanTaskFormDTO.class);
formDTO = JSON.parseObject(params, DataSyncTaskParam.class);
}
Result result = userOpenFeignClient.natInfoScanTask(formDTO);
if (result.success()) {

145
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncRecordDeathDTO.java

@ -0,0 +1,145 @@
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 数据同步记录-居民死亡信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-10-11
*/
@Data
public class DataSyncRecordDeathDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户Id
*/
private String customerId;
/**
* 组织Id
*/
private String agencyId;
/**
* 组织的pids 含agencyId本身
*/
private String pids;
/**
* 网格ID
*/
private String gridId;
/**
* 姓名
*/
private String name;
/**
* 身份证
*/
private String idCard;
/**
* 手机号
*/
private String mobile;
/**
* 居民Idic_resi_user.id
*/
private String icResiUserId;
/**
* 年龄(享年)
*/
private Integer age;
/**
* 家庭住址
*/
private String address;
/**
* 死亡时间
*/
private String deathDate;
/**
* 火化时间
*/
private String cremationTime;
/**
* 民族
*/
private String mz;
/**
* 登记单位名称
*/
private String organName;
/**
* 国籍
*/
private String nation;
/**
* 第三方记录唯一标识
*/
private String thirdRecordId;
/**
* 处理状态更新至居民信息 0:未处理1:处理成功2处理失败
*/
private Integer dealStatus;
/**
* 处理结果
*/
private String dealRedult;
/**
* 删除标识0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

145
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncRecordDisabilityDTO.java

@ -0,0 +1,145 @@
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 数据同步记录-居民残疾信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-10-11
*/
@Data
public class DataSyncRecordDisabilityDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户Id
*/
private String customerId;
/**
* 组织Id
*/
private String agencyId;
/**
* 组织的pids 含agencyId本身
*/
private String pids;
/**
* 网格ID
*/
private String gridId;
/**
* 姓名
*/
private String name;
/**
* 身份证
*/
private String idCard;
/**
* 电话
*/
private String mobile;
/**
* 居民Idic_resi_user.id
*/
private String icResiUserId;
/**
* 残疾证号
*/
private String cardNum;
/**
* 残疾等级(状况)
*/
private String cjzk;
/**
* 残疾类别
*/
private String cjlb;
/**
* 文化程度
*/
private String eduLevel;
/**
* 婚姻状况
*/
private String maritalStatus;
/**
* 监护人
*/
private String guardian;
/**
* 监护人联系方式
*/
private String guardianPhone;
/**
* 处理状态更新至居民信息 0:未处理1:处理成功2处理失败
*/
private Integer dealStatus;
/**
* 残疾状态 0:非残疾1:残疾
*/
private Integer disabilityStatus;
/**
* 处理结果
*/
private String dealRedult;
/**
* 删除标识0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

42
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DataSyncTaskParam.java

@ -0,0 +1,42 @@
package com.epmet.dto.form;
import com.epmet.dto.DataSyncScopeDTO;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Author zxc
* @DateTime 2022/9/26 17:04
* @DESC
*/
@Data
public class DataSyncTaskParam implements Serializable {
private static final long serialVersionUID = 3053943501957102943L;
private String customerId;
private List<String> idCards;
// ========================后台设置=====
/**
* 根据配置 设置次参数数据查询范围 必填
*/
private List<DataSyncScopeDTO> orgList;
/**
* 居民状态0:正常;1:迁出;2:注销
*/
private String resiStatus;
/**
* 居民子状态 01新增02导入03迁入04新生11迁出21死亡
*/
private String resiSubStatus;
/**
* 类别字段
*/
public String categoryColumn;
}

21
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/NatInfoScanTaskFormDTO.java

@ -1,21 +0,0 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Author zxc
* @DateTime 2022/9/26 17:04
* @DESC
*/
@Data
public class NatInfoScanTaskFormDTO implements Serializable {
private static final long serialVersionUID = 3053943501957102943L;
private String customerId;
private List<String> idCards;
}

40
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/dataSync/QueryIcResiUserFormDTO.java

@ -0,0 +1,40 @@
package com.epmet.dto.form.dataSync;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import com.epmet.dto.DataSyncScopeDTO;
import lombok.Data;
import java.util.List;
/**
* desc:查询数据同步 所需要的居民信息参数
* @author liujianjun
*/
@Data
public class QueryIcResiUserFormDTO extends PageFormDTO {
private static final long serialVersionUID = -3556723801307348545L;
/**
* 数据查询范围 必填
*/
private List<DataSyncScopeDTO> scopeList;
/**
* 必填
*/
private String customerId;
/**
* 身份证号集合 非必填
*/
private List<String> idCards;
/**
* 居民状态0:正常;1:迁出;2:注销
*/
private String resiStatus;
/**
* 居民子状态 01新增02导入03迁入04新生11迁出21死亡
*/
private String resiSubStatus;
}

11
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatUserInfoResultDTO.java

@ -14,11 +14,22 @@ public class NatUserInfoResultDTO implements Serializable {
private static final long serialVersionUID = 8904940082452398136L;
private String customerId;
private String idCard;
private String userId;
private String agencyId;
private String gridId;
private String pids;
private String name;
/**
* 18大类 某一类的 是否值用于比较 同步数据结果确定是否要插入到表中
*/
private String categoryColumn;
}

2
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java

@ -923,5 +923,5 @@ public interface EpmetUserOpenFeignClient {
Result<DingLoginResiResDTO> dingResiLogin(@RequestBody DingLoginResiFormDTO formDTO);
@PostMapping("/epmetuser/dataSyncConfig/natInfoScanTask")
Result natInfoScanTask(@RequestBody NatInfoScanTaskFormDTO formDTO);
Result natInfoScanTask(@RequestBody DataSyncTaskParam formDTO);
}

2
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java

@ -713,7 +713,7 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
}
@Override
public Result natInfoScanTask(NatInfoScanTaskFormDTO formDTO) {
public Result natInfoScanTask(DataSyncTaskParam formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "natInfoScanTask", formDTO);
}
}

4
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncConfigController.java

@ -13,7 +13,7 @@ import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.DataSyncConfigDTO;
import com.epmet.dto.form.ConfigSwitchFormDTO;
import com.epmet.dto.form.NatInfoScanTaskFormDTO;
import com.epmet.dto.form.DataSyncTaskParam;
import com.epmet.dto.form.ScopeSaveFormDTO;
import com.epmet.service.DataSyncConfigService;
import org.springframework.beans.factory.annotation.Autowired;
@ -107,7 +107,7 @@ public class DataSyncConfigController {
}
@PostMapping("natInfoScanTask")
public Result natInfoScanTask(@RequestBody NatInfoScanTaskFormDTO formDTO){
public Result natInfoScanTask(@RequestBody DataSyncTaskParam formDTO){
dataSyncConfigService.dataSyncForYanTaiTask(formDTO);
return new Result();
}

5
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncConfigDao.java

@ -4,6 +4,7 @@ import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.DataSyncConfigDTO;
import com.epmet.dto.DataSyncScopeDTO;
import com.epmet.dto.form.ConfigSwitchFormDTO;
import com.epmet.dto.form.DataSyncTaskParam;
import com.epmet.dto.result.NatUserInfoResultDTO;
import com.epmet.entity.DataSyncConfigEntity;
import org.apache.ibatis.annotations.Mapper;
@ -53,10 +54,10 @@ public interface DataSyncConfigDao extends BaseDao<DataSyncConfigEntity> {
/**
* Desc: 根据范围查询居民证件号
*
* @param orgList
* @param formDTO
* @author zxc
* @date 2022/9/27 09:23
*/
List<NatUserInfoResultDTO> getIdCardsByScope(@Param("orgList") List<DataSyncScopeDTO> orgList, @Param("idCardList") List<String> idCardList);
List<NatUserInfoResultDTO> getIdCardsByScope(DataSyncTaskParam formDTO);
}

16
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncRecordDeathDao.java

@ -0,0 +1,16 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.DataSyncRecordDeathEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 数据同步记录-居民死亡信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-10-11
*/
@Mapper
public interface DataSyncRecordDeathDao extends BaseDao<DataSyncRecordDeathEntity> {
}

17
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncRecordDisabilityDao.java

@ -0,0 +1,17 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.DataSyncRecordDisabilityEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 数据同步记录-居民残疾信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-10-11
*/
@Mapper
public interface DataSyncRecordDisabilityDao extends BaseDao<DataSyncRecordDisabilityEntity> {
//int upsertBatch(List<DataSyncRecordDisabilityEntity> list);
}

111
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncRecordDeathEntity.java

@ -0,0 +1,111 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 数据同步记录-居民死亡信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-10-11
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("data_sync_record_death")
public class DataSyncRecordDeathEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
private String customerId;
/**
* 组织Id
*/
private String agencyId;
/**
* 组织的pids 含agencyId本身
*/
private String pids;
/**
* 网格ID
*/
private String gridId;
/**
* 姓名
*/
private String name;
/**
* 身份证
*/
private String idCard;
/**
* 手机号
*/
private String mobile;
/**
* 居民Idic_resi_user.id
*/
private String icResiUserId;
/**
* 年龄(享年)
*/
private Integer age;
/**
* 家庭住址
*/
private String address;
/**
* 死亡时间
*/
private String deathDate;
/**
* 火化时间
*/
private String cremationTime;
/**
* 民族
*/
private String mz;
/**
* 登记单位名称
*/
private String organName;
/**
* 国籍
*/
private String nation;
/**
* 第三方记录唯一标识
*/
private String thirdRecordId;
/**
* 处理状态更新至居民信息 0:未处理1:处理成功2处理失败
*/
private Integer dealStatus;
/**
* 处理结果
*/
private String dealRedult;
}

111
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncRecordDisabilityEntity.java

@ -0,0 +1,111 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 数据同步记录-居民残疾信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-10-11
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("data_sync_record_disability")
public class DataSyncRecordDisabilityEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
private String customerId;
/**
* 组织Id
*/
private String agencyId;
/**
* 组织的pids 含agencyId本身
*/
private String pids;
/**
* 网格ID
*/
private String gridId;
/**
* 姓名
*/
private String name;
/**
* 身份证
*/
private String idCard;
/**
* 电话
*/
private String mobile;
/**
* 居民Idic_resi_user.id
*/
private String icResiUserId;
/**
* 残疾证号
*/
private String cardNum;
/**
* 残疾等级(状况)
*/
private String cjzk;
/**
* 残疾类别
*/
private String cjlb;
/**
* 文化程度
*/
private String eduLevel;
/**
* 婚姻状况
*/
private String maritalStatus;
/**
* 监护人
*/
private String guardian;
/**
* 监护人联系方式
*/
private String guardianPhone;
/**
* 处理状态更新至居民信息 0:未处理1:处理成功2处理失败
*/
private Integer dealStatus;
/**
* 需要处理的残疾状态 0:非残疾1:残疾
*/
private Integer disabilityStatus;
/**
* 处理结果
*/
private String dealRedult;
}

4
epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncConfigService.java

@ -6,7 +6,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.DataSyncConfigDTO;
import com.epmet.dto.form.ConfigSwitchFormDTO;
import com.epmet.dto.form.NatInfoScanTaskFormDTO;
import com.epmet.dto.form.DataSyncTaskParam;
import com.epmet.dto.form.ScopeSaveFormDTO;
import com.epmet.entity.DataSyncConfigEntity;
@ -82,5 +82,5 @@ public interface DataSyncConfigService extends BaseService<DataSyncConfigEntity>
*/
void scopeSave(ScopeSaveFormDTO formDTO);
void dataSyncForYanTaiTask(NatInfoScanTaskFormDTO formDTO);
void dataSyncForYanTaiTask(DataSyncTaskParam formDTO);
}

78
epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncRecordDeathService.java

@ -0,0 +1,78 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.DataSyncRecordDeathDTO;
import com.epmet.entity.DataSyncRecordDeathEntity;
import java.util.List;
import java.util.Map;
/**
* 数据同步记录-居民死亡信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-10-11
*/
public interface DataSyncRecordDeathService extends BaseService<DataSyncRecordDeathEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<DataSyncRecordDeathDTO>
* @author generator
* @date 2022-10-11
*/
PageData<DataSyncRecordDeathDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<DataSyncRecordDeathDTO>
* @author generator
* @date 2022-10-11
*/
List<DataSyncRecordDeathDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return DataSyncRecordDeathDTO
* @author generator
* @date 2022-10-11
*/
DataSyncRecordDeathDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2022-10-11
*/
void save(DataSyncRecordDeathDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2022-10-11
*/
void update(DataSyncRecordDeathDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2022-10-11
*/
void delete(String[] ids);
}

81
epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncRecordDisabilityService.java

@ -0,0 +1,81 @@
package com.epmet.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.DataSyncRecordDisabilityDTO;
import com.epmet.entity.DataSyncRecordDisabilityEntity;
import java.util.List;
import java.util.Map;
/**
* 数据同步记录-居民残疾信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-10-11
*/
public interface DataSyncRecordDisabilityService extends BaseService<DataSyncRecordDisabilityEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<DataSyncRecordDisabilityDTO>
* @author generator
* @date 2022-10-11
*/
PageData<DataSyncRecordDisabilityDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<DataSyncRecordDisabilityDTO>
* @author generator
* @date 2022-10-11
*/
List<DataSyncRecordDisabilityDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return DataSyncRecordDisabilityDTO
* @author generator
* @date 2022-10-11
*/
DataSyncRecordDisabilityDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2022-10-11
*/
void save(DataSyncRecordDisabilityDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2022-10-11
*/
void update(DataSyncRecordDisabilityDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2022-10-11
*/
void delete(String[] ids);
DataSyncRecordDisabilityDTO selectOne(LambdaQueryWrapper<DataSyncRecordDisabilityEntity> queryWrapper);
}

529
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncConfigServiceImpl.java

@ -1,11 +1,17 @@
package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import com.epmet.commons.tools.dto.result.YtDataSyncResDTO;
import com.epmet.commons.tools.dto.result.YtHsjcResDTO;
import com.epmet.commons.tools.enums.IcResiUserSubStatusEnum;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
@ -18,19 +24,14 @@ import com.epmet.commons.tools.utils.YtHsResUtils;
import com.epmet.dao.DataSyncConfigDao;
import com.epmet.dao.IcNatDao;
import com.epmet.dto.DataSyncConfigDTO;
import com.epmet.dto.DataSyncRecordDisabilityDTO;
import com.epmet.dto.form.ConfigSwitchFormDTO;
import com.epmet.dto.form.NatInfoScanTaskFormDTO;
import com.epmet.dto.form.DataSyncTaskParam;
import com.epmet.dto.form.ScopeSaveFormDTO;
import com.epmet.dto.result.NatUserInfoResultDTO;
import com.epmet.entity.DataSyncConfigEntity;
import com.epmet.entity.DataSyncScopeEntity;
import com.epmet.entity.IcNatEntity;
import com.epmet.entity.IcNatRelationEntity;
import com.epmet.entity.*;
import com.epmet.enums.DataSyncEnum;
import com.epmet.service.DataSyncConfigService;
import com.epmet.service.DataSyncScopeService;
import com.epmet.service.IcNatRelationService;
import com.epmet.service.IcNatService;
import com.epmet.service.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
@ -65,9 +66,13 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
private IcNatService icNatService;
@Autowired
private IcNatRelationService icNatRelationService;
@Autowired
private DataSyncRecordDeathService dataSyncRecordDeathService;
@Autowired
private DataSyncRecordDisabilityService dataSyncRecordDisabilityService;
private QueryWrapper<DataSyncConfigEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
private QueryWrapper<DataSyncConfigEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get(FieldConstant.ID_HUMP);
QueryWrapper<DataSyncConfigEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
@ -104,6 +109,7 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
/**
* Desc: 数据配置配置开关
*
* @param formDTO
* @author zxc
* @date 2022/9/26 14:36
@ -116,6 +122,7 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
/**
* Desc: 数据配置列表
*
* @param tokenDto
* @author zxc
* @date 2022/9/26 15:04
@ -125,7 +132,7 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
PageData<DataSyncConfigDTO> result = new PageData<>(new ArrayList<>(), NumConstant.ZERO_L);
PageInfo<DataSyncConfigDTO> pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize())
.doSelectPageInfo(() -> baseDao.list(tokenDto.getCustomerId(), null));
if (CollectionUtils.isNotEmpty(pageInfo.getList())){
if (CollectionUtils.isNotEmpty(pageInfo.getList())) {
result.setList(pageInfo.getList());
result.setTotal(Integer.parseInt(String.valueOf(pageInfo.getTotal())));
}
@ -134,6 +141,7 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
/**
* Desc: 数据配置范围保存
*
* @param formDTO
* @author zxc
* @date 2022/9/26 15:41
@ -142,21 +150,21 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
@Transactional(rollbackFor = Exception.class)
public void scopeSave(ScopeSaveFormDTO formDTO) {
baseDao.delScope(formDTO.getDataSyncConfigId());
if (CollectionUtils.isNotEmpty(formDTO.getScopeList())){
if (CollectionUtils.isNotEmpty(formDTO.getScopeList())) {
formDTO.getScopeList().forEach(o -> {
o.setCustomerId(formDTO.getCustomerId());
o.setDataSyncConfigId(formDTO.getDataSyncConfigId());
if (o.getOrgType().equals("grid")){
if (o.getOrgType().equals("grid")) {
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(o.getOrgId());
if (null == gridInfo){
throw new EpmetException("查询网格信息失败"+o.getOrgId());
if (null == gridInfo) {
throw new EpmetException("查询网格信息失败" + o.getOrgId());
}
o.setPid(gridInfo.getPid());
o.setOrgIdPath(gridInfo.getPids() + ":" + gridInfo.getId());
}else {
} else {
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(o.getOrgId());
if (null == agencyInfo){
throw new EpmetException("查询组织信息失败"+o.getOrgId());
if (null == agencyInfo) {
throw new EpmetException("查询组织信息失败" + o.getOrgId());
}
o.setPid(agencyInfo.getPid());
o.setOrgIdPath(agencyInfo.getPids().equals(NumConstant.EMPTY_STR) || agencyInfo.getPids().equals(NumConstant.ZERO_STR) ? agencyInfo.getId() : agencyInfo.getPids() + ":" + agencyInfo.getId());
@ -171,145 +179,432 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
* 大数据局部门配置on
* 根据范围搜索居民调接口查询最近一次核酸检测记录
* 检测时间 + 身份证 不存在就插入
*
* @param formDTO
* @author zxc
* @date 2022/9/26 17:16
*/
@Override
public void dataSyncForYanTaiTask(NatInfoScanTaskFormDTO formDTO) {
List<DataSyncConfigDTO> allConfigList = baseDao.list(formDTO.getCustomerId() ,"open");
if (CollectionUtils.isEmpty(allConfigList)){
public void dataSyncForYanTaiTask(DataSyncTaskParam formDTO) {
List<DataSyncConfigDTO> allConfigList = baseDao.list(formDTO.getCustomerId(), "open");
if (CollectionUtils.isEmpty(allConfigList)) {
return;
}
//TODO 根据dataCode 调用不同的方法 抽取数据
if (CollectionUtils.isNotEmpty(allConfigList)){
if (CollectionUtils.isNotEmpty(allConfigList)) {
log.warn("dataSyncForYanTaiTask don't have any resi data to pull data form YanTai interface");
return;
}
for (DataSyncConfigDTO config : allConfigList) {
//没有配置 数据拉取范围 继续下次循环
if (CollectionUtils.isEmpty(config.getScopeList())){
if (CollectionUtils.isEmpty(config.getScopeList())) {
continue;
}
//如果传了身份证号 则按照身份证号查询 并同步记录, userId如果为空则是 手动录入的 此人没有录入居民库 但是也可以同步
if (CollectionUtils.isNotEmpty(formDTO.getIdCards())){
List<NatUserInfoResultDTO> userIdByIdCard = baseDao.getIdCardsByScope(config.getScopeList(),formDTO.getIdCards());
List<NatUserInfoResultDTO> collect = formDTO.getIdCards().stream().map(id -> {
NatUserInfoResultDTO e = new NatUserInfoResultDTO();
e.setIdCard(id);
e.setUserId("");
return e;
}).collect(Collectors.toList());
collect.forEach(c -> userIdByIdCard.stream().filter(u -> u.getIdCard().equals(c.getIdCard())).forEach(u -> c.setUserId(u.getUserId())));
executeSyncData(config, collect);
return;
} else {
//没传具体参数 则 按照
int pageNo = NumConstant.ONE;
int pageSize = NumConstant.ONE_THOUSAND;
PageInfo<NatUserInfoResultDTO> pageInfo = null;
do {
//根据 组织 分页获取 居民数据
pageInfo = PageHelper.startPage(pageNo, pageSize, false)
.doSelectPageInfo(() -> baseDao.getIdCardsByScope(config.getScopeList(),formDTO.getIdCards()));
executeSyncData(config, pageInfo.getList());
pageNo++;
} while (pageInfo != null && pageInfo.getSize() == pageSize);
//没传具体参数 则 按照
int pageNo = NumConstant.ONE;
int pageSize = NumConstant.ONE_THOUSAND;
List<NatUserInfoResultDTO> dbResiList = null;
//设置查询数据范围
formDTO.setOrgList(config.getScopeList());
DataSyncEnum anEnum = DataSyncEnum.getEnum(config.getDataCode());
do {
switch (anEnum) {
case HE_SUAN:
dbResiList = getNatUserInfoFromDB(formDTO, anEnum, pageNo, pageSize);
if (CollectionUtils.isEmpty(dbResiList)) {
break;
}
hsjc(dbResiList, config.getCustomerId());
break;
case CAN_JI:
formDTO.setCategoryColumn("IS_CJ");
dbResiList = getNatUserInfoFromDB(formDTO, anEnum, pageNo, pageSize);
canJi(dbResiList);
break;
case SI_WANG:
formDTO.setResiSubStatus(IcResiUserSubStatusEnum.DIED.getSubStatus());
dbResiList = getNatUserInfoFromDB(formDTO, anEnum, pageNo, pageSize);
siWang(dbResiList);
break;
default:
log.warn("没有要处理的数据");
}
pageNo++;
} while (dbResiList != null && dbResiList.size() == pageSize);
}
}
@Transactional(rollbackFor = Exception.class)
public void siWang(List<NatUserInfoResultDTO> dbResiList) {
List<DataSyncRecordDisabilityEntity> list = new ArrayList<>();
for (NatUserInfoResultDTO dbResi : dbResiList) {
YtDataSyncResDTO thirdResult = YtHsResUtils.siWang(dbResi.getIdCard(), dbResi.getName());
if (200 != thirdResult.getCode()) {
log.warn("canJi 调用蓝图接口失败了 继续处理下一个人");
continue;
}
/*{
"AGE": "73",
"CARD_TYPE": "9",
"CREATE_ORGAN_NAME": "菏泽市巨野县殡仪馆",
"CREMATION_TIME": "2014-04-17 14:46",
"DEAD_ID": "SZ-371724-2012-1006560",
"DEATH_DATE": "2014-04-17",
"FAMILY_ADD": "菏泽市巨野县开发区马庄村",
"FOLK": "01",
"ID_CARD": "1",
"NAME": "郭**",
"NATION": "156",
"POPULACE": "3381C3014B60439FE05319003C0A0897",
"POPULACE_NAME": "菏泽市巨野县开发区马庄村",
"RECORD_ID": "E-371724-2012-100000000000407849",
"RN": "1",
"SEX": "1"
}*/
String thirdResultData = thirdResult.getData();
JSONObject thirdResultObject = JSON.parseObject(thirdResultData);
LambdaQueryWrapper<DataSyncRecordDisabilityEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(DataSyncRecordDisabilityEntity::getIdCard, dbResi.getIdCard());
//获取数据库里的记录
DataSyncRecordDisabilityDTO dbDisablityEntity = dataSyncRecordDisabilityService.selectOne(queryWrapper);
DataSyncRecordDisabilityEntity entity = new DataSyncRecordDisabilityEntity();
entity.setId(dbDisablityEntity.getId());
//居民库里 是否是残疾
String categoryColumn = dbResi.getCategoryColumn();
JudgeDealStatus judgeDealStatus = null;
//居民是残疾
if (NumConstant.ONE_STR.equals(categoryColumn)) {
// 第三方返回了该人的 残疾记录 说明和居民库的状态一致 只需要处理 同步记录中的数据即可
if (thirdResultObject != null) {
//todo 联调时看一下 为什么db == null 总是true
judgeDealStatus = new JudgeDealStatus(dbDisablityEntity).invoke();
if (judgeDealStatus.isStop()) {
continue;
}
} else {
//没有返回该人是残疾的数据 说明需要处理居民库的数据
judgeDealStatus = new JudgeDealStatus(dbDisablityEntity).notSame();
}
} else if (NumConstant.ZERO_STR.equals(categoryColumn)) {
//居民不是残疾
// 第三方没有返回了该人的 残疾记录 说明和居民库的状态一致 只需要处理 同步记录中的数据即可
if (thirdResultObject == null) {
//todo 联调时看一下 为什么db == null 总是true
judgeDealStatus = new JudgeDealStatus(dbDisablityEntity).invoke();
if (judgeDealStatus.isStop()) {
continue;
}
} else {
//蓝图返回该人是残疾的数据 说明需要处理居民库的数据
judgeDealStatus = new JudgeDealStatus(dbDisablityEntity).notSame();
}
}
entity.setCustomerId(dbResi.getCustomerId());
entity.setAgencyId(dbResi.getAgencyId());
entity.setPids(dbResi.getPids());
entity.setGridId(dbResi.getGridId());
entity.setName(dbResi.getName());
entity.setIdCard(thirdResultObject.getString("citizenId"));
entity.setMobile(thirdResultObject.getString("phoneNo"));
entity.setIcResiUserId(dbResi.getUserId());
entity.setCardNum(thirdResultObject.getString("cardNum"));
//todo 残疾等级 从字典获取
entity.setCjzk(thirdResultObject.getString("idtLevelName"));
entity.setCjlb(thirdResultObject.getString("idtKindName"));
entity.setEduLevel(thirdResultObject.getString("eduLevelName"));
entity.setMaritalStatus(thirdResultObject.getString("marriagerName"));
entity.setGuardian(thirdResultObject.getString("guardian"));
entity.setGuardianPhone(thirdResultObject.getString("guardianPhone"));
entity.setDealStatus(NumConstant.ZERO);
entity.setDealRedult(StrConstant.EPMETY_STR);
if (judgeDealStatus.isNeedSetStatus) {
entity.setDealRedult(judgeDealStatus.dealResult);
entity.setDealStatus(judgeDealStatus.dealStatus);
}
list.add(entity);
}
dataSyncRecordDisabilityService.saveOrUpdateBatch(list);
}
/**
* desc根据居民身份证号 从蓝图api接口 获取数据到本地
* @param config
* @param resiList
* desc从数据库获取居民信息
*
* @param formDTO
* @param anEnum
* @param pageNo
* @param pageSize
* @return
*/
private void executeSyncData(DataSyncConfigDTO config, List<NatUserInfoResultDTO> resiList) {
DataSyncEnum anEnum = DataSyncEnum.getEnum(config.getDataCode());
switch (anEnum) {
case HE_SUAN:
hsjc(resiList, config.getCustomerId());
break;
case CAN_JI:
//todo
break;
case SI_WANG:
//todo
break;
default:
log.warn("没有要处理的数据");
private List<NatUserInfoResultDTO> getNatUserInfoFromDB(DataSyncTaskParam formDTO, DataSyncEnum anEnum, int pageNo, int pageSize) {
//根据 组织 分页获取 居民数据
PageInfo<NatUserInfoResultDTO> pageInfo = PageHelper.startPage(pageNo, pageSize, false)
.doSelectPageInfo(() -> baseDao.getIdCardsByScope(formDTO));
List<NatUserInfoResultDTO> dbResiList;
dbResiList = pageInfo.getList();
//如果传了身份证号 则按照身份证号查询 并同步记录, userId如果为空则是 手动录入的 此人没有录入居民库 但是也可以同步
if (CollectionUtils.isNotEmpty(formDTO.getIdCards()) && DataSyncEnum.HE_SUAN.equals(anEnum.getCode())) {
List<NatUserInfoResultDTO> collect = formDTO.getIdCards().stream().map(id -> {
NatUserInfoResultDTO e = new NatUserInfoResultDTO();
e.setIdCard(id);
e.setUserId("");
return e;
}).collect(Collectors.toList());
for (NatUserInfoResultDTO c : collect) {
dbResiList.stream().filter(u -> u.getIdCard().equals(c.getIdCard())).forEach(u -> c.setUserId(u.getUserId()));
}
dbResiList = collect;
}
return dbResiList;
}
/*\"code\":300,
\"name\":\"姓名\",
\"genderName\":\"性别\",
\"citizenId\":\"身份证号\",
\"cardNum\":\"残疾证号\",
\"idtKindName\":\"残疾类别\",
\"idtLevelName\":\"残疾等级\",
\"eduLevelName\":\"教育程度\",
\"marriagerName\":\"婚姻状况\",
\"guardian\":\"监护人\",
\"guardianPhone\":\"监护人联系方式\",
\"residentAdd\":\"户籍地址\",
\"nowAdd\":'现居住地\",
\"phoneNo\":'联系电话\",*/
@Transactional(rollbackFor = Exception.class)
public void canJi(List<NatUserInfoResultDTO> resiList) {
List<DataSyncRecordDisabilityEntity> list = new ArrayList<>();
for (NatUserInfoResultDTO dbResi : resiList) {
YtDataSyncResDTO thirdResult = YtHsResUtils.canji(dbResi.getIdCard(), dbResi.getName());
if (200 != thirdResult.getCode()) {
log.warn("canJi 调用蓝图接口失败了 继续处理下一个人");
continue;
}
String thirdResultData = thirdResult.getData();
JSONObject thirdResultObject = JSON.parseObject(thirdResultData);
LambdaQueryWrapper<DataSyncRecordDisabilityEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(DataSyncRecordDisabilityEntity::getIdCard, dbResi.getIdCard());
//获取数据库里的记录
DataSyncRecordDisabilityDTO dbDisablityEntity = dataSyncRecordDisabilityService.selectOne(queryWrapper);
DataSyncRecordDisabilityEntity entity = new DataSyncRecordDisabilityEntity();
entity.setId(dbDisablityEntity.getId());
//居民库里 是否是残疾
String categoryColumn = dbResi.getCategoryColumn();
JudgeDealStatus judgeDealStatus = null;
Integer disabilityStatus = 0;
//居民是残疾
if (NumConstant.ONE_STR.equals(categoryColumn)) {
// 第三方返回了该人的 残疾记录 说明和居民库的状态一致 只需要处理 同步记录中的数据即可
if (thirdResultObject != null) {
//todo 联调时看一下 为什么db == null 总是true
judgeDealStatus = new JudgeDealStatus(dbDisablityEntity).invoke();
if (judgeDealStatus.isStop()) {
continue;
}
disabilityStatus = 1;
} else {
//没有返回该人是残疾的数据 说明需要处理居民库的数据
judgeDealStatus = new JudgeDealStatus(dbDisablityEntity).notSame();
disabilityStatus = 0;
}
} else if (NumConstant.ZERO_STR.equals(categoryColumn)) {
//居民不是残疾
// 第三方没有返回了该人的 残疾记录 说明和居民库的状态一致 只需要处理 同步记录中的数据即可
if (thirdResultObject == null) {
//todo 联调时看一下 为什么db == null 总是true
judgeDealStatus = new JudgeDealStatus(dbDisablityEntity).invoke();
if (judgeDealStatus.isStop()) {
continue;
}
disabilityStatus = 0;
} else {
//蓝图返回该人是残疾的数据 说明需要处理居民库的数据
judgeDealStatus = new JudgeDealStatus(dbDisablityEntity).notSame();
disabilityStatus = 1;
}
}
entity.setCustomerId(dbResi.getCustomerId());
entity.setAgencyId(dbResi.getAgencyId());
entity.setPids(dbResi.getPids());
entity.setGridId(dbResi.getGridId());
entity.setName(dbResi.getName());
entity.setIdCard(thirdResultObject.getString("citizenId"));
entity.setMobile(thirdResultObject.getString("phoneNo"));
entity.setIcResiUserId(dbResi.getUserId());
entity.setCardNum(thirdResultObject.getString("cardNum"));
entity.setCjzk(thirdResultObject.getString("idtLevelName"));
entity.setCjlb(thirdResultObject.getString("idtKindName"));
entity.setEduLevel(thirdResultObject.getString("eduLevelName"));
entity.setMaritalStatus(thirdResultObject.getString("marriagerName"));
entity.setGuardian(thirdResultObject.getString("guardian"));
entity.setGuardianPhone(thirdResultObject.getString("guardianPhone"));
entity.setDealStatus(NumConstant.ZERO);
entity.setDisabilityStatus(disabilityStatus);
entity.setDealRedult(StrConstant.EPMETY_STR);
if (judgeDealStatus.isNeedSetStatus) {
entity.setDealRedult(judgeDealStatus.getDealResult());
entity.setDealStatus(judgeDealStatus.getDealStatus());
}
list.add(entity);
}
dataSyncRecordDisabilityService.saveOrUpdateBatch(list);
}
/**
* Desc: 根据证件号 查询nat 存在 ? 不处理 : 新增
*
* @param idCards
* @param customerId
* @author zxc
* @date 2022/9/27 11:08
*/
private void hsjc(List<NatUserInfoResultDTO> idCards,String customerId){
if (CollectionUtils.isNotEmpty(idCards)){
List<IcNatEntity> entities = new ArrayList<>();
idCards.forEach(idCard -> {
YtHsjcResDTO natInfoResult = YtHsResUtils.hsjc(idCard.getIdCard(), NumConstant.ONE, NumConstant.ONE);
if (CollectionUtils.isNotEmpty(natInfoResult.getData())){
natInfoResult.getData().forEach(natInfo -> {
IcNatEntity e = new IcNatEntity();
e.setCustomerId(customerId);
e.setIsResiUser(StringUtils.isBlank(idCard.getUserId()) ? NumConstant.ZERO_STR : NumConstant.ONE_STR);
e.setUserId(idCard.getUserId());
e.setUserType("sync");
e.setName(StringUtils.isNotBlank(natInfo.getName()) ? natInfo.getName() : "");
e.setMobile(StringUtils.isNotBlank(natInfo.getTelephone()) ? natInfo.getTelephone() : "");
e.setIdCard(StringUtils.isNotBlank(natInfo.getCard_no()) ? natInfo.getCard_no() : "");
e.setNatTime(DateUtils.parseDate(natInfo.getTest_time(),DateUtils.DATE_TIME_PATTERN));
e.setNatResult(natInfo.getSample_result_pcr());
e.setNatAddress(natInfo.getSampling_org_pcr());
e.setAgencyId(idCard.getAgencyId());
e.setPids(idCard.getPids());
e.setAttachmentType("");
e.setAttachmentUrl("");
entities.add(e);
});
@Transactional(rollbackFor = Exception.class)
public void hsjc(List<NatUserInfoResultDTO> idCards, String customerId) {
List<IcNatEntity> entities = new ArrayList<>();
idCards.forEach(idCard -> {
YtHsjcResDTO natInfoResult = YtHsResUtils.hsjc(idCard.getIdCard(), NumConstant.ONE, NumConstant.ONE);
if (CollectionUtils.isNotEmpty(natInfoResult.getData())) {
natInfoResult.getData().forEach(natInfo -> {
IcNatEntity e = new IcNatEntity();
e.setCustomerId(customerId);
e.setIsResiUser(StringUtils.isBlank(idCard.getUserId()) ? NumConstant.ZERO_STR : NumConstant.ONE_STR);
e.setUserId(idCard.getUserId());
e.setUserType("sync");
e.setName(StringUtils.isNotBlank(natInfo.getName()) ? natInfo.getName() : "");
e.setMobile(StringUtils.isNotBlank(natInfo.getTelephone()) ? natInfo.getTelephone() : "");
e.setIdCard(StringUtils.isNotBlank(natInfo.getCard_no()) ? natInfo.getCard_no() : "");
e.setNatTime(DateUtils.parseDate(natInfo.getTest_time(), DateUtils.DATE_TIME_PATTERN));
e.setNatResult(natInfo.getSample_result_pcr());
e.setNatAddress(natInfo.getSampling_org_pcr());
e.setAgencyId(idCard.getAgencyId());
e.setPids(idCard.getPids());
e.setAttachmentType("");
e.setAttachmentUrl("");
entities.add(e);
});
}
});
if (CollectionUtils.isNotEmpty(entities)) {
List<NatUserInfoResultDTO> existNatInfos = icNatDao.getExistNatInfo(entities);
entities.forEach(e -> existNatInfos.stream().filter(i -> i.getUserId().equals(e.getUserId()) && i.getIdCard().equals(e.getIdCard())).forEach(i -> e.setExistStatus(true)));
Map<Boolean, List<IcNatEntity>> groupByStatus = entities.stream().collect(Collectors.groupingBy(IcNatEntity::getExistStatus));
if (CollectionUtils.isNotEmpty(groupByStatus.get(false))) {
for (List<IcNatEntity> icNatEntities : ListUtils.partition(groupByStatus.get(false), 500)) {
icNatService.insertBatch(icNatEntities);
}
}
//组织关系表
List<IcNatRelationEntity> relationEntities = new ArrayList<>();
entities.forEach(ne -> {
// 不是居民的先不加关系表吧
if (ne.getIsResiUser().equals(NumConstant.ONE_STR)) {
IcNatRelationEntity e = new IcNatRelationEntity();
e.setCustomerId(customerId);
e.setAgencyId(ne.getAgencyId());
e.setPids(ne.getPids());
e.setIcNatId(ne.getId());
e.setUserType("sync");
relationEntities.add(e);
}
});
if (CollectionUtils.isNotEmpty(entities)){
List<NatUserInfoResultDTO> existNatInfos = icNatDao.getExistNatInfo(entities);
entities.forEach(e -> existNatInfos.stream().filter(i -> i.getUserId().equals(e.getUserId()) && i.getIdCard().equals(e.getIdCard())).forEach(i -> e.setExistStatus(true)));
Map<Boolean, List<IcNatEntity>> groupByStatus = entities.stream().collect(Collectors.groupingBy(IcNatEntity::getExistStatus));
if (CollectionUtils.isNotEmpty(groupByStatus.get(false))){
for (List<IcNatEntity> icNatEntities : ListUtils.partition(groupByStatus.get(false), 500)) {
icNatService.insertBatch(icNatEntities);
}
if (CollectionUtils.isNotEmpty(relationEntities)) {
for (List<IcNatRelationEntity> icNatRelationEntities : ListUtils.partition(relationEntities, 500)) {
icNatRelationService.insertBatch(icNatRelationEntities);
}
//组织关系表
List<IcNatRelationEntity> relationEntities = new ArrayList<>();
entities.forEach(ne -> {
// 不是居民的先不加关系表吧
if (ne.getIsResiUser().equals(NumConstant.ONE_STR)){
IcNatRelationEntity e = new IcNatRelationEntity();
e.setCustomerId(customerId);
e.setAgencyId(ne.getAgencyId());
e.setPids(ne.getPids());
e.setIcNatId(ne.getId());
e.setUserType("sync");
relationEntities.add(e);
}
});
if (CollectionUtils.isNotEmpty(relationEntities)){
for (List<IcNatRelationEntity> icNatRelationEntities : ListUtils.partition(relationEntities, 500)) {
icNatRelationService.insertBatch(icNatRelationEntities);
}
}
}
}
private class JudgeDealStatus {
private boolean myResult;
private DataSyncRecordDisabilityDTO dbDisablityEntity;
private Integer dealStatus;
private String dealResult;
private boolean isNeedSetStatus;
public JudgeDealStatus(DataSyncRecordDisabilityDTO dbDisablityEntity) {
this.dbDisablityEntity = dbDisablityEntity;
}
boolean isStop() {
return myResult;
}
public Integer getDealStatus() {
return dealStatus;
}
public String getDealResult() {
return dealResult;
}
public boolean isNeedSetStatus() {
return isNeedSetStatus;
}
public JudgeDealStatus invoke() {
//对比记录里 也没有信息 则不用处理
if (dbDisablityEntity == null || StringUtils.isBlank(dbDisablityEntity.getId())) {
myResult = true;
return this;
} else {
//对比记录里 有数据 且是已处理状态 则继续下一个居民
if (dbDisablityEntity.getDealStatus().equals(NumConstant.ONE)) {
myResult = true;
return this;
} else {
//如果是其他处理状态 则改为已处理即可
dealStatus = 1;
dealResult = "系统比对数据一致,自动处理";
isNeedSetStatus = true;
}
}
myResult = false;
return this;
}
/**
* desc:蓝图返回该人是残疾的数据 说明需要处理居民库的数据
*
* @return
*/
public JudgeDealStatus notSame() {
if (dbDisablityEntity != null && StringUtils.isNotBlank(dbDisablityEntity.getId())
&& dbDisablityEntity.getDealStatus().equals(NumConstant.ONE)) {
dealStatus = 0;
dealResult = "";
isNeedSetStatus = true;
}
myResult = false;
return this;
}
}
}

87
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncRecordDeathServiceImpl.java

@ -0,0 +1,87 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.DataSyncRecordDeathDao;
import com.epmet.dto.DataSyncRecordDeathDTO;
import com.epmet.entity.DataSyncRecordDeathEntity;
import com.epmet.redis.DataSyncRecordDeathRedis;
import com.epmet.service.DataSyncRecordDeathService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 数据同步记录-居民死亡信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-10-11
*/
@Service
public class DataSyncRecordDeathServiceImpl extends BaseServiceImpl<DataSyncRecordDeathDao, DataSyncRecordDeathEntity> implements DataSyncRecordDeathService {
@Autowired
private DataSyncRecordDeathRedis dataSyncRecordDeathRedis;
@Override
public PageData<DataSyncRecordDeathDTO> page(Map<String, Object> params) {
IPage<DataSyncRecordDeathEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, DataSyncRecordDeathDTO.class);
}
@Override
public List<DataSyncRecordDeathDTO> list(Map<String, Object> params) {
List<DataSyncRecordDeathEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, DataSyncRecordDeathDTO.class);
}
private QueryWrapper<DataSyncRecordDeathEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<DataSyncRecordDeathEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public DataSyncRecordDeathDTO get(String id) {
DataSyncRecordDeathEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, DataSyncRecordDeathDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(DataSyncRecordDeathDTO dto) {
DataSyncRecordDeathEntity entity = ConvertUtils.sourceToTarget(dto, DataSyncRecordDeathEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(DataSyncRecordDeathDTO dto) {
DataSyncRecordDeathEntity entity = ConvertUtils.sourceToTarget(dto, DataSyncRecordDeathEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

94
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncRecordDisabilityServiceImpl.java

@ -0,0 +1,94 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.DataSyncRecordDisabilityDao;
import com.epmet.dto.DataSyncRecordDisabilityDTO;
import com.epmet.entity.DataSyncRecordDisabilityEntity;
import com.epmet.redis.DataSyncRecordDisabilityRedis;
import com.epmet.service.DataSyncRecordDisabilityService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 数据同步记录-居民残疾信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-10-11
*/
@Service
public class DataSyncRecordDisabilityServiceImpl extends BaseServiceImpl<DataSyncRecordDisabilityDao, DataSyncRecordDisabilityEntity> implements DataSyncRecordDisabilityService {
@Autowired
private DataSyncRecordDisabilityRedis dataSyncRecordDisabilityRedis;
@Override
public PageData<DataSyncRecordDisabilityDTO> page(Map<String, Object> params) {
IPage<DataSyncRecordDisabilityEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, DataSyncRecordDisabilityDTO.class);
}
@Override
public List<DataSyncRecordDisabilityDTO> list(Map<String, Object> params) {
List<DataSyncRecordDisabilityEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, DataSyncRecordDisabilityDTO.class);
}
private QueryWrapper<DataSyncRecordDisabilityEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<DataSyncRecordDisabilityEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public DataSyncRecordDisabilityDTO get(String id) {
DataSyncRecordDisabilityEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, DataSyncRecordDisabilityDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(DataSyncRecordDisabilityDTO dto) {
DataSyncRecordDisabilityEntity entity = ConvertUtils.sourceToTarget(dto, DataSyncRecordDisabilityEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(DataSyncRecordDisabilityDTO dto) {
DataSyncRecordDisabilityEntity entity = ConvertUtils.sourceToTarget(dto, DataSyncRecordDisabilityEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
public DataSyncRecordDisabilityDTO selectOne(LambdaQueryWrapper<DataSyncRecordDisabilityEntity> queryWrapper) {
DataSyncRecordDisabilityEntity entity = baseDao.selectOne(queryWrapper);
return ConvertUtils.sourceToTarget(entity, DataSyncRecordDisabilityDTO.class);
}
}

24
epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncConfigDao.xml

@ -52,22 +52,38 @@
<!-- 范围查询 -->
<select id="scopeList" resultType="com.epmet.dto.DataSyncScopeDTO">
SELECT * FROM data_sync_scope WHERE DEL_FLAG = '0' AND DATA_SYNC_CONFIG_ID = #{id};
SELECT id, customer_id, data_sync_config_id, org_type, org_id, pid, org_id_path, del_flag FROM data_sync_scope WHERE DEL_FLAG = '0' AND DATA_SYNC_CONFIG_ID = #{id};
</select>
<!-- 根据范围查询居民证件号 -->
<select id="getIdCardsByScope" resultType="com.epmet.dto.result.NatUserInfoResultDTO">
SELECT
DISTINCT ID_CARD AS idCard,
CUSTOMER_ID,
ID AS userId,
AGENCY_ID AS agencyId,
<if test="categoryColumn != null and categoryColumn != ''">
${categoryColumn} AS categoryColumn,
</if>
pids
FROM ic_resi_user
WHERE DEL_FLAG = '0'
AND `STATUS` = '0'
<if test="idCardList != null and idCardList.size() != 0">
AND `STATUS` =
<choose>
<when test="resiStatus != null and resiStatus != ''">
#{resiStatus}
</when>
<otherwise>
'0'
</otherwise>
</choose>
<if test="resiSubStatus != null and resiSubStatus != ''">
AND SUB_STATUS = #{resiSubStatus}
</if>
<if test="idCards != null and idCards.size() != 0">
AND id_card in
<foreach collection="idCardList" item="idCard" separator="," close=")" open="(" >
<foreach collection="idCards" item="idCard" separator="," close=")" open="(" >
#{idCard}
</foreach>
</if>

35
epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncRecordDeathDao.xml

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.DataSyncRecordDeathDao">
<resultMap type="com.epmet.entity.DataSyncRecordDeathEntity" id="dataSyncRecordDeathMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="pids" column="PIDS"/>
<result property="gridId" column="GRID_ID"/>
<result property="name" column="NAME"/>
<result property="idCard" column="ID_CARD"/>
<result property="mobile" column="MOBILE"/>
<result property="icResiUserId" column="IC_RESI_USER_ID"/>
<result property="age" column="AGE"/>
<result property="address" column="ADDRESS"/>
<result property="deathDate" column="DEATH_DATE"/>
<result property="cremationTime" column="CREMATION_TIME"/>
<result property="mz" column="MZ"/>
<result property="organName" column="ORGAN_NAME"/>
<result property="nation" column="NATION"/>
<result property="thirdRecordId" column="THIRD_RECORD_ID"/>
<result property="dealStatus" column="DEAL_STATUS"/>
<result property="dealRedult" column="DEAL_REDULT"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
</mapper>

95
epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncRecordDisabilityDao.xml

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.DataSyncRecordDisabilityDao">
<resultMap type="com.epmet.entity.DataSyncRecordDisabilityEntity" id="dataSyncRecordDisabilityMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="pids" column="PIDS"/>
<result property="gridId" column="GRID_ID"/>
<result property="name" column="NAME"/>
<result property="idCard" column="ID_CARD"/>
<result property="mobile" column="MOBILE"/>
<result property="icResiUserId" column="IC_RESI_USER_ID"/>
<result property="cardNum" column="CARD_NUM"/>
<result property="cjzk" column="CJZK"/>
<result property="cjlb" column="CJLB"/>
<result property="eduLevel" column="EDU_LEVEL"/>
<result property="maritalStatus" column="MARITAL_STATUS"/>
<result property="guardian" column="GUARDIAN"/>
<result property="guardianPhone" column="GUARDIAN_PHONE"/>
<result property="dealStatus" column="DEAL_STATUS"/>
<result property="disabilityStatus" column="DISABILITY_STATUS"/>
<result property="dealRedult" column="DEAL_REDULT"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<!-- <insert id="upsertBatch">-->
<!-- INSERT into data_sync_record_disability (-->
<!-- id,-->
<!-- customer_id,-->
<!-- agency_id,-->
<!-- pids,-->
<!-- grid_id,-->
<!-- NAME,-->
<!-- id_card,-->
<!-- mobile,-->
<!-- ic_resi_user_id,-->
<!-- card_num,-->
<!-- cjzk,-->
<!-- cjlb,-->
<!-- edu_level,-->
<!-- marital_status,-->
<!-- guardian,-->
<!-- guardian_phone,-->
<!-- deal_status,-->
<!-- deal_redult,-->
<!-- del_flag,-->
<!-- revision,-->
<!-- created_by,-->
<!-- created_time,-->
<!-- updated_by,-->
<!-- updated_time) VALUES (-->
<!-- <foreach collection="list" item="item" open="(" close=")" separator=",">-->
<!-- #{item.id},-->
<!-- #{item.customer_id},-->
<!-- #{item.agency_id},-->
<!-- #{item.pids},-->
<!-- #{item.grid_id},-->
<!-- #{item.NAME},-->
<!-- #{item.id_card},-->
<!-- #{item.mobile},-->
<!-- #{item.ic_resi_user_id},-->
<!-- #{item.card_num},-->
<!-- #{item.cjzk},-->
<!-- #{item.cjlb},-->
<!-- #{item.edu_level},-->
<!-- #{item.marital_status},-->
<!-- #{item.guardian},-->
<!-- #{item.guardian_phone},-->
<!-- #{item.deal_status},-->
<!-- #{item.deal_redult},-->
<!-- #{item.del_flag},-->
<!-- #{item.revision},-->
<!-- #{item.created_by},-->
<!-- now(),-->
<!-- #{item.updated_by},-->
<!-- now()-->
<!-- </foreach>-->
<!-- )-->
<!-- ON DUPLICATE KEY UPDATE-->
<!-- id_card = values(idCard),-->
<!-- name = values(name),-->
<!-- sex = values(sex),-->
<!-- class = values(class)-->
<!-- </insert>-->
</mapper>
Loading…
Cancel
Save