wangxianzhang 3 years ago
parent
commit
fe311f204e
  1. 6
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java
  2. 1
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyUnitDTO.java
  3. 1
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PartyActivityFormDTO.java
  4. 5
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PartyUnitFormDTO.java
  5. 8
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyActivityController.java
  6. 18
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java
  7. 8
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPartyUnitDao.java
  8. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java
  9. 13
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java
  10. 39
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyActivityDao.xml
  11. 31
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyUnitDao.xml
  12. 8
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatCompareRecordDTO.java
  13. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/yqfk/IcNatCompareRecordPageFormDTO.java
  14. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatCompareRecordEntity.java
  15. 66
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatCompareRecordExcelImportListener.java
  16. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/jdbc/config/JdbcTemplateConfig.java
  17. 132
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncConfigServiceImpl.java
  18. 6
      epmet-user/epmet-user-server/src/main/resources/bootstrap.yml
  19. 2
      epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.80__natcompare.sql
  20. 4
      epmet-user/epmet-user-server/src/main/resources/mapper/IcNatCompareRecordDao.xml

6
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;
/**

1
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;
/**
*

1
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;
}

5
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;
}

8
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<PageData<IcPartyActivityDTO>> page(@RequestBody PartyActivityFormDTO formDTO){
public Result<PageData<IcPartyActivityDTO>> page(@LoginUser TokenDto tokenDto,@RequestBody PartyActivityFormDTO formDTO){
formDTO.setCustomerId(formDTO.getCustomerId());
PageData<IcPartyActivityDTO> page = icPartyActivityService.search(formDTO);
return new Result<PageData<IcPartyActivityDTO>>().ok(page);
}

18
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<PageData<IcPartyUnitDTO>> search(@LoginUser TokenDto tokenDto, @RequestBody PartyUnitFormDTO formDTO) {
formDTO.setCustomerId(tokenDto.getCustomerId());
//工作端调用的话,赋值当前登录用户id
if(AppClientConstant.APP_GOV.equals(tokenDto.getApp())){
formDTO.setCurrentStaffId(tokenDto.getUserId());
}
PageData<IcPartyUnitDTO> page = icPartyUnitService.search(formDTO);
return new Result<PageData<IcPartyUnitDTO>>().ok(page);
}

8
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<IcPartyUnitEntity> {
@Param("customerId") String customerId);
List<IcPartyUnitEntity> selectByIds(@Param("partyUnitIds") List<String> partyUnitIds);
/**
* 联建单位-分页列表查询
* @param formDTO
* @return
*/
List<IcPartyUnitEntity> pageList(PartyUnitFormDTO formDTO);
}

3
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<IcPartyActivityD
if (StringUtils.isNotEmpty(dto.getGridId())) {
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(dto.getGridId());
if (null != gridInfo) {
dto.setGridName(gridInfo.getGridName());
dto.setGridName(gridInfo.getGridNamePath());
dto.setAgencyName(gridInfo.getAgencyName());
}
}
});

