wangxianzhang 3 years ago
parent
commit
ffc7ee14e9
  1. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 25
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/NatInfoScanTask.java
  3. 89
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcSyncJobDTO.java
  4. 10
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java
  5. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcVaccineRelationDTO.java
  6. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DataSyncTaskParam.java
  7. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java
  8. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageTripReportFormDTO.java
  9. 21
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/EmphasisTripListResultDTO.java
  10. 7
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcVaccineListResultDTO.java
  11. 9
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatUserInfoResultDTO.java
  12. 13
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  13. 19
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  14. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/UserApplication.java
  15. 21
      epmet-user/epmet-user-server/src/main/java/com/epmet/constant/EpidemicConstant.java
  16. 46
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncConfigController.java
  17. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java
  18. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccineController.java
  19. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncConfigDao.java
  20. 21
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcSyncJobDao.java
  21. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineDao.java
  22. 59
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcSyncJobEntity.java
  23. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcTripReportRecordEntity.java
  24. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcVaccineRelationEntity.java
  25. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcPsTripReportRecordExcel.java
  26. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcPsTripReportRecordExportExcel.java
  27. 125
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatCompareRecordExcelImportListener.java
  28. 81
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcPsTripReportExcelImportListener.java
  29. 38
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcTripReportExcelImportListener.java
  30. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/jdbc/config/JdbcTemplateConfig.java
  31. 128
      epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiNatSyncProcessor.java
  32. 50
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncConfigService.java
  33. 78
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcSyncJobService.java
  34. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcVaccineService.java
  35. 413
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncConfigServiceImpl.java
  36. 13
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatCompareRecordServiceImpl.java
  37. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java
  38. 83
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcSyncJobServiceImpl.java
  39. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java
  40. 60
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineServiceImpl.java
  41. 6
      epmet-user/epmet-user-server/src/main/resources/bootstrap.yml
  42. 3
      epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.86__alter_ic_trip_report.sql
  43. 5
      epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.87__alter_ic_vaccine_relation.sql
  44. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/ps_trip_report_import_template.xlsx
  45. 11
      epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncConfigDao.xml
  46. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml
  47. 29
      epmet-user/epmet-user-server/src/main/resources/mapper/IcSyncJobDao.xml
  48. 27
      epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml
  49. 45
      epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineDao.xml

2
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, "请求未认证"),

25
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.dataSyncForYanTaiTask(formDTO);
if (result.success()) {
log.info("NatInfoScanTask定时任务执行成功");
} else {
log.error("NatInfoScanTask定时任务执行失败:" + result.getMsg());
}*/
// 核酸检测
Result natResult = userOpenFeignClient.natInfoScanTask(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());
}
}
}

89
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;
/**
* 操作员IDstaffId
*/
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;
}

10
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;
/**
* 来曹事由磐石
*/
@ -365,4 +370,9 @@ public class IcTripReportRecordDTO implements Serializable {
*/
@ExcelIgnore
private String tripDataTypeName;
/**
* 上报人姓名(createdBy对应人名)
*/
@ExcelIgnore
private String createdByName;
}

5
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;
/**
* 是否本辖区居民10
*/
private String isLocalResiUser;
/**
* 删除标识
*/

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

4
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;
/**
* 来曹事由磐石
*/

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

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

7
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;
/**
* 是否本辖区居民10
*/
@ExcelIgnore
private String isLocalResiUser;
}

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

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

@ -922,8 +922,8 @@ public interface EpmetUserOpenFeignClient {
@PostMapping("/epmetuser/userbaseinfo/dingResiLogin")
Result<DingLoginResiResDTO> dingResiLogin(@RequestBody DingLoginResiFormDTO formDTO);
@PostMapping("/epmetuser/dataSyncConfig/natInfoScanTask")
Result natInfoScanTask(@RequestBody DataSyncTaskParam formDTO);
@PostMapping("/epmetuser/dataSyncConfig/dataSyncForYanTaiTask")
Result dataSyncForYanTaiTask(@RequestBody DataSyncTaskParam formDTO);
/**
* Desc: 客户下所有工作人员放缓存
@ -943,4 +943,13 @@ public interface EpmetUserOpenFeignClient {
*/
@PostMapping("/epmetuser/registerrelation/getAllResiByGrid")
Result<Integer> getAllResiByGrid(@RequestBody AllResiByGridFormDTO formDTO);
@PostMapping("/epmetuser/dataSyncConfig/natInfoScanTask")
Result natInfoScanTask(@RequestBody DataSyncTaskParam formDTO);
@PostMapping("/epmetuser/dataSyncConfig/deathInfoScanTask")
Result deathInfoScanTask(@RequestBody DataSyncTaskParam formDTO);
@PostMapping("/epmetuser/dataSyncConfig/disabilityInfoScanTask")
Result disabilityInfoScanTask(@RequestBody DataSyncTaskParam formDTO);
}

19
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
@ -726,4 +726,19 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
public Result<Integer> getAllResiByGrid(AllResiByGridFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getAllResiByGrid", formDTO);
}
@Override
public Result natInfoScanTask(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);
}
}

2
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

21
epmet-user/epmet-user-server/src/main/java/com/epmet/constant/EpidemicConstant.java

@ -0,0 +1,21 @@
package com.epmet.constant;
public interface EpidemicConstant {
/**
* 数据配置的dataCode
* 核酸检测
* 残疾人
* 死亡
*/
String DATA_CODE_NAT = "hesuan";
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";
}

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

@ -106,9 +106,53 @@ 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();
}
@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
* @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);
return new Result();
}

2
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

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

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

