Browse Source

Merge remote-tracking branch 'remotes/origin/develop' into release_temp

# Conflicts:
#	epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
dev_shibei_match
jianjun 4 years ago
parent
commit
44bcc4ad81
  1. 51
      epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/EpmetAdminOpenFeignClient.java
  2. 26
      epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/fallback/EpmetAdminOpenFeignClientFallback.java
  3. 68
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictDataController.java
  4. 41
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/AuthOperationLogListener.java
  5. 33
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/PointOperationLogListener.java
  6. 33
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/ProjectOperationLogListener.java
  7. 47
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/SysDictDataService.java
  8. 114
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/SysDictDataServiceImpl.java
  9. 162
      epmet-auth/src/main/java/com/epmet/controller/IcLoinController.java
  10. 24
      epmet-auth/src/main/java/com/epmet/controller/LoginController.java
  11. 32
      epmet-auth/src/main/java/com/epmet/dto/form/LoginByPassWordFormDTO.java
  12. 25
      epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java
  13. 9
      epmet-auth/src/main/java/com/epmet/redis/IcLoginTicketCacheBean.java
  14. 10
      epmet-auth/src/main/java/com/epmet/service/CaptchaService.java
  15. 9
      epmet-auth/src/main/java/com/epmet/service/IcLoginService.java
  16. 12
      epmet-auth/src/main/java/com/epmet/service/impl/CaptchaServiceImpl.java
  17. 177
      epmet-auth/src/main/java/com/epmet/service/impl/IcLoginServiceImpl.java
  18. 2
      epmet-commons/epmet-commons-extapp-auth/pom.xml
  19. 20
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java
  20. 13
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/MQUserPropertys.java
  21. 21
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java
  22. 22
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/DisputeProcessMQMsg.java
  23. 27
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/OrgOrStaffMQMsg.java
  24. 21
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/StaffPatrolMQMsg.java
  25. 4
      epmet-commons/epmet-commons-tools/pom.xml
  26. 6
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/AppClientConstant.java
  27. 5
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java
  28. 13
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/PageFormDTO.java
  29. 19
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionResultDTO.java
  30. 44
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/GenderEnum.java
  31. 45
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/HouseTypeEnum.java
  32. 7
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  33. 35
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/EpmetBaseRequestInterceptor.java
  34. 41
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/FeignConfig.java
  35. 42
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  36. 81
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/IcTokenDto.java
  37. 11
      epmet-gateway/pom.xml
  38. 10
      epmet-gateway/src/main/resources/bootstrap.yml
  39. 3
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/OrgConstant.java
  40. 16
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/IcFormResColumnDTO.java
  41. 26
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/IcResiDetailFormDTO.java
  42. 38
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/IcResiUserPageFormDTO.java
  43. 20
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/ResiUserQueryValueDTO.java
  44. 173
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/IcResiUserPageResultDTO.java
  45. 61
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/HouseInfoDTO.java
  46. 72
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/IcResiUserController.java
  47. 45
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/IcResiUserDao.java
  48. 3
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java
  49. 8
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercustomize/CustomerFootBarDao.java
  50. 32
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/IcResiUserService.java
  51. 255
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/IcResiUserServiceImpl.java
  52. 3
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
  53. 8
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  54. 10
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercustomize/CustomerFootBarService.java
  55. 17
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercustomize/impl/CustomerFootBarServiceImpl.java
  56. 129
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/IcResiUserDao.xml
  57. 22
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml
  58. 51
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercustomize/CustomerFootBarDao.xml
  59. 12
      epmet-module/data-statistical/data-statistical-client/pom.xml
  60. 22
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/EventInfoFormDTO.java
  61. 190
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/result/EventInfoResultDTO.java
  62. 34
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/form/GridBaseInfoFormDTO.java
  63. 150
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/CustomerAgencyDTO.java
  64. 134
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/CustomerGridDTO.java
  65. 103
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/GridBaseInfoDTO.java
  66. 2
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenCustomerGridDTO.java
  67. 12
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java
  68. 7
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenProjectDataInfoFormDTO.java
  69. 33
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/form/StaffBaseInfoFormDTO.java
  70. 29
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/param/MidPatrolFormDTO.java
  71. 182
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/GridUserInfoDTO.java
  72. 56
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/MidPatrolDetailResult.java
  73. 137
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/MidPatrolRecordResult.java
  74. 71
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
  75. 73
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java
  76. 28
      epmet-module/data-statistical/data-statistical-server/pom.xml
  77. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/OrgTypeConstant.java
  78. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java
  79. 106
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DataReportingController.java
  80. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  81. 18
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java
  82. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java
  83. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java
  84. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java
  85. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java
  86. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerAgencyEntity.java
  87. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerGridEntity.java
  88. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectDataEntity.java
  89. 56
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/ProjectChangedCustomListener.java
  90. 72
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/DataReportingService.java
  91. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java
  92. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java
  93. 18
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java
  94. 21
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java
  95. 32
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java
  96. 41
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java
  97. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java
  98. 65
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java
  99. 281
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java
  100. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java

51
epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/EpmetAdminOpenFeignClient.java

@ -1,6 +1,7 @@
package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.CorsConfigResultDTO;
import com.epmet.feign.fallback.EpmetAdminOpenFeignClientFallbackFactory;
@ -21,4 +22,54 @@ public interface EpmetAdminOpenFeignClient {
*/
@PostMapping("/sys/cors-config/list")
Result<List<CorsConfigResultDTO>> list();
/**
* @Description 文化程度
* @Param
* @Return {@link Result<List< OptionResultDTO >>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:27
*/
@PostMapping("/sys/dict/data/education")
Result<List<OptionResultDTO>> getEducationOption();
/**
* @Description 住房性质
* @Param
* @Return {@link Result<List<OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:27
*/
@PostMapping("/sys/dict/data/house")
Result<List<OptionResultDTO>> getHouseOption();
/**
* @Description 民族
* @Param
* @Return {@link Result<List<OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:27
*/
@PostMapping("/sys/dict/data/nation")
Result<List<OptionResultDTO>> getNationOption();
/**
* @Description 九小场所
* @Param
* @Return {@link Result<List<OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:27
*/
@PostMapping("/sys/dict/data/ninesmallplaces")
Result<List<OptionResultDTO>> getNineSmallPlacesOption();
/**
* @Description 人员关系
* @Param
* @Return {@link Result<List<OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:27
*/
@PostMapping("/sys/dict/data/relationship")
Result<List<OptionResultDTO>> getRelationshipOption();
}

26
epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/fallback/EpmetAdminOpenFeignClientFallback.java

@ -1,6 +1,7 @@
package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.CorsConfigResultDTO;
@ -15,4 +16,29 @@ public class EpmetAdminOpenFeignClientFallback implements EpmetAdminOpenFeignCli
public Result<List<CorsConfigResultDTO>> list() {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "list", null);
}
@Override
public Result<List<OptionResultDTO>> getEducationOption() {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getEducationOption", null);
}
@Override
public Result<List<OptionResultDTO>> getHouseOption() {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getHouseOption", null);
}
@Override
public Result<List<OptionResultDTO>> getNationOption() {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getNationOption", null);
}
@Override
public Result<List<OptionResultDTO>> getNineSmallPlacesOption() {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getNineSmallPlacesOption", null);
}
@Override
public Result<List<OptionResultDTO>> getRelationshipOption() {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getRelationshipOption", null);
}
}

68
epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictDataController.java

@ -8,18 +8,19 @@
package com.epmet.controller;
import com.epmet.dto.SysDictDataDTO;
import com.epmet.service.SysDictDataService;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
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.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.SysDictDataDTO;
import com.epmet.service.SysDictDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
@ -78,4 +79,65 @@ public class SysDictDataController {
return new Result();
}
/**
* @Description 九小场所
* @Param
* @Return {@link Result<List<OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:27
*/
@PostMapping("ninesmallplaces")
public Result<List<OptionResultDTO>> getNineSmallPlacesOption() {
return new Result<List<OptionResultDTO>>().ok(sysDictDataService.getNineSmallPlacesOption());
}
/**
* @Description 文化程度
* @Param
* @Return {@link Result<List<OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:27
*/
@PostMapping("education")
public Result<List<OptionResultDTO>> getEducationOption() {
return new Result<List<OptionResultDTO>>().ok(sysDictDataService.getEducationOption());
}
/**
* @Description 民族
* @Param
* @Return {@link Result<List<OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:27
*/
@PostMapping("nation")
public Result<List<OptionResultDTO>> getNationOption() {
return new Result<List<OptionResultDTO>>().ok(sysDictDataService.getNationOption());
}
/**
* @Description 人员关系
* @Param
* @Return {@link Result<List<OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:27
*/
@PostMapping("relationship")
public Result<List<OptionResultDTO>> getRelationshipOption() {
return new Result<List<OptionResultDTO>>().ok(sysDictDataService.getRelationshipOption());
}
/**
* @Description 住房性质
* @Param
* @Return {@link Result<List<OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:27
*/
@PostMapping("house")
public Result<List<OptionResultDTO>> getHouseOption() {
return new Result<List<OptionResultDTO>>().ok(sysDictDataService.getHouseOption());
}
}

41
epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/AuthOperationLogListener.java

@ -2,22 +2,19 @@ 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.LoginMQMsg;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.distributedlock.DistributedLock;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.utils.IpUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.entity.LogOperationEntity;
import com.epmet.feign.EpmetUserOpenFeignClient;
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;
@ -40,8 +37,15 @@ public class AuthOperationLogListener implements MessageListenerConcurrently {
private Logger logger = LoggerFactory.getLogger(getClass());
private RedisUtils redisUtils;
@Override
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) {
if (redisUtils == null) {
redisUtils = SpringContextUtils.getBean(RedisUtils.class);
}
try {
msgs.forEach(msg -> consumeMessage(msg));
} catch (Exception e) {
@ -54,6 +58,7 @@ public class AuthOperationLogListener implements MessageListenerConcurrently {
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);
LoginMQMsg msgObj = JSON.parseObject(msg, LoginMQMsg.class);
@ -91,5 +96,27 @@ public class AuthOperationLogListener implements MessageListenerConcurrently {
} 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);
}
}

33
epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/PointOperationLogListener.java

@ -1,10 +1,13 @@
package com.epmet.mq.listener.listener;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.rocketmq.constants.MQUserPropertys;
import com.epmet.commons.rocketmq.messages.PointRuleChangedMQMsg;
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.enums.SystemMessageTypeEnum;
@ -34,8 +37,15 @@ public class PointOperationLogListener implements MessageListenerConcurrently {
private Logger logger = LoggerFactory.getLogger(getClass());
private RedisUtils redisUtils;
@Override
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) {
if (redisUtils == null) {
redisUtils = SpringContextUtils.getBean(RedisUtils.class);
}
try {
msgs.forEach(msg -> consumeMessage(msg));
} catch (Exception e) {
@ -48,6 +58,7 @@ public class PointOperationLogListener implements MessageListenerConcurrently {
private void consumeMessage(MessageExt messageExt) {
String opeType = messageExt.getTags();
String msg = new String(messageExt.getBody());
String pendingMsgLabel = messageExt.getUserProperty(MQUserPropertys.BLOCKED_MSG_LABEL);
logger.info("积分操作日志监听器-收到消息内容:{}", msg);
PointRuleChangedMQMsg msgObj = JSON.parseObject(msg, PointRuleChangedMQMsg.class);
@ -87,5 +98,27 @@ public class PointOperationLogListener implements MessageListenerConcurrently {
} 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);
}
}

33
epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/ProjectOperationLogListener.java

@ -1,11 +1,14 @@
package com.epmet.mq.listener.listener;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.rocketmq.constants.MQUserPropertys;
import com.epmet.commons.rocketmq.messages.LoginMQMsg;
import com.epmet.commons.rocketmq.messages.ProjectChangedMQMsg;
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;
@ -34,8 +37,15 @@ public class ProjectOperationLogListener implements MessageListenerConcurrently
private Logger logger = LoggerFactory.getLogger(getClass());
private RedisUtils redisUtils;
@Override
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) {
if (redisUtils == null) {
redisUtils = SpringContextUtils.getBean(RedisUtils.class);
}
try {
msgs.forEach(msg -> consumeMessage(msg));
} catch (Exception e) {
@ -48,6 +58,7 @@ public class ProjectOperationLogListener implements MessageListenerConcurrently
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);
ProjectChangedMQMsg msgObj = JSON.parseObject(msg, ProjectChangedMQMsg.class);
@ -87,6 +98,14 @@ public class ProjectOperationLogListener implements MessageListenerConcurrently
} finally {
distributedLock.unLock(lock);
}
if (StringUtils.isNotBlank(pendingMsgLabel)) {
try {
removePendingMqMsgCache(pendingMsgLabel);
} catch (Exception e) {
logger.error("【项目操作事件监听器】-删除mq阻塞消息缓存失败:{}", ExceptionUtils.getErrorStackTrace(e));
}
}
}
private String getOperationTypeDisplay(String type) {
@ -107,4 +126,18 @@ public class ProjectOperationLogListener implements MessageListenerConcurrently
return null;
}
}
/**
* @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);
}
}

47
epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/SysDictDataService.java

@ -8,11 +8,13 @@
package com.epmet.service;
import com.epmet.dto.SysDictDataDTO;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.SysDictDataDTO;
import com.epmet.entity.SysDictDataEntity;
import java.util.List;
import java.util.Map;
/**
@ -31,5 +33,48 @@ public interface SysDictDataService extends BaseService<SysDictDataEntity> {
void update(SysDictDataDTO dto);
void delete(Long[] ids);
/**
* 九小场所
* @Param
* @Return {@link List<OptionResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:11
*/
List<OptionResultDTO> getNineSmallPlacesOption();
/**
* 文化程度
* @Param
* @Return {@link List<OptionResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:12
*/
List<OptionResultDTO> getEducationOption();
/**
* 民族
* @Param
* @Return {@link List<OptionResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:12
*/
List<OptionResultDTO> getNationOption();
/**
* 人员关系
* @Param
* @Return {@link List<OptionResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:12
*/
List<OptionResultDTO> getRelationshipOption();
/**
* 住房性质
* @Param
* @Return {@link List<OptionResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:12
*/
List<OptionResultDTO> getHouseOption();
}

114
epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/SysDictDataServiceImpl.java

@ -8,9 +8,11 @@
package com.epmet.service.impl;
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.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.SysDictDataDao;
@ -22,7 +24,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 字典类型
@ -85,4 +89,114 @@ public class SysDictDataServiceImpl extends BaseServiceImpl<SysDictDataDao, SysD
deleteBatchIds(Arrays.asList(ids));
}
/**
* 九小场所
*
* @Param
* @Return {@link List < OptionResultDTO >}
* @Author zhaoqifeng
* @Date 2021/10/26 17:11
*/
@Override
public List<OptionResultDTO> getNineSmallPlacesOption() {
LambdaQueryWrapper<SysDictDataEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysDictDataEntity::getDictTypeId, 1000000000000000001L);
wrapper.orderByAsc(SysDictDataEntity::getSort);
List<SysDictDataEntity> list = baseDao.selectList(wrapper);
return list.stream().map(item -> {
OptionResultDTO dto = new OptionResultDTO();
dto.setValue(item.getDictValue());
dto.setLabel(item.getDictLabel());
return dto;
}).collect(Collectors.toList());
}
/**
* 文化程度
*
* @Param
* @Return {@link List<OptionResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:12
*/
@Override
public List<OptionResultDTO> getEducationOption() {
LambdaQueryWrapper<SysDictDataEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysDictDataEntity::getDictTypeId, 1000000000000000002L);
wrapper.orderByAsc(SysDictDataEntity::getSort);
List<SysDictDataEntity> list = baseDao.selectList(wrapper);
return list.stream().map(item -> {
OptionResultDTO dto = new OptionResultDTO();
dto.setValue(item.getDictValue());
dto.setLabel(item.getDictLabel());
return dto;
}).collect(Collectors.toList());
}
/**
* 民族
*
* @Param
* @Return {@link List<OptionResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:12
*/
@Override
public List<OptionResultDTO> getNationOption() {
LambdaQueryWrapper<SysDictDataEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysDictDataEntity::getDictTypeId, 1000000000000000003L);
wrapper.orderByAsc(SysDictDataEntity::getSort);
List<SysDictDataEntity> list = baseDao.selectList(wrapper);
return list.stream().map(item -> {
OptionResultDTO dto = new OptionResultDTO();
dto.setValue(item.getDictValue());
dto.setLabel(item.getDictLabel());
return dto;
}).collect(Collectors.toList());
}
/**
* 人员关系
*
* @Param
* @Return {@link List<OptionResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:12
*/
@Override
public List<OptionResultDTO> getRelationshipOption() {
LambdaQueryWrapper<SysDictDataEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysDictDataEntity::getDictTypeId, 1000000000000000004L);
wrapper.orderByAsc(SysDictDataEntity::getSort);
List<SysDictDataEntity> list = baseDao.selectList(wrapper);
return list.stream().map(item -> {
OptionResultDTO dto = new OptionResultDTO();
dto.setValue(item.getDictValue());
dto.setLabel(item.getDictLabel());
return dto;
}).collect(Collectors.toList());
}
/**
* 住房性质
*
* @Param
* @Return {@link List<OptionResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:12
*/
@Override
public List<OptionResultDTO> getHouseOption() {
LambdaQueryWrapper<SysDictDataEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysDictDataEntity::getDictTypeId, 1000000000000000005L);
wrapper.orderByAsc(SysDictDataEntity::getSort);
List<SysDictDataEntity> list = baseDao.selectList(wrapper);
return list.stream().map(item -> {
OptionResultDTO dto = new OptionResultDTO();
dto.setValue(item.getDictValue());
dto.setLabel(item.getDictLabel());
return dto;
}).collect(Collectors.toList());
}
}

162
epmet-auth/src/main/java/com/epmet/controller/IcLoinController.java