13
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<IcPartyUnitDao, IcPa
@Override
public PageData<IcPartyUnitDTO> search(PartyUnitFormDTO formDTO) {
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize());
LambdaQueryWrapper<IcPartyUnitEntity> wrapper = new LambdaQueryWrapper<>();
/*LambdaQueryWrapper<IcPartyUnitEntity> 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<IcPartyUnitDao, IcPa
wrapper.like(StringUtils.isNotBlank(formDTO.getContact()), IcPartyUnitEntity::getContact, formDTO.getContact());
wrapper.like(StringUtils.isNotBlank(formDTO.getContactMobile()), IcPartyUnitEntity::getContactMobile, formDTO.getContactMobile());
wrapper.orderByDesc(IcPartyUnitEntity::getCreatedTime);
List<IcPartyUnitEntity> list = baseDao.selectList(wrapper);
List<IcPartyUnitEntity> 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<IcPartyUnitEntity> list = baseDao.pageList(formDTO);
PageInfo<IcPartyUnitEntity> pageInfo = new PageInfo<>(list);
List<IcPartyUnitDTO> dtoList = ConvertUtils.sourceToTarget(list, IcPartyUnitDTO.class);
Result<Map<String, String>> unitTypeMap = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.PARTY_UNIT_TYPE.getCode());
@ -150,6 +155,8 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
item.setSatisfaction(new BigDecimal(item.getSatisfaction()).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
}
item.setScore(null == pointMap.get(item.getId()) ? NumConstant.ZERO : pointMap.get(item.getId()));
AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(item.getAgencyId());
item.setAgencyName(null != agencyInfoCache ? agencyInfoCache.getOrganizationName() : StrConstant.EPMETY_STR);
});
return new PageData<>(dtoList, pageInfo.getTotal());
}

39
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyActivityDao.xml

@ -61,42 +61,49 @@
ADDRESS,
LONGITUDE,
LATITUDE,
RESULT
RESULT,
a.AGENCY_ID
FROM
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'
<if test='null != agencyId and "" != agencyId'>
AND (ur.AGENCY_ID = #{agencyId} or ur.PIDS like concat('%',#{agencyId},'%'))
</if>
<if test='null != unitId and "" != unitId'>
AND UNIT_ID = #{unitId}
AND ur.UNIT_ID = #{unitId}
</if>
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'
<if test='null != agencyId and "" != agencyId'>
AND (sr.AGENCY_ID = #{agencyId} or sr.PIDS like concat('%',#{agencyId},'%'))
</if>
<if test='null != serviceMatter and "" != serviceMatter'>
AND SERVICE_MATTER = #{serviceMatter}
AND sr.SERVICE_MATTER = #{serviceMatter}
</if>
GROUP BY
ACTIVITY_ID
sr.ACTIVITY_ID
) c ON a.ID = c.ACTIVITY_ID
WHERE
a.DEL_FLAG = '0'
AND a.AGENCY_ID = #{agencyId}
<if test='null != agencyId and "" != agencyId'>
AND (a.AGENCY_ID = #{agencyId} or a.PIDS like concat('%',#{agencyId},'%'))
</if>
<if test='null != gridId and "" != gridId'>
AND a.GRID_ID = #{gridId}
</if>

31
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyUnitDao.xml

@ -193,4 +193,35 @@
</foreach>
)
</select>
<select id="pageList" parameterType="com.epmet.dto.form.PartyUnitFormDTO" resultType="com.epmet.entity.IcPartyUnitEntity">
SELECT
u.*
FROM
ic_party_unit u
WHERE
u.DEL_FLAG = '0'
<if test="null != customerId and customerId != '' ">
AND u.CUSTOMER_ID = #{customerId}
</if>
<if test="null != agencyId and agencyId != '' ">
AND ( u.AGENCY_ID = #{agencyId} OR u.PIDS LIKE concat( '%', #{agencyId}, '%' ))
</if>
<if test="null != unitName and unitName != '' ">
and u.UNIT_NAME like concat( '%', #{unitName}, '%' )
</if>
<if test="null != serviceMatter and serviceMatter != '' ">
and u.SERVICE_MATTER like concat( '%', #{serviceMatter}, '%' )
</if>
<if test="null != type and type != '' ">
and u.TYPE =#{type}
</if>
<if test="null != contact and contact != '' ">
and u.CONTACT like concat( '%', #{contact}, '%' )
</if>
<if test="null != contactMobile and contactMobile != '' ">
and u.CONTACT_MOBILE like concat( '%', #{contactMobile}, '%' )
</if>
order by u.CREATED_TIME desc
</select>
</mapper>

8
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;
/**
* 最近一次核酸时间:接口填入
*/

4
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/yqfk/IcNatCompareRecordPageFormDTO.java