@ -38,7 +38,7 @@ public interface DataSyncConfigDao extends BaseDao<DataSyncConfigEntity> {
* @author zxc
* @date 2022/9/26 15:04
*/
List<DataSyncConfigDTO> list(@Param("customerId") String customerId, @Param("switchStatus") String switchStatus);
List<DataSyncConfigDTO> list(@Param("customerId") String customerId, @Param("switchStatus") String switchStatus, @Param("dataCode")String dataCode);
List<DataSyncScopeDTO> scopeList(@Param("id") String id);
@ -60,4 +60,6 @@ public interface DataSyncConfigDao extends BaseDao<DataSyncConfigEntity> {
*/
List<NatUserInfoResultDTO> getIdCardsByScope(DataSyncTaskParam formDTO);
DataSyncConfigDTO getConfigInfoByType(@Param("customerId") String customerId, @Param("switchStatus") String switchStatus,@Param("dataCode")String dataCode);
}

21
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcSyncJobDao.java

@ -0,0 +1,21 @@
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;
/**
* 同步任务表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-11-08
*/
@Mapper
public interface IcSyncJobDao extends BaseDao<IcSyncJobEntity> {
List<IcSyncJobEntity> selectExecutableJobList(@Param("jobType") String jobType,
@Param("itemCount") int itemCount);
}

6
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<IcVaccineEntity> {
*/
List<IcVaccineEntity> getVaccineListByIdCard(@Param("idCard") String idCard,@Param("time") String time);
List<RelationAndNatResultDTO> initVaccineLocal();
void updateRelation(List<RelationAndNatResultDTO> list);
void updateRelationOther(@Param("isLocalResiUser") String isLocalResiUser);
}

59
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;
/**
* 操作员IDstaffId
*/
private String operatorId;
/**
* 操作状态,等待中waiting进行中processing结束finish
*/
private String operationStatus;
}

4
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;
/**
* 来曹事由磐石
*/

5
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;
/**
* 是否本辖区居民10
*/
private String isLocalResiUser;
}

7
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字以内)")

8
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:阳性 -中国字