@ -0,0 +1,162 @@
package com.epmet.controller;
import cn.hutool.core.bean.BeanUtil;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.security.password.PasswordUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.form.LoginByPassWordFormDTO;
import com.epmet.dto.form.RootOrgListByStaffIdFormDTO;
import com.epmet.dto.result.StaffOrgsResultDTO;
import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.redis.CaptchaRedis;
import com.epmet.redis.IcLoginTicketCacheBean;
import com.epmet.service.IcLoginService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
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;
import java.util.*;
@RestController
@RequestMapping("ic")
public class IcLoinController implements ResultDataResolver {
public static final long IC_LOGIN_TICKET_EXPIRE_SECONDS = 2 * 60l;
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private CaptchaRedis captchaRedis;
@Autowired
private IcLoginService icLoginService;
@Autowired
private RedisUtils redisUtils;
/**
* @description 基层治理赋能平台-根据手机号密码获取组织列表
*
* @param input
* @return
* @author wxz
* @date 2021.10.25 09:56:33
*/
@PostMapping("getmyorgsbypassword")
public Result<HashMap<String, Object>> getMyOrgsByPassword(@RequestBody LoginByPassWordFormDTO input) {
ValidatorUtils.validateEntity(input, LoginByPassWordFormDTO.IcGetOrgsByPwdGroup.class);
String captcha = input.getCaptcha();
String mobile = input.getMobile();
String password = input.getPassword();
String uuid = input.getUuid();
// 图片验证码
String captchaInCache = captchaRedis.getIcLoginCaptcha(uuid);
if (StringUtils.isBlank(captchaInCache) || !captcha.equals(captchaInCache)) {
throw new RenException(EpmetErrorCode.ERR10019.getCode());
}
// 获取用户信息
Result<List<CustomerStaffDTO>> staffResult = epmetUserFeignClient.checkCustomerStaff(mobile);
List<CustomerStaffDTO> staffList = getResultDataOrThrowsException(staffResult, ServiceConstant.EPMET_USER_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "【基层治理平台登录】获取用户信息失败");
if (CollectionUtils.isEmpty(staffList)) {
throw new RenException(EpmetErrorCode.ERR10003.getCode());
}
CustomerStaffDTO staffInfo = staffList.get(0);
if (!PasswordUtils.matches(password, staffInfo.getPassword())) {
throw new RenException(EpmetErrorCode.ERR10004.getCode());
}
String staffId = staffInfo.getUserId();
// 查询跟组织列表
RootOrgListByStaffIdFormDTO orgListForm = new RootOrgListByStaffIdFormDTO();
orgListForm.setStaffId(staffId);
Result<List<StaffOrgsResultDTO>> orgListResult = govOrgOpenFeignClient.getStaffOrgListByStaffId(orgListForm);
List<StaffOrgsResultDTO> orgs = getResultDataOrThrowsException(orgListResult, ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "【基层治理平台登录】根据staffId查询所属客户跟组织列表失败");
// 生成登录票据
String ticket = UUID.randomUUID().toString().replace("-", "");
IcLoginTicketCacheBean ticketCacheBean = new IcLoginTicketCacheBean();
ticketCacheBean.setMobile(mobile);
ticketCacheBean.setStaffId(staffId);
cacheTicket(ticket, ticketCacheBean);
HashMap<String, Object> resultMap = new HashMap<>();
resultMap.put("staffId", staffId);
resultMap.put("ticket", ticket);
resultMap.put("orgs", orgs);
return new Result<HashMap<String, Object>>().ok(resultMap);
}
/**
* @description IC登录
*
* @param input
* @return
* @author wxz
* @date 2021.10.25 21:14:22
*/
@PostMapping("login")
public Result<UserTokenResultDTO> login(@RequestBody LoginByPassWordFormDTO input) {
ValidatorUtils.validateEntity(input, LoginByPassWordFormDTO.IcLoginGroup.class);
String ticket = input.getTicket();
String orgId = input.getRootAgencyId();
String staffId = input.getStaffId();
// ticket校验
IcLoginTicketCacheBean ticketCache = getTicketCache(ticket);
if (ticketCache == null || !ticketCache.getStaffId().equals(staffId)) {
// ticket&userId不对应
throw new RenException(EpmetErrorCode.ERR10008.getCode());
}
UserTokenResultDTO tokenInfo = icLoginService.login(staffId, orgId);
return new Result<UserTokenResultDTO>().ok(tokenInfo);
}
private void cacheTicket(String ticket, IcLoginTicketCacheBean cacheBean) {
Map<String, Object> stringObjectMap = BeanUtil.beanToMap(cacheBean, false, true);
redisUtils.hMSet(RedisKeys.loginTicket(AppClientConstant.APP_IC, ticket), stringObjectMap, IC_LOGIN_TICKET_EXPIRE_SECONDS);
}
/**
* @description 从缓存中取出ticket并删除
*
* @param ticket
* @return
* @author wxz
* @date 2021.10.26 08:58:27
*/
private IcLoginTicketCacheBean getTicketCache(String ticket) {
String key = RedisKeys.loginTicket(AppClientConstant.APP_IC, ticket);
Map<String, Object> map = redisUtils.hGetAll(key);
if (CollectionUtils.sizeIsEmpty(map)) {
return null;
}
redisUtils.expire(key, 0);
return BeanUtil.mapToBean(map, IcLoginTicketCacheBean.class, false);
}
}

24
epmet-auth/src/main/java/com/epmet/controller/LoginController.java

@ -68,6 +68,30 @@ public class LoginController {
}
}
/**
* @description 基层治理平台登录验证码
*
* @param response
* @return
* @author wxz
* @date 2021.10.25 14:19:40
*/
@GetMapping("ic-login-captcha")
public void icLoginCaptcha(HttpServletResponse response, String uuid) throws IOException {
try {
//生成图片验证码
BufferedImage image = captchaService.createIcLoginCaptcha(uuid);
response.reset();
response.setHeader("Cache-Control", "no-store, no-cache");
response.setContentType("image/jpeg");
ServletOutputStream out = response.getOutputStream();
ImageIO.write(image, "jpg", out);
out.close();
} catch (IOException e) {
log.error("获取登陆验证码异常", e);
}
}
/**
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.lang.String>

32
epmet-auth/src/main/java/com/epmet/dto/form/LoginByPassWordFormDTO.java

@ -14,27 +14,53 @@ import java.io.Serializable;
public class LoginByPassWordFormDTO extends LoginCommonFormDTO implements Serializable {
private static final long serialVersionUID = -7507437651048051183L;
// 基层治理平台账号密码获取组织列表分组
public interface IcGetOrgsByPwdGroup {}
// 基层治理平台登录分组
public interface IcLoginGroup {}
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空",groups = {AddUserShowGroup.class})
private String phone;
@NotBlank(message = "手机号不能为空",groups = {IcGetOrgsByPwdGroup.class})
private String mobile;
/**
* 密码
*/
@NotBlank(message = "密码不能为空",groups = {AddUserShowGroup.class})
@NotBlank(message = "密码不能为空",groups = {AddUserShowGroup.class, IcGetOrgsByPwdGroup.class})
private String password;
/**
* 验证码
*/
@NotBlank(message="验证码不能为空",groups = {AddUserShowGroup.class})
@NotBlank(message="验证码不能为空",groups = {AddUserShowGroup.class, IcGetOrgsByPwdGroup.class})
private String captcha;
/**
* 唯一标识
*/
@NotBlank(message="唯一标识不能为空",groups = {AddUserInternalGroup.class})
@NotBlank(message="唯一标识不能为空",groups = {AddUserInternalGroup.class, IcGetOrgsByPwdGroup.class})
private String uuid;
/**
* 登录票据目前ic基层治理平台用到了
*/
@NotBlank(message="登录票据ticket不能为空", groups = {IcLoginGroup.class})
private String ticket;
/**
* 所选的要登录的组织id
*/
@NotBlank(message = "要登录的orgId不能为空", groups = { IcLoginGroup.class })
private String rootAgencyId;
/**
* 工作人员id
*/
@NotBlank(message = "人员Id不能为空", groups = { IcLoginGroup.class })
private String staffId;
}

25
epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java

@ -45,6 +45,12 @@ public class CaptchaRedis {
redisUtils.set(key, captcha, EXPIRE);
}
public void setIcLoginCaptcha(String uuid, String captcha) {
String key = RedisKeys.getIcLoginCaptchaKey(uuid);
logger.info("保存验证码key=["+key+"]");
redisUtils.set(key, captcha, EXPIRE);
}
public String get(String uuid){
String key = RedisKeys.getLoginCaptchaKey(uuid);
String captcha = (String)redisUtils.get(key);
@ -57,6 +63,25 @@ public class CaptchaRedis {
return captcha;
}
/**
* @description 基层治理平台登录验证码查询
*
* @param uuid
* @return
* @author wxz
* @date 2021.10.25 14:28:28
*/
public String getIcLoginCaptcha(String uuid) {
String key = RedisKeys.getIcLoginCaptchaKey(uuid);
String captcha = (String)redisUtils.get(key);
//删除验证码
if(captcha != null){
redisUtils.delete(key);
}
return captcha;
}
/**
* @param sendSmsCodeFormDTO appclientphone
* @param smsCode 验证码

9
epmet-auth/src/main/java/com/epmet/redis/IcLoginTicketCacheBean.java

@ -0,0 +1,9 @@
package com.epmet.redis;
import lombok.Data;
@Data
public class IcLoginTicketCacheBean {
private String staffId;
private String mobile;
}

10
epmet-auth/src/main/java/com/epmet/service/CaptchaService.java

@ -23,6 +23,16 @@ public interface CaptchaService {
*/
BufferedImage create(String uuid);
/**
* @description 基层治理平台登录验证码
*
* @param
* @return
* @author wxz
* @date 2021.10.25 14:15:30
*/
BufferedImage createIcLoginCaptcha(String uuid);
/**
* 验证码效验
* @param uuid uuid

9
epmet-auth/src/main/java/com/epmet/service/IcLoginService.java

@ -0,0 +1,9 @@
package com.epmet.service;
import com.epmet.dto.result.UserTokenResultDTO;
public interface IcLoginService {
UserTokenResultDTO login(String staffId, String orgId);
}

12
epmet-auth/src/main/java/com/epmet/service/impl/CaptchaServiceImpl.java

@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.awt.image.BufferedImage;
import java.util.UUID;
/**
* 验证码
@ -43,6 +44,17 @@ public class CaptchaServiceImpl implements CaptchaService {
return producer.createImage(captcha);
}
@Override
public BufferedImage createIcLoginCaptcha(String uuid) {
//生成验证码
String captchaText = producer.createText();
//logger.info("uuid:"+uuid+",生成的验证码:"+captcha);
//保存验证码
captchaRedis.setIcLoginCaptcha(uuid, captchaText);
return producer.createImage(captchaText);
}
@Override
public boolean validate(String uuid, String code) {
String captcha = captchaRedis.get(uuid);

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

@ -0,0 +1,177 @@
package com.epmet.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.epmet.auth.constants.AuthOperationConstants;
import com.epmet.commons.rocketmq.messages.LoginMQMsg;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.security.dto.IcTokenDto;
import com.epmet.commons.tools.utils.CpUserDetailRedis;
import com.epmet.commons.tools.utils.IpUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.form.SystemMsgFormDTO;
import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.jwt.JwtTokenProperties;
import com.epmet.jwt.JwtTokenUtils;
import com.epmet.service.IcLoginService;
import lombok.extern.slf4j.Slf4j;
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 java.util.*;
@Service
@Slf4j
public class IcLoginServiceImpl implements IcLoginService, ResultDataResolver {
@Autowired
private JwtTokenUtils jwtTokenUtils;
@Autowired
private RedisUtils redisUtils;
@Autowired
private CpUserDetailRedis cpUserDetailRedis;
@Autowired
private JwtTokenProperties jwtTokenProperties;
@Autowired
private EpmetMessageOpenFeignClient messageOpenFeignClient;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private ThirdLoginServiceImpl thirdLoginService;
@Override
public UserTokenResultDTO login(String staffId, String orgId) {
String app = AppClientConstant.APP_IC;
String client = AppClientConstant.CLIENT_WEB;
// 1.获取用户token
String token = this.generateIcToken(staffId, app, client);
Result<CustomerAgencyDTO> agencyResult = govOrgOpenFeignClient.getAgencyById(orgId);
CustomerAgencyDTO agencyInfo = getResultDataOrThrowsException(agencyResult, ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "【IC平台登录】获取组织信息失败");
// 2.缓存token
cacheToken(app, client, staffId, token, orgId, agencyInfo.getCustomerId());
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
userTokenResultDTO.setToken(token);
userTokenResultDTO.setCustomerId(agencyInfo.getCustomerId());
//7.发送登录事件
try {
sendLoginEvent(staffId, app, client);
} catch (RenException e) {
log.error(e.getInternalMsg());
} catch (Exception e) {
log.error("【工作端workLogin登录】发送登录事件失败,程序继续执行。");
}
return userTokenResultDTO;
}
/**
* @param staffId
* @return
* @description 生成Ic平台的Token
* @author wxz
* @date 2021.10.26 13:42:36
*/
private String generateIcToken(String staffId, String app, String client) {
Map<String, Object> map = new HashMap<>();
map.put("app", app);
map.put("client", client);
map.put("userId", staffId);
String token = jwtTokenUtils.createToken(map);
return token;
}
/**
* @param userId
* @param fromApp
* @param fromClient
* @return
* @description 发布登录时间
* @author wxz
* @date 2021.10.26 13:45:59
*/
private void sendLoginEvent(String userId, String fromApp, String fromClient) {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
LoginMQMsg loginMQMsg = new LoginMQMsg();
loginMQMsg.setUserId(userId);
loginMQMsg.setLoginTime(new Date());
loginMQMsg.setIp(IpUtils.getIpAddr(request));
loginMQMsg.setFromApp(fromApp);
loginMQMsg.setFromClient(fromClient);
SystemMsgFormDTO form = new SystemMsgFormDTO();
form.setMessageType(AuthOperationConstants.LOGIN);
form.setContent(loginMQMsg);
messageOpenFeignClient.sendSystemMsgByMQ(form);
}
/**
* @description 缓存token到redis
*
* @param app
* @param client
* @param userId
* @param token
* @param rootAgencyId
* @return
* @author wxz
* @date 2021.10.26 14:19:07
*/
private void cacheToken(String app,
String client,
String userId,
String token,
String rootAgencyId,
String customerId) {
IcTokenDto tokenDto = new IcTokenDto();
int expire = jwtTokenProperties.getExpire();
long expireTime = jwtTokenUtils.getExpiration(token).getTime();
tokenDto.setApp(app);
tokenDto.setClient(client);
tokenDto.setUserId(userId);
tokenDto.setToken(token);
tokenDto.setExpireTime(expireTime);
tokenDto.setRootAgencyId(rootAgencyId);
tokenDto.setCustomerId(customerId);
//设置部门,网格,角色列表
tokenDto.setDeptIdList(thirdLoginService.getDeptartmentIdList(userId));
tokenDto.setGridIdList(thirdLoginService.getGridIdList(userId));
CustomerAgencyDTO agency = thirdLoginService.getAgencyByStaffId(userId);
if (agency != null) {
tokenDto.setAgencyId(agency.getId());
tokenDto.setRoleList(thirdLoginService.queryGovStaffRoles(userId, agency.getId()));
}
tokenDto.setOrgIdPath(thirdLoginService.getOrgIdPath(userId));
String key = RedisKeys.getCpUserKey(app, client, userId);
Map<String, Object> map = BeanUtil.beanToMap(tokenDto, false, true);
redisUtils.hMSet(key, map, expire);
}
}

2
epmet-commons/epmet-commons-extapp-auth/pom.xml

@ -18,7 +18,7 @@
<commons.fileupload.version>1.3.3</commons.fileupload.version>
<commons.io.version>2.6</commons.io.version>
<hutool.version>4.6.1</hutool.version>
<easypoi.version>4.1.0</easypoi.version>
<easypoi.version>4.4.0</easypoi.version>
<joda.time.version>2.9.9</joda.time.version>
<fastjson.version>1.2.60</fastjson.version>
<gson.version>2.8.6</gson.version>

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

@ -45,4 +45,24 @@ public interface ConsomerGroupConstants {
*/
String POINT_OPERATION_LOG_GROUP = "point_operation_log_group";
/**
* 开放的对接数据(中间库) 组织变更事件监听器分组
*/
String OPEN_DATA_ORG_CHANGE_EVENT_LISTENER_GROUP = "open_data_org_change_event_listener_group";
/**
* 开放的对接数据(中间库) 工作人员变更事件监听器分组
*/
String OPEN_DATA_STAFF_CHANGE_EVENT_LISTENER_GROUP = "open_data_staff_change_event_listener_group";
/**
* 开放的对接数据(中间库) 巡查记录变更事件监听器分组
*/
String OPEN_DATA_PATROL_CHANGE_EVENT_LISTENER_GROUP = "open_data_patrol_change_event_listener_group";
/**
* 开放的对接数据(中间库) 项目变更事件监听器分组
*/
String OPEN_DATA_PROJECT_CHANGE_EVENT_LISTENER_GROUP = "open_data_project_change_event_listener_group";
}

13
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/MQUserPropertys.java

@ -0,0 +1,13 @@
package com.epmet.commons.rocketmq.constants;
/**
* @Description MQ用户自定义属性
* @author wxz
* @date 2021.10.14 15:47:03
*/
public interface MQUserPropertys {
//阻塞消息label
String BLOCKED_MSG_LABEL = "blockedMsgLabel";
}

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

