Browse Source

Merge branch 'dev_compare_data' of http://git.elinkit.com.cn:7070/r/epmet-cloud into dev_compare_data

master
wangxianzhang 3 years ago
parent
commit
2b776e92c5
  1. 21
      epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/ComplementLogOperationDTO.java
  2. 20
      epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/form/LogOperationListFormDTO.java
  3. 5
      epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/region/LogOperationResultDTO.java
  4. 25
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/LogOperationController.java
  5. 20
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/dao/LogOperationDao.java
  6. 2
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/entity/LogOperationEntity.java
  7. 2
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/RocketMQConsumerRegister.java
  8. 122
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/CheckAndExportOperationLogListener.java
  9. 21
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/LogOperationService.java
  10. 75
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/LogOperationServiceImpl.java
  11. 3
      epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.25__alter_log_operation2.sql
  12. 62
      epmet-admin/epmet-admin-server/src/main/resources/mapper/LogOperationDao.xml
  13. 6
      epmet-auth/src/main/java/com/epmet/service/impl/IcLoginServiceImpl.java
  14. 3
      epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java
  15. 5
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java
  16. 5
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java
  17. 33
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/CheckMQMsg.java
  18. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java
  19. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonUserFeignClient.java
  20. 6
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonUserFeignClientFallback.java
  21. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  22. 38
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerResiUserRedis.java
  23. 539
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/IcResiUserInfoCache.java
  24. 126
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/YtHsResUtils.java
  25. 12
      epmet-module/data-aggregator/data-aggregator-server/pom.xml
  26. 14
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java
  27. 11
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/IcResiUserDao.java
  28. 13
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java
  29. 128
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java
  30. 43
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/IcResiUserDao.xml
  31. 6
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java
  32. 3
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java
  33. 3
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java
  34. 51
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/constant/NeighborhoodConstant.java
  35. 9
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcHouseDTO.java
  36. 25
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DetailByTypeFormDTO.java
  37. 20
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DetailByTypeResultDTO.java
  38. 52
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java
  39. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java
  40. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java
  41. 18
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java
  42. 1
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/TransferFormDTO.java
  43. 3
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatCompareRecordDTO.java
  44. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatListResultDTO.java
  45. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatUserInfoResultDTO.java
  46. 13
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicSpecialAttentionController.java
  47. 24
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  48. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java
  49. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatImportExcelData.java
  50. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatExcelImportListener.java
  51. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcEpidemicSpecialAttentionService.java
  52. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNatService.java
  53. 3
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
  54. 288
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncConfigServiceImpl.java
  55. 13
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncRecordDisabilityServiceImpl.java
  56. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcEpidemicSpecialAttentionServiceImpl.java
  57. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java
  58. 18
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java
  59. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  60. 66
      epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.77__data_compare_d_c.sql
  61. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/ic_nat.xlsx
  62. 8
      epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncRecordDisabilityDao.xml
  63. 1
      epmet-user/epmet-user-server/src/main/resources/mapper/IcNatCompareRecordDao.xml
  64. 35
      epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml
  65. 30
      epmet-user/epmet-user-server/src/test/java/com/epmet/dao/IcNatDaoTest.java

21
epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/ComplementLogOperationDTO.java

@ -0,0 +1,21 @@
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2022/10/20 14:21
* @DESC
*/
@Data
public class ComplementLogOperationDTO implements Serializable {
private static final long serialVersionUID = 7563210356670229204L;
private String staffId;
private String orgId;
private String orgIdPath;
}

20
epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/form/LogOperationListFormDTO.java

@ -10,4 +10,24 @@ public class LogOperationListFormDTO {
private Integer pageNo = 1;
private Integer pageSize = 10;
/**
* 姓名
*/
private String operatorName;
/**
* 手机号
*/
private String operatorMobile;
/**
* yyyyMMdd
*/
private String startTime;
/**
* yyyyMMdd
*/
private String endTime;
/**
* 默认传data_tm
*/
private String category;
}

5
epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/region/LogOperationResultDTO.java

@ -1,7 +1,10 @@
package com.epmet.dto.region;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
/**
*
*/
@ -45,4 +48,6 @@ public class LogOperationResultDTO {
*/
private Long operatingTime;
@JsonFormat(pattern="yyyy-MM-dd HH:mm")
private Date operateTime;
}

25
epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/LogOperationController.java

@ -1,7 +1,10 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.annotation.RequirePermission;
import com.epmet.commons.tools.enums.RequirePermissionEnum;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
@ -45,4 +48,26 @@ public class LogOperationController {
return new Result<List<LogOperationResultDTO>>().ok(resultList);
}
/**
* 数字社区-操作记录
* @param formDTO
* @return
*/
@PostMapping("page")
public Result<PageData<LogOperationResultDTO>> page(@RequestBody LogOperationListFormDTO formDTO, @LoginUser TokenDto tokenDto){
return new Result<PageData<LogOperationResultDTO>>().ok(logOperationService.page(loginUserUtil.getLoginUserCustomerId(),
formDTO.getStartTime(),
formDTO.getEndTime(),
formDTO.getOperatorName(),
formDTO.getOperatorMobile(),
formDTO.getPageNo(),
formDTO.getPageSize(),
formDTO.getCategory(),tokenDto));
}
@PostMapping("complementLogOperation")
public Result complementLogOperation(){
logOperationService.complementLogOperation();
return new Result();
}
}

20
epmet-admin/epmet-admin-server/src/main/java/com/epmet/dao/LogOperationDao.java

@ -18,8 +18,14 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.ComplementLogOperationDTO;
import com.epmet.dto.region.LogOperationResultDTO;
import com.epmet.entity.LogOperationEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 操作日指标
@ -29,5 +35,17 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface LogOperationDao extends BaseDao<LogOperationEntity> {
List<LogOperationResultDTO> pageList(@Param("customerId") String customerId,
@Param("startTime")String startTime,
@Param("endTime")String endTime,
@Param("operatorName")String operatorName,
@Param("operatorMobile")String operatorMobile,
@Param("category")String category,
@Param("agencyId")String agencyId);
List<Map<String,String>> getStaffId();
void updateBatchLog(@Param("list") List<ComplementLogOperationDTO> list);
}

2
epmet-admin/epmet-admin-server/src/main/java/com/epmet/entity/LogOperationEntity.java

@ -79,6 +79,8 @@ public class LogOperationEntity extends BaseEpmetEntity {
* 操作人手机号
*/
private String operatorMobile;
private String orgId;
private String orgIdPath;
/**
* 操作时间,该时间不是插入数据的时间而是操作发生的真实时间

2
epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/RocketMQConsumerRegister.java

@ -5,6 +5,7 @@ import com.epmet.commons.rocketmq.constants.TopicConstants;
import com.epmet.commons.rocketmq.register.MQAbstractRegister;
import com.epmet.commons.rocketmq.register.MQConsumerProperties;
import com.epmet.mq.listener.listener.AuthOperationLogListener;
import com.epmet.mq.listener.listener.CheckAndExportOperationLogListener;
import com.epmet.mq.listener.listener.PointOperationLogListener;
import com.epmet.mq.listener.listener.ProjectOperationLogListener;
import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
@ -19,6 +20,7 @@ public class RocketMQConsumerRegister extends MQAbstractRegister {
register(consumerProperties, ConsomerGroupConstants.AUTH_OPERATION_LOG_GROUP, MessageModel.CLUSTERING, TopicConstants.AUTH, "*", new AuthOperationLogListener());
register(consumerProperties, ConsomerGroupConstants.PROJECT_OPERATION_LOG_GROUP, MessageModel.CLUSTERING, TopicConstants.PROJECT_CHANGED, "*", new ProjectOperationLogListener());
register(consumerProperties, ConsomerGroupConstants.POINT_OPERATION_LOG_GROUP, MessageModel.CLUSTERING, TopicConstants.POINT, "*", new PointOperationLogListener());
register(consumerProperties, ConsomerGroupConstants.CHECK_OR_EXPORT_GROUP, MessageModel.CLUSTERING, TopicConstants.CHECK_OR_EXPORT, "*", new CheckAndExportOperationLogListener());
// ...其他监听器类似
}

122
epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/CheckAndExportOperationLogListener.java

@ -0,0 +1,122 @@
package com.epmet.mq.listener.listener;
import com.alibaba.fastjson.JSON;
import com.epmet.auth.constants.AuthOperationEnum;
import com.epmet.commons.rocketmq.constants.MQUserPropertys;
import com.epmet.commons.rocketmq.messages.CheckMQMsg;
import com.epmet.commons.rocketmq.messages.LoginMQMsg;
import com.epmet.commons.tools.distributedlock.DistributedLock;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.entity.LogOperationEntity;
import com.epmet.mq.listener.bean.log.LogOperationHelper;
import com.epmet.mq.listener.bean.log.OperatorInfo;
import com.epmet.service.LogOperationService;
import org.apache.commons.lang3.StringUtils;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
import org.apache.rocketmq.common.message.MessageExt;
import org.redisson.api.RLock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* @author zxc
* @Description 查询明文或者导出操作日志监听器
*/
public class CheckAndExportOperationLogListener implements MessageListenerConcurrently {
private Logger logger = LoggerFactory.getLogger(getClass());
private RedisUtils redisUtils;
@Override
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) {
if (redisUtils == null) {
redisUtils = SpringContextUtils.getBean(RedisUtils.class);
}
try {
msgs.forEach(msg -> consumeMessage(msg));
} catch (Exception e) {
logger.error(ExceptionUtils.getErrorStackTrace(e));
return ConsumeConcurrentlyStatus.RECONSUME_LATER;
}
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}
private void consumeMessage(MessageExt messageExt) {
String tags = messageExt.getTags();
String msg = new String(messageExt.getBody());
String pendingMsgLabel = messageExt.getUserProperty(MQUserPropertys.BLOCKED_MSG_LABEL);
logger.info("查询明文或者导出操作日志监听器-收到消息内容:{}", msg);
CheckMQMsg msgObj = JSON.parseObject(msg, CheckMQMsg.class);
//获取操作人信息
OperatorInfo operatorInfo = LogOperationHelper.getInstance().getOperatorInfo(msgObj.getUserId());
LogOperationEntity logEntity = new LogOperationEntity();
logEntity.setCategory("data_tm");
logEntity.setType(msgObj.getType());
logEntity.setTypeDisplay(msgObj.getTypeDisplay());
logEntity.setIp(msgObj.getIp());
logEntity.setFromApp(msgObj.getFromApp());
logEntity.setFromClient(msgObj.getFromClient());
logEntity.setTargetId("");
logEntity.setCustomerId(operatorInfo.getCustomerId());
logEntity.setOperatorId(msgObj.getUserId());
logEntity.setOperatorName(operatorInfo.getName());
logEntity.setOperatorMobile(operatorInfo.getMobile());
logEntity.setOperatingTime(msgObj.getOperateTime());
logEntity.setContent(msgObj.getContent());
logEntity.setOrgId(msgObj.getOrgId());
logEntity.setOrgIdPath(msgObj.getOrgIdPath());
DistributedLock distributedLock = null;
RLock lock = null;
try {
distributedLock = SpringContextUtils.getBean(DistributedLock.class);
lock = distributedLock.getLock(String.format("lock:auth_operation_log:%s:%s", logEntity.getType(), logEntity.getOperatorId()),
30L, 30L, TimeUnit.SECONDS);
SpringContextUtils.getBean(LogOperationService.class).log(logEntity);
} catch (RenException e) {
// 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试
logger.error("【RocketMQ】添加操作日志失败:".concat(ExceptionUtils.getErrorStackTrace(e)));
} catch (Exception e) {
// 不是我们自己抛出的异常,可以让MQ重试
logger.error("【RocketMQ】添加操作日志失败:".concat(ExceptionUtils.getErrorStackTrace(e)));
throw e;
} finally {
distributedLock.unLock(lock);
}
if (StringUtils.isNotBlank(pendingMsgLabel)) {
try {
removePendingMqMsgCache(pendingMsgLabel);
} catch (Exception e) {
logger.error("【查询明文或者导出操作日志监听器】-删除mq阻塞消息缓存失败:{}", ExceptionUtils.getErrorStackTrace(e));
}
}
}
/**
* @description
*
* @param pendingMsgLabel
* @return
* @author wxz
* @date 2021.10.14 16:32:32
*/
private void removePendingMqMsgCache(String pendingMsgLabel) {
String key = RedisKeys.blockedMqMsgKey(pendingMsgLabel);
redisUtils.delete(key);
//logger.info("【登录操作事件监听器】删除pendingMsgLabel成功:{}", pendingMsgLabel);
}
}

21
epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/LogOperationService.java

@ -1,5 +1,7 @@
package com.epmet.service;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.region.LogOperationResultDTO;
import com.epmet.entity.LogOperationEntity;
@ -25,4 +27,23 @@ public interface LogOperationService {
* @date 2021.06.07 21:56
*/
List<LogOperationResultDTO> listOperationLogs(String condition, String customerId, Integer pageNo, Integer pageSize);
/**
* 数字社区-操作记录
* @param loginUserCustomerId
* @param startTime
* @param endTime
* @param operatorName
* @param operatorMobile
* @return
*/
PageData<LogOperationResultDTO> page(String loginUserCustomerId,
String startTime,
String endTime,
String operatorName,
String operatorMobile,
Integer pageNo, Integer pageSize, String category, TokenDto tokenDto);
void complementLogOperation();
}

75
epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/LogOperationServiceImpl.java