125
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<IcNat
* 导入日期yyyyMMdd
*/
private String importDate;
public IcNatCompareRecordExcelImportListener(String customerId, CustomerStaffInfoCacheResult staffInfo,String importDate,Date importTime, IcNatCompareRecordServiceImpl icNatCompareRecordService) {
private NamedParameterJdbcTemplate yantaiNamedParamLantuJdbcTemplate;
public IcNatCompareRecordExcelImportListener(String customerId, CustomerStaffInfoCacheResult staffInfo,String importDate,Date importTime,
IcNatCompareRecordServiceImpl icNatCompareRecordService,
NamedParameterJdbcTemplate yantaiNamedParamLantuJdbcTemplate) {
this.customerId = customerId;
this.staffInfo = staffInfo;
this.icNatCompareRecordService = icNatCompareRecordService;
this.importDate=importDate;
this.importTime=importTime;
this.yantaiNamedParamLantuJdbcTemplate=yantaiNamedParamLantuJdbcTemplate;
}
@Override
/*@Override
public void invoke(IcNatCompareRecordExcelData data, AnalysisContext analysisContext) {
try {
// log.warn("有数据吗?"+JSON.toJSONString(data));
@ -137,6 +139,110 @@ public class IcNatCompareRecordExcelImportListener implements ReadListener<IcNat
}
datas.add(compareRecordEntity);
if (datas.size() == MAX_THRESHOLD) {
execPersist();
}
} catch (Exception e) {
String errorMsg = null;
if (e instanceof ValidateException) {
errorMsg = ((ValidateException) e).getMsg();
} else if (e instanceof EpmetException) {
errorMsg = ((EpmetException) e).getMsg();
} else {
errorMsg = "未知错误";
log.error("【未做核酸比对导入】出错:{}", ExceptionUtils.getErrorStackTrace(e));
}
IcNatCompareRecordExcelData.ErrorRow errorRow = new IcNatCompareRecordExcelData.ErrorRow();
errorRow.setIdCard(data.getIdCard());
errorRow.setName(data.getName());
errorRow.setMobile(data.getMobile());
errorRow.setErrorInfo(errorMsg);
errorRows.add(errorRow);
}
}*/
@Override
public void invoke(IcNatCompareRecordExcelData data, AnalysisContext analysisContext) {
try {
// log.warn("有数据吗?"+JSON.toJSONString(data));
// 不能为空先校验数据
ValidatorUtils.validateEntity(data);
// 去除空格
ObjectUtil.objectToTrim(data);
IcNatCompareRecordEntity compareRecordEntity = ConvertUtils.sourceToTarget(data, IcNatCompareRecordEntity.class);
compareRecordEntity.setCustomerId(customerId);
compareRecordEntity.setLatestNatTime(null);
compareRecordEntity.setNatAddress(StrConstant.EPMETY_STR);
compareRecordEntity.setNatResult(StrConstant.EPMETY_STR);
// 开发和测试没法测试,只能写死只有生产才去调用了 烟台客户id:1535072605621841922
EnvEnum currentEnv = EnvEnum.getCurrentEnv();
if (EnvEnum.PROD.getCode().equals(currentEnv.getCode()) && "1535072605621841922".equals(customerId)) {
// 先查询最后一次采样记录
Map<String, Object> args = new HashMap<>();
args.put("idcard", data.getIdCard());
List<Map<String, Object>> 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<String, Object> latestCyMap = hscyList.get(0);
Date create_time = (Date) latestCyMap.get("create_time");
if (create_time == null) {
// 最近一次采样时间为空,说明这人好久不做核酸了
compareRecordEntity.setInternalRemark("采样时间create_time is null");
} else {
// 赋值采样时间
compareRecordEntity.setLatestCyTime(create_time);
// 查询最后一次检测结果
List<Map<String, Object>> 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);
if (CollectionUtils.isNotEmpty(hsjcResultList) && MapUtils.isNotEmpty(hsjcResultList.get(0))) {
Map<String, Object> latestJcMap = hsjcResultList.get(0);
// 采样时间
Date sample_time = (Date) latestJcMap.get("SAMPLE_TIME");
// 检测时间
Date test_time = (Date) 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 (test_time != null) {
// 赋值最近一次核酸时间
compareRecordEntity.setLatestNatTime(test_time);
}
// 赋值检测地点
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(), DateUtils.format(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<IcNat
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
// 最后几条达不到阈值,这里必须再调用一次

81
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 ReadListener<IcPsTripR
AtomicBoolean bl = new AtomicBoolean(false);
StringBuffer errMsg = new StringBuffer("");
IcTripReportRecordEntity e = ConvertUtils.sourceToTarget(data, IcTripReportRecordEntity.class);
e.setCustomerId(customerId);
e.setAgencyId(staffInfo.getAgencyId());
e.setPids(staffInfo.getAgencyPIds());
e.setUserType(IcResiUserConstant.USER_TYPE_IMPORT);
e.setNatOutcome("阳性".equals(e.getNatOutcome()) ? "1" : "0");
if (trafficTypeMap.containsKey(data.getTrafficType())) {
e.setTrafficType(trafficTypeMap.get(data.getTrafficType()));
//先对一下字段值填写是否正确做判断
if (!"阳性".equals(e.getNatOutcome()) && !"阴性".equals(e.getNatOutcome())) {
errMsg.append("‘48小时核酸检测’值填写错误;");
bl.set(true);
}
if (!trafficTypeMap.containsKey(e.getTrafficType())) {
errMsg.append("‘返回方式’值填写错误;");
bl.set(true);
}
if ("其他".equals(e.getTrafficType()) && StringUtils.isBlank(e.getTrafficTypeExplain())) {
errMsg.append("返回方式为其他时,请补充‘其他返回方式’;");
bl.set(true);
}
if (StringUtils.isNotBlank(e.getSojournHistory()) && !sojournHistoryMap.containsKey(e.getSojournHistory())) {
errMsg.append("‘7天内旅居史情况’值填写错误;");
bl.set(true);
}
if ("其他".equals(data.getTrafficType()) && StringUtils.isBlank(data.getTrafficTypeExplain())) {
errMsg.append("返回方式为其他时,请补充“其他返回方式”;");
if (StringUtils.isNotBlank(e.getIsolateType()) && !isolateTypeMap.containsKey(e.getIsolateType())) {
errMsg.append("‘隔离状态’值填写错误;");
bl.set(true);
}
if (StringUtils.isNotBlank(e.getIsArriveCheck()) && !"是".equals(e.getIsArriveCheck()) && !"否".equals(e.getIsArriveCheck())) {
errMsg.append("‘是否落实“落地检”’值填写错误;");
bl.set(true);
}
if (StringUtils.isNotBlank(e.getIsArrive()) && !"是".equals(e.getIsArrive()) && !"否".equals(e.getIsArrive())) {
errMsg.append("‘是否达到曹县’值填写错误;");
bl.set(true);
}
if (StringUtils.isNotBlank(e.getTripDataType()) && !tripDataTypeMap.containsKey(e.getTripDataType())) {
errMsg.append("‘类型(省内、省外、市内、县内)’值填写错误;");
bl.set(true);
}
/*//必要字段没值的
if (StringUtils.isEmpty(e.getSourceAddress()) || StringUtils.isEmpty(e.getPresentAddress())
|| StringUtils.isEmpty(e.getTrafficType())) {
errMsg.append("数据不完整,请检查‘来源地’、‘在曹居住地点’、‘返回方式’信息是否填写完整;");
bl.set(true);
}*/
if (StringUtils.isNotBlank(data.getSojournHistory())) {
e.setSojournHistory(sojournHistoryMap.get(data.getSojournHistory()));
} else {
@ -103,20 +131,7 @@ public class IcPsTripReportExcelImportListener implements ReadListener<IcPsTripR
e.setSojournHistory(areaMap.get(str[2]));
}
}
if (StringUtils.isNotBlank(data.getIsolateType())) {
e.setIsolateType(isolateTypeMap.get(data.getIsolateType()));
}
if (StringUtils.isNotBlank(data.getTripDataType())) {
e.setTripDataType(tripDataTypeMap.get(data.getTripDataType()));
}
e.setIsArriveCheck("是".equals(data.getIsArriveCheck()) ? "1" : "0");
e.setIsArrive("是".equals(data.getIsArrive()) ? "1" : "0");
//必要字段没值的
if (StringUtils.isEmpty(e.getSourceAddress()) || StringUtils.isEmpty(e.getPresentAddress())
|| StringUtils.isEmpty(e.getTrafficType())) {
errMsg.append("数据不完整,请检查‘来源地’、‘在曹居住地点’、‘返回方式’信息是否填写完整;");
bl.set(true);
}
//错误数据记录到错误文件
if (bl.get()) {
IcPsTripReportRecordErrorExcel errorRow = new IcPsTripReportRecordErrorExcel();
errorRow.setName(data.getName());
@ -126,6 +141,24 @@ public class IcPsTripReportExcelImportListener implements ReadListener<IcPsTripR
errorRows.add(errorRow);
return;
}
e.setCustomerId(customerId);
e.setAgencyId(staffInfo.getAgencyId());
e.setPids(staffInfo.getAgencyPIds());
e.setUserType(IcResiUserConstant.USER_TYPE_IMPORT);
e.setNatOutcome("阳性".equals(e.getNatOutcome()) ? "1" : "0");
if (trafficTypeMap.containsKey(data.getTrafficType())) {
e.setTrafficType(trafficTypeMap.get(data.getTrafficType()));
}
if (StringUtils.isNotBlank(data.getIsolateType())) {
e.setIsolateType(isolateTypeMap.get(data.getIsolateType()));
}
if (StringUtils.isNotBlank(data.getTripDataType())) {
e.setTripDataType(tripDataTypeMap.get(data.getTripDataType()));
}
e.setIsArriveCheck("是".equals(data.getIsArriveCheck()) ? "1" : "0");
e.setIsArrive("是".equals(data.getIsArrive()) ? "1" : "0");
e.setReportingTime(DateUtils.integrate(new Date(), "yyyy-MM-dd"));
datas.add(e);
if (datas.size() == MAX_THRESHOLD) {

38
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcTripReportExcelImportListener.java

@ -10,7 +10,6 @@ import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.constant.IcResiUserConstant;
import com.epmet.entity.IcTripReportRecordEntity;
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;
@ -65,24 +64,28 @@ public class IcTripReportExcelImportListener implements ReadListener<IcTripRepor
try {
// 先校验数据
ValidatorUtils.validateEntity(data);
AtomicBoolean bl = new AtomicBoolean(false);
StringBuffer errMsg = new StringBuffer("");
IcTripReportRecordEntity tripReportRecordEntity = ConvertUtils.sourceToTarget(data, IcTripReportRecordEntity.class);
tripReportRecordEntity.setCustomerId(customerId);
tripReportRecordEntity.setAgencyId(staffInfo.getAgencyId());
tripReportRecordEntity.setPids(staffInfo.getAgencyPIds());
tripReportRecordEntity.setUserType(IcResiUserConstant.USER_TYPE_IMPORT);
tripReportRecordEntity.setIsNatRecord("是".equals(data.getIsNatRecord()) ? "1" : "0");
tripReportRecordEntity.setVaccineNum(tripReportRecordEntity.getVaccineNum().replace("次",""));
if (trafficTypeMap.containsKey(data.getTrafficType())) {
tripReportRecordEntity.setTrafficType(trafficTypeMap.get(data.getTrafficType()));
IcTripReportRecordEntity e = ConvertUtils.sourceToTarget(data, IcTripReportRecordEntity.class);
//先对一下字段值填写是否正确做判断
if (!trafficTypeMap.containsKey(data.getTrafficType())) {
errMsg.append("‘返回方式’值填写错误;");
bl.set(true);
}
if ("其他".equals(data.getTrafficType()) && StringUtils.isBlank(data.getTrafficTypeExplain())) {
errMsg.append("返回方式为其他时,请补充“其他返回方式”;");
bl.set(true);
}
if (!"是".equals(e.getIsNatRecord()) && !"否".equals(e.getIsNatRecord())) {
errMsg.append("‘48小时核酸检测’值填写错误;");
bl.set(true);
}
if (!"0次".equals(e.getVaccineNum()) && !"1次".equals(e.getVaccineNum())
&& !"2次".equals(e.getVaccineNum()) && !"3次".equals(e.getVaccineNum())) {
errMsg.append("‘疫苗接种针次’值填写错误;");
bl.set(true);
}
//错误数据记录到错误文件
if (bl.get()) {
IcTripReportExcelData.ErrorRow errorRow = new IcTripReportExcelData.ErrorRow();
errorRow.setName(data.getName());
@ -93,7 +96,16 @@ public class IcTripReportExcelImportListener implements ReadListener<IcTripRepor
return;
}
datas.add(tripReportRecordEntity);
e.setCustomerId(customerId);
e.setAgencyId(staffInfo.getAgencyId());
e.setPids(staffInfo.getAgencyPIds());
e.setUserType(IcResiUserConstant.USER_TYPE_IMPORT);
e.setIsNatRecord("是".equals(data.getIsNatRecord()) ? "1" : "0");
e.setVaccineNum(e.getVaccineNum().replace("次", ""));
if (trafficTypeMap.containsKey(data.getTrafficType())) {
e.setTrafficType(trafficTypeMap.get(data.getTrafficType()));
}
datas.add(e);
if (datas.size() == MAX_THRESHOLD) {
execPersist();

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

128
epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiNatSyncProcessor.java

@ -0,0 +1,128 @@
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<IcSyncJobEntity> executingListQuery = new LambdaQueryWrapper<>();
executingListQuery.eq(IcSyncJobEntity::getOperationStatus, EpidemicConstant.OPERATION_STATUS_PROCESSING);
List<IcSyncJobEntity> 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<IcSyncJobEntity> icSyncJobToExec = icSyncJobDao.selectExecutableJobList(
EpidemicConstant.JOB_TYPE_NAT,
leftCount);
if (!CollectionUtils.isEmpty(icSyncJobToExec)) {
// 异步提交任务
for (IcSyncJobEntity jobEntity : icSyncJobToExec) {
updateJobStatus(jobEntity.getId(), EpidemicConstant.OPERATION_STATUS_PROCESSING);
executorService.submit(() -> {
// 将此任务状态修改为执行中
try {
dataSyncConfigService.execSyncByJobProcessor(jobEntity);
} finally {
// 更新任务状态为结束
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<IcSyncJobEntity> query = new LambdaQueryWrapper<>();
query.eq(IcSyncJobEntity::getId, id);
IcSyncJobEntity updateEntity = new IcSyncJobEntity();
updateEntity.setOperationStatus(status);
icSyncJobDao.update(updateEntity, query);
}
}

50
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;
/**
* 数据更新配置表
@ -83,4 +87,50 @@ public interface DataSyncConfigService extends BaseService<DataSyncConfigEntity>
void scopeSave(ScopeSaveFormDTO formDTO);
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);
void natInfoSyncButton(DataSyncTaskParam formDTO);
List<NatUserInfoResultDTO> getNatUserInfoFromDb(DataSyncTaskParam formDTO, int pageNo, int pageSize);
/**
* 烟台核酸检测(视图方式获取数据)
* @param resiInfos
* @param customerId
* @param isSync
*/
void yantaiHsjcByDbView(List<NatUserInfoResultDTO> resiInfos, String customerId, String isSync);
/**
* 更新居民核酸检测信息(通过任务处理器)
* @author wxz
* @date 2022/11/8 下午8:17
* @param jobEntity
*/
void execSyncByJobProcessor(IcSyncJobEntity jobEntity);
}

78
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<IcSyncJobEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<IcSyncJobDTO>
* @author generator
* @date 2022-11-08
*/
PageData<IcSyncJobDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<IcSyncJobDTO>
* @author generator
* @date 2022-11-08
*/
List<IcSyncJobDTO> list(Map<String, Object> 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);
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcVaccineService.java

@ -68,4 +68,6 @@ public interface IcVaccineService extends BaseService<IcVaccineEntity> {
void edit(AddIcVaccineFormDTO formDTO);
void del(IcVaccineFormDTO formDTO);
void initVaccineLocal();
}

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

@ -1,28 +1,37 @@
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;
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.dao.IcSyncJobDao;
import com.epmet.dto.DataSyncConfigDTO;
import com.epmet.dto.DataSyncRecordDeathDTO;
import com.epmet.dto.DataSyncRecordDisabilityDTO;
@ -39,8 +48,10 @@ 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;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -48,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.*;
/**
* 数据更新配置表
*
@ -75,6 +89,15 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
private DataSyncRecordDisabilityService dataSyncRecordDisabilityService;
@Autowired
private ExecutorService executorService;
@Autowired
private IcSyncJobService icSyncJobService;
@Autowired
private IcSyncJobDao icSyncJobDao;
@Autowired
private DistributedLock distributedLock;
@Resource(name = "yantaiNamedParamLantuJdbcTemplate")
private NamedParameterJdbcTemplate yantaiNamedParamLantuJdbcTemplate;
@Resource(name = "yantaiLantuJdbcTemplate")
private JdbcTemplate yantaiJdbcTemplate;
@ -130,7 +153,7 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
public PageData list(TokenDto tokenDto, PageFormDTO formDTO) {
PageData<DataSyncConfigDTO> result = new PageData<>(new ArrayList<>(), NumConstant.ZERO_L);
PageInfo<DataSyncConfigDTO> pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize())
.doSelectPageInfo(() -> baseDao.list(tokenDto.getCustomerId(), null));
.doSelectPageInfo(() -> baseDao.list(tokenDto.getCustomerId(), null,null));
if (CollectionUtils.isNotEmpty(pageInfo.getList())) {
result.setList(pageInfo.getList());
result.setTotal(Integer.parseInt(String.valueOf(pageInfo.getTotal())));
@ -185,7 +208,7 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
*/
@Override
public void dataSyncForYanTaiTask(DataSyncTaskParam formDTO) {
List<DataSyncConfigDTO> allConfigList = baseDao.list(formDTO.getCustomerId(), "open");
List<DataSyncConfigDTO> allConfigList = baseDao.list(formDTO.getCustomerId(), "open",null);
if (CollectionUtils.isEmpty(allConfigList)) {
return;
}
@ -221,6 +244,259 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
}
}
/**
* @Description 死亡信息定时拉取
* @param formDTO
* @Author zxc
* @Date 2022/11/8 09:01
*/
@Override
public void deathInfoScanTask(DataSyncTaskParam formDTO) {
List<DataSyncConfigDTO> 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<NatUserInfoResultDTO> 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);
}
/**
* @Description 残疾信息定时拉取
* @param formDTO
* @Author zxc
* @Date 2022/11/8 09:01
*/
@Override
public void disabilityInfoScanTask(DataSyncTaskParam formDTO) {
List<DataSyncConfigDTO> 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<NatUserInfoResultDTO> 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<DataSyncConfigDTO> configData = new ArrayList<>();
if (StringUtils.isBlank(formDTO.getAgencyId())){
configData = getConfigData(null, EpidemicConstant.DATA_CODE_NAT);
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<NatUserInfoResultDTO> 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);
}
/**
* 提交同步任务放到任务池
* @author wxz
* @date 2022/11/8 下午5:32
* @param formDTO
*/
@Override
public void natInfoSyncButton(DataSyncTaskParam formDTO) {
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
if (null == staffInfo){
throw new EpmetException("未查询到工作人员信息:"+formDTO.getStaffId());
}
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(formDTO.getAgencyId());
if (null == agencyInfo){
throw new EpmetException("未查询到组织信息:"+formDTO.getAgencyId());
}
// 查询该组织是否存在等待中或者进行中的任务
LambdaQueryWrapper<IcSyncJobEntity> qw = new LambdaQueryWrapper<>();
qw.eq(IcSyncJobEntity::getOrgId,formDTO.getAgencyId())
.in(IcSyncJobEntity::getOperationStatus,OPERATION_STATUS_WAITING,OPERATION_STATUS_PROCESSING);
List<IcSyncJobEntity> 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);
//List<IcSyncJobEntity> waitList;
//do {
// LambdaQueryWrapper<IcSyncJobEntity> 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<IcSyncJobEntity> 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
* @param dataCode
* @Author zxc
* @Date 2022/11/8 10:41
*/
public List<DataSyncConfigDTO> getConfigData(String customerId, String dataCode){
List<DataSyncConfigDTO> allConfigList = baseDao.list(customerId, "open",dataCode);
return CollectionUtils.isEmpty(allConfigList) ? new ArrayList<>() : allConfigList;
}
private void dataSyncYanTaiParallel(List<DataSyncConfigDTO> configList, DataSyncTaskParam formDTO) {
if (CollectionUtils.isEmpty(configList)) {
log.warn("dataSyncYanTaiParallel configList is null");
@ -255,7 +531,8 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
executorService.submit(() -> {
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);
@ -421,7 +698,7 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
* @param pageSize
* @return
*/
private List<NatUserInfoResultDTO> getNatUserInfoFromDb(DataSyncTaskParam formDTO, int pageNo, int pageSize) {
public List<NatUserInfoResultDTO> getNatUserInfoFromDb(DataSyncTaskParam formDTO, int pageNo, int pageSize) {
//根据 组织 分页获取 居民数据
PageInfo<NatUserInfoResultDTO> pageInfo = PageHelper.startPage(pageNo, pageSize, false)
.doSelectPageInfo(() -> baseDao.getIdCardsByScope(formDTO));
@ -629,10 +906,13 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
* 数据库采样时间+idCard+userId 存在的 做更新
* 数据库采样时间+idCard+userId 不存在的 新增
*/
entities.forEach(e -> 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<Boolean, List<IcNatEntity>> groupByStatus = entities.stream().collect(Collectors.groupingBy(IcNatEntity::getExistStatus));
if (CollectionUtils.isNotEmpty(groupByStatus.get(false))) {
for (List<IcNatEntity> icNatEntities : ListUtils.partition(groupByStatus.get(false), NumConstant.FIVE_HUNDRED)) {
@ -786,35 +1066,43 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
public void yantaiHsjcByDbView(List<NatUserInfoResultDTO> resiInfos, String customerId, String isSync) {
List<List<NatUserInfoResultDTO>> resiInfobatchs = ListUtils.partition(resiInfos, 50);
for (List<NatUserInfoResultDTO> 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<NatUserInfoResultDTO> resiInfos, String customerId, String 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()));
Set<String> idCards = idCardAndResiInfo.keySet();//resiInfos.stream().map(resi -> resi.getIdCard()).collect(Collectors.toList());
// String idCardsStr = "''" + String.join("','", idCards) + "''";
List<String> 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<String, Object> args = new HashMap<>();
args.put("idCards", idCards);
Map<String, Object> args = new HashMap<>();
args.put("idcards", idCards);
//log.info("【更新核酸检测信息(from 兰图)】本批次身份证号为:{}", String.join(",", idCards));
// 2.=====================核酸采样=========================
// 这一批居民的核酸采样列表
List<Map<String, Object>> hscyList = yantaiJdbcTemplate.queryForList(sql, args);
List<Map<String, Object>> hscyList = yantaiNamedParamLantuJdbcTemplate.queryForList(
"select id, name,card_no, create_time, realname from hscyxxb where card_no in (:idcards)", args);
if (CollectionUtils.isNotEmpty(hscyList)) {
List<IcNatEntity> 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");
Date createTime = (Date) resiHscyInfo.get("create_time");
// 本地数据库中,居民信息
NatUserInfoResultDTO currentResiInfo = idCardAndResiInfo.get(cardNo);
@ -828,7 +1116,6 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
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("");
@ -840,5 +1127,85 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
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");
Date testTime = (Date) natResult.get("test_time");
String telephone = (String) natResult.get("telephone");
Date sampleTime = (Date) 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(testTime);
e.setSampleTime(sampleTime);
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);
}
}
}
/**
* 更新居民核酸检测信息(通过任务处理器)
* @author wxz
* @date 2022/11/8 下午8:17
* @param jobEntity
*/
public void execSyncByJobProcessor(IcSyncJobEntity jobEntity) {
DataSyncTaskParam p = new DataSyncTaskParam();
// 正常状态
p.setResiStatus("0");
// 指定组织
p.setAgencyId(jobEntity.getOrgIdPath());
List<NatUserInfoResultDTO> resis = null;
int pageNo = 1;
int pageSize = 1000;
int updatedResiCount = 0;
log.info("【任务处理器同步数据】组织Id:{},开始同步数据,同步类型:{}", jobEntity.getOrgId(), jobEntity.getJobType());
do {
// 分页,一次查询1000居民,循环更新他们的核酸检测信息
resis = getNatUserInfoFromDb(p, pageNo, pageSize);
if (CollectionUtils.isNotEmpty(resis)) {
yantaiHsjcByDbView(resis, jobEntity.getCustomerId(), NumConstant.ONE_STR);
pageNo++;
updatedResiCount += resis.size();
}
} while (CollectionUtils.isNotEmpty(resis));
log.info("【任务处理器同步数据】组织Id:{},同步类型:{},已完成居民数:{}", jobEntity.getOrgId(), jobEntity.getJobType(), updatedResiCount);
}
}

13
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatCompareRecordServiceImpl.java

@ -38,10 +38,12 @@ import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.entity.ContentType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import javax.annotation.Resource;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
@ -66,6 +68,10 @@ public class IcNatCompareRecordServiceImpl extends BaseServiceImpl<IcNatCompareR
@Autowired
private IcNatCompareRecRelationDao icNatCompareRecRelationDao;
@Resource(name = "yantaiNamedParamLantuJdbcTemplate")
private NamedParameterJdbcTemplate yantaiNamedParamLantuJdbcTemplate;
private CustomerStaffInfoCacheResult queryCurrentStaff(String customerId, String userId) {
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId);
if (null == staffInfo) {
@ -106,7 +112,12 @@ public class IcNatCompareRecordServiceImpl extends BaseServiceImpl<IcNatCompareR
CustomerStaffInfoCacheResult staffInfo= queryCurrentStaff(customerId,userId);
Date importTime=new Date();
String importDate= DateUtils.format(importTime,DateUtils.DATE_PATTERN_YYYYMMDD);
IcNatCompareRecordExcelImportListener listener = new IcNatCompareRecordExcelImportListener(customerId, staffInfo, importDate, importTime, this);
IcNatCompareRecordExcelImportListener listener = new IcNatCompareRecordExcelImportListener(customerId,
staffInfo,
importDate,
importTime,
this,
yantaiNamedParamLantuJdbcTemplate);
EasyExcel.read(filePath.toFile(), IcNatCompareRecordExcelData.class, listener).headRowNumber(1).sheet(0).doRead();

12
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java

@ -703,28 +703,28 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> 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<IcNatRelationEntity> 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);
}

83
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<IcSyncJobDao, IcSyncJobEntity> implements IcSyncJobService {
@Override
public PageData<IcSyncJobDTO> page(Map<String, Object> params) {
IPage<IcSyncJobEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, IcSyncJobDTO.class);
}
@Override
public List<IcSyncJobDTO> list(Map<String, Object> params) {
List<IcSyncJobEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, IcSyncJobDTO.class);
}
private QueryWrapper<IcSyncJobEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<IcSyncJobEntity> 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));
}
}

5
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java

@ -203,6 +203,7 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR
public String save(IcTripReportFormDTO formDTO) {
//磐石
if(StrConstant.PS_CUSTOMER_ID.equals(formDTO.getCustomerId())){
formDTO.setReportingTime(DateUtils.integrate(new Date(), "yyyy-MM-dd"));
//判断是磐石客户的7天内旅居史情况没值的按逻辑赋值
if (StringUtils.isEmpty(formDTO.getSojournHistory())) {
//风险地区数据
@ -352,6 +353,7 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR
public String resiSave(IcTripReportFormDTO formDTO) {
//磐石
if(StrConstant.PS_CUSTOMER_ID.equals(formDTO.getCustomerId())){
formDTO.setReportingTime(DateUtils.integrate(new Date(), "yyyy-MM-dd"));
//判断是磐石客户的7天内旅居史情况没值的按逻辑赋值
if (StringUtils.isEmpty(formDTO.getSojournHistory())) {
//风险地区数据
@ -759,6 +761,8 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR
// 7天旅居史字典
Result<List<SysDictDataDTO>> sojournMapRes = adminOpenFeignClient.dictDataList(DictTypeEnum.SOJOURN_HISTORY.getCode());
Map<String, String> sojournMap = sojournMapRes.success() && CollectionUtils.isNotEmpty(sojournMapRes.getData()) ? sojournMapRes.getData().stream().collect(Collectors.toMap(SysDictDataDTO::getDictValue, SysDictDataDTO::getDictLabel)) : new HashMap<>();
//交通方式
Map<String, String> trafficTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.TRAFFIC_TYPE.getCode()).getData();
// 隔离状态字典
Map<String, String> isolateMap = new HashMap<>();
@ -768,6 +772,7 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR
result.getList().forEach(l -> {
l.setIsolateTypeName(isolateMap.get(l.getIsolateType()));
l.setSojournHistoryName(sojournMap.get(l.getSojournHistory()));
l.setTrafficTypeName(trafficTypeMap.containsKey(l.getTrafficType()) ? trafficTypeMap.get(l.getTrafficType()) : "无");
});
}
return result;

60
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineServiceImpl.java

@ -18,15 +18,13 @@ 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;
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;
@ -82,6 +80,8 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
private UserService userService;
@Autowired
private IcNoticeService icNoticeService;
@Autowired
private IcNatDao icNatDao;
/**
* @Author sun
@ -369,7 +369,7 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
// 建立关系
if (resi != null) {
createVaccineRelation(resiVaccine.getId(), resi.getAgencyId(), resi.getPids());
createVaccineRelation(resiVaccine.getId(), resi.getAgencyId(), resi.getPids(), agencyPids);
}
return;
@ -383,7 +383,7 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
// 只要是居民,就创建上关系
if (resi != null) {
createVaccineRelation(e.getId(), resi.getAgencyId(), resi.getPids());
createVaccineRelation(e.getId(), resi.getAgencyId(), resi.getPids(), agencyPids);
}
}
@ -425,7 +425,7 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
* @param vaccineId
* @param currentUserAgencyId
*/
private void createVaccineRelation(String vaccineId, String currentUserAgencyId, String agencyPids) {
private void createVaccineRelation(String vaccineId, String currentUserAgencyId, String agencyPids, String tokenAgencyPids) {
// 没有关系创建关系,有关系就跳过
LambdaQueryWrapper<IcVaccineRelationEntity> query = new LambdaQueryWrapper<>();
@ -440,6 +440,7 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
relation.setPids(String.join(":", Arrays.asList(agencyPids, currentUserAgencyId)));
relation.setIcVaccineId(vaccineId);
relation.setUserType("import");
relation.setIsLocalResiUser(tokenAgencyPids.contains(currentUserAgencyId) ? NumConstant.ONE_STR : NumConstant.ZERO_STR);
icVaccineRelationDao.insert(relation);
}
@ -508,6 +509,9 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
IcVaccineRelationEntity relationEntity = ConvertUtils.sourceToTarget(formDTO, IcVaccineRelationEntity.class);
relationEntity.setIcVaccineId(entity.getId());
relationEntity.setPids(StringUtils.isNotBlank(agencyInfo.getPids()) ? agencyInfo.getPids() + ":" + formDTO.getAgencyId() : formDTO.getAgencyId());
//判断当前身份证号是否本辖区下居民
ResiAndLocalResiResultDTO resiCount = icResiUserDao.getResiCount(formDTO.getAgencyId(), formDTO.getIdCard(), formDTO.getCustomerId());
relationEntity.setIsLocalResiUser(resiCount.getIsLocal() == NumConstant.ZERO ? NumConstant.ZERO_STR : NumConstant.ONE_STR);
icVaccineRelationDao.insert(relationEntity);
//3.新增通知表信息
@ -567,4 +571,46 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
icVaccineRelationDao.delRelation(formDTO.getVaccineId(), null);
}
@Override
public void initVaccineLocal() {
Integer no = NumConstant.ONE;
Integer size;
// 查询关系表
do {
PageInfo<RelationAndNatResultDTO> pageInfo = PageHelper.startPage(no, NumConstant.ONE_THOUSAND).doSelectPageInfo(() -> baseDao.initVaccineLocal());
List<RelationAndNatResultDTO> list = pageInfo.getList();
size = list.size();
if (CollectionUtils.isNotEmpty(list)){
List<IcResiUserEntity> 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<RelationAndNatResultDTO> list,String type){
if (NumConstant.ONE_STR.equals(type)){
if (CollectionUtils.isNotEmpty(list)){
baseDao.updateRelation(list);
}
}else {
baseDao.updateRelationOther("1");
baseDao.updateRelationOther("0");
}
}
}

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

3
epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.86__alter_ic_trip_report.sql

@ -0,0 +1,3 @@
ALTER TABLE `ic_trip_report_record`
ADD COLUMN `pass_by` varchar(255) NULL COMMENT '7天内到达或途径【磐石】' AFTER `registered_residence`;

5
epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.87__alter_ic_vaccine_relation.sql

@ -0,0 +1,5 @@
ALTER TABLE `ic_vaccine_relation`
ADD COLUMN `IS_LOCAL_RESI_USER` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '是否本辖区居民,1:是;0:否' AFTER `USER_TYPE`;

BIN
epmet-user/epmet-user-server/src/main/resources/excel/ps_trip_report_import_template.xlsx

Binary file not shown.

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

@ -47,6 +47,9 @@
<if test='null != customerId and customerId != "" '>
AND CUSTOMER_ID = #{customerId}
</if>
<if test="dataCode != null and dataCode != ''">
AND data_code = #{dataCode}
</if>
order by sort
</select>
@ -103,4 +106,12 @@
</choose>
ORDER BY CREATED_TIME
</select>
<select id="getConfigInfoByType" resultType="com.epmet.dto.DataSyncConfigDTO">
select * FROM data_sync_config
WHERE DEL_FLAG = 0
AND switch_status = #{switchStatus}
AND CUSTOMER_ID = #{customerId}
AND data_code = #{dataCode}
</select>
</mapper>

3
epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml

@ -161,7 +161,8 @@
SELECT
ID,
USER_ID,
ID_CARD
ID_CARD,
SAMPLE_TIME
FROM ic_nat
WHERE del_flag = '0'
AND USER_ID = #{l.userId}

29
epmet-user/epmet-user-server/src/main/resources/mapper/IcSyncJobDao.xml

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.IcSyncJobDao">
<!--查询可执行任务列表-->
<select id="selectExecutableJobList" resultType="com.epmet.entity.IcSyncJobEntity">
select id,
customer_id,
org_id,
pid,
org_id_path,
job_type,
operator_id,
operation_status,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
from ic_sync_job
where OPERATION_STATUS = 'waiting'
and JOB_TYPE = #{jobType}
and DEL_FLAG = 0
order by CREATED_TIME asc
limit #{itemCount}
</select>
</mapper>

27
epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml

@ -7,9 +7,17 @@
<select id="selectMyReported" parameterType="map" resultType="com.epmet.dto.IcTripReportRecordDTO">
SELECT
r.*,
r.CREATED_TIME AS reportTime
r.CREATED_TIME AS reportTime,
(
CASE
WHEN r.USER_TYPE = 'resi' THEN IFNULL(ubi.REAL_NAME, '无')
ELSE IFNULL(cs.REAL_NAME, '无')
END
) AS createdByName
FROM
ic_trip_report_record r
LEFT JOIN customer_staff cs on r.user_type != 'resi' AND r.created_by = cs.user_id AND r.customer_id = cs.customer_id
LEFT JOIN user_base_info ubi ON r.user_type = 'resi' AND r.created_by = ubi.user_id AND r.customer_id = ubi.customer_id
WHERE
r.DEL_FLAG = '0'
AND r.CUSTOMER_ID = #{customerId}
@ -29,11 +37,19 @@
a.ID AS epidemicId,
r.CREATED_TIME AS reportTime,
r.ID_CARD as realIdCard,
r.MOBILE as realMobile
r.MOBILE as realMobile,
(
CASE
WHEN r.USER_TYPE = 'resi' THEN IFNULL(ubi.REAL_NAME, '无')
ELSE IFNULL(cs.REAL_NAME, '无')
END
) AS createdByName
FROM ic_trip_report_record r
LEFT JOIN (
select * from ic_epidemic_special_attention GROUP BY id_card ORDER BY created_time DESC
) a ON (a.ID_CARD = r.ID_CARD AND a.DEL_FLAG = 0 AND a.IS_ATTENTION = 1 AND a.ATTENTION_TYPE = 2)
LEFT JOIN customer_staff cs on r.user_type != 'resi' AND r.created_by = cs.user_id AND r.customer_id = cs.customer_id
LEFT JOIN user_base_info ubi ON r.user_type = 'resi' AND r.created_by = ubi.user_id AND r.customer_id = ubi.customer_id
WHERE
r.DEL_FLAG = '0'
AND r.CUSTOMER_ID = #{customerId}
@ -67,6 +83,9 @@
<if test='null != sojournHistory and "" != sojournHistory'>
AND r.sojourn_history = #{sojournHistory}
</if>
<if test='null != isolateType and "" != isolateType'>
AND r.isolate_type = #{isolateType}
</if>
ORDER BY
r.ARRIVE_DATE DESC, r.CREATED_TIME DESC
</select>
@ -87,6 +106,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

45
epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineDao.xml

@ -35,6 +35,7 @@
a.IC_VACCINE_ID AS vaccineId,
a.agency_id,
a.user_type,
a.is_local_resi_user isLocalResiUser,
b.`name`,
b.mobile,
b.id_card,
@ -63,7 +64,7 @@
AND b.INOCULATE_TIME <![CDATA[ <= ]]> #{endTime}
</if>
<if test='isResiUser != null and isResiUser != ""'>
AND b.IS_RESI_USER = #{isResiUser}
AND a.is_local_resi_user = #{isResiUser}
</if>
ORDER BY b.INOCULATE_TIME DESC, b.id ASC
</select>
@ -183,4 +184,46 @@
and ID_CARD = #{idCard}
and DATE_FORMAT( INOCULATE_TIME, '%Y-%m-%d' ) = #{time}
</select>
<select id="initVaccineLocal" resultType="com.epmet.dto.result.RelationAndNatResultDTO">
SELECT
r.id AS relationId,
i.id AS natId,
i.id_card,
r.pids AS staffAgencyIdPath
FROM ic_vaccine_relation r
INNER JOIN ic_vaccine i ON i.ID = r.ic_vaccine_id AND i.del_flag = 0
WHERE r.del_flag = 0
AND r.user_type = 'import'
</select>
<update id="updateRelation">
UPDATE ic_vaccine_relation
<trim prefix="set" suffixOverrides=",">
<trim prefix="is_local_resi_user =(case" suffix="end),">
<foreach collection="list" item="l">
when ID = #{l.relationId} then #{l.isLocalResiUser}
</foreach>
</trim>
updated_time = NOW()
</trim>
WHERE ID IN(
<foreach collection="list" item="l" separator=",">
#{l.relationId}
</foreach>)
</update>
<update id="updateRelationOther">
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'
<if test="isLocalResiUser == '1'">
and b.USER_ID is not null
and b.USER_ID != ''
</if>
<if test="isLocalResiUser == '0'">
and (b.USER_ID is null or b.USER_ID ='')
</if>
</update>
</mapper>

Loading…
Cancel
Save