@ -13,6 +13,7 @@ public interface TopicConstants {
* 项目变动
*/
String PROJECT_CHANGED = "project_changed";
/**
* 小组成就
*/
@ -27,4 +28,24 @@ public interface TopicConstants {
* 积分系统话题
*/
String POINT = "point";
/**
* 组织信息
*/
String ORG = "org";
/**
* 工作人员
*/
String STAFF = "staff";
/**
* 巡查记录
*/
String PATROL = "patrol";
/**
* 项目
*/
String PROJECT = "project";
}

22
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/DisputeProcessMQMsg.java

@ -0,0 +1,22 @@
package com.epmet.commons.rocketmq.messages;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.io.Serializable;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/10/18 16:24
*/
@Data
@AllArgsConstructor
public class DisputeProcessMQMsg implements Serializable {
private String customerId;
private String projectId;
/**
* 操作类型新增:add 修改删除:edit
*/
private String type;
}

27
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/OrgOrStaffMQMsg.java

@ -0,0 +1,27 @@
package com.epmet.commons.rocketmq.messages;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 组织网格人员中间库数据上报MQ
* @author sun
*/
@Data
public class OrgOrStaffMQMsg implements Serializable {
//客户Id
private String customerId;
//组织、网格、人员Id
private String orgId;
//数据类型【组织:agency 网格:grid 人员:staff】
private String orgType;
//操作类型【组织新增:agency_create 组织变更:agency_change 网格新增:grid_create 网格变更:grid_change 人员新增:staff_create 人员变更:staff_change】
private String type;
}

21
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/StaffPatrolMQMsg.java

@ -0,0 +1,21 @@
package com.epmet.commons.rocketmq.messages;
import lombok.Data;
/**
* 用户巡查消息体
* @author liujianjun
*/
@Data
public class StaffPatrolMQMsg {
/**
* 客户Id
*/
private String customerId;
/**
* 巡查记录id
*/
private String patrolId;
}

4
epmet-commons/epmet-commons-tools/pom.xml

@ -18,7 +18,7 @@
<commons.fileupload.version>1.3.3</commons.fileupload.version>
<commons.io.version>2.6</commons.io.version>
<hutool.version>4.6.1</hutool.version>
<easypoi.version>4.1.3</easypoi.version>
<easypoi.version>4.4.0</easypoi.version>
<joda.time.version>2.9.9</joda.time.version>
<fastjson.version>1.2.60</fastjson.version>
<gson.version>2.8.6</gson.version>
@ -89,6 +89,8 @@
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-base</artifactId>
<version>${easypoi.version}</version>
<!--<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/jar/easypoi-base-4.4.0.jar</systemPath>-->
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>

6
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/AppClientConstant.java

@ -17,6 +17,12 @@ public interface AppClientConstant {
* app类型-运营端
*/
String APP_OPER = "oper";
/**
* 基层治理平台端
*/
String APP_IC = "ic";
/**
* PC端:web
*/

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

@ -44,6 +44,11 @@ public interface StrConstant {
*/
String COLON = ":";
/**
* 英文分号
*/
String SEMICOLON = ";";
/**
* 中文顿号
*/

13
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/PageFormDTO.java

@ -20,8 +20,17 @@ public class PageFormDTO {
}
@NotNull(message = "页码不能为空", groups = AddUserInternalGroup.class)
private Integer pageNo;
private Integer pageNo = 1;
@NotNull(message = "每页数量不能为空", groups = AddUserInternalGroup.class)
private Integer pageSize;
private Integer pageSize = 20;
/**
* 偏移量 从多少条开始
*/
private Integer offset;
public Integer getOffset() {
return (pageNo-1)*pageSize;
}
}

19
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionResultDTO.java

@ -0,0 +1,19 @@
package com.epmet.commons.tools.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/10/26 13:53
*/
@Data
public class OptionResultDTO implements Serializable {
private static final long serialVersionUID = 8618231166600518980L;
private String label;
private String value;
private List<OptionResultDTO> children;
}

44
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/GenderEnum.java

@ -0,0 +1,44 @@
package com.epmet.commons.tools.enums;
import com.epmet.commons.tools.exception.EpmetErrorCode;
public enum GenderEnum {
MAN("1", "男"),
WOMAN("2", "女"),
UN_KNOWN("0", "未知");
private String code;
private String name;
GenderEnum(String code, String name) {
this.code = code;
this.name = name;
}
public static String getName(String code) {
GenderEnum[] genderEnums = values();
for (GenderEnum genderEnum : genderEnums) {
if (genderEnum.getCode() == code) {
return genderEnum.getName();
}
}
return EpmetErrorCode.SERVER_ERROR.getMsg();
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

45
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/HouseTypeEnum.java

@ -0,0 +1,45 @@
package com.epmet.commons.tools.enums;
import com.epmet.commons.tools.exception.EpmetErrorCode;
public enum HouseTypeEnum {
//房屋类型,1楼房,2平房,3别墅
LOUFANG("1", "楼房"),
PINGFANG("2", "平房"),
BIESHU("3", "别墅");
private String code;
private String name;
HouseTypeEnum(String code, String name) {
this.code = code;
this.name = name;
}
public static String getName(String code) {
HouseTypeEnum[] houseTypeEnums = values();
for (HouseTypeEnum houseTypeEnum : houseTypeEnums) {
if (houseTypeEnum.getCode() == code) {
return houseTypeEnum.getName();
}
}
return EpmetErrorCode.SERVER_ERROR.getMsg();
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

7
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -19,6 +19,7 @@ public enum EpmetErrorCode {
ERR10005(10005, "token不能为空"),
ERR10006(10006, "登录超时,请重新登录"),
ERR10007(10007, "当前帐号已在别处登录"),
ERR10008(10008, "Ticket错误"),
ERR10019(10019, "验证码不正确"),
SYSTEM_MQ_MSG_SEND_FAIL(10020, "MQ消息发送失败"),
ERR401(401, "未授权"),
@ -76,6 +77,7 @@ public enum EpmetErrorCode {
SET_PARENT_AREA_CODE(8210,"请先设置上级组织区划"),
HAVE_GUIDE_CANNOT_DEL(8211,"当前分类已经存在办事指南,不允许删除"),
GUIDE_CATEGORY_NAME_EXITS(8212,"分类已存在"),
CUSTOMER_FORM_NOT_EXITS(8213,"客户未配置表单"),
REQUIRE_PERMISSION(8301, "您没有足够的操作权限"),
THIRD_PLAT_REQUEST_ERROR(8302, "请求第三方平台错误"),
@ -212,8 +214,11 @@ public enum EpmetErrorCode {
SAME_RULE_NAME(8916,"该积分事件已存在,请重新调整保存"),
UP_LIMIT_POINT(8917,"积分上限需为单位积分倍数,请重新调整保存"),
BADGE_CHECK(8918,"");
BADGE_CHECK(8918,""),
ORG_ADD_FAILED(8919,"添加失败"),
ORG_EDIT_FAILED(8920,"编辑失败"),
ORG_DEL_FAILED(8921,"删除失败");
private int code;
private String msg;

35
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/EpmetBaseRequestInterceptor.java

@ -0,0 +1,35 @@
package com.epmet.commons.tools.feign;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
public class EpmetBaseRequestInterceptor implements RequestInterceptor {
@Override
public void apply(RequestTemplate template) {
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
if (requestAttributes == null) {
return;
}
HttpServletRequest request = ((ServletRequestAttributes) requestAttributes).getRequest();
Enumeration<String> headerNames = request.getHeaderNames();
if (headerNames != null) {
while (headerNames.hasMoreElements()) {
String name = headerNames.nextElement();
Enumeration<String> values = request.getHeaders(name);
while (values.hasMoreElements()) {
String value = values.nextElement();
template.header(name, value);
}
}
}
}
}

41
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/FeignConfig.java

@ -1,8 +1,8 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* <p>
* https://www.renren.io
*
* <p>
* 版权所有侵权必究
*/
@ -10,49 +10,32 @@ package com.epmet.commons.tools.feign;
import feign.Logger;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
/**
* Feign调用携带header
* 各服务可以自定义自己的RequestInterceptor如果自定义了此处不会再生效会优先使用自定义的拦截器实例
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Configuration
public class FeignConfig implements RequestInterceptor {
@Override
public void apply(RequestTemplate template) {
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
if (requestAttributes == null) {
return;
}
HttpServletRequest request = ((ServletRequestAttributes) requestAttributes).getRequest();
Enumeration<String> headerNames = request.getHeaderNames();
if (headerNames != null) {
while (headerNames.hasMoreElements()) {
String name = headerNames.nextElement();
Enumeration<String> values = request.getHeaders(name);
while (values.hasMoreElements()) {
String value = values.nextElement();
template.header(name, value);
}
}
}
public class FeignConfig {
@Bean
@ConditionalOnMissingBean
RequestInterceptor requestInterceptor() {
return new EpmetBaseRequestInterceptor();
}
@Bean
@ConditionalOnMissingBean
Logger.Level feignLoggerLevel() {
return Logger.Level.BASIC;//控制台会输出debug日志
}
}

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

@ -38,6 +38,13 @@ public class RedisKeys {
return rootPrefix.concat("sys:captcha:").concat(uuid);
}
/**
* 登录验证码Key
*/
public static String getIcLoginCaptchaKey(String uuid) {
return rootPrefix.concat("sys:captcha:iclogin:").concat(uuid);
}
/**
* 登录用户Key
*/
@ -548,4 +555,39 @@ public class RedisKeys {
public static String getQuestionnaireAccessKey(String userId, String qKey) {
return rootPrefix.concat("questionnaire:accesskey:").concat(userId).concat(":").concat(qKey);
}
/**
* @description 检查message MQ阻塞消息
*
* @param blockedMsgLabel 滞留消息的label
* @return
* @author wxz
* @date 2021.10.14 14:33:53
*/
public static String blockedMqMsgKey(String blockedMsgLabel) {
return rootPrefix.concat("message:mq:blocked:").concat(blockedMsgLabel);
}
/**
* @description 登录票据目前只有IC基层治理平台用到
*
* @param app
* @param ticket
* @return
* @author wxz
* @date 2021.10.25 17:49:43
*/
public static String loginTicket(String app, String ticket) {
return rootPrefix.concat("sys:security:ticket:").concat(app).concat(":").concat(ticket);
}
/**
* 政府端机关单位缓存Key
* @param formCode
* @param customerId
* @return
*/
public static String getIcFormKey(String formCode,String customerId) {
return rootPrefix.concat("icform:").concat(formCode).concat(":").concat(customerId);
}
}

81
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/IcTokenDto.java

@ -0,0 +1,81 @@
package com.epmet.commons.tools.security.dto;
import com.alibaba.fastjson.JSON;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
import java.util.Set;
/**
* @Description ic平台token
* @author wxz
* @date 2021.10.26 13:58:03
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class IcTokenDto extends BaseTokenDto {
/**
* 当前登录的组织id(顶级)
*/
private String rootAgencyId;
/**
* 当前用户所属的机关单位id
*/
private String agencyId;
/**
* 当前网格对应的组织结构id的全路径用:隔开
*/
private String orgIdPath;
/**
* 当前所在网格id
*/
private String gridId;
/***
* 所在网格列表
*/
private Set<String> gridIdList;
/**
* 部门id列表
*/
private Set<String> deptIdList;
/**
* 功能权限列表实际上是gov_staff => staff_role => role_operation查询到的operationKey
*/
private Set<String> permissions;
/**
* 角色ID列表
*/
private List<GovTokenDto.Role> roleList;
/**
* 过期时间戳
*/
private Long expireTime;
@Data
public static class Role {
private String id;
private String roleKey;
private String roleName;
public Role() {
}
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}

11
epmet-gateway/pom.xml

@ -223,6 +223,9 @@
<!-- 35、多数据源服务 -->
<gateway.routes.data-aggregator-server.url>lb://data-aggregator-server</gateway.routes.data-aggregator-server.url>
<!-- <gateway.routes.data-aggregator-server.url>http://127.0.0.1:8114</gateway.routes.data-aggregator-server.url>-->
<!-- 36、中间库服务 -->
<gateway.routes.open-data-worker-server.url>lb://open-data-worker-server</gateway.routes.open-data-worker-server.url>
<!--<gateway.routes.open-data-worker-server.url>http://127.0.0.1:8117</gateway.routes.open-data-worker-server.url>-->
<!--宣传服务-->
<gateway.routes.epmet-openapi-adv-server.url>lb://epmet-openapi-adv-server</gateway.routes.epmet-openapi-adv-server.url>
@ -361,6 +364,10 @@
<gateway.routes.data-aggregator-server.url>lb://data-aggregator-server</gateway.routes.data-aggregator-server.url>
<!-- <gateway.routes.data-aggregator-server.url>http://127.0.0.1:8114</gateway.routes.data-aggregator-server.url>-->
<!-- 36、中间库服务 -->
<gateway.routes.open-data-worker-server.url>lb://open-data-worker-server</gateway.routes.open-data-worker-server.url>
<!-- <gateway.routes.open-data-worker-server.url>http://127.0.0.1:8117</gateway.routes.open-data-worker-server.url>-->
<!--宣传服务-->
<gateway.routes.epmet-openapi-adv-server.url>lb://epmet-openapi-adv-server</gateway.routes.epmet-openapi-adv-server.url>
<!--<gateway.routes.epmet-openapi-adv-server.url>http://localhost:8115</gateway.routes.epmet-openapi-adv-server.url>-->
@ -469,6 +476,8 @@
<gateway.routes.data-aggregator-server.url>lb://data-aggregator-server</gateway.routes.data-aggregator-server.url>
<!--问卷服务-->
<gateway.routes.tduck-api.url>lb://tduck-api</gateway.routes.tduck-api.url>
<!-- 36、中间库服务 -->
<gateway.routes.open-data-worker-server.url>lb://open-data-worker-server</gateway.routes.open-data-worker-server.url>
<!--宣传服务-->
<gateway.routes.epmet-openapi-adv-server.url>lb://epmet-openapi-adv-server</gateway.routes.epmet-openapi-adv-server.url>
@ -570,6 +579,8 @@
<gateway.routes.epmet-ext-server.url>lb://epmet-ext-server</gateway.routes.epmet-ext-server.url>
<!-- 35、多数据源服务 -->
<gateway.routes.data-aggregator-server.url>lb://data-aggregator-server</gateway.routes.data-aggregator-server.url>
<!-- 36、中间库服务 -->
<gateway.routes.open-data-worker-server.url>lb://open-data-worker-server</gateway.routes.open-data-worker-server.url>
<!--宣传服务-->
<gateway.routes.epmet-openapi-adv-server.url>lb://epmet-openapi-adv-server</gateway.routes.epmet-openapi-adv-server.url>

10
epmet-gateway/src/main/resources/bootstrap.yml

@ -350,6 +350,16 @@ spring:
filters:
- StripPrefix=1
- CpAuth=true
#政府工作端议题管理
- id: open-data-worker-server
uri: @gateway.routes.open-data-worker-server.url@
order: 38
predicates:
- Path=${server.servlet.context-path}/opendata/**
filters:
- StripPrefix=1
- CpAuth=true
nacos:
discovery:
server-addr: @nacos.server-addr@

3
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/OrgConstant.java

@ -11,4 +11,7 @@ public interface OrgConstant {
String CITY = "city";
String DISTRICT = "district";
String GRID_ID="GRID_ID";
String GENDER="GENDER";
String HOUSE_TYPE_KEY="HOUSE_TYPE";
}

16
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/IcFormResColumnDTO.java

@ -0,0 +1,16 @@
package com.epmet.dataaggre.dto.epmetuser;
import lombok.Data;
/**
* @Description TODO
* @Author yinzuomei
* @Date 2021/10/27 4:26 下午
*/
@Data
public class IcFormResColumnDTO {
private String tableName;
private String columnName;
private String label;
}

26
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/IcResiDetailFormDTO.java

@ -0,0 +1,26 @@
package com.epmet.dataaggre.dto.epmetuser.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 查看详情回显表单
* @Author yinzuomei
* @Date 2021/10/27 10:22 下午
*/
@Data
public class IcResiDetailFormDTO implements Serializable {
public interface AddUserInternalGroup {
}
@NotBlank(message = "icResiUserId不能为空",groups = AddUserInternalGroup.class)
private String icResiUserId;
@NotBlank(message = "formCode不能为空", groups = AddUserInternalGroup.class)
private String formCode;
@NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class)
private String customerId;
}

38
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/IcResiUserPageFormDTO.java

@ -0,0 +1,38 @@
package com.epmet.dataaggre.dto.epmetuser.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @Description 居民信息分页查询入参
* @Author yinzuomei
* @Date 2021/10/27 2:06 下午
*/
@Data
public class IcResiUserPageFormDTO implements Serializable {
public interface AddUserInternalGroup {
}
@NotNull(message = "pageNo不能为空", groups = AddUserInternalGroup.class)
private Integer pageNo;
@NotNull(message = "pageSize不能为空", groups = AddUserInternalGroup.class)
private Integer pageSize;
@NotBlank(message = "formCode不能为空", groups = AddUserInternalGroup.class)
private String formCode;
@NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class)
private String customerId;
/**
* 表对应的字段及值
*/
private List<ResiUserQueryValueDTO> conditions;
private Boolean pageFlag;
}

20
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/ResiUserQueryValueDTO.java

@ -0,0 +1,20 @@
package com.epmet.dataaggre.dto.epmetuser.form;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description TODO
* @Author yinzuomei
* @Date 2021/10/27 6:02 下午
*/
@Data
public class ResiUserQueryValueDTO implements Serializable {
private String queryType;
private List<String> columnValue;
private String columnName;
private String tableName;
}

173
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/IcResiUserPageResultDTO.java

@ -0,0 +1,173 @@
package com.epmet.dataaggre.dto.epmetuser.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 居民信息分页查询表单返参
* @Author yinzuomei
* @Date 2021/10/27 2:07 下午
*/
@Data
public class IcResiUserPageResultDTO implements Serializable {
private String icResiUserId;
private String gridId;
private String gridName;
/**
* 所属小区ID
*/
private String villageId;
private String vallageName;
/**
* 所属楼宇Id
*/
private String buildId;
private String buildName;
/**
* 单元id
*/
private String unitId;
private String unitName;
/**
* 所属家庭Id
*/
private String homeId;
private String homeName;
/**
* 姓名
*/
private String name;
/**
* 手机号
*/
private String mobile;
/**
* 性别
*/
private String gender;
/**
* 身份证号
*/
private String idCard;
/**
* 出生日期
*/
private String birthday;
/**
* 备注
*/
private String remarks;
/**
* 是否党员
*/
private Boolean isParty;
/**
* 是否低保户
*/
private Boolean isDbh;
/**
* 是否保障房
*/
private Boolean isEnsureHouse;
/**
* 是否失业
*/
private Boolean isUnemployed;
/**
* 是否育龄妇女
*/
private Boolean isYlfn;
/**
* 是否退役军人
*/
private Boolean isVeterans;
/**
* 是否统战人员
*/
private Boolean isUnitedFront;
/**
* 是否信访人员
*/
private Boolean isXfry;
/**
* 是否志愿者
*/
private Boolean isVolunteer;
/**
* 是否老年人
*/
private Boolean isOldPeople;
/**
* 是否空巢
*/
private Boolean isKc;
/**
* 是否失独
*/
private Boolean isSd;
/**
* 是否失能
*/
private Boolean isSn;
/**
* 是否失智
*/
private Boolean isSz;
/**
* 是否残疾
*/
private Boolean isCj;
/**
* 是否大病
*/
private Boolean isDb;
/**
* 是否慢病
*/
private Boolean isMb;
/**
* 是否特殊人群
*/
private Boolean isSpecial;
// 以下属性都需要单独处理,不是直接取数据库的字段
private String demandCategoryIds;
private String demandName;
/**
* 房屋类型1楼房2平房3别墅
*/
private String houseType;
}

61
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/HouseInfoDTO.java

@ -0,0 +1,61 @@
package com.epmet.dataaggre.dto.govorg.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description TODO
* @Author yinzuomei
* @Date 2021/10/28 2:05 下午
*/
@Data
public class HouseInfoDTO implements Serializable {
private static final long serialVersionUID = -5204197079709062825L;
/**
* 所属家庭Id
*/
private String homeId;
/**
* 小区id
*/
private String neighborHoodId;
/**
* 小区名称
*/
private String neighborHoodName;
/**
* 所属楼栋id
*/
private String buildingId;
/**
* 楼栋名称
*/
private String buildingName;
/**
* 所属单元id
*/
private String buildingUnitId;
/**
* 单元名
*/
private String unitName;
/**
* 门牌号
*/
private String doorName;
/**
* 房屋类型1楼房2平房3别墅
*/
private String houseType;
}

72
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/IcResiUserController.java

@ -0,0 +1,72 @@
package com.epmet.dataaggre.controller;
import com.epmet.commons.tools.annotation.LoginUser;
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.ValidatorUtils;
import com.epmet.dataaggre.dto.epmetuser.form.IcResiDetailFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.IcResiUserPageFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.IcResiUserPageResultDTO;
import com.epmet.dataaggre.service.epmetuser.IcResiUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* @Description TODO
* @Author yinzuomei
* @Date 2021/10/27 2:03 下午
*/
@RestController
@RequestMapping("icresiuser")
public class IcResiUserController {
@Autowired
private IcResiUserService icResiUserService;
/**
* 分页查询居民信息列表
*
* @param tokenDto
* @param pageFormDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.commons.tools.page.PageData<com.epmet.dataaggre.dto.epmetuser.result.IcResiUserPageResultDTO>>
* @author yinzuomei
* @date 2021/10/28 10:29 上午
*/
//@PostMapping("listresi1")
public Result<PageData<IcResiUserPageResultDTO>> queryListResi(@LoginUser TokenDto tokenDto, @RequestBody IcResiUserPageFormDTO pageFormDTO){
//pageFormDTO.setCustomerId("45687aa479955f9d06204d415238f7cc");
pageFormDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(pageFormDTO,IcResiUserPageFormDTO.AddUserInternalGroup.class);
return new Result<PageData<IcResiUserPageResultDTO>>().ok(icResiUserService.pageResi(pageFormDTO));
}
//@PostMapping("listresi")
public Result<PageData<Map<String,Object>>> queryListResi1(@LoginUser TokenDto tokenDto, @RequestBody IcResiUserPageFormDTO pageFormDTO){
//pageFormDTO.setCustomerId("45687aa479955f9d06204d415238f7cc");
pageFormDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(pageFormDTO,IcResiUserPageFormDTO.AddUserInternalGroup.class);
return new Result<PageData<Map<String,Object>>>().ok(icResiUserService.pageResiMap(pageFormDTO));
}
/**
* 编辑页面显示居民信息详情
*
* @param pageFormDTO
* @return com.epmet.commons.tools.utils.Result
* @author yinzuomei
* @date 2021/10/28 10:29 上午
*/
//@PostMapping("detail")
public Result queryIcResiDetail(@LoginUser TokenDto tokenDto,@RequestBody IcResiDetailFormDTO pageFormDTO){
//pageFormDTO.setCustomerId("45687aa479955f9d06204d415238f7cc");
pageFormDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(pageFormDTO,IcResiDetailFormDTO.AddUserInternalGroup.class);
return new Result().ok(icResiUserService.queryIcResiDetail(pageFormDTO));
}
}

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

@ -0,0 +1,45 @@
package com.epmet.dataaggre.dao.epmetuser;
import com.epmet.dataaggre.dto.epmetuser.IcFormResColumnDTO;
import com.epmet.dataaggre.dto.epmetuser.form.ResiUserQueryValueDTO;
import com.epmet.dataaggre.dto.epmetuser.result.IcResiUserPageResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface IcResiUserDao {
List<IcResiUserPageResultDTO> selectListResi(@Param("customerId") String customerId,
@Param("formCode") String formCode,
@Param("conditions") List<ResiUserQueryValueDTO> conditions,
@Param("resultColumns") List<IcFormResColumnDTO> resultColumns,
@Param("subTables") List<String> subTables);
List<Map<String,Object>> selectListResiMap(@Param("customerId") String customerId,
@Param("formCode") String formCode,
@Param("conditions") List<ResiUserQueryValueDTO> conditions,
@Param("resultColumns") List<IcFormResColumnDTO> resultColumns,
@Param("subTables") List<String> subTables);
/**
* 查询主表
*
* @param icResiUserId
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
* @author yinzuomei
* @date 2021/10/28 11:20 上午
*/
List<Map<String, Object>> selectById(String icResiUserId);
/**
* 根据ic_resi_user.id去查询各个子表记录动态传入表名
*
* @param icResiUserId
* @param tableName
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
* @author yinzuomei
* @date 2021/10/28 11:19 上午
*/
List<Map<String, Object>> selectSubTableRecords(@Param("icResiUserId") String icResiUserId,@Param("tableName") String tableName);
}

3
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java

@ -24,6 +24,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Set;
/**
* 机关单位信息表
@ -98,4 +99,6 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
* @Date 2021/9/23 10:16
*/
List<String> getOrgList(@Param("staffId") String staffId);
List<HouseInfoDTO> queryHouseInfo(@Param("houseIdList") Set<String> houseIdList);
}

8
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercustomize/CustomerFootBarDao.java

@ -19,11 +19,13 @@ package com.epmet.dataaggre.dao.opercustomize;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.app.result.CustomerFootBarDTO;
import com.epmet.dataaggre.dto.epmetuser.IcFormResColumnDTO;
import com.epmet.dataaggre.entity.opercustomize.CustomerFootBarEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Set;
/**
* APP底部菜单栏信息
@ -56,4 +58,10 @@ public interface CustomerFootBarDao extends BaseDao<CustomerFootBarEntity> {
* @date 2021/7/28 10:56
*/
CustomerFootBarEntity selectDefaultIcon(@Param("customerId") String customerId, @Param("appType")String appType, @Param("barKey")String barKey);
List<IcFormResColumnDTO> queryConditions(@Param("customerId") String customerId, @Param("formCode")String formCode);
List<String> querySubTables(@Param("customerId") String customerId, @Param("formCode")String formCode);
Set<String> queryIcResiSubTables(@Param("customerId") String customerId, @Param("formCode")String formCode);
}

32
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/IcResiUserService.java

@ -0,0 +1,32 @@
package com.epmet.dataaggre.service.epmetuser;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dataaggre.dto.epmetuser.form.IcResiDetailFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.IcResiUserPageFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.IcResiUserPageResultDTO;
import java.util.Map;
public interface IcResiUserService {
/**
* 分页查询居民信息列表
*
* @param pageFormDTO
* @return com.epmet.commons.tools.page.PageData<com.epmet.dataaggre.dto.epmetuser.result.IcResiUserPageResultDTO>
* @author yinzuomei
* @date 2021/10/28 10:30 上午
*/
@Deprecated
PageData<IcResiUserPageResultDTO> pageResi(IcResiUserPageFormDTO pageFormDTO);
PageData<Map<String,Object>> pageResiMap(IcResiUserPageFormDTO formDTO);
/**
* 编辑页面显示居民信息详情
*
* @param pageFormDTO
* @return java.util.Map
* @author yinzuomei
* @date 2021/10/28 10:29 上午
*/
Map queryIcResiDetail(IcResiDetailFormDTO pageFormDTO);
}

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

@ -0,0 +1,255 @@
package com.epmet.dataaggre.service.epmetuser.impl;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.enums.GenderEnum;
import com.epmet.commons.tools.enums.HouseTypeEnum;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.constant.OrgConstant;
import com.epmet.dataaggre.dao.epmetuser.IcResiUserDao;
import com.epmet.dataaggre.dto.epmetuser.IcFormResColumnDTO;
import com.epmet.dataaggre.dto.epmetuser.form.IcResiDetailFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.IcResiUserPageFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.IcResiUserPageResultDTO;
import com.epmet.dataaggre.dto.govorg.result.GridsInfoListResultDTO;
import com.epmet.dataaggre.dto.govorg.result.HouseInfoDTO;
import com.epmet.dataaggre.service.epmetuser.IcResiUserService;
import com.epmet.dataaggre.service.govorg.GovOrgService;
import com.epmet.dataaggre.service.opercustomize.CustomerFootBarService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @Description TODO
* @Author yinzuomei
* @Date 2021/10/27 2:04 下午
*/
@Service
@DataSource(DataSourceConstant.EPMET_USER)
@Slf4j
public class IcResiUserServiceImpl implements IcResiUserService {
@Autowired
private IcResiUserDao icResiUserDao;
@Autowired
private CustomerFootBarService customerFootBarService;
@Autowired
private GovOrgService govOrgService;
/**
* 分页查询居民信息列表
*
* @param formDTO
* @return com.epmet.commons.tools.page.PageData<com.epmet.dataaggre.dto.epmetuser.result.IcResiUserPageResultDTO>
* @author yinzuomei
* @date 2021/10/28 10:30 上午
*/
@Override
public PageData<IcResiUserPageResultDTO> pageResi(IcResiUserPageFormDTO formDTO) {
// 查询列表展示项,如果没有,直接返回
List<IcFormResColumnDTO> resultColumns = customerFootBarService.queryConditions(formDTO.getCustomerId(), formDTO.getFormCode());
if (CollectionUtils.isEmpty(resultColumns)) {
log.warn("没有配置列表展示列");
return new PageData(new ArrayList(), NumConstant.ZERO);
}
log.warn("列表展示项:" + JSON.toJSONString(resultColumns));
// 查询列表展示项需要用到哪些子表
// 拼接好的left join table_name on (ic_resi_user.ID=table_name.IC_RESI_USER AND table_name.del_flag='0')
List<String> subTables = customerFootBarService.querySubTables(formDTO.getCustomerId(), formDTO.getFormCode());
log.warn("子表:" + JSON.toJSONString(subTables));
/* Set<String> subTableList=resultColumns.stream().filter(item->!item.getTableName().equals("ic_resi_user")
&& StringUtils.isNotBlank(item.getLink()))
.map(IcFormResColumnDTO :: getTableName).collect(Collectors.toSet());
List<String> subTables=new ArrayList<>();
subTableList.forEach(tableName->{
//'left join ',temp.TABLE_NAME, ' on ( ic_resi_user.ID=',temp.TABLE_NAME,'.IC_RESI_USER and ',temp.TABLE_NAME,'.del_flag="0" )'
String joinSql=String.format("% join %s on ( ic_resi_user.ID=%s.IC_RESI_USER and %s.del_flag=\"0\" ");
subTables.add(joinSql);
});*/
PageInfo<IcResiUserPageResultDTO> pageInfo = PageHelper.startPage(formDTO.getPageNo(),
formDTO.getPageSize()).doSelectPageInfo(() -> icResiUserDao.selectListResi(formDTO.getCustomerId(),
formDTO.getFormCode(),
formDTO.getConditions(),
resultColumns,
subTables));
List<IcResiUserPageResultDTO> list = pageInfo.getList();
//查询网格名称
List<String> gridIds = list.stream().map(IcResiUserPageResultDTO::getGridId).collect(Collectors.toList());
log.warn("gridIds:" + JSON.toJSONString(gridIds));
List<GridsInfoListResultDTO> gridInfoList = govOrgService.gridListByIds(gridIds);
log.warn(JSON.toJSONString(gridInfoList));
Map<String, GridsInfoListResultDTO> gridInfoMap = gridInfoList.stream().collect(Collectors.toMap(GridsInfoListResultDTO::getGridId, Function.identity()));
//查询房子名称
Set<String> houseIds = list.stream().map(IcResiUserPageResultDTO::getHomeId).collect(Collectors.toSet());
List<HouseInfoDTO> houseInfoDTOList = govOrgService.queryHouseInfo(houseIds);
Map<String, HouseInfoDTO> houseInfoMap = houseInfoDTOList.stream().collect(Collectors.toMap(HouseInfoDTO::getHomeId, Function.identity()));
for (IcResiUserPageResultDTO resultDTO : list) {
if (null != gridInfoMap && gridInfoMap.containsKey(resultDTO.getGridId())) {
resultDTO.setGridName(gridInfoMap.get(resultDTO.getGridId()).getGridName());
}
if (null != houseInfoMap && houseInfoMap.containsKey(resultDTO.getHomeId())) {
resultDTO.setBuildName(houseInfoMap.get(resultDTO.getHomeId()).getBuildingName());
resultDTO.setVallageName(houseInfoMap.get(resultDTO.getHomeId()).getNeighborHoodName());
resultDTO.setUnitName(houseInfoMap.get(resultDTO.getHomeId()).getUnitName());
resultDTO.setHomeName(houseInfoMap.get(resultDTO.getHomeId()).getDoorName());
resultDTO.setHouseType(houseInfoMap.get(resultDTO.getHomeId()).getHouseType());
}
}
pageInfo.setList(list);
return new PageData<>(pageInfo.getList(), pageInfo.getTotal());
}
public PageData<Map<String, Object>> pageResiMap(IcResiUserPageFormDTO formDTO) {
// 查询列表展示项,如果没有,直接返回
List<IcFormResColumnDTO> resultColumns = customerFootBarService.queryConditions(formDTO.getCustomerId(), formDTO.getFormCode());
if (CollectionUtils.isEmpty(resultColumns)) {
log.warn("没有配置列表展示列");
return new PageData(new ArrayList(), NumConstant.ZERO);
}
// 查询列表展示项需要用到哪些子表
// 拼接好的left join table_name on (ic_resi_user.ID=table_name.IC_RESI_USER AND table_name.del_flag='0')
List<String> subTables = customerFootBarService.querySubTables(formDTO.getCustomerId(), formDTO.getFormCode());
PageInfo<Map<String, Object>> pageInfo=new PageInfo<>();
if (null == formDTO.getPageFlag()||formDTO.getPageFlag()) {
//分页
pageInfo= PageHelper.startPage(formDTO.getPageNo(),
formDTO.getPageSize()).doSelectPageInfo(() -> icResiUserDao.selectListResiMap(formDTO.getCustomerId(),
formDTO.getFormCode(),
formDTO.getConditions(),
resultColumns,
subTables));
}else{
List<Map<String,Object>> list=icResiUserDao.selectListResiMap(formDTO.getCustomerId(),
formDTO.getFormCode(),
formDTO.getConditions(),
resultColumns,
subTables);
pageInfo.setTotal(CollectionUtils.isEmpty(list)?NumConstant.ZERO:list.size());
pageInfo.setList(list);
}
List<Map<String, Object>> list = pageInfo.getList();
//查询网格名称
List<String> gridIds = new ArrayList<>();
Set<String> houseIds = new HashSet<>();
for (Map<String, Object> map : list) {
log.warn(JSON.toJSONString(map));
if (map.containsKey(OrgConstant.GRID_ID) && null != map.get(OrgConstant.GRID_ID) && StringUtils.isNotBlank(map.get(OrgConstant.GRID_ID).toString())) {
gridIds.add(map.get(OrgConstant.GRID_ID).toString());
}
if (map.containsKey("HOME_ID") && null != map.get("HOME_ID") && StringUtils.isNotBlank(map.get("HOME_ID").toString())) {
houseIds.add(map.get("HOME_ID").toString());
}
}
List<GridsInfoListResultDTO> gridInfoList = govOrgService.gridListByIds(gridIds);
Map<String, GridsInfoListResultDTO> gridInfoMap = gridInfoList.stream().collect(Collectors.toMap(GridsInfoListResultDTO::getGridId, Function.identity()));
//查询房子名称
List<HouseInfoDTO> houseInfoDTOList = govOrgService.queryHouseInfo(houseIds);
Map<String, HouseInfoDTO> houseInfoMap = houseInfoDTOList.stream().collect(Collectors.toMap(HouseInfoDTO::getHomeId, Function.identity()));
for (Map<String, Object> resultMap : list) {
String gridIdValue = null != resultMap.get(OrgConstant.GRID_ID) ? resultMap.get(OrgConstant.GRID_ID).toString() : StrConstant.EPMETY_STR;
resultMap.put("GRID_ID_VALUE", gridIdValue);
if (null != gridInfoMap && gridInfoMap.containsKey(gridIdValue) && null != gridInfoMap.get(gridIdValue)) {
//GRID_NAME
resultMap.put(OrgConstant.GRID_ID, gridInfoMap.get(gridIdValue).getGridName());
}
String homeId = null != resultMap.get("HOME_ID") ? resultMap.get("HOME_ID").toString() : StrConstant.EPMETY_STR;
resultMap.put("HOME_ID_VALUE", homeId);
if (null != houseInfoMap && houseInfoMap.containsKey(homeId) && null != houseInfoMap.get(homeId)) {
HouseInfoDTO houseInfoDTO = houseInfoMap.get(homeId);
String buildName = StringUtils.isNotBlank(houseInfoDTO.getBuildingName()) ? houseInfoDTO.getBuildingName() : StrConstant.EPMETY_STR;
resultMap.put("BUILD_NAME", buildName);
String neighBorName = StringUtils.isNotBlank(houseInfoDTO.getNeighborHoodName()) ? houseInfoDTO.getNeighborHoodName() : StrConstant.EPMETY_STR;
resultMap.put("VILLAGE_NAME", neighBorName);
String unitName = StringUtils.isNotBlank(houseInfoDTO.getUnitName()) ? houseInfoDTO.getUnitName() : StrConstant.EPMETY_STR;
resultMap.put("UNIT_NAME", unitName);
String doorName = StringUtils.isNotBlank(houseInfoDTO.getDoorName()) ? houseInfoDTO.getDoorName() : StrConstant.EPMETY_STR;
resultMap.put("DOOR_NAME", doorName);
String houseType = StringUtils.isNotBlank(houseInfoDTO.getHouseType()) ? houseInfoDTO.getHouseType() : StrConstant.EPMETY_STR;
//房屋类型,1楼房,2平房,3别墅
resultMap.put(OrgConstant.HOUSE_TYPE_KEY, "");
if (HouseTypeEnum.LOUFANG.getCode().equals(houseType)) {
resultMap.put(OrgConstant.HOUSE_TYPE_KEY, HouseTypeEnum.LOUFANG.getName());
} else if (HouseTypeEnum.PINGFANG.getCode().equals(houseType)) {
resultMap.put(OrgConstant.HOUSE_TYPE_KEY, HouseTypeEnum.PINGFANG.getName());
} else if (HouseTypeEnum.BIESHU.getCode().equals(houseType)) {
resultMap.put(OrgConstant.HOUSE_TYPE_KEY, HouseTypeEnum.BIESHU.getName());
}
resultMap.put("HOME_ID", neighBorName.concat(buildName).concat(unitName).concat(doorName));
}
if (resultMap.containsKey(OrgConstant.GENDER)) {
String genderValue = null != resultMap.get(OrgConstant.GENDER) ? resultMap.get(OrgConstant.GENDER).toString() : StrConstant.EPMETY_STR;
if (GenderEnum.MAN.getCode().equals(genderValue)) {
resultMap.put(OrgConstant.GENDER, GenderEnum.MAN.getName());
} else if (GenderEnum.WOMAN.getCode().equals(genderValue)) {
resultMap.put(OrgConstant.GENDER, GenderEnum.WOMAN.getName());
} else if (GenderEnum.UN_KNOWN.getCode().equals(genderValue)) {
resultMap.put(OrgConstant.GENDER, GenderEnum.UN_KNOWN.getName());
}
}
}
pageInfo.setList(list);
return new PageData<>(pageInfo.getList(), pageInfo.getTotal());
}
/**
* 编辑页面显示居民信息详情
*
* @param pageFormDTO
* @return java.util.Map
* @author yinzuomei
* @date 2021/10/28 10:29 上午
*/
@Override
public Map queryIcResiDetail(IcResiDetailFormDTO pageFormDTO) {
Map resultMap = new HashMap();
// 先查询主表,主表没有记录,直接返回空
List<Map<String, Object>> icResiUserMapList = icResiUserDao.selectById(pageFormDTO.getIcResiUserId());
if (CollectionUtils.isEmpty(icResiUserMapList)) {
return new HashMap();
}
resultMap.put("ic_resi_user", icResiUserMapList);
//循环查询每个子表的记录
Set<String> subTableList = customerFootBarService.queryIcResiSubTables(pageFormDTO.getCustomerId(), pageFormDTO.getFormCode());
for (String subTalbeName : subTableList) {
List<Map<String, Object>> list = icResiUserDao.selectSubTableRecords(pageFormDTO.getIcResiUserId(), subTalbeName);
if (!CollectionUtils.isEmpty(list)) {
resultMap.put(subTalbeName, list);
}
//else{
// resultMap.put(subTalbeName,new ArrayList<>());
//}
}
return resultMap;
}
}

3
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java

@ -12,6 +12,7 @@ import com.epmet.dataaggre.dto.govorg.result.*;
import com.epmet.dataaggre.dto.resigroup.result.OrgInfoCommonDTO;
import java.util.List;
import java.util.Set;
/**
* @Author zxc
@ -154,4 +155,6 @@ public interface GovOrgService {
* @Date 2021/9/23 10:14
*/
List<String> getStaffOrgList(String staffId);
List<HouseInfoDTO> queryHouseInfo(Set<String> houseIdList);
}

8
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java

@ -532,4 +532,12 @@ public class GovOrgServiceImpl implements GovOrgService {
return customerAgencyDao.getOrgList(staffId);
}
@Override
public List<HouseInfoDTO> queryHouseInfo(Set<String> houseIdList) {
if(CollectionUtils.isEmpty(houseIdList)){
return new ArrayList<>();
}
return customerAgencyDao.queryHouseInfo(houseIdList);
}
}

10
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercustomize/CustomerFootBarService.java

@ -20,8 +20,12 @@ package com.epmet.dataaggre.service.opercustomize;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dataaggre.dto.app.form.AppFootBarFormDTO;
import com.epmet.dataaggre.dto.app.result.AppFootBarResultDTO;
import com.epmet.dataaggre.dto.epmetuser.IcFormResColumnDTO;
import com.epmet.dataaggre.entity.opercustomize.CustomerFootBarEntity;
import java.util.List;
import java.util.Set;
/**
* APP底部菜单栏信息
*
@ -39,4 +43,10 @@ public interface CustomerFootBarService extends BaseService<CustomerFootBarEntit
* @date 2021/7/27 18:59
*/
AppFootBarResultDTO queryAppFootBars(AppFootBarFormDTO footBarFormDTO);
List<IcFormResColumnDTO> queryConditions(String customerId, String formCode);
List<String> querySubTables(String customerId, String formCode);
Set<String> queryIcResiSubTables(String customerId, String formCode);
}

17
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercustomize/impl/CustomerFootBarServiceImpl.java

@ -27,6 +27,7 @@ import com.epmet.dataaggre.dao.opercustomize.CustomerFootBarDao;
import com.epmet.dataaggre.dto.app.form.AppFootBarFormDTO;
import com.epmet.dataaggre.dto.app.result.AppFootBarResultDTO;
import com.epmet.dataaggre.dto.app.result.CustomerFootBarDTO;
import com.epmet.dataaggre.dto.epmetuser.IcFormResColumnDTO;
import com.epmet.dataaggre.entity.opercrm.CustomerParameterEntity;
import com.epmet.dataaggre.entity.opercustomize.CustomerFootBarEntity;
import com.epmet.dataaggre.service.opercrm.CustomerParameterService;
@ -38,6 +39,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Set;
/**
@ -112,4 +114,19 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD
return resultDTO;
}
@Override
public List<IcFormResColumnDTO> queryConditions(String customerId, String formCode) {
return baseDao.queryConditions(customerId,formCode);
}
@Override
public List<String> querySubTables(String customerId, String formCode) {
return baseDao.querySubTables(customerId,formCode);
}
@Override
public Set<String> queryIcResiSubTables(String customerId, String formCode) {
return baseDao.queryIcResiSubTables(customerId,formCode);
}
}

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

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dataaggre.dao.epmetuser.IcResiUserDao">
<!-- <insert id="add">-->
<!-- insert into ${tableName}-->
<!-- (-->
<!-- <foreach collection="map.entrySet()" index="key" item="value" separator=",">-->
<!-- ${key}-->
<!-- </foreach>-->
<!-- ,DEL_FLAG-->
<!-- ,REVISION-->
<!-- ,CREATED_TIME-->
<!-- ,UPDATED_TIME-->
<!-- ) values-->
<!-- (-->
<!-- <foreach collection="map.entrySet()" index="key" item="value" separator=",">-->
<!-- #{value}-->
<!-- </foreach>-->
<!-- ,'0'-->
<!-- ,'0'-->
<!-- ,NOW()-->
<!-- ,NOW()-->
<!-- )-->
<!-- </insert>-->
<select id="selectListResi" parameterType="map" resultType="com.epmet.dataaggre.dto.epmetuser.result.IcResiUserPageResultDTO">
select
ic_resi_user.id as icResiUserId,
<foreach item="column" collection="resultColumns" open="" separator="," close="">
${column.columnName}
</foreach>
,
GROUP_CONCAT(ic_resi_demand.CATEGORY_CODE) as demandCategoryIds,
GROUP_CONCAT(ic_resi_demand_dict.CATEGORY_NAME) as demandName
FROM
ic_resi_user
<if test="null != subTables and subTables.size() > 0">
<foreach item="subTableName" collection="subTables" open="" separator="" close="">
${subTableName}
</foreach>
</if>
left join ic_resi_demand_dict
on(ic_resi_user.customer_id=ic_resi_demand_dict.CUSTOMER_ID
and ic_resi_demand.CATEGORY_CODE=ic_resi_demand_dict.CATEGORY_CODE )
WHERE
ic_resi_user.DEL_FLAG = '0'
and ic_resi_user.customer_id=#{customerId}
<if test="null != conditions and conditions.size() > 0">
<foreach item="subCondition" collection="conditions" open="" separator="" close="">
<if test="null != subCondition.columnValue and subCondition.columnValue.size() > 0">
<if test="subCondition.queryType!= null and subCondition.queryType == 'equal' ">
and ${subCondition.tableName}.${subCondition.columnName} = #{subCondition.columnValue[0]}
</if>
<if test="subCondition.queryType!= null and subCondition.queryType == 'like' ">
and ${subCondition.tableName}.${subCondition.columnName} like concat('%',#{subCondition.columnValue[0]},'%')
</if>
<if test="subCondition.queryType!= null and subCondition.queryType == 'daterange' ">
and ${subCondition.tableName}.${subCondition.columnName} between #{subCondition.columnValue[0]} and #{subCondition.columnValue[1]}
</if>
</if>
</foreach>
</if>
group by IC_RESI_USER.id
order by ic_resi_user.CREATED_TIME desc
</select>
<select id="selectById" parameterType="java.lang.String" resultType="map">
select * from ic_resi_user where del_flag='0' and id=#{icResiUserId}
</select>
<select id="selectSubTableRecords" parameterType="map" resultType="map">
select * from ${tableName} where del_flag='0' and IC_RESI_USER=#{icResiUserId}
</select>
<select id="selectListResiMap" parameterType="map" resultType="map">
select
ic_resi_user.id as icResiUserId,
<foreach item="column" collection="resultColumns" open="" separator="," close="">
${column.columnName}
</foreach>
,
GROUP_CONCAT(ic_resi_demand.CATEGORY_CODE) as DEMAND_CATEGORY_IDS,
GROUP_CONCAT(ic_resi_demand_dict.CATEGORY_NAME) as DEMAND_NAME
FROM
ic_resi_user
<if test="null != subTables and subTables.size() > 0">
<foreach item="subTableName" collection="subTables" open="" separator="" close="">
${subTableName}
</foreach>
</if>
left join ic_resi_demand_dict
on(ic_resi_user.customer_id=ic_resi_demand_dict.CUSTOMER_ID
and ic_resi_demand.CATEGORY_CODE=ic_resi_demand_dict.CATEGORY_CODE )
WHERE
ic_resi_user.DEL_FLAG = '0'
and ic_resi_user.customer_id=#{customerId}
<if test="null != conditions and conditions.size() > 0">
<foreach item="subCondition" collection="conditions" open="" separator="" close="">
<if test="null != subCondition.columnValue and subCondition.columnValue.size() > 0">
<if test="subCondition.queryType!= null and subCondition.queryType == 'equal' ">
and ${subCondition.tableName}.${subCondition.columnName} = #{subCondition.columnValue[0]}
</if>
<if test="subCondition.queryType!= null and subCondition.queryType == 'like' ">
and ${subCondition.tableName}.${subCondition.columnName} like concat('%',#{subCondition.columnValue[0]},'%')
</if>
<if test="subCondition.queryType!= null and subCondition.queryType == 'daterange' ">
and ${subCondition.tableName}.${subCondition.columnName} between #{subCondition.columnValue[0]} and #{subCondition.columnValue[1]}
</if>
</if>
</foreach>
</if>
group by IC_RESI_USER.id
order by ic_resi_user.CREATED_TIME desc
</select>
</mapper>

22
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml

@ -286,4 +286,26 @@
AND USER_ID = #{staffId}
</select>
<select id="queryHouseInfo" parameterType="map" resultType="com.epmet.dataaggre.dto.govorg.result.HouseInfoDTO">
SELECT
ih.ID as homeId,
ih.NEIGHBOR_HOOD_ID as neighborHoodId,
n.NEIGHBOR_HOOD_NAME as neighborHoodName,
ih.BUILDING_ID as buildingId,
ib.BUILDING_NAME as buildingName,
ih.BUILDING_UNIT_ID as buildingUnitId,
u.UNIT_NAME as unitName,
ih.DOOR_NAME as doorName,
ih.house_type
FROM
ic_house ih
left JOIN ic_neighbor_hood n ON ( ih.NEIGHBOR_HOOD_ID = n.id )
left JOIN ic_building ib ON ( ih.BUILDING_ID = ib.id )
left JOIN ic_building_unit u ON ( ih.BUILDING_UNIT_ID = u.ID )
WHERE
ih.DEL_FLAG = '0'
<foreach collection="houseIdList" item="houseId" separator=" OR " open="AND (" close=")">
ih.ID = #{houseId}
</foreach>
</select>
</mapper>

51
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercustomize/CustomerFootBarDao.xml

@ -38,4 +38,55 @@
and c.BAR_KEY=#{barKey}
AND C.DISPLAY='1'
</select>
<select id="queryConditions" parameterType="map" resultType="com.epmet.dataaggre.dto.epmetuser.IcFormResColumnDTO">
select
temp.table_name,
concat(temp.table_name,'.',temp.columnName) as columnName,
temp.LABEL
from (
SELECT
( CASE WHEN M.ITEM_GROUP_ID = '0' THEN 'ic_resi_user' ELSE g.TABLE_NAME END ) AS table_name,
m.COLUMN_NAME AS columnName,
m.LABEL
FROM
ic_form_item m
LEFT JOIN ic_form_item_group g ON ( m.ITEM_GROUP_ID = g.id )
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_ID = #{customerId}
and m.FORM_CODE=#{formCode}
AND m.LIST_DISPLAY = '1'
)temp
</select>
<select id="querySubTables" parameterType="map" resultType="java.lang.String">
select
CONCAT('left join ',temp.TABLE_NAME, ' on ( ic_resi_user.ID=',temp.TABLE_NAME,'.IC_RESI_USER and ',temp.TABLE_NAME,'.del_flag="0" )') as subTables
from (
SELECT DISTINCT
m.TABLE_NAME
FROM
ic_form_item_group m
WHERE
m.DEL_FLAG = '0'
AND m.TABLE_NAME IS NOT NULL
AND m.TABLE_NAME != ''
AND m.CUSTOMER_ID = #{customerId}
AND m.FORM_CODE = #{formCode}
)temp
</select>
<select id="queryIcResiSubTables" parameterType="map" resultType="java.lang.String">
SELECT DISTINCT
m.TABLE_NAME
FROM
ic_form_item_group m
WHERE
m.DEL_FLAG = '0'
AND m.TABLE_NAME IS NOT NULL
AND m.TABLE_NAME != ''
AND m.CUSTOMER_ID = #{customerId}
AND m.FORM_CODE = #{formCode}
</select>
</mapper>

12
epmet-module/data-statistical/data-statistical-client/pom.xml

@ -17,6 +17,18 @@
<artifactId>epmet-commons-tools</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>open-data-worker-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>open-data-worker-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

22
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/EventInfoFormDTO.java

@ -0,0 +1,22 @@
package com.epmet.dto.basereport.form;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data;
import java.io.Serializable;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/10/15 10:55
*/
@Data
public class EventInfoFormDTO extends PageFormDTO implements Serializable {
private static final long serialVersionUID = 8479649048108914555L;
private String customerId;
private String projectId;
/**
* 操作类型新增:add 修改删除:edit
*/
private String type;
}

190
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/result/EventInfoResultDTO.java

@ -0,0 +1,190 @@
package com.epmet.dto.basereport.result;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/10/15 10:57
*/
@Data
public class EventInfoResultDTO implements Serializable {
private static final long serialVersionUID = -6483163020737762044L;
/**
* 主键
*/
private String id;
/**
* 客户Id
*/
private String customerId;
private Integer detpId;
private String reporterId;
/**
* 网格编码
*/
private String orgCode;
/**
* 网格名称
*/
private String orgName;
/**
* 事件名称
*/
private String eventName;
/**
* 事件类别
*/
private String eventCategory;
/**
* 上报时间 YYYY-MM-DD HH:MM:SS
*/
private Date reportTime;
/**
* 发生时间 格式为YYYY-MM-DD
*/
private Date happenDate;
/**
* 发生地点
*/
private String happenPlace;
/**
* 事件简述
*/
private String eventDescription;
/**
* 办结方式 01自办02上报 源于居民端的最终结案的项目为02工作端立项的项目最终结案的01
*/
private String waysOfResolving;
/**
* 是否办结 YN
*/
private String successfulOrNo;
/**
* 办结层级
01省自治区直辖市
02地
03县
04乡镇街道
05片区
06村社区
07网格
*/
private String completeLevel;
/**
* 基础信息主键
*/
private String baseInfoId;
/**
* 办结时间
*/
private Date completeTime;
/**
* 经度
*/
private BigDecimal lng;
/**
* 纬度
*/
private BigDecimal lat;
/**
* 主要当事人姓名
*/
private String name;
/**
* 涉及人数
*/
private Integer numberInvolved;
/**
* 涉及单位
*/
private String relatedUnits;
/**
* 重点场所类别 01九小场所, 02公共场所
*/
private String keyAreaType;
/**
* 宗教活动规模 01 0-50人,02 51-200人,03 201人以上
*/
private String religionScale;
/**
* 宗教类别 01道教 02佛教 03基督教 04伊斯兰教 05其他
*/
private String religionType;
/**
* 重点场所是否变动 YN
*/
private String isKeyareaState;
/**
* 重点人员是否在当地 YN
*/
private String isKeypeopleLocate;
/**
* 重点人员现状
*/
private String keypeopleStatus;
/**
* 删除标识 0.未删除 1.已删除
*/
private Long delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

34
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/form/GridBaseInfoFormDTO.java

@ -0,0 +1,34 @@
package com.epmet.dto.org.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* @dscription 插叙客户网格基础信息--接口入参
* @author sun
*/
@Data
public class GridBaseInfoFormDTO implements Serializable {
private static final long serialVersionUID = -3634745091993094743L;
/**
* 客户Id
*/
@NotBlank(message = "事件标识不能为空", groups = {Grid.class})
private String customerId = "";
/**
* 网格Id
*/
private List<String> orgIdList;
/**
* 操作类型新增:add 修改删除:edit 初始化所有数据:all
*/
private String type;
public interface Grid extends CustomerClientShowGroup {}
}

150
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/CustomerAgencyDTO.java

@ -0,0 +1,150 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.org.result;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 机关单位信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-04-20
*/
@Data
public class CustomerAgencyDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 上级组织机构ID
*/
private String pid;
/**
* 所有上级组织机构ID(以英文:隔开)
*/
private String pids;
/**
* 所有上级名称,-连接
*/
private String allParentName;
/**
* 组织名称
*/
private String organizationName;
/**
* 机关级别社区级community
街道:street,
区县级: district,
市级: city
省级:province 机关级别社区级community街道:street,区县级: district,市级: city省级:province
*/
private String level;
/**
* 地区编码
*/
private String areaCode;
/**
* 省组织编码
*/
private String code;
/**
* 删除标识
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 总人数
*/
private Integer totalUser;
/**
*
*/
private String province;
/**
*
*/
private String city;
/**
* 区县
*/
private String district;
/**
* 当前组织的上级行政地区编码add0204;举例平阴县对应的是济南市3701
*/
private String parentAreaCode;
/**
* 街道
*/
private String street;
/**
* 社区
*/
private String community;
}

134
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/CustomerGridDTO.java

@ -0,0 +1,134 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.org.result;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 客户网格表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-16
*/
@Data
public class CustomerGridDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID 唯一标识
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 网格名称
*/
private String gridName;
/** 组织-网格 */
private String gridNamePath;
/**
* 中心位置经度
*/
private String longitude;
/**
* 中心位置纬度
*/
private String latitude;
/**
* 所属地区码所属组织地区码
*/
private String areaCode;
/**
* 省网格编码
*/
private String code;
/**
* 删除标识:0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 管辖区域
*/
private String manageDistrict;
/**
* 当前网格总人数
*/
private Integer totalUser;
/**
* 所属组织机构IDcustomer_organization.id
*/
private String pid;
/**
* 所有上级组织ID
*/
private String pids;
/**
* 所属组织机构名
*/
private String agencyName;
/**
* 所有上级组织名
*/
private String allParentName;
}

103
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/GridBaseInfoDTO.java

@ -0,0 +1,103 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.org.result;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 网格员基础信息表
*/
@Data
public class GridBaseInfoDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 网格Id
*/
private String gridId;
/**
* 工作人员Id
*/
private String staffId;
/**
* 客户Id
*/
private String customerId;
/**
* 网格编码
*/
private String code;
/**
* 网格名称
*/
private String gridName;
/**
* 网格员姓名
*/
private String GRID_LEVEL;
/**
* 专属网格类型[01:党政机关; 02:医院; 03:学校; 04:企业; 05:园区; 06:商圈; 07:市场; 08:景区;
*/
private String GRID_TYPE;
/**
* 网格内人口规模[01:500人以下含500人; 02:500-1000人含1000人; 03:1000-1500人含1500人; 04:1500人以上]
*/
private String POPULATION_SIZE;
/**
* 是否成立网格党支部或网格党小组[YN]
*/
private String IS_PARTY_BRANCH;
/**
* 网格党组织类型[01:网格党支部; 02:网格党小组]
*/
private String PARTY_BRANCH_TYPE;
/**
* 中心点质心经度
*/
private String LNG;
/**
* 中心点质心纬度
*/
private String LAT;
/**
* 网格颜色
*/
private Date GRID_COLOR;
/**
* 空间范围
*/
private String SHAPE;
}