@ -4,20 +4,30 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.LogOperationDao;
import com.epmet.dto.ComplementLogOperationDTO;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.form.CustomerStaffFormDTO;
import com.epmet.dto.region.LogOperationResultDTO;
import com.epmet.entity.LogOperationEntity;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.service.LogOperationService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
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 org.springframework.util.CollectionUtils;
import java.util.*;
@ -174,7 +184,72 @@ public class LogOperationServiceImpl implements LogOperationService, ResultDataR
ldto.setCustomerId(l.getCustomerId());
ldto.setOperatorMobile(staffMap.get(l.getOperatorId()).getMobile());
ldto.setOperatorName(staffMap.get(l.getOperatorId()).getRealName());
ldto.setOperateTime(l.getOperatingTime());
return ldto;
}).collect(Collectors.toList());
}
/**
* 数字社区-操作记录
*
* @param customerId
* @param startTime
* @param endTime
* @param operatorName
* @param operatorMobile
* @return
*/
@Override
public PageData<LogOperationResultDTO> page(String customerId, String startTime, String endTime, String operatorName, String operatorMobile,
Integer pageNo, Integer pageSize, String category, TokenDto tokenDto) {
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId());
if (null == staffInfo){
throw new EpmetException("未查询工作人员信息:"+tokenDto.getUserId());
}
// 列表/导出查询
PageHelper.startPage(pageNo, pageSize);
List<LogOperationResultDTO> list = logOperationDao.pageList(customerId, startTime, endTime, operatorName, operatorMobile,category,staffInfo.getAgencyId());
PageInfo<LogOperationResultDTO> pageInfo = new PageInfo<>(list);
return new PageData<>(list, pageInfo.getTotal());
}
/**
* Desc: 补全 log_operation 表的 org_id org_id_path
* @param
* @author zxc
* @date 2022/10/20 13:50
*/
@Override
public void complementLogOperation() {
Integer no = NumConstant.ONE;
Integer size;
do {
PageInfo<Map<String,String>> pageInfo = PageHelper.startPage(no, NumConstant.ONE_HUNDRED).doSelectPageInfo(() -> logOperationDao.getStaffId());
size = pageInfo.getList().size();
if (!CollectionUtils.isEmpty(pageInfo.getList())){
List<ComplementLogOperationDTO> needUpdate = new ArrayList<>();
for (Map<String, String> m : pageInfo.getList()) {
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(m.get("CUSTOMER_ID"), m.get("OPERATOR_ID"));
if (null == staffInfo){
logger.warn("未查询到工作人员信息"+m.get("OPERATOR_ID"));
continue;
}
ComplementLogOperationDTO dto = new ComplementLogOperationDTO();
dto.setStaffId(staffInfo.getStaffId());
dto.setOrgId(staffInfo.getAgencyId());
dto.setOrgIdPath(StringUtils.isBlank(staffInfo.getAgencyPIds()) ? staffInfo.getAgencyId() : staffInfo.getAgencyPIds().concat(":").concat(staffInfo.getAgencyId()));
needUpdate.add(dto);
}
if (!CollectionUtils.isEmpty(needUpdate)){
updateLog(needUpdate);
}
}
no++;
}while (size == NumConstant.ONE_HUNDRED);
}
@Transactional(rollbackFor = Exception.class)
public void updateLog(List<ComplementLogOperationDTO> list){
logOperationDao.updateBatchLog(list);
}
}

3
epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.25__alter_log_operation2.sql

@ -0,0 +1,3 @@
alter table log_operation add COLUMN ORG_ID VARCHAR(32) comment '组织ID' AFTER ID;
alter table log_operation add COLUMN ORG_ID_PATH VARCHAR(255) comment '组织ID全路径,包括组织ID' AFTER ORG_ID;

62
epmet-admin/epmet-admin-server/src/main/resources/mapper/LogOperationDao.xml