@ -38,6 +38,10 @@ public class IcNatCompareRecordPageFormDTO extends PageFormDTO {
private String customerId;
private String userId;
private String agencyId;
/**
* 采样日期yyyyMMdd
*/
private String cyDate;
/**
* 检测时间

10
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;
}

66
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<IcNat
// 开发和测试没法测试,只能写死只有生产才去调用了 烟台客户id:1535072605621841922
EnvEnum currentEnv = EnvEnum.getCurrentEnv();
if (EnvEnum.PROD.getCode().equals(currentEnv.getCode()) && "1535072605621841922".equals(customerId)) {
// 调用烟台api获取核酸检测结果
YtHsjcResDTO hsjcResDTO = YtHsResUtils.hsjc(data.getIdCard(), 1, 1);
if (null != hsjcResDTO && CollectionUtils.isNotEmpty(hsjcResDTO.getData()) && null != hsjcResDTO.getData().get(0)) {
YtHsjcResDetailDTO ytHsjcResDetailDTO = hsjcResDTO.getData().get(0);
String testTime = ytHsjcResDetailDTO.getTest_time();
if (StringUtils.isNotBlank(testTime)) {
// 赋值最近一次核酸时间
compareRecordEntity.setLatestNatTime(DateUtils.parse(testTime, DateUtils.DATE_TIME_PATTERN));
}
// 赋值检测地点
compareRecordEntity.setNatAddress(StringUtils.isNotBlank(ytHsjcResDetailDTO.getSampling_org_pcr()) ? ytHsjcResDetailDTO.getSampling_org_pcr() : StrConstant.EPMETY_STR);
//先查询最后一次采样记录
YtHscyResDTO hscyResDTO=YtHsResUtils.hscy(data.getIdCard(),1,1);
if(CollectionUtils.isNotEmpty(hscyResDTO.getData())){
//存在 最近一条采样记录
YtHscyResDTO.YtHscyResDetail cyDetail=hscyResDTO.getData().get(0);
if (null != cyDetail) {
if(StringUtils.isBlank(cyDetail.getCreate_time())){
compareRecordEntity.setInternalRemark("create_time is null");
}else{
//赋值采样时间
compareRecordEntity.setLatestCyTime(DateUtils.parse(cyDetail.getCreate_time(),DateUtils.DATE_TIME_PATTERN));
// 调用烟台api获取核酸检测结果
YtHsjcResDTO hsjcResDTO = YtHsResUtils.hsjc(data.getIdCard(), 1, 1);
if (null != hsjcResDTO && CollectionUtils.isNotEmpty(hsjcResDTO.getData()) && null != hsjcResDTO.getData().get(0)) {
YtHsjcResDetailDTO ytHsjcResDetailDTO = hsjcResDTO.getData().get(0);
//最近一次采样时间,与最近一次检测结果的采样时间相比较
if(compareRecordEntity.getLatestCyTime().equals(ytHsjcResDetailDTO.getSample_time())){
// 一致说明出结果了
String testTime = ytHsjcResDetailDTO.getTest_time();
if (StringUtils.isNotBlank(testTime)) {
// 赋值最近一次核酸时间
compareRecordEntity.setLatestNatTime(DateUtils.parse(testTime, DateUtils.DATE_TIME_PATTERN));
}
// 赋值检测地点
compareRecordEntity.setNatAddress(StringUtils.isNotBlank(ytHsjcResDetailDTO.getSampling_org_pcr()) ? ytHsjcResDetailDTO.getSampling_org_pcr() : StrConstant.EPMETY_STR);
// "sample_result_pcr":"2",// 核酸检测结果 1:阳性,2:阴性
String sample_result_pcr = ytHsjcResDetailDTO.getSample_result_pcr();
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);
// "sample_result_pcr":"2",// 核酸检测结果 1:阳性,2:阴性
String sample_result_pcr = ytHsjcResDetailDTO.getSample_result_pcr();
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(ytHsjcResDetailDTO.getAddress()) ? ytHsjcResDetailDTO.getAddress() : StrConstant.EPMETY_STR);
}else{
//采样时间不一致,说明未出结果
compareRecordEntity.setInternalRemark(String.format("采样时间不一致,采样接口返回的采样时间:%s,检测结果接口返回的采样时间:%s",compareRecordEntity.getLatestCyTime(),ytHsjcResDetailDTO.getSample_time()));
}
}else{
compareRecordEntity.setInternalRemark("检测结果查询接口为空");
}
}
}else{
compareRecordEntity.setInternalRemark("采样信息查询接口返回成功,data is null");
}
compareRecordEntity.setContactAddress(StringUtils.isNotBlank(ytHsjcResDetailDTO.getAddress()) ? ytHsjcResDetailDTO.getAddress() : StrConstant.EPMETY_STR);
}else{
compareRecordEntity.setInternalRemark("采样信息查询接口返回失败,data is empty");
}
}
datas.add(compareRecordEntity);

6
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());
}
}

132
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,16 @@ 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.jdbc.core.namedparam.NamedParameterJdbcTemplate;
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 +77,12 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
@Autowired
private ExecutorService executorService;
@Resource(name = "yantaiNamedParamLantuJdbcTemplate")
private NamedParameterJdbcTemplate yantaiNamedParamLantuJdbcTemplate;
@Resource(name = "yantaiLantuJdbcTemplate")
private JdbcTemplate yantaiJdbcTemplate;
@Override
public DataSyncConfigDTO get(String id) {
DataSyncConfigEntity entity = baseDao.selectById(id);
@ -769,4 +780,125 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
return this;
}
}
/**
* 烟台核酸检测(视图方式获取数据)
* @param resiInfos
* @param customerId
* @param isSync
*/
public void yantaiHsjcByDbView(List<NatUserInfoResultDTO> resiInfos, String customerId, String isSync) {
List<List<NatUserInfoResultDTO>> resiInfobatchs = ListUtils.partition(resiInfos, 50);
for (List<NatUserInfoResultDTO> resibatch : resiInfobatchs) {
// n个一批,来处理他们的核酸信息,太多怕给数据库查崩了。
try {
yantaiHsjcByDbViewPartition(resibatch, customerId, isSync);
} catch (Exception e) {
String errorMsg = ExceptionUtils.getErrorStackTrace(e);
log.error("【更新核酸检测信息(from 兰图)】失败,信息:{}", errorMsg);
}
}
}
/**
* n个一批来处理他们的核酸信息太多怕给数据库查崩了
* @param resiInfos
* @param customerId
* @param isSync
*/
public void yantaiHsjcByDbViewPartition(List<NatUserInfoResultDTO> resiInfos, String customerId, String isSync) {
// 将居民信息转化为<idCard,resiInfo>的map
Map<String, NatUserInfoResultDTO> idCardAndResiInfo = resiInfos.stream().collect(Collectors.toMap(resi -> resi.getIdCard(), Function.identity()));
List<String> idCards = new ArrayList<>(idCardAndResiInfo.keySet());
// 1.获取核酸采样信息
Map<String, Object> args = new HashMap<>();
args.put("idcards", idCards);
log.info("【更新核酸检测信息(from 兰图)】本批次身份证号为:{}", String.join(",", idCards));
// 2.=====================核酸采样=========================
// 这一批居民的核酸采样列表
List<Map<String, Object>> 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<IcNatEntity> entities = new ArrayList<>();
hscyList.forEach(resiHscyInfo -> {
// 从视图中获取到的核酸采样相关信息
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);
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(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<NatUserInfoResultDTO> existSampleInfo = icNatDao.getExistNatInfo(entities);
sampleAndNat(existSampleInfo,entities,NumConstant.ONE_STR,customerId,isSync);
}
}
// 2.=====================核酸采样=========================
// 这一批居民的核酸采样列表
List<Map<String, Object>> 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<IcNatEntity> 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<NatUserInfoResultDTO> existNatInfos = icNatDao.getExistNatInfo(entities);
sampleAndNat(existNatInfos,entities,NumConstant.TWO_STR,customerId,isSync);
}
}
}
}

6
epmet-user/epmet-user-server/src/main/resources/bootstrap.yml

@ -64,9 +64,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/sjzt?allowPublicKeyRetrieval=true&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

2
epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.80__natcompare.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;

4
epmet-user/epmet-user-server/src/main/resources/mapper/IcNatCompareRecordDao.xml

@ -11,6 +11,7 @@
c.MOBILE,
c.ID_CARD,
c.`NAME`,
c.LATEST_CY_TIME,
c.LATEST_NAT_TIME,
c.NAT_ADDRESS,
c.NAT_RESULT,
@ -55,6 +56,9 @@
<if test='null != agencyId and "" != agencyId'>
AND (r.AGENCY_ID = #{agencyId} or r.pids like concat('%',#{agencyId},'%') )
</if>
<if test='null != cyDate and "" != cyDate'>
and DATE_FORMAT(c.LATEST_CY_TIME,'%Y%m%d') = #{cyDate}
</if>
<if test='null != natDate and "" != natDate'>
<if test='null != natStatus and "1" == natStatus'>

Loading…
Cancel
Save