2
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenCustomerGridDTO.java

@ -43,7 +43,7 @@ public class ScreenCustomerGridDTO implements Serializable {
* 客户id
*/
private String customerId;
private String code;
/**
* 网格id
*/

12
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java

@ -132,6 +132,8 @@ public class ScreenProjectDataDTO implements Serializable {
*/
private BigDecimal latitude;
private String projectCreator;
/**
* 删除标识 0未删除1已删除
*/
@ -170,7 +172,7 @@ public class ScreenProjectDataDTO implements Serializable {
/**
* 结案日期
*/
private String closeCaseTime;
private Date closeCaseTime;
/**
* 数据更新至: yyyy|yyyMM|yyyyMMdd
@ -196,4 +198,12 @@ public class ScreenProjectDataDTO implements Serializable {
* fact_origin_project_main_daily.grid_id对应的网格名称
*/
private String tempGridName;
private String finishOrg;
private String finishOrgLevel;
private String orgIdPath;
private String finishOrgType;
}

7
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenProjectDataInfoFormDTO.java

@ -115,7 +115,8 @@ public class ScreenProjectDataInfoFormDTO implements Serializable {
/**
* 结案日期
*/
private String closeCaseTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date closeCaseTime;
/**
* 所有上级ID用英文逗号分开
@ -131,4 +132,8 @@ public class ScreenProjectDataInfoFormDTO implements Serializable {
* 满意度得分
*/
private BigDecimal satisfactionScore;
/**
* 项目创建人
*/
private String projectCreator;
}

33
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/form/StaffBaseInfoFormDTO.java

@ -0,0 +1,33 @@
package com.epmet.dto.user.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* @dscription 插叙客户网格人员基础信息--接口入参
* @author sun
*/
@Data
public class StaffBaseInfoFormDTO implements Serializable {
private static final long serialVersionUID = -3634745091993094743L;
/**
* 客户Id
*/
@NotBlank(message = "事件标识不能为空", groups = {Staff.class})
private String customerId = "";
/**
* 人员Id
*/
private List<String> staffIdList;
/**
* 操作类型新增:add 修改删除:edit
*/
private String type;
public interface Staff extends CustomerClientShowGroup {}
}

29
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/param/MidPatrolFormDTO.java

@ -0,0 +1,29 @@
package com.epmet.dto.user.param;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* desc:查询巡查 参数
*
* @author zhaoqifeng
* @dscription
* @date 2021/6/7 16:23
*/
@NoArgsConstructor
@Data
public class MidPatrolFormDTO extends PageFormDTO implements Serializable {
private static final long serialVersionUID = 4411051728689886810L;
/**
* 客户Id
*/
private String customerId;
/**
* 巡查记录id 没有则查询全部
*/
private String patrolId;
}

182
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/GridUserInfoDTO.java

@ -0,0 +1,182 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.user.result;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 网格员基础信息表
*/
@Data
public class GridUserInfoDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 网格Id
*/
private String gridId;
/**
* 工作人员Id
*/
private String staffId;
/**
* 客户Id
*/
private String customerId;
/**
* 网格编码
*/
private String code;
/**
* 网格名称
*/
private String gridName;
/**
* 网格员姓名
*/
private String nickName;
/**
* 专属网格类型[01:党政机关; 02:医院; 03:学校; 04:企业; 05:园区; 06:商圈; 07:市场; 08:景区;
*/
private String cardNum;
/**
* 网格员类型[01:专职网格员; 02:兼职网格员; 03:网格长; 04:综治机构人员; 05:职能部门人员]
*/
private String userType;
/**
* 手机号码
*/
private String phonenumber;
/**
* 性别[1:男性; 2:女性; 9:未说明的性别]
*/
private String sex;
/**
* 民族[字典表主键]
*/
private String nation;
/**
* 政治面貌[字典表主键]
*/
private String paerty;
/**
* 出生日期[YYYY-MM-DD]
*/
private Date birthday;
/**
* 学历[字典表主键]
*/
private String education;
/**
* 入职时间
*/
private Date entryDate;
/**
* 是否离职
*/
private String isLeave;
/**
* 离职时间
*/
private Date leaveDate;
/**
* 网格员年收入
*/
private String income;
/**
* 是否社区两委委员[YN]
*/
private String isCommittee;
/**
* 是否社区工作者[YN]
*/
private String isCommunityWorkers;
/**
* 是否社会工作者[YN]
*/
private String isSocialWorker;
/**
* 是否村民小组长[YN
*/
private String isVillageLeader;
/**
* 是否警务助理[YN]
*/
private String isPoliceAssistant;
/**
* 是否人民调解员[YN]
*/
private String isMediator;
/**
* 删除标识 0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

56
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/MidPatrolDetailResult.java

@ -0,0 +1,56 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.user.result;
import lombok.Data;
import java.io.Serializable;
/**
* 工作人员巡查明细记录
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-06-07
*/
@Data
public class MidPatrolDetailResult implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户Id
*/
private String customerId;
/**
* 维度
*/
private String latitude;
/**
* 经度
*/
private String longitude;
}

137
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/MidPatrolRecordResult.java

@ -0,0 +1,137 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.user.result;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 工作人员巡查主记录
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-06-07
*/
@Data
public class MidPatrolRecordResult implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户Id
*/
private String customerId;
/**
* 网格id
*/
private String grid;
/**
* 网格所有上级id
*/
private String gridPids;
/**
* 工作人员用户id
*/
private String staffId;
/**
* 工作人员所属组织id=网格所属的组织id
*/
private String agencyId;
/**
* 巡查开始时间
*/
private Date patrolStartTime;
/**
* 巡查结束时间,前端传入
*/
private Date patrolEndTime;
/**
* 实际结束时间=操作结束巡查的时间
*/
private Date actrualEndTime;
/**
* 本次巡查总耗时单位秒结束巡查时写入
*/
private Integer totalTime;
/**
* 正在巡查中patrolling结束end
*/
private String status;
/**
* 删除标识 0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 维度
*/
private String latitude;
/**
* 精度
*/
private String longitude;
/**
* 经纬度组合成的路线 经度,维度;
*/
private String route;
}