@ -26,5 +26,67 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<update id="updateBatchLog">
update log_operation
<trim prefix="set" suffixOverrides=",">
<trim prefix="ORG_ID =(case" suffix="end),">
<foreach collection="list" item="item">
when OPERATOR_ID = #{item.staffId} then #{item.orgId}
</foreach>
</trim>
<trim prefix="ORG_ID_PATH =(case" suffix="end),">
<foreach collection="list" item="item">
when OPERATOR_ID = #{item.staffId} then #{item.orgIdPath}
</foreach>
</trim>
UPDATED_TIME = NOW()
</trim>
where 1=1
<foreach collection="list" item="item" open="AND( " separator=" OR " index="index" close=")">
OPERATOR_ID = #{item.staffId}
</foreach>
</update>
<select id="pageList" parameterType="map" resultType="com.epmet.dto.region.LogOperationResultDTO">
SELECT
lo.CATEGORY as category,
lo.TYPE as type,
lo.TYPE_DISPLAY as typeDisplay,
lo.CONTENT as content,
lo.TARGET_ID as targetId,
lo.CUSTOMER_ID as customerId,
lo.OPERATOR_ID as operatorId,
lo.OPERATOR_NAME as operatorName,
lo.OPERATOR_MOBILE as operatorMobile,
lo.OPERATING_TIME as operateTime
FROM
log_operation lo
WHERE
lo.del_flag = '0'
AND lo.CUSTOMER_ID = #{customerId}
AND lo.ORG_ID_PATH LIKE concat('%',#{agencyId},'%')
<if test="category != null and category != ''">
AND lo.CATEGORY = #{category}
</if>
<if test="operatorName != null and operatorName != ''">
AND lo.OPERATOR_NAME LIKE concat('%',#{operatorName},'%')
</if>
<if test="operatorMobile != null and operatorMobile != ''">
AND lo.OPERATOR_MOBILE LIKE concat('%',#{operatorMobile},'%')
</if>
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT( lo.OPERATING_TIME, '%Y%m%d' ) &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT( lo.OPERATING_TIME, '%Y%m%d' ) &lt;= #{endTime}
</if>
ORDER BY lo.OPERATING_TIME DESC
</select>
<select id="getStaffId" resultType="java.util.Map">
SELECT
OPERATOR_ID,
CUSTOMER_ID
FROM log_operation
GROUP BY OPERATOR_ID
</select>
</mapper>

6
epmet-auth/src/main/java/com/epmet/service/impl/IcLoginServiceImpl.java

@ -5,11 +5,14 @@ import com.epmet.auth.constants.AuthOperationConstants;
import com.epmet.commons.rocketmq.messages.LoginMQMsg;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.IcTokenDto;
import com.epmet.commons.tools.utils.CpUserDetailRedis;
import com.epmet.commons.tools.utils.IpUtils;
@ -23,6 +26,7 @@ import com.epmet.jwt.JwtTokenProperties;
import com.epmet.jwt.JwtTokenUtils;
import com.epmet.service.IcLoginService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
@ -115,14 +119,12 @@ public class IcLoginServiceImpl implements IcLoginService, ResultDataResolver {
*/
private void sendLoginEvent(String userId, String fromApp, String fromClient) {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
LoginMQMsg loginMQMsg = new LoginMQMsg();
loginMQMsg.setUserId(userId);
loginMQMsg.setLoginTime(new Date());
loginMQMsg.setIp(IpUtils.getIpAddr(request));
loginMQMsg.setFromApp(fromApp);
loginMQMsg.setFromClient(fromClient);
SystemMsgFormDTO form = new SystemMsgFormDTO();
form.setMessageType(AuthOperationConstants.LOGIN);
form.setContent(loginMQMsg);

3
epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java

@ -12,6 +12,7 @@ import com.epmet.commons.rocketmq.messages.LoginMQMsg;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.enums.EnvEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
@ -19,6 +20,7 @@ import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.redis.common.CustomerDingDingRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.DingMiniInfoCache;
import com.epmet.commons.tools.security.dto.GovTokenDto;
import com.epmet.commons.tools.security.dto.TokenDto;
@ -830,7 +832,6 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol
loginMQMsg.setIp(IpUtils.getIpAddr(request));
loginMQMsg.setFromApp(fromApp);
loginMQMsg.setFromClient(fromClient);
SystemMsgFormDTO form = new SystemMsgFormDTO();
form.setMessageType(AuthOperationConstants.LOGIN);
form.setContent(loginMQMsg);

5
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java

@ -108,4 +108,9 @@ public interface ConsomerGroupConstants {
* 党建积分操作消费组
*/
String PARTY_BUILDING_GROUP = "party_building_group";
/**
* 查看或者导出 日志记录 消费组
*/
String CHECK_OR_EXPORT_GROUP = "check_or_export_group";
}

5
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java

@ -91,4 +91,9 @@ public interface TopicConstants {
String IC_MESSAGE = "ic_message";
String PARTY_BUILDING = "party_building";
/**
* 查看或者导出 日志记录
*/
String CHECK_OR_EXPORT = "check_or_export";
}

33
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/CheckMQMsg.java

@ -0,0 +1,33 @@
package com.epmet.commons.rocketmq.messages;
import lombok.Data;
import java.util.Date;
@Data
public class CheckMQMsg {
/**
* 谁登录
*/
private String userId;
private String content;
private String typeDisplay;
private String type;
/**
* 操作时间
*/
private Date operateTime;
private String ip;
private String fromApp;
private String fromClient;
private String orgId;
private String orgIdPath;
}

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java

@ -13,6 +13,8 @@ import org.springframework.http.MediaType;
public interface StrConstant {
String UTF_8 = CharEncoding.UTF_8;
String HTTP_STATUS_OK = "200";
String HTTP_RESP_CODE = "code";
String ISO_8859_1 = CharEncoding.ISO_8859_1;

4
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonUserFeignClient.java

@ -2,6 +2,7 @@ package com.epmet.commons.tools.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.feign.fallback.CommonUserFeignClientFallBackFactory;
import com.epmet.commons.tools.redis.common.bean.IcResiUserInfoCache;
import com.epmet.commons.tools.redis.common.bean.ResiUserInfoCache;
import com.epmet.commons.tools.utils.Result;
import org.springframework.cloud.openfeign.FeignClient;
@ -17,4 +18,7 @@ import org.springframework.web.bind.annotation.PostMapping;
public interface CommonUserFeignClient {
@PostMapping("/epmetuser/userbaseinfo/getUserInfo/{userId}")
Result<ResiUserInfoCache> getUserInfo(@PathVariable("userId") String userId);
@PostMapping("/epmetuser/icresiuser/getIcResiUserInfo/{userId}")
Result<IcResiUserInfoCache> getIcResiUserInfo(@PathVariable("userId") String userId);
}

6
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonUserFeignClientFallback.java

@ -2,6 +2,7 @@ package com.epmet.commons.tools.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.feign.CommonUserFeignClient;
import com.epmet.commons.tools.redis.common.bean.IcResiUserInfoCache;
import com.epmet.commons.tools.redis.common.bean.ResiUserInfoCache;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
@ -20,4 +21,9 @@ public class CommonUserFeignClientFallback implements CommonUserFeignClient {
public Result<ResiUserInfoCache> getUserInfo(String userId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserInfo", userId);
}
@Override
public Result<IcResiUserInfoCache> getIcResiUserInfo(String userId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getIcResiUserInfo", userId);
}
}

4
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -393,6 +393,10 @@ public class RedisKeys {
return rootPrefix.concat("resi:user:").concat(userId);
}
public static String getIcResiUserKey(String userId) {
return rootPrefix.concat("resi:icResiUser:").concat(userId);
}
/**
* @param userId
* @return epmet:badge:user:[customerId]:[userId]

38
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerResiUserRedis.java

@ -1,10 +1,12 @@
package com.epmet.commons.tools.redis.common;
import cn.hutool.core.bean.BeanUtil;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.CommonUserFeignClient;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.redis.common.bean.IcResiUserInfoCache;
import com.epmet.commons.tools.redis.common.bean.ResiUserInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
@ -70,6 +72,31 @@ public class CustomerResiUserRedis {
return resultData;
}
public static IcResiUserInfoCache getIcResiUserInfo(String icResiUserId){
if (StringUtils.isBlank(icResiUserId)){
log.warn("getIcResiUserInfo param is blank,userId:{}",icResiUserId);
return null;
}
String key = RedisKeys.getIcResiUserKey(icResiUserId);
Map<String, Object> map = customerResiUserRedis.redisUtils.hGetAll(key);
if (!CollectionUtils.isEmpty(map)) {
return ConvertUtils.mapToEntity(map, IcResiUserInfoCache.class);
}
Result<IcResiUserInfoCache> result = customerResiUserRedis.commonUserFeignClient.getIcResiUserInfo(icResiUserId);
if (result == null || !result.success()) {
throw new EpmetException("获取居民信息失败");
}
IcResiUserInfoCache data = result.getData();
if (null == data) {
log.warn("居民信息为空,userId:{}", icResiUserId);
return null;
}
Map<String, Object> cacheMap = BeanUtil.beanToMap(data, false, true);
customerResiUserRedis.redisUtils.hMSet(key, cacheMap);
return data;
}
@Nullable
private static ResiUserInfoCache reloadStaffCache(String userId, String key) {
Result<ResiUserInfoCache> result = customerResiUserRedis.commonUserFeignClient.getUserInfo(userId);
@ -87,4 +114,15 @@ public class CustomerResiUserRedis {
return resultData;
}
/**
* Desc: 删除Ic居民缓存
* @param icResiUserId
* @author zxc
* @date 2022/10/20 15:57
*/
public static Boolean delIcResiUserInfo(String icResiUserId){
String key = RedisKeys.getIcResiUserKey(icResiUserId);
return customerResiUserRedis.redisUtils.delete(key);
}
}

539
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/IcResiUserInfoCache.java

@ -0,0 +1,539 @@
package com.epmet.commons.tools.redis.common.bean;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Author zxc
* @DateTime 2022/10/17 15:40
* @DESC
*/
@Data
public class IcResiUserInfoCache implements Serializable {
private static final long serialVersionUID = -3644143706074015380L;
/**
* 主键
*/
private String id;
/**
* 客户Id customer.id
*/
private String customerId;
/**
*
*/
private String agencyId;
/**
*
*/
private String pids;
/**
* 网格ID
*/
private String gridId;
/**
* 所属小区ID
*/
private String villageId;
/**
* 所属楼宇Id
*/
private String buildId;
/**
* 单元id
*/
private String unitId;
/**
* 所属家庭Id
*/
private String homeId;
/**
* 是否本地户籍
*/
private String isBdhj;
/**
* 姓名
*/
private String name;
/**
* 手机号
*/
private String mobile;
/**
* 性别
*/
private String gender;
/**
* 身份证号
*/
private String idCard;
/**
* 出生日期
*/
private String birthday;
/**
* 备注
*/
private String remarks;
/**
* 联系人
*/
private String contacts;
/**
* 联系人电话
*/
private String contactsMobile;
/**
* 九小场所url
*/
private String ninePlace;
/**
* 是否党员
*/
private String isParty;
/**
* 是否低保户
*/
private String isDbh;
/**
* 是否保障房
*/
private String isEnsureHouse;
/**
* 是否失业
*/
private String isUnemployed;
/**
* 是否育龄妇女
*/
private String isYlfn;
/**
* 是否退役军人
*/
private String isVeterans;
/**
* 是否统战人员
*/
private String isUnitedFront;
/**
* 是否信访人员
*/
private String isXfry;
/**
* 是否志愿者
*/
private String isVolunteer;
/**
* 是否老年人
*/
private String isOldPeople;
/**
* 是否空巢
*/
private String isKc;
/**
* 是否失独
*/
private String isSd;
/**
* 是否失能
*/
private String isSn;
/**
* 是否失智
*/
private String isSz;
/**
* 是否残疾
*/
private String isCj;
/**
* 是否大病
*/
private String isDb;
/**
* 是否慢病
*/
private String isMb;
/**
* 是否特殊人群
*/
private String isSpecial;
/**
* 是否租户:1 :0
*/
private String isTenant;
/**
* 是否是流动人口:1 :0
*/
private String isFloating;
/**
* 是否新阶层人士:1 :0
*/
private String isXjc;
/**
* 文化程度字典表
*/
private String culture;
/**
* 文化程度备注
*/
private String cultureRemakes;
/**
* 特长字典表
*/
private String specialSkill;
/**
* 兴趣爱好
*/
private String hobby;
/**
* 兴趣爱好备注
*/
private String hobbyRemakes;
/**
* 宗教信仰
*/
private String faith;
/**
* 宗教信仰备注
*/
private String faithRemakes;
/**
* 残疾类别字典表
*/
private String cjlb;
/**
* 残疾登记(状况)字典表
*/
private String cjzk;
/**
* 残疾证号
*/
private String cjzh;
/**
* 残疾说明
*/
private String cjsm;
/**
* 有无监护人yes no
*/
private String ynJdr;
/**
* 有无技能特长yes no
*/
private String ynJntc;
/**
* 有无劳动能力
*/
private String ynLdnl;
/**
* 有无非义务教育阶段助学yes no
*/
private String ynFywjyjdzx;
/**
* 所患大病
*/
private String shdb;
/**
* 患大病时间
*/
private String dbsj;
/**
* 所患慢性病
*/
private String shmxb;
/**
* 患慢性病时间
*/
private String mxbsj;
/**
* 是否参保
*/
private String isCb;
/**
* 自付金额
*/
private String zfje;
/**
* 救助金额
*/
private String jzje;
/**
* 救助时间[yyyy-MM-dd]
*/
private String jzsj;
/**
* 享受救助明细序号
*/
private String jzmxxh;
/**
* 健康信息备注
*/
private String healthRemakes;
/**
* 工作单位
*/
private String gzdw;
/**
* 职业
*/
private String zy;
/**
* 离退休时间
*/
private String ltxsj;
/**
* 工作信息备注
*/
private String workRemake;
/**
* 退休金额
*/
private String txje;
/**
* 月收入
*/
private String ysr;
/**
* 是否经济低保
*/
private String isJjdb;
/**
* 籍贯
*/
private String jg;
/**
* 户籍所在地
*/
private String hjszd;
/**
* 现居住地
*/
private String xjzd;
/**
* 人户情况
*/
private String rhzk;
/**
* 居住信息备注
*/
private String jzxxRemakes;
/**
* 民族字典表
*/
private String mz;
/**
* 与户主关系字典表
*/
private String yhzgx;
/**
* 居住情况字典表
*/
private String jzqk;
/**
* 婚姻状况字典表
*/
private String hyzk;
/**
* 配偶情况字典表
*/
private String poqk;
/**
* 有无赡养人
*/
private String ynSyr;
/**
* 与赡养人关系字典表
*/
private String ysyrgx;
/**
* 赡养人电话
*/
private String syrMobile;
/**
* 家庭信息备注
*/
private String jtxxRemakes;
/**
* 用户状态0:正常;1:迁出;2:注销
*/
private String status;
/**
* 用户详细状态01新增02导入03迁入04新生11迁出21死亡
*/
private String subStatus;
/**
* 删除标识 0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 预留字段1
*/
private String field1;
/**
* 预留字段2
*/
private String field2;
/**
* 预留字段3
*/
private String field3;
/**
* 预留字段4
*/
private String field4;
/**
* 预留字段5
*/
private String field5;
/**
* 预留字段6
*/
private String field6;
/**
* 预留字段7
*/
private String field7;
/**
* 预留字段8
*/
private String field8;
/**
* 预留字段9
*/
private String field9;
/**
* 预留字段10
*/
private String field10;
}

126
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/YtHsResUtils.java

@ -2,14 +2,18 @@ package com.epmet.commons.tools.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.epmet.commons.tools.constant.StrConstant;
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.google.common.util.concurrent.RateLimiter;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
/**
* @Description
@ -19,14 +23,15 @@ import java.util.Map;
@Slf4j
public class YtHsResUtils {
private static String SERVER_URL = "http://10.2.2.60:8191/sjzt/server/";
private static final String APP_KEY_VALUE = "DR4jF5Be7sCsqDmCamq2tmYCl";
private static final String APP_KEY = "appkey";
private static final String CARD_NO = "card_no";
private static final String USER_NAME = "name";
private static final String ROW_NUM = "ROWNUM";
private static final String PAGE_SIZE = "PAGESIZE";
private static final String START = "ROWNUM";
private static final String LIMIT = "PAGESIZE";
/**
* rate is "2 permits per second"
*/
private static final Map<String,RateLimiter> rateLimiterMap = new ConcurrentHashMap<>();
/**
* desc:核酸采样查询
@ -35,28 +40,42 @@ public class YtHsResUtils {
*/
public static YtHscyResDTO hscy(String cardNo, Integer rowNum, Integer pageSize) {
try {
tryAcquire("hscy");
Map<String, Object> param = new HashMap<>();
param.put(APP_KEY, APP_KEY_VALUE);
param.put(APP_KEY, "tz45j4kuWcnnjoJOVSlzGWJgI");
param.put(CARD_NO, cardNo);
param.put(ROW_NUM, rowNum);
param.put(PAGE_SIZE, pageSize);
log.info("hscy api param:{}", param);
//todo 核酸检测 mock数据 放开她
//Result<String> result = HttpClientManager.getInstance().sendGet(SERVER_URL+"hscyxxcx", param);
String mockData = "{\"id\":\"1570924677539635484\",\"name\":\"杨XX\",\"card_type\":\"1\",\"card_no\":\"370283199912010302\",\"create_by\":\"370613594\",\"create_time\":\"2022-09-17 07:15:22\",\"sys_org_code\":\"370613\",\"sample_tube\":\"GCJ-0825-0441\",\"package_id\":\"bcj00208083952\",\"city\":\"烟台市\",\"uuid\":\"6225684525062602095\",\"county\":\"莱山区\",\"depart_ids\":\"未填写\",\"depart_name\":null,\"realname\":\"采样点327\",\"upload_time\":\"2022-09-17 07:56:45\",\"sd_id\":null,\"sd_batch\":null,\"sd_operation\":null,\"sd_time\":null,\"inserttime\":\"2022-09-17 09:36:20\"}";
Result<String> result = new Result<String>().ok(mockData);
Result<String> result = HttpClientManager.getInstance().sendGet(SERVER_URL + "hscyxxcx", param);
// String mockData = "{\"code\":\"200\",\"msg\":\"请求成功\",\"data\":[{\"id\":\"1570924677539635484\",\"name\":\"杨XX\",\"card_type\":\"1\",\"card_no\":\"370283199912010302\",\"create_by\":\"370613594\",\"create_time\":\"2022-09-24 06:48:28\",\"sys_org_code\":\"370613\",\"sample_tube\":\"GCJ-0825-0441\",\"package_id\":\"bcj00208083952\",\"city\":\"烟台市\",\"uuid\":\"6225684525062602095\",\"county\":\"莱山区\",\"depart_ids\":\"未填写\",\"depart_name\":null,\"realname\":\"采样点327\",\"upload_time\":\"2022-09-17 07:56:45\",\"sd_id\":null,\"sd_batch\":null,\"sd_operation\":null,\"sd_time\":null,\"inserttime\":\"2022-09-17 09:36:20\"}]}";
// Result<String> result = new Result<String>().ok(mockData);
log.info("hscy api result:{}", JSON.toJSONString(result));
if (result.success()) {
return JSON.parseObject(result.getData(), YtHscyResDTO.class);
String data = result.getData();
JSONObject jsonObject = JSON.parseObject(data);
if (jsonObject != null && StrConstant.HTTP_STATUS_OK.equals(jsonObject.getString(StrConstant.HTTP_RESP_CODE))) {
return JSON.parseObject(result.getData(), YtHscyResDTO.class);
} else {
log.warn("hscy 调用蓝图接口败");
}
}
} catch (Exception e) {
log.error(String.format("烟台核酸检测结果查询异常cardNo:%s,异常信息:%s", cardNo, e.getMessage()));
log.error(String.format("烟台核酸检测结果查询异常cardNo:%s", cardNo), e);
}
YtHscyResDTO resultResult = new YtHscyResDTO();
resultResult.setData(new ArrayList<>());
return resultResult;
}
private static void tryAcquire(String hscy) {
RateLimiter rateLimiter = rateLimiterMap.getOrDefault(hscy, RateLimiter.create(2.0));
rateLimiterMap.putIfAbsent(hscy,rateLimiter);
rateLimiter.tryAcquire(1, TimeUnit.SECONDS);
}
/**
* desc:核酸结果查询
*
@ -64,24 +83,30 @@ public class YtHsResUtils {
*/
public static YtHsjcResDTO hsjc(String cardNo, Integer rowNum, Integer pageSize) {
try {
//String param = String.format("&card_no=%s&ROWNUM=%s&PAGESIZE=%s", cardNo, rowNum, pageSize);
//String apiUrl = url.concat(param);
tryAcquire("hsjc");
Map<String, Object> param = new HashMap<>();
param.put(APP_KEY, APP_KEY_VALUE);
param.put(APP_KEY, "DR4jF5Be7sCsqDmCamq2tmYCl");
param.put(CARD_NO, cardNo);
param.put(ROW_NUM, rowNum);
param.put(PAGE_SIZE, pageSize);
log.info("hsjc api param:{}", param);
//todo 核酸检测 mock数据 放开她
//Result<String> result = HttpClientManager.getInstance().sendGet(SERVER_URL+"hsjcxx", param);
String mockData = "{\"code\":\"200\",\"msg\":\"请求成功\",\"data\":[{\"id\":\"6a31eb2d38c011eda054fa163ebc7ff4\",\"name\":\"数据同步测试用户\",\"card_no\":\"370283199912010302\",\"telephone\":\"13697890860\",\"address\":\"保利香榭里公馆18-1-302\",\"test_time\":\"2022-09-20 12:52:28\",\"depart_name\":\"天仁医学检验实验室有限公司\",\"county\":\"莱山区\",\"upload_time\":\"2022-09-20 21:23:10\",\"sample_result_pcr\":\"2\",\"sample_time\":\"2022-09-20 06:48:28\",\"sampling_org_pcr\":\"采样点327\"}],\"total\":1}";
Result<String> result = new Result<String>().ok(mockData);
Result<String> result = HttpClientManager.getInstance().sendGet(SERVER_URL + "hsjcxx", param);
// String mockData = "{\"code\":\"200\",\"msg\":\"请求成功\",\"data\":[{\"id\":\"6a31eb2d38c011eda054fa163ebc7ff4\",\"name\":\"数据同步测试用户\",\"card_no\":\"370283199912010302\",\"telephone\":\"13697890860\",\"address\":\"保利香榭里公馆18-1-302\",\"test_time\":\"2022-09-24 12:52:28\",\"depart_name\":\"天仁医学检验实验室有限公司\",\"county\":\"莱山区\",\"upload_time\":\"2022-09-20 21:23:10\",\"sample_result_pcr\":\"2\",\"sample_time\":\"2022-09-24 06:48:28\",\"sampling_org_pcr\":\"采样点327\"}],\"total\":1}";
// Result<String> result = new Result<String>().ok(mockData);
log.info("hsjc api result:{}", JSON.toJSONString(result));
if (result.success()) {
return JSON.parseObject(result.getData(), YtHsjcResDTO.class);
String data = result.getData();
JSONObject jsonObject = JSON.parseObject(data);
if (jsonObject != null && StrConstant.HTTP_STATUS_OK.equals(jsonObject.getString(StrConstant.HTTP_RESP_CODE))) {
return JSON.parseObject(result.getData(), YtHsjcResDTO.class);
} else {
log.warn("hsjc 调用蓝图接口败");
}
}
} catch (Exception e) {
log.error(String.format("烟台核酸检测结果查询异常cardNo:%s,异常信息:%s", cardNo, e.getMessage()));
log.error(String.format("烟台核酸检测结果查询异常cardNo:%s", cardNo), e);
}
YtHsjcResDTO resultResult = new YtHsjcResDTO();
resultResult.setData(new ArrayList<>());
@ -95,13 +120,14 @@ public class YtHsResUtils {
*/
public static YtDataSyncResDTO siWang(String cardNo, String userName) {
try {
tryAcquire("siWang");
// 1)appkey秘钥
// 2)name姓名 必填
// 3)idcard身份证号 必填
// 4)start开始默认0
// 5)limit每页记录数
Map<String, Object> param = new HashMap<>();
param.put(APP_KEY, APP_KEY_VALUE);
param.put(APP_KEY, "IGE8TMM6f4t1Sef7FfstOLHAL");
param.put("id_card", cardNo);
param.put("name", userName);
param.put("start", 0);
@ -109,24 +135,26 @@ public class YtHsResUtils {
log.info("siWang api param:{}", param);
//todo 放开他
//Result<String> result = HttpClientManager.getInstance().sendGet(SERVER_URL+"mzt_hhrysj1", param);
String mockData = "{\"code\":\"200\",\"msg\":\"请求成功\",\"data\":\"{\\\"code\\\":200,\\\"data\\\":\\\"{\\\\\\\"data\\\\\\\":[{\\\\\\\"AGE\\\\\\\":\\\\\\\"82\\\\\\\",\\\\\\\"BIRTHDAY\\\\\\\":\\\\\\\"1933-02-23\\\\\\\",\\\\\\\"CARD_TYPE\\\\\\\":\\\\\\\"1\\\\\\\",\\\\\\\"CREATE_ORGAN_NAME\\\\\\\":\\\\\\\"莱州市殡仪馆\\\\\\\",\\\\\\\"CREMATION_TIME\\\\\\\":\\\\\\\"2016-01-03 13:01\\\\\\\",\\\\\\\"DEAD_ID\\\\\\\":\\\\\\\"8abc809851ffaf1501520600555c2849\\\\\\\",\\\\\\\"DEATH_DATE\\\\\\\":\\\\\\\"2016-01-02\\\\\\\",\\\\\\\"FAMILY_ADD\\\\\\\":\\\\\\\"山东省莱州市光州西路420号\\\\\\\",\\\\\\\"FOLK\\\\\\\":\\\\\\\"01\\\\\\\",\\\\\\\"ID_CARD\\\\\\\":\\\\\\\"370625193302231929\\\\\\\",\\\\\\\"NAME\\\\\\\":\\\\\\\"陈秀芬\\\\\\\",\\\\\\\"NATION\\\\\\\":\\\\\\\"156\\\\\\\",\\\\\\\"POPULACE\\\\\\\":\\\\\\\"3381C300B4B9439FE05319003C0A0897\\\\\\\",\\\\\\\"POPULACE_NAME\\\\\\\":\\\\\\\"烟台市莱州市文昌路街道\\\\\\\",\\\\\\\"RECORD_ID\\\\\\\":\\\\\\\"8abc809851ffaf1501520600694e2877\\\\\\\",\\\\\\\"RN\\\\\\\":\\\\\\\"1\\\\\\\",\\\\\\\"SEX\\\\\\\":\\\\\\\"2\\\\\\\"}],\\\\\\\"fields\\\\\\\":[\\\\\\\"RN\\\\\\\",\\\\\\\"RECORD_ID\\\\\\\",\\\\\\\"DEAD_ID\\\\\\\",\\\\\\\"NAME\\\\\\\",\\\\\\\"SEX\\\\\\\",\\\\\\\"CARD_TYPE\\\\\\\",\\\\\\\"ID_CARD\\\\\\\",\\\\\\\"BIRTHDAY\\\\\\\",\\\\\\\"AGE\\\\\\\",\\\\\\\"NATION\\\\\\\",\\\\\\\"FOLK\\\\\\\",\\\\\\\"IF_LOCAL\\\\\\\",\\\\\\\"POPULACE\\\\\\\",\\\\\\\"FAMILY_ADD\\\\\\\",\\\\\\\"WORK_NAME\\\\\\\",\\\\\\\"DEATH_DATE\\\\\\\",\\\\\\\"CREMATION_TIME\\\\\\\",\\\\\\\"CREATE_ORGAN_NAME\\\\\\\",\\\\\\\"POPULACE_NAME\\\\\\\"],\\\\\\\"total\\\\\\\":\\\\\\\"1\\\\\\\"}\\\",\\\"message\\\":\\\"\\\"}\",\"total\":0}";
Result<String> result = new Result<String>().ok(mockData);
Result<String> result = HttpClientManager.getInstance().sendGet(SERVER_URL + "mzt_hhrysj1", param);
// String mockData = "{\"code\":\"200\",\"msg\":\"请求成功\",\"data\":\"{\\\"code\\\":200,\\\"data\\\":\\\"{\\\\\\\"data\\\\\\\":[{\\\\\\\"AGE\\\\\\\":\\\\\\\"82\\\\\\\",\\\\\\\"BIRTHDAY\\\\\\\":\\\\\\\"1933-02-23\\\\\\\",\\\\\\\"CARD_TYPE\\\\\\\":\\\\\\\"1\\\\\\\",\\\\\\\"CREATE_ORGAN_NAME\\\\\\\":\\\\\\\"莱州市殡仪馆\\\\\\\",\\\\\\\"CREMATION_TIME\\\\\\\":\\\\\\\"2016-01-03 13:01\\\\\\\",\\\\\\\"DEAD_ID\\\\\\\":\\\\\\\"8abc809851ffaf1501520600555c2849\\\\\\\",\\\\\\\"DEATH_DATE\\\\\\\":\\\\\\\"2016-01-02\\\\\\\",\\\\\\\"FAMILY_ADD\\\\\\\":\\\\\\\"山东省莱州市光州西路420号\\\\\\\",\\\\\\\"FOLK\\\\\\\":\\\\\\\"01\\\\\\\",\\\\\\\"ID_CARD\\\\\\\":\\\\\\\"370625193302231929\\\\\\\",\\\\\\\"NAME\\\\\\\":\\\\\\\"陈秀芬\\\\\\\",\\\\\\\"NATION\\\\\\\":\\\\\\\"156\\\\\\\",\\\\\\\"POPULACE\\\\\\\":\\\\\\\"3381C300B4B9439FE05319003C0A0897\\\\\\\",\\\\\\\"POPULACE_NAME\\\\\\\":\\\\\\\"烟台市莱州市文昌路街道\\\\\\\",\\\\\\\"RECORD_ID\\\\\\\":\\\\\\\"8abc809851ffaf1501520600694e2877\\\\\\\",\\\\\\\"RN\\\\\\\":\\\\\\\"1\\\\\\\",\\\\\\\"SEX\\\\\\\":\\\\\\\"2\\\\\\\"}],\\\\\\\"fields\\\\\\\":[\\\\\\\"RN\\\\\\\",\\\\\\\"RECORD_ID\\\\\\\",\\\\\\\"DEAD_ID\\\\\\\",\\\\\\\"NAME\\\\\\\",\\\\\\\"SEX\\\\\\\",\\\\\\\"CARD_TYPE\\\\\\\",\\\\\\\"ID_CARD\\\\\\\",\\\\\\\"BIRTHDAY\\\\\\\",\\\\\\\"AGE\\\\\\\",\\\\\\\"NATION\\\\\\\",\\\\\\\"FOLK\\\\\\\",\\\\\\\"IF_LOCAL\\\\\\\",\\\\\\\"POPULACE\\\\\\\",\\\\\\\"FAMILY_ADD\\\\\\\",\\\\\\\"WORK_NAME\\\\\\\",\\\\\\\"DEATH_DATE\\\\\\\",\\\\\\\"CREMATION_TIME\\\\\\\",\\\\\\\"CREATE_ORGAN_NAME\\\\\\\",\\\\\\\"POPULACE_NAME\\\\\\\"],\\\\\\\"total\\\\\\\":\\\\\\\"1\\\\\\\"}\\\",\\\"message\\\":\\\"\\\"}\",\"total\":0}";
// Result<String> result = new Result<String>().ok(mockData);
log.info("siWang api result:{}", JSON.toJSONString(result));
if (!result.success()) {
return new YtDataSyncResDTO();
}
String data = result.getData();
JSONObject jsonObject = JSON.parseObject(data);
//他们的结果是成功的
if (jsonObject != null && "200".equals(jsonObject.getString("code"))) {
if (jsonObject != null && StrConstant.HTTP_STATUS_OK.equals(jsonObject.getString(StrConstant.HTTP_RESP_CODE))) {
//第一层
JSONObject firstData = JSON.parseObject(jsonObject.getString("data"));
//第二层 data
if (firstData != null && "200".equals(firstData.getString("code"))) {
if (firstData != null && StrConstant.HTTP_STATUS_OK.equals(firstData.getString(StrConstant.HTTP_RESP_CODE))) {
//第一层
JSONObject secondData = JSON.parseObject(firstData.getString("data"));
Object thirdData = "";
if (secondData != null && secondData.getJSONArray("data") != null) {
if (secondData != null && secondData.getJSONArray("data") != null && secondData.getJSONArray("data").size() >0 ) {
//第二层 data
thirdData = secondData.getJSONArray("data").get(0);
}
@ -138,7 +166,7 @@ public class YtHsResUtils {
log.warn("siWang 调用蓝图接口败");
}
} catch (Exception e) {
log.error(String.format("烟台siWang结果查询异常cardNo:%s,异常信息:%s", cardNo, e.getMessage()));
log.error(String.format("烟台siWang结果查询异常cardNo:%s", cardNo), e);
}
return new YtDataSyncResDTO();
}
@ -150,6 +178,7 @@ public class YtHsResUtils {
* @remark默认失败 因为一旦成功没有数据 会影响残疾人的数据 接口失败数据不做任何处理
*/
public static YtDataSyncResDTO canji(String idCard, String userName) {
tryAcquire("canji");
YtDataSyncResDTO failResult = new YtDataSyncResDTO();
failResult.setCode(500);
@ -159,46 +188,27 @@ public class YtHsResUtils {
// 2)name姓名
// 3)citizenId身份证号
Map<String, Object> param = new HashMap<>();
param.put(APP_KEY, APP_KEY_VALUE);
param.put(APP_KEY, "EWGsaK0aM21wkDjCIWbahGVk2");
param.put("citizenId", idCard);
param.put("name", userName);
log.info("canji api param:{}", param);
//todo 上线放开她
//Result<String> result = HttpClientManager.getInstance().sendGet(SERVER_URL+"sdcl_xxzx_czcjr1", param);
String mockData = "{\"code\":\"200\",\"msg\":\"请求成功\",\"data\":\"{\\\"code\\\":200,\\\"data\\\":\\\"{\\\\\\\"result\\\\\\\":true,\\\\\\\"errorcode\\\\\\\":0,\\\\\\\"msg\\\\\\\":\\\\\\\"获取成功\\\\\\\",\\\\\\\"data\\\\\\\":{\\\\\\\"isNewRecord\\\\\\\":true,\\\\\\\"delFlag\\\\\\\":\\\\\\\"0\\\\\\\",\\\\\\\"pageNo\\\\\\\":0,\\\\\\\"pageSize\\\\\\\":0,\\\\\\\"name\\\\\\\":\\\\\\\"数据同步测试用户\\\\\\\",\\\\\\\"genderName\\\\\\\":\\\\\\\"男\\\\\\\",\\\\\\\"citizenId\\\\\\\":\\\\\\\"370682198002072719\\\\\\\",\\\\\\\"cardNum\\\\\\\":\\\\\\\"370283199912010302\\\\\\\",\\\\\\\"idtKindName\\\\\\\":\\\\\\\"精神\\\\\\\",\\\\\\\"idtLevelName\\\\\\\":\\\\\\\"二级\\\\\\\",\\\\\\\"eduLevelName\\\\\\\":\\\\\\\"小学\\\\\\\",\\\\\\\"marriagerName\\\\\\\":\\\\\\\"未婚\\\\\\\",\\\\\\\"guardian\\\\\\\":\\\\\\\"盖希仁\\\\\\\",\\\\\\\"guardianPhone\\\\\\\":\\\\\\\"13854516627\\\\\\\",\\\\\\\"guardianRName\\\\\\\":\\\\\\\"兄/弟/姐/妹\\\\\\\",\\\\\\\"raceName\\\\\\\":\\\\\\\"汉族\\\\\\\",\\\\\\\"certDate\\\\\\\":1620779842000,\\\\\\\"residentAdd\\\\\\\":\\\\\\\"姜疃镇凤头村248号附1号\\\\\\\",\\\\\\\"nowAdd\\\\\\\":\\\\\\\"山东省烟台市莱阳市姜疃镇凤头村委会\\\\\\\",\\\\\\\"phoneNo\\\\\\\":\\\\\\\"13854516627\\\\\\\"}}\\\",\\\"message\\\":\\\"\\\"}\",\"total\":0}";
Result<String> result = new Result<String>().ok(mockData);
Result<String> result = HttpClientManager.getInstance().sendGet(SERVER_URL + "sdcl_xxzx_czcjr1", param);
// String mockData = "{\"code\":\"200\",\"msg\":\"请求成功\",\"data\":\"{\\\"code\\\":200,\\\"data\\\":\\\"{\\\\\\\"result\\\\\\\":true,\\\\\\\"errorcode\\\\\\\":0,\\\\\\\"msg\\\\\\\":\\\\\\\"获取成功\\\\\\\",\\\\\\\"data\\\\\\\":{\\\\\\\"isNewRecord\\\\\\\":true,\\\\\\\"delFlag\\\\\\\":\\\\\\\"0\\\\\\\",\\\\\\\"pageNo\\\\\\\":0,\\\\\\\"pageSize\\\\\\\":0,\\\\\\\"name\\\\\\\":\\\\\\\"数据同步测试用户\\\\\\\",\\\\\\\"genderName\\\\\\\":\\\\\\\"男\\\\\\\",\\\\\\\"citizenId\\\\\\\":\\\\\\\"370682198002072719\\\\\\\",\\\\\\\"cardNum\\\\\\\":\\\\\\\"370283199912010302\\\\\\\",\\\\\\\"idtKindName\\\\\\\":\\\\\\\"精神\\\\\\\",\\\\\\\"idtLevelName\\\\\\\":\\\\\\\"二级\\\\\\\",\\\\\\\"eduLevelName\\\\\\\":\\\\\\\"小学\\\\\\\",\\\\\\\"marriagerName\\\\\\\":\\\\\\\"未婚\\\\\\\",\\\\\\\"guardian\\\\\\\":\\\\\\\"盖希仁\\\\\\\",\\\\\\\"guardianPhone\\\\\\\":\\\\\\\"13854516627\\\\\\\",\\\\\\\"guardianRName\\\\\\\":\\\\\\\"兄/弟/姐/妹\\\\\\\",\\\\\\\"raceName\\\\\\\":\\\\\\\"汉族\\\\\\\",\\\\\\\"certDate\\\\\\\":1620779842000,\\\\\\\"residentAdd\\\\\\\":\\\\\\\"姜疃镇凤头村248号附1号\\\\\\\",\\\\\\\"nowAdd\\\\\\\":\\\\\\\"山东省烟台市莱阳市姜疃镇凤头村委会\\\\\\\",\\\\\\\"phoneNo\\\\\\\":\\\\\\\"13854516627\\\\\\\"}}\\\",\\\"message\\\":\\\"\\\"}\",\"total\":0}";
// Result<String> result = new Result<String>().ok(mockData);
log.info("canji api result:{}", JSON.toJSONString(result));
if (result.success()) {
/*返回示例
{
"code":"200",
"msg":"请求成功",
"data":"{
\"code\":200,
\"data\":{
\\\"result\\\":true,
\\\"errorcode\\\":0,
\\\"msg\\\":\\\"获取成功\\\",
\\\"data\\\":{
\\\"isNewRecord\\\":\\\"true\\\",
}
}
\"message\":\"\"
}",
"total":0
}
*/
String data = result.getData();
JSONObject jsonObject = JSON.parseObject(data);
//他们的结果是成功的
if (jsonObject != null && "200".equals(jsonObject.getString("code"))) {
if (jsonObject != null && StrConstant.HTTP_STATUS_OK.equals(jsonObject.getString(StrConstant.HTTP_RESP_CODE))) {
//第一层data
JSONObject realObject = JSON.parseObject(jsonObject.getString("data"));
if (realObject != null && "200".equals(realObject.getString("code"))) {
if (realObject != null && StrConstant.HTTP_STATUS_OK.equals(realObject.getString(StrConstant.HTTP_RESP_CODE))) {
//第二层 data
String thirdData = realObject.getString("data");
return JSON.parseObject(thirdData, YtDataSyncResDTO.class);
@ -211,15 +221,15 @@ public class YtHsResUtils {
}
} catch (Exception e) {
log.error(String.format("烟台canji结果查询异常cardNo:%s,异常信息:%s", idCard, e.getMessage()));
log.error(String.format("烟台canji结果查询异常cardNo:%s,异常信息:%s", idCard), e);
}
return failResult;
}
public static void main(String[] args) {
YtDataSyncResDTO canji = canji("123", "123");
System.out.println("残疾结果:" + JSON.toJSON(canji));
//YtDataSyncResDTO canji = canji("123", "123");
//System.out.println("残疾结果:" + JSON.toJSON(canji));
YtDataSyncResDTO siwang = siWang("1213", "!23");

12
epmet-module/data-aggregator/data-aggregator-server/pom.xml

@ -126,6 +126,18 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-rocketmq</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-message-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

14
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java

@ -14,6 +14,8 @@ import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO;
import com.epmet.dataaggre.excel.StaffPatrollExcel;
import com.epmet.dataaggre.service.datastats.DataStatsService;
import com.epmet.dataaggre.service.epmetuser.EpmetUserService;
import com.epmet.dto.form.DetailByTypeFormDTO;
import com.epmet.dto.result.DetailByTypeResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -285,4 +287,16 @@ public class EpmetUserController {
return new Result<List<GridMemberPatrolListResultDTO>>().ok(epmetUserService.gridMemberPatrolList(formDTO));
}
/**
* Desc: 数据明文查询
* @param formDTO
* @author zxc
* @date 2022/10/17 13:45
*/
@PostMapping("detailByType")
public Result<DetailByTypeResultDTO> detailByType(@RequestBody DetailByTypeFormDTO formDTO, @LoginUser TokenDto tokenDto){
ValidatorUtils.validateEntity(formDTO, DetailByTypeFormDTO.DetailByTypeForm.class);
return new Result<DetailByTypeResultDTO>().ok(epmetUserService.detailByType(formDTO,tokenDto));
}
}

11
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/IcResiUserDao.java

@ -30,6 +30,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 用户基础信息
@ -138,4 +139,14 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
@Param("agencyId")String agencyId,
@Param("staffOrgIds")String staffOrgIds,
@Param("search")String search);
Map<String,String> getTripReportRecordInfo(@Param("id")String id);
Map<String,String> getVaccineRecordInfo(@Param("id")String id);
Map<String,String> getSpecialAttentionInfo(@Param("id")String id);
Map<String,String> getNoNatCompareInfo(@Param("id")String id);
Map<String,String> getNatInfo(@Param("id")String id);
}

13
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java

@ -1,6 +1,7 @@
package com.epmet.dataaggre.service.epmetuser;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dataaggre.dto.datastats.form.NowStatsDataFormDTO;
import com.epmet.dataaggre.dto.datastats.result.NowStatsDataResultDTO;
import com.epmet.dataaggre.dto.epmetuser.form.*;
@ -20,6 +21,8 @@ import com.epmet.dataaggre.entity.epmetuser.IcPointVaccinesInoculationEntity;
import com.epmet.dataaggre.entity.epmetuser.IcResiUserEntity;
import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.UserBaseInfoDTO;
import com.epmet.dto.form.DetailByTypeFormDTO;
import com.epmet.dto.result.DetailByTypeResultDTO;
import java.util.List;
import java.util.Map;
@ -250,4 +253,14 @@ public interface EpmetUserService {
List<IcPointVaccinesInoculationEntity> listVaccinePoints(String customerId, String agencyId, String staffOrgIds, String search);
List<IcPointNucleicMonitoringEntity> listNucleicPoints(String customerId, String agencyId,String staffOrgIds, String search);
/**
* Desc: 数据明文查询
* @param formDTO
* @author zxc
* @date 2022/10/17 13:45
*/
DetailByTypeResultDTO detailByType(DetailByTypeFormDTO formDTO, TokenDto tokenDto);
}

128
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java

@ -2,16 +2,26 @@ package com.epmet.dataaggre.service.epmetuser.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.rocketmq.constants.TopicConstants;
import com.epmet.commons.rocketmq.messages.CheckMQMsg;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.form.IdAndNameDTO;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.enums.OrgTypeEnum;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis;
import com.epmet.commons.tools.redis.common.CustomerResiUserRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.HouseInfoCache;
import com.epmet.commons.tools.redis.common.bean.IcResiUserInfoCache;
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.IpUtils;
import com.epmet.constant.BadgeConstant;
import com.epmet.constant.NeighborhoodConstant;
import com.epmet.constant.OrgInfoConstant;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.dao.epmetuser.*;
@ -42,7 +52,11 @@ import com.epmet.dataaggre.service.govproject.GovProjectService;
import com.epmet.dataaggre.service.opercustomize.CustomerFootBarService;
import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.UserBaseInfoDTO;
import com.epmet.dto.form.DetailByTypeFormDTO;
import com.epmet.dto.form.SystemMsgFormDTO;
import com.epmet.dto.result.DetailByTypeResultDTO;
import com.epmet.dto.result.StaffRoleResultDTO;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
@ -51,8 +65,11 @@ import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.text.NumberFormat;
import java.util.*;
import java.util.stream.Collectors;
@ -98,6 +115,8 @@ public class EpmetUserServiceImpl implements EpmetUserService {
private IcPointVaccinesInoculationDao pointVaccinesInoculationDao;
@Resource
private IcPointNucleicMonitoringDao pointNucleicMonitoringDao;
@Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
/**
* @Description 根据UserIds查询
@ -971,4 +990,113 @@ public class EpmetUserServiceImpl implements EpmetUserService {
query.like(StringUtils.isNotBlank(search), IcPointNucleicMonitoringEntity::getName, search);
return pointNucleicMonitoringDao.selectList(query);
}
@Override
public DetailByTypeResultDTO detailByType(DetailByTypeFormDTO formDTO, TokenDto tokenDto) {
DetailByTypeResultDTO result = new DetailByTypeResultDTO();
String customerId = tokenDto.getCustomerId();
String userId = tokenDto.getUserId();
CheckMQMsg msg = new CheckMQMsg();
if (formDTO.getType().equals(NeighborhoodConstant.CHECK_HOUSE)){
HouseInfoCache houseInfo = CustomerIcHouseRedis.getHouseInfo(customerId, formDTO.getId());
if (null == houseInfo){
throw new EpmetException("查询房屋信息失败:"+formDTO.getId());
}
result.setMobile(houseInfo.getOwnerPhone());
result.setIdCard(houseInfo.getOwnerIdCard());
msg.setContent("查看"+houseInfo.getAllName()+"房屋的敏感信息");
}else if (formDTO.getType().equals(NeighborhoodConstant.CHECK_IC_RESI_USER)){
IcResiUserInfoCache icResiUserInfo = CustomerResiUserRedis.getIcResiUserInfo(formDTO.getId());
if (null == icResiUserInfo){
throw new EpmetException("查询icResiUser失败:"+formDTO.getId());
}
result.setIdCard(icResiUserInfo.getIdCard());
result.setMobile(icResiUserInfo.getMobile());
msg.setContent("查看"+icResiUserInfo.getName()+"的敏感信息");
}else if (formDTO.getType().equals(NeighborhoodConstant.JMFYXX)){
IcResiUserInfoCache icResiUserInfo = CustomerResiUserRedis.getIcResiUserInfo(formDTO.getId());
if (null == icResiUserInfo){
throw new EpmetException("查询icResiUser失败:"+formDTO.getId());
}
result.setIdCard(icResiUserInfo.getIdCard());
result.setMobile(icResiUserInfo.getMobile());
msg.setContent("查看"+icResiUserInfo.getName()+"的敏感信息(居民防疫信息)");
}else if (formDTO.getType().equals(NeighborhoodConstant.ROUTE_FOLLOW)){
Map<String, String> info = icResiUserDao.getTripReportRecordInfo(formDTO.getId());
if (null == info){
throw new EpmetException("未查询到行程随访信息:"+formDTO.getId());
}
result.setIdCard(info.get(NeighborhoodConstant.ID_CARD));
result.setMobile(info.get(NeighborhoodConstant.MOBILE));
msg.setContent("查看"+info.get(NeighborhoodConstant.NAME)+"的敏感信息(行程随访)");
}else if (formDTO.getType().equals(NeighborhoodConstant.VACCINATION_RECORD)){
Map<String, String> info = icResiUserDao.getVaccineRecordInfo(formDTO.getId());
if (null == info){
throw new EpmetException("未查询到疫苗接种信息:"+formDTO.getId());
}
result.setIdCard(info.get(NeighborhoodConstant.ID_CARD));
result.setMobile(info.get(NeighborhoodConstant.MOBILE));
msg.setContent("查看"+info.get(NeighborhoodConstant.NAME)+"的敏感信息(疫苗接种记录)");
}else if (formDTO.getType().equals(NeighborhoodConstant.VACCINE_SPECIAL_ATTENTION)
|| formDTO.getType().equals(NeighborhoodConstant.FOCUS_GROUP_SPECIAL_ATTENTION_QUARANTINE)
|| formDTO.getType().equals(NeighborhoodConstant.FOCUS_GROUP_SPECIAL_ATTENTION_HISTORY)){
Map<String, String> info = icResiUserDao.getSpecialAttentionInfo(formDTO.getId());
if (null == info){
throw new EpmetException("未查询到特别关注名单信息:"+formDTO.getId());
}
result.setIdCard(info.get(NeighborhoodConstant.ID_CARD));
result.setMobile(info.get(NeighborhoodConstant.MOBILE));
String cMsg = "";
switch (formDTO.getType()){
case NeighborhoodConstant.VACCINE_SPECIAL_ATTENTION:
cMsg = "疫苗接种关注名单";
break;
case NeighborhoodConstant.FOCUS_GROUP_SPECIAL_ATTENTION_QUARANTINE:
cMsg = "重点人群关注名单(防疫隔离)";
break;
case NeighborhoodConstant.FOCUS_GROUP_SPECIAL_ATTENTION_HISTORY:
cMsg = "重点人群关注名单(历史记录)";
break;
default:
}
msg.setContent("查看"+info.get(NeighborhoodConstant.NAME)+"的敏感信息("+cMsg+")");
}else if (formDTO.getType().equals(NeighborhoodConstant.NO_NAT_COMPARE)){
Map<String, String> info = icResiUserDao.getNoNatCompareInfo(formDTO.getId());
if (null == info){
throw new EpmetException("未查询到未做核酸比对信息:"+formDTO.getId());
}
result.setIdCard(info.get(NeighborhoodConstant.ID_CARD));
result.setMobile(info.get(NeighborhoodConstant.MOBILE));
msg.setContent("查看"+info.get(NeighborhoodConstant.NAME)+"的敏感信息(未做核酸比对)");
}else if (formDTO.getType().equals(NeighborhoodConstant.NAT_RECORD)){
Map<String, String> info = icResiUserDao.getNatInfo(formDTO.getId());
if (null == info){
throw new EpmetException("未查询到核酸检测信息:"+formDTO.getId());
}
result.setIdCard(info.get(NeighborhoodConstant.ID_CARD));
result.setMobile(info.get(NeighborhoodConstant.MOBILE));
msg.setContent("查看"+info.get(NeighborhoodConstant.NAME)+"的敏感信息(核酸检测信息)");
}
// 发送mq消息
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
msg.setOperateTime(new Date());
msg.setType(formDTO.getType());
msg.setTypeDisplay(msg.getContent());
msg.setUserId(userId);
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId);
if(null == staffInfo){
throw new EpmetException("未查询到工作人员信息:"+userId);
}
msg.setOrgId(staffInfo.getAgencyId());
msg.setOrgIdPath(StringUtils.isBlank(staffInfo.getAgencyPIds()) ? staffInfo.getAgencyId() : staffInfo.getAgencyPIds().concat(":").concat(staffInfo.getAgencyId()));
msg.setFromApp(tokenDto.getApp());
msg.setIp(IpUtils.getIpAddr(request));
msg.setFromClient(tokenDto.getClient());
SystemMsgFormDTO form = new SystemMsgFormDTO();
form.setMessageType(TopicConstants.CHECK_OR_EXPORT);
form.setContent(msg);
epmetMessageOpenFeignClient.sendSystemMsgByMQ(form);
return result;
}
}

43
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/IcResiUserDao.xml

@ -283,4 +283,47 @@
having volunteerCategory is null
or volunteerCategory = ''
</select>
<select id="getTripReportRecordInfo" resultType="java.util.Map">
select
MOBILE,
ID_CARD,
NAME
from ic_trip_report_record
where id = #{id}
</select>
<select id="getVaccineRecordInfo" resultType="java.util.Map">
select
MOBILE,
ID_CARD,
NAME
from ic_vaccine
where id = #{id}
</select>
<select id="getSpecialAttentionInfo" resultType="java.util.Map">
select
MOBILE,
ID_CARD,
NAME
from ic_epidemic_special_attention
where id = #{id}
</select>
<select id="getNoNatCompareInfo" resultType="java.util.Map">
select
MOBILE,
ID_CARD,
NAME
from ic_nat_compare_record
where id = #{id}
</select>
<select id="getNatInfo" resultType="java.util.Map">
select
MOBILE,
ID_CARD,
NAME
from ic_nat
where id = #{id}
</select>
</mapper>

6
epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java

@ -175,6 +175,12 @@ public interface SystemMessageType {
*/
String PARTY_MEETING_MESSAGE = "party_meeting_message";
/**
* 查看或者导出 日志记录
*/
String CHECK_OR_EXPORT = "check_or_export";
String ZBWYH = "参加支部委员会";
String ZBDYDH = "参加支部党员大会";
String DXZH = "参加党小组会";

3
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java

@ -248,6 +248,9 @@ public class SystemMessageServiceImpl implements SystemMessageService {
case SystemMessageType.WMFWHD:
topic=TopicConstants.PARTY_BUILDING;
break;
case SystemMessageType.CHECK_OR_EXPORT:
topic = TopicConstants.CHECK_OR_EXPORT;
break;
default:
logger.error("getTopicByMsgType msgType:{} is not support for any topic", msgType);
}

3
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java

@ -26,11 +26,14 @@ import com.epmet.commons.rocketmq.messages.PointRuleChangedMQMsg;
import com.epmet.commons.tools.constant.Constant;
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.enums.CommonOperateTypeEnum;
import com.epmet.commons.tools.enums.EventEnum;
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.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ConvertUtils;

51
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/constant/NeighborhoodConstant.java

@ -6,10 +6,61 @@ package com.epmet.constant;
*/
public interface NeighborhoodConstant {
String MOBILE = "MOBILE";
String ID_CARD = "ID_CARD";
String NAME = "NAME";
String GRID = "grid";
String NEIGHBOR_HOOD= "neighbourHood";
String BUILDING = "building";
String HOUSE = "house";
String CHECK_HOUSE = "checkHouse";
/**
* ic居民
*/
String IC_RESI_USER = "icResiUser";
String CHECK_IC_RESI_USER = "checkIcResiUser";
/**
* 居民防疫信息
*/
String JMFYXX = "JMFYXX";
/**
* 行程随访
*/
String ROUTE_FOLLOW = "routeFollow";
/**
* 疫苗接种记录
*/
String VACCINATION_RECORD = "vaccinationRecord";
/**
* 疫苗接种关注名单
*/
String VACCINE_SPECIAL_ATTENTION = "vaccineSpecialAttention";
/**
* 未做核酸比对
*/
String NO_NAT_COMPARE = "noNatCompare";
/**
* 核酸检测记录
*/
String NAT_RECORD = "natRecord";
/**
* 重点人群关注名单防疫隔离
*/
String FOCUS_GROUP_SPECIAL_ATTENTION_QUARANTINE = "focusGroupSpecialAttentionQuarantine";
/**
* 重点人群关注名单历史记录
*/
String FOCUS_GROUP_SPECIAL_ATTENTION_HISTORY = "focusGroupSpecialAttentionHistory";
}

9
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcHouseDTO.java

@ -161,4 +161,13 @@ public class IcHouseDTO implements Serializable {
* 房屋可编辑编码
*/
private String coding;
/**
* 加密后的联系方式
*/
private String showOwnerPhone;
/**
* 加密后的房主身份证
*/
private String showOwnerIdCard;
}

25
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DetailByTypeFormDTO.java

@ -0,0 +1,25 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2022/10/17 13:42
* @DESC
*/
@Data
public class DetailByTypeFormDTO implements Serializable {
private static final long serialVersionUID = 8190270734257503603L;
public interface DetailByTypeForm{}
@NotBlank(message = "type不能为空",groups = DetailByTypeForm.class)
private String type;
@NotBlank(message = "id不能为空",groups = DetailByTypeForm.class)
private String id;
}

20
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DetailByTypeResultDTO.java

@ -0,0 +1,20 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2022/10/17 13:41
* @DESC
*/
@Data
public class DetailByTypeResultDTO implements Serializable {
private static final long serialVersionUID = -8067849365791132347L;
private String idCard;
private String mobile;
}

52
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java

@ -25,6 +25,8 @@ import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.rocketmq.constants.TopicConstants;
import com.epmet.commons.rocketmq.messages.CheckMQMsg;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.annotation.MaskResponse;
import com.epmet.commons.tools.annotation.ReportRequest;
@ -40,10 +42,7 @@ import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.bean.HouseInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.HouseQRcodeUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.*;
import com.epmet.commons.tools.utils.poi.excel.handler.ExcelFillRowMergeStrategy;
import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter;
import com.epmet.commons.tools.validator.ValidatorUtils;
@ -54,6 +53,7 @@ import com.epmet.dto.result.*;
import com.epmet.entity.CustomerOrgParameterEntity;
import com.epmet.feign.EpmetAdminOpenFeignClient;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.service.HouseService;
import com.epmet.util.ExcelPoiUtils;
@ -66,18 +66,18 @@ import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.multipart.MultipartFile;
import javax.imageio.ImageIO;
import javax.imageio.stream.ImageOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import java.util.*;
import java.util.concurrent.TimeUnit;
@ -105,6 +105,8 @@ public class HouseController implements ResultDataResolver {
@Autowired
private IcHouseDao icHouseDao;
@Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@ReportRequest
@PostMapping("houselist")
@ -265,7 +267,7 @@ public class HouseController implements ResultDataResolver {
* @throws Exception
*/
@RequestMapping("exporthouseinfo")
public void exporthouseinfo(@RequestBody IcHouseListFormDTO formDTO, HttpServletResponse response) throws Exception {
public void exporthouseinfo(@RequestBody IcHouseListFormDTO formDTO, HttpServletResponse response,@LoginUser TokenDto tokenDto) throws Exception {
ValidatorUtils.validateEntity(formDTO);
if (StringUtils.isNotBlank(formDTO.getId())){
formDTO.setSelectType("id");
@ -274,7 +276,21 @@ public class HouseController implements ResultDataResolver {
}
formDTO.setIsPage(false);
houseService.exportBuildinginfo(formDTO, response);
// 新增操作日志
CheckMQMsg msg = new CheckMQMsg();
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
msg.setOperateTime(new Date());
msg.setContent("导出房屋数据");
msg.setType("exportHouse");
msg.setTypeDisplay("导出房屋数据");
msg.setUserId(tokenDto.getUserId());
msg.setFromApp(tokenDto.getApp());
msg.setIp(IpUtils.getIpAddr(request));
msg.setFromClient(tokenDto.getClient());
SystemMsgFormDTO form = new SystemMsgFormDTO();
form.setMessageType(TopicConstants.CHECK_OR_EXPORT);
form.setContent(msg);
epmetMessageOpenFeignClient.sendSystemMsgByMQ(form);
}
@PostMapping("queryListHouseInfo")
@ -452,6 +468,22 @@ public class HouseController implements ResultDataResolver {
//获取导出配置
haveSearchCache.invalidateAll();
// 发送操作日志
CheckMQMsg msg = new CheckMQMsg();
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
msg.setOperateTime(new Date());
msg.setContent("导出一户一档数据");
msg.setType("exportYHYD");
msg.setTypeDisplay("导出一户一档数据");
msg.setUserId(tokenDto.getUserId());
msg.setFromApp(tokenDto.getApp());
msg.setIp(IpUtils.getIpAddr(request));
msg.setFromClient(tokenDto.getClient());
SystemMsgFormDTO form = new SystemMsgFormDTO();
form.setMessageType(TopicConstants.CHECK_OR_EXPORT);
form.setContent(msg);
epmetMessageOpenFeignClient.sendSystemMsgByMQ(form);
} catch (EpmetException e) {
response.reset();
response.setCharacterEncoding("UTF-8");

12
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java

@ -18,20 +18,17 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.annotation.MaskResponse;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.IcHouseDTO;
import com.epmet.dto.IcVaccinePrarmeterDTO;
import com.epmet.dto.form.CheckHouseInfoFormDTO;
import com.epmet.dto.form.DetailByTypeFormDTO;
import com.epmet.dto.form.HouseFormDTO;
import com.epmet.dto.form.VaccinePrarmeterListFormDTO;
import com.epmet.dto.result.HouseAgencyInfoResultDTO;
import com.epmet.dto.result.HouseInfoDTO;
import com.epmet.dto.result.HouseListResultDTO;
import com.epmet.dto.result.HousesNameResultDTO;
import com.epmet.dto.result.*;
import com.epmet.service.IcHouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -53,6 +50,7 @@ public class IcHouseController {
@Autowired
private IcHouseService icHouseService;
@MaskResponse(fieldNames = { "showOwnerPhone", "showOwnerIdCard" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD })
@GetMapping("{id}")
public Result<IcHouseDTO> get(@PathVariable("id") String id) {
IcHouseDTO data = icHouseService.get(id);
@ -154,6 +152,6 @@ public class IcHouseController {
ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
return icHouseService.checkHomeInfo(formDTO);
}
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java

@ -7,11 +7,9 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.IcHouseDTO;
import com.epmet.dto.ImportGeneralDTO;
import com.epmet.dto.form.CheckHouseInfoFormDTO;
import com.epmet.dto.form.DetailByTypeFormDTO;
import com.epmet.dto.form.HouseFormDTO;
import com.epmet.dto.result.HouseAgencyInfoResultDTO;
import com.epmet.dto.result.HouseInfoDTO;
import com.epmet.dto.result.HouseListResultDTO;
import com.epmet.dto.result.HousesNameResultDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.IcHouseEntity;
import java.util.List;
@ -139,4 +137,6 @@ public interface IcHouseService extends BaseService<IcHouseEntity> {
* @return
*/
Result checkHomeInfo(CheckHouseInfoFormDTO formDTO);
}

18
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java

@ -3,6 +3,8 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.rocketmq.constants.TopicConstants;
import com.epmet.commons.rocketmq.messages.CheckMQMsg;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
@ -10,10 +12,14 @@ import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis;
import com.epmet.commons.tools.redis.common.CustomerResiUserRedis;
import com.epmet.commons.tools.redis.common.bean.HouseInfoCache;
import com.epmet.commons.tools.redis.common.bean.IcResiUserInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.IpUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.NeighborhoodConstant;
import com.epmet.dao.IcBuildingDao;
import com.epmet.dao.IcBuildingUnitDao;
import com.epmet.dao.IcHouseDao;
@ -23,7 +29,9 @@ import com.epmet.dto.IcResiCategoryStatsConfigDTO;
import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.ImportGeneralDTO;
import com.epmet.dto.form.CheckHouseInfoFormDTO;
import com.epmet.dto.form.DetailByTypeFormDTO;
import com.epmet.dto.form.HouseFormDTO;
import com.epmet.dto.form.SystemMsgFormDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.IcBuildingEntity;
import com.epmet.entity.IcBuildingUnitEntity;
@ -32,6 +40,7 @@ import com.epmet.entity.IcNeighborHoodEntity;
import com.epmet.enums.HousePurposeEnums;
import com.epmet.enums.HouseRentFlagEnums;
import com.epmet.enums.HouseTypeEnums;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.redis.IcHouseRedis;
@ -39,10 +48,14 @@ import com.epmet.service.IcHouseService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
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 org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
@ -69,7 +82,8 @@ public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntit
private IcBuildingDao icBuildingDao;
@Resource
private IcBuildingUnitDao buildingUnitDao;
@Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Override
public IcHouseDTO get(String id) {
@ -78,6 +92,8 @@ public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntit
if (null == dto) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), String.format("houseId:%s已删除", id), "房屋已删除");
}
dto.setShowOwnerIdCard(dto.getOwnerIdCard());
dto.setShowOwnerPhone(dto.getOwnerPhone());
dto.setHouseTypeName(HouseTypeEnums.getTypeValue(dto.getHouseType()));
dto.setRentName(HouseRentFlagEnums.getTypeValue(dto.getRentFlag()));
dto.setPurposeName(HousePurposeEnums.getTypeValue(dto.getPurpose()));

1
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/TransferFormDTO.java

@ -51,5 +51,6 @@ public class TransferFormDTO implements Serializable {
* 协办单位类型1社区自组织2联建单位
*/
private String assistanceUnitType;
}

3
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatCompareRecordDTO.java

@ -30,6 +30,9 @@ public class IcNatCompareRecordDTO implements Serializable {
@ExcelIgnore
private String relationId;
@ExcelIgnore
private String recordId;
/**
* 姓名
*/

2
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatListResultDTO.java

@ -60,7 +60,7 @@ public class NatListResultDTO implements Serializable {
* 身份证号
*/
@ColumnWidth(25)
@ExcelProperty(value = "身份证号",order = 3)
@ExcelProperty(value = "证号",order = 3)
private String idCard;
/**

5
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatUserInfoResultDTO.java

@ -32,4 +32,9 @@ public class NatUserInfoResultDTO implements Serializable {
* 18大类 某一类的 是否值用于比较 同步数据结果确定是否要插入到表中
*/
private String categoryColumn;
/**
* ic_nat表ID
*/
private String id;
}

13
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicSpecialAttentionController.java

@ -25,6 +25,7 @@ import com.epmet.feign.EpmetAdminOpenFeignClient;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.service.IcEpidemicSpecialAttentionService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -243,4 +244,16 @@ public class IcEpidemicSpecialAttentionController {
return new Result<NatPieResultDTO>().ok(icEpidemicSpecialAttentionService.pie(tokenDto));
}
/**
* 批量删除 ic_epidemic_special_attention
* @param ids
* @return
*/
@PostMapping("delete")
public Result delete(@RequestBody List<String> ids){
if(CollectionUtils.isNotEmpty(ids)){
icEpidemicSpecialAttentionService.delete(ids);
}
return new Result();
}
}

24
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java

@ -22,6 +22,8 @@ import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.metadata.fill.FillWrapper;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.rocketmq.constants.TopicConstants;
import com.epmet.commons.rocketmq.messages.CheckMQMsg;
import com.epmet.commons.rocketmq.messages.IcResiUserAddMQMsg;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.annotation.MaskResponse;
@ -46,6 +48,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.IcResiUserInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.*;
@ -84,6 +87,8 @@ import org.jetbrains.annotations.NotNull;
import org.redisson.api.RLock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.ServletOutputStream;
@ -557,6 +562,20 @@ public class IcResiUserController implements ResultDataResolver {
} else {
icResiUserExportService.exportIcResiUser(tokenDto, pageFormDTO, response,false);
}
CheckMQMsg msg = new CheckMQMsg();
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
msg.setOperateTime(new Date());
msg.setContent("导出居民数据");
msg.setType("exportIcResiUser");
msg.setTypeDisplay("导出居民数据");
msg.setUserId(tokenDto.getUserId());
msg.setFromApp(tokenDto.getApp());
msg.setIp(IpUtils.getIpAddr(request));
msg.setFromClient(tokenDto.getClient());
SystemMsgFormDTO form = new SystemMsgFormDTO();
form.setMessageType(TopicConstants.CHECK_OR_EXPORT);
form.setContent(msg);
epmetMessageOpenFeignClient.sendSystemMsgByMQ(form);
} catch (EpmetException e) {
response.reset();
response.setCharacterEncoding("UTF-8");
@ -1436,4 +1455,9 @@ public class IcResiUserController implements ResultDataResolver {
return new Result();
}
@PostMapping("getIcResiUserInfo/{userId}")
public Result<IcResiUserInfoCache> getIcResiUserInfo(@PathVariable("userId") String userId){
return new Result<IcResiUserInfoCache>().ok(icResiUserService.getIcResiUserInfo(userId));
}
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java

@ -64,4 +64,6 @@ public interface IcNatDao extends BaseDao<IcNatEntity> {
List<NatUserInfoResultDTO> getExistNatInfo(@Param("list") List<IcNatEntity> entities);
void updateBatchNat(@Param("list")List<IcNatEntity> entities);
}

6
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatImportExcelData.java

@ -24,9 +24,9 @@ public class IcNatImportExcelData {
@Length(max = 15, message = "手机号长度不正确,应小于15位")
private String mobile;
@NotBlank(message = "身份证号为必填项")
@ExcelProperty("身份证号")
@Length(max = 18, message = "身份证号长度不正确,应小于18位")
@NotBlank(message = "证号为必填项")
@ExcelProperty("证号")
@Length(max = 18, message = "证号长度不正确,应小于18位")
private String idCard;
// @NotNull(message = "检测时间为必填项")

2
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatExcelImportListener.java

@ -68,7 +68,7 @@ public class IcNatExcelImportListener implements ReadListener<IcNatImportExcelDa
// 先校验数据
ValidatorUtils.validateEntity(data);
if ((null == data.getSampleTime() && null == data.getNatTime() || org.apache.commons.lang3.StringUtils.isBlank(data.getNatResultZh()))){
if (null == data.getSampleTime() && (null == data.getNatTime() || org.apache.commons.lang3.StringUtils.isBlank(data.getNatResultZh()))){
throw new EpmetException(EpmetErrorCode.SAMPLE_TIME_AND_RESULT_IS_NULL_ERROR.getCode());
}
if(null != data.getSampleTime() && org.apache.commons.lang3.StringUtils.isNotBlank(data.getNatResultZh()) && null == data.getNatTime()){

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

@ -82,7 +82,7 @@ public interface IcEpidemicSpecialAttentionService extends BaseService<IcEpidemi
* @author generator
* @date 2022-03-28
*/
void delete(String[] ids);
void delete(List<String> ids);
/**
* Desc: 疫苗接种关注名单疫苗接种关注名单列表

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

@ -92,4 +92,6 @@ public interface IcNatService extends BaseService<IcNatEntity> {
* @return
*/
Integer updateIsResiFlag(String customerId, String icResiUserId);
void updateBatchNat(List<IcNatEntity> entities);
}

3
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java

@ -20,6 +20,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.dto.result.OptionDataResultDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.bean.IcResiUserInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.IcResiUserDTO;
@ -518,4 +519,6 @@ public interface IcResiUserService extends BaseService<IcResiUserEntity> {
* @Date 2022/9/8 15:45
*/
void updateYlfn();
IcResiUserInfoCache getIcResiUserInfo(String userId);
}

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

@ -14,7 +14,6 @@ import com.epmet.commons.tools.enums.GenderEnum;
import com.epmet.commons.tools.exception.EpmetException;
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;
@ -44,6 +43,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors;
/**
@ -68,6 +69,8 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
private DataSyncRecordDeathService dataSyncRecordDeathService;
@Autowired
private DataSyncRecordDisabilityService dataSyncRecordDisabilityService;
@Autowired
private ExecutorService executorService;
@Override
public DataSyncConfigDTO get(String id) {
@ -180,35 +183,127 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
return;
}
//TODO 根据dataCode 调用不同的方法 抽取数据
if (CollectionUtils.isEmpty(allConfigList)) {
log.warn("dataSyncForYanTaiTask don't have any resi data to pull data form YanTai interface");
return;
}
if (StringUtils.isNotBlank(formDTO.getDataCode())){
List<DataSyncConfigDTO> newConfigList = new ArrayList<>();
allConfigList.forEach(c -> {
if (c.getDataCode().equals(formDTO.getDataCode())){
disAllData(c,formDTO);
return;
//串行执行
//disAllData(c,formDTO);
//并行执行
newConfigList.add(c);
}
});
//死亡 残疾等接口 并行执行
dataSyncYanTaiParallel(newConfigList,formDTO);
}else {
for (DataSyncConfigDTO config : allConfigList) {
//没有配置 数据拉取范围 继续下次循环
if (CollectionUtils.isEmpty(config.getScopeList())) {
//死亡 残疾等接口 并行执行
dataSyncYanTaiParallel(allConfigList,formDTO);
//串行执行
// for (DataSyncConfigDTO config : allConfigList) {
// //没有配置 数据拉取范围 继续下次循环
// if (CollectionUtils.isEmpty(config.getScopeList())) {
// continue;
// }
// disAllData(config,formDTO);
// }
}
}
private void dataSyncYanTaiParallel(List<DataSyncConfigDTO> configList, DataSyncTaskParam formDTO) {
if (CollectionUtils.isEmpty(configList)) {
log.warn("dataSyncYanTaiParallel configList is null");
return;
}
long count = configList.stream().filter(o -> CollectionUtils.isNotEmpty(o.getScopeList())).count();
if (count < 1) {
log.warn("dataSyncYanTaiParallel scopeList is null");
return;
}
//没传具体参数 则 按照
int pageNo = NumConstant.ONE;
int pageSize = NumConstant.ONE_THOUSAND;
List<NatUserInfoResultDTO> dbResiList = null;
CountDownLatch countDownLatch = new CountDownLatch((int) count);
do {
for (DataSyncConfigDTO config : configList) {//设置查询数据范围
formDTO.setOrgList(config.getScopeList());
DataSyncEnum anEnum = DataSyncEnum.getEnum(config.getDataCode());
//查询正常状态的居民 并回显 残疾状态
formDTO.setCategoryColumn("IS_CJ");
dbResiList = getNatUserInfoFromDb(formDTO, pageNo, pageSize);
if (CollectionUtils.isEmpty(dbResiList)) {
continue;
}
disAllData(config,formDTO);
List<NatUserInfoResultDTO> finalDbResiList = dbResiList;
switch (anEnum) {
case HE_SUAN:
executorService.submit(() -> {
try {
//查询正常状态的居民
hsjc(finalDbResiList, config.getCustomerId(), formDTO.getIsSync());
log.info("======核酸检测信息拉取结束======");
} catch (Exception e) {
log.error("hsjc thread execute exception", e);
} finally {
countDownLatch.countDown();
}
});
break;
case CAN_JI:
executorService.submit(() -> {
try {
//查询正常状态的居民
canJi(finalDbResiList);
log.info("======canJi信息拉取结束======");
} catch (Exception e) {
log.error("hsjc thread execute exception", e);
} finally {
countDownLatch.countDown();
}
});
break;
case SI_WANG:
try {
//查询正常状态的居民
siWang(finalDbResiList);
log.info("======siWang信息拉取结束======");
} catch (Exception e) {
log.error("hsjc thread execute exception", e);
} finally {
countDownLatch.countDown();
}
break;
default:
log.warn("没有要处理的数据");
}
try {
//等这一批居民 各个方法都执行完后 再继续下一批
countDownLatch.await();
} catch (InterruptedException e) {
log.error("dataSyncYanTaiParallel现成被中断");
}
}
}
pageNo++;
} while (dbResiList != null && dbResiList.size() == pageSize);
}
private void disAllData(DataSyncConfigDTO config,DataSyncTaskParam formDTO){
//没传具体参数 则 按照
int pageNo = NumConstant.ONE;
int pageSize = 1;//todo fangkaita NumConstant.ONE_THOUSAND;
//ToDo 去掉
formDTO.setIdCards(Collections.singletonList("370283199912010302"));
int pageSize = NumConstant.ONE_THOUSAND;
List<NatUserInfoResultDTO> dbResiList = null;
//设置查询数据范围
formDTO.setOrgList(config.getScopeList());
@ -241,7 +336,7 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
log.warn("没有要处理的数据");
}
pageNo++;
} while (false);//todo fangkaita(dbResiList != null && dbResiList.size() == pageSize);
} while (dbResiList != null && dbResiList.size() == pageSize);
}
private void siWang(List<NatUserInfoResultDTO> dbResiList) {
@ -255,6 +350,9 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
}
String thirdResultData = thirdResult.getData();
if(StringUtils.isBlank(thirdResultData)){
continue;
}
JSONObject thirdResultObject = JSON.parseObject(thirdResultData);
LambdaQueryWrapper<DataSyncRecordDeathEntity> queryWrapper = new LambdaQueryWrapper<>();
@ -312,7 +410,6 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
* desc从数据库获取居民信息
*
* @param formDTO
* @param anEnum
* @param pageNo
* @param pageSize
* @return
@ -321,23 +418,7 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
//根据 组织 分页获取 居民数据
PageInfo<NatUserInfoResultDTO> pageInfo = PageHelper.startPage(pageNo, pageSize, false)
.doSelectPageInfo(() -> baseDao.getIdCardsByScope(formDTO));
List<NatUserInfoResultDTO> dbResiList;
dbResiList = pageInfo.getList();
/* //如果传了身份证号 则按照身份证号查询 并同步记录, userId如果为空则是 手动录入的 此人没有录入居民库 但是也可以同步
if (CollectionUtils.isNotEmpty(formDTO.getIdCards()) && DataSyncEnum.HE_SUAN.getCode().equals(anEnum.getCode())) {
List<NatUserInfoResultDTO> collect = formDTO.getIdCards().stream().map(id -> {
NatUserInfoResultDTO e = new NatUserInfoResultDTO();
e.setIdCard(id);
e.setUserId("");
return e;
}).collect(Collectors.toList());
for (NatUserInfoResultDTO c : collect) {
dbResiList.stream().filter(u -> u.getIdCard().equals(c.getIdCard())).forEach(u -> c.setUserId(u.getUserId()));
}
dbResiList = collect;
}*/
return dbResiList;
return pageInfo.getList();
}
private void canJi(List<NatUserInfoResultDTO> resiList) {
@ -454,100 +535,64 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
* @author zxc
* @date 2022/9/27 11:08
*/
@Transactional(rollbackFor = Exception.class)
public void hsjc(List<NatUserInfoResultDTO> idCards, String customerId, String isSync) {
try {
List<IcNatEntity> entities = new ArrayList<>();
idCards.forEach(idCard -> {
// YtHscyResDTO sampleResult = YtHsResUtils.hscy(idCard.getIdCard(), NumConstant.ONE, NumConstant.ONE);
YtHsjcResDTO natInfoResult = YtHsResUtils.hsjc(idCard.getIdCard(), NumConstant.ONE, NumConstant.ONE);
/*Boolean aBoolean = CollectionUtils.isEmpty(sampleResult.getData()) && CollectionUtils.isNotEmpty(natInfoResult.getData());
Boolean bBoolean = CollectionUtils.isNotEmpty(sampleResult.getData()) && CollectionUtils.isNotEmpty(natInfoResult.getData());*/
/**
* 1.采样结果 检测结果 都不为空以检测结果为准
* 2.采样结果为空检测结果不为空
*/
// if (aBoolean || bBoolean) {
if (CollectionUtils.isNotEmpty(natInfoResult.getData())) {
natInfoResult.getData().forEach(natInfo -> {
YtHscyResDTO sampleResult = YtHsResUtils.hscy(idCard.getIdCard(), NumConstant.ONE, NumConstant.ONE);
if (CollectionUtils.isNotEmpty(sampleResult.getData())){
List<IcNatEntity> entities = new ArrayList<>();
sampleResult.getData().forEach(sampleInfo -> {
IcNatEntity e = new IcNatEntity();
e.setCustomerId(customerId);
e.setIsResiUser(StringUtils.isBlank(idCard.getUserId()) ? NumConstant.ZERO_STR : NumConstant.ONE_STR);
e.setUserId(idCard.getUserId());
e.setMobile("");
e.setUserType(isSync.equals(NumConstant.ONE_STR) ? "manualSync" : "sync");
e.setName(StringUtils.isNotBlank(natInfo.getName()) ? natInfo.getName() : "");
e.setMobile(StringUtils.isNotBlank(natInfo.getTelephone()) ? natInfo.getTelephone() : "");
e.setIdCard(StringUtils.isNotBlank(natInfo.getCard_no()) ? natInfo.getCard_no() : "");
e.setNatTime(DateUtils.parseDate(natInfo.getTest_time(), DateUtils.DATE_TIME_PATTERN));
e.setSampleTime(DateUtils.parseDate(natInfo.getSample_time(), DateUtils.DATE_TIME_PATTERN));
String resultPcr = natInfo.getSample_result_pcr();
//检测结果 转换 我们 0:阴性 1:阳性, 他们 :1:阳性,2:阴性
e.setNatResult(NumConstant.ZERO_STR);
if (NumConstant.ONE_STR.equals(resultPcr)) {
e.setNatResult(NumConstant.ONE_STR);
}
e.setNatAddress(natInfo.getSampling_org_pcr());
e.setName(StringUtils.isNotBlank(sampleInfo.getName()) ? sampleInfo.getName() : "");
e.setIdCard(StringUtils.isNotBlank(sampleInfo.getCard_no()) ? sampleInfo.getCard_no() : "");
e.setSampleTime(DateUtils.parseDate(sampleInfo.getCreate_time(), DateUtils.DATE_TIME_PATTERN));
e.setAgencyId(idCard.getAgencyId());
e.setPids(idCard.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);
}
}
/*if (CollectionUtils.isNotEmpty(sampleResult.getData()) && CollectionUtils.isEmpty(natInfoResult.getData())){
sampleResult.getData().forEach(sampleInfo -> {
YtHsjcResDTO natInfoResult = YtHsResUtils.hsjc(idCard.getIdCard(), NumConstant.ONE, NumConstant.ONE);
if (CollectionUtils.isNotEmpty(natInfoResult.getData())) {
List<IcNatEntity> entities = new ArrayList<>();
natInfoResult.getData().forEach(natInfo -> {
IcNatEntity e = new IcNatEntity();
e.setCustomerId(customerId);
e.setIsResiUser(StringUtils.isBlank(idCard.getUserId()) ? NumConstant.ZERO_STR : NumConstant.ONE_STR);
e.setUserId(idCard.getUserId());
e.setUserType(isSync.equals(NumConstant.ONE_STR) ? "manualSync" : "sync");
e.setName(StringUtils.isNotBlank(sampleInfo.getName()) ? sampleInfo.getName() : "");
e.setMobile(StringUtils.isNotBlank(sampleInfo.get()) ? sampleInfo.getTelephone() : "");
e.setIdCard(StringUtils.isNotBlank(sampleInfo.getCard_no()) ? sampleInfo.getCard_no() : "");
e.setNatTime(DateUtils.parseDate(sampleInfo.getTest_time(), DateUtils.DATE_TIME_PATTERN));
e.setSampleTime(DateUtils.parseDate(sampleInfo.getSample_time(), DateUtils.DATE_TIME_PATTERN));
String resultPcr = sampleInfo.getSample_result_pcr();
e.setName(StringUtils.isNotBlank(natInfo.getName()) ? natInfo.getName() : "");
e.setMobile(StringUtils.isNotBlank(natInfo.getTelephone()) ? natInfo.getTelephone() : "");
e.setIdCard(StringUtils.isNotBlank(natInfo.getCard_no()) ? natInfo.getCard_no() : "");
e.setNatTime(DateUtils.parseDate(natInfo.getTest_time(), DateUtils.DATE_TIME_PATTERN));
e.setSampleTime(DateUtils.parseDate(natInfo.getSample_time(), DateUtils.DATE_TIME_PATTERN));
String resultPcr = natInfo.getSample_result_pcr();
//检测结果 转换 我们 0:阴性 1:阳性, 他们 :1:阳性,2:阴性
e.setNatResult(NumConstant.ZERO_STR);
if (NumConstant.ONE_STR.equals(resultPcr)){
if (NumConstant.ONE_STR.equals(resultPcr)) {
e.setNatResult(NumConstant.ONE_STR);
}
e.setNatAddress(sampleInfo.getSampling_org_pcr());
e.setNatAddress(natInfo.getSampling_org_pcr());
e.setAgencyId(idCard.getAgencyId());
e.setPids(idCard.getPids());
e.setAttachmentType("");
e.setAttachmentUrl("");
entities.add(e);
});
}
});*/
if (CollectionUtils.isNotEmpty(entities)) {
List<NatUserInfoResultDTO> existNatInfos = icNatDao.getExistNatInfo(entities);
entities.forEach(e -> existNatInfos.stream().filter(i -> i.getUserId().equals(e.getUserId()) && i.getIdCard().equals(e.getIdCard())).forEach(i -> e.setExistStatus(true)));
Map<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)) {
icNatService.insertBatch(icNatEntities);
//组织关系表
List<IcNatRelationEntity> relationEntities = new ArrayList<>();
icNatEntities.forEach(ne -> {
// 不是居民的先不加关系表吧
if (ne.getIsResiUser().equals(NumConstant.ONE_STR)) {
IcNatRelationEntity e = new IcNatRelationEntity();
e.setCustomerId(customerId);
e.setAgencyId(ne.getAgencyId());
e.setPids(ne.getPids());
e.setIcNatId(ne.getId());
e.setUserType("sync");
relationEntities.add(e);
}
});
if (CollectionUtils.isNotEmpty(relationEntities)) {
icNatRelationService.insertBatch(relationEntities);
}
}
if (CollectionUtils.isNotEmpty(entities)) {
List<NatUserInfoResultDTO> existNatInfos = icNatDao.getExistNatInfo(entities);
sampleAndNat(existNatInfos,entities,NumConstant.TWO_STR,customerId,isSync);
}
}
});
} catch (Exception e) {
@ -556,6 +601,61 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
}
/**
* Desc: 处理采样和检测结果
* @param existInfo 库里存在的ic_nat
* @param entities 所有的
* @param type 1采样结果2检测结果
* @param isSync 1:页面调用同步2定时任务
* @author zxc
* @date 2022/10/18 09:08
*/
private void sampleAndNat(List<NatUserInfoResultDTO> existInfo, List<IcNatEntity> entities, String type, String customerId, String isSync){
/**
* 采样结果不为空
* 数据库采样时间+idCard+userId 存在的 不做操作
* 数据库采样时间+idCard+userId 不存在的 新增
*
* 检测结果不为空
* 数据库采样时间+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());
}));
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)) {
// 主表新增
icNatService.insertBatch(icNatEntities);
// 组织关系表
List<IcNatRelationEntity> relationEntities = new ArrayList<>();
icNatEntities.forEach(ne -> {
if (ne.getIsResiUser().equals(NumConstant.ONE_STR)) {
IcNatRelationEntity e = new IcNatRelationEntity();
e.setCustomerId(customerId);
e.setAgencyId(ne.getAgencyId());
e.setPids(ne.getPids());
e.setIcNatId(ne.getId());
e.setUserType(isSync.equals(NumConstant.ONE_STR) ? "manualSync" : "sync");
relationEntities.add(e);
}
});
if (CollectionUtils.isNotEmpty(relationEntities)) {
icNatRelationService.insertBatch(relationEntities);
}
}
}
if (NumConstant.TWO_STR.equals(type)){
if (CollectionUtils.isNotEmpty(groupByStatus.get(true))){
for (List<IcNatEntity> icNatEntities : ListUtils.partition(groupByStatus.get(true), NumConstant.ONE_HUNDRED)) {
icNatService.updateBatchNat(icNatEntities);
}
}
}
}
private class JudgeDealStatus {
private boolean isNext;
private DataSyncRecordDisabilityDTO dbDisablityEntity;

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

@ -11,6 +11,7 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
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.page.PageData;
@ -97,7 +98,10 @@ public class DataSyncRecordDisabilityServiceImpl extends BaseServiceImpl<DataSyn
public DataSyncRecordDisabilityDTO get(String id) {
DataSyncRecordDisabilityEntity entity = baseDao.selectById(id);
DataSyncRecordDisabilityDTO result = ConvertUtils.sourceToTarget(entity, DataSyncRecordDisabilityDTO.class);
result.setGenderCn(result.getGender() == NumConstant.ONE ? "男" : "女");
result.setGenderCn(GenderEnum.UN_KNOWN.getName());
if (null != result.getGender()){
result.setGenderCn(result.getGender() == NumConstant.ONE ? "男" : "女");
}
IcResiUserDTO icResiUserDTO = icResiUserService.get(entity.getIcResiUserId());
ResiInfoDTO resiInfoDTO = ConvertUtils.sourceToTarget(icResiUserDTO, ResiInfoDTO.class);
resiInfoDTO.setGenderCn(resiInfoDTO.getGender().equals(NumConstant.ONE_STR) ? "男" : "女");
@ -109,6 +113,9 @@ public class DataSyncRecordDisabilityServiceImpl extends BaseServiceImpl<DataSyn
public String getCj(String cj){
String result = "";
if (StringUtils.isBlank(cj)){
return result;
}
switch (cj){
case NumConstant.ONE_STR:
result = "一级";
@ -238,6 +245,7 @@ public class DataSyncRecordDisabilityServiceImpl extends BaseServiceImpl<DataSyn
String customerId = tokenDto.getCustomerId();
String userId = tokenDto.getUserId();
List<String> all = Arrays.asList(ids);
// 根据IDs查询烟台拉取的残疾信息
List<DataSyncRecordDisabilityEntity> entities = baseDao.selectBatchIds(all);
IcFormOptionsQueryFormDTO formDTO = new IcFormOptionsQueryFormDTO();
formDTO.setCustomerId(customerId);
@ -266,7 +274,8 @@ public class DataSyncRecordDisabilityServiceImpl extends BaseServiceImpl<DataSyn
}
});
});
entities.stream().filter(e -> StringUtils.isBlank(e.getCjzk()) || StringUtils.isBlank(e.getCjlb())).forEach(e -> e.setUpdateStatus(true));
// cjzk,cjlb为空的,处理结果赋值 处理失败
// entities.stream().filter(e -> StringUtils.isBlank(e.getCjzk()) || StringUtils.isBlank(e.getCjlb())).forEach(e -> e.setUpdateStatus(true));
// 变更记录
List<CategoryStatusAndIdDTO> collect = entities.stream().map(m -> {
CategoryStatusAndIdDTO dto = new CategoryStatusAndIdDTO();

4
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcEpidemicSpecialAttentionServiceImpl.java

@ -131,9 +131,9 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl<IcEpi
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
public void delete( List<String> ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
baseDao.deleteBatchIds(ids);
}
/**

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

@ -464,6 +464,14 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
return baseDao.updateIsResiFlag(customerId,icResiUserId);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateBatchNat(List<IcNatEntity> entities) {
if (CollectionUtils.isNotEmpty(entities)){
baseDao.updateBatchNat(entities);
}
}
/**
* 批量持久化
* @param entities

18
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java

@ -7,6 +7,8 @@ import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.rocketmq.constants.TopicConstants;
import com.epmet.commons.rocketmq.messages.CheckMQMsg;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
@ -20,22 +22,17 @@ import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Md5Util;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.commons.tools.utils.*;
import com.epmet.commons.tools.utils.poi.excel.handler.ExcelFillCellMergeStrategy;
import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.constant.IcResiUserConstant;
import com.epmet.dto.form.ExportResiUserFormDTO;
import com.epmet.dto.form.IcExportTemplateQueryFormDTO;
import com.epmet.dto.form.IcResiUserPageFormDTO;
import com.epmet.dto.form.ResiUserQueryValueDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.FormItemResult;
import com.epmet.dto.result.IcCustomExportResultDTO;
import com.epmet.dto.result.OptionDTO;
import com.epmet.excel.support.ExportResiUserItemDTO;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.service.IcResiUserExportService;
import com.epmet.service.IcResiUserImportService;
@ -53,7 +50,10 @@ import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.jetbrains.annotations.Nullable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
@ -76,6 +76,8 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService {
private IcResiUserService icResiUserService;
@Autowired
private IcResiUserImportService icResiUserImportService;
@Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
/**
* key:itemId,value: key:columnName,中文

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

@ -44,10 +44,7 @@ import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerResiUserRedis;
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.redis.common.bean.HouseInfoCache;
import com.epmet.commons.tools.redis.common.bean.ResiUserInfoCache;
import com.epmet.commons.tools.redis.common.bean.*;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.*;
import com.epmet.constant.IcPlatformConstant;
@ -697,6 +694,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
log.error("同步党员信息失败");
}
}
CustomerResiUserRedis.delIcResiUserInfo(resiUserId);
return resiUserId;
}
@ -3540,4 +3538,10 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
}
});
}
@Override
public IcResiUserInfoCache getIcResiUserInfo(String userId) {
IcResiUserEntity icResiUserEntity = baseDao.selectById(userId);
return ConvertUtils.sourceToTarget(icResiUserEntity,IcResiUserInfoCache.class);
}
}

66
epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.77__data_compare_d_c.sql

@ -0,0 +1,66 @@
CREATE TABLE `data_sync_record_death` (
`ID` varchar(64) NOT NULL COMMENT '主键',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id',
`AGENCY_ID` varchar(64) DEFAULT '' COMMENT '组织Id',
`PIDS` varchar(255) DEFAULT '' COMMENT '组织的pids 含agencyId本身',
`GRID_ID` varchar(64) DEFAULT '' COMMENT '网格ID',
`NAME` varchar(16) NOT NULL COMMENT '姓名',
`ID_CARD` varchar(24) NOT NULL COMMENT '身份证',
`IC_RESI_USER_ID` varchar(64) DEFAULT NULL COMMENT '居民Id,ic_resi_user.id',
`AGE` varchar(8) DEFAULT NULL COMMENT '年龄(享年)',
`ADDRESS` varchar(128) DEFAULT NULL COMMENT '家庭住址',
`DEATH_DATE` varchar(32) DEFAULT '' COMMENT '死亡时间',
`CREMATION_TIME` varchar(32) DEFAULT '' COMMENT '火化时间',
`MZ` varchar(32) DEFAULT '' COMMENT '民族',
`ORGAN_NAME` varchar(16) DEFAULT '' COMMENT '登记单位名称',
`NATION` varchar(32) DEFAULT '' COMMENT '国籍',
`THIRD_RECORD_ID` varchar(64) DEFAULT '' COMMENT '第三方记录唯一标识',
`DEAL_STATUS` smallint(1) NOT NULL DEFAULT '0' COMMENT '处理状态(更新至居民信息) 0:未处理;1:处理成功;2处理失败',
`DEAL_RESULT` varchar(128) DEFAULT '' COMMENT '处理结果',
`DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除',
`REVISION` int(11) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(32) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`) USING BTREE,
KEY `idx_u_id` (`IC_RESI_USER_ID`) USING BTREE COMMENT '居民Id'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='数据同步记录-居民死亡信息';
CREATE TABLE `data_sync_record_disability` (
`ID` varchar(64) NOT NULL COMMENT '主键',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id',
`AGENCY_ID` varchar(64) DEFAULT '' COMMENT '组织Id',
`PIDS` varchar(255) DEFAULT '' COMMENT '组织的pids 含agencyId本身',
`GRID_ID` varchar(64) DEFAULT '' COMMENT '网格ID',
`NAME` varchar(16) NOT NULL COMMENT '姓名',
`ID_CARD` varchar(24) NOT NULL COMMENT '身份证',
`MOBILE` varchar(24) DEFAULT NULL COMMENT '电话',
`IC_RESI_USER_ID` varchar(64) DEFAULT NULL COMMENT '居民Id,ic_resi_user.id',
`CARD_NUM` varchar(32) DEFAULT NULL COMMENT '残疾证号',
`CJZK_CN` varchar(32) DEFAULT NULL COMMENT '残疾等级(状况)',
`CJLB_CN` varchar(32) DEFAULT NULL COMMENT '残疾类别',
`EDU_LEVEL` varchar(32) DEFAULT '' COMMENT '文化程度',
`MARITAL_STATUS_NAME` varchar(32) DEFAULT '' COMMENT '婚姻状况',
`MZ_CN` varchar(32) DEFAULT '' COMMENT '民族中文',
`GENDER` char(2) DEFAULT NULL COMMENT '性别 1男2女',
`RESIDENT_ADD` varchar(128) DEFAULT NULL COMMENT '户籍地址',
`NOW_ADD` varchar(128) DEFAULT NULL COMMENT '现居住地址',
`GUARDIAN` varchar(32) DEFAULT '' COMMENT '监护人',
`GUARDIAN_PHONE` varchar(32) DEFAULT '' COMMENT '监护人联系方式',
`DEAL_STATUS` smallint(1) NOT NULL DEFAULT '0' COMMENT '处理状态(更新至居民信息) 0:未处理;1:处理成功;2处理失败',
`DISABILITY_STATUS` smallint(1) NOT NULL DEFAULT '0' COMMENT '需要处理的残疾状态 0:非残疾;1:残疾',
`DEAL_RESULT` varchar(128) DEFAULT '' COMMENT '处理结果',
`DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除',
`REVISION` int(11) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(32) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`) USING BTREE,
KEY `idx_u_id` (`IC_RESI_USER_ID`) USING BTREE COMMENT '居民Id'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='数据同步记录-居民残疾信息';
UPDATE `epmet_user`.`data_sync_config` SET `DATA_CODE` = 'siwang' ,`UPDATED_TIME` = now() WHERE `ID` = '7';
UPDATE `epmet_user`.`data_sync_config` SET `DATA_CODE` = 'canji' ,`UPDATED_TIME` = now() WHERE `ID` = '9';

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

Binary file not shown.

8
epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncRecordDisabilityDao.xml

@ -112,7 +112,7 @@
when id = #{item.id} then '处理失败'
</when>
<otherwise>
when id = #{item.id} then '处理成功'
when id = #{item.id} then ''
</otherwise>
</choose>
</foreach>
@ -132,6 +132,12 @@
when d.deal_status = 2 then '处理失败'
else '处理失败' end) as dealStatusName,
d.now_add as address,
(
case when d.GENDER='1' then '男'
when d.GENDER='2' then '女'
else '未知'
end
)as genderCn,
d.*
FROM data_sync_record_disability d
WHERE DEL_FLAG = 0

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

@ -7,6 +7,7 @@
<select id="pageList" parameterType="com.epmet.dto.form.yqfk.IcNatCompareRecordPageFormDTO" resultType="com.epmet.dto.IcNatCompareRecordDTO">
SELECT
r.ID as relationId,
c.ID as recordId,
c.MOBILE,
c.ID_CARD,
c.`NAME`,

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

@ -158,13 +158,14 @@
<select id="getExistNatInfo" resultType="com.epmet.dto.result.NatUserInfoResultDTO">
<foreach collection="list" item="l" separator="UNION ALL">
SELECT
ID,
USER_ID,
ID_CARD
FROM ic_nat
WHERE del_flag = '0'
AND USER_ID = #{l.userId}
AND ID_CARD = #{l.idCard}
AND UNIX_TIMESTAMP(NAT_TIME) = UNIX_TIMESTAMP(#{l.natTime})
AND UNIX_TIMESTAMP(SAMPLE_TIME) = UNIX_TIMESTAMP(#{l.sampleTime})
</foreach>
</select>
@ -189,4 +190,36 @@
m.ID_CARD = t.ID_CARD
AND m.DEL_FLAG = '0'
</update>
<update id="updateBatchNat">
UPDATE ic_nat
<trim prefix="set" suffixOverrides=",">
<trim prefix="NAT_TIME =(case" suffix="end),">
<foreach collection="list" item="l">
when ID = #{l.id} then #{l.natTime}
</foreach>
</trim>
<trim prefix="NAT_ADDRESS =(case" suffix="end),">
<foreach collection="list" item="l">
when ID = #{l.id} then #{l.natAddress}
</foreach>
</trim>
<trim prefix="NAT_RESULT =(case" suffix="end),">
<foreach collection="list" item="l">
when ID = #{l.id} then #{l.natResult}
</foreach>
</trim>
<trim prefix="MOBILE =(case" suffix="end),">
<foreach collection="list" item="l">
when ID = #{l.id} then #{l.mobile}
</foreach>
</trim>
UPDATED_TIME = NOW()
</trim>
WHERE DEL_FLAG = '0'
AND ID IN(
<foreach collection="list" item="l" separator=",">
#{l.id}
</foreach>)
</update>
</mapper>

30
epmet-user/epmet-user-server/src/test/java/com/epmet/dao/IcNatDaoTest.java

@ -0,0 +1,30 @@
package com.epmet.dao;
import com.epmet.entity.IcNatEntity;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.ArrayList;
import java.util.List;
@SpringBootTest
@RunWith(SpringRunner.class)
public class IcNatDaoTest {
@Autowired
private IcNatDao icNatDao;
@Test
public void updateBatchNat() {
List<IcNatEntity> entities = new ArrayList<>();
for (int i = 0; i < 2; i++) {
IcNatEntity en = new IcNatEntity();
en.setNatResult("222222"+i);
en.setUserId(""+i);
en.setIdCard("card"+i);
entities.add(en);
}
icNatDao.updateBatchNat(entities);
}
}
Loading…
Cancel
Save