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..2da04fe5d6 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 @@ -2,6 +2,7 @@ package com.epmet.controller; 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.user.LoginUserUtil; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -45,4 +46,20 @@ public class LogOperationController { return new Result>().ok(resultList); } + /** + * 数字社区-操作记录 + * @param formDTO + * @return + */ + @PostMapping("page") + public Result> page(@RequestBody LogOperationListFormDTO formDTO){ + return new Result>().ok(logOperationService.page(loginUserUtil.getLoginUserCustomerId(), + formDTO.getStartTime(), + formDTO.getEndTime(), + formDTO.getOperatorName(), + formDTO.getOperatorMobile(), + formDTO.getPageNo(), + formDTO.getPageSize(), + formDTO.getCategory())); + } } 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..59650e60ae 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,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +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; /** * 操作日指标 @@ -29,5 +33,11 @@ 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); } \ No newline at end of file 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..b11751f3eb --- /dev/null +++ b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/CheckAndExportOperationLogListener.java @@ -0,0 +1,120 @@ +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()); + + 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..ad7bc8acb6 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,6 @@ package com.epmet.service; +import com.epmet.commons.tools.page.PageData; import com.epmet.dto.region.LogOperationResultDTO; import com.epmet.entity.LogOperationEntity; @@ -25,4 +26,20 @@ 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); } 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..f9837728e7 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 @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.feign.ResultDataResolver; +import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.LogOperationDao; import com.epmet.dto.CustomerStaffDTO; @@ -15,6 +16,8 @@ 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; @@ -174,7 +177,28 @@ 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) { + // 列表/导出查询 + PageHelper.startPage(pageNo, pageSize); + List list = logOperationDao.pageList(customerId, startTime, endTime, operatorName, operatorMobile,category); + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal()); + } } 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/mapper/LogOperationDao.xml b/epmet-admin/epmet-admin-server/src/main/resources/mapper/LogOperationDao.xml index 5f34d339ad..b65219788c 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,38 @@ - + \ No newline at end of file diff --git a/epmet-auth/src/main/java/com/epmet/controller/DingdingLoginController.java b/epmet-auth/src/main/java/com/epmet/controller/DingdingLoginController.java new file mode 100644 index 0000000000..538060a391 --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/controller/DingdingLoginController.java @@ -0,0 +1,79 @@ +package com.epmet.controller; + +import com.dingtalk.api.DefaultDingTalkClient; +import com.dingtalk.api.DingTalkClient; +import com.dingtalk.api.request.OapiGettokenRequest; +import com.dingtalk.api.request.OapiSnsGetuserinfoBycodeRequest; +import com.dingtalk.api.request.OapiUserGetbyunionidRequest; +import com.dingtalk.api.request.OapiV2UserGetRequest; +import com.dingtalk.api.response.OapiGettokenResponse; +import com.dingtalk.api.response.OapiSnsGetuserinfoBycodeResponse; +import com.dingtalk.api.response.OapiUserGetbyunionidResponse; +import com.dingtalk.api.response.OapiV2UserGetResponse; +import com.epmet.commons.tools.utils.Result; +import com.taobao.api.ApiException; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +/** + * 免登第三方网站 + * + * @author openapi@dingtalk + */ +@RestController("dingtalk") +public class DingdingLoginController { + + /** + * 获取授权用户的个人信息 openapi@dingtalk + * + * @return + * @throws Exception ServiceResult> 2020-11-4 + */ + @RequestMapping(value = "/auth", method = RequestMethod.GET) + public Result getDdScan(@RequestParam("code") String code) throws Exception { + // 获取access_token,注意正式代码要有异常流处理 + String access_token = this.getToken(); + + // 通过临时授权码获取授权用户的个人信息 + DefaultDingTalkClient client2 = new DefaultDingTalkClient("https://oapi.dingtalk.com/sns/getuserinfo_bycode"); + OapiSnsGetuserinfoBycodeRequest reqBycodeRequest = new OapiSnsGetuserinfoBycodeRequest(); + + reqBycodeRequest.setTmpAuthCode(code); + OapiSnsGetuserinfoBycodeResponse bycodeResponse = client2.execute(reqBycodeRequest, "yourAppId", "yourAppSecret"); + + // 根据unionid获取userid + String unionid = bycodeResponse.getUserInfo().getUnionid(); + DingTalkClient clientDingTalkClient = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/user/getbyunionid"); + OapiUserGetbyunionidRequest reqGetbyunionidRequest = new OapiUserGetbyunionidRequest(); + reqGetbyunionidRequest.setUnionid(unionid); + OapiUserGetbyunionidResponse oapiUserGetbyunionidResponse = clientDingTalkClient.execute(reqGetbyunionidRequest, access_token); + + // 根据userId获取用户信息 + String userid = oapiUserGetbyunionidResponse.getResult().getUserid(); + DingTalkClient clientDingTalkClient2 = new DefaultDingTalkClient( + "https://oapi.dingtalk.com/topapi/v2/user/get"); + OapiV2UserGetRequest reqGetRequest = new OapiV2UserGetRequest(); + reqGetRequest.setUserid(userid); + //reqGetRequest.setLang("zh_CN"); + OapiV2UserGetResponse rspGetResponse = clientDingTalkClient2.execute(reqGetRequest, access_token); + System.out.println(rspGetResponse.getBody()); + return new Result().ok(rspGetResponse.getBody()); + } + private String getToken() throws RuntimeException { + try { + DefaultDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken"); + OapiGettokenRequest request = new OapiGettokenRequest(); + + request.setAppkey("dingiopfbtn8mktfoaf0"); + request.setAppsecret("RcmHIoP5KFLZSM5wzpYhvCKMMKEzLoWPtqu3OqOEBD6myg4IT8oVw4AwvRkKYKJz"); + request.setHttpMethod("GET"); + OapiGettokenResponse response = client.execute(request); + return response.getAccessToken(); + } catch (ApiException e) { + throw new RuntimeException(); + } + + } +} diff --git a/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java b/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java index 0bb11c468a..44ca89df30 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java @@ -9,7 +9,10 @@ import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.service.ThirdLoginService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import java.util.List; @@ -174,7 +177,7 @@ public class ThirdLoginController { * @return */ @PostMapping("resilogin-ding-md") - public Result resiLoginDingMd(@RequestBody ResiDingAppLoginMdFormDTO formDTO) { + public Result resiLoginDingMd(@RequestBody DingAppLoginMdFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); return new Result().ok(thirdLoginService.resiLoginDingMd(formDTO)); } @@ -200,8 +203,20 @@ public class ThirdLoginController { * @return */ @PostMapping("resilogin-internalding") - public Result resiLoginInternalDing(@RequestBody ResiDingAppLoginMdFormDTO formDTO) { + public Result resiLoginInternalDing(@RequestBody DingAppLoginMdFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); return new Result().ok(thirdLoginService.resiLoginInternalDing(formDTO)); } + + /** + * 根据免登授权码, 获取登录用户身份 + * + * @param formDTO 免登授权码 + * @return + */ + @PostMapping("govlogin-internalding") + public Result login(@RequestBody DingAppLoginMdFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return new Result().ok(thirdLoginService.govLoginInternalDing(formDTO)); + } } diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/ResiDingAppLoginMdFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/DingAppLoginMdFormDTO.java similarity index 90% rename from epmet-auth/src/main/java/com/epmet/dto/form/ResiDingAppLoginMdFormDTO.java rename to epmet-auth/src/main/java/com/epmet/dto/form/DingAppLoginMdFormDTO.java index 0b3b9ae0f8..1a8840e949 100644 --- a/epmet-auth/src/main/java/com/epmet/dto/form/ResiDingAppLoginMdFormDTO.java +++ b/epmet-auth/src/main/java/com/epmet/dto/form/DingAppLoginMdFormDTO.java @@ -10,7 +10,7 @@ import javax.validation.constraints.NotBlank; * @Date 2022/9/22 10:42 */ @Data -public class ResiDingAppLoginMdFormDTO { +public class DingAppLoginMdFormDTO { @NotBlank(message = "authCode不能为空") private String authCode; /** diff --git a/epmet-auth/src/main/java/com/epmet/dto/result/ResiDingAppLoginResDTO.java b/epmet-auth/src/main/java/com/epmet/dto/result/ResiDingAppLoginResDTO.java index 7a0517574a..6658ab5770 100644 --- a/epmet-auth/src/main/java/com/epmet/dto/result/ResiDingAppLoginResDTO.java +++ b/epmet-auth/src/main/java/com/epmet/dto/result/ResiDingAppLoginResDTO.java @@ -38,5 +38,7 @@ public class ResiDingAppLoginResDTO { * false:未注册 */ private Boolean regFlag; + + private String realName; } diff --git a/epmet-auth/src/main/java/com/epmet/service/GovWebService.java b/epmet-auth/src/main/java/com/epmet/service/GovWebService.java index 10d86c20b4..6bee4b24b3 100644 --- a/epmet-auth/src/main/java/com/epmet/service/GovWebService.java +++ b/epmet-auth/src/main/java/com/epmet/service/GovWebService.java @@ -18,6 +18,14 @@ public interface GovWebService { **/ UserTokenResultDTO login(GovWebLoginFormDTO formDTO); + /** + * @param formDTO + * @return + * @Author sun + * @Description PC工作端-工作人员 通过第三方系统登录 + **/ + UserTokenResultDTO loginByThirdPlatform(GovWebLoginFormDTO formDTO); + /** * 区块链系统通过用户密码认证身份 * @param mobile diff --git a/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java b/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java index 70bcc92338..dff5e129e5 100644 --- a/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java +++ b/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java @@ -102,12 +102,19 @@ public interface ThirdLoginService { * @param formDTO * @return */ - ResiDingAppLoginResDTO resiLoginDingMd(ResiDingAppLoginMdFormDTO formDTO); + ResiDingAppLoginResDTO resiLoginDingMd(DingAppLoginMdFormDTO formDTO); /** * 企业内部应用免登 文档地址:https://open.dingtalk.com/document/orgapp-server/enterprise-internal-application-logon-free * @param formDTO * @return */ - ResiDingAppLoginResDTO resiLoginInternalDing(ResiDingAppLoginMdFormDTO formDTO); + ResiDingAppLoginResDTO resiLoginInternalDing(DingAppLoginMdFormDTO formDTO); + + /** + * desc:企业内部应用 工作端登录 + * @param formDTO + * @return + */ + UserTokenResultDTO govLoginInternalDing(DingAppLoginMdFormDTO formDTO); } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java index eab142e6a5..92e1de27a5 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java @@ -100,6 +100,33 @@ public class GovWebServiceImpl implements GovWebService, ResultDataResolver { } + @Override + public UserTokenResultDTO loginByThirdPlatform(GovWebLoginFormDTO formDTO) { + formDTO.setApp(LoginConstant.APP_GOV); + formDTO.setClient(LoginConstant.CLIENT_WEB); +// //1.参数校验 +// if (!(LoginConstant.APP_GOV.equals(formDTO.getApp()) && LoginConstant.CLIENT_WEB.equals(formDTO.getClient()))) { +// logger.error("当前接口只适用于PC工作端运营管理后台"); +// throw new RenException("当前接口只适用于PC工作端运营管理后台"); +// } + //3.校验登陆账号是否存在 + //根据客户Id和手机号查询登陆用户信息(此处不需要判断登陆人是否是有效客户以及是否是客户的根管理员,前一接口获取登陆手机号对应客户列表已经判断了) + GovWebOperLoginFormDTO form = new GovWebOperLoginFormDTO(); + form.setCustomerId(formDTO.getCustomerId()); + form.setMobile(formDTO.getPhone()); + Result result = epmetUserFeignClient.getStaffIdAndPwd(form); + if (!result.success() || null == result.getData() || null == result.getData().getUserId()) { + logger.warn("根据手机号查询PC工作端登陆人员信息失败,返回10003账号不存在"); + throw new RenException(EpmetErrorCode.ERR10003.getCode()); + } + GovWebOperLoginResultDTO resultDTO = result.getData(); + + //5.生成token存到redis并返回 + UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); + userTokenResultDTO.setToken(this.packagingUserToken(formDTO, resultDTO.getUserId())); + return userTokenResultDTO; + } + /** * 生成PC工作端token * @author sun diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java index 211fce084e..3e1e580fce 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java @@ -6,8 +6,10 @@ import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; import cn.binarywang.wx.miniapp.bean.WxMaUserInfo; import com.alibaba.fastjson.JSON; import com.epmet.common.token.constant.LoginConstant; +import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; 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.password.PasswordUtils; import com.epmet.commons.tools.utils.CpUserDetailRedis; @@ -130,13 +132,13 @@ public class LoginServiceImpl implements LoginService { } } } catch (WxErrorException e) { - log.error("->[getMaOpenId]::error[{}]", "解析微信code失败",e); + log.warn("->[getMaOpenId]::error[{}]", "解析微信code失败",e); } if (null == wxMaJscode2SessionResult) { - log.error(String.format("解析微信用户信息失败,app[%s],wxCode[%s],result:[%S]",app,wxCode, JSON.toJSONString(wxMaJscode2SessionResult))); + log.warn(String.format("解析微信用户信息失败,app[%s],wxCode[%s],result:[%S]",app,wxCode, JSON.toJSONString(wxMaJscode2SessionResult))); throw new RenException("解析微信用户信息失败"); } else if (StringUtils.isBlank(wxMaJscode2SessionResult.getOpenid())) { - log.error(String.format("获取微信openid失败,app[%s],wxCode[%s]",app,wxCode)); + log.warn(String.format("获取微信openid失败,app[%s],wxCode[%s]",app,wxCode)); throw new RenException("获取微信openid失败"); } return wxMaJscode2SessionResult; @@ -366,6 +368,10 @@ public class LoginServiceImpl implements LoginService { } else { logger.error(String.format("运营人员%s退出成功,清空菜单和权限redis异常", tokenDto.getUserId())); } + //如果是工作端退出,删除当前工作人员缓存 + if(AppClientConstant.APP_GOV.equals(tokenDto.getApp())){ + CustomerStaffRedis.delStaffInfoFormCache(tokenDto.getCustomerId(),tokenDto.getUserId()); + } return new Result(); } 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 91812aaeda..c7c79bb575 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 @@ -34,11 +34,13 @@ import com.epmet.dto.dingres.V2UserGetuserinfoResDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.feign.EpmetMessageOpenFeignClient; +import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.jwt.JwtTokenProperties; import com.epmet.jwt.JwtTokenUtils; import com.epmet.redis.CaptchaRedis; +import com.epmet.service.GovWebService; import com.epmet.service.ThirdLoginService; import com.taobao.api.ApiException; import com.taobao.dingtalk.client.DingTalkClientToken; @@ -90,6 +92,10 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol private DingTalkClientToken dingTalkClientToken; @Autowired private DingTalkClientUser dingTalkClientUser; + @Autowired + private EpmetUserFeignClient epmetUserFeignClient; + @Autowired + private GovWebService govWebService; /** * @param formDTO @@ -920,7 +926,7 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol } @Override - public ResiDingAppLoginResDTO resiLoginDingMd(ResiDingAppLoginMdFormDTO formDTO) { + public ResiDingAppLoginResDTO resiLoginDingMd(DingAppLoginMdFormDTO formDTO) { // 获取用户手机号 log.info("1、钉钉居民端应用登录入参:" + JSON.toJSONString(formDTO)); ResiDingAppLoginResDTO resDTO = null; @@ -1020,17 +1026,16 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol * @return */ @Override - public ResiDingAppLoginResDTO resiLoginInternalDing(ResiDingAppLoginMdFormDTO formDTO) { + public ResiDingAppLoginResDTO resiLoginInternalDing(DingAppLoginMdFormDTO formDTO) { // 获取用户手机号 log.info("1、钉钉居民端应用登录入参:" + JSON.toJSONString(formDTO)); - ResiDingAppLoginResDTO resDTO = null; - resDTO = new ResiDingAppLoginResDTO(); + ResiDingAppLoginResDTO resDTO = new ResiDingAppLoginResDTO(); resDTO.setCustomerId(getCurrentCustomerId()); // 1、获取用户手机号 DingLoginResiFormDTO dingLoginResiFormDTO = getDingLoginResiFormDTOInternal(formDTO.getMiniAppId(), formDTO.getAuthCode()); dingLoginResiFormDTO.setCustomerId(resDTO.getCustomerId()); - + resDTO.setRealName(dingLoginResiFormDTO.getNick()); // 2、调用userfeign接口获取userId、注册网格相关信息 Result loginResiResDTOResult = epmetUserOpenFeignClient.dingResiLogin(dingLoginResiFormDTO); if (!loginResiResDTOResult.success() || null == loginResiResDTOResult.getData()) { @@ -1052,6 +1057,26 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol return resDTO; } + @Override + public UserTokenResultDTO govLoginInternalDing(DingAppLoginMdFormDTO formDTO) { + // 获取用户手机号 + log.info("1、钉钉居民端应用登录入参:" + JSON.toJSONString(formDTO)); + ResiDingAppLoginResDTO resDTO = null; + resDTO = new ResiDingAppLoginResDTO(); + resDTO.setCustomerId(getCurrentCustomerId()); + + // 1、获取用户手机号 + DingLoginResiFormDTO dingLoginResiFormDTO = getDingLoginResiFormDTOInternal(formDTO.getMiniAppId(), formDTO.getAuthCode()); + dingLoginResiFormDTO.setCustomerId(resDTO.getCustomerId()); + + + GovWebLoginFormDTO loginGovParam = new GovWebLoginFormDTO(); + loginGovParam.setCustomerId(dingLoginResiFormDTO.getCustomerId()); + loginGovParam.setPhone(dingLoginResiFormDTO.getMobile()); + + return govWebService.loginByThirdPlatform(loginGovParam); + } + /** * 最原始的企业内部应用开发,不授权给产品服务商 * @param miniAppId @@ -1060,12 +1085,14 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol */ private DingLoginResiFormDTO getDingLoginResiFormDTOInternal(String miniAppId, String authCode) { DingMiniInfoCache dingMiniInfo = CustomerDingDingRedis.getDingMiniInfo(miniAppId); - + if (dingMiniInfo == null){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取钉钉应用配置异常", "获取钉钉应用配置异常"); + } // 1、获取企业内部应用的accessToken文档地址:https://open.dingtalk.com/document/orgapp-server/obtain-the-access_token-of-an-internal-app String accessToken = ""; DingTalkResult dingTalkResult = dingTalkClientToken.getAppAccessTokenToken(dingMiniInfo.getSuiteKey(), dingMiniInfo.getSuiteSecret()); if (!dingTalkResult.success() || StringUtils.isBlank(dingTalkResult.getData())) { - log.error(String.format("获取企业内部应用的accessToken失败,customKey:%s,customSecret:%s", dingMiniInfo.getSuiteSecret(), dingMiniInfo.getSuiteSecret())); + log.error(String.format("获取企业内部应用的accessToken失败,customKey:%s,customSecret:%s", dingMiniInfo.getSuiteKey(), dingMiniInfo.getSuiteSecret())); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取企业内部应用的accessToken异常", "获取企业内部应用的accessToken"); } accessToken = dingTalkResult.getData(); 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..462133adfe --- /dev/null +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/CheckMQMsg.java @@ -0,0 +1,31 @@ +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; + +} 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/enums/CoverageEnums.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/CoverageEnums.java index 02f5504d6a..35b60a3fb1 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/CoverageEnums.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/CoverageEnums.java @@ -6,10 +6,10 @@ package com.epmet.commons.tools.enums; public enum CoverageEnums { ZHZL("zhzl", "综合治理图层", 1), - YJCL("yjcl", "应急处置资源", 1), - AQSC("aqsc", "安全生产资源", 1), - CSGL("csgl", "城市管理资源", 1), - GGFW("ggfw", "公共服务资源", 1), + YJCL("yjcl", "应急处置图层", 1), + AQSC("aqsc", "安全生产图层", 1), + CSGL("csgl", "城市管理图层", 1), + GGFW("ggfw", "公共服务图层", 1), DATA_TYPE_GOVERNED_TARGET("governedTarget", "被管理对象", 2), DATA_TYPE_RESOURCES("resources", "资源", 2); 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/processor/MaskProcessor.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/processor/MaskProcessor.java index a3169a2ec6..0ebc34c00c 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/processor/MaskProcessor.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/processor/MaskProcessor.java @@ -15,7 +15,6 @@ import java.lang.reflect.Field; import java.util.Arrays; import java.util.List; import java.util.Map; -import java.util.regex.Pattern; /** * desc:脱敏处理器 @@ -83,6 +82,9 @@ public class MaskProcessor { String maskResult = maskString((String) value, fieldsMaskType.get(index)); entry.setValue(maskResult); } + } else if (value instanceof List) { + // 列表 + ((List)value).forEach(e -> mask(e)); } } } @@ -155,10 +157,12 @@ public class MaskProcessor { // 2个字以上的,首位字母明文,中间* // 中文不能用\\w,要用[\u4e00-\u9fa5] if (length == 2) { - return originString.replaceAll("^([\\u4e00-\\u9fa5]).*$", "$1*"); +// return originString.replaceAll("^([\\u4e00-\\u9fa5]).*$", "$1*"); + return originString.substring(0).concat("*"); } else { String maskStr = StrUtil.repeat("*", length - 2); - return originString.replaceAll("^([\\u4e00-\\u9fa5]).*([\\u4e00-\\u9fa5])$", "$1" + maskStr + "$2"); +// return originString.replaceAll("^([\\u4e00-\\u9fa5]).*([\\u4e00-\\u9fa5])$", "$1" + maskStr + "$2"); + return originString.charAt(0) + maskStr + originString.charAt(originString.length() - 1); } } @@ -168,7 +172,7 @@ public class MaskProcessor { * @param originString * @return */ - private String maskIdCard(String originString) { + public static String maskIdCard(String originString) { IdCardRegexUtils regexUtil = IdCardRegexUtils.parse(originString); if (regexUtil == null) { @@ -216,7 +220,9 @@ public class MaskProcessor { public static void main(String[] args) { String[] idc = {"idCard"}; String[] idct = {MaskResponse.MASK_TYPE_ID_CARD}; - String r = new MaskProcessor(idc, idct).maskString("333333333333333333", MaskResponse.MASK_TYPE_ID_CARD); + String r = new MaskProcessor(idc, idct).maskString("王五(372284152412022222)", MaskResponse.MASK_TYPE_ID_CARD); System.out.println(r); + String s = MaskProcessor.maskIdCard("372284152412022222"); + System.out.println(s); } } 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/CustomerOrgRedis.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java index 7cb132b0f5..3945081261 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java @@ -13,6 +13,7 @@ import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; @@ -111,4 +112,36 @@ public class CustomerOrgRedis { customerOrgRedis.redisUtils.delete(key); } + /** + * 拼接orgIdPath + * @param orgId + * @param orgType + * @return + */ + public static String getOrgIdPath(String orgId, String orgType) { + String orgPids = null; + + if ("grid".equals(orgType)) { + GridInfoCache gridInfo = getGridInfo(orgId); + if (gridInfo == null) { + log.error("查询网格信息失败:{}", orgId); + return null; + } + orgPids = gridInfo.getPids(); + } else if ("agency".equals(orgType)) { + AgencyInfoCache agencyInfo = getAgencyInfo(orgId); + if (agencyInfo == null) { + log.error("查询组织信息失败:{}", orgId); + return null; + } + orgPids = agencyInfo.getPids(); + } + + if (StringUtils.isBlank(orgPids) || "0".equals(orgPids)) { + return orgId; + } + + return orgPids.concat(":").concat(orgId); + } + } 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..39e1995d9b 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); 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..3f72228656 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,9 @@ package com.epmet.commons.tools.utils; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +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,14 +18,73 @@ import java.util.Map; */ @Slf4j public class YtHsResUtils { - private static String URL = "http://10.2.2.60:8191/sjzt/server/hsjcxx"; + private static String SERVER_URL = "http://10.2.2.60:8191/sjzt/server/"; private static final String APP_KEY_VALUE = "DR4jF5Be7sCsqDmCamq2tmYCl"; private static final String APP_KEY = "appkey"; private static final String CARD_NO = "card_no"; + private static final String USER_NAME = "name"; private static final String ROW_NUM = "ROWNUM"; private static final String PAGE_SIZE = "PAGESIZE"; + private static final String START = "ROWNUM"; + private static final String LIMIT = "PAGESIZE"; + + /** + * desc:核酸采样查询 + * + * @return + */ + public static YtHscyResDTO hscy(String cardNo, Integer rowNum, Integer pageSize) { + try { + 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("hscy api param:{}", param); + //todo 核酸检测 mock数据 放开她 + //Result result = HttpClientManager.getInstance().sendGet(SERVER_URL+"hscyxxcx", param); + String mockData = "{\n" + + " \"code\":0,\n" + + " \"msg\":\"success\",\n" + + " \"data\":[{\n" + + " \"id\": \"1570924677539635484\",\n" + + " \"name\": \"杨XX\",\n" + + " \"card_type\": \"1\",\n" + + " \"card_no\": \"370283199912010302\",\n" + + " \"create_by\": \"370613594\",\n" + + " \"create_time\": \"2022-09-17 07:15:22\",\n" + + " \"sys_org_code\": \"370613\",\n" + + " \"sample_tube\": \"GCJ-0825-0441\",\n" + + " \"package_id\": \"bcj00208083952\",\n" + + " \"city\": \"烟台市\",\n" + + " \"uuid\": \"6225684525062602095\",\n" + + " \"county\": \"莱山区\",\n" + + " \"depart_ids\": \"未填写\",\n" + + " \"depart_name\": null,\n" + + " \"realname\": \"采样点327\",\n" + + " \"upload_time\": \"2022-09-17 07:56:45\",\n" + + " \"sd_id\": null,\n" + + " \"sd_batch\": null,\n" + + " \"sd_operation\": null,\n" + + " \"sd_time\": null,\n" + + " \"inserttime\": \"2022-09-17 09:36:20\"\n" + + "}]\n" + + "}"; + Result result = new Result().ok(mockData); + log.info("hscy api result:{}", JSON.toJSONString(result)); + if (result.success()) { + return JSON.parseObject(result.getData(), YtHscyResDTO.class); + } + } 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 */ @@ -30,24 +92,166 @@ public class YtHsResUtils { 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, APP_KEY_VALUE); + param.put(CARD_NO, cardNo); + param.put(ROW_NUM, rowNum); + param.put(PAGE_SIZE, pageSize); + log.info("hsjc api param:{}", param); + //todo 核酸检测 mock数据 放开她 + //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-17 07:15:22\",\"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); } } 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, APP_KEY_VALUE); + param.put("id_card", cardNo); + param.put("name", userName); + param.put("start", 0); + param.put("limit", 1); + + log.info("siWang api param:{}", param); + + //todo 放开他 + //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)); + String data = result.getData(); + JSONObject jsonObject = JSON.parseObject(data); + //他们的结果是成功的 + if (jsonObject != null && "200".equals(jsonObject.getString("code"))) { + //第一层 + JSONObject firstData = JSON.parseObject(jsonObject.getString("data")); + + //第二层 data + if (firstData != null && "200".equals(firstData.getString("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, APP_KEY_VALUE); + param.put("citizenId", idCard); + param.put("name", userName); + + log.info("canji api param:{}", param); + + + //todo 上线放开她 + //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()) { + /*返回示例 + { + "code":"200", + "msg":"请求成功", + "data":"{ + \"code\":200, + \"data\":{ + \\\"result\\\":true, + \\\"errorcode\\\":0, + \\\"msg\\\":\\\"获取成功\\\", + \\\"data\\\":{ + \\\"isNewRecord\\\":\\\"true\\\", + } + } + \"message\":\"\" + }", + "total":0 + } + */ + String data = result.getData(); + JSONObject jsonObject = JSON.parseObject(data); + //他们的结果是成功的 + if (jsonObject != null && "200".equals(jsonObject.getString("code"))) { + //第一层data + JSONObject realObject = JSON.parseObject(jsonObject.getString("data")); + + if (realObject != null && "200".equals(realObject.getString("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/src/main/java/com/epmet/dataaggre/controller/CoverageController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/CoverageController.java index 7a451a9f94..7815998386 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/CoverageController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/CoverageController.java @@ -1,6 +1,7 @@ package com.epmet.dataaggre.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.MaskResponse; import com.epmet.commons.tools.dto.result.ZhzlCategorySelectDTO; import com.epmet.commons.tools.enums.ZhzlResiCategoryEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; @@ -74,6 +75,7 @@ public class CoverageController { * @author zxc * @date 2022/7/26 16:29 */ + @MaskResponse(fieldNames = {"mobile","idCard"}, fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE,MaskResponse.MASK_TYPE_ID_CARD}) @PostMapping("search") public Result coverageHomeSearch(@RequestBody CoverageHomeSearchFormDTO formDTO, @LoginUser TokenDto tokenDto){ formDTO.setCustomerId(tokenDto.getCustomerId()); diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/CoverageServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/CoverageServiceImpl.java index ff931888c3..f4553cd9b8 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/CoverageServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/CoverageServiceImpl.java @@ -9,6 +9,7 @@ import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.processor.MaskProcessor; import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis; import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; @@ -670,7 +671,7 @@ public class CoverageServiceImpl implements CoverageService { return new CoverageAnalisisDataListResultDTO( re.getId(), categoryKey, isPage ? categoryDict.getCategoryName() : null, placeType, - re.getName().concat(StrConstant.BRACKET_LEFT).concat(re.getIdCard()).concat(StrConstant.BRACKET_RIGNT), + re.getName().concat(StrConstant.BRACKET_LEFT).concat(MaskProcessor.maskIdCard(re.getIdCard())).concat(StrConstant.BRACKET_RIGNT), coordinates[1], coordinates[0]); }).collect(Collectors.toList()); @@ -684,7 +685,7 @@ public class CoverageServiceImpl implements CoverageService { return new CoverageAnalisisDataListResultDTO( re.getId(), categoryKey, isPage ? categoryDict.getCategoryName() : null, placeType, - re.getName().concat(StrConstant.BRACKET_LEFT).concat(re.getIdNum()).concat(StrConstant.BRACKET_RIGNT), + re.getName().concat(StrConstant.BRACKET_LEFT).concat(MaskProcessor.maskIdCard(re.getIdNum())).concat(StrConstant.BRACKET_RIGNT), coordinates[1], coordinates[0]); }).collect(Collectors.toList()); @@ -1276,4 +1277,4 @@ public class CoverageServiceImpl implements CoverageService { } return resultList; } -} \ No newline at end of file +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/constant/DataSourceConstant.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/constant/DataSourceConstant.java index d1e438d81a..d73da4247f 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/constant/DataSourceConstant.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/constant/DataSourceConstant.java @@ -7,5 +7,6 @@ public interface DataSourceConstant { */ String EVALUATION_INDEX = "evaluationIndex"; String STATS_DISPLAY = "statsDisplay"; + String STATS = "stats"; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/stats/UserHouseStatsQueryFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/stats/UserHouseStatsQueryFormDTO.java new file mode 100644 index 0000000000..ca6ea589fb --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/stats/UserHouseStatsQueryFormDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.form.stats; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; + +/** + * 人房信息查询dto + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class UserHouseStatsQueryFormDTO { + + private String orgId; + private String orgType; + + @NotBlank(message = "dateId不能为空") + private String dateId; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/feign/DataReportOpenFeignClient.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/feign/DataReportOpenFeignClient.java index 862013f1a6..97771d20f0 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/feign/DataReportOpenFeignClient.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/feign/DataReportOpenFeignClient.java @@ -2,11 +2,15 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.stats.UserHouseStatsQueryFormDTO; import com.epmet.dto.result.plugins.AgencyNodeDTO; import com.epmet.feign.impl.DataReportOpenFeignClientFallBackFactory; +import com.epmet.stats.UserHouseStatsResultDTO; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 @@ -24,4 +28,12 @@ public interface DataReportOpenFeignClient { **/ @GetMapping("/data/report/screen/agency/querystaffagencytree/{agencyId}") Result queryStaffAgencyTree(@PathVariable("agencyId") String agencyId); + + /** + * 通过dateId查询人房统计信息 + * @param input 3个参数,就不用dto了,类太多: + * @return + */ + @PostMapping("/data/report/userHouse/getUserHouseDailyStatsByDateId") + Result getUserHouseDailyStatsByDateId(@RequestBody UserHouseStatsQueryFormDTO input); } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/feign/impl/DataReportOpenFeignClientFallBack.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/feign/impl/DataReportOpenFeignClientFallBack.java index 247fe4499b..efc784a8b3 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/feign/impl/DataReportOpenFeignClientFallBack.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/feign/impl/DataReportOpenFeignClientFallBack.java @@ -3,8 +3,10 @@ package com.epmet.feign.impl; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.stats.UserHouseStatsQueryFormDTO; import com.epmet.dto.result.plugins.AgencyNodeDTO; import com.epmet.feign.DataReportOpenFeignClient; +import com.epmet.stats.UserHouseStatsResultDTO; //@Component public class DataReportOpenFeignClientFallBack implements DataReportOpenFeignClient { @@ -17,4 +19,9 @@ public class DataReportOpenFeignClientFallBack implements DataReportOpenFeignCli public Result queryStaffAgencyTree(String agencyId) { return ModuleUtils.feignConError(ServiceConstant.DATA_REPORT_SERVER, "queryStaffAgencyTree",agencyId); } + + @Override + public Result getUserHouseDailyStatsByDateId(UserHouseStatsQueryFormDTO input) { + return ModuleUtils.feignConError(ServiceConstant.DATA_REPORT_SERVER, "getUserHouseDailyStatsByDateId",input); + } } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/stats/UserHouseStatsResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/stats/UserHouseStatsResultDTO.java new file mode 100644 index 0000000000..654bfed4cf --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/stats/UserHouseStatsResultDTO.java @@ -0,0 +1,18 @@ +package com.epmet.stats; + +import lombok.Data; + +/** + * 人房信息统计 + */ +@Data +public class UserHouseStatsResultDTO { + private Integer houseTotal = 0; + private Integer zzHouseTotal = 0; + private Integer czHouseTotal = 0; + private Integer xzHouseTotal = 0; + private Integer userTotal = 0; + private Integer czUserTotal = 0; + private Integer ldUserTotal = 0; + private Integer usingCommunityNum = 0; +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/stats/UserHouseController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/stats/UserHouseController.java new file mode 100644 index 0000000000..9556299271 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/stats/UserHouseController.java @@ -0,0 +1,37 @@ +package com.epmet.datareport.controller.stats; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.datareport.service.stats.UserHouseStatsService; +import com.epmet.dto.form.stats.UserHouseStatsQueryFormDTO; +import com.epmet.stats.UserHouseStatsResultDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("userHouse") +public class UserHouseController { + + @Autowired + private UserHouseStatsService userHouseStatsService; + + /** + * 通过dateId查询人房统计信息 + * @param input + * @return + */ + @PostMapping("getUserHouseDailyStatsByDateId") + public Result getUserHouseDailyStatsByDateId(@RequestBody UserHouseStatsQueryFormDTO input) { + ValidatorUtils.validateEntity(input); + String orgId = input.getOrgId(); + String orgType = input.getOrgType(); + String dateId = input.getDateId(); + + UserHouseStatsResultDTO r = userHouseStatsService.getUserHouseDailyStats(orgId, orgType, dateId); + return new Result().ok(r); + } + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/stats/FactAgencyUserHouseDailyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/stats/FactAgencyUserHouseDailyDao.java new file mode 100644 index 0000000000..bb2c98b36c --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/stats/FactAgencyUserHouseDailyDao.java @@ -0,0 +1,17 @@ +package com.epmet.datareport.dao.stats; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.datareport.entity.stats.FactAgencyUserHouseDailyEntity; +import org.apache.ibatis.annotations.Mapper; + + +/** + * 人房信息统计数,按天统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-27 + */ +@Mapper +public interface FactAgencyUserHouseDailyDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/stats/FactGridUserHouseDailyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/stats/FactGridUserHouseDailyDao.java new file mode 100644 index 0000000000..da22c4a27b --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/stats/FactGridUserHouseDailyDao.java @@ -0,0 +1,17 @@ +package com.epmet.datareport.dao.stats; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.datareport.entity.stats.FactGridUserHouseDailyEntity; +import org.apache.ibatis.annotations.Mapper; + + +/** + * 网格的人房信息统计数,按天统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-27 + */ +@Mapper +public interface FactGridUserHouseDailyDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/stats/FactAgencyUserHouseDailyEntity.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/stats/FactAgencyUserHouseDailyEntity.java new file mode 100644 index 0000000000..8bae60daeb --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/stats/FactAgencyUserHouseDailyEntity.java @@ -0,0 +1,115 @@ +package com.epmet.datareport.entity.stats; + +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-05-27 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_agency_user_house_daily") +public class FactAgencyUserHouseDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 数据更新至:yyyyMMdd; + */ + private String dateId; + + /** + * 组织id + */ + private String agencyId; + + /** + * agency_id所属的机关级别(社区级:community, +乡(镇、街道)级:street, +区县级: district, +市级: city +省级:province) + */ + private String level; + + /** + * 组织i所属的组织id + */ + private String pid; + + /** + * 组织i所有上级id + */ + private String pids; + + /** + * 小区总数 + */ + private Integer neighbourhoodsCount; + + /** + * 房屋总数 + */ + private Integer houseCount; + + /** + * 自住房屋总数 + */ + private Integer houseSelfCount; + + /** + * 出租房屋总数 + */ + private Integer houseLeaseCount; + + /** + * 闲置房屋总数 + */ + private Integer houseIdleCount; + + /** + * 居民总数 + */ + private Integer userCount; + + /** + * 常住居民总数 + */ + private Integer userResiCount; + + /** + * 流动居民总数 + */ + private Integer userFloatCount; + + /** + * 当日新增房屋数 + */ + private Integer houseIncr; + + /** + * 当日修改房屋数 + */ + private Integer houseModify; + + /** + * 当日新增居民数 + */ + private Integer userIncr; + + /** + * 当日修改居民数 + */ + private Integer userModify; + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/stats/FactGridUserHouseDailyEntity.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/stats/FactGridUserHouseDailyEntity.java new file mode 100644 index 0000000000..f2aded5df4 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/stats/FactGridUserHouseDailyEntity.java @@ -0,0 +1,106 @@ +package com.epmet.datareport.entity.stats; + +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-05-27 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_grid_user_house_daily") +public class FactGridUserHouseDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 数据更新至:yyyyMMdd; + */ + private String dateId; + + /** + * 网格id + */ + private String gridId; + + /** + * 网格所属的组织id + */ + private String pid; + + /** + * 网格所有上级id + */ + private String pids; + + /** + * 小区总数 + */ + private Integer neighbourhoodsCount; + + /** + * 房屋总数 + */ + private Integer houseCount; + + /** + * 自住房屋总数 + */ + private Integer houseSelfCount; + + /** + * 出租房屋总数 + */ + private Integer houseLeaseCount; + + /** + * 闲置房屋总数 + */ + private Integer houseIdleCount; + + /** + * 居民总数 + */ + private Integer userCount; + + /** + * 常住居民总数 + */ + private Integer userResiCount; + + /** + * 流动居民总数 + */ + private Integer userFloatCount; + + /** + * 当日新增房屋数 + */ + private Integer houseIncr; + + /** + * 当日修改房屋数 + */ + private Integer houseModify; + + /** + * 当日新增居民数 + */ + private Integer userIncr; + + /** + * 当日修改居民数 + */ + private Integer userModify; + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/stats/UserHouseStatsService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/stats/UserHouseStatsService.java new file mode 100644 index 0000000000..c898ed5ced --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/stats/UserHouseStatsService.java @@ -0,0 +1,19 @@ +package com.epmet.datareport.service.stats; + +import com.epmet.stats.UserHouseStatsResultDTO; +import lombok.extern.slf4j.Slf4j; + +/** + * 人房统计service + */ +public interface UserHouseStatsService { + + /** + * 查询指定dateId的人房统计信息 + * @param orgId + * @param orgType + * @param dateId + * @return + */ + UserHouseStatsResultDTO getUserHouseDailyStats(String orgId, String orgType, String dateId); +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/stats/impl/UserHouseStatsServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/stats/impl/UserHouseStatsServiceImpl.java new file mode 100644 index 0000000000..e03c81ac8a --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/stats/impl/UserHouseStatsServiceImpl.java @@ -0,0 +1,87 @@ +package com.epmet.datareport.service.stats.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.commons.tools.utils.EpmetRequestHolder; +import com.epmet.constant.DataSourceConstant; +import com.epmet.datareport.dao.stats.FactAgencyUserHouseDailyDao; +import com.epmet.datareport.dao.stats.FactGridUserHouseDailyDao; +import com.epmet.datareport.entity.stats.FactAgencyUserHouseDailyEntity; +import com.epmet.datareport.entity.stats.FactGridUserHouseDailyEntity; +import com.epmet.datareport.service.stats.UserHouseStatsService; +import com.epmet.stats.UserHouseStatsResultDTO; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Slf4j +@Service +@DataSource(DataSourceConstant.STATS) +public class UserHouseStatsServiceImpl implements UserHouseStatsService { + + @Autowired + private FactGridUserHouseDailyDao factGridUserHouseDailyDao; + + @Autowired + private FactAgencyUserHouseDailyDao factAgencyUserHouseDailyDao; + + @Override + public UserHouseStatsResultDTO getUserHouseDailyStats(String orgId, String orgType, String dateId) { + // 没有传参,使用当前登录人的 + if (StringUtils.isEmpty(orgId) || StringUtils.isEmpty(orgType)) { + String userId = EpmetRequestHolder.getLoginUserId(); + String customerId = EpmetRequestHolder.getLoginUserCustomerId(); + + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId); + if (null == staffInfo) { + throw new EpmetException(String.format("查询工作人员%s缓存信息失败:%s", userId)); + } + + orgId = staffInfo.getAgencyId(); + orgType = "agency"; + } + + // 结果对象初始化 + UserHouseStatsResultDTO result = new UserHouseStatsResultDTO(); + + if ("agency".equals(orgType)) { + // 查询的目标是组织 + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(FactAgencyUserHouseDailyEntity::getDateId, dateId); + query.eq(FactAgencyUserHouseDailyEntity::getAgencyId, orgId); + FactAgencyUserHouseDailyEntity agencyDailyStats = factAgencyUserHouseDailyDao.selectOne(query); + if (agencyDailyStats != null) { + result.setHouseTotal(agencyDailyStats.getHouseCount()); + result.setCzHouseTotal(agencyDailyStats.getHouseLeaseCount()); + result.setXzHouseTotal(agencyDailyStats.getHouseIdleCount()); + result.setZzHouseTotal(agencyDailyStats.getHouseSelfCount()); + result.setUserTotal(agencyDailyStats.getUserCount()); + result.setCzUserTotal(agencyDailyStats.getUserResiCount()); + result.setLdUserTotal(agencyDailyStats.getUserFloatCount()); + } + } else { + // 查询的目标是网格 + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(FactGridUserHouseDailyEntity::getDateId, dateId); + query.eq(FactGridUserHouseDailyEntity::getGridId, orgId); + FactGridUserHouseDailyEntity gridDailyStats = factGridUserHouseDailyDao.selectOne(query); + if (gridDailyStats != null) { + result.setHouseTotal(gridDailyStats.getHouseCount()); + result.setCzHouseTotal(gridDailyStats.getHouseLeaseCount()); + result.setXzHouseTotal(gridDailyStats.getHouseIdleCount()); + result.setZzHouseTotal(gridDailyStats.getHouseSelfCount()); + result.setUserTotal(gridDailyStats.getUserCount()); + result.setCzUserTotal(gridDailyStats.getUserResiCount()); + result.setLdUserTotal(gridDailyStats.getUserFloatCount()); + } + } + + return result; + } +} diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/stats/FactAgencyUserHouseDailyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/stats/FactAgencyUserHouseDailyDao.xml new file mode 100644 index 0000000000..8168105c8b --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/stats/FactAgencyUserHouseDailyDao.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml new file mode 100644 index 0000000000..37ae699771 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java index b0f519a3ac..418b3dc251 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java @@ -833,7 +833,7 @@ public class AreaCodeServiceImpl extends BaseServiceImpl> page(@RequestParam Map params){ + PageData page = dingMiniInfoService.page(params); + return new Result>().ok(page); + } + + @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + DingMiniInfoDTO data = dingMiniInfoService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody DingMiniInfoDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + dingMiniInfoService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody DingMiniInfoDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + dingMiniInfoService.update(dto); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + dingMiniInfoService.delete(ids); + return new Result(); + } + + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/DingMiniInfoDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/DingMiniInfoDao.java new file mode 100644 index 0000000000..3e3d84793b --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/DingMiniInfoDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.DingMiniInfoEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 钉钉小程序信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-14 + */ +@Mapper +public interface DingMiniInfoDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/DingMiniInfoEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/DingMiniInfoEntity.java new file mode 100644 index 0000000000..e2be67a8a4 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/DingMiniInfoEntity.java @@ -0,0 +1,55 @@ +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-09-14 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ding_mini_info") +public class DingMiniInfoEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String suiteId; + + /** + * + */ + private String appId; + + /** + * + */ + private String miniAppId; + + /** + * + */ + private String suiteName; + + /** + * + */ + private String suiteKey; + + /** + * + */ + private String suiteSecret; + + private String token; + + private String aesKey; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/DingMiniInfoService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/DingMiniInfoService.java new file mode 100644 index 0000000000..a57b3b3cfa --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/DingMiniInfoService.java @@ -0,0 +1,78 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.DingMiniInfoDTO; +import com.epmet.entity.DingMiniInfoEntity; + +import java.util.List; +import java.util.Map; + +/** + * 钉钉小程序信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-14 + */ +public interface DingMiniInfoService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-09-14 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-09-14 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return DingMiniInfoDTO + * @author generator + * @date 2022-09-14 + */ + DingMiniInfoDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-09-14 + */ + void save(DingMiniInfoDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-09-14 + */ + void update(DingMiniInfoDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-09-14 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/DingMiniInfoServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/DingMiniInfoServiceImpl.java new file mode 100644 index 0000000000..7e8579d139 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/DingMiniInfoServiceImpl.java @@ -0,0 +1,82 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.DingMiniInfoDao; +import com.epmet.dto.DingMiniInfoDTO; +import com.epmet.entity.DingMiniInfoEntity; +import com.epmet.service.DingMiniInfoService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 钉钉小程序信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-14 + */ +@Service +public class DingMiniInfoServiceImpl extends BaseServiceImpl implements DingMiniInfoService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, DingMiniInfoDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, DingMiniInfoDTO.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 DingMiniInfoDTO get(String id) { + DingMiniInfoEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, DingMiniInfoDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(DingMiniInfoDTO dto) { + DingMiniInfoEntity entity = ConvertUtils.sourceToTarget(dto, DingMiniInfoEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(DingMiniInfoDTO dto) { + DingMiniInfoEntity entity = ConvertUtils.sourceToTarget(dto, DingMiniInfoEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.14__add_ding_table.sql b/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.14__add_ding_table.sql index 9d13ecb53c..82573c8761 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.14__add_ding_table.sql +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.14__add_ding_table.sql @@ -33,13 +33,13 @@ INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_AP CREATE TABLE `open_sync_biz_data` ( - `ID` varchar(255) NOT NULL, + `ID` varchar(64) NOT NULL, `SUITE_KEY` varchar(255) DEFAULT NULL, `SUBSCRIBE_ID` varchar(255) NOT NULL COMMENT '第三方企业应用的suiteid加下划线0', `CORP_ID` varchar(255) NOT NULL COMMENT '第三方企业应用的corpid', `BIZ_ID` varchar(255) NOT NULL COMMENT '第三方企业应用的suiteid', `BIZ_DATA` json NOT NULL COMMENT '数据为Json格式', - `BIZ_TYPE` varchar(10) NOT NULL COMMENT '2:第三方企业应用票据;\n4:企业授权变更,包含授权、解除授权、授权变更;\n7:第三方企业应用变更,包含停用、启用、删除(删除保留授权);\n13:企业用户变更,包含用户添加、修改、删除;\n14:企业部门变更,包含部门添加、修改、删除;\n15:企业角色变更,包含角色添加、修改、删除;\n16:企业变更,包含企业修改、删除;\n17:市场订单;\n20:企业外部联系人变更,包含添加、修改、删除;\n22:ISV自定义审批;\n25:家校通讯录1.0(Deprecated)信息变更。家校通讯录升级,请查看家校通讯录2.0数据推送;\n32:智能硬件绑定类型;\n37:因订单到期或者用户退款等导致的服务关闭,目前仅推送因退款等导致的服务关闭;\n50:家校通讯录2.0,部门信息变更;\n51:家校通讯录2.0,人员信息变更;\n63:应用试用记录回调信息;\n66:工作台组件变更回调事件;\n67:钉钉假期相关回调事件;\n133:CRM客户动态相关数据回调事件;\n137:人事平台员工异动V2相关数据回调事件;\n139:异步转译通讯录id任务完成通知;\n165:人事平台员工档案变动事件相关数据的回调事件;\n175:人事解决方案变更事件;', + `BIZ_TYPE` varchar(10) NOT NULL COMMENT '2:第三方企业应用票据;', `DEL_FLAG` int(1) NOT NULL, `REVISION` int(1) NOT NULL, `CREATED_TIME` datetime NOT NULL, @@ -48,4 +48,4 @@ CREATE TABLE `open_sync_biz_data` `UPDATED_BY` varchar(255) NOT NULL, PRIMARY KEY (`ID`) USING BTREE ) ENGINE = InnoDB - DEFAULT CHARSET = utf8mb4; \ No newline at end of file + DEFAULT CHARSET = utf8mb4; diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/DingMiniInfoDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/DingMiniInfoDao.xml new file mode 100644 index 0000000000..e812ece013 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/DingMiniInfoDao.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/test/java/com/epmet/ThirdPlatformTest.java b/epmet-module/epmet-third/epmet-third-server/src/main/test/java/com/epmet/ThirdPlatformTest.java index 02c064c0de..bd5671a8cf 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/test/java/com/epmet/ThirdPlatformTest.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/test/java/com/epmet/ThirdPlatformTest.java @@ -1,7 +1,5 @@ package com.epmet; -import com.alibaba.fastjson.JSON; -import com.aliyun.dingtalk.module.DingTalkResult; import com.taobao.dingtalk.client.DingTalkClientToken; import lombok.extern.slf4j.Slf4j; import org.junit.Test; @@ -24,7 +22,7 @@ public class ThirdPlatformTest { @Test public void sendText(){ - DingTalkResult appAccessTokenToken = dingTalkClientToken.getAppAccessTokenToken(); - System.out.println("=======:"+JSON.toJSONString(appAccessTokenToken)); + /* DingTalkResult appAccessTokenToken = dingTalkClientToken.getAppAccessTokenToken(); + System.out.println("=======:"+JSON.toJSONString(appAccessTokenToken));*/ } } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/GovMenuController.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/GovMenuController.java index cc94cd91f0..ef763f4a43 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/GovMenuController.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/GovMenuController.java @@ -106,6 +106,7 @@ public class GovMenuController { /** * 导航 + * +数字社区-系统管理-角色管理配置角色权限,也会调用此接口 * @param tokenDto token * @return List */ 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..3f7dfdcbc4 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,13 +234,22 @@ public class GovMenuServiceImpl extends BaseServiceImpl navDigitalCommunity(TokenDto tokenDto, String tableName) { tableName = getTableName(tableName); - List menuList = baseDao.getCustomerMenuList(tokenDto.getCustomerId(), MenuTypeEnum.MENU.value(), HttpContextUtils.getLanguage(),tableName); + List menuList=new ArrayList<>(); + if("gov_menu".equals(tableName)){ + // 管理平台菜单返回所有的 + menuList = baseDao.getCustomerMenuList(tokenDto.getCustomerId(),null, HttpContextUtils.getLanguage(),tableName); + }else{ + //数据分析还是沿用原来的 + menuList = baseDao.getCustomerMenuList(tokenDto.getCustomerId(), MenuTypeEnum.MENU.value(), HttpContextUtils.getLanguage(),tableName); + } Result isRootManager = epmetUserOpenFeignClient.getIsRootManager(tokenDto.getUserId()); if (!isRootManager.success()){ throw new EpmetException("getIsRootManager method is failure"); @@ -249,6 +258,11 @@ public class GovMenuServiceImpl extends BaseServiceImpl govMenuDTOS = ConvertUtils.sourceToTarget(menuList, GovMenuDTO.class); return TreeUtils.buildTree(govMenuDTOS); } + /*for(GovMenuEntity m:menuList){ + if("ic_resi_add".equals(m.getPermissions())){ + logger.info("1、菜单返回了新增居民"); + } + }*/ disposeGovMenu(menuList,tokenDto.getUserId()); Map> groupByStatus = menuList.stream().collect(Collectors.groupingBy(GovMenuEntity::getRoleStatus)); List dtoList = ConvertUtils.sourceToTarget(CollectionUtils.isEmpty(groupByStatus.get(true)) ? new ArrayList<>() : groupByStatus.get(true), GovMenuDTO.class); @@ -284,11 +298,17 @@ public class GovMenuServiceImpl extends BaseServiceImpl(); return; } + // logger.info("==roleIdList="+ JSON.toJSONString(roleIdList)); List menuIdsList = govRoleMenuDao.getMenuIdsList(roleIdList); if (CollectionUtils.isEmpty(menuIdsList)){ menuList = new ArrayList<>(); return; } + /*for(String mid:menuIdsList){ + if("1581827798717898754".equals(mid)){ + logger.info("2、角色也有此菜单"); + } + }*/ for (String id : menuIdsList) { for (GovMenuEntity m : menuList) { if (m.getId().equals(id)){ diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/GovMenuDao.xml b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/GovMenuDao.xml index 6bc815e44d..7a005b3c02 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/GovMenuDao.xml +++ b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/GovMenuDao.xml @@ -47,9 +47,16 @@ select t1.*, lang.field_value name from gov_menu t1 - INNER join gov_language lang on lang.table_name=#{tableName} and lang.field_name='name' and lang.table_id=t1.id and lang.language=#{language} - RIGHT JOIN gov_customer_menu m ON t1.id = m.TABLE_ID - where t1.del_flag = 0 AND m.del_flag = 0 + INNER join gov_language lang + on (lang.table_name=#{tableName} + and lang.field_name='name' + and lang.table_id=t1.id + and lang.language=#{language} + ) + RIGHT JOIN gov_customer_menu m + ON t1.id = m.TABLE_ID + where t1.del_flag = 0 + AND m.del_flag = 0 and t1.type = #{type} 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 49a21f262e..fe92bcd3c2 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 @@ -12,4 +12,6 @@ public interface NeighborhoodConstant { String BUILDING = "building"; String HOUSE = "house"; + String IC_RESI_USER = "icResiUser"; + } 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-client/src/main/java/com/epmet/dto/form/CommunityUserHouseStatsFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommunityUserHouseStatsFormDTO.java new file mode 100644 index 0000000000..075dc08b7c --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommunityUserHouseStatsFormDTO.java @@ -0,0 +1,15 @@ +package com.epmet.dto.form; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class CommunityUserHouseStatsFormDTO { + private String orgId; + private String orgType; + private Integer pageNo = 1; + private Integer pageSize = 10; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DetailByTypeFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DetailByTypeFormDTO.java new file mode 100644 index 0000000000..45fc98f517 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DetailByTypeFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/10/17 13:42 + * @DESC + */ +@Data +public class DetailByTypeFormDTO implements Serializable { + + private static final long serialVersionUID = 8190270734257503603L; + + public interface DetailByTypeForm{} + + @NotBlank(message = "type不能为空",groups = DetailByTypeForm.class) + private String type; + + @NotBlank(message = "id不能为空",groups = DetailByTypeForm.class) + private String id; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UsingCommunityStatsFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UsingCommunityStatsFormDTO.java new file mode 100644 index 0000000000..c8afdd13ea --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UsingCommunityStatsFormDTO.java @@ -0,0 +1,15 @@ +package com.epmet.dto.form; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class UsingCommunityStatsFormDTO { + + private String orgId; + private String orgType; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DetailByTypeResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DetailByTypeResultDTO.java new file mode 100644 index 0000000000..3992215890 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DetailByTypeResultDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/10/17 13:41 + * @DESC + */ +@Data +public class DetailByTypeResultDTO implements Serializable { + + private static final long serialVersionUID = -8067849365791132347L; + + private String idCard; + + private String mobile; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseChartResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseChartResultDTO.java index 61bee2a9cc..eb7ee86152 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseChartResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseChartResultDTO.java @@ -56,6 +56,26 @@ public class HouseChartResultDTO implements Serializable { */ private Double wscHouseRatio = 0.0; + /** + * 房屋总数-较上月 + */ + private Integer houseTotalJSY; + + /** + * 自住房屋树-较上月 + */ + private Integer zzHouseTotalJSY; + + /** + * 出租房屋总数-较上月 + */ + private Integer czHouseTotalJSY; + + /** + * 闲置房屋总数-较上月 + */ + private Integer xzHouseTotalJSY; + @JsonIgnore private Integer num; //1:出租 0:自住 2:闲置 3:未出售 diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseInfoDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseInfoDTO.java index fffaae071c..f6be2d8f83 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseInfoDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseInfoDTO.java @@ -108,4 +108,20 @@ public class HouseInfoDTO implements Serializable { * 二维码地址 */ private String houseQrcodeUrl; + + + /** + * 房主姓名 + */ + private String ownerName; + + /** + * 房主电话 + */ + private String ownerPhone; + + /** + * 房主身份证 + */ + private String ownerIdCard; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubUserHouseListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubUserHouseListResultDTO.java index 45ded6601b..dc5bbe6b52 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubUserHouseListResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubUserHouseListResultDTO.java @@ -79,4 +79,9 @@ public class SubUserHouseListResultDTO implements Serializable { */ private Double ldUserRatio = 0.0; + /** + * 开通平台的社区数 + */ + private Integer usingCommunityNum; + } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/UsingCommunityStatsResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/UsingCommunityStatsResultDTO.java new file mode 100644 index 0000000000..2ba49424b6 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/UsingCommunityStatsResultDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.result; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class UsingCommunityStatsResultDTO { + + /** + * 开通平台社区数 + */ + private Integer usingCommunityNum; + /** + * 开通平台社区数-较上月 + */ + private Integer usingCommunityNumJSY; + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java index 3d86d05fb6..2ab19bc5c1 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java @@ -613,5 +613,14 @@ public class AgencyController { return new Result>().ok(agencyService.getCustomerTree(tokenDto)); } - + /** + * 开通平台的社区数统计 + * @return + */ + @RequestMapping("usingCommunityStats") + public Result usingCommunityStats(@RequestBody UsingCommunityStatsFormDTO input) { + String orgId = input.getOrgId(); + String orgType = input.getOrgType(); + return new Result().ok(agencyService.usingCommunityStats(orgId, orgType)); + } } 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..6282777484 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"); @@ -629,4 +661,20 @@ public class HouseController implements ResultDataResolver { return new Result>().ok(houseService.houseStatisListDetail(formDTO)); } + /** + * 针对社区的人房统计列表 + * @return + */ + @PostMapping("usingCommunityUserHouseStats") + public Result> communityUserHouseStats(@RequestBody CommunityUserHouseStatsFormDTO input) { + + String orgId = input.getOrgId(); + String orgType = input.getOrgType(); + Integer pageNo = input.getPageNo(); + Integer pageSize = input.getPageSize(); + + PageData r = houseService.usingCommunityUserHouseStats(orgId, orgType, pageNo, pageSize); + return new Result>().ok(r); + } + } 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 6d828df25a..00a9076821 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,20 +18,17 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.MaskResponse; import com.epmet.commons.tools.dto.form.PageFormDTO; import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.IcHouseDTO; -import com.epmet.dto.IcVaccinePrarmeterDTO; import com.epmet.dto.form.CheckHouseInfoFormDTO; +import com.epmet.dto.form.DetailByTypeFormDTO; import com.epmet.dto.form.HouseFormDTO; -import com.epmet.dto.form.VaccinePrarmeterListFormDTO; -import com.epmet.dto.result.HouseAgencyInfoResultDTO; -import com.epmet.dto.result.HouseInfoDTO; -import com.epmet.dto.result.HouseListResultDTO; -import com.epmet.dto.result.HousesNameResultDTO; +import com.epmet.dto.result.*; import com.epmet.service.IcHouseService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -53,6 +50,7 @@ public class IcHouseController { @Autowired private IcHouseService icHouseService; + @MaskResponse(fieldNames = { "showOwnerPhone", "showOwnerIdCard" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD }) @GetMapping("{id}") public Result get(@PathVariable("id") String id) { IcHouseDTO data = icHouseService.get(id); @@ -154,6 +152,17 @@ public class IcHouseController { ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class); formDTO.setCustomerId(tokenDto.getCustomerId()); 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/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java index 37e8d93c98..fb1fc77855 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java @@ -27,6 +27,7 @@ import com.epmet.entity.CustomerAgencyEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.Date; import java.util.List; /** @@ -387,5 +388,15 @@ public interface CustomerAgencyDao extends BaseDao { */ CustomerAgencyEntity getAgencyByUserId(@Param("userId") String userId, @Param("customerId") String customerId); + /** + * 开通社区列表 + * @param agencyId 机关组织的id + * @param agencyOrgIdPath agency的id路径path,包含自己 + * @param endDate 截止日期,也即查询,截止改日期,有多少社区在使用 + * @return + */ + List getUsingCommunityList(@Param("customerId") String customerId, @Param("agencyId") String agencyId, @Param("agencyOrgIdPath") String agencyOrgIdPath, @Param("endDate") Date endDate); + + List getCommunitysByOrgIdPath(@Param("customerId") String customerId, @Param("orgId") String orgId, @Param("orgIdPath") String orgIdPath); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java index 04c73a7756..d7bb4b2564 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java @@ -199,4 +199,9 @@ public interface AgencyService { */ List getCustomerTree(TokenDto tokenDto); + /** + * 开通平台的社区数统计 + * @return + */ + UsingCommunityStatsResultDTO usingCommunityStats(String orgId, String orgType); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java index 239e844523..d1d1b87503 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java @@ -197,4 +197,6 @@ public interface HouseService { PageData listHouses4ReportTest(String houseId, Integer pageNo, Integer pageSize); PageData houseStatisListDetail(HouseChartFormDTO formDTO); + + PageData usingCommunityUserHouseStats(String orgId, String orgType, Integer pageNo, Integer pageSize); } 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..0b2e40f86d 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,13 @@ public interface IcHouseService extends BaseService { * @return */ 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/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java index 10499f4b52..c15458dede 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java @@ -34,9 +34,7 @@ import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.user.LoginUserUtil; -import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.utils.NodeTreeUtils; -import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.*; import com.epmet.constant.CustomerAgencyConstant; import com.epmet.constant.OrgInfoConstant; import com.epmet.constant.RoleKeyConstants; @@ -1114,4 +1112,55 @@ public class AgencyServiceImpl implements AgencyService { } + @Override + public UsingCommunityStatsResultDTO usingCommunityStats(String orgId, String orgType) { + String customerId = EpmetRequestHolder.getLoginUserCustomerId(); + String userId = EpmetRequestHolder.getLoginUserId(); + + // 所属组织的上级 + String agencyOrgIdPath = null; + if (StringUtils.isBlank(orgId)) { + // 没有传参数,使用当前登录人员所属的组织去查询 + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId); + if (staffInfo == null) { + String errorMsg = String.format("查询当前工作人员信息失败。staffId:%s", userId); + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), errorMsg, errorMsg); + } + + orgId = staffInfo.getAgencyId(); + orgType = "agency"; + +// agencyOrgIdPath = getOrgIdPath(staffInfo); + } + + if ("agency".equals(orgType)) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + calendar.set(Calendar.DAY_OF_MONTH, 1); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + Date endTime = calendar.getTime(); + + AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(orgId); + agencyOrgIdPath = getOrgIdPath(agencyInfo.getPids(), agencyInfo.getId()); + List currentUsingCommunityList = customerAgencyDao.getUsingCommunityList(customerId, orgId, agencyOrgIdPath, null); + List preferUsingCommunityList = customerAgencyDao.getUsingCommunityList(customerId, orgId, agencyOrgIdPath, endTime); + return new UsingCommunityStatsResultDTO(currentUsingCommunityList.size(), currentUsingCommunityList.size() - preferUsingCommunityList.size()); + } else if ("grid".equals(orgType)) { + // 网格下不会有该数据,给个0 + return new UsingCommunityStatsResultDTO(0, 0); + } + + return null; + } + + private String getOrgIdPath(String orgPids, String orgId) { + if (StringUtils.isBlank(orgPids) || "0".equals(orgPids)) { + return orgId; + } + + return orgPids.concat(":").concat(orgId); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java index de8806a781..53340d24dc 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java @@ -8,6 +8,7 @@ import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.tools.constant.NumConstant; +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.HouseQrcodeEnum; @@ -34,17 +35,17 @@ import com.epmet.constants.ImportTaskConstants; import com.epmet.dao.*; import com.epmet.dto.*; import com.epmet.dto.form.*; +import com.epmet.dto.form.stats.UserHouseStatsQueryFormDTO; import com.epmet.dto.result.*; import com.epmet.entity.*; import com.epmet.enums.*; -import com.epmet.feign.EpmetAdminOpenFeignClient; -import com.epmet.feign.EpmetCommonServiceOpenFeignClient; -import com.epmet.feign.EpmetUserOpenFeignClient; -import com.epmet.feign.OssFeignClient; +import com.epmet.feign.*; import com.epmet.model.HouseInfoModel; import com.epmet.model.ImportHouseInfoListener; +import com.epmet.redis.CustomerAgencyRedis; import com.epmet.redis.IcHouseRedis; import com.epmet.service.*; +import com.epmet.stats.UserHouseStatsResultDTO; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.google.common.cache.Cache; @@ -68,6 +69,7 @@ import java.awt.image.BufferedImage; import java.io.*; import java.net.URLEncoder; import java.text.NumberFormat; +import java.time.LocalDate; import java.util.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; @@ -132,6 +134,9 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { @Autowired private IcBuildingUnitDao icBuildingUnitDao; + @Autowired + private DataReportOpenFeignClient dataReportOpenFeignClient; + @Override @Transactional(rollbackFor = Exception.class) @@ -175,7 +180,9 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { try { entity.setHouseQrcodeUrl(createHouseQrcodeUrl(icHouseDTO.getId(),null)); } catch (Exception e) { - throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"二维码生成失败","二维码生成失败"); + String errorMsg = ExceptionUtils.getErrorStackTrace(e); + log.error("二维码生成失败:"+errorMsg); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"二维码生成失败:","二维码生成失败"); } icHouseDao.updateById(entity); } @@ -716,6 +723,17 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { resultDTO.setWscHouseRatio(Double.valueOf((resultDTO.getHouseTotal() == 0 || resultDTO.getWscHouseTotal() > resultDTO.getHouseTotal()) ? "0" : numberFormat.format(((float) resultDTO.getWscHouseTotal() / (float) resultDTO.getHouseTotal()) * 100))); resultDTO.setOrgId(formDTO.getOrgId()); resultDTO.setOrgType(formDTO.getOrgType()); + + // 加载上个月,该组织的人房统计信息,并且计算较上月信息 + Date lastDayOfLastMonth = DateUtils.getLastDayOfMonth(DateUtils.addDateMonths(new Date(), -1)); + UserHouseStatsQueryFormDTO form = new UserHouseStatsQueryFormDTO(formDTO.getOrgId(), formDTO.getOrgType(), DateUtils.format(lastDayOfLastMonth, "yyyyMMdd")); + UserHouseStatsResultDTO lastMonthUserHouseStats = getResultDataOrThrowsException(dataReportOpenFeignClient.getUserHouseDailyStatsByDateId(form), ServiceConstant.DATA_REPORT_SERVER, + EpmetErrorCode.SERVER_ERROR.getCode(), null, null); + + resultDTO.setHouseTotalJSY(resultDTO.getHouseTotal() - lastMonthUserHouseStats.getHouseTotal()); + resultDTO.setCzHouseTotalJSY(resultDTO.getCzHouseTotal() - lastMonthUserHouseStats.getCzHouseTotal()); + resultDTO.setXzHouseTotalJSY(resultDTO.getXzHouseTotal() - lastMonthUserHouseStats.getXzHouseTotal()); + resultDTO.setZzHouseTotalJSY(resultDTO.getZzHouseTotal() - lastMonthUserHouseStats.getZzHouseTotal()); return resultDTO; } @@ -962,6 +980,20 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { dto.setLdUserRatio(u.getLdUserRatio()); } } + + // 为每一个子级组织,查询开通了多少个社区 + if ("agency".equals(dto.getOrgType())) { + AgencyService agencyService = SpringContextUtils.getBean(AgencyService.class); + if (agencyService != null) { + UsingCommunityStatsResultDTO usingCommunityStats = agencyService.usingCommunityStats(dto.getOrgId(), dto.getOrgType()); + if (usingCommunityStats != null) { + dto.setUsingCommunityNum(usingCommunityStats.getUsingCommunityNum()); + } + } + } else if ("grid".equals(dto.getOrgType())) { + // 网格这项数据为0 + dto.setUsingCommunityNum(0); + } list.add(dto); } return list; @@ -1363,5 +1395,62 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { return new PageData<>(list, pageInfo.getTotal()); } + @Override + public PageData usingCommunityUserHouseStats(String orgId, String orgType, Integer pageNo, Integer pageSize) { + + String customerId = EpmetRequestHolder.getLoginUserCustomerId(); + + if (StringUtils.isBlank(orgId)) { + // 没有传参数,使用当前登录人员所属的组织去查询 + String userId = EpmetRequestHolder.getLoginUserId(); + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId); + if (staffInfo == null) { + String errorMsg = String.format("查询当前工作人员信息失败。staffId:%s", userId); + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), errorMsg, errorMsg); + } + orgId = staffInfo.getAgencyId(); + orgType = "agency"; + } + + PageHelper.startPage(pageNo, pageSize); + List communityIds = customerAgencyDao.getUsingCommunityList(customerId, orgId, CustomerOrgRedis.getOrgIdPath(orgId, orgType), null); + // List communityIds = customerAgencyDao.getCommunitysByOrgIdPath(customerId, orgId, CustomerOrgRedis.getOrgIdPath(orgId, orgType)); + + + // 填充组织信息 + Map communityMap = communityIds.stream().collect(Collectors.toMap(id -> id, id -> concatAgencyNamePath(id))); + List communityUserHouseStats = houseUserChartList(communityIds, communityMap, "agency"); + + return new PageData(communityUserHouseStats, new PageInfo<>(communityIds).getTotal()); + } + + public String concatAgencyNamePath(String agencyId) { + List agencyNamePathList = new ArrayList(); + + AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(agencyId); + if (agencyInfo == null) { + return null; + } + + + String pidsStr = agencyInfo.getPids(); + if (StringUtils.isBlank(pidsStr)) { + // 没有pids,是顶级,直接返回 + agencyNamePathList.add(agencyInfo.getOrganizationName()); + return String.join("-", agencyNamePathList); + } + + String[] pidList = pidsStr.split(":"); + for (String pAgencyId : pidList) { + AgencyInfoCache pAgencyInfo = CustomerOrgRedis.getAgencyInfo(pAgencyId); + if (pAgencyInfo == null) { + continue; + } + agencyNamePathList.add(pAgencyInfo.getOrganizationName()); + } + // 最后把自己加上 + agencyNamePathList.add(agencyInfo.getOrganizationName()); + return String.join("-", agencyNamePathList); + } } 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..a44882b549 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().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("查看"+houseInfo.getAllName()+"房屋的敏感信息"); + msg.setType("checkHouse"); + msg.setTypeDisplay("查看"+houseInfo.getAllName()+"房屋的敏感信息"); + }else if (formDTO.getType().equals(NeighborhoodConstant.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()+"的敏感信息"); + msg.setType("checkIcResiUser"); + msg.setTypeDisplay("查看"+icResiUserInfo.getName()+"的敏感信息"); + } + // 发送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-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml index 8493df5d81..d221f07b12 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml @@ -1011,4 +1011,33 @@ LIMIT 1 + + + + diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml index ed9bc5acd9..6e417b0aed 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml @@ -276,7 +276,10 @@ gr.GRID_NAME, ih.HOUSE_CODE, ih.CODING, - ih.HOUSE_QRCODE_URL + ih.HOUSE_QRCODE_URL, + ih.owner_name, + ih.owner_phone, + ih.owner_id_card FROM ic_house ih left JOIN ic_neighbor_hood n ON ( ih.NEIGHBOR_HOOD_ID = n.id AND n.DEL_FLAG = '0') left JOIN ic_building ib ON ( ih.BUILDING_ID = ib.id AND ib.DEL_FLAG = '0') diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/IcEventController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/IcEventController.java index 5105ca27bf..711e66623d 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/IcEventController.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/IcEventController.java @@ -5,6 +5,7 @@ import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.MaskResponse; import com.epmet.commons.tools.annotation.RequirePermission; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.constant.NumConstant; @@ -274,6 +275,7 @@ public class IcEventController { * @Author sun * @Description 事件管理-详情 **/ + @MaskResponse(fieldNames = { "idCard"}, fieldsMaskType = {MaskResponse.MASK_TYPE_ID_CARD }) @PostMapping("detail") public Result detail(@LoginUser TokenDto tokenDto, @RequestBody IcEventListFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml index dd94828eb2..b0d42f5b0e 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml @@ -57,6 +57,7 @@ e.CUSTOMER_ID = #{customerId} + AND e.DEL_FLAG = '0' and e.HAPPEN_TIME >= #{queryStartTime} and e.HAPPEN_TIME #{queryEndTime} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/TopArticleFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/TopArticleFormDTO.java index 030fc58bd5..f97e610192 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/TopArticleFormDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/TopArticleFormDTO.java @@ -22,5 +22,10 @@ public class TopArticleFormDTO { */ @NotBlank(message = "type不能为空,置顶:top,取消置顶:cancel_top") private String type; + + /** + * 封面图片 + */ + private String imgUrl; } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java index bcbaf69fde..7ab6795c57 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java @@ -432,7 +432,7 @@ public class ArticleController { @PostMapping("topArticle") public Result topArticle(@RequestBody TopArticleFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO); - articleService.topArticle(formDTO.getArticleId(),formDTO.getType()); + articleService.topArticle(formDTO.getArticleId(),formDTO.getType(),formDTO.getImgUrl()); return new Result(); } /** diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java index 4a9269c42c..8f0914bfe4 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java @@ -256,5 +256,5 @@ public interface ArticleService extends BaseService { PublishedListResultDTO detailV2(ArticleListFormDTO formDTO); - void topArticle(String articleId, String type); + void topArticle(String articleId, String type,String imgUrl); } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java index b2099dd2a5..4e94222164 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java @@ -878,7 +878,10 @@ public class ArticleServiceImpl extends BaseServiceImpl params = new HashMap<>(); @@ -1777,7 +1780,7 @@ public class ArticleServiceImpl extends BaseServiceImpl queryWrapper=new LambdaQueryWrapper(); + queryWrapper.eq(ArticleCoverEntity::getArticleId,articleEntity); + if (articleCoverDao.selectCount(queryWrapper) == 0) { + ArticleCoverEntity articleCoverEntity=new ArticleCoverEntity(); + articleCoverEntity.setCustomerId(articleEntity.getCustomerId()); + articleCoverEntity.setArticleId(articleId); + articleCoverEntity.setImgUrl(imgUrl); + articleCoverEntity.setAuditStatus("pass"); + articleCoverDao.insert(articleCoverEntity); + } + } } else if ("cancel_top".equals(type)) { articleEntity.setIsTop(NumConstant.ZERO); } diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/IcPartyMemberDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/IcPartyMemberDTO.java index 9832a35e5e..74c7166a2c 100644 --- a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/IcPartyMemberDTO.java +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/IcPartyMemberDTO.java @@ -63,7 +63,8 @@ public class IcPartyMemberDTO implements Serializable { */ @NotBlank(message = "当前网格id不能为空",groups ={AddGroup.class, UpdateGroup.class}) private String mobile; - + private String showMobile; + private String showIdCard; /** * 身份证号 */ diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/IcPartyMemberController.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/IcPartyMemberController.java index fbddc60fb1..7628cfbb82 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/IcPartyMemberController.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/IcPartyMemberController.java @@ -30,7 +30,6 @@ import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.constants.ImportTaskConstants; import com.epmet.dto.form.IcPartyMemberFormDTO; import com.epmet.dto.form.IcPartyMemberListFormDTO; -import com.epmet.dto.form.ReadIcMessageFormDTO; import com.epmet.dto.result.ImportTaskCommonResultDTO; import com.epmet.dto.result.PartyMemberAgeResultDTO; import com.epmet.dto.result.PartyMemberEducationResultDTO; @@ -90,9 +89,14 @@ public class IcPartyMemberController implements ResultDataResolver { return new Result>().ok(page); } + @MaskResponse(fieldNames = { "showMobile", "showIdCard" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD }) @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) public Result get(@LoginUser TokenDto tokenDto, @PathVariable("id") String id){ IcPartyMemberDTO data = icPartyMemberService.get(tokenDto, id); + if(null!=data){ + data.setShowMobile(data.getMobile()); + data.setShowIdCard(data.getIdCard()); + } return new Result().ok(data); } @NoRepeatSubmit diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/IcResiUserConstant.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/IcResiUserConstant.java index 95a4b56fa5..ed6bbfcc1a 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/IcResiUserConstant.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/IcResiUserConstant.java @@ -24,4 +24,9 @@ public interface IcResiUserConstant { String BIRTH = "birth"; String IN = "in"; String ADD ="add"; + + String USER_CATEGORY = "category"; + String USER_CATEGORY_CN = "类别"; + String IS_CJ = "IS_CJ"; + String IS_CJ_CN = "残疾"; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncRecordDeathDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncRecordDeathDTO.java new file mode 100644 index 0000000000..eeed519be6 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncRecordDeathDTO.java @@ -0,0 +1,177 @@ +package com.epmet.dto; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 数据同步记录-居民死亡信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-10-11 + */ +@Data +public class DataSyncRecordDeathDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ColumnWidth(50) + @ExcelProperty("所属网格") + private String gridName; + /** + * 主键 + */ + @ExcelIgnore + private String id; + + /** + * 客户Id + */ + @ExcelIgnore + private String customerId; + + /** + * 组织Id + */ + @ExcelIgnore + private String agencyId; + + /** + * 组织的pids 含agencyId本身 + */ + @ExcelIgnore + private String pids; + + /** + * 网格ID + */ + @ExcelIgnore + private String gridId; + + /** + * 姓名 + */ + @ColumnWidth(15) + @ExcelProperty("姓名") + private String name; + + /** + * 身份证 + */ + @ColumnWidth(20) + @ExcelProperty("证件号") + private String idCard; + + /** + * 居民Id,ic_resi_user.id + */ + @ExcelIgnore + private String icResiUserId; + + /** + * 年龄(享年) + */ + @ColumnWidth(10) + @ExcelProperty("年龄") + private String age; + + /** + * 家庭住址 + */ + @ColumnWidth(40) + @ExcelProperty("家庭住址") + private String address; + + /** + * 死亡时间 + */ + @ColumnWidth(20) + @ExcelProperty("死亡日期") + private String deathDate; + + /** + * 火化时间 + */ + @ColumnWidth(20) + @ExcelProperty("火化时间") + private String cremationTime; + + /** + * 民族 + */ + @ExcelIgnore + private String mz; + + /** + * 登记单位名称 + */ + @ColumnWidth(40) + @ExcelProperty("登记单位名称") + private String organName; + + /** + * 国籍 + */ + @ExcelIgnore + private String nation; + + /** + * 第三方记录唯一标识 + */ + @ExcelIgnore + private String thirdRecordId; + + /** + * 处理状态(更新至居民信息) 0:未处理;1:处理成功;2处理失败 + */ + @ExcelIgnore + private Integer dealStatus; + + /** + * 处理结果 + */ + @ExcelIgnore + private String dealResult; + + /** + * 删除标识:0.未删除 1.已删除 + */ + @ExcelIgnore + private Integer delFlag; + + /** + * 乐观锁 + */ + @ExcelIgnore + private Integer revision; + + /** + * 创建人 + */ + @ExcelIgnore + private String createdBy; + + /** + * 创建时间 + */ + @ExcelIgnore + private Date createdTime; + + /** + * 更新人 + */ + @ExcelIgnore + private String updatedBy; + + /** + * 更新时间 + */ + @ExcelIgnore + private Date updatedTime; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncRecordDisabilityDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncRecordDisabilityDTO.java new file mode 100644 index 0000000000..d6768e09da --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncRecordDisabilityDTO.java @@ -0,0 +1,171 @@ +package com.epmet.dto; + +import com.epmet.dto.form.dataSync.ResiInfoDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 数据同步记录-居民残疾信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-10-11 + */ +@Data +public class DataSyncRecordDisabilityDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户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; + + /** + * 残疾类别 + */ + private String cjlbCn; + + /** + * 文化程度 + */ + private String eduLevel; + + /** + * 婚姻状况 中文 + */ + private String maritalStatusName; + + /** + * 民族 中文 + */ + private String mzCn; + + /** + * 性别1男2女 + */ + private Integer gender; + private String genderCn; + + /** + * 户籍地址 + */ + private String residentAdd; + + /** + * 现居住地址 + */ + private String nowAdd; + private String address; + + /** + * 监护人 + */ + private String guardian; + + /** + * 监护人联系方式 + */ + private String guardianPhone; + + /** + * 处理状态(更新至居民信息) 0:未处理;1:处理成功;2处理失败 + */ + private Integer dealStatus; + private String dealStatusName; + + /** + * 残疾状态 0:非残疾;1:残疾 + */ + private Integer disabilityStatus; + + /** + * 处理结果 + */ + private String dealResult; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + private ResiInfoDTO resiInfo; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatDTO.java index dbd32f4463..66c9828dfd 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatDTO.java @@ -67,6 +67,12 @@ public class IcNatDTO implements Serializable { @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") private Date natTime; + /** + * 采样时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date sampleTime; + /** * 检测结果(0:阴性 1:阳性) */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcNatFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcNatFormDTO.java index 258f28c66b..1d7ba24673 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcNatFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcNatFormDTO.java @@ -61,9 +61,14 @@ public class AddIcNatFormDTO implements Serializable { /** * 检测时间 */ - @NotNull(message = "检测时间不能为空", groups = Nat.class) +// @NotNull(message = "检测时间不能为空", groups = Nat.class) @JsonFormat(pattern="yyyy-MM-dd HH:mm") private Date natTime; + +// @NotNull(message = "采样时间不能为空", groups = Nat.class) + @JsonFormat(pattern="yyyy-MM-dd HH:mm") + private Date sampleTime; + /** * 检测结果 */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CollectDetailResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CollectDetailResultDTO.java index 3f2f2f728b..5a6d58d685 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CollectDetailResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CollectDetailResultDTO.java @@ -1,5 +1,7 @@ package com.epmet.dto.form; +import com.epmet.dto.result.OrgInfoIdAndNameResultDTO; +import com.epmet.dto.result.OrgInfoResultDTO; import lombok.Data; import java.io.Serializable; @@ -73,4 +75,8 @@ public class CollectDetailResultDTO implements Serializable { private String checkReason; private List memberList; + + private String orgIdPath; + + private List orgIdPathList; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DataSyncTaskParam.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DataSyncTaskParam.java new file mode 100644 index 0000000000..00134f6c45 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DataSyncTaskParam.java @@ -0,0 +1,50 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.dto.DataSyncScopeDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2022/9/26 17:04 + * @DESC + */ +@Data +public class DataSyncTaskParam implements Serializable { + + private static final long serialVersionUID = 3053943501957102943L; + + private String customerId; + + private List 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/dto/result/OrgInfoIdAndNameResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/OrgInfoIdAndNameResultDTO.java new file mode 100644 index 0000000000..53223ed6ad --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/OrgInfoIdAndNameResultDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.result; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/10/11 13:41 + * @DESC + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class OrgInfoIdAndNameResultDTO implements Serializable { + + private static final long serialVersionUID = 7478605833438304330L; + + private String id; + private String name; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserChartResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserChartResultDTO.java index 12f87fd20d..fb484d72b7 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserChartResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserChartResultDTO.java @@ -40,6 +40,19 @@ public class UserChartResultDTO implements Serializable { */ private Double ldUserRatio = 0.0; + /** + * 用户总数-较上月 + */ + private Integer userTotalJSY; + /** + * 常住用户-较上月 + */ + private Integer czUserTotalJSY; + /** + * 流动人口-较上月 + */ + private Integer ldUserTotalJSY; + @JsonIgnore private Integer num; //是否是流动人口【是:1 否:0】 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..429585d104 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; @@ -421,6 +426,7 @@ public class IcResiUserController implements ResultDataResolver { * @author yinzuomei * @date 2021/10/28 10:29 上午 */ + @MaskResponse(fieldNames = {"MOBILE","ID_CARD"}, fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD}) @PostMapping("detail") public Result queryIcResiDetail(@LoginUser TokenDto tokenDto, @RequestBody IcResiDetailFormDTO pageFormDTO) { //pageFormDTO.setCustomerId("45687aa479955f9d06204d415238f7cc"); @@ -557,6 +563,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"); @@ -754,6 +774,7 @@ public class IcResiUserController implements ResultDataResolver { * @author zxc * @date 2021/11/3 9:21 上午 */ + @MaskResponse(fieldNames = {"mobile"}, fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE}) @PostMapping("persondata") public Result personData(@LoginUser TokenDto tokenDto, @RequestBody PersonDataFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); @@ -783,6 +804,7 @@ public class IcResiUserController implements ResultDataResolver { * @param tokenDto * @return 根据分类搜索 */ + @MaskResponse(fieldNames = {"mobile","idCard"}, fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD}) @PostMapping("searchbycategory") public Result> search(@RequestBody SearchByNameFormDTO formDTO, @LoginUser TokenDto tokenDto) { formDTO.setCustomerId(tokenDto.getCustomerId()); @@ -895,7 +917,7 @@ public class IcResiUserController implements ResultDataResolver { * @Date 2021/12/10 17:54 */ @PostMapping("partymemberagelist") - @MaskResponse(fieldNames = {"mobile"}, fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE}) + @MaskResponse(fieldNames = {"name","mobile"}, fieldsMaskType = {MaskResponse.MASK_TYPE_CHINESE_NAME,MaskResponse.MASK_TYPE_MOBILE}) public Result> partyMemberAgelist(@RequestBody PartyMemberListFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); return new Result>().ok(icResiUserService.getPartyMemberAgeList(formDTO)); @@ -974,7 +996,7 @@ public class IcResiUserController implements ResultDataResolver { * @Date 2021/12/10 17:58 */ @PostMapping("partymembereducationlist") - @MaskResponse(fieldNames = {"mobile"}, fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE}) + @MaskResponse(fieldNames = {"name","mobile"}, fieldsMaskType = {MaskResponse.MASK_TYPE_CHINESE_NAME,MaskResponse.MASK_TYPE_MOBILE}) public Result> partyMemberEducationlist(@RequestBody PartyMemberListFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); return new Result>().ok(icResiUserService.getPartyMemberEducationList(formDTO)); @@ -1042,6 +1064,7 @@ public class IcResiUserController implements ResultDataResolver { * @param resiUserId * @return */ + @MaskResponse(fieldNames = {"mobile","idCard"}, fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE,MaskResponse.MASK_TYPE_ID_CARD}) @PostMapping("resi-brief/{resi-user-id}") public Result getResiBrief(@PathVariable("resi-user-id") String resiUserId, @LoginUser TokenDto loginUser) { String customerId = loginUser.getCustomerId(); @@ -1416,6 +1439,7 @@ public class IcResiUserController implements ResultDataResolver { * @Author sun * @Description 【人房概览】居民统计数点击查询列表 **/ + @MaskResponse(fieldNames = {"mobile", "idCard"},fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD}) @PostMapping("icuserstatislist") public Result> icUserStatisList(@LoginUser TokenDto tokenDto, @RequestBody UserChartFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); @@ -1436,4 +1460,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 +64,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 +98,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 +139,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 +168,339 @@ 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; + } + + //TODO 根据dataCode 调用不同的方法 抽取数据 + if (CollectionUtils.isEmpty(allConfigList)) { + log.warn("dataSyncForYanTaiTask don't have any resi data to pull data form YanTai interface"); + return; + } + if (StringUtils.isNotBlank(formDTO.getDataCode())){ + 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 = 1;//todo fangkaita NumConstant.ONE_THOUSAND; + //ToDo 去掉 + formDTO.setIdCards(Collections.singletonList("370283199912010302")); + 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 (false);//todo fangkaita(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 +508,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/IcResiCollectServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java index 599f9e81f8..c519210d7b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java @@ -224,6 +224,18 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl orgInfoList = new ArrayList<>(); + for (String orgId : split) { + AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(orgId); + if (null == agencyInfo){ + throw new EpmetException("查询组织信息失败:"+orgId); + } + OrgInfoIdAndNameResultDTO orgInfoResultDTO = new OrgInfoIdAndNameResultDTO(orgId,agencyInfo.getOrganizationName()); + orgInfoList.add(orgInfoResultDTO); + } + result.setOrgIdPathList(orgInfoList); //查询成员信息 List memberList = icResiMemberDao.selectListByCollectId(dto.getId()); result.setMemberList(memberList); 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..e3ff19f2da 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; @@ -57,6 +54,7 @@ import com.epmet.dao.*; import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO; +import com.epmet.dto.form.stats.UserHouseStatsQueryFormDTO; import com.epmet.dto.result.*; import com.epmet.dto.result.demand.IcResiDemandDictDTO; import com.epmet.dto.result.demand.OptionDTO; @@ -70,6 +68,7 @@ import com.epmet.opendata.dto.result.ResidentByIdCardResultDTO; import com.epmet.opendata.feign.GuardarDatosFeignClient; import com.epmet.resi.partymember.feign.ResiPartyMemberOpenFeignClient; import com.epmet.service.*; +import com.epmet.stats.UserHouseStatsResultDTO; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -162,6 +161,9 @@ public class IcResiUserServiceImpl extends BaseServiceImpl getWrapper(Map params) { @@ -2045,6 +2047,16 @@ 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/java/com/epmet/service/impl/IcVaccinePrarmeterServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccinePrarmeterServiceImpl.java index 1f3e85df9e..e56c8d5a0a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccinePrarmeterServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccinePrarmeterServiceImpl.java @@ -324,23 +324,7 @@ public class IcVaccinePrarmeterServiceImpl extends BaseServiceImpl - 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/IcNatDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml index e6dd5b0417..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 @@ -42,6 +42,7 @@ b.mobile mobile, b.id_card idCard, b.nat_time natTime, + b.sample_time sampleTime, b.nat_result natResult, b.nat_address natAddress FROM @@ -67,6 +68,12 @@ AND b.nat_time #{endTime} + + AND b.sample_time = ]]> #{sampleStartTime} + + + AND b.sample_time #{sampleEndTime} + AND b.is_resi_user = #{isResiUser} @@ -83,6 +90,7 @@ mobile mobile, id_card idCard, nat_time natTime, + sample_time sampleTime, nat_result natResult, nat_address natAddress FROM @@ -105,6 +113,12 @@ AND nat_time #{endTime} + + AND sample_time = ]]> #{sampleStartTime} + + + AND sample_time #{sampleEndTime} + ORDER BY nat_time DESC, id ASC @@ -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/main/resources/mapper/IcTripReportRecordDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml index 48805be438..b3e00357ac 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml @@ -68,8 +68,7 @@ update ic_trip_report_record set del_flag='1',UPDATED_BY=#{userId},UPDATED_TIME=NOW() - WHERE USER_TYPE !='resi' - AND AGENCY_ID=#{agencyId} + WHERE AGENCY_ID=#{agencyId} AND ( id=#{id} 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); + + } +}