71
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java

@ -3,17 +3,31 @@ package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.StatsFormDTO;
import com.epmet.dto.extract.form.*;
import com.epmet.dto.basereport.form.EventInfoFormDTO;
import com.epmet.dto.basereport.result.EventInfoResultDTO;
import com.epmet.dto.extract.form.BizDataFormDTO;
import com.epmet.dto.extract.form.ExtractIndexFormDTO;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.dto.extract.form.ExtractScreenFormDTO;
import com.epmet.dto.group.form.GroupStatsFormDTO;
import com.epmet.dto.group.form.GroupTotalFormDTO;
import com.epmet.dto.org.form.GridBaseInfoFormDTO;
import com.epmet.dto.org.result.CustomerAgencyDTO;
import com.epmet.dto.org.result.CustomerGridDTO;
import com.epmet.dto.screen.form.InitCustomerIndexForm;
import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO;
import com.epmet.feign.impl.DataStatisticalOpenFeignClientFallBack;
import com.epmet.dto.user.form.StaffBaseInfoFormDTO;
import com.epmet.dto.user.param.MidPatrolFormDTO;
import com.epmet.dto.user.result.GridUserInfoDTO;
import com.epmet.dto.user.result.MidPatrolDetailResult;
import com.epmet.dto.user.result.MidPatrolRecordResult;
import com.epmet.feign.impl.DataStatisticalOpenFeignClientFallBackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* desc: 数据统计 对外feign client
*
@ -274,4 +288,57 @@ public interface DataStatisticalOpenFeignClient {
*/
@PostMapping("/data/stats/statsgroup/groupandhottopic")
Result groupAndHotTopicTask(@RequestBody GroupTotalFormDTO formDTO);
/**
* @dscription 批量查询客户组织基础信息
* @author sun
*/
@PostMapping("/data/stats/datareporting/agencybaseinfo")
Result<List<CustomerAgencyDTO>> getAgencyBaseInfo(@RequestBody GridBaseInfoFormDTO formDTO);
/**
* @dscription 批量查询客户网格基础信息
* @author sun
*/
@PostMapping("/data/stats/datareporting/gridbaseinfo")
Result<List<CustomerGridDTO>> getGridBaseInfo(@RequestBody GridBaseInfoFormDTO formDTO);
/**
* @dscription 批量查询客户网格员基础信息
* @author sun
*/
@PostMapping("/data/stats/datareporting/staffbaseinfo")
Result<List<GridUserInfoDTO>> getStaffBaseInfo(@RequestBody StaffBaseInfoFormDTO formDTO);
/**
* 根据巡查记录id 获取巡查主记录信息
*
* @param midPatrolFormDTO
* @return
* @author yinzuomei
* @date 2021/9/10 8:56 上午
*/
@PostMapping(value = "/data/stats/datareporting/getPatrolRecordList")
Result<List<MidPatrolRecordResult>> getPatrolRecordList(@RequestBody MidPatrolFormDTO midPatrolFormDTO);
/**
* 根据巡查记录id 获取巡查轨迹明细信息
*
* @param midPatrolFormDTO
* @return
* @author yinzuomei
* @date 2021/9/10 8:56 上午
*/
@PostMapping(value = "/data/stats/datareporting/getPatrolDetailList")
Result<List<MidPatrolDetailResult>> getPatrolDetailList(@RequestBody MidPatrolFormDTO midPatrolFormDTO);
/**
* 事件上报
* @Param formDTO
* @Return {@link Result<List<BaseDisputeProcessDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/15 16:50
*/
@PostMapping("/data/stats/datareporting/eventinfo")
Result<List<EventInfoResultDTO>> getEventInfo(@RequestBody EventInfoFormDTO formDTO);
}

