From 7e6c0c6bb96ac3bd343cb76b506763c43bace683 Mon Sep 17 00:00:00 2001 From: jianjun Date: Wed, 12 Oct 2022 18:14:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=20=E6=AD=BB=E4=BA=A1?= =?UTF-8?q?=E5=92=8C=E6=AE=8B=E7=96=BE=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/dto/result/YtDataSyncResDTO.java | 28 + .../commons/tools/utils/YtHsResUtils.java | 144 ++++- .../java/com/epmet/task/NatInfoScanTask.java | 6 +- .../com/epmet/dto/DataSyncRecordDeathDTO.java | 145 +++++ .../dto/DataSyncRecordDisabilityDTO.java | 145 +++++ .../com/epmet/dto/form/DataSyncTaskParam.java | 42 ++ .../dto/form/NatInfoScanTaskFormDTO.java | 21 - .../form/dataSync/QueryIcResiUserFormDTO.java | 40 ++ .../dto/result/NatUserInfoResultDTO.java | 11 + .../epmet/feign/EpmetUserOpenFeignClient.java | 2 +- .../EpmetUserOpenFeignClientFallback.java | 2 +- .../controller/DataSyncConfigController.java | 4 +- .../java/com/epmet/dao/DataSyncConfigDao.java | 5 +- .../com/epmet/dao/DataSyncRecordDeathDao.java | 16 + .../dao/DataSyncRecordDisabilityDao.java | 17 + .../entity/DataSyncRecordDeathEntity.java | 111 ++++ .../DataSyncRecordDisabilityEntity.java | 111 ++++ .../epmet/service/DataSyncConfigService.java | 4 +- .../service/DataSyncRecordDeathService.java | 78 +++ .../DataSyncRecordDisabilityService.java | 81 +++ .../impl/DataSyncConfigServiceImpl.java | 529 ++++++++++++++---- .../impl/DataSyncRecordDeathServiceImpl.java | 87 +++ .../DataSyncRecordDisabilityServiceImpl.java | 94 ++++ .../resources/mapper/DataSyncConfigDao.xml | 24 +- .../mapper/DataSyncRecordDeathDao.xml | 35 ++ .../mapper/DataSyncRecordDisabilityDao.xml | 95 ++++ 26 files changed, 1721 insertions(+), 156 deletions(-) create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtDataSyncResDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncRecordDeathDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncRecordDisabilityDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DataSyncTaskParam.java delete mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/NatInfoScanTaskFormDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/dataSync/QueryIcResiUserFormDTO.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncRecordDeathDao.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncRecordDisabilityDao.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncRecordDeathEntity.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncRecordDisabilityEntity.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncRecordDeathService.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncRecordDisabilityService.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncRecordDeathServiceImpl.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncRecordDisabilityServiceImpl.java create mode 100644 epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncRecordDeathDao.xml create mode 100644 epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncRecordDisabilityDao.xml diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtDataSyncResDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtDataSyncResDTO.java new file mode 100644 index 0000000000..aff500e51e --- /dev/null +++ b/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; + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/YtHsResUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/YtHsResUtils.java index 0ea496de19..b41afbd23b 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/YtHsResUtils.java +++ b/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 result = HttpClientManager.getInstance().sendGet(URL, param); + Result 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 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 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 result = new Result().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 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 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 result = new Result().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)); + } + + } diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/NatInfoScanTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/NatInfoScanTask.java index d7334fabd6..f141cc818a 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/NatInfoScanTask.java +++ b/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()) { diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncRecordDeathDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncRecordDeathDTO.java new file mode 100644 index 0000000000..33ad3a8c5f --- /dev/null +++ b/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; + + /** + * 居民Id,ic_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; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncRecordDisabilityDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncRecordDisabilityDTO.java new file mode 100644 index 0000000000..678a770c1a --- /dev/null +++ b/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; + + /** + * 居民Id,ic_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; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DataSyncTaskParam.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DataSyncTaskParam.java new file mode 100644 index 0000000000..163158f47e --- /dev/null +++ b/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 idCards; + + // ========================后台设置===== + /** + * 根据配置 设置次参数;数据查询范围 必填 + */ + private List orgList; + + /** + * 居民状态【0:正常;1:迁出;2:注销】 + */ + private String resiStatus; + /** + * 居民子状态 01:新增、02:导入、03:迁入、04:新生、11:迁出、21死亡 + */ + private String resiSubStatus; + + /** + * 类别字段 + */ + public String categoryColumn; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/NatInfoScanTaskFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/NatInfoScanTaskFormDTO.java deleted file mode 100644 index 6d642b2e90..0000000000 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/NatInfoScanTaskFormDTO.java +++ /dev/null @@ -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 idCards; -} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/dataSync/QueryIcResiUserFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/dataSync/QueryIcResiUserFormDTO.java new file mode 100644 index 0000000000..99a2d856d7 --- /dev/null +++ b/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 scopeList; + /** + * 必填 + */ + private String customerId; + + /** + * 身份证号集合 非必填 + */ + private List idCards; + + /** + * 居民状态【0:正常;1:迁出;2:注销】 + */ + private String resiStatus; + /** + * 居民子状态 01:新增、02:导入、03:迁入、04:新生、11:迁出、21死亡 + */ + private String resiSubStatus; + +} + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatUserInfoResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatUserInfoResultDTO.java index 10e611aa46..278f3ca537 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatUserInfoResultDTO.java +++ b/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; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index a2398b2d92..1a61d61a3c 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -923,5 +923,5 @@ public interface EpmetUserOpenFeignClient { Result dingResiLogin(@RequestBody DingLoginResiFormDTO formDTO); @PostMapping("/epmetuser/dataSyncConfig/natInfoScanTask") - Result natInfoScanTask(@RequestBody NatInfoScanTaskFormDTO formDTO); + Result natInfoScanTask(@RequestBody DataSyncTaskParam formDTO); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 4601ca1ef3..630e838db7 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/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); } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncConfigController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncConfigController.java index 2963823ce2..2ea0a33db9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncConfigController.java +++ b/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(); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncConfigDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncConfigDao.java index 6df7281e5b..2963617263 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncConfigDao.java +++ b/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 { /** * Desc: 根据范围查询居民证件号 * - * @param orgList + * @param formDTO * @author zxc * @date 2022/9/27 09:23 */ - List getIdCardsByScope(@Param("orgList") List orgList, @Param("idCardList") List idCardList); + List getIdCardsByScope(DataSyncTaskParam formDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncRecordDeathDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncRecordDeathDao.java new file mode 100644 index 0000000000..6456d58053 --- /dev/null +++ b/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 { + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncRecordDisabilityDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncRecordDisabilityDao.java new file mode 100644 index 0000000000..caad1854be --- /dev/null +++ b/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 { + + //int upsertBatch(List list); +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncRecordDeathEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncRecordDeathEntity.java new file mode 100644 index 0000000000..49d8749e9a --- /dev/null +++ b/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; + + /** + * 居民Id,ic_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; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncRecordDisabilityEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncRecordDisabilityEntity.java new file mode 100644 index 0000000000..4307bd8e25 --- /dev/null +++ b/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; + + /** + * 居民Id,ic_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; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncConfigService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncConfigService.java index 049fc774a0..fe51881c46 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncConfigService.java +++ b/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 */ void scopeSave(ScopeSaveFormDTO formDTO); - void dataSyncForYanTaiTask(NatInfoScanTaskFormDTO formDTO); + void dataSyncForYanTaiTask(DataSyncTaskParam formDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncRecordDeathService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncRecordDeathService.java new file mode 100644 index 0000000000..17a4efb3e0 --- /dev/null +++ b/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 { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-10-11 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-10-11 + */ + List list(Map 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); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncRecordDisabilityService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncRecordDisabilityService.java new file mode 100644 index 0000000000..73408be3f2 --- /dev/null +++ b/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 { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-10-11 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-10-11 + */ + List list(Map 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 queryWrapper); +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncConfigServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncConfigServiceImpl.java index ed2490feed..26fe7c97c3 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncConfigServiceImpl.java +++ b/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 getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); + private QueryWrapper getWrapper(Map params) { + String id = (String) params.get(FieldConstant.ID_HUMP); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); @@ -104,6 +109,7 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl result = new PageData<>(new ArrayList<>(), NumConstant.ZERO_L); PageInfo 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 { 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 allConfigList = baseDao.list(formDTO.getCustomerId() ,"open"); - if (CollectionUtils.isEmpty(allConfigList)){ + public void dataSyncForYanTaiTask(DataSyncTaskParam formDTO) { + List 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 userIdByIdCard = baseDao.getIdCardsByScope(config.getScopeList(),formDTO.getIdCards()); - List 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 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 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 dbResiList) { + List 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 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 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 getNatUserInfoFromDB(DataSyncTaskParam formDTO, DataSyncEnum anEnum, int pageNo, int pageSize) { + //根据 组织 分页获取 居民数据 + PageInfo pageInfo = PageHelper.startPage(pageNo, pageSize, false) + .doSelectPageInfo(() -> baseDao.getIdCardsByScope(formDTO)); + List dbResiList; + dbResiList = pageInfo.getList(); + //如果传了身份证号 则按照身份证号查询 并同步记录, userId如果为空则是 手动录入的 此人没有录入居民库 但是也可以同步 + if (CollectionUtils.isNotEmpty(formDTO.getIdCards()) && DataSyncEnum.HE_SUAN.equals(anEnum.getCode())) { + List 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 resiList) { + List 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 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 idCards,String customerId){ - if (CollectionUtils.isNotEmpty(idCards)){ - List 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 idCards, String customerId) { + List 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 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> groupByStatus = entities.stream().collect(Collectors.groupingBy(IcNatEntity::getExistStatus)); + if (CollectionUtils.isNotEmpty(groupByStatus.get(false))) { + for (List icNatEntities : ListUtils.partition(groupByStatus.get(false), 500)) { + icNatService.insertBatch(icNatEntities); + } + } + //组织关系表 + List 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 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> groupByStatus = entities.stream().collect(Collectors.groupingBy(IcNatEntity::getExistStatus)); - if (CollectionUtils.isNotEmpty(groupByStatus.get(false))){ - for (List icNatEntities : ListUtils.partition(groupByStatus.get(false), 500)) { - icNatService.insertBatch(icNatEntities); - } + if (CollectionUtils.isNotEmpty(relationEntities)) { + for (List icNatRelationEntities : ListUtils.partition(relationEntities, 500)) { + icNatRelationService.insertBatch(icNatRelationEntities); } - //组织关系表 - List 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 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; } } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncRecordDeathServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncRecordDeathServiceImpl.java new file mode 100644 index 0000000000..81a8c39961 --- /dev/null +++ b/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 implements DataSyncRecordDeathService { + + @Autowired + private DataSyncRecordDeathRedis dataSyncRecordDeathRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, DataSyncRecordDeathDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, DataSyncRecordDeathDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper 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)); + } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncRecordDisabilityServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncRecordDisabilityServiceImpl.java new file mode 100644 index 0000000000..8556999dc2 --- /dev/null +++ b/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 implements DataSyncRecordDisabilityService { + + @Autowired + private DataSyncRecordDisabilityRedis dataSyncRecordDisabilityRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, DataSyncRecordDisabilityDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, DataSyncRecordDisabilityDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper 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 queryWrapper) { + DataSyncRecordDisabilityEntity entity = baseDao.selectOne(queryWrapper); + return ConvertUtils.sourceToTarget(entity, DataSyncRecordDisabilityDTO.class); + } + +} diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncConfigDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncConfigDao.xml index 4f61e271d3..bae3918241 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncConfigDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncConfigDao.xml @@ -52,22 +52,38 @@