diff --git a/epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/ComplementLogOperationDTO.java b/epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/ComplementLogOperationDTO.java new file mode 100644 index 0000000000..ff363c2ad6 --- /dev/null +++ b/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; +} diff --git a/epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/form/LogOperationListFormDTO.java b/epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/form/LogOperationListFormDTO.java index 3fe203b482..a4fc503431 100644 --- a/epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/form/LogOperationListFormDTO.java +++ b/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; } diff --git a/epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/region/LogOperationResultDTO.java b/epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/region/LogOperationResultDTO.java index b08c9fc295..b794dcbd26 100644 --- a/epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/region/LogOperationResultDTO.java +++ b/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; } diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/LogOperationController.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/LogOperationController.java index 089ad29639..419ff38b21 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/LogOperationController.java +++ b/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>().ok(resultList); } + /** + * 数字社区-操作记录 + * @param formDTO + * @return + */ + @PostMapping("page") + public Result> page(@RequestBody LogOperationListFormDTO formDTO, @LoginUser TokenDto tokenDto){ + return new Result>().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(); + } } diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/dao/LogOperationDao.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/dao/LogOperationDao.java index a63a5aa8e4..be1858c9e2 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/dao/LogOperationDao.java +++ b/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 { - + + List 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> getStaffId(); + + void updateBatchLog(@Param("list") List list); + } \ No newline at end of file diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/entity/LogOperationEntity.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/entity/LogOperationEntity.java index 537d1fc9b2..e576d3823a 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/entity/LogOperationEntity.java +++ b/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; /** * 操作时间,该时间不是插入数据的时间,而是操作发生的真实时间 diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/RocketMQConsumerRegister.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/RocketMQConsumerRegister.java index 93a2f8e5f0..7f15960037 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/RocketMQConsumerRegister.java +++ b/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()); // ...其他监听器类似 } diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/CheckAndExportOperationLogListener.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/CheckAndExportOperationLogListener.java new file mode 100644 index 0000000000..977117ac84 --- /dev/null +++ b/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 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); + } +} diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/LogOperationService.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/LogOperationService.java index 67b3736395..ce56a25a6e 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/LogOperationService.java +++ b/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 listOperationLogs(String condition, String customerId, Integer pageNo, Integer pageSize); + + /** + * 数字社区-操作记录 + * @param loginUserCustomerId + * @param startTime + * @param endTime + * @param operatorName + * @param operatorMobile + * @return + */ + PageData page(String loginUserCustomerId, + String startTime, + String endTime, + String operatorName, + String operatorMobile, + Integer pageNo, Integer pageSize, String category, TokenDto tokenDto); + + void complementLogOperation(); + } diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/LogOperationServiceImpl.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/LogOperationServiceImpl.java index 1cbf7e32d2..fae8de2b7c 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/LogOperationServiceImpl.java +++ b/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 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 list = logOperationDao.pageList(customerId, startTime, endTime, operatorName, operatorMobile,category,staffInfo.getAgencyId()); + PageInfo 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> pageInfo = PageHelper.startPage(no, NumConstant.ONE_HUNDRED).doSelectPageInfo(() -> logOperationDao.getStaffId()); + size = pageInfo.getList().size(); + if (!CollectionUtils.isEmpty(pageInfo.getList())){ + List needUpdate = new ArrayList<>(); + for (Map 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 list){ + logOperationDao.updateBatchLog(list); + } } diff --git a/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.24__alter_log_operation.sql b/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.24__alter_log_operation.sql new file mode 100644 index 0000000000..cba42020bb --- /dev/null +++ b/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.24__alter_log_operation.sql @@ -0,0 +1,2 @@ + +ALTER TABLE log_operation MODIFY COLUMN CATEGORY varchar(64) not null COMMENT '操作类型大类。例如login和logout都属于login大类。项目立项,项目流转,项目结案都属于项目大类;data_tm:数据脱敏;'; diff --git a/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.25__alter_log_operation2.sql b/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.25__alter_log_operation2.sql new file mode 100644 index 0000000000..aa1c5f98a3 --- /dev/null +++ b/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; \ No newline at end of file diff --git a/epmet-admin/epmet-admin-server/src/main/resources/mapper/LogOperationDao.xml b/epmet-admin/epmet-admin-server/src/main/resources/mapper/LogOperationDao.xml index 5f34d339ad..749e9b4288 100644 --- a/epmet-admin/epmet-admin-server/src/main/resources/mapper/LogOperationDao.xml +++ b/epmet-admin/epmet-admin-server/src/main/resources/mapper/LogOperationDao.xml @@ -26,5 +26,67 @@ + + update log_operation + + + + when OPERATOR_ID = #{item.staffId} then #{item.orgId} + + + + + when OPERATOR_ID = #{item.staffId} then #{item.orgIdPath} + + + UPDATED_TIME = NOW() + + where 1=1 + + OPERATOR_ID = #{item.staffId} + + + + \ No newline at end of file diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/IcLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/IcLoginServiceImpl.java index ea0ae6d5fb..16d7e2ba5e 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/IcLoginServiceImpl.java +++ b/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); diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java index c7c79bb575..447e2cb1d5 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java +++ b/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); diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java index 6bc618a01b..c4f43a03b2 100644 --- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java +++ b/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"; } diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java index 23bfd628a4..2624971db2 100644 --- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java +++ b/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"; } diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/CheckMQMsg.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/CheckMQMsg.java new file mode 100644 index 0000000000..30b1595e20 --- /dev/null +++ b/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; + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java index b89a521218..1dd825b18e 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java @@ -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; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtDataSyncResDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtDataSyncResDTO.java new file mode 100644 index 0000000000..aff500e51e --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtDataSyncResDTO.java @@ -0,0 +1,28 @@ +package com.epmet.commons.tools.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + + +/** + * @Description + * @Author yzm + * @Date 2022/9/26 17:04 + */ +@NoArgsConstructor +@Data +public class YtDataSyncResDTO { + private int code = 200; + private String msg = "请求成功"; + /** + * 响应数据 + */ + private String data; + private int total; + + public YtDataSyncResDTO(int code, String msg, String data) { + this.code = code; + this.msg = msg; + this.data = data; + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtHscyResDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtHscyResDTO.java new file mode 100644 index 0000000000..5e404f75d9 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtHscyResDTO.java @@ -0,0 +1,80 @@ +package com.epmet.commons.tools.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + + +/** + * @Description 核算采样结果 + * @Author yzm + * @Date 2022/9/26 17:04 + */ +@NoArgsConstructor +@Data +public class YtHscyResDTO { + private int code = 200; + private String msg = "请求成功"; + /** + * 响应数据 + */ + private List data; + private int total; + + @Data + public static class YtHscyResDetail { + private String id; + private String name; + private String card_type; + private String card_no; + private String create_by; + /** + * 采样时间 + */ + private String create_time; + private String sys_org_code; + private String sample_tube; + private String package_id; + private String city; + private String uuid; + private String county; + private String depart_ids; + private Object depart_name; + /** + * 采样点名称 + */ + private String realname; + private String upload_time; + private Object sd_id; + private Object sd_batch; + private Object sd_operation; + private Object sd_time; + private String inserttime; + } + + /*{ + "id":"1570924677539635484", + "name":"杨XX",//姓名 + "card_type":"1",//证件类型 + "card_no":"37************0813",//证件号码 + "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"//省大数据局返还烟台入库时间 + }*/ + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 64688c8990..ec9ee8c209 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -263,6 +263,10 @@ public enum EpmetErrorCode { UNIT_EXIST_HOUSES_ERROR(8928,"单元下存在房屋,不可修改单元数"), IC_VACCINE(8929,"已存在相同记录,请去修改原有记录"), NOT_MATCH_IC_USER_ERROR(8930,"请联系社区工作人员"), + NAT_TIME_IS_NULL_ERROR(8931,"检测时间不能为空"), + NAT_RESULT_IS_NULL_ERROR(8932,"检测结果不能为空"), + SAMPLE_TIME_IS_NULL_ERROR(8933,"采样时间不能为空"), + SAMPLE_TIME_AND_RESULT_IS_NULL_ERROR(8934,"检测时间或结果不能为空"), MISMATCH(10086,"人员与房屋信息不匹配,请与工作人员联系。"), diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonUserFeignClient.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonUserFeignClient.java index 0f8f937a8a..8e67c1939b 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonUserFeignClient.java +++ b/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 getUserInfo(@PathVariable("userId") String userId); + + @PostMapping("/epmetuser/icresiuser/getIcResiUserInfo/{userId}") + Result getIcResiUserInfo(@PathVariable("userId") String userId); } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonUserFeignClientFallback.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonUserFeignClientFallback.java index 8cd5660484..77f212943c 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonUserFeignClientFallback.java +++ b/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 getUserInfo(String userId) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserInfo", userId); } + + @Override + public Result getIcResiUserInfo(String userId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getIcResiUserInfo", userId); + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index c09f13f2f4..49ab921e0f 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/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] diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerResiUserRedis.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerResiUserRedis.java index 5b34fcdee7..2efa0bdbf1 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerResiUserRedis.java +++ b/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 map = customerResiUserRedis.redisUtils.hGetAll(key); + if (!CollectionUtils.isEmpty(map)) { + return ConvertUtils.mapToEntity(map, IcResiUserInfoCache.class); + } + Result 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 cacheMap = BeanUtil.beanToMap(data, false, true); + customerResiUserRedis.redisUtils.hMSet(key, cacheMap); + return data; + } + @Nullable private static ResiUserInfoCache reloadStaffCache(String userId, String key) { Result 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); + } + } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/HouseInfoCache.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/HouseInfoCache.java index 1fe656fef6..d3df049dab 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/HouseInfoCache.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/HouseInfoCache.java @@ -107,4 +107,19 @@ public class HouseInfoCache implements Serializable { * 二维码地址 */ private String houseQrcodeUrl; + + /** + * 房主姓名 + */ + private String ownerName; + + /** + * 房主电话 + */ + private String ownerPhone; + + /** + * 房主身份证 + */ + private String ownerIdCard; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/IcResiUserInfoCache.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/IcResiUserInfoCache.java new file mode 100644 index 0000000000..6749272790 --- /dev/null +++ b/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; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/YtHsResUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/YtHsResUtils.java index 0ea496de19..3a23dac10d 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/YtHsResUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/YtHsResUtils.java @@ -1,6 +1,10 @@ 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 lombok.extern.slf4j.Slf4j; @@ -15,39 +19,203 @@ import java.util.Map; */ @Slf4j public class YtHsResUtils { - private static String URL = "http://10.2.2.60:8191/sjzt/server/hsjcxx"; - private static final String APP_KEY_VALUE = "DR4jF5Be7sCsqDmCamq2tmYCl"; + private static String SERVER_URL = "http://10.2.2.60:8191/sjzt/server/"; private static final String APP_KEY = "appkey"; private static final String CARD_NO = "card_no"; private static final String ROW_NUM = "ROWNUM"; private static final String PAGE_SIZE = "PAGESIZE"; + + /** + * desc:核酸采样查询 + * + * @return + */ + public static YtHscyResDTO hscy(String cardNo, Integer rowNum, Integer pageSize) { + try { + Map param = new HashMap<>(); + 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); + + Result 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 result = new Result().ok(mockData); + log.info("hscy api result:{}", JSON.toJSONString(result)); + if (result.success()) { + 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())); + } + YtHscyResDTO resultResult = new YtHscyResDTO(); + resultResult.setData(new ArrayList<>()); + return resultResult; + } + /** - * desc:图片同步扫描 + * desc:核酸结果查询 * * @return */ 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); - Map param = new HashMap<>(); - param.put(APP_KEY,APP_KEY_VALUE); - param.put(CARD_NO,cardNo); - param.put(ROW_NUM,rowNum); - param.put(PAGE_SIZE,pageSize); - log.info("hsjc api param:{}",param); - Result result = HttpClientManager.getInstance().sendGet(URL, param); - log.info("hsjc api result:{}",JSON.toJSONString(result)); + Map param = new HashMap<>(); + 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); + Result 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 result = new Result().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) { - e.printStackTrace(); - log.warn(String.format("烟台核酸检测结果查询异常cardNo:%s,异常信息:%s", cardNo, e.getMessage())); + log.error(String.format("烟台核酸检测结果查询异常cardNo:%s,异常信息:%s", cardNo, e.getMessage())); } YtHsjcResDTO resultResult = new YtHsjcResDTO(); resultResult.setData(new ArrayList<>()); return resultResult; } + + /** + * desc:死亡数据同步 + * + * @return + */ + public static YtDataSyncResDTO siWang(String cardNo, String userName) { + try { +// 1)appkey秘钥 +// 2)name姓名 必填 +// 3)idcard身份证号 必填 +// 4)start开始默认0 +// 5)limit每页记录数 + Map param = new HashMap<>(); + param.put(APP_KEY, "IGE8TMM6f4t1Sef7FfstOLHAL"); + param.put("id_card", cardNo); + param.put("name", userName); + param.put("start", 0); + param.put("limit", 1); + + log.info("siWang api param:{}", param); + + Result 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 result = new Result().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 && StrConstant.HTTP_STATUS_OK.equals(jsonObject.getString(StrConstant.HTTP_RESP_CODE))) { + //第一层 + JSONObject firstData = JSON.parseObject(jsonObject.getString("data")); + + //第二层 data + 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) { + //第二层 data + thirdData = secondData.getJSONArray("data").get(0); + } + return new YtDataSyncResDTO(200, "", thirdData.toString()); + } else { + log.warn("siWang 调用蓝图接口成功但是蓝图的结果中 省平台失败"); + } + } else { + log.warn("siWang 调用蓝图接口败"); + } + } catch (Exception e) { + log.error(String.format("烟台siWang结果查询异常cardNo:%s,异常信息:%s", cardNo, e.getMessage())); + } + return new YtDataSyncResDTO(); + } + + /** + * desc:残疾数据同步 + * + * @return + * @remark:默认失败 因为一旦成功没有数据 会影响残疾人的数据 接口失败数据不做任何处理 + */ + public static YtDataSyncResDTO canji(String idCard, String userName) { + + YtDataSyncResDTO failResult = new YtDataSyncResDTO(); + failResult.setCode(500); + failResult.setMsg("默认错误"); + try { +// 1)appkey +// 2)name姓名 +// 3)citizenId身份证号 + Map param = new HashMap<>(); + param.put(APP_KEY, "EWGsaK0aM21wkDjCIWbahGVk2"); + param.put("citizenId", idCard); + param.put("name", userName); + + log.info("canji api param:{}", param); + + + Result 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 result = new Result().ok(mockData); + log.info("canji api result:{}", JSON.toJSONString(result)); + + if (result.success()) { + String data = result.getData(); + JSONObject jsonObject = JSON.parseObject(data); + //他们的结果是成功的 + 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 && StrConstant.HTTP_STATUS_OK.equals(realObject.getString(StrConstant.HTTP_RESP_CODE))) { + //第二层 data + String thirdData = realObject.getString("data"); + return JSON.parseObject(thirdData, YtDataSyncResDTO.class); + } else { + log.warn("canji 调用蓝图接口成功但是蓝图的结果中 省平台失败"); + } + } else { + log.warn("canji 调用蓝图接口败"); + } + + } + } catch (Exception e) { + log.error(String.format("烟台canji结果查询异常cardNo:%s,异常信息:%s", idCard, e.getMessage())); + } + return failResult; + } + + + public static void main(String[] args) { + YtDataSyncResDTO canji = canji("123", "123"); + System.out.println("残疾结果:" + JSON.toJSON(canji)); + + + YtDataSyncResDTO siwang = siWang("1213", "!23"); + System.out.println("死亡结果:" + JSON.toJSON(siwang)); + } + + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/pom.xml b/epmet-module/data-aggregator/data-aggregator-server/pom.xml index 27873367ec..30999f1c99 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/pom.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/pom.xml @@ -126,6 +126,18 @@ 2.0.0 compile + + com.epmet + epmet-commons-rocketmq + 2.0.0 + compile + + + com.epmet + epmet-message-client + 2.0.0 + compile + diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java index 9b9c7a0ef1..24d9c5a738 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java +++ b/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>().ok(epmetUserService.gridMemberPatrolList(formDTO)); } + /** + * Desc: 数据明文查询 + * @param formDTO + * @author zxc + * @date 2022/10/17 13:45 + */ + @PostMapping("detailByType") + public Result detailByType(@RequestBody DetailByTypeFormDTO formDTO, @LoginUser TokenDto tokenDto){ + ValidatorUtils.validateEntity(formDTO, DetailByTypeFormDTO.DetailByTypeForm.class); + return new Result().ok(epmetUserService.detailByType(formDTO,tokenDto)); + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/IcResiUserDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/IcResiUserDao.java index 3b3a66dd50..e666aab317 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/IcResiUserDao.java +++ b/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 { @Param("agencyId")String agencyId, @Param("staffOrgIds")String staffOrgIds, @Param("search")String search); + + Map getTripReportRecordInfo(@Param("id")String id); + + Map getVaccineRecordInfo(@Param("id")String id); + + Map getSpecialAttentionInfo(@Param("id")String id); + + Map getNoNatCompareInfo(@Param("id")String id); + + Map getNatInfo(@Param("id")String id); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java index 901087a7ba..6ff3e02f90 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java +++ b/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 listVaccinePoints(String customerId, String agencyId, String staffOrgIds, String search); List 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); + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java index f93c66675b..79f949b525 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java +++ b/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 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 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 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 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 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; + } } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/IcResiUserDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/IcResiUserDao.xml index d89996a58a..d80dceb72d 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/IcResiUserDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/IcResiUserDao.xml @@ -283,4 +283,47 @@ having volunteerCategory is null or volunteerCategory = '' + + + + + + + + diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/NatInfoScanTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/NatInfoScanTask.java index d7334fabd6..f141cc818a 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/NatInfoScanTask.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/NatInfoScanTask.java @@ -3,7 +3,7 @@ package com.epmet.task; import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.form.NatInfoScanTaskFormDTO; +import com.epmet.dto.form.DataSyncTaskParam; import com.epmet.feign.EpmetUserOpenFeignClient; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -26,9 +26,9 @@ public class NatInfoScanTask implements ITask { @Override public void run(String params) { - NatInfoScanTaskFormDTO formDTO = new NatInfoScanTaskFormDTO(); + DataSyncTaskParam formDTO = new DataSyncTaskParam(); if (StringUtils.isNotBlank(params)) { - formDTO = JSON.parseObject(params, NatInfoScanTaskFormDTO.class); + formDTO = JSON.parseObject(params, DataSyncTaskParam.class); } Result result = userOpenFeignClient.natInfoScanTask(formDTO); if (result.success()) { diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java index 9920eb019a..e0d8c80b35 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java +++ b/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 = "参加党小组会"; diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java index 3eea1f03d8..ad742b155b 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java +++ b/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); } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java index 251046a50f..f8210046bd 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java +++ b/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; diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/GovMenuServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/GovMenuServiceImpl.java index a3b63e096b..a413c9dfdc 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/GovMenuServiceImpl.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/GovMenuServiceImpl.java @@ -234,7 +234,7 @@ public class GovMenuServiceImpl extends BaseServiceImpl 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); - } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java index 77a5bdd4ad..0855d78104 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java +++ b/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 { * @return */ Result checkHomeInfo(CheckHouseInfoFormDTO formDTO); + + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java index 0f69fc8816..943d6f9eee 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java +++ b/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 idCards; + + // ========================后台设置===== + /** + * 根据配置 设置次参数;数据查询范围 必填 + */ + private List orgList; + + /** + * 居民状态【0:正常;1:迁出;2:注销】 + */ + private String resiStatus; + + /** + * 类别字段 + */ + public String categoryColumn; + + /** + * 是否同步 1:是;0:否; + */ + private String isSync = NumConstant.ZERO_STR; + + /** + * 核酸检测信息列表 点击同步时使用此字段 不使用数据配置的范围 + */ + private String agencyId = null; + private String dataCode; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/MyNatListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/MyNatListFormDTO.java index 0272a30799..88f8359222 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/MyNatListFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/MyNatListFormDTO.java @@ -51,6 +51,12 @@ public class MyNatListFormDTO extends PageFormDTO { */ private String endTime; + /** + * 采样开始/结束时间yyyy-MM-dd HH:mm + */ + private String sampleStartTime; + private String sampleEndTime; + /** * 核酸记录Id */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/NatInfoScanTaskFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/NatInfoScanTaskFormDTO.java deleted file mode 100644 index 6d642b2e90..0000000000 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/NatInfoScanTaskFormDTO.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.epmet.dto.form; - -import lombok.Data; - -import java.io.Serializable; -import java.util.List; - -/** - * @Author zxc - * @DateTime 2022/9/26 17:04 - * @DESC - */ -@Data -public class NatInfoScanTaskFormDTO implements Serializable { - - private static final long serialVersionUID = 3053943501957102943L; - - private String customerId; - - private List idCards; -} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/dataSync/AddRecordByResidentCategoryFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/dataSync/AddRecordByResidentCategoryFormDTO.java new file mode 100644 index 0000000000..e855aa6b00 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/dataSync/AddRecordByResidentCategoryFormDTO.java @@ -0,0 +1,34 @@ +package com.epmet.dto.form.dataSync; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2022/10/14 09:03 + * @DESC + */ +@Data +public class AddRecordByResidentCategoryFormDTO implements Serializable { + + private static final long serialVersionUID = -6932891703465769267L; + + private List icResiUserIds; + + /** + * 字段名【居民类别名】,与label相对应。eg:IS_CJ + */ + private String columnName; + + /** + * eg:残疾 + */ + private String label; + + private String userId; + private String userName; + + private String customerId; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/dataSync/CategoryStatusAndIdDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/dataSync/CategoryStatusAndIdDTO.java new file mode 100644 index 0000000000..92327d1fe4 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/dataSync/CategoryStatusAndIdDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.form.dataSync; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/10/14 10:55 + * @DESC + */ +@Data +public class CategoryStatusAndIdDTO implements Serializable { + + private static final long serialVersionUID = 439600592532868368L; + + private String icResiUserId; + + /** + * 类别状态 是:1,否:0 + */ + private String categoryStatus; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/dataSync/DataSyncRecordDeathPageFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/dataSync/DataSyncRecordDeathPageFormDTO.java new file mode 100644 index 0000000000..ea1daef7b3 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/dataSync/DataSyncRecordDeathPageFormDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dto.form.dataSync; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.Data; + +/** + * @Description + * @Author yzm + * @Date 2022/10/13 14:16 + */ +@Data +public class DataSyncRecordDeathPageFormDTO extends PageFormDTO { + /** + * 姓名 + */ + private String name; + + /** + * 身份证 + */ + private String idCard; + + private String customerId; + /** + * 当前工作人员id + */ + private String staffId; + /** + * 当前工作人员所属组织id + */ + private String agencyId; +} + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/dataSync/DataSyncRecordDisabilityFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/dataSync/DataSyncRecordDisabilityFormDTO.java new file mode 100644 index 0000000000..0de7c52e15 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/dataSync/DataSyncRecordDisabilityFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.form.dataSync; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/10/13 14:47 + * @DESC + */ +@Data +public class DataSyncRecordDisabilityFormDTO extends PageFormDTO implements Serializable { + + private static final long serialVersionUID = -20061989190666183L; + + private String name; + private String idCard; + private String mobile; + private String customerId; + private String userId; + private String agencyId; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/dataSync/QueryIcResiUserFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/dataSync/QueryIcResiUserFormDTO.java new file mode 100644 index 0000000000..99a2d856d7 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/dataSync/QueryIcResiUserFormDTO.java @@ -0,0 +1,40 @@ +package com.epmet.dto.form.dataSync; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import com.epmet.dto.DataSyncScopeDTO; +import lombok.Data; + +import java.util.List; + +/** + * desc:查询数据同步 所需要的居民信息参数 + * @author liujianjun + */ +@Data +public class QueryIcResiUserFormDTO extends PageFormDTO { + private static final long serialVersionUID = -3556723801307348545L; + /** + * 数据查询范围 必填 + */ + private List scopeList; + /** + * 必填 + */ + private String customerId; + + /** + * 身份证号集合 非必填 + */ + private List idCards; + + /** + * 居民状态【0:正常;1:迁出;2:注销】 + */ + private String resiStatus; + /** + * 居民子状态 01:新增、02:导入、03:迁入、04:新生、11:迁出、21死亡 + */ + private String resiSubStatus; + +} + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/dataSync/ResiInfoDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/dataSync/ResiInfoDTO.java new file mode 100644 index 0000000000..1f148219b5 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/dataSync/ResiInfoDTO.java @@ -0,0 +1,84 @@ +package com.epmet.dto.form.dataSync; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/10/13 15:58 + * @DESC + */ +@Data +public class ResiInfoDTO implements Serializable { + + private static final long serialVersionUID = -3320460795150912451L; + + + /** + * 姓名 + */ + private String name; + + /** + * 身份证 + */ + private String idCard; + + /** + * 电话 + */ + private String mobile; + + + /** + * 残疾证号 + */ + private String cardNum; + + /** + * 残疾等级(状况) + */ + private String cjzk; + private String cjzkCn; + + /** + * 残疾类别 + */ + private String cjlb; + private String cjlbCn; + + /** + * 民族 + */ + private String mz; + + /** + * 家庭住址 + */ + private String address; + + /** + * 性别 + */ + private String gender; + private String genderCn; + + /** + * 监护人 + */ + private String guardian; + + public ResiInfoDTO() { + this.name = ""; + this.idCard = ""; + this.mobile = ""; + this.cardNum = ""; + this.cjzk = ""; + this.cjlb = ""; + this.mz = ""; + this.address = ""; + this.gender = ""; + this.guardian = ""; + } +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatListResultDTO.java index cbeb66e482..ee3f03e5e9 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatListResultDTO.java +++ b/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; /** @@ -71,6 +71,11 @@ public class NatListResultDTO implements Serializable { @ExcelProperty(value = "检测时间",order = 4) private Date natTime; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + @ColumnWidth(25) + @ExcelProperty(value = "采样时间",order = 4) + private Date sampleTime; + /** * 检测结果 */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatUserInfoResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatUserInfoResultDTO.java index 10e611aa46..278f3ca537 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatUserInfoResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatUserInfoResultDTO.java @@ -14,11 +14,22 @@ public class NatUserInfoResultDTO implements Serializable { private static final long serialVersionUID = 8904940082452398136L; + private String customerId; + private String idCard; private String userId; private String agencyId; + private String gridId; + private String pids; + + private String name; + + /** + * 18大类 中 某一类的 是否值,用于比较 同步数据结果确定是否要插入到表中 + */ + private String categoryColumn; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index a2398b2d92..1a61d61a3c 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -923,5 +923,5 @@ public interface EpmetUserOpenFeignClient { Result dingResiLogin(@RequestBody DingLoginResiFormDTO formDTO); @PostMapping("/epmetuser/dataSyncConfig/natInfoScanTask") - Result natInfoScanTask(@RequestBody NatInfoScanTaskFormDTO formDTO); + Result natInfoScanTask(@RequestBody DataSyncTaskParam formDTO); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 4601ca1ef3..630e838db7 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -713,7 +713,7 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien } @Override - public Result natInfoScanTask(NatInfoScanTaskFormDTO formDTO) { + public Result natInfoScanTask(DataSyncTaskParam formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "natInfoScanTask", formDTO); } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/ChangeDeathController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/ChangeDeathController.java index c3a1e0ec6f..963d2369d0 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/ChangeDeathController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/ChangeDeathController.java @@ -50,6 +50,12 @@ public class ChangeDeathController { return new Result().ok(data); } + /** + * 死亡管理-新增死亡人员 + * @param tokenDto + * @param dto + * @return + */ @NoRepeatSubmit @PostMapping("save") public Result save(@LoginUser TokenDto tokenDto, @RequestBody ChangeDeathDTO dto){ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncConfigController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncConfigController.java index 950de6f573..2ea0a33db9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncConfigController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncConfigController.java @@ -13,7 +13,7 @@ import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.DataSyncConfigDTO; import com.epmet.dto.form.ConfigSwitchFormDTO; -import com.epmet.dto.form.NatInfoScanTaskFormDTO; +import com.epmet.dto.form.DataSyncTaskParam; import com.epmet.dto.form.ScopeSaveFormDTO; import com.epmet.service.DataSyncConfigService; import org.springframework.beans.factory.annotation.Autowired; @@ -107,8 +107,8 @@ public class DataSyncConfigController { } @PostMapping("natInfoScanTask") - public Result natInfoScanTask(@RequestBody NatInfoScanTaskFormDTO formDTO){ - dataSyncConfigService.natInfoScanTask(formDTO); + public Result natInfoScanTask(@RequestBody DataSyncTaskParam formDTO){ + dataSyncConfigService.dataSyncForYanTaiTask(formDTO); return new Result(); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncRecordDeathController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncRecordDeathController.java new file mode 100644 index 0000000000..f03708e2f4 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncRecordDeathController.java @@ -0,0 +1,137 @@ +package com.epmet.controller; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.write.metadata.WriteSheet; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.MaskResponse; +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; +import com.epmet.dto.DataSyncRecordDeathDTO; +import com.epmet.dto.form.dataSync.DataSyncRecordDeathPageFormDTO; +import com.epmet.service.DataSyncRecordDeathService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.Date; +import java.util.List; + + +/** + * 数据同步记录-居民死亡信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-10-11 + */ +@Slf4j +@RestController +@RequestMapping("dataSyncRecordDeath") +public class DataSyncRecordDeathController { + + @Autowired + private DataSyncRecordDeathService dataSyncRecordDeathService; + + /** + * 列表 + * @param formDTO + * @return + */ + @MaskResponse(fieldNames = {"idCard" }, fieldsMaskType = {MaskResponse.MASK_TYPE_ID_CARD }) + @RequestMapping("page") + public Result> page(@LoginUser TokenDto tokenDto, @RequestBody DataSyncRecordDeathPageFormDTO formDTO){ + formDTO.setStaffId(tokenDto.getUserId()); + formDTO.setCustomerId(tokenDto.getCustomerId()); + PageData page = dataSyncRecordDeathService.page(formDTO); + return new Result>().ok(page); + } + + /** + * 查看详情-带网格名称 + * @param id + * @return + */ + @PostMapping(value = "detail/{id}") + public Result get(@PathVariable("id") String id){ + DataSyncRecordDeathDTO data = dataSyncRecordDeathService.get(id); + return new Result().ok(data); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @PostMapping("delete") + public Result delete(@RequestBody List ids) { + if (CollectionUtils.isEmpty(ids)) { + return new Result(); + } + dataSyncRecordDeathService.delete(ids); + return new Result(); + } + + /** + * pc:数据比对-死亡人员数据-导出 + * @param tokenDto + * @param formDTO + * @param response + */ + @NoRepeatSubmit + @PostMapping("export") + public void export(@LoginUser TokenDto tokenDto, @RequestBody DataSyncRecordDeathPageFormDTO formDTO, HttpServletResponse response) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); + formDTO.setIsPage(false); + ExcelWriter excelWriter = null; + formDTO.setPageSize(NumConstant.TEN_THOUSAND); + int pageNo = formDTO.getPageNo(); + try { + String today = DateUtils.format(new Date(), DateUtils.DATE_PATTERN_MMDD); + String fileName = "数据比对-死亡人员数据".concat(today); + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), DataSyncRecordDeathDTO.class).build(); + WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); + PageData data = null; + do { + data = dataSyncRecordDeathService.page(formDTO); + formDTO.setPageNo(++pageNo); + excelWriter.write(data.getList(), writeSheet); + } while (org.apache.commons.collections4.CollectionUtils.isNotEmpty(data.getList()) && data.getList().size() == formDTO.getPageSize()); + + } catch (Exception e) { + log.error("export exception", e); + } finally { + // 千万别忘记finish 会帮忙关闭流 + if (excelWriter != null) { + excelWriter.finish(); + } + } + } + + /** + * 批量更新 + * 新增死亡记录 + * + * @param tokenDto + * @param ids + * @return + */ + @NoRepeatSubmit + @PostMapping("batchupdate") + public Result batchUpdate(@LoginUser TokenDto tokenDto, @RequestBody List ids) { + if (CollectionUtils.isEmpty(ids)) { + return new Result(); + } + dataSyncRecordDeathService.batchUpdate(tokenDto.getUserId(), tokenDto.getCustomerId(), ids); + return new Result(); + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncRecordDisabilityController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncRecordDisabilityController.java new file mode 100644 index 0000000000..d890ff812c --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncRecordDisabilityController.java @@ -0,0 +1,105 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.MaskResponse; +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.dto.DataSyncRecordDisabilityDTO; +import com.epmet.dto.form.dataSync.DataSyncRecordDisabilityFormDTO; +import com.epmet.service.DataSyncRecordDisabilityService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Map; + + +/** + * 数据同步记录-居民残疾信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-10-11 + */ +@RestController +@RequestMapping("dataSyncRecordDisability") +public class DataSyncRecordDisabilityController { + + @Autowired + private DataSyncRecordDisabilityService dataSyncRecordDisabilityService; + + @PostMapping("page") + @MaskResponse(fieldNames = { "mobile", "idCard" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD }) + public Result> page(@LoginUser TokenDto tokenDto,@RequestBody DataSyncRecordDisabilityFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + PageData page = dataSyncRecordDisabilityService.list(formDTO); + return new Result>().ok(page); + } + + @PostMapping("detail/{id}") + public Result get(@PathVariable("id") String id){ + DataSyncRecordDisabilityDTO data = dataSyncRecordDisabilityService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody DataSyncRecordDisabilityDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + dataSyncRecordDisabilityService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody DataSyncRecordDisabilityDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + dataSyncRecordDisabilityService.update(dto); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + dataSyncRecordDisabilityService.delete(ids); + return new Result(); + } + + /** + * Desc: 导出 + * @param tokenDto + * @param formDTO + * @param response + * @author zxc + * @date 2022/10/13 16:17 + */ + @PostMapping("export") + public void export(@LoginUser TokenDto tokenDto, @RequestBody DataSyncRecordDisabilityFormDTO formDTO, HttpServletResponse response) throws IOException { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + dataSyncRecordDisabilityService.export(formDTO,response); + } + + /** + * Desc: 批量更新 + * @param ids + * @author zxc + * @date 2022/10/13 16:18 + */ + @PostMapping("batchUpdate") + public Result batchUpdate(@RequestBody String[] ids,@LoginUser TokenDto tokenDto){ + dataSyncRecordDisabilityService.batchUpdate(ids,tokenDto); + return new Result(); + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index c70bf78c83..701968bcf0 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/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 getIcResiUserInfo(@PathVariable("userId") String userId){ + return new Result().ok(icResiUserService.getIcResiUserInfo(userId)); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncConfigDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncConfigDao.java index d3a2c600ef..2963617263 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncConfigDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncConfigDao.java @@ -4,6 +4,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.DataSyncConfigDTO; import com.epmet.dto.DataSyncScopeDTO; import com.epmet.dto.form.ConfigSwitchFormDTO; +import com.epmet.dto.form.DataSyncTaskParam; import com.epmet.dto.result.NatUserInfoResultDTO; import com.epmet.entity.DataSyncConfigEntity; import org.apache.ibatis.annotations.Mapper; @@ -22,6 +23,7 @@ public interface DataSyncConfigDao extends BaseDao { /** * Desc: 【数据配置】配置开关 + * * @param formDTO * @author zxc * @date 2022/9/26 14:36 @@ -30,30 +32,32 @@ public interface DataSyncConfigDao extends BaseDao { /** * Desc: 【数据配置】列表 + * * @param customerId + * @param switchStatus * @author zxc * @date 2022/9/26 15:04 */ - List list(@Param("customerId")String customerId); + List list(@Param("customerId") String customerId, @Param("switchStatus") String switchStatus); - List scopeList(@Param("id")String id); + List scopeList(@Param("id") String id); /** * Desc: 删除范围 + * * @param dataSyncConfigId * @author zxc * @date 2022/9/26 15:46 */ - void delScope(@Param("dataSyncConfigId")String dataSyncConfigId); + void delScope(@Param("dataSyncConfigId") String dataSyncConfigId); /** * Desc: 根据范围查询居民证件号 - * @param list + * + * @param formDTO * @author zxc * @date 2022/9/27 09:23 */ - List getIdCardsByScope(@Param("list") List list); - - List getUserIdByIdCard(@Param("list") List list); + List getIdCardsByScope(DataSyncTaskParam formDTO); -} \ No newline at end of file +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncRecordDeathDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncRecordDeathDao.java new file mode 100644 index 0000000000..4633fa4ea5 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncRecordDeathDao.java @@ -0,0 +1,32 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.DataSyncRecordDeathDTO; +import com.epmet.entity.DataSyncRecordDeathEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 数据同步记录-居民死亡信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-10-11 + */ +@Mapper +public interface DataSyncRecordDeathDao extends BaseDao { + /** + * 列表查询 + * + * @param customerId + * @param idCard + * @param name + * @param agencyId + * @return + */ + List pageSelect(@Param("customerId") String customerId, + @Param("idCard") String idCard, + @Param("name") String name, + @Param("agencyId") String agencyId); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncRecordDisabilityDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncRecordDisabilityDao.java new file mode 100644 index 0000000000..d17f7e13cd --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncRecordDisabilityDao.java @@ -0,0 +1,39 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.DataSyncRecordDisabilityDTO; +import com.epmet.dto.form.dataSync.DataSyncRecordDisabilityFormDTO; +import com.epmet.entity.DataSyncRecordDisabilityEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 数据同步记录-居民残疾信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-10-11 + */ +@Mapper +public interface DataSyncRecordDisabilityDao extends BaseDao { + + //int upsertBatch(List list); + + List list(DataSyncRecordDisabilityFormDTO formDTO); + + /** + * Desc: 更新 icResiUser + * @param entities + * @author zxc + * @date 2022/10/14 13:43 + */ + void batchUpdateResiDisability(List entities); + + /** + * Desc: 批量更新残疾表 + * @param entities + * @author zxc + * @date 2022/10/14 13:44 + */ + void batchUpdateDisability(List entities); +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java index 3507473187..f21ec91eb3 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java @@ -49,7 +49,9 @@ public interface IcNatDao extends BaseDao { * @Author sun * @Description 按条件查询业务数据 **/ - IcNatDTO getNatDTO(@Param("customerId") String customerId, @Param("icNatId") String icNatId, @Param("idCard") String idCard, @Param("natTime") String natTime, @Param("natResult") String natResult); + IcNatDTO getNatDTO(@Param("customerId") String customerId, @Param("icNatId") String icNatId, + @Param("idCard") String idCard, @Param("natTime") String natTime, + @Param("natResult") String natResult, @Param("sampleTime") String sampleTime); /** * desc:根据客户id 更新是否居民状态 @@ -62,4 +64,6 @@ public interface IcNatDao extends BaseDao { List getExistNatInfo(@Param("list") List entities); + void updateBatchNat(@Param("list")List entities); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncRecordDeathEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncRecordDeathEntity.java new file mode 100644 index 0000000000..9525bd45a7 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncRecordDeathEntity.java @@ -0,0 +1,106 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 数据同步记录-居民死亡信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-10-11 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("data_sync_record_death") +public class DataSyncRecordDeathEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 组织Id + */ + private String agencyId; + + /** + * 组织的pids 含agencyId本身 + */ + private String pids; + + /** + * 网格ID + */ + private String gridId; + + /** + * 姓名 + */ + private String name; + + /** + * 身份证 + */ + private String idCard; + + /** + * 居民Id,ic_resi_user.id + */ + private String icResiUserId; + + /** + * 年龄(享年) + */ + private String age; + + /** + * 家庭住址 + */ + private String address; + + /** + * 死亡时间 + */ + private String deathDate; + + /** + * 火化时间 + */ + private String cremationTime; + + /** + * 民族 + */ + private String mz; + + /** + * 登记单位名称 + */ + private String organName; + + /** + * 国籍 + */ + private String nation; + + /** + * 第三方记录唯一标识 + */ + private String thirdRecordId; + + /** + * 处理状态(更新至居民信息) 0:未处理;1:处理成功;2处理失败 + */ + private Integer dealStatus; + + /** + * 处理结果 + */ + private String dealResult; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncRecordDisabilityEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncRecordDisabilityEntity.java new file mode 100644 index 0000000000..81f8fd7a06 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncRecordDisabilityEntity.java @@ -0,0 +1,147 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 数据同步记录-居民残疾信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-10-11 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("data_sync_record_disability") +public class DataSyncRecordDisabilityEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 组织Id + */ + private String agencyId; + + /** + * 组织的pids 含agencyId本身 + */ + private String pids; + + /** + * 网格ID + */ + private String gridId; + + /** + * 姓名 + */ + private String name; + + /** + * 身份证 + */ + private String idCard; + + /** + * 电话 + */ + private String mobile; + + /** + * 居民Id,ic_resi_user.id + */ + private String icResiUserId; + + /** + * 残疾证号 + */ + private String cardNum; + + /** + * 残疾等级(状况) + */ + private String cjzkCn; + + @TableField(exist = false) + private String cjzk; + + /** + * 残疾类别 + */ + private String cjlbCn; + + @TableField(exist = false) + private String cjlb; + + /** + * 文化程度 + */ + private String eduLevel; + + /** + * 婚姻状况 中文 + */ + private String maritalStatusName; + + /** + * 民族 中文 + */ + private String mzCn; + + /** + * 性别1男2女 + */ + private Integer gender; + + @TableField(exist = false) + private Integer genderCn; + + /** + * 户籍地址 + */ + private String residentAdd; + + /** + * 现居住地址 + */ + private String nowAdd; + + /** + * 监护人 + */ + private String guardian; + + /** + * 监护人联系方式 + */ + private String guardianPhone; + + /** + * 处理状态(更新至居民信息) 0:未处理;1:处理成功;2处理失败 + */ + private Integer dealStatus; + + /** + * 需要处理的残疾状态 0:非残疾;1:残疾 + */ + private Integer disabilityStatus; + + /** + * 处理结果 + */ + private String dealResult; + + /** + * 更新状态 + */ + @TableField(exist = false) + private Boolean updateStatus = false; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java index 50a9eed8e7..7cbe8cdd66 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java @@ -64,6 +64,11 @@ public class IcNatEntity extends BaseEpmetEntity { */ private Date natTime; + /** + * 采样时间 + */ + private Date sampleTime; + /** * 检测结果(0:阴性 1:阳性) */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java index d7849f5592..7611a80a9f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java @@ -17,6 +17,7 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; @@ -469,6 +470,13 @@ public class IcResiUserEntity extends BaseEpmetEntity { */ private String subStatus; + + /** + * 类别状态 是:1,否:0 + */ + @TableField(exist = false) + private String categoryStatus; + /** * 预留字段1 */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/enums/DataSyncEnum.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/enums/DataSyncEnum.java new file mode 100644 index 0000000000..a3a66c4efc --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/enums/DataSyncEnum.java @@ -0,0 +1,55 @@ +package com.epmet.enums; + +/** + * desc:数据同步配置枚举 对应data_sync_config中的DATA_CODE + * @author Administrator + */ + +public enum DataSyncEnum { + /** + * 环境变量枚举 + */ + HE_SUAN("hesuan", "核酸检测数据"), + CAN_JI("canji", "残疾数据"), + SI_WANG("siwang", "死亡数据"), + OTHER("qita","其他"), + + ; + + private final String code; + private final String name; + + + + DataSyncEnum(String code, String name) { + this.code = code; + this.name = name; + } + + public static DataSyncEnum getEnum(String code) { + DataSyncEnum[] values = DataSyncEnum.values(); + for (DataSyncEnum value : values) { + if (value.getCode().equals(code)) { + return value; + } + } + return DataSyncEnum.OTHER; + } + + + public String getCode() { + return code; + } + + public String getName() { + return name; + } + + public static void main(String[] args) { + Integer pageNo = 1; + + for (int i = 0; i < 5; i++) { + System.out.println(pageNo++); + } + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/DataSyncRecordDisabilityExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/DataSyncRecordDisabilityExcel.java new file mode 100644 index 0000000000..9b4d338451 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/DataSyncRecordDisabilityExcel.java @@ -0,0 +1,59 @@ +package com.epmet.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import lombok.Data; + +/** + * @Author zxc + * @DateTime 2022/10/13 15:29 + * @DESC + */ +@Data +public class DataSyncRecordDisabilityExcel { + + @ExcelProperty(value = "姓名") + @ColumnWidth(20) + private String name; + + @ExcelProperty(value = "证件号") + @ColumnWidth(20) + private String idCard; + + @ExcelProperty(value = "手机") + @ColumnWidth(20) + private String mobile; + + @ExcelProperty(value = "性别") + @ColumnWidth(20) + private Integer gender; + + @ExcelProperty(value = "民族") + @ColumnWidth(20) + private String mzCn; + + @ExcelProperty(value = "家庭住址") + @ColumnWidth(20) + private String address; + + @ExcelProperty(value = "残疾类别") + @ColumnWidth(20) + private String cjlbCn; + + @ExcelProperty(value = "残疾等级") + @ColumnWidth(20) + private String cjzkCn; + + @ExcelProperty(value = "监护人") + @ColumnWidth(20) + private String guardian; + + @ExcelProperty(value = "状态") + @ColumnWidth(20) + private String dealStatusName; + + @ExcelProperty(value = "失败原因") + @ColumnWidth(20) + private String dealResult; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatImportExcelData.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatImportExcelData.java index 052b0cb1eb..b54c571f8f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatImportExcelData.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatImportExcelData.java @@ -24,19 +24,22 @@ 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 = "检测时间为必填项") +// @NotNull(message = "检测时间为必填项") @ExcelProperty("检测时间") private Date natTime; + @ExcelProperty("采样时间") + private Date sampleTime; + @ExcelProperty("检测地点") private String natAddress; - @NotBlank(message = "检测结果为必填项") +// @NotBlank(message = "检测结果为必填项") @ExcelProperty("检测结果") private String natResultZh; diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatExcelImportListener.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatExcelImportListener.java index 1f09a5142f..c600349029 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatExcelImportListener.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatExcelImportListener.java @@ -2,6 +2,8 @@ package com.epmet.excel.handler; import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.read.listener.ReadListener; +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.ValidateException; import com.epmet.commons.tools.utils.ConvertUtils; @@ -66,6 +68,16 @@ public class IcNatExcelImportListener implements ReadListener */ void scopeSave(ScopeSaveFormDTO formDTO); - void natInfoScanTask(NatInfoScanTaskFormDTO formDTO); -} \ No newline at end of file + void dataSyncForYanTaiTask(DataSyncTaskParam formDTO); +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncRecordDeathService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncRecordDeathService.java new file mode 100644 index 0000000000..de5e8ef59f --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncRecordDeathService.java @@ -0,0 +1,70 @@ +package com.epmet.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.DataSyncRecordDeathDTO; +import com.epmet.dto.form.dataSync.DataSyncRecordDeathPageFormDTO; +import com.epmet.entity.DataSyncRecordDeathEntity; + +import java.util.List; +import java.util.Map; + +/** + * 数据同步记录-居民死亡信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-10-11 + */ +public interface DataSyncRecordDeathService extends BaseService { + + /** + * 默认分页 + * + * @param formDTO + * @return PageData + * @author generator + * @date 2022-10-11 + */ + PageData page(DataSyncRecordDeathPageFormDTO formDTO); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-10-11 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return DataSyncRecordDeathDTO + * @author generator + * @date 2022-10-11 + */ + DataSyncRecordDeathDTO get(String id); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-10-11 + */ + void delete(List ids); + + DataSyncRecordDeathDTO selectOne(LambdaQueryWrapper queryWrapper); + + /** + * + * @param userId 当前操作人 + * @param customerId 当前客户 + * @param ids 要操作的记录id + */ + void batchUpdate(String userId, String customerId, List ids); +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncRecordDisabilityService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncRecordDisabilityService.java new file mode 100644 index 0000000000..b49becbc7f --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncRecordDisabilityService.java @@ -0,0 +1,110 @@ +package com.epmet.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.dto.DataSyncRecordDisabilityDTO; +import com.epmet.dto.form.dataSync.DataSyncRecordDisabilityFormDTO; +import com.epmet.entity.DataSyncRecordDisabilityEntity; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * 数据同步记录-居民残疾信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-10-11 + */ +public interface DataSyncRecordDisabilityService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-10-11 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-10-11 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return DataSyncRecordDisabilityDTO + * @author generator + * @date 2022-10-11 + */ + DataSyncRecordDisabilityDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-10-11 + */ + void save(DataSyncRecordDisabilityDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-10-11 + */ + void update(DataSyncRecordDisabilityDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-10-11 + */ + void delete(String[] ids); + + DataSyncRecordDisabilityDTO selectOne(LambdaQueryWrapper queryWrapper); + + /** + * Desc: 列表 + * @param formDTO + * @author zxc + * @date 2022/10/13 16:17 + */ + PageData list(DataSyncRecordDisabilityFormDTO formDTO); + + /** + * Desc: 导出 + * @param formDTO + * @param response + * @author zxc + * @date 2022/10/13 16:17 + */ + void export(DataSyncRecordDisabilityFormDTO formDTO, HttpServletResponse response) throws IOException; + + /** + * Desc: 批量更新 + * @param ids + * @author zxc + * @date 2022/10/13 16:18 + */ + void batchUpdate(String[] ids, TokenDto tokenDto); +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNatService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNatService.java index ea75c911e4..430a66424a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNatService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNatService.java @@ -92,4 +92,6 @@ public interface IcNatService extends BaseService { * @return */ Integer updateIsResiFlag(String customerId, String icResiUserId); + + void updateBatchNat(List entities); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java index 87dcd4cba3..e3e0f75e1f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java +++ b/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 { * @Date 2022/9/8 15:45 */ void updateYlfn(); + + IcResiUserInfoCache getIcResiUserInfo(String userId); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeRecordService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeRecordService.java index 620c786e5f..2b9a7e688f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeRecordService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeRecordService.java @@ -22,6 +22,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.dto.form.IcResiUserChangeRecordFormDTO; import com.epmet.dto.form.IcUserChangeRecordInitFormDTO; import com.epmet.dto.form.IcUsercategoryAnalysisFormDTO; +import com.epmet.dto.form.dataSync.AddRecordByResidentCategoryFormDTO; import com.epmet.dto.result.IcUserChangeRecordResultDTO; import com.epmet.dto.result.IcUsercategoryAnalysisResultDTO; import com.epmet.entity.IcUserChangeRecordEntity; @@ -56,4 +57,12 @@ public interface IcUserChangeRecordService extends BaseService implements ChangeDeathService { @@ -106,6 +108,12 @@ public class ChangeDeathServiceImpl extends BaseServiceImpl params = new HashMap<>(4); params.put("idCard", dto.getIdCard()); if (!list(params).isEmpty()) { - return new Result().error("该人员已经迁入死亡人口"); + // return new Result().error("该人员已经迁入死亡人口"); + log.warn(String.format("该人员已经迁入死亡人口,idCard:%s",result.getIdCard())); + return new Result(); } - + // 插入死亡名单表 dto.setJoinDate(DateUtils.format(new Date())); ChangeDeathEntity entity = ConvertUtils.sourceToTarget(dto, ChangeDeathEntity.class); entity.setCustomerId(loginUserUtil.getLoginUserCustomerId()); insert(entity); + // 如果勾选了享受福利 if (dto.getWelfareFlag() != null && dto.getWelfareFlag()) { ChangeWelfareDTO formDto = new ChangeWelfareDTO(); formDto.setUserId(dto.getUserId()); @@ -148,6 +163,8 @@ public class ChangeDeathServiceImpl extends BaseServiceImpl implements DataSyncConfigService { @@ -61,15 +63,10 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); - - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); - - return wrapper; - } + @Autowired + private DataSyncRecordDeathService dataSyncRecordDeathService; + @Autowired + private DataSyncRecordDisabilityService dataSyncRecordDisabilityService; @Override public DataSyncConfigDTO get(String id) { @@ -100,6 +97,7 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl result = new PageData<>(new ArrayList<>(), NumConstant.ZERO_L); - PageInfo pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.list(tokenDto.getCustomerId())); - if (CollectionUtils.isNotEmpty(pageInfo.getList())){ + PageInfo pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()) + .doSelectPageInfo(() -> baseDao.list(tokenDto.getCustomerId(), null)); + if (CollectionUtils.isNotEmpty(pageInfo.getList())) { result.setList(pageInfo.getList()); - result.setTotal(Integer.valueOf(String.valueOf(pageInfo.getTotal()))); + result.setTotal(Integer.parseInt(String.valueOf(pageInfo.getTotal()))); } return result; } /** * Desc: 【数据配置】范围保存 + * * @param formDTO * @author zxc * @date 2022/9/26 15:41 @@ -137,21 +138,21 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl { o.setCustomerId(formDTO.getCustomerId()); o.setDataSyncConfigId(formDTO.getDataSyncConfigId()); - if (o.getOrgType().equals("grid")){ + if (o.getOrgType().equals("grid")) { GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(o.getOrgId()); - if (null == gridInfo){ - throw new EpmetException("查询网格信息失败"+o.getOrgId()); + if (null == gridInfo) { + throw new EpmetException("查询网格信息失败" + o.getOrgId()); } o.setPid(gridInfo.getPid()); o.setOrgIdPath(gridInfo.getPids() + ":" + gridInfo.getId()); - }else { + } else { AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(o.getOrgId()); - if (null == agencyInfo){ - throw new EpmetException("查询组织信息失败"+o.getOrgId()); + if (null == agencyInfo) { + throw new EpmetException("查询组织信息失败" + o.getOrgId()); } o.setPid(agencyInfo.getPid()); o.setOrgIdPath(agencyInfo.getPids().equals(NumConstant.EMPTY_STR) || agencyInfo.getPids().equals(NumConstant.ZERO_STR) ? agencyInfo.getId() : agencyInfo.getPids() + ":" + agencyInfo.getId()); @@ -166,69 +167,337 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl userIdByIdCard = baseDao.getUserIdByIdCard(formDTO.getIdCards()); + public void dataSyncForYanTaiTask(DataSyncTaskParam formDTO) { + List allConfigList = baseDao.list(formDTO.getCustomerId(), "open"); + if (CollectionUtils.isEmpty(allConfigList)) { + return; + } + + 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())){ + allConfigList.forEach(c -> { + if (c.getDataCode().equals(formDTO.getDataCode())){ + disAllData(c,formDTO); + return; + } + }); + }else { + for (DataSyncConfigDTO config : allConfigList) { + //没有配置 数据拉取范围 继续下次循环 + if (CollectionUtils.isEmpty(config.getScopeList())) { + continue; + } + disAllData(config,formDTO); + } + } + } + + private void disAllData(DataSyncConfigDTO config,DataSyncTaskParam formDTO){ + //没传具体参数 则 按照 + int pageNo = NumConstant.ONE; + int pageSize = NumConstant.ONE_THOUSAND; + + List dbResiList = null; + //设置查询数据范围 + formDTO.setOrgList(config.getScopeList()); + DataSyncEnum anEnum = DataSyncEnum.getEnum(config.getDataCode()); + + do { + switch (anEnum) { + case HE_SUAN: + //查询正常状态的居民 + log.info("======核酸检测信息拉取开始======"); + dbResiList = getNatUserInfoFromDb(formDTO, pageNo, pageSize); + if (CollectionUtils.isEmpty(dbResiList)) { + break; + } + hsjc(dbResiList, config.getCustomerId(), formDTO.getIsSync()); + log.info("======核酸检测信息拉取结束======"); + break; + case CAN_JI: + //查询正常状态的居民 并回显 残疾状态 + formDTO.setCategoryColumn("IS_CJ"); + dbResiList = getNatUserInfoFromDb(formDTO, pageNo, pageSize); + canJi(dbResiList); + break; + case SI_WANG: + //查询正常状态的居民 + dbResiList = getNatUserInfoFromDb(formDTO, pageNo, pageSize); + siWang(dbResiList); + break; + default: + log.warn("没有要处理的数据"); + } + pageNo++; + } while (dbResiList != null && dbResiList.size() == pageSize); + } + + private void siWang(List dbResiList) { + try { + List list = new ArrayList<>(); + for (NatUserInfoResultDTO dbResi : dbResiList) { + YtDataSyncResDTO thirdResult = YtHsResUtils.siWang(dbResi.getIdCard(), dbResi.getName()); + if (200 != thirdResult.getCode()) { + log.warn("canJi 调用蓝图接口失败了 继续处理下一个人"); + continue; + } + + String thirdResultData = thirdResult.getData(); + JSONObject thirdResultObject = JSON.parseObject(thirdResultData); + + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(DataSyncRecordDeathEntity::getIdCard, dbResi.getIdCard()); + //获取数据库里的记录 + DataSyncRecordDeathDTO dbDeathEntity = dataSyncRecordDeathService.selectOne(queryWrapper); + + JudgeDealStatus judgeDealStatus = new JudgeDealStatus(thirdResultObject, dbDeathEntity).invokeDeath(); + if (judgeDealStatus.isStop()) { + continue; + } + + DataSyncRecordDeathEntity entity = new DataSyncRecordDeathEntity(); + if (dbDeathEntity != null && StringUtils.isNotBlank(dbDeathEntity.getId())) { + entity.setId(dbDeathEntity.getId()); + } + entity.setCustomerId(dbResi.getCustomerId()); + entity.setAgencyId(dbResi.getAgencyId()); + entity.setPids(dbResi.getPids()); + entity.setGridId(dbResi.getGridId()); + entity.setName(dbResi.getName()); + entity.setIdCard(dbResi.getIdCard()); + entity.setIcResiUserId(dbResi.getUserId()); + //死亡未获取到数据 + if (thirdResultObject != null) { + entity.setAge(thirdResultObject.getString("AGE")); + entity.setAddress(thirdResultObject.getString("FAMILY_ADD")); + entity.setDeathDate(thirdResultObject.getString("DEATH_DATE")); + entity.setCremationTime(thirdResultObject.getString("CREMATION_TIME")); + entity.setMz(thirdResultObject.getString("FAMILY_ADD")); + entity.setOrganName(thirdResultObject.getString("CREATE_ORGAN_NAME")); + entity.setNation(thirdResultObject.getString("NATION")); + entity.setThirdRecordId(thirdResultObject.getString("RECORD_ID")); + } + + entity.setDealStatus(NumConstant.ZERO); + entity.setDealResult(StrConstant.EPMETY_STR); + if (judgeDealStatus.isNeedSetStatus) { + entity.setDealResult(judgeDealStatus.dealResult); + entity.setDealStatus(judgeDealStatus.dealStatus); + } + entity.setUpdatedTime(new Date()); + list.add(entity); + } + if (list.size() == NumConstant.ZERO) { + return; + } + dataSyncRecordDeathService.saveOrUpdateBatch(list, NumConstant.TWO_HUNDRED); + } catch (Exception e) { + log.error("siwang exception", e); + } + } + + /** + * desc:从数据库获取居民信息 + * + * @param formDTO + * @param anEnum + * @param pageNo + * @param pageSize + * @return + */ + private List getNatUserInfoFromDb(DataSyncTaskParam formDTO, int pageNo, int pageSize) { + //根据 组织 分页获取 居民数据 + PageInfo pageInfo = PageHelper.startPage(pageNo, pageSize, false) + .doSelectPageInfo(() -> baseDao.getIdCardsByScope(formDTO)); + List dbResiList; + dbResiList = pageInfo.getList(); + /* //如果传了身份证号 则按照身份证号查询 并同步记录, userId如果为空则是 手动录入的 此人没有录入居民库 但是也可以同步 + if (CollectionUtils.isNotEmpty(formDTO.getIdCards()) && DataSyncEnum.HE_SUAN.getCode().equals(anEnum.getCode())) { List collect = formDTO.getIdCards().stream().map(id -> { NatUserInfoResultDTO e = new NatUserInfoResultDTO(); e.setIdCard(id); e.setUserId(""); return e; }).collect(Collectors.toList()); - collect.forEach(c -> userIdByIdCard.stream().filter(u -> u.getIdCard().equals(c.getIdCard())).forEach(u -> c.setUserId(u.getUserId()))); - hsjc(collect,formDTO.getCustomerId()); - return; - } - List allConfigList = baseDao.list(StringUtils.isNotBlank(formDTO.getCustomerId()) ? formDTO.getCustomerId() : null); - if (CollectionUtils.isEmpty(allConfigList)){ - return; - } - List configList = allConfigList.stream().filter(l -> l.getDeptCode().equals("dsjj") && l.getSwitchStatus().equals("open")).collect(Collectors.toList()); - if (CollectionUtils.isNotEmpty(configList)){ - configList.forEach(c -> { - if (CollectionUtils.isNotEmpty(c.getScopeList())){ - Integer no = NumConstant.ONE; - Integer size; - do { - PageInfo pageInfo = PageHelper.startPage(no, NumConstant.ONE_THOUSAND).doSelectPageInfo(() -> baseDao.getIdCardsByScope(c.getScopeList())); - size = pageInfo.getList().size(); - hsjc(pageInfo.getList(),c.getCustomerId()); - no++; - }while (size.compareTo(NumConstant.ONE_THOUSAND) == NumConstant.ZERO); + + for (NatUserInfoResultDTO c : collect) { + dbResiList.stream().filter(u -> u.getIdCard().equals(c.getIdCard())).forEach(u -> c.setUserId(u.getUserId())); + } + dbResiList = collect; + }*/ + return dbResiList; + } + + private void canJi(List resiList) { + try { + List list = new ArrayList<>(); + for (NatUserInfoResultDTO dbResi : resiList) { + YtDataSyncResDTO thirdResult = YtHsResUtils.canji(dbResi.getIdCard(), dbResi.getName()); + if (200 != thirdResult.getCode()) { + log.warn("canJi 调用蓝图接口失败了 继续处理下一个人"); + continue; } - }); + String thirdResultData = thirdResult.getData(); + JSONObject thirdResultObject = JSON.parseObject(thirdResultData); + + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(DataSyncRecordDisabilityEntity::getIdCard, dbResi.getIdCard()); + //获取数据库里的记录 + DataSyncRecordDisabilityDTO dbDisablityEntity = dataSyncRecordDisabilityService.selectOne(queryWrapper); + + + DataSyncRecordDisabilityEntity entity = new DataSyncRecordDisabilityEntity(); + if (dbDisablityEntity != null && StringUtils.isNotBlank(dbDisablityEntity.getId())) { + entity.setId(dbDisablityEntity.getId()); + } + //居民库里 是否是残疾 + String categoryColumn = dbResi.getCategoryColumn(); + + + JudgeDealStatus judgeDealStatus = null; + int disabilityStatus = 0; + //居民是残疾 + if (NumConstant.ONE_STR.equals(categoryColumn)) { + // 第三方返回了该人的 残疾记录 说明和居民库的状态一致 只需要处理 同步记录中的数据即可 + if (thirdResultObject != null) { + //todo 联调时看一下 为什么db == null 总是true + judgeDealStatus = new JudgeDealStatus(dbDisablityEntity).invoke(); + if (judgeDealStatus.isStop()) { + continue; + } + disabilityStatus = 1; + } else { + //没有返回该人是残疾的数据 说明需要处理居民库的数据 + judgeDealStatus = new JudgeDealStatus(dbDisablityEntity).notSame(); + disabilityStatus = 0; + } + } else { + //居民不是残疾 + + // 第三方没有返回了该人的 残疾记录 说明和居民库的状态一致 只需要处理 同步记录中的数据即可 + if (thirdResultObject == null) { + //todo 联调时看一下 为什么db == null 总是true + judgeDealStatus = new JudgeDealStatus(dbDisablityEntity).invoke(); + if (judgeDealStatus.isStop()) { + continue; + } + disabilityStatus = 0; + } else { + //蓝图返回该人是残疾的数据 说明需要处理居民库的数据 + judgeDealStatus = new JudgeDealStatus(dbDisablityEntity).notSame(); + disabilityStatus = 1; + } + } + + entity.setCustomerId(dbResi.getCustomerId()); + entity.setAgencyId(dbResi.getAgencyId()); + entity.setPids(dbResi.getPids()); + entity.setGridId(dbResi.getGridId()); + entity.setName(dbResi.getName()); + entity.setIdCard(dbResi.getIdCard()); + entity.setIcResiUserId(dbResi.getUserId()); + if (thirdResultObject != null){ + entity.setMobile(thirdResultObject.getString("phoneNo")); + entity.setCardNum(thirdResultObject.getString("cardNum")); + entity.setCjzkCn(thirdResultObject.getString("idtLevelName")); + entity.setCjlbCn(thirdResultObject.getString("idtKindName")); + entity.setEduLevel(thirdResultObject.getString("eduLevelName")); + entity.setMaritalStatusName(thirdResultObject.getString("marriagerName")); + entity.setGuardian(thirdResultObject.getString("guardian")); + entity.setGuardianPhone(thirdResultObject.getString("guardianPhone")); + entity.setMzCn(thirdResultObject.getString("raceName")); + String genderName = thirdResultObject.getString("genderName"); + if (GenderEnum.MAN.getName().equals(genderName)){ + entity.setGender(NumConstant.ONE); + }else { + entity.setGender(NumConstant.TWO); + } + entity.setResidentAdd(thirdResultObject.getString("residentAdd")); + entity.setNowAdd(thirdResultObject.getString("nowAdd")); + } + + entity.setDealStatus(NumConstant.ZERO); + entity.setDisabilityStatus(disabilityStatus); + entity.setDealResult(StrConstant.EPMETY_STR); + if (judgeDealStatus.isNeedSetStatus) { + entity.setDealResult(judgeDealStatus.getDealResult()); + entity.setDealStatus(judgeDealStatus.getDealStatus()); + } + entity.setUpdatedTime(new Date()); + list.add(entity); + } + dataSyncRecordDisabilityService.saveOrUpdateBatch(list, NumConstant.TWO_HUNDRED); + } catch (Exception e) { + log.error("canJi exception", e); } } + /** * Desc: 根据证件号 查询nat 存在 ? 不处理 : 新增 + * * @param idCards * @param customerId + * @param isSync 是否同步,1是人工点同步;0否 * @author zxc * @date 2022/9/27 11:08 */ - private void hsjc(List idCards,String customerId){ - if (CollectionUtils.isNotEmpty(idCards)){ - List entities = new ArrayList<>(); + public void hsjc(List idCards, String customerId, String isSync) { + try { idCards.forEach(idCard -> { + YtHscyResDTO sampleResult = YtHsResUtils.hscy(idCard.getIdCard(), NumConstant.ONE, NumConstant.ONE); + if (CollectionUtils.isNotEmpty(sampleResult.getData())){ + List 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(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 existSampleInfo = icNatDao.getExistNatInfo(entities); + sampleAndNat(existSampleInfo,entities,NumConstant.ONE_STR,customerId,isSync); + } + } YtHsjcResDTO natInfoResult = YtHsResUtils.hsjc(idCard.getIdCard(), NumConstant.ONE, NumConstant.ONE); - if (CollectionUtils.isNotEmpty(natInfoResult.getData())){ + if (CollectionUtils.isNotEmpty(natInfoResult.getData())) { + List 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("sync"); + 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.setNatResult(natInfo.getSample_result_pcr()); + 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.setAgencyId(idCard.getAgencyId()); e.setPids(idCard.getPids()); @@ -236,37 +505,178 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl 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> groupByStatus = entities.stream().collect(Collectors.groupingBy(IcNatEntity::getExistStatus)); - if (CollectionUtils.isNotEmpty(groupByStatus.get(false))){ - for (List icNatEntities : ListUtils.partition(groupByStatus.get(false), 500)) { - icNatService.insertBatch(icNatEntities); + if (CollectionUtils.isNotEmpty(entities)) { + List existNatInfos = icNatDao.getExistNatInfo(entities); + sampleAndNat(existNatInfos,entities,NumConstant.TWO_STR,customerId,isSync); } } - //组织关系表 + }); + } catch (Exception e) { + log.error("hsjc exception", e); + } + + } + + /** + * 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 existInfo, List 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))); + Map> groupByStatus = entities.stream().collect(Collectors.groupingBy(IcNatEntity::getExistStatus)); + if (CollectionUtils.isNotEmpty(groupByStatus.get(false))) { + for (List icNatEntities : ListUtils.partition(groupByStatus.get(false), NumConstant.FIVE_HUNDRED)) { + // 主表新增 + icNatService.insertBatch(icNatEntities); + // 组织关系表 List relationEntities = new ArrayList<>(); - entities.forEach(ne -> { - // 不是居民的先不加关系表吧 - if (ne.getIsResiUser().equals(NumConstant.ONE_STR)){ + 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"); + e.setUserType(isSync.equals(NumConstant.ONE_STR) ? "manualSync" : "sync"); relationEntities.add(e); } }); - if (CollectionUtils.isNotEmpty(relationEntities)){ - for (List icNatRelationEntities : ListUtils.partition(relationEntities, 500)) { - icNatRelationService.insertBatch(icNatRelationEntities); + if (CollectionUtils.isNotEmpty(relationEntities)) { + icNatRelationService.insertBatch(relationEntities); + } + } + } + if (NumConstant.TWO_STR.equals(type)){ + if (CollectionUtils.isNotEmpty(groupByStatus.get(true))){ + for (List icNatEntities : ListUtils.partition(groupByStatus.get(true), NumConstant.ONE_HUNDRED)) { + icNatService.updateBatchNat(icNatEntities); + } + } + } + } + + private class JudgeDealStatus { + private boolean isNext; + private DataSyncRecordDisabilityDTO dbDisablityEntity; + private DataSyncRecordDeathDTO dbDeathEntity; + private Integer dealStatus; + private String dealResult; + private boolean isNeedSetStatus; + + /** + * http请求返回的结果 + */ + private JSONObject thirdResultObject; + + public JudgeDealStatus(DataSyncRecordDisabilityDTO dbDisablityEntity) { + this.dbDisablityEntity = dbDisablityEntity; + } + + public JudgeDealStatus(JSONObject thirdResultObject, DataSyncRecordDeathDTO dbDeathEntity) { + this.thirdResultObject = thirdResultObject; + this.dbDeathEntity = dbDeathEntity; + } + + boolean isStop() { + return isNext; + } + + public Integer getDealStatus() { + return dealStatus; + } + + public String getDealResult() { + return dealResult; + } + + public boolean isNeedSetStatus() { + return isNeedSetStatus; + } + + public JudgeDealStatus invoke() { + //对比记录里 也没有信息 则不用处理 + if (dbDisablityEntity == null || StringUtils.isBlank(dbDisablityEntity.getId())) { + isNext = true; + return this; + } else { + //对比记录里 有数据 且是已处理状态 则继续下一个居民 + if (dbDisablityEntity.getDealStatus().equals(NumConstant.ONE)) { + isNext = true; + return this; + } else { + //如果是其他处理状态 则改为已处理即可 + dealStatus = 1; + dealResult = "系统比对数据一致,自动处理"; + isNeedSetStatus = true; + } + } + isNext = false; + return this; + } + + /** + * desc:蓝图返回该人是残疾的数据 说明需要处理居民库的数据 + * + * @return + */ + public JudgeDealStatus notSame() { + + if (dbDisablityEntity != null && StringUtils.isNotBlank(dbDisablityEntity.getId()) + && dbDisablityEntity.getDealStatus().equals(NumConstant.ONE)) { + dealStatus = 0; + dealResult = ""; + isNeedSetStatus = true; + } + isNext = false; + return this; + } + + public JudgeDealStatus invokeDeath() { + //获取到了死亡记录 同步记录不存在 或者存在且状态不为为已处理 则返回true 继续下一个数据 + if (thirdResultObject != null) { + if (dbDeathEntity != null && StringUtils.isNotBlank(dbDeathEntity.getId())) { + Integer dealStatusDb = dbDeathEntity.getDealStatus(); + //数据库中的状态如果是已处理 改为未处理 + if (dealStatusDb.equals(NumConstant.ONE)) { + dealStatus = 0; + dealResult = ""; + isNeedSetStatus = true; + } else { + isNext = true; + return this; + } + } + } else { + //没有获取到 死亡记录 + if (dbDeathEntity != null && StringUtils.isNotBlank(dbDeathEntity.getId())) { + Integer dealStatusDb = dbDeathEntity.getDealStatus(); + //数据库中的状态如果是未处理 或处理失败 则继续下一条 + if (dealStatusDb.equals(NumConstant.ONE)) { + isNext = true; + return this; + } else { + dealStatus = 1; + dealResult = "系统比对数据一致,自动处理"; + isNeedSetStatus = true; } } } + isNext = false; + return this; } } -} \ No newline at end of file +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncRecordDeathServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncRecordDeathServiceImpl.java new file mode 100644 index 0000000000..e83e251478 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncRecordDeathServiceImpl.java @@ -0,0 +1,159 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +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.constant.StrConstant; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +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.GridInfoCache; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.SpringContextUtils; +import com.epmet.dao.DataSyncRecordDeathDao; +import com.epmet.dto.ChangeDeathDTO; +import com.epmet.dto.DataSyncRecordDeathDTO; +import com.epmet.dto.form.dataSync.DataSyncRecordDeathPageFormDTO; +import com.epmet.entity.DataSyncRecordDeathEntity; +import com.epmet.service.DataSyncRecordDeathService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; + +/** + * 数据同步记录-居民死亡信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-10-11 + */ +@Service +public class DataSyncRecordDeathServiceImpl extends BaseServiceImpl implements DataSyncRecordDeathService { + + /** + * 列表查询 + * @param formDTO + * @return + */ + @Override + public PageData page(DataSyncRecordDeathPageFormDTO formDTO) { + CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); + formDTO.setAgencyId(null != staffInfoCacheResult ? staffInfoCacheResult.getAgencyId() : null); + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(),formDTO.getIsPage()); + List records = baseDao.pageSelect(formDTO.getCustomerId(),formDTO.getIdCard(), formDTO.getName(), formDTO.getAgencyId()); + records.forEach(r->{ + GridInfoCache gridInfoCache = CustomerOrgRedis.getGridInfo(r.getGridId()); + r.setGridName(null != gridInfoCache ? gridInfoCache.getGridNamePath() : StrConstant.EPMETY_STR); + }); + PageInfo pi = new PageInfo<>(records); + return new PageData<>(records, pi.getTotal()); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, DataSyncRecordDeathDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + /** + * 返回详情:带网格名称 + * + * @param id + * @return + */ + @Override + public DataSyncRecordDeathDTO get(String id) { + DataSyncRecordDeathEntity entity = baseDao.selectById(id); + DataSyncRecordDeathDTO recordDeathDTO = ConvertUtils.sourceToTarget(entity, DataSyncRecordDeathDTO.class); + if (StringUtils.isNotBlank(recordDeathDTO.getGridId())) { + GridInfoCache gridInfoCache = CustomerOrgRedis.getGridInfo(entity.getGridId()); + recordDeathDTO.setGridName(null != gridInfoCache ? gridInfoCache.getGridNamePath() : StrConstant.EPMETY_STR); + } + return recordDeathDTO; + } + + /** + * 批量删除 + * @param ids + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(List ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(ids); + } + + @Override + public DataSyncRecordDeathDTO selectOne(LambdaQueryWrapper queryWrapper) { + DataSyncRecordDeathEntity entity = baseDao.selectOne(queryWrapper); + return ConvertUtils.sourceToTarget(entity, DataSyncRecordDeathDTO.class); + } + + /** + * @param userId 当前操作人 + * @param customerId 当前客户 + * @param ids 要操作的记录id + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void batchUpdate(String userId, String customerId, List ids) { + // 要做的事:居民表修改状态为注销、子状态为死亡、加入死亡人员名单、记录变更主表、变更明细表(如果当前死亡的这个人属于十八类中的是,-1操作) + // 上面要做的事,其实就是新增死亡人员名单,调整下ChangeDeathServiceImpl.save,直接调用吧, + for (String id : ids) { + DataSyncRecordDeathEntity entity = baseDao.selectById(id); + if (NumConstant.ONE == entity.getDealStatus() || StringUtils.isBlank(entity.getIcResiUserId())) { + // 已处理的跳过 + continue; + } + try { + ChangeDeathDTO changeDeathDTO = new ChangeDeathDTO(); + changeDeathDTO.setStaffId(userId); + changeDeathDTO.setUserId(entity.getIcResiUserId()); + changeDeathDTO.setGridId(entity.getGridId()); + changeDeathDTO.setName(entity.getName()); + changeDeathDTO.setIdCard(entity.getIdCard()); + // 手机号没有值 + changeDeathDTO.setMobile(StrConstant.EPMETY_STR); + changeDeathDTO.setDeathDate(DateUtils.stringToDate(entity.getDeathDate(), "yyyy-MM-dd")); + changeDeathDTO.setJoinReason("来源于数据比对-死亡人员数据"); + SpringContextUtils.getBean(ChangeDeathServiceImpl.class).save(changeDeathDTO); + entity.setDealStatus(NumConstant.ONE); + } catch (EpmetException epmetException) { + + entity.setDealStatus(NumConstant.TWO); + entity.setDealResult("系统内部异常:" + epmetException.getMsg()); + + epmetException.printStackTrace(); + } catch (Exception e) { + + entity.setDealStatus(NumConstant.TWO); + entity.setDealResult("未知错误"); + + e.printStackTrace(); + } finally { + baseDao.updateById(entity); + } + } + } + + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncRecordDisabilityServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncRecordDisabilityServiceImpl.java new file mode 100644 index 0000000000..3b564f19e7 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncRecordDisabilityServiceImpl.java @@ -0,0 +1,301 @@ +package com.epmet.service.impl; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.write.metadata.WriteSheet; +import com.alibaba.fastjson.JSON; +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.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.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +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.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; +import com.epmet.constant.IcResiUserConstant; +import com.epmet.dao.DataSyncRecordDisabilityDao; +import com.epmet.dto.DataSyncRecordDisabilityDTO; +import com.epmet.dto.IcResiUserDTO; +import com.epmet.dto.form.IcFormOptionsQueryFormDTO; +import com.epmet.dto.form.dataSync.AddRecordByResidentCategoryFormDTO; +import com.epmet.dto.form.dataSync.CategoryStatusAndIdDTO; +import com.epmet.dto.form.dataSync.DataSyncRecordDisabilityFormDTO; +import com.epmet.dto.form.dataSync.ResiInfoDTO; +import com.epmet.entity.DataSyncRecordDisabilityEntity; +import com.epmet.excel.DataSyncRecordDisabilityExcel; +import com.epmet.feign.OperCustomizeOpenFeignClient; +import com.epmet.service.DataSyncRecordDisabilityService; +import com.epmet.service.IcResiUserService; +import com.epmet.service.IcUserChangeRecordService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +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 javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 数据同步记录-居民残疾信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-10-11 + */ +@Service +@Slf4j +public class DataSyncRecordDisabilityServiceImpl extends BaseServiceImpl implements DataSyncRecordDisabilityService { + + @Autowired + private IcResiUserService icResiUserService; + @Autowired + private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient; + @Autowired + private IcUserChangeRecordService icUserChangeRecordService; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, DataSyncRecordDisabilityDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, DataSyncRecordDisabilityDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public DataSyncRecordDisabilityDTO get(String id) { + DataSyncRecordDisabilityEntity entity = baseDao.selectById(id); + DataSyncRecordDisabilityDTO result = ConvertUtils.sourceToTarget(entity, DataSyncRecordDisabilityDTO.class); + 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) ? "男" : "女"); + resiInfoDTO.setCjzkCn(getCj(resiInfoDTO.getCjzk())); + resiInfoDTO.setCjlbCn(getCjlb(resiInfoDTO.getCjlb(),entity.getCustomerId())); + result.setResiInfo(resiInfoDTO); + return result; + } + + public String getCj(String cj){ + String result = ""; + switch (cj){ + case NumConstant.ONE_STR: + result = "一级"; + break; + case NumConstant.TWO_STR: + result = "二级"; + break; + case NumConstant.THREE_STR: + result = "三级"; + break; + case NumConstant.FOUR_STR: + result = "四级"; + break; + default: + break; + } + return result; + } + + public String getCjlb(String cjlb,String customerId){ + IcFormOptionsQueryFormDTO formDTO = new IcFormOptionsQueryFormDTO(); + formDTO.setCustomerId(customerId); + formDTO.setFormCode("resi_base_info"); + formDTO.setColumnName("CJLB"); + Result> cjlbOptionsMap = operCustomizeOpenFeignClient.getOptionsMap(formDTO); + if (!cjlbOptionsMap.success()){ + throw new EpmetException("operCustomizeOpenFeignClient.getOptionsMap执行失败"); + } + Map data = cjlbOptionsMap.getData(); + return data.get(cjlb); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(DataSyncRecordDisabilityDTO dto) { + DataSyncRecordDisabilityEntity entity = ConvertUtils.sourceToTarget(dto, DataSyncRecordDisabilityEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(DataSyncRecordDisabilityDTO dto) { + DataSyncRecordDisabilityEntity entity = ConvertUtils.sourceToTarget(dto, DataSyncRecordDisabilityEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public DataSyncRecordDisabilityDTO selectOne(LambdaQueryWrapper queryWrapper) { + DataSyncRecordDisabilityEntity entity = baseDao.selectOne(queryWrapper); + return ConvertUtils.sourceToTarget(entity, DataSyncRecordDisabilityDTO.class); + } + + @Override + public PageData list(DataSyncRecordDisabilityFormDTO formDTO) { + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); + if (null == staffInfo){ + throw new EpmetException("查询工作人员失败:"+formDTO.getUserId()); + } + formDTO.setAgencyId(staffInfo.getAgencyId()); + PageData result = new PageData<>(new ArrayList<>(), NumConstant.ZERO_L); + if (formDTO.getIsPage()){ + PageInfo pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.list(formDTO)); + result.setList(pageInfo.getList()); + result.setTotal(Integer.valueOf(String.valueOf(pageInfo.getTotal()))); + }else { + List list = baseDao.list(formDTO); + result.setList(list); + result.setTotal(list.size()); + } + return result; + } + + @Override + public void export(DataSyncRecordDisabilityFormDTO formDTO, HttpServletResponse response) throws IOException { + ExcelWriter excelWriter = null; + formDTO.setPageNo(NumConstant.ONE); + formDTO.setPageSize(NumConstant.TEN_THOUSAND); + try { + String fileName = "残疾" + DateUtils.format(new Date()) + ".xlsx"; + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), DataSyncRecordDisabilityExcel.class).build(); + WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); + List list = null; + do { + PageData data = list(formDTO); + list = ConvertUtils.sourceToTarget(data.getList(), DataSyncRecordDisabilityExcel.class); + formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); + excelWriter.write(list, writeSheet); + } while (CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize()); + } catch (EpmetException e) { + response.reset(); + response.setCharacterEncoding("UTF-8"); + response.setHeader("content-type", "application/json; charset=UTF-8"); + PrintWriter printWriter = response.getWriter(); + Result result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),e.getMsg()); + printWriter.write(JSON.toJSONString(result)); + printWriter.close(); + } catch (Exception e) { + log.error("export exception", e); + } finally { + if (excelWriter != null) { + excelWriter.finish(); + } + } + } + + /** + * Desc: 批量更新 + * 更新 ic_resi_user的是否残疾,cjlb,cjzk,cjzh + * 添加 变更记录 + * 回填残疾表状态 + * @param ids + * @author zxc + * @date 2022/10/13 16:18 + */ + @Override + public void batchUpdate(String[] ids, TokenDto tokenDto) { + if (null == ids || ids.length == NumConstant.ZERO){ + return; + } + String customerId = tokenDto.getCustomerId(); + String userId = tokenDto.getUserId(); + List all = Arrays.asList(ids); + List entities = baseDao.selectBatchIds(all); + IcFormOptionsQueryFormDTO formDTO = new IcFormOptionsQueryFormDTO(); + formDTO.setCustomerId(customerId); + formDTO.setFormCode("resi_base_info"); + formDTO.setColumnName("CJZK"); + Result> cjzkOptionsMap = operCustomizeOpenFeignClient.getOptionsMap(formDTO); + if (!cjzkOptionsMap.success()){ + throw new EpmetException("operCustomizeOpenFeignClient.getOptionsMap执行失败"); + } + formDTO.setColumnName("CJLB"); + Result> cjlbOptionsMap = operCustomizeOpenFeignClient.getOptionsMap(formDTO); + if (!cjlbOptionsMap.success()){ + throw new EpmetException("operCustomizeOpenFeignClient.getOptionsMap执行失败"); + } + Map cjlbMap = cjlbOptionsMap.getData(); + Map cjzkMap = cjzkOptionsMap.getData(); + entities.forEach(e -> { + cjlbMap.forEach((k,v) ->{ + if (e.getCjlbCn().equals(v)){ + e.setCjlb(k); + } + }); + cjzkMap.forEach((k,v) -> { + if (e.getCjzkCn().equals(v)){ + e.setCjzk(k); + } + }); + }); + entities.stream().filter(e -> StringUtils.isBlank(e.getCjzk()) || StringUtils.isBlank(e.getCjlb())).forEach(e -> e.setUpdateStatus(true)); + // 变更记录 + List collect = entities.stream().map(m -> { + CategoryStatusAndIdDTO dto = new CategoryStatusAndIdDTO(); + dto.setCategoryStatus(m.getDisabilityStatus().toString()); + dto.setIcResiUserId(m.getIcResiUserId()); + return dto; + }).collect(Collectors.toList()); + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId); + if (null == staffInfo){ + throw new EpmetException("查询工作人员信息失败:"+userId); + } + AddRecordByResidentCategoryFormDTO addRecordByResidentCategoryFormDTO = new AddRecordByResidentCategoryFormDTO(); + addRecordByResidentCategoryFormDTO.setIcResiUserIds(collect); + addRecordByResidentCategoryFormDTO.setColumnName(IcResiUserConstant.IS_CJ); + addRecordByResidentCategoryFormDTO.setLabel(IcResiUserConstant.IS_CJ_CN); + addRecordByResidentCategoryFormDTO.setUserId(userId); + addRecordByResidentCategoryFormDTO.setUserName(staffInfo.getRealName()); + addRecordByResidentCategoryFormDTO.setCustomerId(customerId); + disposeDisabilitybatchUpdate(entities,addRecordByResidentCategoryFormDTO); + } + + @Transactional(rollbackFor = Exception.class) + public void disposeDisabilitybatchUpdate(List entities,AddRecordByResidentCategoryFormDTO addRecordByResidentCategoryFormDTO){ + // 新增变更记录 + icUserChangeRecordService.addRecordByResidentCategory(addRecordByResidentCategoryFormDTO); + // 更新 ic_resi_user + baseDao.batchUpdateResiDisability(entities); + // 回填 主表 + baseDao.batchUpdateDisability(entities); + } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java index 40d9818db8..fcc03adf39 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java @@ -88,6 +88,23 @@ public class IcNatServiceImpl extends BaseServiceImpl imp //@Autowired //private UserService userService; + public void disposeIsNull(AddIcNatFormDTO formDTO){ + /** + * 根据产品要求 不同情况提示不同错误 + * 1.采样时间为空,检测时间和结果有一个为空就报错 + * 2.采样时间不为空,检测时间和结果可以为空【如果不为空 检测时间和结果都不为空】 + */ + if ((null == formDTO.getSampleTime() && (null == formDTO.getNatTime() || org.apache.commons.lang3.StringUtils.isBlank(formDTO.getNatResult())))){ + throw new EpmetException(EpmetErrorCode.SAMPLE_TIME_AND_RESULT_IS_NULL_ERROR.getCode()); + } + if(null != formDTO.getSampleTime() && org.apache.commons.lang3.StringUtils.isNotBlank(formDTO.getNatResult()) && null == formDTO.getNatTime()){ + throw new EpmetException(EpmetErrorCode.NAT_TIME_IS_NULL_ERROR.getCode()); + } + if (null != formDTO.getSampleTime() && org.apache.commons.lang3.StringUtils.isBlank(formDTO.getNatResult()) && null != formDTO.getNatTime()){ + throw new EpmetException(EpmetErrorCode.NAT_RESULT_IS_NULL_ERROR.getCode()); + } + } + /** * @Author sun * @Description 核酸检测-上报核酸记录 @@ -95,8 +112,9 @@ public class IcNatServiceImpl extends BaseServiceImpl imp @Override @Transactional(rollbackFor = Exception.class) public void add(AddIcNatFormDTO formDTO) { + disposeIsNull(formDTO); //0.先根据身份证号和检查时间以及检测结果校验数据是否存在 - IcNatDTO icNatDTO = baseDao.getNatDTO(formDTO.getCustomerId(), null, formDTO.getIdCard(), DateUtils.format(formDTO.getNatTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE), null); + IcNatDTO icNatDTO = baseDao.getNatDTO(formDTO.getCustomerId(), null, formDTO.getIdCard(), null != formDTO.getNatTime() ? DateUtils.format(formDTO.getNatTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE) : null, null, null != formDTO.getSampleTime() ? DateUtils.format(formDTO.getSampleTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE) : null); //按身份证号核酸时间存在记录的 核酸结果相同的提示已存在相同记录核酸结果不同的提示已存在去修改【业务要求的】 if (null != icNatDTO && icNatDTO.getNatResult().equals(formDTO.getNatResult())) { throw new RenException(EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getCode(), EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getMsg()); @@ -216,8 +234,9 @@ public class IcNatServiceImpl extends BaseServiceImpl imp @Override @Transactional(rollbackFor = Exception.class) public void edit(AddIcNatFormDTO formDTO) { + disposeIsNull(formDTO); //0.先根据身份证号和检测时间以及检测结果校验除当前数据是否还存在相同数据 - IcNatDTO icNatDTO = baseDao.getNatDTO(formDTO.getCustomerId(), formDTO.getIcNatId(), formDTO.getIdCard(), DateUtils.format(formDTO.getNatTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE), formDTO.getNatResult()); + IcNatDTO icNatDTO = baseDao.getNatDTO(formDTO.getCustomerId(), formDTO.getIcNatId(), formDTO.getIdCard(), null != formDTO.getNatTime() ? DateUtils.format(formDTO.getNatTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE) : null, formDTO.getNatResult(), null != formDTO.getSampleTime() ? DateUtils.format(formDTO.getSampleTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE) : null); if (null != icNatDTO) { throw new RenException(EpmetErrorCode.IC_NAT.getCode(), EpmetErrorCode.IC_NAT.getMsg()); } @@ -445,6 +464,14 @@ public class IcNatServiceImpl extends BaseServiceImpl imp return baseDao.updateIsResiFlag(customerId,icResiUserId); } + @Override + @Transactional(rollbackFor = Exception.class) + public void updateBatchNat(List entities) { + if (CollectionUtils.isNotEmpty(entities)){ + baseDao.updateBatchNat(entities); + } + } + /** * 批量持久化 * @param entities @@ -464,7 +491,7 @@ public class IcNatServiceImpl extends BaseServiceImpl imp errorRow.setName(e.getName()); errorRow.setMobile(e.getMobile()); errorRow.setIdCard(e.getIdCard()); - errorRow.setErrorInfo("未知系统错误"); + errorRow.setErrorInfo(exception.getMessage()); listener.getErrorRows().add(errorRow); } }); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java index b0b9a12f77..ec754bb2b8 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java +++ b/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,中文 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index ec9bf3043c..bae8e89c0b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/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 { + IcResiUserEntity entity = icResiUserDao.selectById(i.getIcResiUserId()); + // 未变更前的记录 + Map categoryMap = icResiUserDao.getCategoryListMap(Arrays.asList(formDTO.getColumnName()), entity.getId()); + // 修改前跟要修改的值一样,不新增变更记录 + if (!categoryMap.get(formDTO.getColumnName()).equals(i.getCategoryStatus())) { + IcUserChangeRecordEntity icUserChangeRecordEntity = new IcUserChangeRecordEntity(); + icUserChangeRecordEntity.setCustomerId(formDTO.getCustomerId()); + icUserChangeRecordEntity.setOperatorId(formDTO.getUserId()); + icUserChangeRecordEntity.setIcUserId(entity.getId()); + icUserChangeRecordEntity.setOperatorName(formDTO.getUserName()); + icUserChangeRecordEntity.setIcUserName(entity.getName()); + icUserChangeRecordEntity.setType(IcResiUserConstant.USER_CATEGORY); + icUserChangeRecordEntity.setTypeName(IcResiUserConstant.USER_CATEGORY_CN); + icUserChangeRecordEntity.setBeforeChangeName(categoryMap.get(formDTO.getColumnName()).equals(NumConstant.ONE_STR) ? formDTO.getLabel().concat(":是") : formDTO.getLabel().concat(":否")); + icUserChangeRecordEntity.setAfterChangeName(i.getCategoryStatus().equals(NumConstant.ONE_STR) ? formDTO.getLabel().concat(":是") : formDTO.getLabel().concat(":否")); + icUserChangeRecordEntity.setChangeTime(new Date()); + icUserChangeRecordEntity.setRemark(formDTO.getLabel().concat("数据更新")); + baseDao.insert(icUserChangeRecordEntity); + + IcUserChangeDetailedEntity icUserChangeDetailedEntity = new IcUserChangeDetailedEntity(); + icUserChangeDetailedEntity.setCustomerId(formDTO.getCustomerId()); + icUserChangeDetailedEntity.setIcUserChangeRecordId(icUserChangeRecordEntity.getId()); + icUserChangeDetailedEntity.setPids(StringUtils.isNotBlank(entity.getPids()) && entity.getPids().contains(":") ? entity.getPids().substring(NumConstant.ZERO, entity.getPids().lastIndexOf(":")) : ""); + icUserChangeDetailedEntity.setAgencyId(entity.getAgencyId()); + icUserChangeDetailedEntity.setGridId(entity.getGridId()); + icUserChangeDetailedEntity.setNeighborHoodId(entity.getVillageId()); + icUserChangeDetailedEntity.setBuildingId(entity.getBuildId()); + icUserChangeDetailedEntity.setBuildingUnitId(entity.getUnitId()); + icUserChangeDetailedEntity.setHouseId(entity.getHomeId()); + icUserChangeDetailedEntity.setIcUserId(entity.getId()); + icUserChangeDetailedEntity.setType(IcResiUserConstant.USER_CATEGORY); + icUserChangeDetailedEntity.setTypeName(IcResiUserConstant.USER_CATEGORY_CN); + icUserChangeDetailedEntity.setFieldName(formDTO.getColumnName()); + icUserChangeDetailedEntity.setValue(i.getCategoryStatus().equals(NumConstant.ONE_STR) ? NumConstant.ONE : NumConstant.ONE_NEG); + icUserChangeDetailedService.insert(icUserChangeDetailedEntity); + + // 发送消息 + IcResiUserAddMQMsg mqMsg = new IcResiUserAddMQMsg(); + mqMsg.setCustomerId(formDTO.getCustomerId()); + mqMsg.setIcResiUser(formDTO.getUserId()); + SystemMsgFormDTO form = new SystemMsgFormDTO(); + form.setMessageType(SystemMessageType.IC_RESI_USER_EDIT); + form.setContent(mqMsg); + epmetMessageOpenFeignClient.sendSystemMsgByMQ(form); + } + }); + } + /** * @Author sun * @Description 按客户初始化客户下居民的变更记录、变更明细数据 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserTransferRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserTransferRecordServiceImpl.java index d07fe051eb..e2013336f0 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserTransferRecordServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserTransferRecordServiceImpl.java @@ -179,10 +179,19 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl result2 = getNewHouseInfo(formDTO); CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.76__alter_ic_nat.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.76__alter_ic_nat.sql new file mode 100644 index 0000000000..136596160f --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.76__alter_ic_nat.sql @@ -0,0 +1,7 @@ +alter table ic_nat add COLUMN `SAMPLE_TIME` datetime COMMENT '采样时间'after ID_CARD; + +ALTER TABLE ic_nat MODIFY COLUMN NAT_TIME datetime COMMENT '检测时间,精确到分钟'; + +UPDATE ic_nat +SET SAMPLE_TIME = NAT_TIME, + UPDATED_TIME = NOW(); \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.77__data_compare_d_c.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.77__data_compare_d_c.sql new file mode 100644 index 0000000000..ed2d9a1de1 --- /dev/null +++ b/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'; diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/ic_nat.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/ic_nat.xlsx index d9038bfdc4..524d327bd7 100644 Binary files a/epmet-user/epmet-user-server/src/main/resources/excel/ic_nat.xlsx and b/epmet-user/epmet-user-server/src/main/resources/excel/ic_nat.xlsx differ diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/ChangeDeathDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/ChangeDeathDao.xml index af48cfae7f..36a6f06002 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/ChangeDeathDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/ChangeDeathDao.xml @@ -56,13 +56,13 @@ AND d.GRID_ID = #{gridId} - AND d.NAME = #{name} + AND d.NAME like concat( '%',#{name},'%') - AND d.ID_CARD = #{idCard} + AND d.ID_CARD like concat('%', #{idCard},'%') - AND d.MOBILE = #{mobile} + AND d.MOBILE like concat('%', #{mobile},'%') AND d.DEATH_DATE >= #{startTime} diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncConfigDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncConfigDao.xml index 9b441032e3..cc4209f310 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncConfigDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncConfigDao.xml @@ -41,50 +41,66 @@ customer_id as customerId FROM data_sync_config WHERE DEL_FLAG = 0 - - AND CUSTOMER_ID = #{customerId} - + + AND switch_status = #{switchStatus} + + + AND CUSTOMER_ID = #{customerId} + order by sort - - \ No newline at end of file + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncRecordDeathDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncRecordDeathDao.xml new file mode 100644 index 0000000000..67e8f18649 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncRecordDeathDao.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncRecordDisabilityDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncRecordDisabilityDao.xml new file mode 100644 index 0000000000..889ca27c1c --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncRecordDisabilityDao.xml @@ -0,0 +1,212 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + UPDATE ic_resi_user + + + + + when id = #{item.icResiUserId} then #{item.disabilityStatus} + + + + + + + + when id = #{item.icResiUserId} then #{item.cardNum} + + + when id = #{item.icResiUserId} then '' + + + + + + + + + when id = #{item.icResiUserId} then #{item.cjzk} + + + when id = #{item.icResiUserId} then '' + + + + + + + + + when id = #{item.icResiUserId} then #{item.cjlb} + + + when id = #{item.icResiUserId} then '' + + + + + UPDATED_TIME = NOW() + + WHERE 1=1 + + id = #{item.icResiUserId} + + + + + UPDATE data_sync_record_disability + + + + + + when id = #{item.id} then 2 + + + when id = #{item.id} then 1 + + + + + + + + + when id = #{item.id} then '处理失败' + + + when id = #{item.id} then '处理成功' + + + + + UPDATED_TIME = NOW() + + WHERE 1=1 + + id = #{item.id} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatCompareRecordDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatCompareRecordDao.xml index 2a33a5680b..0e3fcaa606 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatCompareRecordDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatCompareRecordDao.xml @@ -7,6 +7,7 @@ @@ -117,6 +131,7 @@ mobile, id_card, nat_time, + sample_time, nat_result, nat_address FROM @@ -125,7 +140,12 @@ del_flag = '0' AND customer_id = #{customerId} AND id_card = #{idCard} - AND DATE_FORMAT(nat_time, '%Y-%m-%d %h:%i') = DATE_FORMAT(#{natTime}, '%Y-%m-%d %h:%i') + + AND DATE_FORMAT(nat_time, '%Y-%m-%d %h:%i') = DATE_FORMAT(#{natTime}, '%Y-%m-%d %h:%i') + + + AND DATE_FORMAT(sample_time, '%Y-%m-%d %h:%i') = DATE_FORMAT(#{sampleTime}, '%Y-%m-%d %h:%i') + AND nat_result = #{natResult} @@ -144,7 +164,7 @@ 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}) @@ -169,4 +189,36 @@ m.ID_CARD = t.ID_CARD AND m.DEL_FLAG = '0' + + UPDATE ic_nat + + + + when USER_ID = #{l.userId} AND ID_CARD = #{l.idCard} then #{l.natTime} + + + + + when USER_ID = #{l.userId} AND ID_CARD = #{l.idCard} then #{l.natAddress} + + + + + when USER_ID = #{l.userId} AND ID_CARD = #{l.idCard} then #{l.natResult} + + + + + when USER_ID = #{l.userId} AND ID_CARD = #{l.idCard} then #{l.mobile} + + + UPDATED_TIME = NOW() + + WHERE DEL_FLAG = '0' + + AND USER_ID = #{l.userId} + AND ID_CARD = #{l.idCard} + + + diff --git a/epmet-user/epmet-user-server/src/test/java/com/epmet/service/DataSyncConfigServiceTest.java b/epmet-user/epmet-user-server/src/test/java/com/epmet/service/DataSyncConfigServiceTest.java new file mode 100644 index 0000000000..a60c27d432 --- /dev/null +++ b/epmet-user/epmet-user-server/src/test/java/com/epmet/service/DataSyncConfigServiceTest.java @@ -0,0 +1,22 @@ +package com.epmet.service; + +import com.epmet.dto.form.DataSyncTaskParam; +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; + +@SpringBootTest +@RunWith(SpringRunner.class) +public class DataSyncConfigServiceTest { + @Autowired + private DataSyncConfigService dataSyncConfigService; + + @Test + public void dataSyncForYanTaiTask() { + DataSyncTaskParam param = new DataSyncTaskParam(); + dataSyncConfigService.dataSyncForYanTaiTask(param); + + } +}