73
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java

@ -4,13 +4,27 @@ 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.StatsFormDTO;
import com.epmet.dto.extract.form.*;
import com.epmet.dto.basereport.form.EventInfoFormDTO;
import com.epmet.dto.basereport.result.EventInfoResultDTO;
import com.epmet.dto.extract.form.BizDataFormDTO;
import com.epmet.dto.extract.form.ExtractIndexFormDTO;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.dto.extract.form.ExtractScreenFormDTO;
import com.epmet.dto.group.form.GroupStatsFormDTO;
import com.epmet.dto.group.form.GroupTotalFormDTO;
import com.epmet.dto.org.form.GridBaseInfoFormDTO;
import com.epmet.dto.org.result.CustomerAgencyDTO;
import com.epmet.dto.org.result.CustomerGridDTO;
import com.epmet.dto.screen.form.InitCustomerIndexForm;
import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO;
import com.epmet.dto.user.form.StaffBaseInfoFormDTO;
import com.epmet.dto.user.param.MidPatrolFormDTO;
import com.epmet.dto.user.result.GridUserInfoDTO;
import com.epmet.dto.user.result.MidPatrolDetailResult;
import com.epmet.dto.user.result.MidPatrolRecordResult;
import com.epmet.feign.DataStatisticalOpenFeignClient;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* desc:
@ -265,4 +279,59 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp
public Result groupAndHotTopicTask(GroupTotalFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "groupAndHotTopic", formDTO);
}
@Override
public Result<List<CustomerAgencyDTO>> getAgencyBaseInfo(GridBaseInfoFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "getAgencyBaseInfo", formDTO);
}
@Override
public Result<List<CustomerGridDTO>> getGridBaseInfo(GridBaseInfoFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "getGridBaseInfo", formDTO);
}
@Override
public Result<List<GridUserInfoDTO>> getStaffBaseInfo(StaffBaseInfoFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "getStaffBaseInfo", formDTO);
}
/**
* 根据巡查记录id 获取巡查主记录信息
*
* @param midPatrolFormDTO
* @return
* @author yinzuomei
* @date 2021/9/10 8:56 上午
*/
@Override
public Result<List<MidPatrolRecordResult>> getPatrolRecordList(MidPatrolFormDTO midPatrolFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "getPatrolRecordList", midPatrolFormDTO);
}
/**
* 根据巡查记录id 获取巡查轨迹明细信息
*
* @param midPatrolFormDTO
* @return
* @author yinzuomei
* @date 2021/9/10 8:56 上午
*/
@Override
public Result<List<MidPatrolDetailResult>> getPatrolDetailList(MidPatrolFormDTO midPatrolFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "getPatrolDetailList", midPatrolFormDTO);
}
/**
* 事件上报
*
* @param formDTO
* @Param formDTO
* @Return {@link Result<List< EventInfoResultDTO >>}
* @Author zhaoqifeng
* @Date 2021/10/15 16:50
*/
@Override
public Result<List<EventInfoResultDTO>> getEventInfo(EventInfoFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "getEventInfo", formDTO);
}
}

28
epmet-module/data-statistical/data-statistical-server/pom.xml

@ -97,7 +97,21 @@
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>2.2.6</version>
<version>2.2.10</version>
<exclusions>
<exclusion>
<artifactId>poi</artifactId>
<groupId>org.apache.poi</groupId>
</exclusion>
<exclusion>
<artifactId>poi-ooxml</artifactId>
<groupId>org.apache.poi</groupId>
</exclusion>
<exclusion>
<artifactId>poi-ooxml-schemas</artifactId>
<groupId>org.apache.poi</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.github.wnjustdoit</groupId>
@ -116,6 +130,18 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>open-data-worker-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-message-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/OrgTypeConstant.java

@ -46,4 +46,14 @@ public interface OrgTypeConstant {
*/
String COMMUNITY = "community";
/**
* 省级
*/
String PROVINCE = "province";
/**
* 市级
*/
String CITY = "city";
}

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java

@ -82,4 +82,12 @@ public interface ProjectConstant {
*/
String PROJECT_ORIGIN_AGENCY="agency";
String PROJECT_ORIGIN_EVENT="resi_event";
/**
* 自办
*/
String PROJECT_SELF_CLOSED="01";
/**
* 上报
*/
String PROJECT_REPORT="02";
}

106
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DataReportingController.java

@ -0,0 +1,106 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.basereport.form.EventInfoFormDTO;
import com.epmet.dto.basereport.result.EventInfoResultDTO;
import com.epmet.dto.org.form.GridBaseInfoFormDTO;
import com.epmet.dto.org.result.CustomerAgencyDTO;
import com.epmet.dto.org.result.CustomerGridDTO;
import com.epmet.dto.user.form.StaffBaseInfoFormDTO;
import com.epmet.dto.user.param.MidPatrolFormDTO;
import com.epmet.dto.user.result.GridUserInfoDTO;
import com.epmet.dto.user.result.MidPatrolDetailResult;
import com.epmet.dto.user.result.MidPatrolRecordResult;
import com.epmet.opendata.dto.BaseDisputeProcessDTO;
import com.epmet.service.DataReportingService;
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;
import java.util.List;
/**
* @dscription 省网格化平台数据上报--数据查询
* @author sun
*/
@RequestMapping("datareporting")
@RestController
public class DataReportingController {
@Autowired
private DataReportingService dataReportingService;
/**
* @Author sun
* @Description 批量查询客户组织基础信息
**/
@PostMapping("agencybaseinfo")
public Result<List<CustomerAgencyDTO>> getAgencyBaseInfo(@RequestBody(required = false) GridBaseInfoFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, GridBaseInfoFormDTO.Grid.class);
return new Result<List<CustomerAgencyDTO>>().ok(dataReportingService.getAgencyBaseInfo(formDTO));
}
/**
* @Author sun
* @Description 批量查询客户网格基础信息
**/
@PostMapping("gridbaseinfo")
public Result<List<CustomerGridDTO>> getGridBaseInfo(@RequestBody(required = false) GridBaseInfoFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, GridBaseInfoFormDTO.Grid.class);
return new Result<List<CustomerGridDTO>>().ok(dataReportingService.getGridBaseInfo(formDTO));
}
/**
* @Author sun
* @Description 批量查询客户网格员基础信息
**/
@PostMapping("staffbaseinfo")
public Result<List<GridUserInfoDTO>> getStaffBaseInfo(@RequestBody(required = false) StaffBaseInfoFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, StaffBaseInfoFormDTO.Staff.class);
return new Result<List<GridUserInfoDTO>>().ok(dataReportingService.getStaffBaseInfo(formDTO));
}
/**
* desc: 条件获取巡查主表信息
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.user.result.MidPatrolRecordResult>>
* @author LiuJanJun
* @date 2021/10/15 12:01 下午
*/
@PostMapping("getPatrolRecordList")
public Result<List<MidPatrolRecordResult>> getPatrolRecordList(@RequestBody(required = false) MidPatrolFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, StaffBaseInfoFormDTO.Staff.class);
return new Result<List<MidPatrolRecordResult>>().ok(dataReportingService.getPatrolRecordList(formDTO));
}
/**
* desc: 条件获取巡查明细信息
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.user.result.CustomerStaffDTO>>
* @author LiuJanJun
* @date 2021/10/15 12:01 下午
*/
@PostMapping("getPatrolDetailList")
public Result<List<MidPatrolDetailResult>> getPatrolDetailList(@RequestBody(required = false) MidPatrolFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, StaffBaseInfoFormDTO.Staff.class);
return new Result<List<MidPatrolDetailResult>>().ok(dataReportingService.getPatrolDetailList(formDTO));
}
/**
* @Description 事件上报
* @Param formDTO
* @Return {@link Result<List<BaseDisputeProcessDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/15 14:09
*/
@PostMapping("eventinfo")
public Result<List<EventInfoResultDTO>> getEventInfo(@RequestBody(required = false) EventInfoFormDTO formDTO) {
return new Result<List<EventInfoResultDTO>>().ok(dataReportingService.getEventInfo(formDTO));
}
}

