From 6dea7ca5ae5f28208199e989d102d6e5cd0d6fd7 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Wed, 2 Nov 2022 14:25:40 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E8=A7=86?= =?UTF-8?q?=E5=9B=BE=E6=9F=A5=E8=AF=A2=E6=A0=B8=E9=85=B8=E9=87=87=E6=A0=B7?= =?UTF-8?q?-=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/DataSyncConfigServiceImpl.java | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) 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 bb72f987a6..a72a56edeb 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 @@ -12,6 +12,7 @@ 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.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.bean.AgencyInfoCache; @@ -39,12 +40,15 @@ import org.apache.commons.collections4.CollectionUtils; 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.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; import java.util.*; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; +import java.util.function.Function; import java.util.stream.Collectors; /** @@ -72,6 +76,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); + } + } + + /** + * 50个一批,来处理他们的核酸信息,太多怕给数据库查崩了。 + * @param resiInfos + * @param customerId + * @param isSync + */ + public void yantaiHsjcByDbViewBatch(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) + "''"; + // 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); + // 这一批居民的核酸采样列表 + List> hscyList = yantaiJdbcTemplate.queryForList(sql, args); + if (CollectionUtils.isNotEmpty(hscyList)) { + List entities = new ArrayList<>(); + hscyList.forEach(sampleInfo -> { + // 从视图中获取到的核酸采样相关信息 + String name = (String) sampleInfo.get("name"); + String cardNo = (String) sampleInfo.get("card_no"); + Date createTime = (Date) sampleInfo.get("create_time"); + + // 本地数据库中,居民信息 + 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.setMobile(""); + e.setUserType(isSync.equals(NumConstant.ONE_STR) ? "manualSync" : "sync"); + e.setName(StringUtils.isNotBlank(name) ? name : ""); + e.setIdCard(StringUtils.isNotBlank(cardNo) ? cardNo : ""); + e.setSampleTime(createTime); + // e.setSampleTime(DateUtils.parseDate(createTime, DateUtils.DATE_TIME_PATTERN)); + e.setAgencyId(currentResiInfo.getAgencyId()); + e.setPids(currentResiInfo.getPids()); + e.setAttachmentType(""); + e.setAttachmentUrl(""); + entities.add(e); + }); + if (CollectionUtils.isNotEmpty(entities)){ + List existSampleInfo = icNatDao.getExistNatInfo(entities); + sampleAndNat(existSampleInfo,entities,NumConstant.ONE_STR,customerId,isSync); + } + } + } } From d4d9bd6f3a81b676fb09d09e7a54c0cfc3cdf4a2 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 3 Nov 2022 11:08:42 +0800 Subject: [PATCH 2/9] =?UTF-8?q?/heart/icpartyunit/list=20=E8=81=94?= =?UTF-8?q?=E5=BB=BA=E5=8D=95=E4=BD=8D=E5=88=97=E8=A1=A8=E6=9C=AC=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E5=8F=8A=E4=B8=8B=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/form/PartyUnitFormDTO.java | 5 +++ .../controller/IcPartyUnitController.java | 18 +++++++---- .../java/com/epmet/dao/IcPartyUnitDao.java | 8 +++++ .../service/impl/IcPartyUnitServiceImpl.java | 11 +++++-- .../main/resources/mapper/IcPartyUnitDao.xml | 31 +++++++++++++++++++ 5 files changed, 64 insertions(+), 9 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PartyUnitFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PartyUnitFormDTO.java index cf7841d93e..ec4a1751dd 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PartyUnitFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PartyUnitFormDTO.java @@ -24,4 +24,9 @@ public class PartyUnitFormDTO implements Serializable { private String contactMobile; private Integer pageNo; private Integer pageSize; + + /** + * 工作端当前登录人员 + */ + private String currentStaffId; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java index 95093177cb..8a0ba036ff 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java @@ -3,6 +3,7 @@ package com.epmet.controller; import com.epmet.commons.rocketmq.messages.ServerSatisfactionCalFormDTO; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.dto.result.OptionDataResultDTO; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.RenException; @@ -16,10 +17,6 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.constants.ImportTaskConstants; import com.epmet.dto.IcPartyUnitDTO; -import com.epmet.dto.form.ImportTaskCommonFormDTO; -import com.epmet.dto.form.PartyActivityFormDTO; -import com.epmet.dto.form.PartyUnitFormDTO; -import com.epmet.dto.form.PartyUnitListFormDTO; import com.epmet.dto.form.*; import com.epmet.dto.form.demand.ServiceQueryFormDTO; import com.epmet.dto.result.*; @@ -37,12 +34,10 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import javax.validation.Valid; import java.io.IOException; import java.nio.file.Path; import java.util.ArrayList; import java.util.List; -import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; @@ -70,9 +65,20 @@ public class IcPartyUnitController { private Path IC_PARTY_UNIT_UPLOAD_DIR; + /** + * 联建单位-列表查询 + * 本组织及下级数据 + * @param tokenDto + * @param formDTO + * @return + */ @PostMapping("list") public Result> search(@LoginUser TokenDto tokenDto, @RequestBody PartyUnitFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); + //工作端调用的话,赋值当前登录用户id + if(AppClientConstant.APP_GOV.equals(tokenDto.getApp())){ + formDTO.setCurrentStaffId(tokenDto.getUserId()); + } PageData page = icPartyUnitService.search(formDTO); return new Result>().ok(page); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPartyUnitDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPartyUnitDao.java index 0c02e737b7..e0cb649327 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPartyUnitDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPartyUnitDao.java @@ -19,6 +19,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.tools.dto.result.OptionDataResultDTO; +import com.epmet.dto.form.PartyUnitFormDTO; import com.epmet.dto.form.PartyUnitListbriefFormDTO; import com.epmet.dto.result.PartyTypepercentResultDTO; import com.epmet.dto.result.PartyUnitDistributionResultDTO; @@ -116,4 +117,11 @@ public interface IcPartyUnitDao extends BaseDao { @Param("customerId") String customerId); List selectByIds(@Param("partyUnitIds") List partyUnitIds); + + /** + * 联建单位-分页列表查询 + * @param formDTO + * @return + */ + List pageList(PartyUnitFormDTO formDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java index 304705ac2d..71711ea98e 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java @@ -77,7 +77,6 @@ import org.apache.http.entity.ContentType; import org.apache.poi.ss.usermodel.Workbook; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.commons.CommonsMultipartFile; @@ -119,7 +118,7 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl search(PartyUnitFormDTO formDTO) { PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + /*LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(IcPartyUnitEntity::getAgencyId, formDTO.getAgencyId()); wrapper.like(StringUtils.isNotBlank(formDTO.getUnitName()), IcPartyUnitEntity::getUnitName, formDTO.getUnitName()); wrapper.like(StringUtils.isNotBlank(formDTO.getServiceMatter()), IcPartyUnitEntity::getServiceMatter, formDTO.getServiceMatter()); @@ -127,7 +126,13 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl list = baseDao.selectList(wrapper); + List list = baseDao.selectList(wrapper);*/ + //本组织及下级 + if(StringUtils.isNotBlank(formDTO.getCurrentStaffId())&&StringUtils.isBlank(formDTO.getAgencyId())){ + CustomerStaffInfoCacheResult staffInfo=CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(),formDTO.getCurrentStaffId()); + formDTO.setAgencyId(staffInfo.getAgencyId()); + } + List list = baseDao.pageList(formDTO); PageInfo pageInfo = new PageInfo<>(list); List dtoList = ConvertUtils.sourceToTarget(list, IcPartyUnitDTO.class); Result> unitTypeMap = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.PARTY_UNIT_TYPE.getCode()); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyUnitDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyUnitDao.xml index c1800190cb..e57c6d2419 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyUnitDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyUnitDao.xml @@ -193,4 +193,35 @@ ) + + \ No newline at end of file From a2dcf858be450eedc941315ba62ddbcd273cac94 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 3 Nov 2022 11:22:32 +0800 Subject: [PATCH 3/9] =?UTF-8?q?/icpartyactivity/search=E8=81=94=E5=BB=BA?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8=EF=BC=8C=E5=88=97=E8=A1=A8=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/form/PartyActivityFormDTO.java | 1 + .../controller/IcPartyActivityController.java | 8 ++++- .../resources/mapper/IcPartyActivityDao.xml | 36 +++++++++++-------- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PartyActivityFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PartyActivityFormDTO.java index 0481b07fc4..fb67921cd8 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PartyActivityFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PartyActivityFormDTO.java @@ -29,4 +29,5 @@ public class PartyActivityFormDTO implements Serializable { private String serviceMatter; private Integer pageNo; private Integer pageSize; + private String customerId; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyActivityController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyActivityController.java index 2ff977b4db..67b3c5da5a 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyActivityController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyActivityController.java @@ -71,8 +71,14 @@ public class IcPartyActivityController { @Resource private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; + /** + * 联建活动-列表 + * @param formDTO + * @return + */ @PostMapping("search") - public Result> page(@RequestBody PartyActivityFormDTO formDTO){ + public Result> page(@LoginUser TokenDto tokenDto,@RequestBody PartyActivityFormDTO formDTO){ + formDTO.setCustomerId(formDTO.getCustomerId()); PageData page = icPartyActivityService.search(formDTO); return new Result>().ok(page); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyActivityDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyActivityDao.xml index 0c5c86d30d..bf3af69b84 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyActivityDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyActivityDao.xml @@ -66,37 +66,43 @@ ic_party_activity a INNER JOIN ( SELECT - ACTIVITY_ID, - GROUP_CONCAT( UNIT_ID ) AS unitId + ur.ACTIVITY_ID, + GROUP_CONCAT( ur.UNIT_ID ) AS unitId FROM - ic_activity_unit_relation + ic_activity_unit_relation ur WHERE - DEL_FLAG = '0' - AND AGENCY_ID = #{agencyId} + ur.DEL_FLAG = '0' + + AND (ur.AGENCY_ID = #{agencyId} or ur.PIDS like concat('%',#{agencyId},'%')) + - AND UNIT_ID = #{unitId} + AND ur.UNIT_ID = #{unitId} GROUP BY - ACTIVITY_ID + ur.ACTIVITY_ID ) b ON a.ID = b.ACTIVITY_ID INNER JOIN ( SELECT - ACTIVITY_ID, - GROUP_CONCAT( SERVICE_MATTER ) AS serviceMatter + sr.ACTIVITY_ID, + GROUP_CONCAT( sr.SERVICE_MATTER ) AS serviceMatter FROM - ic_activity_service_relation + ic_activity_service_relation sr WHERE - DEL_FLAG = '0' - AND AGENCY_ID = #{agencyId} + sr.DEL_FLAG = '0' + + AND (sr.AGENCY_ID = #{agencyId} or sr.PIDS like concat('%',#{agencyId},'%')) + - AND SERVICE_MATTER = #{serviceMatter} + AND sr.SERVICE_MATTER = #{serviceMatter} GROUP BY - ACTIVITY_ID + sr.ACTIVITY_ID ) c ON a.ID = c.ACTIVITY_ID WHERE a.DEL_FLAG = '0' - AND a.AGENCY_ID = #{agencyId} + + AND (a.AGENCY_ID = #{agencyId} or a.PIDS like concat('%',#{agencyId},'%')) + AND a.GRID_ID = #{gridId} From 9bef7ca1460578d22cbab50d1235bdb6f7233017 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 3 Nov 2022 12:30:54 +0800 Subject: [PATCH 4/9] ZUZHIid --- .../src/main/java/com/epmet/dto/IcPartyActivityDTO.java | 6 +++++- .../src/main/java/com/epmet/dto/IcPartyUnitDTO.java | 1 + .../com/epmet/service/impl/IcPartyActivityServiceImpl.java | 3 ++- .../java/com/epmet/service/impl/IcPartyUnitServiceImpl.java | 2 ++ .../src/main/resources/mapper/IcPartyActivityDao.xml | 3 ++- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java index b0367639ed..0115706902 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java @@ -55,8 +55,12 @@ public class IcPartyActivityDTO implements Serializable { /** * 组织ID */ - @JsonIgnore + // @JsonIgnore private String agencyId; + /** + * 组织名称 + */ + private String agencyName; private String gridId; private String gridName; /** diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyUnitDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyUnitDTO.java index 5935d564de..1aed3be19f 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyUnitDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyUnitDTO.java @@ -51,6 +51,7 @@ public class IcPartyUnitDTO implements Serializable { * 组织ID */ private String agencyId; + private String agencyName; /** * diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java index c645ffbc55..e7b3fbc4e5 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java @@ -128,7 +128,8 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl(dtoList, pageInfo.getTotal()); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyActivityDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyActivityDao.xml index bf3af69b84..b02c91bfd5 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyActivityDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyActivityDao.xml @@ -61,7 +61,8 @@ ADDRESS, LONGITUDE, LATITUDE, - RESULT + RESULT, + a.AGENCY_ID FROM ic_party_activity a INNER JOIN ( From 24f1d574e39d9247a0b8388b67f6fd6a7fd140f3 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 3 Nov 2022 15:05:07 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E6=9C=AA=E5=81=9A=E6=A0=B8=E9=85=B8?= =?UTF-8?q?=E6=AF=94=E5=AF=B9=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=A4=87=E6=B3=A8?= =?UTF-8?q?=E3=80=81=E9=87=87=E6=A0=B7=E6=97=B6=E9=97=B4=E3=80=82=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E4=B8=8B=E6=9F=A5=E8=AF=A2=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=8C=E8=BF=98=E6=9C=89=E5=AF=BC=E5=87=BAsql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/IcNatCompareRecordDTO.java | 8 +++ .../yqfk/IcNatCompareRecordPageFormDTO.java | 4 ++ .../entity/IcNatCompareRecordEntity.java | 10 ++- ...IcNatCompareRecordExcelImportListener.java | 66 +++++++++++++------ .../mapper/IcNatCompareRecordDao.xml | 4 ++ 5 files changed, 72 insertions(+), 20 deletions(-) diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatCompareRecordDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatCompareRecordDTO.java index b422af6b61..be20e5fa68 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatCompareRecordDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatCompareRecordDTO.java @@ -82,6 +82,14 @@ public class IcNatCompareRecordDTO implements Serializable { @ExcelIgnore private String icResiUserId; + /*** + * 采样时间 + */ + @ColumnWidth(30) + @ExcelProperty("最近一次采样时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date latestCyTime; + /** * 最近一次核酸时间:接口填入 */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/yqfk/IcNatCompareRecordPageFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/yqfk/IcNatCompareRecordPageFormDTO.java index c5f6ddd53e..ac323d4b8f 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/yqfk/IcNatCompareRecordPageFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/yqfk/IcNatCompareRecordPageFormDTO.java @@ -38,5 +38,9 @@ public class IcNatCompareRecordPageFormDTO extends PageFormDTO { private String customerId; private String userId; private String agencyId; + /** + * 采样日期:yyyyMMdd + */ + private String cyDate; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatCompareRecordEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatCompareRecordEntity.java index 0110312ed9..75b18618fe 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatCompareRecordEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatCompareRecordEntity.java @@ -45,7 +45,10 @@ public class IcNatCompareRecordEntity extends BaseEpmetEntity { * 是否客户下居民,ic_resi_user.id */ private String icResiUserId; - + /** + * 最近一次采样时间:接口填入 + */ + private Date latestCyTime; /** * 最近一次核酸时间:接口填入 */ @@ -68,4 +71,9 @@ public class IcNatCompareRecordEntity extends BaseEpmetEntity { * 最新一次导入时间,对应ic_nat_compare_rec_relation.IMPORT_TIME */ private Date latestImportTime; + + /** + * 备注;系统内部使用,方便看看错误 + */ + private String internalRemark; } 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 03c01a2f37..44ed565c6e 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,6 +5,7 @@ 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; @@ -84,27 +85,54 @@ public class IcNatCompareRecordExcelImportListener implements ReadListener AND (r.AGENCY_ID = #{agencyId} or r.pids like concat('%',#{agencyId},'%') ) + + and DATE_FORMAT(c.LATEST_CY_TIME,'%Y%m%d') = #{cyDate} + ORDER BY r.IMPORT_TIME DESC,r.AGENCY_ID desc From dc49dcef0051b6cb93681c8cb6d7d335ffb70ede Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 3 Nov 2022 15:06:07 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E7=AD=89=E4=BC=9A=E5=9B=9E=E6=9D=A5?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E8=84=9A=E6=9C=AC=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../db/migration/V0.0.77__data_compare_d_c - 副本.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.77__data_compare_d_c - 副本.sql diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.77__data_compare_d_c - 副本.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.77__data_compare_d_c - 副本.sql new file mode 100644 index 0000000000..f19afc8b27 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.77__data_compare_d_c - 副本.sql @@ -0,0 +1,2 @@ +alter table ic_nat_compare_record add COLUMN `LATEST_CY_TIME` datetime DEFAULT NULL COMMENT '最近一次采样时间:接口填入' after IC_RESI_USER_ID; +ALTER TABLE ic_nat_compare_record ADD COLUMN INTERNAL_REMARK VARCHAR ( 128 ) DEFAULT '' COMMENT '备注;系统内部使用,方便看看错误' AFTER LATEST_IMPORT_TIME; \ No newline at end of file From 24320e97ebf4b36ed5473af61abcd61633bbfee5 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 3 Nov 2022 15:12:54 +0800 Subject: [PATCH 7/9] 80 --- ....77__data_compare_d_c - 副本.sql => V0.0.80__natcompare.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename epmet-user/epmet-user-server/src/main/resources/db/migration/{V0.0.77__data_compare_d_c - 副本.sql => V0.0.80__natcompare.sql} (100%) diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.77__data_compare_d_c - 副本.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.80__natcompare.sql similarity index 100% rename from epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.77__data_compare_d_c - 副本.sql rename to epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.80__natcompare.sql From 23f663498d94ad944111b9792574fee5abe0e1fc Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Sat, 5 Nov 2022 23:03:30 +0800 Subject: [PATCH 8/9] =?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 9/9] =?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