From 23f663498d94ad944111b9792574fee5abe0e1fc Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Sat, 5 Nov 2022 23:03:30 +0800 Subject: [PATCH 01/32] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E6=A0=B8?= =?UTF-8?q?=E9=85=B8=E6=A3=80=E6=B5=8B=E5=90=8C=E6=AD=A5=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E5=A2=9E=E5=8A=A0=E8=B0=83=E7=94=A8=E5=85=B0?= =?UTF-8?q?=E5=9B=BE=E8=A7=86=E5=9B=BE=E8=8E=B7=E5=8F=96=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=9A=84=E9=80=BB=E8=BE=91=EF=BC=8C=E4=BD=86=E6=98=AF=E8=BF=98?= =?UTF-8?q?=E6=B2=A1=E5=90=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/jdbc/config/JdbcTemplateConfig.java | 6 ++ .../impl/DataSyncConfigServiceImpl.java | 92 +++++++++++++++---- .../src/main/resources/bootstrap.yml | 6 +- 3 files changed, 85 insertions(+), 19 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/jdbc/config/JdbcTemplateConfig.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/jdbc/config/JdbcTemplateConfig.java index 4f8be141f3..1c26f1d808 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/jdbc/config/JdbcTemplateConfig.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/jdbc/config/JdbcTemplateConfig.java @@ -6,6 +6,7 @@ import org.springframework.boot.autoconfigure.AutoConfigurationPackage; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; import javax.sql.DataSource; @@ -27,4 +28,9 @@ public class JdbcTemplateConfig { DataSource yantaiLantuDataSource = jdbcDataSourceConfig.createYantaiLantuDataSource(); return new JdbcTemplate(yantaiLantuDataSource); } + + @Bean + NamedParameterJdbcTemplate yantaiNamedParamLantuJdbcTemplate() { + return new NamedParameterJdbcTemplate(yantaiLantuJdbcTemplate()); + } } \ No newline at end of file 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 6d4c42690d..e771aa4968 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 @@ -41,6 +41,7 @@ import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -76,6 +77,9 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl resiInfos, String customerId, String isSync) { List> resiInfobatchs = ListUtils.partition(resiInfos, 50); for (List resibatch : resiInfobatchs) { - // 50个一批,来处理他们的核酸信息,太多怕给数据库查崩了。 - yantaiHsjcByDbViewBatch(resibatch, customerId, isSync); + // n个一批,来处理他们的核酸信息,太多怕给数据库查崩了。 + try { + yantaiHsjcByDbViewPartition(resibatch, customerId, isSync); + } catch (Exception e) { + String errorMsg = ExceptionUtils.getErrorStackTrace(e); + log.error("【更新核酸检测信息(from 兰图)】失败,信息:{}", errorMsg); + } } } /** - * 50个一批,来处理他们的核酸信息,太多怕给数据库查崩了。 + * n个一批,来处理他们的核酸信息,太多怕给数据库查崩了。 * @param resiInfos * @param customerId * @param isSync */ - public void yantaiHsjcByDbViewBatch(List resiInfos, String customerId, String isSync) { + public void yantaiHsjcByDbViewPartition(List resiInfos, String customerId, String isSync) { // 将居民信息转化为的map Map idCardAndResiInfo = resiInfos.stream().collect(Collectors.toMap(resi -> resi.getIdCard(), Function.identity())); - Set idCards = idCardAndResiInfo.keySet();//resiInfos.stream().map(resi -> resi.getIdCard()).collect(Collectors.toList()); - // String idCardsStr = "''" + String.join("','", idCards) + "''"; + List idCards = new ArrayList<>(idCardAndResiInfo.keySet()); // 1.获取核酸采样信息 - String sql = "select id, name,card_no, create_time, realname from hscyxxb where card_no in (:idCards) order by create_time desc"; - HashMap args = new HashMap<>(); - args.put("idCards", idCards); + Map args = new HashMap<>(); + args.put("idcards", idCards); + + log.info("【更新核酸检测信息(from 兰图)】本批次身份证号为:{}", String.join(",", idCards)); + + // 2.=====================核酸采样========================= // 这一批居民的核酸采样列表 - List> hscyList = yantaiJdbcTemplate.queryForList(sql, args); + List> hscyList = yantaiNamedParamLantuJdbcTemplate.queryForList( + "select id, name,card_no, create_time, realname from hscyxxb where card_no in (:idcards) order by create_time desc", args); if (CollectionUtils.isNotEmpty(hscyList)) { List entities = new ArrayList<>(); - hscyList.forEach(sampleInfo -> { + hscyList.forEach(resiHscyInfo -> { // 从视图中获取到的核酸采样相关信息 - String name = (String) sampleInfo.get("name"); - String cardNo = (String) sampleInfo.get("card_no"); - Date createTime = (Date) sampleInfo.get("create_time"); + String name = (String) resiHscyInfo.get("name"); + String cardNo = (String) resiHscyInfo.get("card_no"); + String createTime = (String) resiHscyInfo.get("create_time"); // 本地数据库中,居民信息 NatUserInfoResultDTO currentResiInfo = idCardAndResiInfo.get(cardNo); @@ -827,8 +839,7 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl> hsjcResultList = yantaiNamedParamLantuJdbcTemplate.queryForList( + "select name, telephone, card_no, test_time, SAMPLE_TIME, SAMPLE_RESULT_PCR, SAMPLING_ORG_PCR from hsjcxxb where card_no in (:idcards)", args); + if (CollectionUtils.isNotEmpty(hsjcResultList)) { + List entities = new ArrayList<>(); + hsjcResultList.forEach(natResult -> { + // 从视图中获取到的核酸采样相关信息 + String name = (String) natResult.get("name"); + String cardNo = (String) natResult.get("card_no"); + String testTime = (String) natResult.get("test_time"); + String telephone = (String) natResult.get("telephone"); + String sampleTime = (String) natResult.get("SAMPLE_TIME"); + String sampleResultPcr = (String) natResult.get("SAMPLE_RESULT_PCR"); + String samplingOrgPcr = (String) natResult.get("SAMPLING_ORG_PCR"); + + // 本地数据库中,居民信息 + NatUserInfoResultDTO currentResiInfo = idCardAndResiInfo.get(cardNo); + + IcNatEntity e = new IcNatEntity(); + e.setCustomerId(customerId); + e.setIsResiUser(StringUtils.isBlank(currentResiInfo.getUserId()) ? NumConstant.ZERO_STR : NumConstant.ONE_STR); + e.setUserId(currentResiInfo.getUserId()); + e.setUserType(isSync.equals(NumConstant.ONE_STR) ? "manualSync" : "sync"); + e.setName(StringUtils.isNotBlank(name) ? name : ""); + e.setMobile(StringUtils.isNotBlank(telephone) ? telephone : ""); + e.setIdCard(StringUtils.isNotBlank(cardNo) ? cardNo : ""); + e.setNatTime(DateUtils.parseDate(testTime, DateUtils.DATE_TIME_PATTERN)); + e.setSampleTime(DateUtils.parseDate(sampleTime, DateUtils.DATE_TIME_PATTERN)); + String resultPcr = sampleResultPcr; + //检测结果 转换 我们 0:阴性 1:阳性, 他们 :1:阳性,2:阴性 + e.setNatResult(NumConstant.ZERO_STR); + if (NumConstant.ONE_STR.equals(resultPcr)) { + e.setNatResult(NumConstant.ONE_STR); + } + e.setNatAddress(samplingOrgPcr); + e.setAgencyId(currentResiInfo.getAgencyId()); + e.setPids(currentResiInfo.getPids()); + e.setAttachmentType(""); + e.setAttachmentUrl(""); + entities.add(e); + }); + if (CollectionUtils.isNotEmpty(entities)) { + List existNatInfos = icNatDao.getExistNatInfo(entities); + sampleAndNat(existNatInfos,entities,NumConstant.TWO_STR,customerId,isSync); + } + } } } diff --git a/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml b/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml index 184c73ee7b..0f824c7155 100644 --- a/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml +++ b/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml @@ -56,9 +56,9 @@ spring: yantai: lantu: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://localhost:3306/epmet_gov_voice?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai - username: root - password: root + url: jdbc:mysql://10.2.2.61:3367/epmet_gov_voice?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai + username: yilian + password: 1qaz2wsx initial-size: 10 max-active: 100 min-idle: 10 From 5939b0054b6c9ab846c9ab1bc37729e8bc694d18 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Sat, 5 Nov 2022 23:06:51 +0800 Subject: [PATCH 02/32] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-user/epmet-user-server/src/main/resources/bootstrap.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml b/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml index 0f824c7155..a9ff79fb01 100644 --- a/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml +++ b/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml @@ -56,7 +56,7 @@ spring: yantai: lantu: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://10.2.2.61:3367/epmet_gov_voice?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai + url: jdbc:mysql://10.2.2.61:3367/sjzt?allowPublicKeyRetrieval=true&allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai username: yilian password: 1qaz2wsx initial-size: 10 From 2153e719bef86d08c6068c4daa27bdea04299433 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Mon, 7 Nov 2022 14:15:58 +0800 Subject: [PATCH 03/32] - --- .../java/com/epmet/service/impl/DataSyncConfigServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e771aa4968..56ef6451eb 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 @@ -819,7 +819,7 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl> hscyList = yantaiNamedParamLantuJdbcTemplate.queryForList( - "select id, name,card_no, create_time, realname from hscyxxb where card_no in (:idcards) order by create_time desc", args); + "select id, name,card_no, create_time, realname from hscyxxb where card_no in (:idcards)", args); if (CollectionUtils.isNotEmpty(hscyList)) { List entities = new ArrayList<>(); hscyList.forEach(resiHscyInfo -> { From 51abd4bd06775dfa27eba3c1b830af17884592e3 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Mon, 7 Nov 2022 17:12:21 +0800 Subject: [PATCH 04/32] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E8=93=9D=E5=9B=BE?= =?UTF-8?q?=E8=A7=86=E5=9B=BE=E6=9F=A5=E8=AF=A2=E6=A0=B8=E9=85=B8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/service/impl/DataSyncConfigServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 56ef6451eb..815c36d9cf 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 @@ -259,7 +259,8 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl { try { //查询正常状态的居民 - hsjc(finalDbResiList, config.getCustomerId(), formDTO.getIsSync()); + //hsjc(finalDbResiList, config.getCustomerId(), formDTO.getIsSync()); + yantaiHsjcByDbView(finalDbResiList, config.getCustomerId(), formDTO.getIsSync()); log.info("======核酸检测信息拉取结束======"); } catch (Exception e) { log.error("hsjc thread execute exception", e); From 88cb21b2de3c5347eab3dde60051104a4be221c3 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 8 Nov 2022 09:27:18 +0800 Subject: [PATCH 05/32] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/dto/IcSyncJobDTO.java | 89 +++++++++++++++++++ .../controller/DataSyncConfigController.java | 12 +++ .../main/java/com/epmet/dao/IcSyncJobDao.java | 16 ++++ .../com/epmet/entity/IcSyncJobEntity.java | 59 ++++++++++++ .../epmet/service/DataSyncConfigService.java | 5 ++ .../com/epmet/service/IcSyncJobService.java | 78 ++++++++++++++++ .../impl/DataSyncConfigServiceImpl.java | 22 +++++ .../service/impl/IcSyncJobServiceImpl.java | 83 +++++++++++++++++ .../main/resources/mapper/IcSyncJobDao.xml | 6 ++ 9 files changed, 370 insertions(+) create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcSyncJobDTO.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcSyncJobDao.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcSyncJobEntity.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcSyncJobService.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcSyncJobServiceImpl.java create mode 100644 epmet-user/epmet-user-server/src/main/resources/mapper/IcSyncJobDao.xml diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcSyncJobDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcSyncJobDTO.java new file mode 100644 index 0000000000..320acd13b9 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcSyncJobDTO.java @@ -0,0 +1,89 @@ +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 同步任务表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-11-08 + */ +@Data +public class IcSyncJobDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String orgId; + + /** + * 组织ID的上级 + */ + private String pid; + + /** + * 组织ID的所有上级,包括org_id + */ + private String orgIdPath; + + /** + * 任务类型,残疾:disability;死亡:death;核酸:nat; + */ + private String jobType; + + /** + * 操作员ID【staffId】 + */ + private String operatorId; + + /** + * 操作状态,等待中:waiting;进行中:processing;结束:finish + */ + private String operationStatus; + + /** + * + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file 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 2ea0a33db9..56ec47f551 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 @@ -112,4 +112,16 @@ public class DataSyncConfigController { return new Result(); } + @PostMapping("deathInfoScanTask") + public Result deathInfoScanTask(@RequestBody DataSyncTaskParam formDTO){ + dataSyncConfigService.deathInfoScanTask(formDTO); + return new Result(); + } + + @PostMapping("disabilityInfoScanTask") + public Result disabilityInfoScanTask(@RequestBody DataSyncTaskParam formDTO){ + dataSyncConfigService.disabilityInfoScanTask(formDTO); + return new Result(); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcSyncJobDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcSyncJobDao.java new file mode 100644 index 0000000000..5b4ad6684e --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcSyncJobDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.IcSyncJobEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 同步任务表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-11-08 + */ +@Mapper +public interface IcSyncJobDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcSyncJobEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcSyncJobEntity.java new file mode 100644 index 0000000000..0a83b7aa56 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcSyncJobEntity.java @@ -0,0 +1,59 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 同步任务表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-11-08 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_sync_job") +public class IcSyncJobEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String orgId; + + /** + * 组织ID的上级 + */ + private String pid; + + /** + * 组织ID的所有上级,包括org_id + */ + private String orgIdPath; + + /** + * 任务类型,残疾:disability;死亡:death;核酸:nat; + */ + private String jobType; + + /** + * 操作员ID【staffId】 + */ + private String operatorId; + + /** + * 操作状态,等待中:waiting;进行中:processing;结束:finish + */ + private String operationStatus; + +} 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 fe51881c46..50e65d3b23 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 @@ -83,4 +83,9 @@ public interface DataSyncConfigService extends BaseService void scopeSave(ScopeSaveFormDTO formDTO); void dataSyncForYanTaiTask(DataSyncTaskParam formDTO); + + void deathInfoScanTask(DataSyncTaskParam formDTO); + + void disabilityInfoScanTask(DataSyncTaskParam formDTO); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcSyncJobService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcSyncJobService.java new file mode 100644 index 0000000000..fab06ea871 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcSyncJobService.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.IcSyncJobDTO; +import com.epmet.entity.IcSyncJobEntity; + +import java.util.List; +import java.util.Map; + +/** + * 同步任务表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-11-08 + */ +public interface IcSyncJobService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-11-08 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-11-08 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return IcSyncJobDTO + * @author generator + * @date 2022-11-08 + */ + IcSyncJobDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-11-08 + */ + void save(IcSyncJobDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-11-08 + */ + void update(IcSyncJobDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-11-08 + */ + void delete(String[] ids); +} \ No newline at end of file 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 815c36d9cf..cd544907bb 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 @@ -225,6 +225,28 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl configList, DataSyncTaskParam formDTO) { if (CollectionUtils.isEmpty(configList)) { log.warn("dataSyncYanTaiParallel configList is null"); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcSyncJobServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcSyncJobServiceImpl.java new file mode 100644 index 0000000000..c9e415eead --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcSyncJobServiceImpl.java @@ -0,0 +1,83 @@ +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.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.IcSyncJobDao; +import com.epmet.dto.IcSyncJobDTO; +import com.epmet.entity.IcSyncJobEntity; +import com.epmet.service.IcSyncJobService; +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-11-08 + */ +@Service +public class IcSyncJobServiceImpl extends BaseServiceImpl implements IcSyncJobService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, IcSyncJobDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, IcSyncJobDTO.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 IcSyncJobDTO get(String id) { + IcSyncJobEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, IcSyncJobDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IcSyncJobDTO dto) { + IcSyncJobEntity entity = ConvertUtils.sourceToTarget(dto, IcSyncJobEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(IcSyncJobDTO dto) { + IcSyncJobEntity entity = ConvertUtils.sourceToTarget(dto, IcSyncJobEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcSyncJobDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcSyncJobDao.xml new file mode 100644 index 0000000000..0b7ecc334d --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcSyncJobDao.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From 5c3aad5f2cfa0442322a0a3c3c4587f7cf7757cc Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 8 Nov 2022 11:17:45 +0800 Subject: [PATCH 06/32] =?UTF-8?q?=E6=9A=82=E6=8F=90=E4=B8=80=E6=B3=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/feign/EpmetUserOpenFeignClient.java | 11 +- .../EpmetUserOpenFeignClientFallback.java | 15 ++ .../com/epmet/constant/EpidemicConstant.java | 15 ++ .../controller/DataSyncConfigController.java | 26 ++- .../java/com/epmet/dao/DataSyncConfigDao.java | 4 +- .../epmet/service/DataSyncConfigService.java | 20 +++ .../impl/DataSyncConfigServiceImpl.java | 152 +++++++++++++++++- .../resources/mapper/DataSyncConfigDao.xml | 11 ++ 8 files changed, 248 insertions(+), 6 deletions(-) create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/constant/EpidemicConstant.java 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 9abd3a1073..24ca6b3873 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 @@ -922,7 +922,7 @@ public interface EpmetUserOpenFeignClient { @PostMapping("/epmetuser/userbaseinfo/dingResiLogin") Result dingResiLogin(@RequestBody DingLoginResiFormDTO formDTO); - @PostMapping("/epmetuser/dataSyncConfig/natInfoScanTask") + @PostMapping("/epmetuser/dataSyncConfig/dataSyncForYanTaiTask") Result natInfoScanTask(@RequestBody DataSyncTaskParam formDTO); /** @@ -943,4 +943,13 @@ public interface EpmetUserOpenFeignClient { */ @PostMapping("/epmetuser/registerrelation/getAllResiByGrid") Result getAllResiByGrid(@RequestBody AllResiByGridFormDTO formDTO); + + @PostMapping("/epmetuser/dataSyncConfig/natInfoScanTask") + Result natInfoScanTaskV2(@RequestBody DataSyncTaskParam formDTO); + + @PostMapping("/epmetuser/dataSyncConfig/deathInfoScanTask") + Result deathInfoScanTask(@RequestBody DataSyncTaskParam formDTO); + + @PostMapping("/epmetuser/dataSyncConfig/disabilityInfoScanTask") + Result disabilityInfoScanTask(@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 2e198c04d9..d13aab8c15 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 @@ -726,4 +726,19 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result getAllResiByGrid(AllResiByGridFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getAllResiByGrid", formDTO); } + + @Override + public Result natInfoScanTaskV2(DataSyncTaskParam formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "natInfoScanTaskV2", formDTO); + } + + @Override + public Result deathInfoScanTask(DataSyncTaskParam formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "deathInfoScanTask", formDTO); + } + + @Override + public Result disabilityInfoScanTask(DataSyncTaskParam formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "disabilityInfoScanTask", formDTO); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/EpidemicConstant.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/EpidemicConstant.java new file mode 100644 index 0000000000..41bdd00158 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/EpidemicConstant.java @@ -0,0 +1,15 @@ +package com.epmet.constant; + +public interface EpidemicConstant { + + /** + * 数据配置的dataCode + * 核酸检测 + * 残疾人 + * 死亡 + */ + String DATA_CODE_NAT = "hesuan"; + String DATA_CODE_DISABILITY = "canji"; + String DATA_CODE_DEATH = "siwang"; + +} 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 56ec47f551..7f67e1df52 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 @@ -106,18 +106,42 @@ public class DataSyncConfigController { return new Result(); } + @PostMapping("dataSyncForYanTaiTask") + public Result dataSyncForYanTaiTask(@RequestBody DataSyncTaskParam formDTO){ + dataSyncConfigService.dataSyncForYanTaiTask(formDTO); + return new Result(); + } + + /** + * @Description 核酸检测信息定时拉取 + * @param formDTO + * @Author zxc + * @Date 2022/11/8 10:37 + */ @PostMapping("natInfoScanTask") public Result natInfoScanTask(@RequestBody DataSyncTaskParam formDTO){ - dataSyncConfigService.dataSyncForYanTaiTask(formDTO); + dataSyncConfigService.natInfoScanTask(formDTO); return new Result(); } + /** + * @Description 死亡信息定时拉取 + * @param formDTO + * @Author zxc + * @Date 2022/11/8 09:01 + */ @PostMapping("deathInfoScanTask") public Result deathInfoScanTask(@RequestBody DataSyncTaskParam formDTO){ dataSyncConfigService.deathInfoScanTask(formDTO); return new Result(); } + /** + * @Description 残疾信息定时拉取 + * @param formDTO + * @Author zxc + * @Date 2022/11/8 09:01 + */ @PostMapping("disabilityInfoScanTask") public Result disabilityInfoScanTask(@RequestBody DataSyncTaskParam formDTO){ dataSyncConfigService.disabilityInfoScanTask(formDTO); 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 2963617263..35bbc6266d 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 @@ -38,7 +38,7 @@ public interface DataSyncConfigDao extends BaseDao { * @author zxc * @date 2022/9/26 15:04 */ - List list(@Param("customerId") String customerId, @Param("switchStatus") String switchStatus); + List list(@Param("customerId") String customerId, @Param("switchStatus") String switchStatus, @Param("dataCode")String dataCode); List scopeList(@Param("id") String id); @@ -60,4 +60,6 @@ public interface DataSyncConfigDao extends BaseDao { */ List getIdCardsByScope(DataSyncTaskParam formDTO); + DataSyncConfigDTO getConfigInfoByType(@Param("customerId") String customerId, @Param("switchStatus") String switchStatus,@Param("dataCode")String dataCode); + } 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 50e65d3b23..8ffba84f3b 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 @@ -84,8 +84,28 @@ public interface DataSyncConfigService extends BaseService void dataSyncForYanTaiTask(DataSyncTaskParam formDTO); + /** + * @Description 死亡信息定时拉取 + * @param formDTO + * @Author zxc + * @Date 2022/11/8 09:01 + */ void deathInfoScanTask(DataSyncTaskParam formDTO); + /** + * @Description 残疾信息定时拉取 + * @param formDTO + * @Author zxc + * @Date 2022/11/8 09:01 + */ void disabilityInfoScanTask(DataSyncTaskParam formDTO); + /** + * @Description 核酸检测信息定时拉取 + * @param formDTO + * @Author zxc + * @Date 2022/11/8 10:37 + */ + void natInfoScanTask(DataSyncTaskParam formDTO); + } 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 cd544907bb..81a894be8e 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 @@ -21,6 +21,7 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.YtHsResUtils; +import com.epmet.constant.EpidemicConstant; import com.epmet.dao.DataSyncConfigDao; import com.epmet.dao.IcNatDao; import com.epmet.dto.DataSyncConfigDTO; @@ -134,7 +135,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)); + .doSelectPageInfo(() -> baseDao.list(tokenDto.getCustomerId(), null,null)); if (CollectionUtils.isNotEmpty(pageInfo.getList())) { result.setList(pageInfo.getList()); result.setTotal(Integer.parseInt(String.valueOf(pageInfo.getTotal()))); @@ -189,7 +190,7 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl allConfigList = baseDao.list(formDTO.getCustomerId(), "open"); + List allConfigList = baseDao.list(formDTO.getCustomerId(), "open",null); if (CollectionUtils.isEmpty(allConfigList)) { return; } @@ -233,7 +234,43 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl configData = getConfigData(null, EpidemicConstant.DATA_CODE_DEATH); + if (CollectionUtils.isEmpty(configData)){ + log.warn("deathInfoScanTask not exists config data,customer is "+formDTO.getCustomerId()); + return; + } + long count = configData.stream().filter(o -> CollectionUtils.isNotEmpty(o.getScopeList())).count(); + if (count < 1) { + log.warn("deathInfoScanTask scopeList is null"); + return; + } + int pageNo = NumConstant.ONE; + int pageSize = NumConstant.ONE_THOUSAND; + List dbResiList = null; + do { + for (DataSyncConfigDTO config : configData) { + // 设置查询数据范围 + formDTO.setOrgList(config.getScopeList()); + DataSyncEnum anEnum = DataSyncEnum.getEnum(config.getDataCode()); + dbResiList = getNatUserInfoFromDb(formDTO, pageNo, pageSize); + if (CollectionUtils.isEmpty(dbResiList)) { + continue; + } + switch (anEnum) { + case SI_WANG: + try { + //查询正常状态的居民 + siWang(dbResiList); + log.info("======siWang信息拉取结束======"); + } catch (Exception e) { + log.error("death thread execute exception", e); + } + default: + log.warn("没有要处理的数据"); + } + } + pageNo++; + } while (dbResiList != null && dbResiList.size() == pageSize); } /** @@ -244,7 +281,116 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl configData = getConfigData(null, EpidemicConstant.DATA_CODE_DISABILITY); + if (CollectionUtils.isEmpty(configData)){ + log.warn("disabilityInfoScanTask not exists config data,customer is "+formDTO.getCustomerId()); + return; + } + long count = configData.stream().filter(o -> CollectionUtils.isNotEmpty(o.getScopeList())).count(); + if (count < 1) { + log.warn("disabilityInfoScanTask scopeList is null"); + return; + } + int pageNo = NumConstant.ONE; + int pageSize = NumConstant.ONE_THOUSAND; + List dbResiList = null; + do { + for (DataSyncConfigDTO config : configData) { + // 设置查询数据范围 + formDTO.setOrgList(config.getScopeList()); + formDTO.setCategoryColumn("IS_CJ"); + DataSyncEnum anEnum = DataSyncEnum.getEnum(config.getDataCode()); + dbResiList = getNatUserInfoFromDb(formDTO, pageNo, pageSize); + if (CollectionUtils.isEmpty(dbResiList)) { + continue; + } + switch (anEnum) { + case CAN_JI: + try { + //查询正常状态的居民 + canJi(dbResiList); + log.info("======canJi信息拉取结束======"); + } catch (Exception e) { + log.error("disability thread execute exception", e); + } + break; + default: + log.warn("没有要处理的数据"); + } + } + pageNo++; + } while (dbResiList != null && dbResiList.size() == pageSize); + } + /** + * @Description 核酸检测信息定时拉取 + * @param formDTO + * @Author zxc + * @Date 2022/11/8 10:37 + */ + @Override + public void natInfoScanTask(DataSyncTaskParam formDTO) { + List configData = new ArrayList<>(); + if (StringUtils.isBlank(formDTO.getAgencyId())){ + configData = getConfigData(null, EpidemicConstant.DATA_CODE_DISABILITY); + if (CollectionUtils.isEmpty(configData)){ + log.warn("natInfoScanTask not exists config data,customer is "+formDTO.getCustomerId()); + return; + } + long count = configData.stream().filter(o -> CollectionUtils.isNotEmpty(o.getScopeList())).count(); + if (count < 1) { + log.warn("natInfoScanTask scopeList is null"); + return; + } + } + int pageNo = NumConstant.ONE; + int pageSize = NumConstant.ONE_THOUSAND; + List dbResiList = null; + do { + if (StringUtils.isBlank(formDTO.getAgencyId())){ + for (DataSyncConfigDTO config : configData) { + // 设置查询数据范围 + formDTO.setOrgList(config.getScopeList()); + DataSyncEnum anEnum = DataSyncEnum.getEnum(config.getDataCode()); + dbResiList = getNatUserInfoFromDb(formDTO, pageNo, pageSize); + if (CollectionUtils.isEmpty(dbResiList)) { + continue; + } + switch (anEnum) { + case HE_SUAN: + try { + //查询正常状态的居民 + yantaiHsjcByDbView(dbResiList, config.getCustomerId(), formDTO.getIsSync()); + log.info("======核酸检测信息拉取结束======"); + } catch (Exception e) { + log.error("nat thread execute exception", e); + } + break; + default: + log.warn("没有要处理的数据"); + } + } + }else { + dbResiList = getNatUserInfoFromDb(formDTO, pageNo, pageSize); + if (CollectionUtils.isEmpty(dbResiList)){ + return; + } + yantaiHsjcByDbView(dbResiList, dbResiList.get(NumConstant.ZERO).getCustomerId(), formDTO.getIsSync()); + } + pageNo++; + } while (dbResiList != null && dbResiList.size() == pageSize); + } + + /** + * @Description 配置信息查询 + * @param customerId + * @param dataCode + * @Author zxc + * @Date 2022/11/8 10:41 + */ + public List getConfigData(String customerId, String dataCode){ + List allConfigList = baseDao.list(customerId, "open",dataCode); + return CollectionUtils.isEmpty(allConfigList) ? new ArrayList<>() : allConfigList; } private void dataSyncYanTaiParallel(List configList, DataSyncTaskParam formDTO) { 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 cc4209f310..911b5102bd 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 @@ -47,6 +47,9 @@ AND CUSTOMER_ID = #{customerId} + + AND data_code = #{dataCode} + order by sort @@ -103,4 +106,12 @@ ORDER BY CREATED_TIME + + From 89f45c19e698e9e8ddbea72d86f7eac50dd66469 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 8 Nov 2022 13:26:36 +0800 Subject: [PATCH 07/32] =?UTF-8?q?=E6=9A=82=E6=8F=90=E4=B8=80=E6=B3=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/task/NatInfoScanTask.java | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) 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 f141cc818a..459fdfd72b 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 @@ -30,11 +30,34 @@ public class NatInfoScanTask implements ITask { if (StringUtils.isNotBlank(params)) { formDTO = JSON.parseObject(params, DataSyncTaskParam.class); } - Result result = userOpenFeignClient.natInfoScanTask(formDTO); + /*Result result = userOpenFeignClient.natInfoScanTask(formDTO); if (result.success()) { log.info("NatInfoScanTask定时任务执行成功"); } else { log.error("NatInfoScanTask定时任务执行失败:" + result.getMsg()); + }*/ + // 核酸检测 + Result natResult = userOpenFeignClient.natInfoScanTaskV2(formDTO); + if (natResult.success()) { + log.info("NatInfoScanTask定时任务执行成功"); + } else { + log.error("NatInfoScanTask定时任务执行失败:" + natResult.getMsg()); + } + + // 死亡 + Result deathResult = userOpenFeignClient.deathInfoScanTask(formDTO); + if (deathResult.success()) { + log.info("deathInfoScanTask定时任务执行成功"); + } else { + log.error("deathInfoScanTask定时任务执行失败:" + deathResult.getMsg()); + } + + // 残疾 + Result disabilityResult = userOpenFeignClient.disabilityInfoScanTask(formDTO); + if (disabilityResult.success()) { + log.info("disabilityInfoScanTask定时任务执行成功"); + } else { + log.error("disabilityInfoScanTask定时任务执行失败:" + disabilityResult.getMsg()); } } } From ed0605fd660d23e8f5f8d058743482986ae68505 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 8 Nov 2022 13:28:56 +0800 Subject: [PATCH 08/32] emm --- .../src/main/java/com/epmet/task/NatInfoScanTask.java | 4 ++-- .../main/java/com/epmet/feign/EpmetUserOpenFeignClient.java | 4 ++-- .../feign/fallback/EpmetUserOpenFeignClientFallback.java | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) 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 459fdfd72b..e50793f551 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 @@ -30,14 +30,14 @@ public class NatInfoScanTask implements ITask { if (StringUtils.isNotBlank(params)) { formDTO = JSON.parseObject(params, DataSyncTaskParam.class); } - /*Result result = userOpenFeignClient.natInfoScanTask(formDTO); + /*Result result = userOpenFeignClient.dataSyncForYanTaiTask(formDTO); if (result.success()) { log.info("NatInfoScanTask定时任务执行成功"); } else { log.error("NatInfoScanTask定时任务执行失败:" + result.getMsg()); }*/ // 核酸检测 - Result natResult = userOpenFeignClient.natInfoScanTaskV2(formDTO); + Result natResult = userOpenFeignClient.natInfoScanTask(formDTO); if (natResult.success()) { log.info("NatInfoScanTask定时任务执行成功"); } else { 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 24ca6b3873..b24a4a9651 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,7 +923,7 @@ public interface EpmetUserOpenFeignClient { Result dingResiLogin(@RequestBody DingLoginResiFormDTO formDTO); @PostMapping("/epmetuser/dataSyncConfig/dataSyncForYanTaiTask") - Result natInfoScanTask(@RequestBody DataSyncTaskParam formDTO); + Result dataSyncForYanTaiTask(@RequestBody DataSyncTaskParam formDTO); /** * Desc: 客户下所有工作人员放缓存 @@ -945,7 +945,7 @@ public interface EpmetUserOpenFeignClient { Result getAllResiByGrid(@RequestBody AllResiByGridFormDTO formDTO); @PostMapping("/epmetuser/dataSyncConfig/natInfoScanTask") - Result natInfoScanTaskV2(@RequestBody DataSyncTaskParam formDTO); + Result natInfoScanTask(@RequestBody DataSyncTaskParam formDTO); @PostMapping("/epmetuser/dataSyncConfig/deathInfoScanTask") Result deathInfoScanTask(@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 d13aab8c15..b675a7626b 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,8 +713,8 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien } @Override - public Result natInfoScanTask(DataSyncTaskParam formDTO) { - return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "natInfoScanTask", formDTO); + public Result dataSyncForYanTaiTask(DataSyncTaskParam formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "dataSyncForYanTaiTask", formDTO); } @Override @@ -728,7 +728,7 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien } @Override - public Result natInfoScanTaskV2(DataSyncTaskParam formDTO) { + public Result natInfoScanTask(DataSyncTaskParam formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "natInfoScanTaskV2", formDTO); } From f7769f33076f3e402e213e870f60c732bb0da478 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 8 Nov 2022 15:23:35 +0800 Subject: [PATCH 09/32] =?UTF-8?q?=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 2 + .../com/epmet/dto/form/DataSyncTaskParam.java | 2 + .../com/epmet/constant/EpidemicConstant.java | 6 + .../controller/DataSyncConfigController.java | 8 ++ .../epmet/service/DataSyncConfigService.java | 2 + .../impl/DataSyncConfigServiceImpl.java | 103 +++++++++++++++++- 6 files changed, 122 insertions(+), 1 deletion(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 0bf690a8ea..8bea28a618 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -217,6 +217,8 @@ public enum EpmetErrorCode { CUSTOMER_CATEGORY(9101,"分类已使用,不允许删除"), CATEGORY_NAME(9102,"分类名称已存在,不允许重复"), + EXIST_SYNC_JOB_ERROR(9103,"存在同步任务"), + OTHER_SYNC_JOB_ERROR(9104,"同步任务已提交,请稍后查看数据"), // open api异常 OPEN_API_UNAUTHENTICATED(10100, "请求未认证"), 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 index 00134f6c45..215ffabf28 100644 --- 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 @@ -47,4 +47,6 @@ public class DataSyncTaskParam implements Serializable { */ private String agencyId = null; private String dataCode; + + private String staffId; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/EpidemicConstant.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/EpidemicConstant.java index 41bdd00158..0ad814d722 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/EpidemicConstant.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/EpidemicConstant.java @@ -12,4 +12,10 @@ public interface EpidemicConstant { String DATA_CODE_DISABILITY = "canji"; String DATA_CODE_DEATH = "siwang"; + String JOB_TYPE_NAT = "nat"; + + String OPERATION_STATUS_WAITING = "waiting"; + String OPERATION_STATUS_PROCESSING = "processing"; + String OPERATION_STATUS_FINISH = "finish"; + } 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 7f67e1df52..cbbc409d6b 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 @@ -124,6 +124,14 @@ public class DataSyncConfigController { return new Result(); } + @PostMapping("natInfoSyncButton") + public Result natInfoSyncButton(@RequestBody DataSyncTaskParam formDTO, @LoginUser TokenDto tokenDto){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); + dataSyncConfigService.natInfoSyncButton(formDTO); + return new Result(); + } + /** * @Description 死亡信息定时拉取 * @param formDTO 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 8ffba84f3b..dd1efb81b1 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 @@ -108,4 +108,6 @@ public interface DataSyncConfigService extends BaseService */ void natInfoScanTask(DataSyncTaskParam formDTO); + void natInfoSyncButton(DataSyncTaskParam formDTO); + } 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 81a894be8e..88e30607ba 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,20 +1,27 @@ package com.epmet.service.impl; +import java.util.Date; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.distributedlock.DistributedLock; import com.epmet.commons.tools.dto.form.PageFormDTO; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.YtDataSyncResDTO; import com.epmet.commons.tools.dto.result.YtHscyResDTO; import com.epmet.commons.tools.dto.result.YtHsjcResDTO; import com.epmet.commons.tools.enums.GenderEnum; +import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.common.CustomerOrgRedis; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.security.dto.TokenDto; @@ -24,6 +31,7 @@ import com.epmet.commons.tools.utils.YtHsResUtils; import com.epmet.constant.EpidemicConstant; import com.epmet.dao.DataSyncConfigDao; import com.epmet.dao.IcNatDao; +import com.epmet.dao.IcSyncJobDao; import com.epmet.dto.DataSyncConfigDTO; import com.epmet.dto.DataSyncRecordDeathDTO; import com.epmet.dto.DataSyncRecordDisabilityDTO; @@ -40,6 +48,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang3.StringUtils; +import org.redisson.api.RLock; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; @@ -50,9 +59,12 @@ import javax.annotation.Resource; import java.util.*; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; +import java.util.concurrent.TimeUnit; import java.util.function.Function; import java.util.stream.Collectors; +import static com.epmet.constant.EpidemicConstant.*; + /** * 数据更新配置表 * @@ -77,6 +89,12 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl configData = new ArrayList<>(); if (StringUtils.isBlank(formDTO.getAgencyId())){ - configData = getConfigData(null, EpidemicConstant.DATA_CODE_DISABILITY); + configData = getConfigData(null, EpidemicConstant.DATA_CODE_NAT); if (CollectionUtils.isEmpty(configData)){ log.warn("natInfoScanTask not exists config data,customer is "+formDTO.getCustomerId()); return; @@ -381,6 +399,89 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl qw = new LambdaQueryWrapper<>(); + qw.eq(IcSyncJobEntity::getOrgId,formDTO.getAgencyId()).in(IcSyncJobEntity::getOperationStatus,OPERATION_STATUS_WAITING,OPERATION_STATUS_PROCESSING); + List icSyncJobEntities = icSyncJobDao.selectList(qw); + // 当前组织下存在同步任务 + if (CollectionUtils.isNotEmpty(icSyncJobEntities)){ + throw new EpmetException(EpmetErrorCode.EXIST_SYNC_JOB_ERROR.getCode()); + } + // 不存在新增一条记录 + IcSyncJobEntity e = new IcSyncJobEntity(); + e.setCustomerId(formDTO.getCustomerId()); + e.setOrgId(formDTO.getAgencyId()); + e.setPid(agencyInfo.getPid()); + e.setOrgIdPath(StringUtils.isBlank(agencyInfo.getPids()) ? agencyInfo.getId() : agencyInfo.getPids()+":"+agencyInfo.getId()); + e.setJobType(JOB_TYPE_NAT); + e.setOperatorId(formDTO.getStaffId()); + e.setOperationStatus(OPERATION_STATUS_WAITING); + insertSync(e); + // 客户下,type=nat 存在两条正在进行中的同步任务 + LambdaQueryWrapper qw2 = new LambdaQueryWrapper<>(); + qw2.eq(IcSyncJobEntity::getCustomerId,formDTO.getCustomerId()) + .eq(IcSyncJobEntity::getOperationStatus,OPERATION_STATUS_PROCESSING) + .eq(IcSyncJobEntity::getJobType,JOB_TYPE_NAT); + List processingList = icSyncJobDao.selectList(qw2); + if (CollectionUtils.isNotEmpty(processingList) && processingList.size() >= NumConstant.TWO){ + throw new EpmetException(EpmetErrorCode.OTHER_SYNC_JOB_ERROR.getCode()); + } + List waitList; + do { + LambdaQueryWrapper qw3 = new LambdaQueryWrapper<>(); + qw3.eq(IcSyncJobEntity::getCustomerId,formDTO.getCustomerId()) + .eq(IcSyncJobEntity::getOperationStatus,OPERATION_STATUS_WAITING) + .eq(IcSyncJobEntity::getJobType,JOB_TYPE_NAT) + .orderByAsc(BaseEpmetEntity::getCreatedTime); + waitList = icSyncJobDao.selectList(qw3); + if (CollectionUtils.isNotEmpty(waitList)){ + for (IcSyncJobEntity entity : waitList) { + RLock lock = null; + try { + lock = distributedLock.getLock(entity.getOrgId() + JOB_TYPE_NAT, 60L, 60L, TimeUnit.SECONDS); + updateSync(entity.getId(),OPERATION_STATUS_PROCESSING); + }catch (Exception ex){ + log.error(ex.getMessage()); + throw new EpmetException(ex.getMessage()); + }finally { + lock.unlock(); + } + formDTO.setAgencyId(entity.getOrgId()); + try { + natInfoScanTask(formDTO); + }catch (Exception ee){ + log.error(ee.getMessage()); + throw new EpmetException(ee.getMessage()); + }finally { + updateSync(entity.getId(),OPERATION_STATUS_FINISH); + } + } + } + }while (CollectionUtils.isNotEmpty(waitList)); + } + + @Transactional(rollbackFor = Exception.class) + public void updateSync(String id,String status){ + LambdaUpdateWrapper qwUpdate = new LambdaUpdateWrapper<>(); + qwUpdate.eq(BaseEpmetEntity::getId,id) + .set(IcSyncJobEntity::getOperationStatus,status) + .set(BaseEpmetEntity::getUpdatedTime, new Date()); + icSyncJobDao.update(null,qwUpdate); + } + @Transactional(rollbackFor = Exception.class) + public void insertSync(IcSyncJobEntity e){ + icSyncJobService.insert(e); + } + /** * @Description 配置信息查询 * @param customerId From cf75416107e7784a7bec5cb750b6edd625490314 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Tue, 8 Nov 2022 20:40:56 +0800 Subject: [PATCH 10/32] =?UTF-8?q?=E6=A0=B8=E9=85=B8=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=BC=82=E6=AD=A5?= =?UTF-8?q?=E5=A4=84=E7=90=86=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 2 +- .../main/java/com/epmet/UserApplication.java | 2 + .../main/java/com/epmet/dao/IcSyncJobDao.java | 8 +- .../processor/YanTaiNatSyncProcessor.java | 126 ++++++++++++++++++ .../epmet/service/DataSyncConfigService.java | 23 ++++ .../impl/DataSyncConfigServiceImpl.java | 114 ++++++++++------ .../main/resources/mapper/IcSyncJobDao.xml | 23 ++++ 7 files changed, 253 insertions(+), 45 deletions(-) create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiNatSyncProcessor.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 8bea28a618..46e02f1d12 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -217,7 +217,7 @@ public enum EpmetErrorCode { CUSTOMER_CATEGORY(9101,"分类已使用,不允许删除"), CATEGORY_NAME(9102,"分类名称已存在,不允许重复"), - EXIST_SYNC_JOB_ERROR(9103,"存在同步任务"), + EXIST_SYNC_JOB_ERROR(9103,"存在等待或进行中的任务"), OTHER_SYNC_JOB_ERROR(9104,"同步任务已提交,请稍后查看数据"), // open api异常 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/UserApplication.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/UserApplication.java index 5767fb4d33..dd147516e9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/UserApplication.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/UserApplication.java @@ -14,6 +14,7 @@ import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.annotation.EnableScheduling; /** * 管理后台 @@ -22,6 +23,7 @@ import org.springframework.scheduling.annotation.EnableAsync; * @since 1.0.0 */ +@EnableScheduling @SpringBootApplication @EnableDiscoveryClient @EnableFeignClients diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcSyncJobDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcSyncJobDao.java index 5b4ad6684e..298b5fb6b1 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcSyncJobDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcSyncJobDao.java @@ -3,6 +3,9 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.IcSyncJobEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 同步任务表 @@ -12,5 +15,8 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface IcSyncJobDao extends BaseDao { - + + List selectExecutableJobList(@Param("jobType") String jobType, + @Param("operationStatus") String operationStatus, + @Param("itemCount") int itemCount); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiNatSyncProcessor.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiNatSyncProcessor.java new file mode 100644 index 0000000000..fb8b4a2230 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiNatSyncProcessor.java @@ -0,0 +1,126 @@ +package com.epmet.processor; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.epmet.commons.tools.distributedlock.DistributedLock; +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.constant.EpidemicConstant; +import com.epmet.dao.IcSyncJobDao; +import com.epmet.entity.IcSyncJobEntity; +import com.epmet.service.DataSyncConfigService; +import lombok.extern.slf4j.Slf4j; +import org.redisson.api.RLock; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; + +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.TimeUnit; + +import static com.epmet.constant.EpidemicConstant.JOB_TYPE_NAT; + +// 烟台核酸检测数据同步处理器 +@Component +@Slf4j +public class YanTaiNatSyncProcessor { + + public static final int MAX_EXECUTING_COUNT = 3; + + @Autowired + private ExecutorService executorService; + + @Autowired + private IcSyncJobDao icSyncJobDao; + + @Autowired + private DataSyncConfigService dataSyncConfigService; + + @Autowired + private DistributedLock distributedLock; + + @Autowired + RedisUtils redisUtils; + + /** + * 定时扫描和执行同步任务 + * 10s扫一次库 + * + * @author wxz + * @date 2022/11/8 下午5:42 + */ + @Scheduled(cron = "0/10 * * * * ? ") + public void scanJobs() { + log.info("【异步数据更新】开始同步任务"); + + String dataSyncEnable = redisUtils.getString("data:sync:enable"); + if (StringUtils.isEmpty(dataSyncEnable)) { + return; + } + + LambdaQueryWrapper executingListQuery = new LambdaQueryWrapper<>(); + executingListQuery.eq(IcSyncJobEntity::getOperationStatus, EpidemicConstant.OPERATION_STATUS_PROCESSING); + List executingJobList = icSyncJobDao.selectList(executingListQuery); + + if (!CollectionUtils.isEmpty(executingJobList) && executingJobList.size() >= MAX_EXECUTING_COUNT) { + // 最多只允许同时3条线程运行 + return; + } + + int executingCount = executingJobList.size(); + // 还可以运行几条线程 + int leftCount = MAX_EXECUTING_COUNT - executingCount; + + RLock lock = null; + try { + lock = distributedLock.getLock("data:sync:" + JOB_TYPE_NAT, 60L, 60L, TimeUnit.SECONDS); + // 查询可执行的任务列表,并且异步执行 + List icSyncJobToExec = icSyncJobDao.selectExecutableJobList( + EpidemicConstant.JOB_TYPE_NAT, + EpidemicConstant.OPERATION_STATUS_WAITING, + leftCount); + + if (!CollectionUtils.isEmpty(icSyncJobToExec)) { + // 异步提交任务 + for (IcSyncJobEntity jobEntity : icSyncJobToExec) { + + updateJobStatus(jobEntity.getId(), EpidemicConstant.OPERATION_STATUS_PROCESSING); + executorService.submit(() -> { + // 将此任务状态修改为执行中 + + dataSyncConfigService.execSyncByJobProcessor(jobEntity); + + // 更新任务状态为结束 + updateJobStatus(jobEntity.getId(), EpidemicConstant.OPERATION_STATUS_FINISH); + }); + } + } + } catch (Exception e) { + log.error("【异步数据更新】出错:{}", ExceptionUtils.getErrorStackTrace(e)); + } finally { + if (lock != null) { + lock.unlock(); + } + } + } + + /** + * 更新任务状态 + * @author wxz + * @date 2022/11/8 下午8:25 + * @param id + * @param status + + */ + private void updateJobStatus(String id, String status) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(IcSyncJobEntity::getId, id); + + IcSyncJobEntity updateEntity = new IcSyncJobEntity(); + updateEntity.setOperationStatus(status); + icSyncJobDao.update(updateEntity, query); + } + +} 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 dd1efb81b1..d7e44b58de 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 @@ -8,7 +8,11 @@ import com.epmet.dto.DataSyncConfigDTO; import com.epmet.dto.form.ConfigSwitchFormDTO; 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.IcSyncJobEntity; + +import java.util.List; /** * 数据更新配置表 @@ -110,4 +114,23 @@ public interface DataSyncConfigService extends BaseService void natInfoSyncButton(DataSyncTaskParam formDTO); + List getNatUserInfoFromDb(DataSyncTaskParam formDTO, int pageNo, int pageSize); + + /** + * 烟台核酸检测(视图方式获取数据) + * @param resiInfos + * @param customerId + * @param isSync + */ + void yantaiHsjcByDbView(List resiInfos, String customerId, String isSync); + + /** + * 更新居民核酸检测信息(通过任务处理器) + * @author wxz + * @date 2022/11/8 下午8:17 + * @param jobEntity + + */ + void execSyncByJobProcessor(IcSyncJobEntity jobEntity); + } 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 88e30607ba..3013c0bd79 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 @@ -399,6 +399,13 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl qw = new LambdaQueryWrapper<>(); - qw.eq(IcSyncJobEntity::getOrgId,formDTO.getAgencyId()).in(IcSyncJobEntity::getOperationStatus,OPERATION_STATUS_WAITING,OPERATION_STATUS_PROCESSING); + qw.eq(IcSyncJobEntity::getOrgId,formDTO.getAgencyId()) + .in(IcSyncJobEntity::getOperationStatus,OPERATION_STATUS_WAITING,OPERATION_STATUS_PROCESSING); List icSyncJobEntities = icSyncJobDao.selectList(qw); // 当前组织下存在同步任务 if (CollectionUtils.isNotEmpty(icSyncJobEntities)){ throw new EpmetException(EpmetErrorCode.EXIST_SYNC_JOB_ERROR.getCode()); } + // 不存在新增一条记录 IcSyncJobEntity e = new IcSyncJobEntity(); e.setCustomerId(formDTO.getCustomerId()); @@ -426,47 +437,39 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl qw2 = new LambdaQueryWrapper<>(); - qw2.eq(IcSyncJobEntity::getCustomerId,formDTO.getCustomerId()) - .eq(IcSyncJobEntity::getOperationStatus,OPERATION_STATUS_PROCESSING) - .eq(IcSyncJobEntity::getJobType,JOB_TYPE_NAT); - List processingList = icSyncJobDao.selectList(qw2); - if (CollectionUtils.isNotEmpty(processingList) && processingList.size() >= NumConstant.TWO){ - throw new EpmetException(EpmetErrorCode.OTHER_SYNC_JOB_ERROR.getCode()); - } - List waitList; - do { - LambdaQueryWrapper qw3 = new LambdaQueryWrapper<>(); - qw3.eq(IcSyncJobEntity::getCustomerId,formDTO.getCustomerId()) - .eq(IcSyncJobEntity::getOperationStatus,OPERATION_STATUS_WAITING) - .eq(IcSyncJobEntity::getJobType,JOB_TYPE_NAT) - .orderByAsc(BaseEpmetEntity::getCreatedTime); - waitList = icSyncJobDao.selectList(qw3); - if (CollectionUtils.isNotEmpty(waitList)){ - for (IcSyncJobEntity entity : waitList) { - RLock lock = null; - try { - lock = distributedLock.getLock(entity.getOrgId() + JOB_TYPE_NAT, 60L, 60L, TimeUnit.SECONDS); - updateSync(entity.getId(),OPERATION_STATUS_PROCESSING); - }catch (Exception ex){ - log.error(ex.getMessage()); - throw new EpmetException(ex.getMessage()); - }finally { - lock.unlock(); - } - formDTO.setAgencyId(entity.getOrgId()); - try { - natInfoScanTask(formDTO); - }catch (Exception ee){ - log.error(ee.getMessage()); - throw new EpmetException(ee.getMessage()); - }finally { - updateSync(entity.getId(),OPERATION_STATUS_FINISH); - } - } - } - }while (CollectionUtils.isNotEmpty(waitList)); + + //List waitList; + //do { + // LambdaQueryWrapper qw3 = new LambdaQueryWrapper<>(); + // qw3.eq(IcSyncJobEntity::getCustomerId,formDTO.getCustomerId()) + // .eq(IcSyncJobEntity::getOperationStatus,OPERATION_STATUS_WAITING) + // .eq(IcSyncJobEntity::getJobType,JOB_TYPE_NAT) + // .orderByAsc(BaseEpmetEntity::getCreatedTime); + // waitList = icSyncJobDao.selectList(qw3); + // if (CollectionUtils.isNotEmpty(waitList)){ + // for (IcSyncJobEntity entity : waitList) { + // RLock lock = null; + // try { + // lock = distributedLock.getLock(entity.getOrgId() + JOB_TYPE_NAT, 60L, 60L, TimeUnit.SECONDS); + // updateSync(entity.getId(),OPERATION_STATUS_PROCESSING); + // }catch (Exception ex){ + // log.error(ex.getMessage()); + // throw new EpmetException(ex.getMessage()); + // }finally { + // lock.unlock(); + // } + // formDTO.setAgencyId(entity.getOrgId()); + // try { + // natInfoScanTask(formDTO); + // }catch (Exception ee){ + // log.error(ee.getMessage()); + // throw new EpmetException(ee.getMessage()); + // }finally { + // updateSync(entity.getId(),OPERATION_STATUS_FINISH); + // } + // } + // } + //}while (CollectionUtils.isNotEmpty(waitList)); } @Transactional(rollbackFor = Exception.class) @@ -695,7 +698,7 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl getNatUserInfoFromDb(DataSyncTaskParam formDTO, int pageNo, int pageSize) { + public List getNatUserInfoFromDb(DataSyncTaskParam formDTO, int pageNo, int pageSize) { //根据 组织 分页获取 居民数据 PageInfo pageInfo = PageHelper.startPage(pageNo, pageSize, false) .doSelectPageInfo(() -> baseDao.getIdCardsByScope(formDTO)); @@ -1171,4 +1174,29 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl resis = null; + int pageNo = 1; + int pageSize = 1000; + do { + // 分页,一次查询1000居民,循环更新他们的核酸检测信息 + resis = getNatUserInfoFromDb(p, pageNo, pageSize); + yantaiHsjcByDbView(resis, jobEntity.getCustomerId(), NumConstant.ONE_STR); + pageNo++; + } while (org.springframework.util.CollectionUtils.isEmpty(resis)); + } } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcSyncJobDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcSyncJobDao.xml index 0b7ecc334d..9f712c8896 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcSyncJobDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcSyncJobDao.xml @@ -3,4 +3,27 @@ + + \ No newline at end of file From 7a00d9b038a6180e84e7c8e4be2826fa9d922125 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Tue, 8 Nov 2022 20:47:41 +0800 Subject: [PATCH 11/32] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../db/migration/V0.0.81__data_sync_job.sql | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.81__data_sync_job.sql diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.81__data_sync_job.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.81__data_sync_job.sql new file mode 100644 index 0000000000..6008cbf584 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.81__data_sync_job.sql @@ -0,0 +1,20 @@ +create table ic_sync_job +( + ID varchar(64) not null comment 'ID' + primary key, + CUSTOMER_ID varchar(64) not null comment '客户ID', + ORG_ID varchar(64) not null comment '组织ID', + PID varchar(255) not null comment '组织ID的上级', + ORG_ID_PATH varchar(1024) not null comment '组织ID的所有上级,包括org_id', + JOB_TYPE varchar(255) not null comment '任务类型,残疾:disability;死亡:death;核酸:nat;', + OPERATOR_ID varchar(255) not null comment '操作员ID【staffId】', + OPERATION_STATUS varchar(255) null comment '操作状态,等待中:waiting;进行中:processing;结束:finish', + DEL_FLAG int not null, + REVISION int not null comment '乐观锁', + CREATED_BY varchar(32) not null comment '创建人', + CREATED_TIME datetime not null comment '创建时间', + UPDATED_BY varchar(32) not null comment '更新人', + UPDATED_TIME datetime not null comment '更新时间', + index(ORG_ID,OPERATION_STATUS,JOB_TYPE) using btree +) + comment '同步任务表'; From 159ffb1b94e7fb2610bd4a5dfd27c9470a82348f Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Tue, 8 Nov 2022 20:49:49 +0800 Subject: [PATCH 12/32] - --- .../{V0.0.81__data_sync_job.sql => V0.0.84__data_sync_job.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename epmet-user/epmet-user-server/src/main/resources/db/migration/{V0.0.81__data_sync_job.sql => V0.0.84__data_sync_job.sql} (100%) diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.81__data_sync_job.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.84__data_sync_job.sql similarity index 100% rename from epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.81__data_sync_job.sql rename to epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.84__data_sync_job.sql From 283b0b70452f2c91992c1b332e44d949e8dbc3fc Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Tue, 8 Nov 2022 20:51:08 +0800 Subject: [PATCH 13/32] - --- .../db/migration/V0.0.84__data_sync_job.sql | 20 ------------------- 1 file changed, 20 deletions(-) delete mode 100644 epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.84__data_sync_job.sql diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.84__data_sync_job.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.84__data_sync_job.sql deleted file mode 100644 index 6008cbf584..0000000000 --- a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.84__data_sync_job.sql +++ /dev/null @@ -1,20 +0,0 @@ -create table ic_sync_job -( - ID varchar(64) not null comment 'ID' - primary key, - CUSTOMER_ID varchar(64) not null comment '客户ID', - ORG_ID varchar(64) not null comment '组织ID', - PID varchar(255) not null comment '组织ID的上级', - ORG_ID_PATH varchar(1024) not null comment '组织ID的所有上级,包括org_id', - JOB_TYPE varchar(255) not null comment '任务类型,残疾:disability;死亡:death;核酸:nat;', - OPERATOR_ID varchar(255) not null comment '操作员ID【staffId】', - OPERATION_STATUS varchar(255) null comment '操作状态,等待中:waiting;进行中:processing;结束:finish', - DEL_FLAG int not null, - REVISION int not null comment '乐观锁', - CREATED_BY varchar(32) not null comment '创建人', - CREATED_TIME datetime not null comment '创建时间', - UPDATED_BY varchar(32) not null comment '更新人', - UPDATED_TIME datetime not null comment '更新时间', - index(ORG_ID,OPERATION_STATUS,JOB_TYPE) using btree -) - comment '同步任务表'; From e3c051dbe98ed50dc02d555ec66e0569310ca047 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Tue, 8 Nov 2022 22:31:47 +0800 Subject: [PATCH 14/32] - --- .../main/java/com/epmet/dao/IcSyncJobDao.java | 1 - .../processor/YanTaiNatSyncProcessor.java | 18 ++++++++++-------- .../impl/DataSyncConfigServiceImpl.java | 19 +++++++++++-------- .../main/resources/mapper/IcSyncJobDao.xml | 2 +- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcSyncJobDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcSyncJobDao.java index 298b5fb6b1..a8dfd6bee2 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcSyncJobDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcSyncJobDao.java @@ -17,6 +17,5 @@ import java.util.List; public interface IcSyncJobDao extends BaseDao { List selectExecutableJobList(@Param("jobType") String jobType, - @Param("operationStatus") String operationStatus, @Param("itemCount") int itemCount); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiNatSyncProcessor.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiNatSyncProcessor.java index fb8b4a2230..e3417c3811 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiNatSyncProcessor.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiNatSyncProcessor.java @@ -55,10 +55,10 @@ public class YanTaiNatSyncProcessor { public void scanJobs() { log.info("【异步数据更新】开始同步任务"); - String dataSyncEnable = redisUtils.getString("data:sync:enable"); - if (StringUtils.isEmpty(dataSyncEnable)) { - return; - } + //String dataSyncEnable = redisUtils.getString("data:sync:enable"); + //if (StringUtils.isEmpty(dataSyncEnable)) { + // return; + //} LambdaQueryWrapper executingListQuery = new LambdaQueryWrapper<>(); executingListQuery.eq(IcSyncJobEntity::getOperationStatus, EpidemicConstant.OPERATION_STATUS_PROCESSING); @@ -79,7 +79,6 @@ public class YanTaiNatSyncProcessor { // 查询可执行的任务列表,并且异步执行 List icSyncJobToExec = icSyncJobDao.selectExecutableJobList( EpidemicConstant.JOB_TYPE_NAT, - EpidemicConstant.OPERATION_STATUS_WAITING, leftCount); if (!CollectionUtils.isEmpty(icSyncJobToExec)) { @@ -90,10 +89,13 @@ public class YanTaiNatSyncProcessor { executorService.submit(() -> { // 将此任务状态修改为执行中 - dataSyncConfigService.execSyncByJobProcessor(jobEntity); + try { + dataSyncConfigService.execSyncByJobProcessor(jobEntity); + } finally { + // 更新任务状态为结束 + updateJobStatus(jobEntity.getId(), EpidemicConstant.OPERATION_STATUS_FINISH); + } - // 更新任务状态为结束 - updateJobStatus(jobEntity.getId(), EpidemicConstant.OPERATION_STATUS_FINISH); }); } } 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 3013c0bd79..e462eea806 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 @@ -1099,7 +1099,7 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl resis = null; int pageNo = 1; int pageSize = 1000; + int updatedResiCount = 0; do { // 分页,一次查询1000居民,循环更新他们的核酸检测信息 resis = getNatUserInfoFromDb(p, pageNo, pageSize); yantaiHsjcByDbView(resis, jobEntity.getCustomerId(), NumConstant.ONE_STR); pageNo++; - } while (org.springframework.util.CollectionUtils.isEmpty(resis)); + updatedResiCount += pageSize; + log.info("【任务处理器同步数据】组织Id:{},同步类型:{},已完成居民数:{}", jobEntity.getOrgId(), jobEntity.getJobType(), updatedResiCount); + } while (!org.springframework.util.CollectionUtils.isEmpty(resis)); } } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcSyncJobDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcSyncJobDao.xml index 9f712c8896..6ed0708d43 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcSyncJobDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcSyncJobDao.xml @@ -20,7 +20,7 @@ updated_by, updated_time from ic_sync_job - where OPERATION_STATUS = 'wating' + where OPERATION_STATUS = 'waiting' and JOB_TYPE = #{jobType} and DEL_FLAG = 0 order by CREATED_TIME asc From 3c0f1b789bc8d609311ad75d3ee8d703fbc1cf6d Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Wed, 9 Nov 2022 00:44:03 +0800 Subject: [PATCH 15/32] - --- .../dto/result/NatUserInfoResultDTO.java | 9 +++++++ .../processor/YanTaiNatSyncProcessor.java | 2 +- .../impl/DataSyncConfigServiceImpl.java | 26 ++++++++++++------- .../src/main/resources/mapper/IcNatDao.xml | 3 ++- 4 files changed, 28 insertions(+), 12 deletions(-) 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 dc696ff8dc..5b0300f764 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 @@ -3,6 +3,7 @@ package com.epmet.dto.result; import lombok.Data; import java.io.Serializable; +import java.util.Date; /** * @Author zxc @@ -37,4 +38,12 @@ public class NatUserInfoResultDTO implements Serializable { * ic_nat表ID */ private String id; + + /** + * 采样时间 + * @author wxz + * @date 2022/11/9 上午12:22 + * @param null + */ + private Date sampleTime; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiNatSyncProcessor.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiNatSyncProcessor.java index e3417c3811..1fbfb6a69f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiNatSyncProcessor.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiNatSyncProcessor.java @@ -53,7 +53,7 @@ public class YanTaiNatSyncProcessor { */ @Scheduled(cron = "0/10 * * * * ? ") public void scanJobs() { - log.info("【异步数据更新】开始同步任务"); + //log.info("【异步数据更新】开始同步任务"); //String dataSyncEnable = redisUtils.getString("data:sync:enable"); //if (StringUtils.isEmpty(dataSyncEnable)) { 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 e462eea806..4010a1c231 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 @@ -906,10 +906,13 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl existInfo.stream().filter(i -> i.getUserId().equals(e.getUserId()) && i.getIdCard().equals(e.getIdCard())).forEach(i -> { - e.setExistStatus(true); - e.setId(i.getId()); - })); + entities.forEach(e -> existInfo.stream() + .filter(i -> i.getUserId().equals(e.getUserId()) && i.getIdCard().equals(e.getIdCard()) && i.getSampleTime().equals(e.getSampleTime())) + .forEach(i -> { + e.setExistStatus(true); + e.setId(i.getId()); + })); + Map> groupByStatus = entities.stream().collect(Collectors.groupingBy(IcNatEntity::getExistStatus)); if (CollectionUtils.isNotEmpty(groupByStatus.get(false))) { for (List icNatEntities : ListUtils.partition(groupByStatus.get(false), NumConstant.FIVE_HUNDRED)) { @@ -1087,7 +1090,7 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl args = new HashMap<>(); args.put("idcards", idCards); - log.info("【更新核酸检测信息(from 兰图)】本批次身份证号为:{}", String.join(",", idCards)); + //log.info("【更新核酸检测信息(from 兰图)】本批次身份证号为:{}", String.join(",", idCards)); // 2.=====================核酸采样========================= // 这一批居民的核酸采样列表 @@ -1193,13 +1196,16 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl Date: Wed, 9 Nov 2022 14:54:13 +0800 Subject: [PATCH 16/32] =?UTF-8?q?=E8=AF=A6=E6=83=85=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=8F=8D=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/result/EmphasisTripListResultDTO.java | 21 +++++++++++++++++++ .../impl/IcTripReportRecordServiceImpl.java | 3 +++ .../mapper/IcTripReportRecordDao.xml | 4 ++++ 3 files changed, 28 insertions(+) diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/EmphasisTripListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/EmphasisTripListResultDTO.java index f44bf4e952..40ce0f9b38 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/EmphasisTripListResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/EmphasisTripListResultDTO.java @@ -22,6 +22,7 @@ public class EmphasisTripListResultDTO implements Serializable { * 来源地 */ private String sourceAddress; + private String sourceDetailAddress; /** * 来曹事由 @@ -68,4 +69,24 @@ public class EmphasisTripListResultDTO implements Serializable { private String remark; + /** + * 返回方式 + */ + private String trafficTypeName; + + /** + * 疫苗接种针次 + */ + private Integer vaccineNum; + + /** + * 交通方式 + */ + private String trafficType; + + /** + * 其他返回方式,交通方式为其他时此列需要有值 + */ + private String trafficTypeExplain; + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java index c7e37d77dd..715d1a63c9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java @@ -759,6 +759,8 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl> sojournMapRes = adminOpenFeignClient.dictDataList(DictTypeEnum.SOJOURN_HISTORY.getCode()); Map sojournMap = sojournMapRes.success() && CollectionUtils.isNotEmpty(sojournMapRes.getData()) ? sojournMapRes.getData().stream().collect(Collectors.toMap(SysDictDataDTO::getDictValue, SysDictDataDTO::getDictLabel)) : new HashMap<>(); + //交通方式 + Map trafficTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.TRAFFIC_TYPE.getCode()).getData(); // 隔离状态字典 Map isolateMap = new HashMap<>(); @@ -768,6 +770,7 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl { l.setIsolateTypeName(isolateMap.get(l.getIsolateType())); l.setSojournHistoryName(sojournMap.get(l.getSojournHistory())); + l.setTrafficTypeName(trafficTypeMap.containsKey(l.getTrafficType()) ? trafficTypeMap.get(l.getTrafficType()) : "无"); }); } return result; diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml index 490810a020..63fa414be6 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml @@ -87,6 +87,10 @@ LEAVE_DATE, PRESENT_ADDRESS, DETAIL_ADDRESS, + IFNULL(source_detail_address,'') AS sourceDetailAddress, + IFNULL(vaccine_num,0) AS vaccineNum, + traffic_type, + IFNULL(traffic_type_explain,'') AS trafficTypeExplain, REMARK, IFNULL(nat_outcome,'0') as natOutcome, (case when nat_outcome = '1' then '阳性' when nat_outcome = '0' then '阴性' else '阴性' end) as natOutComeName From 4c4cc558214ef7cfccae7a73c836b6bafac1aa67 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 9 Nov 2022 15:30:00 +0800 Subject: [PATCH 17/32] =?UTF-8?q?=E8=BF=94=E5=8F=82=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=B8=8A=E6=8A=A5=E4=BA=BA=E5=A7=93=E5=90=8D=EF=BC=8C=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=A2=9E=E5=8A=A0=E9=9A=94=E7=A6=BB=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/IcTripReportRecordDTO.java | 5 ++++ .../epmet/dto/form/PageTripReportFormDTO.java | 5 ++++ .../mapper/IcTripReportRecordDao.xml | 23 +++++++++++++++++-- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java index e81053a3c0..7796f0f5d8 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java @@ -365,4 +365,9 @@ public class IcTripReportRecordDTO implements Serializable { */ @ExcelIgnore private String tripDataTypeName; + /** + * 上报人姓名(createdBy对应人名) + */ + @ExcelIgnore + private String createdByName; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageTripReportFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageTripReportFormDTO.java index 4c2e07b48d..b28e494577 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageTripReportFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageTripReportFormDTO.java @@ -60,4 +60,9 @@ public class PageTripReportFormDTO extends PageFormDTO implements Serializable { */ private String sojournHistory; + /** + * 隔离状态,字典表(isolate_type)【磐石】 + */ + private String isolateType; + } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml index 63fa414be6..eaf72e3c95 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml @@ -7,9 +7,17 @@ From 0f82049a5663003ce9c381808502be892b4bf0b2 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 9 Nov 2022 16:26:02 +0800 Subject: [PATCH 18/32] =?UTF-8?q?=E7=A3=90=E7=9F=B3=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=96=B0=E5=A2=9E=E5=88=97=E8=A1=A8=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E5=9D=87=E5=A2=9E=E5=8A=A07=E5=A4=A9=E9=80=94?= =?UTF-8?q?=E5=BE=84=E5=9C=B0=EF=BC=8C=E5=AF=BC=E5=85=A5=E5=AF=B9=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E6=A1=86=E5=AD=97=E6=AE=B5=E5=80=BC=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/IcTripReportRecordDTO.java | 5 ++ .../epmet/dto/form/IcTripReportFormDTO.java | 4 + .../entity/IcTripReportRecordEntity.java | 4 + .../excel/IcPsTripReportRecordExcel.java | 7 +- .../IcPsTripReportRecordExportExcel.java | 8 +- .../IcPsTripReportExcelImportListener.java | 79 +++++++++++++----- .../IcTripReportExcelImportListener.java | 38 ++++++--- .../V0.0.86__alter_ic_trip_report.sql | 3 + .../excel/ps_trip_report_import_template.xlsx | Bin 10373 -> 10294 bytes 9 files changed, 109 insertions(+), 39 deletions(-) create mode 100644 epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.86__alter_ic_trip_report.sql diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java index 7796f0f5d8..60491f0b17 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java @@ -289,6 +289,11 @@ public class IcTripReportRecordDTO implements Serializable { */ @ExcelIgnore private String registeredResidence; + /** + * 7天内到达或途径【磐石】 + */ + @ExcelIgnore + private String passBy; /** * 来曹事由【磐石】 */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java index 1f2cf09949..65f289cd46 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java @@ -209,6 +209,10 @@ public class IcTripReportFormDTO implements Serializable { */ @NotBlank(message = "户籍地不能为空", groups = {PsAdd.class}) private String registeredResidence; + /** + * 7天内到达或途径【磐石】 + */ + private String passBy; /** * 来曹事由【磐石】 */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcTripReportRecordEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcTripReportRecordEntity.java index 497e0707c6..3ab91a19b5 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcTripReportRecordEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcTripReportRecordEntity.java @@ -139,6 +139,10 @@ public class IcTripReportRecordEntity extends BaseEpmetEntity { * 户籍地 【磐石】 */ private String registeredResidence; + /** + * 7天内到达或途径【磐石】 + */ + private String passBy; /** * 来曹事由【磐石】 */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcPsTripReportRecordExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcPsTripReportRecordExcel.java index 743aa60438..1c442cac62 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcPsTripReportRecordExcel.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcPsTripReportRecordExcel.java @@ -39,6 +39,9 @@ public class IcPsTripReportRecordExcel { @NotBlank(message = "来自地区详细地址不能为空") private String sourceDetailAddress; + @ExcelProperty("7天内到达或途径") + private String passBy; + @ExcelProperty("来曹事由(100字以内)") @NotBlank(message = "来曹事由不能为空") @Length(max = 500,message = "来曹事由不能超过100字") @@ -84,10 +87,10 @@ public class IcPsTripReportRecordExcel { @ExcelProperty("是否达到曹县") private String isArrive; - @ExcelProperty("上报时间\n" + + /*@ExcelProperty("上报时间\n" + "(2022-01-01)") @JsonFormat(pattern = "yyyy-MM-dd") - private Date reportingTime; + private Date reportingTime;*/ @ExcelProperty("管控措施\n" + "(500字以内)") diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcPsTripReportRecordExportExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcPsTripReportRecordExportExcel.java index fd9c52e04a..f036e4a185 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcPsTripReportRecordExportExcel.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcPsTripReportRecordExportExcel.java @@ -55,11 +55,17 @@ public class IcPsTripReportRecordExportExcel implements Serializable { @ColumnWidth(30) @ExcelProperty(value = "来自地区详细地址",order = 6) private String sourceDetailAddress; + /** + * 7天内到达或途径【磐石】 + */ + @ColumnWidth(25) + @ExcelProperty(value = "7天内到达或途径") + private String passBy; /** * 来曹事由(100字以内)【磐石】 */ @ColumnWidth(25) - @ExcelProperty(value = "来曹事由(100字以内)",order = 7) + @ExcelProperty(value = "来曹事由(100字以内)") private String describeContent; /** * 48小时核酸检测 0:阴性 1:阳性 -中国字 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcPsTripReportExcelImportListener.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcPsTripReportExcelImportListener.java index 8fc2a65e39..06cea360b2 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcPsTripReportExcelImportListener.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcPsTripReportExcelImportListener.java @@ -6,17 +6,18 @@ import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.ValidateException; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.constant.IcResiUserConstant; import com.epmet.entity.IcTripReportRecordEntity; import com.epmet.excel.IcPsTripReportRecordExcel; -import com.epmet.excel.data.IcTripReportExcelData; import com.epmet.excel.error.IcPsTripReportRecordErrorExcel; import com.epmet.service.impl.IcTripReportRecordServiceImpl; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; +import java.util.Date; import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; @@ -78,18 +79,45 @@ public class IcPsTripReportExcelImportListener implements ReadListenerxss=+T7YtLaVb?$)^;9U79mp}a zHJwM%KMfwZN*;QmA0@X9Qk9>~>^LsC08=BJv>1`jr5!Qz+!kcEBB*9Ft^JvJ$98V+ zOP1^ajPg&G7O>Y&#YZwyCG!!#+lp5jH1uvux<2-!VVSJf}(0qYb?u zPvPm7(<0{ib;LA3@&58oOUd+pV*I$JF0};K zxGnzhO9TndV%-}J84mCRXeoO4_o#)5I%dWO*C;UCOM6xpA7rt&R*tU23>mq1G<@+~ zn)-!{ny^VftvXYkyr6T#11nn*mv^3Ron2no`hrEb-xnY+jt%+1oQZ6=Wpj;Bzh<->tRg=K(L&db2;{tmZK zNq;?;*OdJ>-pPsTU7gE_uj7xhhN{_fgo5IbLXOMtDOg}euz%t{rIdkL<>s+6X)Tm% z!jni#I&MQAI7eYOjzhvo$>BGjC60*StO7LV8OQhe=ak=NrFCf5)VfHv~Mu~Fk&?%pXWpZoKPCW%qP|gL{dlh?e z3qOs(^?+GZkRMK!HO7#I2cx@qArGWAb?;|b$qn7@G3%_00Q(Cs(tt0NPm}{~yRAMc z8(NNyq%IY!<=QLDzrK1k-+CYCT(>x|UtfYpopV|@)WAC3y~U%I)#A^T!QB9#)fpN3 zDM>0l0}P;j!Xx4O=SKj1?xtO%1y=Dk6PID*UYBNA^{+1EJy*7fh8gkcKD$ADp5T5XZt=!Gr1N-h8*z1pT_ zHO@`VOmdsg##CTHQhg0wI|_0jS+>XZee}T@!mL{sCwJt&V(Q*|q_jOMYDr3YAV{Go zRLX}A?VZ3Wv9;u0evryf|EiA&ROjQO1H|fc(r=K@S-72(jFg((OI|h)I#&0pfuVB- z*c?l&q@;btrO$GaRc_GexD*7m$LX7yQbp4z${4U$MAGr-x?iN2)NJjj;UN7Y)oDVO z6;)LvyKXmS8Xf#2^IOF?rEuutc)IMq*flCiN|B8XL0tX{+bs!4HwL~tMuX)~fop!z ztKDW}UJ&_P&&ed>b(a~4j438y^Vgzd8m7IPuRj*w=-;gdeE`dYVNB614dT}*1fo5p8C8E(O!{UN5|0~W;8 z5WP8jGH&zgP3p`;lBxc($ea42Am9x&S>(WgVE?IhZq%2lBRA}?zn{L7(>gj>;~>{NSs{~&peZEJU96I)T^!1EYwvdl7Va}kqN+0&Yq<`L+p??@9aZP23BW>dxSke1 z_hkQgdU|))!G<-Hc;k6`4dEm!wQUKkTy!rWLoS?aR1V%@?rzhNC7SsQO+D^0wK+!~ z>{jP#efL0)!D^Rlkd$;DB^BfAj-Rb?q4DIJcs<&jHwFA6+~_P~$Sy_6AS>v$HM~Z8 z2FK2-JijhRCSZJsI}|O;By^xUdIl+SN>vv(oiuU~h&)w~g$J-rT0p>_YOma7H7%%u z=nfElG%=!2bmg85*<)zNAFX)5QOt8x%C^gE(Gh2igYug(+wc_kXq1C^aAs9d0RL&{ z@@3vWItM-AQ)e>K;W{AnCFfirZ?&hSJx^rkd!vhErEn42Bt5V)W+Ar06x+m}cIsdI zm5?<(qwl?W4+wDx{;F3Z_eGexCVYDHd&?~_#fZqT-R#Z=6J_c2^ph;6!SKZ>KymJe zr-bsn5@o6Hmd%3Flr$4kDpU7JrWYgfyiJ9M?(-(AcsRI;TxHQ;gvnM;mgOk8Me9q7 zUQ8qSiXoccb{DoLH7sYYU@VHpWXGxo3Z7sp?aH_Cz>@zlTwX0*wTEEo>nX^Zt!Jb> z6DJ@jz_|L(F)U58vZsb$=PzYJM8%AMf?c@199X3^>Pq$KC_-E~1ycX|vvh)JUMt+Y zyehapa+BzCc&%tB=;gtiQ4d=*p_pCCu1WZo7l+Iv8V;6IRvHEoac>g6v$Rn17nNei z^(tK>z(+~P4Z?Y!j!`9u@_VR`Rd_Mx)kf`d9O%c$;j!~d84e3@SOjtOm#R?98^PaP zIu-lXmV2663_RD2l|l<9Vm(VDHB~&TYgfI(zE47+{Yr-L?KaC>9i|TJ0(~p$@JlDZ z!=oOaM6)w_obX8V_Y!EeWYOcC$nGPerq~C-wRcq8y*i?w&45(tx@D=MOkbf9Tt8B} znR_G*!ae}%m!6~m7aBxMrbK+VX04`1Fp0d*T6zxEQ?GSmE*@Xjj43H#L>85+;7F~p z#sRC!podZR>TEZ6?%6Ncez;#{R=tmkdO-Ivw?oUGQ`ks`n?{`M))yi!i2=n#EA*q)2m|7!~$W+Yah^|3X=wKq;6o_kEjvC!YYqEJxO zohTKfb{9(c+7o3VOoEhA8;xbCgx&F^T^aTkC+Q(8)#6D#;g(R`VxTAH(LginDIV{C zdKKZ9xDZd@cdzUw_-~D=xClSuBA))hgs$zS{3)DIa(J$@z&Yw8(YDSw9ozaDAci{x9CW_ThWYY~8UVX=@P3pj&?i>Fq@|Opm~b7b&}h^$aif{kKzy zI7P$jyCno7_g82As8*mG;<9EYLC9vHmmt_u_sq?NXhaKnACkUqj%q9NG|=V>rTDga zk|@WkU_wPFw#OeO7plf-^k^w81#%ftj{g#)J0)u)DezbI8s_KAz{(3%YH8-Y!SuVt zj|%U-*j?dM`ZjkYs2jbx7c5F>1iqLROJRm9%q$K*-0V)ut%?N7}9SZz3^^m~3c z%<}Yfz3uRET<|+BpW$SkC&yce&N4q(pKW@W;N`YXGVGvMBh_*yQPkGnU=?yJ>wuVe zt{Oi*!!AAj>$6vLqtrEu+xBAotnP#rG%}>A9P(1llSBPM>zHj7K&`P8y0@V$TBR?an^)fTo5is z8Grs~1=dBvO}-JjCg-B(T&blKV^@wT(V?0scc;ZmOS`S)u8y}RoZYI$`}=?I)=aQy zZ{RuGj0HK-p;voHKgK3~fAr_6{!ZJ;`+O8U=l~c6Z{Q_hdg7vcrNNy_9f!j3Uq>76 zMv2Zs6u{}w!FH;H;qC=HyB)B1v|klq8e%QgW{kj z-(>2ulgiYh!I}xKS?x|0h{`M4ryMH3Hol%@3<3ao^TE%}+=t_dw8CH42K*Yd?SG;U z9%i+>s9i}O(|%^gJU%FYkIz@%jDC4;Z%c@>J7eSc?$f&0ZvEWW7!ww~?YLb_abU-L z7G)Po`wujd?ZiBIqgMyJDFg=edL?18yJT0IL*d!=(_=A>y>vlqYSo2k7EGP^T(Q85 zpz~Awj)fAeO`rHAPkAHRyV=rwk8EJrW&})YJq8vFVqs$v(IXJrt z-5!Ue?8hF=ccqrIOBzPeDC^n|XLIc2JQN;C-&MQA{`1*Mzkv@d;1cj?Bsl$!_5lk$ z8?7c8Bn_Yr?yA1=;#(Xn3<1x_e+Ngol&M7qF%KHQ0%~br)dKLNG+h(jV2|JW+KVE# zdj<0NQ;WpzMxP@1j%*w7>dQ>h_(fU4)Z$xt94}Lj|FzL+d>J}cXz1T}Z?II!uk58^KA(q3xIRX`J_*1$y=ygh6jHDn>W*UFVEEV$olhaFU zU_yo*}$^YNeIv}XP{@-l=2hab< z6jIrQ6iMFGr&)`%;&#sf}`x=#K^%6`&y>DR3ZKK0Vi$LFpFpIdt3Tj$nWJL2b=ZElSHx1E) z1Ovw9r*qx?VU1V^FNkL!5>Q!Zq?jbbKV1{TRIpT7;D3|(K_`Fq)B~Qv@ofCS? zeN3Q94(;~G_(pbz@2pmwj-_IYw{Pyijb zk@So&_ZHV#cU=)f<Hqr2;_w_Yq=J-%W}w$nm&GQ~IZ7h((Wm4@&;P7%E?h<9D`jt#~#`VuA56hr=S zp+Ghto?2RHN7^m;1Hx#^9@%&Gsg(YsjP4@QA?mrTX0WX^D;< z*>z#R4T7C)@(!!w3PYjY9kNb^on*EJOeWE^!M3E1zE^MyfO}(r+QRK@=p^4}#+QxN zE2gTPm~y2@!`JmzNfO_|IA~1M~60}B?_t|3t;bIohbam_zV=fu+Z_8q@Ly4f3?PIs#kqkeLmCi@1u z)zRt6U6VA~0qkgNDYJ&Tk;ky$hgdWCmVmA5cm1 z(Q>?{ln%G&vU{I=pxGDShxeaMbo;HQ3^@70mc(c*#A04rDTdE1NBMuQ=)FTMia)Jc@&9m<7l{amk{a(S$&4I z3Qt5etMeO=tEILw6*|+J)5utL%3~go8n=cCGfuX#MZ@)VR3$l}=VabF7}lo8=IOR1 z#r4Gzdj|U7HEaDqxy@m+(e9x|B5%uFuP%arQm;Bn4V1-}JTU75AWet#>F?rE2P0po ze+D0}60Dr%_sh9#)!qjvYV>Q+XWRRVDHoBBZ-@sWJD=@-;ny>Jo!m83_=>5bJFRc) z`9rF%hvY6RAGxik5_k8%eH+TpLO%V>;e&d;X)hgCBzY$m7>~HUEc*Th{RLNgbBn43 zkw=9i*$>*wf2{88{X#OLai4TyPBD8qgakjn1im0! zWJ{{Gmvr}$8f*&X1M)3otB&tj?Kx?{O&QY&!@JpZo=D^*7;bKN-ddyFBErQ~ zP;^z^9)aLLjhwVrFR*Xhxye7RjZ8u9rQEtMw7}Rk1Pk_y2xIFuBRwUxt84FCJ|zfb zfc=dS0D^-T_1S@}fp8gL-4f`{@gVF+p~5L3U{>THN3rWCTok|kEABv1s@bjzMm<0Q z=S(z*qEYP3{1h4J=`~{Z!`}$?9pd~+$(-;MYISqm^3mB9z`OeSs=B*W_<%Drz_XLT z(%UJIt~1rSW?6iA(fRt(ruWE?`<>O!pA>0;Z$0ay`Dx9)d3^3WgheEsB^mu|=j_hX zxw%{7?eoYeLh(S%+azG&)7~Dhx@rk-F`TY@i*MgiT)1SsDvE$6;^Mc>`pMfDeWxAz z-`@_xS)k9iDnJC(~n5kh|`{Sw+xf7PJkH+HS)8ImF&Z^#Mnh zQGX+F#t^5Bqe8>$J)Md?^*(Jsc!^!b$&#m;MDMP4?NWNNP@{a2JL% zb{Lbmc_7&IS8kL@>T}5--!=Xw0#p3%J5iSd#%|9+)cY644o1epC1XB)Okj*qa1|S~ z5#)Vl=G)QC%FU`|@D4HQ!F_h|r-A;Qxw#yDtpe&;{n4r^etZo2r5xHnbYq&4o}|$D zwarcZT7K!)H45bRGhwdn>hGHsOz9%?GV6}xR(B*oXl+*LDcGkrgvZkn&{Z@eS4f0N znxhIt{S@mhp8BR#)6C02YC^%LycAr6AYpmtAwHd1E56L?XR0vrJit#9e5dwUfT*pI z7Z+yz3*~_}Rvd$zPRqDQ*6C0Ad9q39AbdW$6hPfACj50&X+3kt1|9h>Sbr1T1NWgX272-m$n1d|C1-k6DB2ryf}S_h z9Lk}7dXI5tEcYDsy(?2}t~nQ)j>B*{4^;0ReE#< z{+b9WZ64HCo(o0|ztKpMkCgxCPx8;;AHRIX4&C_^MVAnEh)B# zOlAKGBAu=ia#TF*H0=11T?b>6jEz`&vI|0hX2=Ig*)OcC@=x@$(g>Up_(y5-sRLvK z-{?EA2}tBq<+2+WQ2wE99_8O0HzRBBgO-O%umNx0vqRb5Jg4jbG#jB?A{uDbUl=sM z&CoZD*yJ$}P*s^!)BX^m`X^z_#JtNZzMZLSlH6bU*ZJq062HikDju;>I(`W3&z>24 zZ8WGfg*m&Fp`DLlTC7ADWLiBW3RPAIO{Sf=-|#(kp}r|>yI@xhGYAm7b#t;TF|K*> z6%P?$msR-bzWrcClIHW`?P4f-=S5~J&-7xgQ@h9ZBL2H)Jwc)M4c>KGqIt|kdjWzI zD^CxWA1!{hm8-NN9{ivy+^T|rM_M;YH|944$cG$nyu+m3OS+!fj01|(@KD^KthcY9 z!DQLB-X*!+8|6N&-Xgv<8O4UMda*7vo&}gxi0#&$=4@yy^Z&xAXB)2&)A3|NOphz~ zD{Y|Ax;30uBG^mPppD7Bd15fFK}R~G13mFdciO!tm0=Z@bdm80r0rr8G(9zsdgKZW_6@pt;bD$Zyvb! zl38FX7>TrfUim#R=tl8h{?MQ0N+>H$%`2qr)mLMB2|67ggIDKnui`CuDX2cG#6(0y zk$&#kGr&oje+myumw68|d#~~i$IV@h{~jGKwCX+r!Z1fSJ%62KeR#$rY(dYPvvqEy zRigPzO}6WNceOTr+}q+mA~=8XgH6=PlKJgw5Iqpd63Nbs(ZYP28(IF4MY^K+ zb}>C2tyId#gBqS649PXVeUAFZy1Z8~p(R-fYfrqNg9!-TwYRxgTkly#G2v$fN$+5$vb$~|{3|PM9XGuCTzhZ!$NwrPa zR~>8^J=}sb2PmvCDKDlZ!nHepN25DuZWI-SgegliFoV=Mf9C+!(+>n#r=~Gz+du#(slZ}F-Ywa z+36FhfYQ%5=btqBjyLz?=HLU%JzcCO{(D^q-&Fqa=tAGDJaUgqiDTgTnpHA4|6A{s zzK>yxq{U6MZPvm`BA3Z7I{om!l1_H7Fn*u4YVU0y4xc^hu mKT6^Lk5@DO4*=%HW{PTnrlug3_kNh7?$w>tO From 69f8a3e9db2f5d67f9899ea8d1a3d738b9f72d7b Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 9 Nov 2022 16:34:52 +0800 Subject: [PATCH 19/32] =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/controller/IcTripReportRecordController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java index 354c3be87c..0e149ed9df 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java @@ -469,7 +469,7 @@ public class IcTripReportRecordController implements ResultDataResolver { } /** - * @Description 重点行程详情 + * @Description 可视化重点行程名单统计-详情 已废弃不用这个接口了,改用管理平台详情 * @param formDTO * @Author zxc * @Date 2022/11/1 16:05 From f7bd7b655b862596cd44a08b0ae416e57feafc00 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 9 Nov 2022 17:27:51 +0800 Subject: [PATCH 20/32] =?UTF-8?q?=E6=94=B9=E4=B8=80=E4=B8=8B=E6=B5=8B?= =?UTF-8?q?=E7=A3=90=E7=9F=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/commons/tools/constant/StrConstant.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java index fb294721f8..77e9d4fa8f 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java @@ -100,7 +100,8 @@ public interface StrConstant { //平音客户跟组织Id String PY_ROOT_AGENCY = "53613e1c5de6ed473467f0159a10b135"; //磐石街道客户Id - String PS_CUSTOMER_ID = "1580460084738760705"; + //String PS_CUSTOMER_ID = "1580460084738760705"; + String PS_CUSTOMER_ID = "45687aa479955f9d06204d415238f7cc"; /** * 单位积分,积分上限,积分说明,积分事件 From 25507d8f1ed70ea595bef2c83609185161fd95f2 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 10 Nov 2022 09:52:11 +0800 Subject: [PATCH 21/32] =?UTF-8?q?=E7=A3=90=E7=9F=B3=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=97=B6=E9=BB=98=E8=AE=A4=E8=B5=8B=E5=80=BC=E4=B8=8A=E6=8A=A5?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/service/impl/IcTripReportRecordServiceImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java index 715d1a63c9..06ae46b36a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java @@ -203,6 +203,7 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl Date: Thu, 10 Nov 2022 10:08:30 +0800 Subject: [PATCH 22/32] =?UTF-8?q?=E7=A3=90=E7=9F=B3=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E8=90=BD=E5=9C=B0=E6=A3=80=E6=98=AF=E5=90=A6=E5=88=B0=E8=BE=BE?= =?UTF-8?q?=E6=9B=B9=E5=8E=BF=E6=94=B9=E4=B8=BA=E9=9D=9E=E5=BF=85=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../handler/IcPsTripReportExcelImportListener.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcPsTripReportExcelImportListener.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcPsTripReportExcelImportListener.java index 06cea360b2..2715302612 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcPsTripReportExcelImportListener.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcPsTripReportExcelImportListener.java @@ -84,31 +84,31 @@ public class IcPsTripReportExcelImportListener implements ReadListener Date: Thu, 10 Nov 2022 10:52:01 +0800 Subject: [PATCH 23/32] =?UTF-8?q?=E5=A7=93=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/IcTripReportRecordDao.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml index eaf72e3c95..0a5b35e2f5 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml @@ -10,7 +10,7 @@ r.CREATED_TIME AS reportTime, ( CASE - WHEN r.USER_TYPE = 'resi' THEN IFNULL(ubi.`NAME`, '无') + WHEN r.USER_TYPE = 'resi' THEN IFNULL(ubi.REAL_NAME, '无') ELSE IFNULL(cs.REAL_NAME, '无') END ) AS createdByName @@ -40,7 +40,7 @@ r.MOBILE as realMobile, ( CASE - WHEN r.USER_TYPE = 'resi' THEN IFNULL(ubi.`NAME`, '无') + WHEN r.USER_TYPE = 'resi' THEN IFNULL(ubi.REAL_NAME, '无') ELSE IFNULL(cs.REAL_NAME, '无') END ) AS createdByName From 88e941fdcfc2602819320e0359dd577b98ce8009 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 10 Nov 2022 12:43:46 +0800 Subject: [PATCH 24/32] =?UTF-8?q?=E6=9C=AA=E5=81=9A=E6=A0=B8=E9=85=B8?= =?UTF-8?q?=E6=AF=94=E5=AF=B9=E8=B0=83=E6=95=B4=E6=94=B9=E4=B8=BA=E8=A7=86?= =?UTF-8?q?=E5=9B=BE=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...IcNatCompareRecordExcelImportListener.java | 125 ++++++++++++++++-- .../impl/IcNatCompareRecordServiceImpl.java | 13 +- 2 files changed, 128 insertions(+), 10 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatCompareRecordExcelImportListener.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatCompareRecordExcelImportListener.java index 44ed565c6e..265d492107 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatCompareRecordExcelImportListener.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatCompareRecordExcelImportListener.java @@ -5,9 +5,6 @@ import com.alibaba.excel.read.listener.ReadListener; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; -import com.epmet.commons.tools.dto.result.YtHscyResDTO; -import com.epmet.commons.tools.dto.result.YtHsjcResDTO; -import com.epmet.commons.tools.dto.result.YtHsjcResDetailDTO; import com.epmet.commons.tools.enums.EnvEnum; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.ExceptionUtils; @@ -15,18 +12,17 @@ import com.epmet.commons.tools.exception.ValidateException; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.ObjectUtil; -import com.epmet.commons.tools.utils.YtHsResUtils; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.entity.IcNatCompareRecordEntity; import com.epmet.excel.data.IcNatCompareRecordExcelData; import com.epmet.service.impl.IcNatCompareRecordServiceImpl; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; +import java.util.*; /** * @Description @@ -60,16 +56,22 @@ public class IcNatCompareRecordExcelImportListener implements ReadListener args = new HashMap<>(); + args.put("idcard", data.getIdCard()); + List> hscyList = yantaiNamedParamLantuJdbcTemplate.queryForList( + "select id, name,card_no, create_time, realname from hscyxxb where card_no =:idcard order by create_time desc limit 1", args); + + if (CollectionUtils.isNotEmpty(hscyList) && MapUtils.isNotEmpty(hscyList.get(0))) { + // 存在 最近一条采样记录 + Map latestCyMap = hscyList.get(0); + String create_time = (String) latestCyMap.get("create_time"); + if (StringUtils.isBlank(create_time)) { + // 最近一次采样时间为空,说明这人好久不做核酸了 + compareRecordEntity.setInternalRemark("采样时间create_time is null"); + } else { + // 赋值采样时间 + compareRecordEntity.setLatestCyTime(DateUtils.parse(create_time, DateUtils.DATE_TIME_PATTERN)); + // 查询最后一次检测结果 + List> hsjcResultList = yantaiNamedParamLantuJdbcTemplate.queryForList( + "select name, telephone, card_no, test_time, SAMPLE_TIME, SAMPLE_RESULT_PCR, SAMPLING_ORG_PCR from hsjcxxb where card_no =:idcard order by test_time desc limit 1", args); + + if (CollectionUtils.isNotEmpty(hsjcResultList) && MapUtils.isNotEmpty(hsjcResultList.get(0))) { + Map latestJcMap = hsjcResultList.get(0); + // 采样时间 + String sample_time = (String) latestJcMap.get("SAMPLE_TIME"); + // 检测时间 + String test_time = (String) latestJcMap.get("test_time"); + // 核酸采样机构 + String sampling_org_pcr = (String) latestJcMap.get("SAMPLING_ORG_PCR"); + // 核酸检测结果 1:阳性,2:阴性 + String sample_result_pcr = (String) latestJcMap.get("SAMPLE_RESULT_PCR"); + // 联系地址 + String address = (String) latestJcMap.get("address"); + + // 最近一次采样时间,与最近一次检测结果的采样时间相比较 + if (compareRecordEntity.getLatestCyTime().equals(sample_time)) { + // 一致说明出结果了 + if (StringUtils.isNotBlank(test_time)) { + // 赋值最近一次核酸时间 + compareRecordEntity.setLatestNatTime(DateUtils.parse(test_time, DateUtils.DATE_TIME_PATTERN)); + } + // 赋值检测地点 + compareRecordEntity.setNatAddress(StringUtils.isNotBlank(sampling_org_pcr) ? sampling_org_pcr : StrConstant.EPMETY_STR); + + // 核酸检测结果 1:阳性,2:阴性 + if (NumConstant.ONE_STR.equals(sample_result_pcr)) { + // 检测结果(0:阴性 1:阳性):接口填入 + compareRecordEntity.setNatResult(NumConstant.ONE_STR); + } else if (NumConstant.TWO_STR.equals(sample_result_pcr)) { + compareRecordEntity.setNatResult(NumConstant.ZERO_STR); + } + compareRecordEntity.setContactAddress(StringUtils.isNotBlank(address) ? address : StrConstant.EPMETY_STR); + } else { + // 采样时间不一致,说明未出结果 + compareRecordEntity.setInternalRemark(String.format("采样时间不一致,采样视图最近一次采样时间:%s,检测结果视图的最近一次采样时间:%s", compareRecordEntity.getLatestCyTime(), sample_time)); + } + } else { + compareRecordEntity.setInternalRemark("最近一次检测结果为空"); + } + } + } else { + // 没有核酸采样记录 + compareRecordEntity.setInternalRemark("最近一次采样结果为空"); + } + } + datas.add(compareRecordEntity); + if (datas.size() == MAX_THRESHOLD) { execPersist(); } @@ -159,6 +265,7 @@ public class IcNatCompareRecordExcelImportListener implements ReadListener Date: Thu, 10 Nov 2022 13:53:03 +0800 Subject: [PATCH 25/32] . --- .../java/com/epmet/commons/tools/constant/StrConstant.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java index 77e9d4fa8f..fb294721f8 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java @@ -100,8 +100,7 @@ public interface StrConstant { //平音客户跟组织Id String PY_ROOT_AGENCY = "53613e1c5de6ed473467f0159a10b135"; //磐石街道客户Id - //String PS_CUSTOMER_ID = "1580460084738760705"; - String PS_CUSTOMER_ID = "45687aa479955f9d06204d415238f7cc"; + String PS_CUSTOMER_ID = "1580460084738760705"; /** * 单位积分,积分上限,积分说明,积分事件 From 28ccffcabcdc456c0372ba685028a767bae8b5c6 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 10 Nov 2022 14:49:24 +0800 Subject: [PATCH 26/32] address --- .../excel/handler/IcNatCompareRecordExcelImportListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatCompareRecordExcelImportListener.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatCompareRecordExcelImportListener.java index 265d492107..d163fc0192 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatCompareRecordExcelImportListener.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatCompareRecordExcelImportListener.java @@ -195,7 +195,7 @@ public class IcNatCompareRecordExcelImportListener implements ReadListener> hsjcResultList = yantaiNamedParamLantuJdbcTemplate.queryForList( - "select name, telephone, card_no, test_time, SAMPLE_TIME, SAMPLE_RESULT_PCR, SAMPLING_ORG_PCR from hsjcxxb where card_no =:idcard order by test_time desc limit 1", args); + "select name, telephone, card_no, address, test_time, SAMPLE_TIME, SAMPLE_RESULT_PCR, SAMPLING_ORG_PCR from hsjcxxb where card_no =:idcard order by test_time desc limit 1", args); if (CollectionUtils.isNotEmpty(hsjcResultList) && MapUtils.isNotEmpty(hsjcResultList.get(0))) { Map latestJcMap = hsjcResultList.get(0); From ae8e8b9db5455f4817096b023bc85ce639275a02 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 10 Nov 2022 15:13:55 +0800 Subject: [PATCH 27/32] getExistUserByHouseIds --- .../src/main/resources/mapper/IcResiUserDao.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml index 9c48f39c2f..aba350f712 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml @@ -824,6 +824,7 @@ DISTINCT home_id FROM ic_resi_user WHERE DEL_FLAG = '0' + and STATUS='0' AND home_id IN ( #{id} From 0dc98744403548d89c56d9b4c5095a0f55b238b4 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Thu, 10 Nov 2022 18:12:24 +0800 Subject: [PATCH 28/32] =?UTF-8?q?=E6=97=B6=E9=97=B4=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IcNatCompareRecordExcelImportListener.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatCompareRecordExcelImportListener.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatCompareRecordExcelImportListener.java index d163fc0192..531e977ea7 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatCompareRecordExcelImportListener.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatCompareRecordExcelImportListener.java @@ -186,13 +186,13 @@ public class IcNatCompareRecordExcelImportListener implements ReadListener latestCyMap = hscyList.get(0); - String create_time = (String) latestCyMap.get("create_time"); - if (StringUtils.isBlank(create_time)) { + Date create_time = (Date) latestCyMap.get("create_time"); + if (create_time == null) { // 最近一次采样时间为空,说明这人好久不做核酸了 compareRecordEntity.setInternalRemark("采样时间create_time is null"); } else { // 赋值采样时间 - compareRecordEntity.setLatestCyTime(DateUtils.parse(create_time, DateUtils.DATE_TIME_PATTERN)); + compareRecordEntity.setLatestCyTime(create_time); // 查询最后一次检测结果 List> hsjcResultList = yantaiNamedParamLantuJdbcTemplate.queryForList( "select name, telephone, card_no, address, test_time, SAMPLE_TIME, SAMPLE_RESULT_PCR, SAMPLING_ORG_PCR from hsjcxxb where card_no =:idcard order by test_time desc limit 1", args); @@ -200,9 +200,9 @@ public class IcNatCompareRecordExcelImportListener implements ReadListener latestJcMap = hsjcResultList.get(0); // 采样时间 - String sample_time = (String) latestJcMap.get("SAMPLE_TIME"); + Date sample_time = (Date) latestJcMap.get("SAMPLE_TIME"); // 检测时间 - String test_time = (String) latestJcMap.get("test_time"); + Date test_time = (Date) latestJcMap.get("test_time"); // 核酸采样机构 String sampling_org_pcr = (String) latestJcMap.get("SAMPLING_ORG_PCR"); // 核酸检测结果 1:阳性,2:阴性 @@ -213,9 +213,9 @@ public class IcNatCompareRecordExcelImportListener implements ReadListener Date: Fri, 11 Nov 2022 08:42:06 +0800 Subject: [PATCH 29/32] =?UTF-8?q?getExistUserByHouseIds=20=E6=81=A2?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/IcResiUserDao.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml index aba350f712..9c48f39c2f 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml @@ -824,7 +824,6 @@ DISTINCT home_id FROM ic_resi_user WHERE DEL_FLAG = '0' - and STATUS='0' AND home_id IN ( #{id} From f57a120d0f2e877bd40e2e20e8bf4f971506db0f Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 11 Nov 2022 15:17:22 +0800 Subject: [PATCH 30/32] =?UTF-8?q?=E7=96=AB=E8=8B=97=E6=8E=A5=E7=A7=8D?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=A2=9E=E5=8A=A0=E6=98=AF=E5=90=A6=E6=9C=AC?= =?UTF-8?q?=E8=BE=96=E5=8C=BA=E5=B1=85=E6=B0=91=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/IcVaccineRelationDTO.java | 5 +++++ .../epmet/dto/result/IcVaccineListResultDTO.java | 7 +++++++ .../com/epmet/entity/IcVaccineRelationEntity.java | 5 +++++ .../epmet/service/impl/IcVaccineServiceImpl.java | 15 ++++++++------- .../V0.0.87__alter_ic_vaccine_relation.sql | 5 +++++ .../src/main/resources/mapper/IcVaccineDao.xml | 3 ++- 6 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.87__alter_ic_vaccine_relation.sql diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcVaccineRelationDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcVaccineRelationDTO.java index 7939293b5b..5fcb403a1e 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcVaccineRelationDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcVaccineRelationDTO.java @@ -50,6 +50,11 @@ public class IcVaccineRelationDTO implements Serializable { */ private String userType; + /** + * 是否本辖区居民,1:是;0:否 + */ + private String isLocalResiUser; + /** * 删除标识 */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcVaccineListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcVaccineListResultDTO.java index 87480268cf..1764d1c61c 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcVaccineListResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcVaccineListResultDTO.java @@ -85,5 +85,12 @@ public class IcVaccineListResultDTO implements Serializable { @ExcelProperty(value = "疫苗厂家",order = 7) private String manufacturer; + /** + * 是否本辖区居民,1:是;0:否 + */ + @ExcelIgnore + private String isLocalResiUser; + + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcVaccineRelationEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcVaccineRelationEntity.java index d4cfb6ad48..cbacf0b140 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcVaccineRelationEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcVaccineRelationEntity.java @@ -49,4 +49,9 @@ public class IcVaccineRelationEntity extends BaseEpmetEntity { */ private String userType; + /** + * 是否本辖区居民,1:是;0:否 + */ + private String isLocalResiUser; + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineServiceImpl.java index 6d183807ab..cdb0e2348b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineServiceImpl.java @@ -23,10 +23,7 @@ import com.epmet.dao.IcVaccineDao; import com.epmet.dao.IcVaccineRelationDao; import com.epmet.dto.IcVaccineDTO; import com.epmet.dto.form.*; -import com.epmet.dto.result.IcVaccineListResultDTO; -import com.epmet.dto.result.LoginUserDetailsResultDTO; -import com.epmet.dto.result.UploadImgResultDTO; -import com.epmet.dto.result.VaccineListDTO; +import com.epmet.dto.result.*; import com.epmet.entity.IcResiUserEntity; import com.epmet.entity.IcVaccineEntity; import com.epmet.entity.IcVaccineRelationEntity; @@ -369,7 +366,7 @@ public class IcVaccineServiceImpl extends BaseServiceImpl query = new LambdaQueryWrapper<>(); @@ -440,6 +437,7 @@ public class IcVaccineServiceImpl extends BaseServiceImpl #{endTime} - AND b.IS_RESI_USER = #{isResiUser} + AND a.is_local_resi_user = #{isResiUser} ORDER BY b.INOCULATE_TIME DESC, b.id ASC From 9cce2df712da319ab52aa3a99827393dc45fd0e5 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 11 Nov 2022 17:49:29 +0800 Subject: [PATCH 31/32] =?UTF-8?q?=E5=8E=86=E5=8F=B2=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=B5=8B=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/controller/IcVaccineController.java | 7 +++ .../main/java/com/epmet/dao/IcVaccineDao.java | 6 +++ .../com/epmet/service/IcVaccineService.java | 2 + .../service/impl/IcVaccineServiceImpl.java | 45 +++++++++++++++++++ .../main/resources/mapper/IcVaccineDao.xml | 42 +++++++++++++++++ 5 files changed, 102 insertions(+) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccineController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccineController.java index 8c742919a7..cf78a5535a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccineController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccineController.java @@ -277,5 +277,12 @@ public class IcVaccineController implements ResultDataResolver { return new Result<>(); } + @PostMapping("initVaccineLocal") + public Result initVaccineLocal(){ + icVaccineService.initVaccineLocal(); + return new Result(); + } + + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineDao.java index 55b4591be3..c081011f88 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineDao.java @@ -7,6 +7,7 @@ import com.epmet.dto.form.MyNatListFormDTO; import com.epmet.dto.form.VaccineListFormDTO; import com.epmet.dto.result.IcVaccineListResultDTO; import com.epmet.dto.result.MyNatListResultDTO; +import com.epmet.dto.result.RelationAndNatResultDTO; import com.epmet.entity.IcVaccineEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -72,4 +73,9 @@ public interface IcVaccineDao extends BaseDao { */ List getVaccineListByIdCard(@Param("idCard") String idCard,@Param("time") String time); + List initVaccineLocal(); + + void updateRelation(List list); + + void updateRelationOther(@Param("isLocalResiUser") String isLocalResiUser); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcVaccineService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcVaccineService.java index c89b5f2db4..609297b255 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcVaccineService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcVaccineService.java @@ -68,4 +68,6 @@ public interface IcVaccineService extends BaseService { void edit(AddIcVaccineFormDTO formDTO); void del(IcVaccineFormDTO formDTO); + + void initVaccineLocal(); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineServiceImpl.java index cdb0e2348b..0d6b3418bd 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineServiceImpl.java @@ -18,6 +18,7 @@ import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.utils.*; import com.epmet.constants.ImportTaskConstants; +import com.epmet.dao.IcNatDao; import com.epmet.dao.IcResiUserDao; import com.epmet.dao.IcVaccineDao; import com.epmet.dao.IcVaccineRelationDao; @@ -79,6 +80,8 @@ public class IcVaccineServiceImpl extends BaseServiceImpl pageInfo = PageHelper.startPage(no, NumConstant.ONE_THOUSAND).doSelectPageInfo(() -> baseDao.initVaccineLocal()); + List list = pageInfo.getList(); + size = list.size(); + if (CollectionUtils.isNotEmpty(list)){ + List users = icNatDao.getResiByIdCards(list.stream().map(m -> m.getIdCard()).distinct().collect(Collectors.toList())); + if (CollectionUtils.isNotEmpty(users)){ + for (RelationAndNatResultDTO l : list) { + for (IcResiUserEntity u : users) { + if (l.getStaffAgencyIdPath().contains(u.getAgencyId())){ + l.setIsLocalResiUser(NumConstant.ONE_STR); + break; + } + } + } + updateRelation(list,NumConstant.ONE_STR); + } + } + no++; + }while (size == NumConstant.ONE_THOUSAND); + // 其他类型的userType直接是居民的组织信息,所以直接赋值 is_local_resi_user = '1' + updateRelation(null,NumConstant.TWO_STR); + log.error("/epmetuser/icNat/initNatLocal更新核酸检测记录关系表,是否是本辖区居民标志 end"); + } + + @Transactional(rollbackFor = Exception.class) + public void updateRelation(List list,String type){ + if (NumConstant.ONE_STR.equals(type)){ + if (CollectionUtils.isNotEmpty(list)){ + baseDao.updateRelation(list); + } + }else { + baseDao.updateRelationOther("1"); + baseDao.updateRelationOther("0"); + } + } + } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineDao.xml index d4a58ec8a9..a580d72a00 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineDao.xml @@ -184,4 +184,46 @@ and ID_CARD = #{idCard} and DATE_FORMAT( INOCULATE_TIME, '%Y-%m-%d' ) = #{time} + + + + + UPDATE ic_vaccine_relation + + + + when ID = #{l.relationId} then #{l.isLocalResiUser} + + + updated_time = NOW() + + WHERE ID IN( + + #{l.relationId} + ) + + + UPDATE ic_vaccine_relation a + INNER JOIN ic_vaccine b ON a.ic_vaccine_id = b.id + set a.is_local_resi_user = #{isLocalResiUser}, + a.updated_time = NOW() + where a.user_type != 'import' + + and b.USER_ID is not null + and b.USER_ID != '' + + + and (b.USER_ID is null or b.USER_ID ='') + + From d02b0fb6509b914dde0710ac988f373a7e62677d Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 14 Nov 2022 09:03:40 +0800 Subject: [PATCH 32/32] =?UTF-8?q?=E6=98=AF=E5=90=A6=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E5=B1=85=E6=B0=91=E7=9A=84pids=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/service/impl/IcNatServiceImpl.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java index fe452ead61..8d0486a925 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java @@ -703,28 +703,28 @@ public class IcNatServiceImpl extends BaseServiceImpl imp /** * 创建nat关系 * @param natId - * @param currentUserAgencyId 居民所属组织 + * @param currentResiAgencyId 居民所属组织 * @param staffAgencyId 工作人员所属组织 * @param agencyPids 工作人员所属组织路径 */ - private void createNatRelation(String natId, String currentUserAgencyId, String agencyPids,String staffAgencyId) { + private void createNatRelation(String natId, String currentResiAgencyId, String agencyPids,String staffAgencyId) { // 没有关系创建关系,有关系就跳过 // 2022-10-25 修改:不管是不是本辖区居民,都创建关系,用 is_local_resi_user区分是不是本辖区居民 // 组织ID都改成工作人员所属组织ID LambdaQueryWrapper query = new LambdaQueryWrapper<>(); query.eq(IcNatRelationEntity::getIcNatId, natId); - query.eq(IcNatRelationEntity::getAgencyId, currentUserAgencyId); + query.eq(IcNatRelationEntity::getAgencyId, currentResiAgencyId); if (icNatRelationDao.selectCount(query) > 0) { return; } IcNatRelationEntity relation = new IcNatRelationEntity(); - relation.setAgencyId(currentUserAgencyId); - relation.setPids(String.join(":", Arrays.asList(agencyPids, currentUserAgencyId))); + relation.setAgencyId(currentResiAgencyId); + relation.setPids(String.join(":", Arrays.asList(agencyPids, staffAgencyId))); relation.setIcNatId(natId); relation.setUserType("import"); - relation.setIsLocalResiUser(agencyPids.contains(currentUserAgencyId) ? NumConstant.ONE_STR : NumConstant.ZERO_STR); + relation.setIsLocalResiUser(agencyPids.contains(currentResiAgencyId) ? NumConstant.ONE_STR : NumConstant.ZERO_STR); icNatRelationDao.insert(relation); }