1
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java

@ -61,7 +61,6 @@ import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.Date;
import java.util.ArrayList;
import java.util.List;

18
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java

@ -55,16 +55,28 @@ public interface ScreenProjectCategoryOrgDailyDao extends BaseDao<ScreenProjectC
List<CategoryProjectResultDTO> selectOrgCategoryInfo(@Param("customerId") String customerId, @Param("dateId") String dateId,@Param("level")String level);
/**
* @Description 查询组织分类信息多客户
* @Description 查询组织分类信息多客户父客户存在的分类
* @Param customerId
* @Param dateId
* @Param level
* @Param existsStatus 父客户是否存在
* @author zxc
* @date 2021/3/24 下午2:48
*/
List<CategoryProjectResultDTO> selectOrgCategoryMoreCustomerInfo(@Param("customerIds")List<String> customerIds, @Param("dateId") String dateId,
@Param("level")String level, @Param("customerId")String customerId, @Param("existsStatus")Boolean existsStatus);
@Param("level")String level, @Param("customerId")String customerId);
/**
* @Description 查询组织分类信息多客户父客户存在的分类
* @param customerIds
* @param dateId
* @param level
* @param customerId
* @author zxc
* @date 2021/10/21 4:03 下午
*/
List<CategoryProjectResultDTO> selectOrgCategoryMoreCustomerInfoNotExists(@Param("customerIds")List<String> customerIds, @Param("dateId") String dateId,
@Param("level")String level, @Param("customerId")String customerId);
/**
* @Description 查询组织分类信息多客户升级版
* @Param customerIds

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java

@ -66,4 +66,6 @@ public interface ScreenProjectDataDao extends BaseDao<ScreenProjectDataEntity> {
void deleteByProjectIds(@Param("customerId") String customerId, @Param("list") List<String> list);
int updateProjectSatisfactionScore(@Param("projectId")String projectId, @Param("score")BigDecimal score);
List<ScreenProjectDataDTO> selectProjectList(@Param("customerId") String customerId, @Param("projectId") String projectId);
}

16
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java

@ -23,6 +23,10 @@ import com.epmet.dto.group.result.AgencyGridTotalCountResultDTO;
import com.epmet.dto.group.result.GridIdListByCustomerResultDTO;
import com.epmet.dto.org.CustomerStaffGridDTO;
import com.epmet.dto.org.GridInfoDTO;
import com.epmet.dto.org.form.GridBaseInfoFormDTO;
import com.epmet.dto.org.result.CustomerGridDTO;
import com.epmet.dto.user.form.StaffBaseInfoFormDTO;
import com.epmet.dto.user.result.GridUserInfoDTO;
import com.epmet.entity.org.CustomerGridEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -95,4 +99,16 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
* @Description 查询客户已删除网格列表
**/
List<String> selectDelGridList(@Param("customerId") String customerId);
/**
* @Author sun
* @Description 批量查询客户网格基础信息
**/
List<CustomerGridDTO> getGridBaseInfo(GridBaseInfoFormDTO formDTO);
/**
* @Author sun
* @Description 查询工作人员所属网格信息
**/
List<GridUserInfoDTO> getStaffGrid(StaffBaseInfoFormDTO formDTO);
}

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java

@ -2,6 +2,8 @@ package com.epmet.dao.org;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.AgencySubTreeDto;
import com.epmet.dto.org.form.GridBaseInfoFormDTO;
import com.epmet.dto.org.result.CustomerAgencyDTO;
import com.epmet.dto.org.result.CustomerAreaCodeResultDTO;
import com.epmet.dto.org.result.OrgStaffDTO;
import com.epmet.entity.org.CustomerAgencyEntity;
@ -71,4 +73,10 @@ public interface StatsCustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
CustomerAgencyEntity selectByDeptId(String deptId);
CustomerAgencyEntity selecByAreaCode(@Param("customerId")String customerId, @Param("areaCode")String areaCode);
/**
* @Author sun
* @Description 批量查询客户组织基础信息
**/
List<CustomerAgencyDTO> getAgencyBaseInfo(GridBaseInfoFormDTO formDTO);
}

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java

@ -5,6 +5,8 @@ import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO;
import com.epmet.dto.extract.result.UserPartyResultDTO;
import com.epmet.dto.screen.ScreenProjectDataDTO;
import com.epmet.dto.stats.form.GmUploadEventFormDTO;
import com.epmet.dto.user.form.StaffBaseInfoFormDTO;
import com.epmet.dto.user.param.MidPatrolFormDTO;
import com.epmet.dto.user.result.*;
import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity;
import org.apache.ibatis.annotations.Mapper;
@ -252,5 +254,15 @@ public interface UserDao {
* @author sun
*/
int saveOrUpGmUploadEvent(@Param("list") List<GmUploadEventFormDTO.DataList> list);
/**
* @Author sun
* @Description 批量查询客户网格员基础信息
**/
List<CustomerStaffDTO> getStaffBaseInfo(StaffBaseInfoFormDTO formDTO);
List<MidPatrolRecordResult> getPatrolRecordList(MidPatrolFormDTO formDTO);
List<MidPatrolDetailResult> getPatrolDetailList(MidPatrolFormDTO formDTO);
}

1
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerAgencyEntity.java

@ -94,7 +94,6 @@ public class ScreenCustomerAgencyEntity extends BaseEpmetEntity {
* 行政地区编码
*/
private String areaCode;
private String sourceType;
/**

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerGridEntity.java

@ -92,6 +92,4 @@ public class ScreenCustomerGridEntity extends BaseEpmetEntity {
* desc: 是否参与上级计算yes:参与;no:不参与 add 01.14
*/
private String upToCal;
private String code;
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectDataEntity.java

@ -143,7 +143,7 @@ public class ScreenProjectDataEntity extends BaseEpmetEntity {
/**
* 结案日期
*/
private String closeCaseTime;
private Date closeCaseTime;
/**
* 数据更新至: yyyy|yyyMM|yyyyMMdd
@ -159,4 +159,7 @@ public class ScreenProjectDataEntity extends BaseEpmetEntity {
* 满意度得分
*/
private BigDecimal satisfactionScore;
private String projectCreator;
}

56
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/ProjectChangedCustomListener.java

@ -1,15 +1,20 @@
package com.epmet.mq;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.rocketmq.constants.MQUserPropertys;
import com.epmet.commons.rocketmq.messages.DisputeProcessMQMsg;
import com.epmet.commons.rocketmq.messages.ProjectChangedMQMsg;
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.constant.SystemMessageType;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.service.evaluationindex.extract.todata.FactOriginExtractService;
import com.epmet.service.evaluationindex.extract.toscreen.ScreenExtractService;
import com.epmet.service.evaluationindex.screen.ScreenProjectDataService;
import com.epmet.util.DimIdGenerator;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@ -27,7 +32,6 @@ import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* @Description 项目变动-监听器
@ -43,14 +47,21 @@ public class ProjectChangedCustomListener implements MessageListenerConcurrently
private RedisUtils redisUtils;
@Override
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) {
long start = System.currentTimeMillis();
try {
List<String> msgStrs = msgs.stream().map(messageExt -> new String(messageExt.getBody())).distinct().collect(Collectors.toList());
for (String msgStr : msgStrs) {
consumeMessage(msgStr);
//List<String> msgStrs = msgs.stream().map(messageExt -> new String(messageExt.getBody())).distinct().collect(Collectors.toList());
//for (String msgStr : msgStrs) {
// consumeMessage(msgStr);
//}
for (MessageExt msgExt : msgs) {
consumeMessage(msgExt);
}
} catch (Exception e) {
//失败不重发
logger.error("consumeMessage fail,msg:{}",e.getMessage());
@ -60,7 +71,10 @@ public class ProjectChangedCustomListener implements MessageListenerConcurrently
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}
private void consumeMessage(String msg) {
private void consumeMessage(MessageExt msgExt) {
String msg = new String(msgExt.getBody());
String pendingMsgLabel = msgExt.getUserProperty(MQUserPropertys.BLOCKED_MSG_LABEL);
logger.info("receive customerId:{}", JSON.toJSONString(msg));
ProjectChangedMQMsg msgObj = JSON.parseObject(msg, ProjectChangedMQMsg.class);
if (msgObj == null){
@ -87,6 +101,14 @@ public class ProjectChangedCustomListener implements MessageListenerConcurrently
} else {
log.info("该客户的项目变动消息刚刚消费,请等待30秒,customer id:{}", msgObj.getCustomerId());
}
if (org.apache.commons.lang.StringUtils.isNotBlank(pendingMsgLabel)) {
try {
removePendingMqMsgCache(pendingMsgLabel);
} catch (Exception e) {
logger.error("【项目变动事件监听器】-删除mq滞留消息缓存失败:{}", ExceptionUtils.getErrorStackTrace(e));
}
}
}
public void consumeMessage(ProjectChangedMQMsg msgObj) {
@ -130,6 +152,16 @@ public class ProjectChangedCustomListener implements MessageListenerConcurrently
SpringContextUtils.getBean(ScreenExtractService.class).extractPartData(customerId,dateId);
}
logger.info("consumer projectChanged msg success,{}",aBoolean);
//发送项目数据上报的mq消息
String type;
if ("issue_shift_project".equals(msgObj.getOperation()) || "created".equals(msgObj.getOperation())) {
type = SystemMessageType.PROJECT_ADD;
} else {
type = SystemMessageType.PROJECT_EDIT;
}
DisputeProcessMQMsg msg = new DisputeProcessMQMsg(customerId, msgObj.getProjectId(), type);
SpringContextUtils.getBean(ScreenProjectDataService.class).sendProjectChangeMq(msg);
} catch (RenException e) {
// 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试
logger.error("【RocketMQ】消费项目变动消息失败:",e);
@ -151,6 +183,20 @@ public class ProjectChangedCustomListener implements MessageListenerConcurrently
}
/**
* @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("【项目变动事件监听器】删除mq阻塞消息缓存成功,penddingMsgLabel:{}", pendingMsgLabel);
}
/*@Override
public ConsumerConfigProperties getConsumerProperty() {
ConsumerConfigProperties configProperties = new ConsumerConfigProperties();

72
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/DataReportingService.java

@ -0,0 +1,72 @@
package com.epmet.service;
import com.epmet.dto.basereport.form.EventInfoFormDTO;
import com.epmet.dto.basereport.result.EventInfoResultDTO;
import com.epmet.dto.org.form.GridBaseInfoFormDTO;
import com.epmet.dto.org.result.CustomerAgencyDTO;
import com.epmet.dto.org.result.CustomerGridDTO;
import com.epmet.dto.user.form.StaffBaseInfoFormDTO;
import com.epmet.dto.user.param.MidPatrolFormDTO;
import com.epmet.dto.user.result.GridUserInfoDTO;
import com.epmet.dto.user.result.MidPatrolDetailResult;
import com.epmet.dto.user.result.MidPatrolRecordResult;
import java.util.List;
/**
* @dscription 省网格化平台数据上报--数据查询
* @author sun
*/
public interface DataReportingService {
/**
* @Author sun
* @Description 批量查询客户组织基础信息
*
* @return*/
List<CustomerAgencyDTO> getAgencyBaseInfo(GridBaseInfoFormDTO formDTO);
/**
* @Author sun
* @Description 批量查询客户网格基础信息
*
* @return*/
List<CustomerGridDTO> getGridBaseInfo(GridBaseInfoFormDTO formDTO);
/**
* @Author sun
* @Description 批量查询客户网格员基础信息
*
* @return*/
List<GridUserInfoDTO> getStaffBaseInfo(StaffBaseInfoFormDTO formDTO);
/**
* desc: 获取巡查记录列表
*
* @param formDTO
* @return java.util.List<com.epmet.dto.user.result.CustomerStaffDTO>
* @author LiuJanJun
* @date 2021/10/15 1:21 下午
*/
List<MidPatrolRecordResult> getPatrolRecordList(MidPatrolFormDTO formDTO);
/**
* desc: 获取巡查明细列表
*
* @param formDTO
* @return java.util.List<com.epmet.dto.user.result.MidPatrolDetailResult>
* @author LiuJanJun
* @date 2021/10/15 1:22 下午
*/
List<MidPatrolDetailResult> getPatrolDetailList(MidPatrolFormDTO formDTO);
/**
* 事件上报
* @Param formDTO
* @Return {@link List<EventInfoResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/15 14:10
*/
List<EventInfoResultDTO> getEventInfo(EventInfoFormDTO formDTO);
}

1
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java

@ -85,6 +85,7 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic
meta.setProjectCreateTime(projectInfo.getCreatedTime());
meta.setProjectTitle(projectInfo.getTitle());
meta.setOrigin(projectInfo.getOrigin());
meta.setProjectCreator(projectInfo.getCreatedBy());
if (ProjectConstant.PROJECT_ORIGIN_ISSUE.equals(projectInfo.getOrigin())) {
//来源于议题的,上面的initNewScreenProjectData,已经赋值orgType=grid, orgId:gridId

19
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java

@ -17,6 +17,7 @@
package com.epmet.service.evaluationindex.screen;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.extract.form.PartyBaseInfoFormDTO;
import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO;
@ -35,7 +36,7 @@ import java.util.Map;
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-22
*/
public interface ScreenCustomerAgencyService{
public interface ScreenCustomerAgencyService extends BaseService<ScreenCustomerAgencyEntity> {
/**
* @Description 根据agencyId查询所有子级agencyId当机关的级别为 community时所有子级为gridId
@ -137,5 +138,21 @@ public interface ScreenCustomerAgencyService{
* @author sun
*/
List<CustomerAgencyDTO> getByCustomerId(String customerId);
/**
* @Description 根据ID获取组织
* @Param agencyId
* @Return {@link ScreenCustomerAgencyEntity}
* @Author zhaoqifeng
* @Date 2021/10/15 15:44
*/
ScreenCustomerAgencyEntity getAgencyById(String agencyId);
/**
* @Description 获取组织列表
* @Param customerId
* @Return {@link Map< String, ScreenCustomerAgencyEntity>}
* @Author zhaoqifeng
* @Date 2021/10/15 15:44
*/
Map<String, ScreenCustomerAgencyEntity> getAgencyList(String customerId);
}

18
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java

@ -28,6 +28,7 @@ import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity;
import com.epmet.entity.org.CustomerGridEntity;
import java.util.List;
import java.util.Map;
/**
* 网格(党支部)信息
@ -111,4 +112,21 @@ public interface ScreenCustomerGridService extends BaseService<ScreenCustomerGri
List<ScreenProjectGridDailyDTO> selectGridInfoList(String customerId, String pids);
List<ScreenCustomerGridEntity> selectEntityByAgencyId(String customerId, String parentAgencyId);
/**
* @Description 根据ID获取网格
* @Param gridId
* @Return {@link ScreenCustomerGridDTO}
* @Author zhaoqifeng
* @Date 2021/10/15 15:50
*/
ScreenCustomerGridDTO getGridById(String gridId);
/**
* @Description 获取网格列表
* @Param customerId
* @Return {@link Map<String, ScreenCustomerGridDTO>}
* @Author zhaoqifeng
* @Date 2021/10/15 15:50
*/
Map<String, ScreenCustomerGridDTO> getGridList(String customerId);
}

21
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java

@ -18,6 +18,7 @@
package com.epmet.service.evaluationindex.screen;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.rocketmq.messages.DisputeProcessMQMsg;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.screen.ScreenProjectDataDTO;
import com.epmet.dto.screen.form.ScreenProjectDataInfoFormDTO;
@ -127,4 +128,24 @@ public interface ScreenProjectDataService extends BaseService<ScreenProjectDataE
void insertOrUpdateBatch(String customerId,String dateId,List<ScreenProjectDataDTO> meta,List<ScreenProjectDataDTO> orient);
int updateProjectSatisfactionScore(String projectId, BigDecimal calProjectSatisfactionScore);
/**
* 获取项目
* @Param customerId
* @Param projectId
* @Return {@link List<ScreenProjectDataDTO>}
* @Author zhaoqifeng
* @Date 2021/10/15 14:22
*/
List<ScreenProjectDataDTO> getProjectList(String customerId, String projectId, Integer pageNo, Integer pageSize);
/**
* 项目变更MQ
* @Param msg
* @Return
* @Author zhaoqifeng
* @Date 2021/10/18 15:55
*/
void sendProjectChangeMq(DisputeProcessMQMsg msg);
}

32
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java

@ -19,6 +19,7 @@ package com.epmet.service.evaluationindex.screen.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant;
@ -37,13 +38,14 @@ import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity;
import com.epmet.entity.org.CustomerAgencyEntity;
import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
@ -55,7 +57,7 @@ import java.util.stream.Collectors;
@Service
@Slf4j
@DataSource(DataSourceConstant.EVALUATION_INDEX)
public class ScreenCustomerAgencyServiceImpl implements ScreenCustomerAgencyService {
public class ScreenCustomerAgencyServiceImpl extends BaseServiceImpl<ScreenCustomerAgencyDao, ScreenCustomerAgencyEntity> implements ScreenCustomerAgencyService {
@Autowired
private ScreenCustomerAgencyDao screenCustomerAgencyDao;
@ -314,4 +316,30 @@ public class ScreenCustomerAgencyServiceImpl implements ScreenCustomerAgencyServ
return screenCustomerAgencyDao.selectByCustomerId(customerId);
}
@Override
public ScreenCustomerAgencyEntity getAgencyById(String agencyId) {
LambdaQueryWrapper<ScreenCustomerAgencyEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ScreenCustomerAgencyEntity::getAgencyId, agencyId);
return baseDao.selectOne(wrapper);
}
/**
* @param customerId
* @Description 获取组织列表
* @Param customerId
* @Return {@link Map< String, ScreenCustomerAgencyEntity>}
* @Author zhaoqifeng
* @Date 2021/10/15 15:44
*/
@Override
public Map<String, ScreenCustomerAgencyEntity> getAgencyList(String customerId) {
LambdaQueryWrapper<ScreenCustomerAgencyEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(customerId), ScreenCustomerAgencyEntity::getCustomerId, customerId);
List<ScreenCustomerAgencyEntity> list = baseDao.selectList(wrapper);
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyMap();
}
return list.stream().collect(Collectors.toMap(ScreenCustomerAgencyEntity::getAgencyId, Function.identity()));
}
}

