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/listener/CheckAndExportOperationLogListener.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/CheckAndExportOperationLogListener.java index 1d86c65b8d..977117ac84 100644 --- 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 @@ -63,9 +63,9 @@ public class CheckAndExportOperationLogListener implements MessageListenerConcur //获取操作人信息 OperatorInfo operatorInfo = LogOperationHelper.getInstance().getOperatorInfo(msgObj.getUserId()); LogOperationEntity logEntity = new LogOperationEntity(); - logEntity.setCategory(messageExt.getTopic()); - logEntity.setType(tags); - logEntity.setTypeDisplay(AuthOperationEnum.getDisplay(tags)); + logEntity.setCategory("data_tm"); + logEntity.setType(msgObj.getType()); + logEntity.setTypeDisplay(msgObj.getTypeDisplay()); logEntity.setIp(msgObj.getIp()); logEntity.setFromApp(msgObj.getFromApp()); logEntity.setFromClient(msgObj.getFromClient()); @@ -76,6 +76,8 @@ public class CheckAndExportOperationLogListener implements MessageListenerConcur 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; 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.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 e1ab790e0f..9850feb4b3 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/messages/CheckMQMsg.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/CheckMQMsg.java index 0a9f02b692..30b1595e20 100644 --- 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 @@ -14,6 +14,9 @@ public class CheckMQMsg { private String content; + private String typeDisplay; + private String type; + /** * 操作时间 */ @@ -24,5 +27,7 @@ public class CheckMQMsg { 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/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/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-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-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-org/gov-org-client/src/main/java/com/epmet/constant/NeighborhoodConstant.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/constant/NeighborhoodConstant.java index fe92bcd3c2..261b951496 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/constant/NeighborhoodConstant.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/constant/NeighborhoodConstant.java @@ -6,12 +6,61 @@ package com.epmet.constant; */ public interface NeighborhoodConstant { + String MOBILE = "MOBILE"; + String ID_CARD = "ID_CARD"; + String NAME = "NAME"; + String GRID = "grid"; String NEIGHBOR_HOOD= "neighbourHood"; String BUILDING = "building"; String HOUSE = "house"; + String CHECK_HOUSE = "checkHouse"; + /** + * ic居民 + */ String IC_RESI_USER = "icResiUser"; + String CHECK_IC_RESI_USER = "checkIcResiUser"; + + /** + * 居民防疫信息 + */ + String JMFYXX = "JMFYXX"; + + /** + * 行程随访 + */ + String ROUTE_FOLLOW = "routeFollow"; + + /** + * 疫苗接种记录 + */ + String VACCINATION_RECORD = "vaccinationRecord"; + + /** + * 疫苗接种关注名单 + */ + String VACCINE_SPECIAL_ATTENTION = "vaccineSpecialAttention"; + + /** + * 未做核酸比对 + */ + String NO_NAT_COMPARE = "noNatCompare"; + + /** + * 核酸检测记录 + */ + String NAT_RECORD = "natRecord"; + + /** + * 重点人群关注名单【防疫隔离】 + */ + String FOCUS_GROUP_SPECIAL_ATTENTION_QUARANTINE = "focusGroupSpecialAttentionQuarantine"; + + /** + * 重点人群关注名单【历史记录】 + */ + String FOCUS_GROUP_SPECIAL_ATTENTION_HISTORY = "focusGroupSpecialAttentionHistory"; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcHouseDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcHouseDTO.java index e026d7cbdc..cdbf65c799 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcHouseDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcHouseDTO.java @@ -161,4 +161,13 @@ public class IcHouseDTO implements Serializable { * 房屋可编辑编码 */ private String coding; + + /** + * 加密后的联系方式 + */ + private String showOwnerPhone; + /** + * 加密后的房主身份证 + */ + private String showOwnerIdCard; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java index 35b3bc0e6f..0e2f57f7d9 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java @@ -25,6 +25,8 @@ import com.alibaba.excel.write.metadata.style.WriteCellStyle; import com.alibaba.excel.write.style.HorizontalCellStyleStrategy; import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; import com.alibaba.fastjson.JSON; +import com.epmet.commons.rocketmq.constants.TopicConstants; +import com.epmet.commons.rocketmq.messages.CheckMQMsg; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.MaskResponse; import com.epmet.commons.tools.annotation.ReportRequest; @@ -40,10 +42,7 @@ import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.common.bean.HouseInfoCache; import com.epmet.commons.tools.security.dto.TokenDto; -import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.utils.ExcelUtils; -import com.epmet.commons.tools.utils.HouseQRcodeUtils; -import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.*; import com.epmet.commons.tools.utils.poi.excel.handler.ExcelFillRowMergeStrategy; import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -54,6 +53,7 @@ import com.epmet.dto.result.*; import com.epmet.entity.CustomerOrgParameterEntity; import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; +import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.service.HouseService; import com.epmet.util.ExcelPoiUtils; @@ -66,18 +66,18 @@ import org.apache.poi.ss.usermodel.VerticalAlignment; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.multipart.MultipartFile; import javax.imageio.ImageIO; import javax.imageio.stream.ImageOutputStream; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.awt.image.BufferedImage; import java.io.*; import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Set; +import java.util.*; import java.util.concurrent.TimeUnit; @@ -105,6 +105,8 @@ public class HouseController implements ResultDataResolver { @Autowired private IcHouseDao icHouseDao; + @Autowired + private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; @ReportRequest @PostMapping("houselist") @@ -265,7 +267,7 @@ public class HouseController implements ResultDataResolver { * @throws Exception */ @RequestMapping("exporthouseinfo") - public void exporthouseinfo(@RequestBody IcHouseListFormDTO formDTO, HttpServletResponse response) throws Exception { + public void exporthouseinfo(@RequestBody IcHouseListFormDTO formDTO, HttpServletResponse response,@LoginUser TokenDto tokenDto) throws Exception { ValidatorUtils.validateEntity(formDTO); if (StringUtils.isNotBlank(formDTO.getId())){ formDTO.setSelectType("id"); @@ -274,7 +276,21 @@ public class HouseController implements ResultDataResolver { } formDTO.setIsPage(false); houseService.exportBuildinginfo(formDTO, response); - + // 新增操作日志 + CheckMQMsg msg = new CheckMQMsg(); + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + msg.setOperateTime(new Date()); + msg.setContent("导出房屋数据"); + msg.setType("exportHouse"); + msg.setTypeDisplay("导出房屋数据"); + msg.setUserId(tokenDto.getUserId()); + msg.setFromApp(tokenDto.getApp()); + msg.setIp(IpUtils.getIpAddr(request)); + msg.setFromClient(tokenDto.getClient()); + SystemMsgFormDTO form = new SystemMsgFormDTO(); + form.setMessageType(TopicConstants.CHECK_OR_EXPORT); + form.setContent(msg); + epmetMessageOpenFeignClient.sendSystemMsgByMQ(form); } @PostMapping("queryListHouseInfo") @@ -452,6 +468,22 @@ public class HouseController implements ResultDataResolver { //获取导出配置 haveSearchCache.invalidateAll(); + + // 发送操作日志 + CheckMQMsg msg = new CheckMQMsg(); + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + msg.setOperateTime(new Date()); + msg.setContent("导出一户一档数据"); + msg.setType("exportYHYD"); + msg.setTypeDisplay("导出一户一档数据"); + msg.setUserId(tokenDto.getUserId()); + msg.setFromApp(tokenDto.getApp()); + msg.setIp(IpUtils.getIpAddr(request)); + msg.setFromClient(tokenDto.getClient()); + SystemMsgFormDTO form = new SystemMsgFormDTO(); + form.setMessageType(TopicConstants.CHECK_OR_EXPORT); + form.setContent(msg); + epmetMessageOpenFeignClient.sendSystemMsgByMQ(form); } catch (EpmetException e) { response.reset(); response.setCharacterEncoding("UTF-8"); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java index 6e867c47de..e7b5ac7e56 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java @@ -18,17 +18,16 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.MaskResponse; import com.epmet.commons.tools.dto.form.PageFormDTO; import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.IcHouseDTO; -import com.epmet.dto.IcVaccinePrarmeterDTO; import com.epmet.dto.form.CheckHouseInfoFormDTO; import com.epmet.dto.form.DetailByTypeFormDTO; import com.epmet.dto.form.HouseFormDTO; -import com.epmet.dto.form.VaccinePrarmeterListFormDTO; import com.epmet.dto.result.*; import com.epmet.service.IcHouseService; import org.springframework.beans.factory.annotation.Autowired; @@ -51,6 +50,7 @@ public class IcHouseController { @Autowired private IcHouseService icHouseService; + @MaskResponse(fieldNames = { "showOwnerPhone", "showOwnerIdCard" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD }) @GetMapping("{id}") public Result get(@PathVariable("id") String id) { IcHouseDTO data = icHouseService.get(id); @@ -154,15 +154,4 @@ public class IcHouseController { return icHouseService.checkHomeInfo(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(icHouseService.detailByType(formDTO,tokenDto)); - } } 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 0b2e40f86d..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 @@ -138,12 +138,5 @@ public interface IcHouseService extends BaseService { */ Result checkHomeInfo(CheckHouseInfoFormDTO formDTO); - /** - * Desc: 数据明文查询 - * @param formDTO - * @author zxc - * @date 2022/10/17 13:45 - */ - DetailByTypeResultDTO detailByType(DetailByTypeFormDTO formDTO, TokenDto tokenDto); } 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 364b859376..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 @@ -5,7 +5,6 @@ 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.rocketmq.messages.LoginMQMsg; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.OptionResultDTO; @@ -15,7 +14,7 @@ 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.ResiUserInfoCache; +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; @@ -93,6 +92,8 @@ public class IcHouseServiceImpl extends BaseServiceImpl().ok(checkHomeInfoResultInfo); } - - /** - * Desc: 数据明文查询 - * @param formDTO - * @author zxc - * @date 2022/10/17 13:45 - */ - @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.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("查看房屋信息明文"); - }else if (formDTO.getType().equals(NeighborhoodConstant.IC_RESI_USER)){ - ResiUserInfoCache userBaseInfo = CustomerResiUserRedis.getUserBaseInfo(formDTO.getId()); - if (null == userBaseInfo){ - throw new EpmetException("查询icResiUser失败:"+formDTO.getId()); - } - result.setIdCard(userBaseInfo.getIdNum()); - result.setMobile(userBaseInfo.getMobile()); - msg.setContent("查看居民信息明文"); - } - // 发送mq消息 - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - msg.setOperateTime(new Date()); - msg.setUserId(userId); - 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/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/TransferFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/TransferFormDTO.java index 5eb7013261..c03f72dd51 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/TransferFormDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/TransferFormDTO.java @@ -51,5 +51,6 @@ public class TransferFormDTO implements Serializable { * 协办单位类型,1社区自组织,2联建单位 */ private String assistanceUnitType; + } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatCompareRecordDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatCompareRecordDTO.java index 9bde2314d1..b422af6b61 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatCompareRecordDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatCompareRecordDTO.java @@ -30,6 +30,9 @@ public class IcNatCompareRecordDTO implements Serializable { @ExcelIgnore private String relationId; + @ExcelIgnore + private String recordId; + /** * 姓名 */ 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 43f9582b8c..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; /** 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/IcNatDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java index b2419b09f5..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 @@ -64,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/excel/data/IcNatImportExcelData.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatImportExcelData.java index ae0cb210d7..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,9 +24,9 @@ public class IcNatImportExcelData { @Length(max = 15, message = "手机号长度不正确,应小于15位") private String mobile; - @NotBlank(message = "身份证号为必填项") - @ExcelProperty("身份证号") - @Length(max = 18, message = "身份证号长度不正确,应小于18位") + @NotBlank(message = "证件号为必填项") + @ExcelProperty("证件号") + @Length(max = 18, message = "证件号长度不正确,应小于18位") private String idCard; // @NotNull(message = "检测时间为必填项") 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 59f5eaab7b..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 @@ -68,7 +68,7 @@ public class IcNatExcelImportListener implements ReadListener { * @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/impl/DataSyncConfigServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncConfigServiceImpl.java index fbdb3eb7d1..47d402e7d2 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncConfigServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncConfigServiceImpl.java @@ -450,100 +450,64 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl idCards, String customerId, String isSync) { try { - List entities = new ArrayList<>(); idCards.forEach(idCard -> { -// YtHscyResDTO sampleResult = YtHsResUtils.hscy(idCard.getIdCard(), NumConstant.ONE, NumConstant.ONE); - YtHsjcResDTO natInfoResult = YtHsResUtils.hsjc(idCard.getIdCard(), NumConstant.ONE, NumConstant.ONE); - /*Boolean aBoolean = CollectionUtils.isEmpty(sampleResult.getData()) && CollectionUtils.isNotEmpty(natInfoResult.getData()); - Boolean bBoolean = CollectionUtils.isNotEmpty(sampleResult.getData()) && CollectionUtils.isNotEmpty(natInfoResult.getData());*/ - /** - * 1.采样结果 和 检测结果 都不为空,以检测结果为准 - * 2.采样结果为空,检测结果不为空 - */ -// if (aBoolean || bBoolean) { - if (CollectionUtils.isNotEmpty(natInfoResult.getData())) { - natInfoResult.getData().forEach(natInfo -> { + YtHscyResDTO sampleResult = YtHsResUtils.hscy(idCard.getIdCard(), NumConstant.ONE, NumConstant.ONE); + if (CollectionUtils.isNotEmpty(sampleResult.getData())){ + List entities = new ArrayList<>(); + sampleResult.getData().forEach(sampleInfo -> { IcNatEntity e = new IcNatEntity(); e.setCustomerId(customerId); e.setIsResiUser(StringUtils.isBlank(idCard.getUserId()) ? NumConstant.ZERO_STR : NumConstant.ONE_STR); e.setUserId(idCard.getUserId()); + e.setMobile(""); e.setUserType(isSync.equals(NumConstant.ONE_STR) ? "manualSync" : "sync"); - e.setName(StringUtils.isNotBlank(natInfo.getName()) ? natInfo.getName() : ""); - e.setMobile(StringUtils.isNotBlank(natInfo.getTelephone()) ? natInfo.getTelephone() : ""); - e.setIdCard(StringUtils.isNotBlank(natInfo.getCard_no()) ? natInfo.getCard_no() : ""); - e.setNatTime(DateUtils.parseDate(natInfo.getTest_time(), DateUtils.DATE_TIME_PATTERN)); - e.setSampleTime(DateUtils.parseDate(natInfo.getSample_time(), DateUtils.DATE_TIME_PATTERN)); - String resultPcr = natInfo.getSample_result_pcr(); - //检测结果 转换 我们 0:阴性 1:阳性, 他们 :1:阳性,2:阴性 - e.setNatResult(NumConstant.ZERO_STR); - if (NumConstant.ONE_STR.equals(resultPcr)) { - e.setNatResult(NumConstant.ONE_STR); - } - e.setNatAddress(natInfo.getSampling_org_pcr()); + e.setName(StringUtils.isNotBlank(sampleInfo.getName()) ? sampleInfo.getName() : ""); + e.setIdCard(StringUtils.isNotBlank(sampleInfo.getCard_no()) ? sampleInfo.getCard_no() : ""); + e.setSampleTime(DateUtils.parseDate(sampleInfo.getCreate_time(), DateUtils.DATE_TIME_PATTERN)); e.setAgencyId(idCard.getAgencyId()); e.setPids(idCard.getPids()); e.setAttachmentType(""); e.setAttachmentUrl(""); entities.add(e); }); + if (CollectionUtils.isNotEmpty(entities)){ + List existSampleInfo = icNatDao.getExistNatInfo(entities); + sampleAndNat(existSampleInfo,entities,NumConstant.ONE_STR,customerId,isSync); + } } - /*if (CollectionUtils.isNotEmpty(sampleResult.getData()) && CollectionUtils.isEmpty(natInfoResult.getData())){ - sampleResult.getData().forEach(sampleInfo -> { + YtHsjcResDTO natInfoResult = YtHsResUtils.hsjc(idCard.getIdCard(), NumConstant.ONE, NumConstant.ONE); + if (CollectionUtils.isNotEmpty(natInfoResult.getData())) { + List entities = new ArrayList<>(); + natInfoResult.getData().forEach(natInfo -> { IcNatEntity e = new IcNatEntity(); e.setCustomerId(customerId); e.setIsResiUser(StringUtils.isBlank(idCard.getUserId()) ? NumConstant.ZERO_STR : NumConstant.ONE_STR); e.setUserId(idCard.getUserId()); e.setUserType(isSync.equals(NumConstant.ONE_STR) ? "manualSync" : "sync"); - e.setName(StringUtils.isNotBlank(sampleInfo.getName()) ? sampleInfo.getName() : ""); - e.setMobile(StringUtils.isNotBlank(sampleInfo.get()) ? sampleInfo.getTelephone() : ""); - e.setIdCard(StringUtils.isNotBlank(sampleInfo.getCard_no()) ? sampleInfo.getCard_no() : ""); - e.setNatTime(DateUtils.parseDate(sampleInfo.getTest_time(), DateUtils.DATE_TIME_PATTERN)); - e.setSampleTime(DateUtils.parseDate(sampleInfo.getSample_time(), DateUtils.DATE_TIME_PATTERN)); - String resultPcr = sampleInfo.getSample_result_pcr(); + e.setName(StringUtils.isNotBlank(natInfo.getName()) ? natInfo.getName() : ""); + e.setMobile(StringUtils.isNotBlank(natInfo.getTelephone()) ? natInfo.getTelephone() : ""); + e.setIdCard(StringUtils.isNotBlank(natInfo.getCard_no()) ? natInfo.getCard_no() : ""); + e.setNatTime(DateUtils.parseDate(natInfo.getTest_time(), DateUtils.DATE_TIME_PATTERN)); + e.setSampleTime(DateUtils.parseDate(natInfo.getSample_time(), DateUtils.DATE_TIME_PATTERN)); + String resultPcr = natInfo.getSample_result_pcr(); //检测结果 转换 我们 0:阴性 1:阳性, 他们 :1:阳性,2:阴性 e.setNatResult(NumConstant.ZERO_STR); - if (NumConstant.ONE_STR.equals(resultPcr)){ + if (NumConstant.ONE_STR.equals(resultPcr)) { e.setNatResult(NumConstant.ONE_STR); } - e.setNatAddress(sampleInfo.getSampling_org_pcr()); + e.setNatAddress(natInfo.getSampling_org_pcr()); e.setAgencyId(idCard.getAgencyId()); e.setPids(idCard.getPids()); e.setAttachmentType(""); e.setAttachmentUrl(""); entities.add(e); }); - } - });*/ - if (CollectionUtils.isNotEmpty(entities)) { - List 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), NumConstant.FIVE_HUNDRED)) { - icNatService.insertBatch(icNatEntities); - //组织关系表 - List relationEntities = new ArrayList<>(); - icNatEntities.forEach(ne -> { - // 不是居民的先不加关系表吧 - if (ne.getIsResiUser().equals(NumConstant.ONE_STR)) { - IcNatRelationEntity e = new IcNatRelationEntity(); - e.setCustomerId(customerId); - e.setAgencyId(ne.getAgencyId()); - e.setPids(ne.getPids()); - e.setIcNatId(ne.getId()); - e.setUserType("sync"); - relationEntities.add(e); - } - }); - if (CollectionUtils.isNotEmpty(relationEntities)) { - icNatRelationService.insertBatch(relationEntities); - } - } + if (CollectionUtils.isNotEmpty(entities)) { + List existNatInfos = icNatDao.getExistNatInfo(entities); + sampleAndNat(existNatInfos,entities,NumConstant.TWO_STR,customerId,isSync); } - } }); } catch (Exception e) { @@ -552,6 +516,58 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl 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<>(); + icNatEntities.forEach(ne -> { + if (ne.getIsResiUser().equals(NumConstant.ONE_STR)) { + IcNatRelationEntity e = new IcNatRelationEntity(); + e.setCustomerId(customerId); + e.setAgencyId(ne.getAgencyId()); + e.setPids(ne.getPids()); + e.setIcNatId(ne.getId()); + e.setUserType(isSync.equals(NumConstant.ONE_STR) ? "manualSync" : "sync"); + relationEntities.add(e); + } + }); + if (CollectionUtils.isNotEmpty(relationEntities)) { + icNatRelationService.insertBatch(relationEntities); + } + } + } + if (NumConstant.TWO_STR.equals(type)){ + if (CollectionUtils.isNotEmpty(groupByStatus.get(true))){ + for (List icNatEntities : ListUtils.partition(groupByStatus.get(true), NumConstant.ONE_HUNDRED)) { + icNatService.updateBatchNat(icNatEntities); + } + } + } + } + private class JudgeDealStatus { private boolean isNext; private DataSyncRecordDisabilityDTO dbDisablityEntity; 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 3a9282b9bb..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 @@ -464,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 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 SELECT r.ID as relationId, + c.ID as recordId, c.MOBILE, c.ID_CARD, c.`NAME`, diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml index 0295d92f3f..ea4f9a8bc6 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml @@ -164,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}) @@ -189,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} + + +