41
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java

@ -23,6 +23,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.constant.OrgSourceTypeConstant;
@ -35,15 +36,15 @@ import com.epmet.dto.screen.ScreenProjectGridDailyDTO;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity;
import com.epmet.entity.org.CustomerGridEntity;
import com.epmet.service.evaluationindex.screen.ScreenCustomerGridService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 网格(党支部)信息
@ -218,4 +219,36 @@ public class ScreenCustomerGridServiceImpl extends BaseServiceImpl<ScreenCustome
public List<ScreenCustomerGridEntity> selectEntityByAgencyId(String customerId, String parentAgencyId) {
return baseDao.selectEntityByAgencyId(customerId,parentAgencyId);
}
/**
* @param gridId
* @Description 根据ID获取网格
* @Param gridId
* @Return {@link ScreenCustomerGridDTO}
* @Author zhaoqifeng
* @Date 2021/10/15 15:50
*/
@Override
public ScreenCustomerGridDTO getGridById(String gridId) {
LambdaQueryWrapper<ScreenCustomerGridEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ScreenCustomerGridEntity::getGridId, gridId);
ScreenCustomerGridEntity entity = baseDao.selectOne(wrapper);
return ConvertUtils.sourceToTarget(entity, ScreenCustomerGridDTO.class);
}
/**
* @param customerId
* @Description 获取网格列表
* @Param customerId
* @Return {@link Map <String, ScreenCustomerGridDTO>}
* @Author zhaoqifeng
* @Date 2021/10/15 15:50
*/
@Override
public Map<String, ScreenCustomerGridDTO> getGridList(String customerId) {
LambdaQueryWrapper<ScreenCustomerGridEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(customerId), ScreenCustomerGridEntity::getCustomerId, customerId);
List<ScreenCustomerGridEntity> list = baseDao.selectList(wrapper);
return ConvertUtils.sourceToTarget(list, ScreenCustomerGridDTO.class).stream().collect(Collectors.toMap(ScreenCustomerGridDTO::getGridId, Function.identity()));
}
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java

@ -415,10 +415,10 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
// 子客户单独存一份【三个街道的】
List<CategoryProjectResultDTO> sonCustomerList = new ArrayList<>();
// 父客户存在的分类
List<CategoryProjectResultDTO> categoryProjectExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId, true);
List<CategoryProjectResultDTO> categoryProjectExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId);
log.info("父客户存在的分类{}"+ JSON.toJSONString(categoryProjectExists));
// 父客户不存在的分类
List<CategoryProjectResultDTO> categoryProjectNotExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId, false);
List<CategoryProjectResultDTO> categoryProjectNotExists = baseDao.selectOrgCategoryMoreCustomerInfoNotExists(customerIds, dateId, level, customerId);
log.info("父客户不存在的分类{}"+ JSON.toJSONString(categoryProjectNotExists));
if (!CollectionUtils.isEmpty(categoryProjectExists)){
sonCustomerList.addAll(categoryProjectExists);

65
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java

@ -21,18 +21,23 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.rocketmq.messages.DisputeProcessMQMsg;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.screen.*;
import com.epmet.dao.evaluationindex.screen.ScreenProjectDataDao;
import com.epmet.dao.evaluationindex.screen.ScreenProjectImgDataDao;
import com.epmet.dto.screen.ScreenProjectDataDTO;
import com.epmet.dto.screen.form.ScreenProjectDataInfoFormDTO;
import com.epmet.dto.screencoll.ScreenCollFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenProjectDataEntity;
import com.epmet.entity.evaluationindex.screen.ScreenProjectImgDataEntity;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.send.SendMqMsgUtil;
import com.epmet.service.evaluationindex.screen.ScreenProjectDataService;
import com.github.pagehelper.PageHelper;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
@ -42,7 +47,6 @@ import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
@ -61,6 +65,8 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl<ScreenProjectD
@Resource
private ScreenProjectImgDataDao screenProjectImgDataDao;
@Resource
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Override
public PageData<ScreenProjectDataDTO> page(Map<String, Object> params) {
@ -134,22 +140,18 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl<ScreenProjectD
//todo 动态获取超时时间
//如果结案 结案时间立项时间;
if ("closed_case".equals(projectStatusCode)) {
try {
Date createTime = item.getProjectCreateTime();
Date closeCaseTime = sdf.parse(item.getCloseCaseTime());
Date createTime = item.getProjectCreateTime();
Date closeCaseTime = item.getCloseCaseTime();
if (closeCaseTime.getTime() - createTime.getTime() <= 1000 * 60 * 60 * 24 * 4) {
//如果结案时间-立项时间小于等于4天 未超期 level3
item.setProjectLevel(3);
} else if (closeCaseTime.getTime() - createTime.getTime() <= 1000 * 60 * 60 * 24 * 5) {
//如果结案时间-立项时间大于4天小于5天 即将超期 level2
item.setProjectLevel(2);
} else {
//大于5天 已超期 level1
item.setProjectLevel(1);
}
} catch (ParseException e) {
e.printStackTrace();
if (closeCaseTime.getTime() - createTime.getTime() <= 1000 * 60 * 60 * 24 * 4) {
//如果结案时间-立项时间小于等于4天 未超期 level3
item.setProjectLevel(3);
} else if (closeCaseTime.getTime() - createTime.getTime() <= 1000 * 60 * 60 * 24 * 5) {
//如果结案时间-立项时间大于4天小于5天 即将超期 level2
item.setProjectLevel(2);
} else {
//大于5天 已超期 level1
item.setProjectLevel(1);
}
} else if ("pending".equals(projectStatusCode)) {
//如果处理中 当前时间-立项时间;
@ -275,4 +277,33 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl<ScreenProjectD
return baseDao.updateProjectSatisfactionScore(projectId,score);
}
/**
* 获取项目
*
* @param customerId
* @param projectId
* @Param customerId
* @Param projectId
* @Return {@link List<ScreenProjectDataDTO>}
* @Author zhaoqifeng
* @Date 2021/10/15 14:22
*/
@Override
public List<ScreenProjectDataDTO> getProjectList(String customerId, String projectId, Integer pageNo, Integer pageSize) {
PageHelper.startPage(pageNo, pageSize);
return baseDao.selectProjectList(customerId, projectId);
}
/**
* @Description 项目变更MQ
* @Param msg
* @Return
* @Author zhaoqifeng
* @Date 2021/10/18 14:00
*/
@Override
public void sendProjectChangeMq(DisputeProcessMQMsg msg) {
SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendProjectMqMsg(msg);
}
}

281
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java

@ -0,0 +1,281 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.OrgTypeConstant;
import com.epmet.constant.ProjectConstant;
import com.epmet.dto.basereport.form.EventInfoFormDTO;
import com.epmet.dto.basereport.result.EventInfoResultDTO;
import com.epmet.dto.org.form.GridBaseInfoFormDTO;
import com.epmet.dto.org.result.CustomerAgencyDTO;
import com.epmet.dto.org.result.CustomerGridDTO;
import com.epmet.dto.screen.ScreenCustomerGridDTO;
import com.epmet.dto.screen.ScreenProjectDataDTO;
import com.epmet.dto.user.form.StaffBaseInfoFormDTO;
import com.epmet.dto.user.param.MidPatrolFormDTO;
import com.epmet.dto.user.result.CustomerStaffDTO;
import com.epmet.dto.user.result.GridUserInfoDTO;
import com.epmet.dto.user.result.MidPatrolDetailResult;
import com.epmet.dto.user.result.MidPatrolRecordResult;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity;
import com.epmet.entity.stats.CustomerProjectCategoryDictEntity;
import com.epmet.service.DataReportingService;
import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService;
import com.epmet.service.evaluationindex.screen.ScreenCustomerGridService;
import com.epmet.service.evaluationindex.screen.ScreenProjectDataService;
import com.epmet.service.org.CustomerAgencyService;
import com.epmet.service.org.CustomerGridService;
import com.epmet.service.stats.CustomerProjectCategoryDictService;
import com.epmet.service.user.StatsStaffPatrolService;
import com.epmet.service.user.UserService;
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 javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
* @dscription 省网格化平台数据上报--数据查询
* @author sun
*/
@Slf4j
@Service
public class DataReportingServiceImpl implements DataReportingService {
@Autowired
private CustomerAgencyService customerAgencyService;
@Autowired
private CustomerGridService customerGridService;
@Autowired
private UserService userService;
@Resource
private ScreenProjectDataService screenProjectDataService;
@Resource
private ScreenCustomerAgencyService screenCustomerAgencyService;
@Resource
private ScreenCustomerGridService screenCustomerGridService;
@Autowired
private StatsStaffPatrolService statsStaffPatrolService;
@Resource
private CustomerProjectCategoryDictService customerProjectCategoryDictService;
/**
* @Author sun
* @Description 批量查询客户组织基础信息
**/
@Override
public List<CustomerAgencyDTO> getAgencyBaseInfo(GridBaseInfoFormDTO formDTO) {
//批量查询客户组织信息
List<CustomerAgencyDTO> resultList = customerAgencyService.getAgencyBaseInfo(formDTO);
return resultList;
}
/**
* @Author sun
* @Description 批量查询客户网格基础信息
**/
@Override
public List<CustomerGridDTO> getGridBaseInfo(GridBaseInfoFormDTO formDTO) {
//批量查询客户网格信息
List<CustomerGridDTO> resultList = customerGridService.getGridBaseInfo(formDTO);
return resultList;
}
/**
* @Author sun
* @Description 批量查询客户网格员基础信息
**/
@Override
public List<GridUserInfoDTO> getStaffBaseInfo(StaffBaseInfoFormDTO formDTO) {
//1.查询工作人员所属网格信息
List<GridUserInfoDTO> resultList = customerGridService.getStaffGrid(formDTO);
//2.查询工作人员基础信息
List<CustomerStaffDTO> staffDTOList = userService.getStaffBaseInfo(formDTO);
if (CollectionUtils.isEmpty(staffDTOList)) {
return new ArrayList<>();
}
Map<String, CustomerStaffDTO> staffMap = new HashMap<>();
staffDTOList.forEach(staff -> staffMap.put(staff.getUserId(), staff));
//3.封装数据
resultList.forEach(st -> {
if (staffMap.containsKey(st.getStaffId())) {
CustomerStaffDTO dto = staffMap.get(st.getStaffId());
st.setNickName(dto.getRealName());
st.setCardNum("01");
st.setUserType(dto.getWorkType().equals("fulltime") ? "01" : "02");
st.setPhonenumber(dto.getMobile());
st.setSex(0 == dto.getGender() ? "9" : dto.getGender().toString());
st.setNation("01");
st.setPaerty("13");
st.setBirthday(new Date());
st.setEducation("20");
st.setEntryDate(new Date());
st.setIsLeave("N");
//st.setLeaveDate();
st.setIncome("05");
st.setIsCommittee("Y");
st.setIsCommunityWorkers("Y");
st.setIsSocialWorker("Y");
st.setIsVillageLeader("Y");
st.setIsPoliceAssistant("N");
st.setIsMediator("Y");
st.setDelFlag(dto.getDelFlag());
st.setCreatedBy(dto.getCreatedBy());
st.setCreatedTime(dto.getCreatedTime());
st.setUpdatedBy(dto.getUpdatedBy());
st.setUpdatedTime(dto.getUpdatedTime());
}
});
return resultList;
}
/**
* 事件上报
*
* @param formDTO
* @Param formDTO
* @Return {@link List<EventInfoResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/15 14:10
*/
@Override
public List<EventInfoResultDTO> getEventInfo(EventInfoFormDTO formDTO) {
List<EventInfoResultDTO> list;
//根据入参,获取项目
List<ScreenProjectDataDTO> projectList = screenProjectDataService.getProjectList(formDTO.getCustomerId(), formDTO.getProjectId(), formDTO.getPageNo(), formDTO.getPageSize());
//项目列表为空,返回空数组
if(CollectionUtils.isEmpty(projectList)) {
return Collections.emptyList();
}
//项目ID不为空时,因为只有一条,可以直接处理
if (StringUtils.isNotEmpty(formDTO.getProjectId())) {
list = projectList.stream().map(project -> {
EventInfoResultDTO dto = getEventInfoResultDTO(project);
if (OrgTypeConstant.AGENCY.equals(project.getOrgType())) {
ScreenCustomerAgencyEntity agency = screenCustomerAgencyService.getAgencyById(project.getOrgId());
dto.setOrgCode(agency.getCode());
dto.setOrgName(agency.getAgencyName());
} else {
ScreenCustomerGridDTO grid = screenCustomerGridService.getGridById(project.getOrgId());
dto.setOrgCode(grid.getCode());
dto.setOrgName(grid.getGridName());
}
return dto;
}).collect(Collectors.toList());
} else {
//项目ID不为空时,提前取出客户下的组织和网格
Map<String, ScreenCustomerAgencyEntity> agencyMap = screenCustomerAgencyService.getAgencyList(formDTO.getCustomerId());
Map<String, ScreenCustomerGridDTO> gridMap = screenCustomerGridService.getGridList(formDTO.getCustomerId());
list = projectList.stream().map(project -> {
EventInfoResultDTO dto = getEventInfoResultDTO(project);
if (OrgTypeConstant.AGENCY.equals(project.getOrgType())) {
ScreenCustomerAgencyEntity agency = agencyMap.get(project.getOrgId());
dto.setOrgCode(agency.getCode());
dto.setOrgName(agency.getAgencyName());
} else {
ScreenCustomerGridDTO grid = gridMap.get(project.getOrgId());
dto.setOrgCode(grid.getCode());
dto.setOrgName(grid.getGridName());
}
return dto;
}).collect(Collectors.toList());
}
return list.stream().filter(item -> StringUtils.isNotBlank(item.getEventCategory())).collect(Collectors.toList());
}
private EventInfoResultDTO getEventInfoResultDTO(ScreenProjectDataDTO project) {
EventInfoResultDTO dto = new EventInfoResultDTO();
dto.setId(project.getProjectId());
dto.setCustomerId(project.getCustomerId());
dto.setEventName(project.getProjectTitle());
dto.setReporterId(project.getProjectCreator());
String categoryCode = project.getCategoryCode().split(StrConstant.COMMA)[0];
//如果是孔村、榆山、锦水的项目需要关联分类字典表
if("2fe0065f70ca0e23ce4c26fca5f1d933".equals(project.getCustomerId()) ||
"44876154d10d7cb7affd92000f84f833".equals(project.getCustomerId()) ||
"46c55cb862d6d5e6d05d2ab61a1cc07e".equals(project.getCustomerId())) {
CustomerProjectCategoryDictEntity categoryEntity = customerProjectCategoryDictService.getByCategoryCode(project.getCustomerId(), categoryCode);
if (null != categoryEntity) {
categoryCode = categoryEntity.getEpmetCategoryCode();
} else {
categoryCode = null;
}
}
dto.setEventCategory(categoryCode);
dto.setReportTime(project.getProjectCreateTime());
dto.setHappenDate(DateUtils.parseDate(DateUtils.format(project.getProjectCreateTime()), DateUtils.DATE_PATTERN));
dto.setHappenPlace(project.getProjectAddress());
dto.setEventDescription(project.getProjectContent());
dto.setSuccessfulOrNo(ProjectConstant.CLOSED_CASE.equals(project.getProjectStatusCode())?"Y":"N");
if (ProjectConstant.CLOSED_CASE.equals(project.getProjectStatusCode())) {
dto.setWaysOfResolving(project.getOrgId().equals(project.getFinishOrg())?ProjectConstant.PROJECT_SELF_CLOSED:ProjectConstant.PROJECT_REPORT);
//办结组织是机关时,办结层级为机关的层级
if (OrgTypeConstant.AGENCY.equals(project.getFinishOrgType())) {
//如果是孔村的项目办结层级需要降一级
if("2fe0065f70ca0e23ce4c26fca5f1d933".equals(project.getCustomerId())) {
switch (project.getFinishOrgLevel()) {
case OrgTypeConstant.DISTRICT:
dto.setCompleteLevel("04");
break;
case OrgTypeConstant.STREET:
case OrgTypeConstant.COMMUNITY:
dto.setCompleteLevel("06");
break;
default:
break;
}
} else {
dto.setCompleteLevel(getCompleteLevel(project.getFinishOrgLevel()));
}
} else if (OrgTypeConstant.DEPARTMENT.equals(project.getFinishOrgType())) {
//办结组织是部门时,办结层级为部门所在组织的曾经
String[] orgIds = project.getOrgIdPath().split(StrConstant.COLON);
int size = orgIds.length;
ScreenCustomerAgencyEntity agency = screenCustomerAgencyService.getAgencyById(orgIds[size - 1]);
dto.setCompleteLevel(getCompleteLevel(agency.getLevel()));
} else {
//办结组织是网格时,办结层级为网格
dto.setCompleteLevel("07");
}
}
dto.setCompleteTime(project.getCloseCaseTime());
dto.setLat(project.getLatitude());
dto.setLng(project.getLongitude());
return dto;
}
private String getCompleteLevel(String level) {
switch (level) {
case OrgTypeConstant.PROVINCE:
return "01";
case OrgTypeConstant.CITY:
return "02";
case OrgTypeConstant.DISTRICT:
return "03";
case OrgTypeConstant.STREET:
return "04";
case OrgTypeConstant.COMMUNITY:
return "06";
default:
return null;
}
}
@Override
public List<MidPatrolRecordResult> getPatrolRecordList(MidPatrolFormDTO formDTO) {
return userService.getPatrolRecordList(formDTO);
}
@Override
public List<MidPatrolDetailResult> getPatrolDetailList(MidPatrolFormDTO formDTO) {
return userService.getPatrolDetailList(formDTO);
}
}

7
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java

@ -1,5 +1,7 @@
package com.epmet.service.org;
import com.epmet.dto.org.form.GridBaseInfoFormDTO;
import com.epmet.dto.org.result.CustomerAgencyDTO;
import com.epmet.dto.org.result.CustomerAreaCodeResultDTO;
import com.epmet.dto.org.result.OrgStaffDTO;
import com.epmet.entity.org.CustomerAgencyEntity;
@ -59,4 +61,9 @@ public interface CustomerAgencyService {
*/
void sysAgencyInfo(String fromCustomerId, String toCustomerId);
/**
* @Author sun
* @Description 批量查询客户组织基础信息
**/
List<CustomerAgencyDTO> getAgencyBaseInfo(GridBaseInfoFormDTO formDTO);
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save