Browse Source

Merge remote-tracking branch 'remotes/origin/dev' into dev_grid_user_work

master
jianjun 4 years ago
parent
commit
2d03856f1e
  1. 69
      epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/EpmetAdminOpenFeignClient.java
  2. 42
      epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/fallback/EpmetAdminOpenFeignClientFallback.java
  3. 4
      epmet-admin/epmet-admin-server/deploy/docker-compose-prod.yml
  4. 4
      epmet-admin/epmet-admin-server/pom.xml
  5. 90
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictDataController.java
  6. 3
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/dao/SysDictDataDao.java
  7. 2
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/bean/log/LogOperationHelper.java
  8. 41
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/AuthOperationLogListener.java
  9. 33
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/PointOperationLogListener.java
  10. 33
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/ProjectOperationLogListener.java
  11. 57
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/SysDictDataService.java
  12. 6
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/LogOperationServiceImpl.java
  13. 132
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/SysDictDataServiceImpl.java
  14. 29
      epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.6__add_dict_data.sql
  15. 9
      epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.7__add_dict_data_V3.sql
  16. 13
      epmet-admin/epmet-admin-server/src/main/resources/mapper/SysDictDataDao.xml
  17. 4
      epmet-auth/deploy/docker-compose-prod.yml
  18. 4
      epmet-auth/pom.xml
  19. 162
      epmet-auth/src/main/java/com/epmet/controller/IcLoinController.java
  20. 109
      epmet-auth/src/main/java/com/epmet/controller/LoginController.java
  21. 32
      epmet-auth/src/main/java/com/epmet/dto/form/LoginByPassWordFormDTO.java
  22. 25
      epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java
  23. 9
      epmet-auth/src/main/java/com/epmet/redis/IcLoginTicketCacheBean.java
  24. 10
      epmet-auth/src/main/java/com/epmet/service/CaptchaService.java
  25. 9
      epmet-auth/src/main/java/com/epmet/service/IcLoginService.java
  26. 12
      epmet-auth/src/main/java/com/epmet/service/impl/CaptchaServiceImpl.java
  27. 17
      epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java
  28. 177
      epmet-auth/src/main/java/com/epmet/service/impl/IcLoginServiceImpl.java
  29. 2
      epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java
  30. 2
      epmet-auth/src/main/resources/bootstrap.yml
  31. 2
      epmet-commons/epmet-commons-extapp-auth/pom.xml
  32. 26
      epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/service/BaseService.java
  33. 55
      epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/service/impl/BaseServiceImpl.java
  34. 29
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java
  35. 13
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/MQUserPropertys.java
  36. 31
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java
  37. 19
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/CalPartyUnitSatisfactionFormDTO.java
  38. 23
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/DisputeProcessMQMsg.java
  39. 20
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/IcResiUserAddMQMsg.java
  40. 27
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/OrgOrStaffMQMsg.java
  41. 21
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/StaffPatrolMQMsg.java
  42. 4
      epmet-commons/epmet-commons-tools/pom.xml
  43. 69
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java
  44. 6
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/AppClientConstant.java
  45. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java
  46. 9
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java
  47. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/distributedlock/DistributedLock.java
  48. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/distributedlock/LockConstants.java
  49. 20
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DictListFormDTO.java
  50. 13
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/PageFormDTO.java
  51. 16
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/CustomerStaffInfoCacheResult.java
  52. 17
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/DictListResultDTO.java
  53. 19
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionDataResultDTO.java
  54. 22
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionResultDTO.java
  55. 22
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/BizTypeEnum.java
  56. 59
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java
  57. 53
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/FormItemTypeEnum.java
  58. 44
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/GenderEnum.java
  59. 45
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/HouseTypeEnum.java
  60. 59
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/PartyUnitTypeEnum.java
  61. 58
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RelationshipEnum.java
  62. 49
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  63. 96
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetException.java
  64. 10
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenException.java
  65. 21
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java
  66. 35
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/EpmetBaseRequestInterceptor.java
  67. 41
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/FeignConfig.java
  68. 7
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/ResultDataResolver.java
  69. 12
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java
  70. 98
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  71. 93
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java
  72. 142
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/AgencyInfoCache.java
  73. 116
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/GridInfoCache.java
  74. 81
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/IcTokenDto.java
  75. 13
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java
  76. 93
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java
  77. 276
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelPoiUtils.java
  78. 11
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelUtils.java
  79. 31
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelVerifyInfo.java
  80. 11
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IpUtils.java
  81. 10
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/Pinyin4jUtil.java
  82. 11
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/validator/AssertUtils.java
  83. 4
      epmet-gateway/deploy/docker-compose-prod.yml
  84. 25
      epmet-gateway/pom.xml
  85. 6
      epmet-gateway/src/main/java/com/epmet/GatewayApplication.java
  86. 2
      epmet-gateway/src/main/java/com/epmet/config/CorsConfig.java
  87. 15
      epmet-gateway/src/main/resources/bootstrap.yml
  88. 3
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/OrgConstant.java
  89. 21
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/FactAgencyProjectMonthResultDTO.java
  90. 35
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/FactAgencyProjectResultDTO.java
  91. 16
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/IcFormResColumnDTO.java
  92. 5
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffPatrolDetailDTO.java
  93. 5
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffPatrolRecordDTO.java
  94. 20
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/CustomerStaffResultDTO.java
  95. 2
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolDailySumResult.java
  96. 5
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolRecordDetailDTO.java
  97. 5
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolRecordListResultDTO.java
  98. 93
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueProjectCategoryDictDTO.java
  99. 15
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerAgencyDTO.java
  100. 10
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerGridDTO.java

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

@ -1,13 +1,19 @@
package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.form.DictListFormDTO;
import com.epmet.commons.tools.dto.result.DictListResultDTO;
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;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
import java.util.Map;
@FeignClient(name = ServiceConstant.EPMET_ADMIN_SERVER, fallbackFactory = EpmetAdminOpenFeignClientFallbackFactory.class)
//@FeignClient(name = ServiceConstant.EPMET_ADMIN_SERVER, fallbackFactory = EpmetAdminOpenFeignClientFallbackFactory.class, url = "localhost:8082")
@ -21,4 +27,67 @@ 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();
/**
* 字典数据查询通用接口
* @Param dictType
* @Return {@link Result< Map < String, String>>}
* @Author zhaoqifeng
* @Date 2021/11/19 17:36
*/
@PostMapping("/sys/dict/data/dictmap/{dictType}")
Result<Map<String, String>> dictMap(@PathVariable("dictType") String dictType);
@PostMapping("/sys/dict/data/dictlist")
Result<List<DictListResultDTO>> dictList(@RequestBody DictListFormDTO formDTO);
}

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

@ -1,18 +1,56 @@
package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.form.DictListFormDTO;
import com.epmet.commons.tools.dto.result.DictListResultDTO;
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;
import com.epmet.feign.EpmetAdminOpenFeignClient;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
//@Component
public class EpmetAdminOpenFeignClientFallback implements EpmetAdminOpenFeignClient {
@Override
public Result<List<CorsConfigResultDTO>> list() {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "list", null);
return ModuleUtils.feignConError(ServiceConstant.EPMET_ADMIN_SERVER, "list", null);
}
@Override
public Result<List<OptionResultDTO>> getEducationOption() {
return ModuleUtils.feignConError(ServiceConstant.EPMET_ADMIN_SERVER, "getEducationOption", null);
}
@Override
public Result<List<OptionResultDTO>> getHouseOption() {
return ModuleUtils.feignConError(ServiceConstant.EPMET_ADMIN_SERVER, "getHouseOption", null);
}
@Override
public Result<List<OptionResultDTO>> getNationOption() {
return ModuleUtils.feignConError(ServiceConstant.EPMET_ADMIN_SERVER, "getNationOption", null);
}
@Override
public Result<List<OptionResultDTO>> getNineSmallPlacesOption() {
return ModuleUtils.feignConError(ServiceConstant.EPMET_ADMIN_SERVER, "getNineSmallPlacesOption", null);
}
@Override
public Result<List<OptionResultDTO>> getRelationshipOption() {
return ModuleUtils.feignConError(ServiceConstant.EPMET_ADMIN_SERVER, "getRelationshipOption", null);
}
@Override
public Result<Map<String, String>> dictMap(String dictType) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_ADMIN_SERVER, "dictMap", dictType);
}
@Override
public Result<List<DictListResultDTO>> dictList(DictListFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_ADMIN_SERVER, "dictList", formDTO);
}
}

4
epmet-admin/epmet-admin-server/deploy/docker-compose-prod.yml

@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-admin-server:
container_name: epmet-admin-server-prod
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-admin-server:0.3.15
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-admin-server:0.3.28
ports:
- "8082:8082"
network_mode: host # 使用现有网络
@ -15,4 +15,4 @@ services:
resources:
limits:
cpus: '0.1'
memory: 600M
memory: 600M

4
epmet-admin/epmet-admin-server/pom.xml

@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>0.3.15</version>
<version>0.3.28</version>
<parent>
<groupId>com.epmet</groupId>
<artifactId>epmet-admin</artifactId>
@ -246,7 +246,7 @@
<nacos.ip/>
<!--是否开启服务列表变更监听-->
<nacos.service-list-changed-listening.enable>false</nacos.service-list-changed-listening.enable>
<nacos.service-list-changed-listening.enable>true</nacos.service-list-changed-listening.enable>
<spring.flyway.enabled>true</spring.flyway.enabled>

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

@ -8,18 +8,21 @@
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.form.DictListFormDTO;
import com.epmet.commons.tools.dto.result.DictListResultDTO;
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 +81,85 @@ 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());
}
/**
* @Description 字典数据查询通用接口
* @Author sun
*/
@PostMapping("dictlist")
public Result<List<DictListResultDTO>> dictList(@RequestBody DictListFormDTO formDTO) {
return new Result<List<DictListResultDTO>>().ok(sysDictDataService.dictList(formDTO.getDictType()));
}
/**
* 字典数据查询通用接口
* @Param dictType
* @Return {@link Result< Map< String, String>>}
* @Author zhaoqifeng
* @Date 2021/11/19 17:36
*/
@PostMapping("dictmap/{dictType}")
public Result<Map<String, String>> dictMap(@PathVariable("dictType") String dictType) {
return new Result<Map<String, String>>().ok(sysDictDataService.dictMap(dictType));
}
}

3
epmet-admin/epmet-admin-server/src/main/java/com/epmet/dao/SysDictDataDao.java

@ -9,6 +9,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.commons.tools.dto.result.DictListResultDTO;
import com.epmet.entity.DictData;
import com.epmet.entity.SysDictDataEntity;
import org.apache.ibatis.annotations.Mapper;
@ -27,4 +28,6 @@ public interface SysDictDataDao extends BaseDao<SysDictDataEntity> {
* 字典数据列表
*/
List<DictData> getDictDataList();
List<DictListResultDTO> selectDictList(String dictType);
}

2
epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/bean/log/LogOperationHelper.java

@ -57,7 +57,7 @@ public class LogOperationHelper implements ResultDataResolver {
form.setUserId(userId);
Result<CustomerStaffDTO> result = userOpenFeignClient.getCustomerStaffInfoByUserId(form);
CustomerStaffDTO staffInfo = getResultDataOrThrowsException(result, ServiceConstant.EPMET_ADMIN_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(),
"调用epmet-user服务获取staff信息发生异常");
"调用epmet-user服务获取staff信息发生异常", null);
return new OperatorInfo(staffInfo.getCustomerId(), staffInfo.getMobile(), staffInfo.getRealName());
}
}

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);
}
}

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

@ -8,11 +8,14 @@
package com.epmet.service;
import com.epmet.dto.SysDictDataDTO;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.dto.result.DictListResultDTO;
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 +34,57 @@ 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();
/**
* @Description 字典数据查询通用接口
* @Author sun
*/
List<DictListResultDTO> dictList(String dictType);
Map<String, String> dictMap(String dictType);
}

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

@ -82,7 +82,7 @@ public class LogOperationServiceImpl implements LogOperationService, ResultDataR
CustomerStaffFormDTO form = new CustomerStaffFormDTO();
form.setUserIds(new ArrayList<>(userIds));
Result<List<CustomerStaffDTO>> result = userOpenFeignClient.list(form);
List<CustomerStaffDTO> staffs = getResultDataOrThrowsException(result, ServiceConstant.EPMET_USER_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "调用user服务发生异常");
List<CustomerStaffDTO> staffs = getResultDataOrThrowsException(result, ServiceConstant.EPMET_USER_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "调用user服务发生异常", null);
HashMap<String, CustomerStaffDTO> staffMap = new HashMap<>();
staffs.forEach(s -> {
@ -103,7 +103,7 @@ public class LogOperationServiceImpl implements LogOperationService, ResultDataR
form.setCustomerId(customerId);
form.setMobile(operatorMobile);
Result<List<CustomerStaffDTO>> result = userOpenFeignClient.list(form);
List<CustomerStaffDTO> staffs = getResultDataOrThrowsException(result, ServiceConstant.EPMET_USER_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "调用user服务发生异常");
List<CustomerStaffDTO> staffs = getResultDataOrThrowsException(result, ServiceConstant.EPMET_USER_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "调用user服务发生异常", null);
if (staffs.size() == 0) {
return null;
@ -134,7 +134,7 @@ public class LogOperationServiceImpl implements LogOperationService, ResultDataR
CustomerStaffFormDTO form = new CustomerStaffFormDTO();
form.setRealName(operatorName);
Result<List<CustomerStaffDTO>> result = userOpenFeignClient.list(form);
List<CustomerStaffDTO> staffs = getResultDataOrThrowsException(result, ServiceConstant.EPMET_USER_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "调用user服务查询工作人员信息发生异常");
List<CustomerStaffDTO> staffs = getResultDataOrThrowsException(result, ServiceConstant.EPMET_USER_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "调用user服务查询工作人员信息发生异常", null);
List<String> userIds = new ArrayList<>();
HashMap<String, CustomerStaffDTO> staffMap = new HashMap<String, CustomerStaffDTO>();

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

@ -8,9 +8,12 @@
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.DictListResultDTO;
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 +25,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 +90,131 @@ 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());
dto.setSysDictDataId(item.getId().toString());
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());
}
/**
* @Description 字典数据查询通用接口
* @Author sun
*/
@Override
public List<DictListResultDTO> dictList(String dictType) {
List<DictListResultDTO> resultDTOList = baseDao.selectDictList(dictType);
return resultDTOList;
}
@Override
public Map<String, String> dictMap(String dictType) {
List<DictListResultDTO> resultDTOList = baseDao.selectDictList(dictType);
return resultDTOList.stream().collect(Collectors.toMap(DictListResultDTO::getValue, DictListResultDTO::getLabel));
}
}

29
epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.6__add_dict_data.sql

@ -0,0 +1,29 @@
-- 1、增加字典类型
INSERT INTO `epmet_admin`.`sys_dict_type` (`id`, `dict_type`, `dict_name`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (8, 'user_demand_status', '居民需求状态', '待处理:pending;已取消canceled;已派单:assigned;已接单:have_order;已完成:finished', 8, 1067246875800000001, '2021-11-18 16:29:58', 1067246875800000001, '2021-11-18 16:29:58');
INSERT INTO `epmet_admin`.`sys_dict_type` (`id`, `dict_type`, `dict_name`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (9, 'user_demand_report_type', '居民需求上报类型', '社区帮办:community;楼长帮办:building_caption;党员帮办:party;自身上报:self_help', 9, 1067246875800000001, '2021-11-18 16:29:58', 1067246875800000001, '2021-11-18 16:29:58');
INSERT INTO `epmet_admin`.`sys_dict_type` (`id`, `dict_type`, `dict_name`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (10, 'user_demand_service_type', '居民需求服务方类型', '服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit;', 10, 1067246875800000001, '2021-11-18 16:29:58', 1067246875800000001, '2021-11-18 16:29:58');
INSERT INTO `epmet_admin`.`sys_dict_type` (`id`, `dict_type`, `dict_name`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1000000000000000006, 'scale', '人员规模', '', 6, 1067246875800000001, '2021-11-18 16:29:58', 1067246875800000001, '2021-11-18 16:29:58');
INSERT INTO `epmet_admin`.`sys_dict_type` (`id`, `dict_type`, `dict_name`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1000000000000000007, 'party_unit_type', '联建单位分类', '', 7, 1067246875800000001, '2021-11-18 16:29:58', 1067246875800000001, '2021-11-18 16:29:58');
-- 2、增加字典数据
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1000000000000000200, 1000000000000000007, '楼宇党建', '0', '', 0, 1067246875800000001, '2020-03-08 16:29:58', 1067246875800000001, '2020-03-08 16:29:58');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1000000000000000201, 1000000000000000007, '两新组织', '1', '', 1, 1067246875800000001, '2020-03-08 16:29:58', 1067246875800000001, '2020-03-08 16:29:58');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1000000000000000202, 1000000000000000007, '区域单位党建', '2', '', 2, 1067246875800000001, '2020-03-08 16:29:58', 1067246875800000001, '2020-03-08 16:29:58');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1000000000000000203, 1000000000000000007, '机关直属部门', '3', '', 3, 1067246875800000001, '2020-03-08 16:29:58', 1067246875800000001, '2020-03-08 16:29:58');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1000000000000000204, 1000000000000000007, '其他', '4', '', 4, 1067246875800000001, '2020-03-08 16:29:58', 1067246875800000001, '2020-03-08 16:29:58');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1000000000000000205, 8, '待处理', 'pending', '', 1, 1, '2021-11-23 14:00:59', 1, '2021-11-23 14:00:59');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1000000000000000206, 8, '已取消', 'canceled', '', 2, 1, '2021-11-23 14:00:59', 1, '2021-11-23 14:00:59');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1000000000000000207, 8, '已派单', 'assigned', '', 3, 1, '2021-11-23 14:00:59', 1, '2021-11-23 14:00:59');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1000000000000000208, 8, '已接单', 'have_order', '', 4, 1, '2021-11-23 14:00:59', 1, '2021-11-23 14:00:59');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1000000000000000209, 8, '已完成', 'finished', '', 5, 1, '2021-11-23 14:00:59', 1, '2021-11-23 14:00:59');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1000000000000000210, 9, '社区帮办', 'community', '', 1, 1, '2021-11-23 14:03:22', 1, '2021-11-23 14:03:22');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1000000000000000211, 9, '楼长帮办', 'building_caption', '', 2, 1, '2021-11-23 14:03:22', 1, '2021-11-23 14:03:22');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1000000000000000212, 9, '党员帮办', 'party', '', 3, 1, '2021-11-23 14:03:22', 1, '2021-11-23 14:03:22');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1000000000000000213, 10, '志愿者', 'volunteer', '', 1, 1, '2021-11-23 14:04:42', 1, '2021-11-23 14:04:42');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1000000000000000214, 10, '社会组织', 'social_org', '', 2, 1, '2021-11-23 14:04:42', 1, '2021-11-23 14:04:42');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1000000000000000215, 10, '社区自组织', 'community_org', '', 3, 1, '2021-11-23 14:04:42', 1, '2021-11-23 14:04:42');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1000000000000000216, 10, '区域党建单位', 'party_unit', '', 4, 1, '2021-11-23 14:04:42', 1, '2021-11-23 14:04:42');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (2000000000000000000, 1000000000000000006, '10人以下', '0', '', 0, 1067246875800000001, '2021-11-18 16:29:58', 1067246875800000001, '2021-11-18 16:29:58');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (2000000000000000001, 1000000000000000006, '10-20人', '1', '', 1, 1067246875800000001, '2021-11-18 16:29:58', 1067246875800000001, '2021-11-18 16:29:58');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (2000000000000000002, 1000000000000000006, '21-40人', '2', '', 2, 1067246875800000001, '2021-11-18 16:29:58', 1067246875800000001, '2021-11-18 16:29:58');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (2000000000000000003, 1000000000000000006, '41-100人', '3', '', 3, 1067246875800000001, '2021-11-18 16:29:58', 1067246875800000001, '2021-11-18 16:29:58');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (2000000000000000004, 1000000000000000006, '100人以上', '4', '', 4, 1067246875800000001, '2021-11-18 16:29:58', 1067246875800000001, '2021-11-18 16:29:58');

9
epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.7__add_dict_data_V3.sql

@ -0,0 +1,9 @@
-- 1、增加字典类型
INSERT INTO `epmet_admin`.`sys_dict_type` (`id`, `dict_type`, `dict_name`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1000000000000000011, 'age_group', '年龄范围', '', 11, 1067246875800000001, '2021-11-18 16:29:58', 1067246875800000001, '2021-11-18 16:29:58');
-- 2、增加字典数据
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1000000000000000230, 1000000000000000011, '50岁以下', '0', '', 0, 1, '2021-11-23 14:04:42', 1, '2021-11-23 14:04:42');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1000000000000000231, 1000000000000000011, '50-59岁', '1', '', 1, 1, '2021-11-23 14:04:42', 1, '2021-11-23 14:04:42');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1000000000000000232, 1000000000000000011, '60-69岁', '2', '', 2, 1, '2021-11-23 14:04:42', 1, '2021-11-23 14:04:42');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1000000000000000233, 1000000000000000011, '70-79岁', '3', '', 3, 1, '2021-11-23 14:04:42', 1, '2021-11-23 14:04:42');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1000000000000000234, 1000000000000000011, '80岁以上', '4', '', 4, 1, '2021-11-23 14:04:42', 1, '2021-11-23 14:04:42');

13
epmet-admin/epmet-admin-server/src/main/resources/mapper/SysDictDataDao.xml

@ -7,4 +7,17 @@
select dict_type_id, dict_label, dict_value from sys_dict_data order by dict_type_id, sort
</select>
<select id="selectDictList" resultType="com.epmet.commons.tools.dto.result.DictListResultDTO">
SELECT
a.dict_label label,
a.dict_value `value`
FROM
sys_dict_data a
INNER JOIN sys_dict_type b ON a.dict_type_id = b.id
WHERE
b.dict_type = #{dictType}
ORDER BY
a.sort ASC
</select>
</mapper>

4
epmet-auth/deploy/docker-compose-prod.yml

@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-auth-server:
container_name: epmet-auth-server-prod
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-auth:0.3.70
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-auth:0.3.96
ports:
- "8081:8081"
network_mode: host # 使用现有网络
@ -15,4 +15,4 @@ services:
resources:
limits:
cpus: '0.1'
memory: 600M
memory: 600M

4
epmet-auth/pom.xml

@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>0.3.70</version>
<version>0.3.96</version>
<parent>
<groupId>com.epmet</groupId>
<artifactId>epmet-cloud</artifactId>
@ -352,7 +352,7 @@
<nacos.ip/>
<!--是否开启服务列表变更监听-->
<nacos.service-list-changed-listening.enable>false</nacos.service-list-changed-listening.enable>
<nacos.service-list-changed-listening.enable>true</nacos.service-list-changed-listening.enable>
<!--公众号配置-->
<wx.mp.configs.appId>wxcb6ce2ed0c5ae54c</wx.mp.configs.appId>

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(), "【基层治理平台登录】获取用户信息失败", null);
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查询所属客户跟组织列表失败", null);
// 生成登录票据
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);
}
}

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

@ -23,6 +23,9 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
/**
* @Description 通用登录接口
@ -65,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>
@ -121,4 +148,86 @@ public class LoginController {
}
return new Result().ok("");
}
//================start test code==========
/**
* 校验签名
*/
public static boolean checkSignature(String signature, String timestamp, String nonce) {
System.out.println("signature:" + signature + "timestamp:" + timestamp + "nonc:" + nonce);
String WECHAT_TOKEN = "1jkoyyih83nj8";
String[] arr = new String[]{WECHAT_TOKEN, timestamp, nonce};
// 将token、timestamp、nonce三个参数进行字典序排序
Arrays.sort(arr);
StringBuilder content = new StringBuilder();
for (int i = 0; i < arr.length; i++) {
content.append(arr[i]);
}
MessageDigest md = null;
String tmpStr = null;
try {
md = MessageDigest.getInstance("SHA-1");
// 将三个参数字符串拼接成一个字符串进行sha1加密
byte[] digest = md.digest(content.toString().getBytes());
tmpStr = byteToStr(digest);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
content = null;
// 将sha1加密后的字符串可与signature对比,标识该请求来源于微信
System.out.println(tmpStr.equals(signature.toUpperCase()));
return tmpStr != null ? tmpStr.equals(signature.toUpperCase()) : false;
}
/**
* 将字节数组转换为十六进制字符串
*
* @param byteArray
* @return
*/
private static String byteToStr(byte[] byteArray) {
String strDigest = "";
for (int i = 0; i < byteArray.length; i++) {
strDigest += byteToHexStr(byteArray[i]);
}
return strDigest;
}
/**
* 将字节转换为十六进制字符串
*
* @param mByte
* @return
*/
private static String byteToHexStr(byte mByte) {
char[] Digit = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
char[] tempArr = new char[2];
tempArr[0] = Digit[(mByte >>> 4) & 0X0F];
tempArr[1] = Digit[mByte & 0X0F];
String s = new String(tempArr);
return s;
}
/**
* 打开开发者模式签名认证
* @param signature
* @param timestamp
* @param nonce
* @param echostr
* @return
*/
@ResponseBody
@RequestMapping(value = "/service", method = RequestMethod.GET)
public Object defaultView(String signature, String timestamp, String nonce, String echostr) {
if (echostr == null || echostr.isEmpty()) {
return nonce;
}
if (this.checkSignature(signature, timestamp, nonce)) {
return echostr;
}
return nonce;
}
}

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);

17
epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java

@ -3,7 +3,7 @@ package com.epmet.service.impl;
import com.epmet.common.token.constant.LoginConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.security.dto.GovTokenDto;
import com.epmet.commons.tools.security.password.PasswordUtils;
import com.epmet.commons.tools.utils.CpUserDetailRedis;
import com.epmet.commons.tools.utils.DateUtils;
@ -45,6 +45,8 @@ public class GovWebServiceImpl implements GovWebService {
private CpUserDetailRedis cpUserDetailRedis;
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
@Autowired
private ThirdLoginServiceImpl thirdLoginService;
/**
* @param formDTO
@ -105,7 +107,11 @@ public class GovWebServiceImpl implements GovWebService {
String token = jwtTokenUtils.createToken(map);
logger.info("app:" + formDTO.getApp() + ";client:" + formDTO.getClient() + ";userId:" + userId + ";生成token[" + token + "]");
int expire = jwtTokenProperties.getExpire();
TokenDto tokenDto = new TokenDto();
String orgIdPath = thirdLoginService.getOrgIdPath(userId);
String[] orgIdPathParts = orgIdPath.split(":");
GovTokenDto tokenDto = new GovTokenDto();
tokenDto.setCustomerId(formDTO.getCustomerId());
tokenDto.setApp(formDTO.getApp());
tokenDto.setClient(formDTO.getClient());
@ -113,6 +119,13 @@ public class GovWebServiceImpl implements GovWebService {
tokenDto.setToken(token);
tokenDto.setUpdateTime(System.currentTimeMillis());
tokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime());
tokenDto.setAgencyId(orgIdPathParts[orgIdPathParts.length - 1]);
tokenDto.setRootAgencyId(orgIdPathParts[0]);
tokenDto.setDeptIdList(thirdLoginService.getDeptartmentIdList(userId));
tokenDto.setGridIdList(thirdLoginService.getGridIdList(userId));
tokenDto.setRoleList(thirdLoginService.queryGovStaffRoles(userId, orgIdPathParts[orgIdPathParts.length - 1]));
tokenDto.setOrgIdPath(orgIdPath);
cpUserDetailRedis.set(tokenDto, expire);
logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss"));
return token;

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平台登录】获取组织信息失败", null);
// 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-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java

@ -295,7 +295,7 @@ public class LoginServiceImpl implements LoginService {
if (!flag) {
logger.warn(String.format("用户%s登录,验证码输入错误", formDTO.getPhone()));
//2020-05-21去除验证码校验
return new Result<UserTokenResultDTO>().error(EpmetErrorCode.ERR10019.getCode());
//return new Result<UserTokenResultDTO>().error(EpmetErrorCode.ERR10019.getCode());
}
//2、账号是否存在
//获取用户信息

2
epmet-auth/src/main/resources/bootstrap.yml

@ -32,6 +32,8 @@ spring:
namespace: @nacos.discovery.namespace@
#不把自己注册到注册中心的地址
register-enabled: @nacos.register-enabled@
serviceListChangedListening:
enable: @nacos.service-list-changed-listening.enable@
config:
enabled: @nacos.config-enabled@
server-addr: @nacos.server-addr@

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>

26
epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/service/BaseService.java

@ -123,5 +123,31 @@ public interface BaseService<T> {
*/
boolean deleteBatchIds(Collection<? extends Serializable> idList);
/**
* <p>
* 存在更新记录否插入一条记录
* </p>
*
* @param entity 实体对象
*/
boolean saveOrUpdate(T entity);
/**
* <p>
* 批量修改插入
* </p>
*
* @param entityList 实体对象集合
*/
boolean saveOrUpdateBatch(Collection<T> entityList);
/**
* <p>
* 批量修改插入
* </p>
*
* @param entityList 实体对象集合
* @param batchSize 更新批次数量
*/
boolean saveOrUpdateBatch(Collection<T> entityList, int batchSize);
}

55
epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/service/impl/BaseServiceImpl.java

@ -13,6 +13,8 @@ import com.baomidou.mybatisplus.core.enums.SqlMethod;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
import com.baomidou.mybatisplus.core.toolkit.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
@ -31,6 +33,7 @@ import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* 基础服务类所有Service都要继承
@ -298,4 +301,56 @@ public abstract class BaseServiceImpl<M extends BaseMapper<T>, T> implements Bas
public boolean deleteBatchIds(Collection<? extends Serializable> idList) {
return SqlHelper.delBool(baseDao.deleteBatchIds(idList));
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean saveOrUpdate(T entity) {
if (null != entity) {
Class<?> cls = entity.getClass();
TableInfo tableInfo = TableInfoHelper.getTableInfo(cls);
Assert.notNull(tableInfo, "error: can not execute. because can not find cache of TableInfo for entity!");
String keyProperty = tableInfo.getKeyProperty();
Assert.notEmpty(keyProperty, "error: can not execute. because can not find column for id from entity!");
Object idVal = ReflectionKit.getMethodValue(cls, entity, tableInfo.getKeyProperty());
return StringUtils.checkValNull(idVal) || Objects.isNull(selectById((Serializable) idVal)) ? insert(entity) : updateById(entity);
}
return false;
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean saveOrUpdateBatch(Collection<T> entityList) {
return saveOrUpdateBatch(entityList, 100);
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean saveOrUpdateBatch(Collection<T> entityList, int batchSize) {
Assert.notEmpty(entityList, "error: entityList must not be empty");
Class<?> cls = currentModelClass();
TableInfo tableInfo = TableInfoHelper.getTableInfo(cls);
Assert.notNull(tableInfo, "error: can not execute. because can not find cache of TableInfo for entity!");
String keyProperty = tableInfo.getKeyProperty();
Assert.notEmpty(keyProperty, "error: can not execute. because can not find column for id from entity!");
try (SqlSession batchSqlSession = sqlSessionBatch()) {
int i = 0;
for (T entity : entityList) {
Object idVal = ReflectionKit.getMethodValue(cls, entity, keyProperty);
if (StringUtils.checkValNull(idVal) || Objects.isNull(selectById((Serializable) idVal))) {
batchSqlSession.insert(sqlStatement(SqlMethod.INSERT_ONE), entity);
} else {
MapperMethod.ParamMap<T> param = new MapperMethod.ParamMap<>();
param.put(Constants.ENTITY, entity);
batchSqlSession.update(sqlStatement(SqlMethod.UPDATE_BY_ID), param);
}
// 不知道以后会不会有人说更新失败了还要执行插入 😂😂😂
if (i >= 1 && i % batchSize == 0) {
batchSqlSession.flushStatements();
}
i++;
}
batchSqlSession.flushStatements();
}
return true;
}
}

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

@ -45,4 +45,33 @@ 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";
/**
* 开放的人员信息变更预警统计
*/
String IC_WARN_STATS_EVENT_LISTENER_GROUP = "ic_warn_stats_event_listener_group";
/**
* 需求完成如果服务方是区域化党建单位重新计算这个单位的满意度
*/
String CAL_PARTY_UNIT_SATISFACTION = "cal_party_unit_satisfaction";
}

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";
}

31
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,34 @@ public interface TopicConstants {
* 积分系统话题
*/
String POINT = "point";
/**
* 组织信息
*/
String ORG = "org";
/**
* 工作人员
*/
String STAFF = "staff";
/**
* 巡查记录
*/
String PATROL = "patrol";
/**
* 项目
*/
String PROJECT = "project";
/**
* 项目
*/
String IC_RESI_USER = "ic_resi_user";
/**
* 需求完成如果服务方是区域化党建单位重新计算这个单位的满意度
*/
String CAL_PARTY_UNIT_SATISFACTION = "cal_party_unit_satisfaction";
}

19
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/CalPartyUnitSatisfactionFormDTO.java

@ -0,0 +1,19 @@
package com.epmet.commons.rocketmq.messages;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 需求完成如果服务方是区域化党建单位重新计算这个单位的满意度,或者直接计算整个客户
*/
@Data
public class CalPartyUnitSatisfactionFormDTO implements Serializable {
public interface AddUserInternalGroup {
}
@NotBlank(message = "客户id不能为空",groups = AddUserInternalGroup.class)
private String customerId;
private String partyUnitId;
}

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

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

20
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/IcResiUserAddMQMsg.java

@ -0,0 +1,20 @@
package com.epmet.commons.rocketmq.messages;
import lombok.Data;
import java.io.Serializable;
/**
* 居民信息新增修改推送MQ
* @author sun
*/
@Data
public class IcResiUserAddMQMsg implements Serializable {
//客户Id
private String customerId;
//居民ID
private String icResiUser;
}

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>

69
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java

@ -1,5 +1,6 @@
package com.epmet.commons.tools.aspect;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.ThreadLocalConstant;
import com.epmet.commons.tools.exception.*;
@ -14,6 +15,9 @@ import javax.servlet.http.HttpServletRequest;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
/**
* 日志切面
@ -54,6 +58,8 @@ public abstract class BaseRequestLogAspect {
// transactionSerial = UUID.randomUUID().toString();
//}
Map<String, String> requestHeaders = getRequestHeaders(request);
// 将当前线程名称设置为事务流水号
if (!StringUtils.isEmpty(transactionSerial)) {
Thread.currentThread().setName(transactionSerial);
@ -64,10 +70,19 @@ public abstract class BaseRequestLogAspect {
try {
Object[] args = point.getArgs();
ThreadLocalConstant.requestParam.set(Arrays.toString(point.getArgs()));
log.info(">>>>>>>>请求信息>>>>>>>>:事务流水号:{},url:{} ,method:{},请求参数:{}", transactionSerial, requestURI, method, objectsToString(args));
log.info(">>>>>>>>请求信息>>>>>>>>:事务流水号:{},url:{} ,method:{},请求参数:{},请求头:{}",
transactionSerial, requestURI, method, objectsToString(args), requestHeaders);
result = point.proceed();
resultInfoLog(transactionSerial, getExecPeriod(startTime), result);
} catch (RenException e) {
} catch (EpmetException e) {
result = handleRenException(e);
if (e.getCode() > 8000) {
resultWarnLog(transactionSerial, getExecPeriod(startTime), result, e.getInternalMsg(), ExceptionUtils.getErrorStackTrace(e));
} else {
resultErrorLog(transactionSerial, getExecPeriod(startTime), result, e.getInternalMsg(), ExceptionUtils.getErrorStackTrace(e));
}
return result;
} catch (RenException e) {
result = handleRenException(e);
if (e.getCode() > 8000) {
resultWarnLog(transactionSerial, getExecPeriod(startTime), result, e.getInternalMsg(), ExceptionUtils.getErrorStackTrace(e));
@ -91,6 +106,23 @@ public abstract class BaseRequestLogAspect {
return result;
}
/**
* @Description 获取请求头信息
* @return
* @author wxz
* @date 2021.03.31 13:59
*/
private Map<String, String> getRequestHeaders(HttpServletRequest request) {
Enumeration<String> headerNames = request.getHeaderNames();
HashMap<String, String> headerMap = new HashMap<>();
while (headerNames.hasMoreElements()) {
String headerName = headerNames.nextElement();
String headerValue = request.getHeader(headerName);
headerMap.put(headerName, headerValue);
}
return headerMap;
}
/**
* info日志
* @param transactionSerial
@ -213,6 +245,31 @@ public abstract class BaseRequestLogAspect {
return result;
}
/**
* 处理EpmetException
* @param e
* @return
*/
private Result handleRenException(EpmetException e) {
if (e.getCode() > 8000) {
Result result;
if (StringUtils.isNotBlank(e.getMsg())) {
// 抛出异常的时候填写了自定义显示信息,把显示信息返回
result = new Result().error(e.getCode(), e.getMsg());
} else {
// 没有填写显示信息,则根据code找固定的显示信息
result = new Result().error(e.getCode());
}
result.setInternalMsg(e.getInternalMsg());
return result;
}
// 转化成服务器开小差...
Result result=new Result().error();
result.setInternalMsg(e.getInternalMsg());
//result.setMsg(e.getMsg());
return result;
}
/**
* 将请求对象转换为String
* @param args
@ -225,7 +282,13 @@ public abstract class BaseRequestLogAspect {
StringBuilder builder = new StringBuilder("[");
for (Object object : args) {
if (object != null) {
builder.append(object.toString());
try {
// 尝试作为json解析
String objectString = JSON.toJSONString(object);
builder.append(objectString);
} catch (Exception e) {
builder.append(object.toString());
}
builder.append(",");
}
}

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
*/

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

@ -64,6 +64,8 @@ public interface NumConstant {
long THREE_L = 3L;
long FOUR_L = 4L;
long MINUS_ONE_L = -1L;
long TEN_L = 10L;
long SIX_HUNDRED_L = 600L;
String ZERO_STR = "0";
String ONE_STR = "1";

9
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 = ";";
/**
* 中文顿号
*/
@ -69,6 +74,10 @@ public interface StrConstant {
*/
String STAR="*";
String QUESTION_MARK="?";
String QUESTION_MARK_TRANSFER="\\?";
String AND_MARK="&";
/**
* 空字符串
*/

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/distributedlock/DistributedLock.java

@ -18,7 +18,7 @@ import java.util.concurrent.TimeUnit;
@Component
public class DistributedLock {
@Autowired
@Autowired(required = false)
private RedissonClient redissonClient;
/**

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/distributedlock/LockConstants.java

@ -9,4 +9,6 @@ public interface LockConstants {
String TEST_LOCK_NAME = "testLock";
String STATS_LOCK_NAME = "stats";
String SCREEN_DAILY = "screenDaily";
}

20
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DictListFormDTO.java

@ -0,0 +1,20 @@
package com.epmet.commons.tools.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @Description 字典数据查询-接口入参
* @Author sun
*/
@Data
public class DictListFormDTO {
/**
* 字典类型
*/
@NotBlank(message = "字典类型不能为空")
private String dictType;
}

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;
}
}

16
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/CustomerStaffInfoCacheResult.java

@ -93,4 +93,20 @@ public class CustomerStaffInfoCacheResult implements Serializable {
*/
private List<IdAndNameDTO> deptList;
/**
* 组织级别
*/
private String level;
/**
* 中心位置经度
*/
private String longitude;
/**
* 中心位置纬度
*/
private String latitude;
}

17
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/DictListResultDTO.java

@ -0,0 +1,17 @@
package com.epmet.commons.tools.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description 字典数据查询-接口返参
* @Author sun
*/
@Data
public class DictListResultDTO implements Serializable {
private static final long serialVersionUID = 8618231166600518980L;
private String label;
private String value;
}

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

@ -0,0 +1,19 @@
package com.epmet.commons.tools.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/12/8 14:50
*/
@Data
public class OptionDataResultDTO implements Serializable {
private static final long serialVersionUID = 416877704759019210L;
private String label;
private String value;
private String code;
private String radio;
}

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

@ -0,0 +1,22 @@
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 String pValue;
private String sysDictDataId;
private List<OptionResultDTO> children;
private Boolean usableFlag;
}

22
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/BizTypeEnum.java

@ -11,10 +11,24 @@ import lombok.Getter;
@Getter
@AllArgsConstructor
public enum BizTypeEnum {
//枚举类型
//枚举类型 user,group,topic,issue,project,article
USER("user", "用户"),
GROUP("group", "小组"),
ACTIVITY("activity", "活动"),
AGENCY("agency", "组织");
TOPIC("topic", "话题"),
ISSUE("issue", "议题"),
PROJECT("project", "项目"),
ARTICLE("article", "文章(党建声音)"),
;
public static BizTypeEnum getEnum(String code) {
BizTypeEnum[] values = BizTypeEnum.values();
for (BizTypeEnum value : values) {
if (value.getType().equals(code)) {
return value;
}
}
return null;
}
/**
* 类型
@ -23,6 +37,6 @@ public enum BizTypeEnum {
/**
* 描述
*/
private String typeDesc;
private String desc;
}

59
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java

@ -0,0 +1,59 @@
package com.epmet.commons.tools.enums;
/**
* @author Administrator
*/
public enum DictTypeEnum {
/**
* 环境变量枚举
*/
UN_KNOWN("un_know", "暂不清楚", 0),
NINE_SMALL_PLACES("nine_small_places", "九小场所", 1),
EDUCATION("education", "文化程度", 2),
NATION("nation", "民族", 3),
RELATIONSHIP("relationship", "与户主关系", 4),
HOUSE("house", "住房性质", 5),
SCALE("scale", "人员规模", 6),
PARTY_UNIT_TYPE("party_unit_type", "联建单位分类", 7),
GENDER("gender", "性别", 8),
USER_DEMAND_STATUS("user_demand_status", "居民需求状态",8),
USER_DEMAND_REPORT_TYPE("user_demand_report_type","居民需求上报类型",9),
USER_DEMAND_SERVICE_TYPE("user_demand_service_type","居民需求服务方类型",10),
AGE_GROUP("age_group", "年龄范围", 11),
;
private final String code;
private final String name;
private final Integer sort;
DictTypeEnum(String code, String name, Integer sort) {
this.code = code;
this.name = name;
this.sort = sort;
}
public static DictTypeEnum getEnum(String code) {
DictTypeEnum[] values = DictTypeEnum.values();
for (DictTypeEnum value : values) {
if (value.getCode().equals(code)) {
return value;
}
}
return DictTypeEnum.UN_KNOWN;
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
public Integer getSort(){
return sort;
}
}

53
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/FormItemTypeEnum.java

@ -0,0 +1,53 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.commons.tools.enums;
/**
* form表单 配置item类型 枚举
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
public enum FormItemTypeEnum {
//枚举类型
INPUT("input", "输入框"),
RADIO("radio", "单选框"),
CHECKBOX("checkbox", "复选框"),
SELECT("select", "下拉框"),
TEXTAREA("textarea", "文本域"),
CASCADER("cascader", "及联"),
DATE_PICKER("datepicker", "组织"),
UN_KNOWN("un_known", "不支持的类型");
private String code;
private String desc;
FormItemTypeEnum(String value,String name) {
this.code = value;
this.desc = name;
}
public static FormItemTypeEnum getEnum(String code) {
FormItemTypeEnum[] values = FormItemTypeEnum.values();
for (FormItemTypeEnum value : values) {
if (value.getCode().equals(code)) {
return value;
}
}
return UN_KNOWN;
}
public String getCode() {
return code;
}
public String getDesc() {
return desc;
}
}

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;
}
}

59
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/PartyUnitTypeEnum.java

@ -0,0 +1,59 @@
package com.epmet.commons.tools.enums;
import com.epmet.commons.tools.exception.EpmetErrorCode;
/**
* @author Administrator
*/
public enum PartyUnitTypeEnum {
//房屋类型,1楼房,2平房,3别墅
LOUYU("0", "楼宇党建"),
ZUZHI("1", "两新组织"),
DANWEI("2", "区域单位党建"),
JIGUAN("3", "机关直属部门"),
QITA("4", "其他");
private String code;
private String name;
PartyUnitTypeEnum(String code, String name) {
this.code = code;
this.name = name;
}
public static String getName(String code) {
PartyUnitTypeEnum[] houseTypeEnums = values();
for (PartyUnitTypeEnum houseTypeEnum : houseTypeEnums) {
if (houseTypeEnum.getCode() == code) {
return houseTypeEnum.getName();
}
}
return EpmetErrorCode.SERVER_ERROR.getMsg();
}
public static String getCode(String name) {
PartyUnitTypeEnum[] houseTypeEnums = values();
for (PartyUnitTypeEnum houseTypeEnum : houseTypeEnums) {
if (houseTypeEnum.getName().equals(name)) {
return houseTypeEnum.getCode();
}
}
return null;
}
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;
}
}

58
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RelationshipEnum.java

@ -0,0 +1,58 @@
package com.epmet.commons.tools.enums;
/**
* @author Administrator
*/
public enum RelationshipEnum {
/**
* 环境变量枚举
*/
UN_KNOWN("0", "暂不清楚", 0),
SELF("1", "本人", 1),
spouse("2", "配偶", 2),
CHILD("3", "子女", 3),
PARENT("4", "父母", 4),
PARENT_IN_LAW("5", "岳父母或公婆", 5),
GRANDPARENT_IN_LAW("6", "祖父母", 6),
CHILD_IN_LAW("7", "媳婿", 7),
GRANDCHILD("8", "孙子女", 8),
BROTHER_AND_SISTER("9", "兄弟姐妹", 9),
OTHER("10", "其他", 10),
;
private final String code;
private final String name;
private final Integer sort;
RelationshipEnum(String code, String name, Integer sort) {
this.code = code;
this.name = name;
this.sort = sort;
}
public static RelationshipEnum getEnum(String code) {
RelationshipEnum[] values = RelationshipEnum.values();
for (RelationshipEnum value : values) {
if (value.getCode().equals(code)) {
return value;
}
}
return RelationshipEnum.UN_KNOWN;
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
public Integer getSort(){
return sort;
}
}

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

@ -7,6 +7,9 @@ package com.epmet.commons.tools.exception;
*/
public enum EpmetErrorCode {
/**
* 错误code及消息
*/
ERR10002( 10002,"数据库中已存在该记录"),
/**
* 账号或密码错误ACCOUNT_NOT_EXIST
@ -19,6 +22,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 +80,19 @@ public enum EpmetErrorCode {
SET_PARENT_AREA_CODE(8210,"请先设置上级组织区划"),
HAVE_GUIDE_CANNOT_DEL(8211,"当前分类已经存在办事指南,不允许删除"),
GUIDE_CATEGORY_NAME_EXITS(8212,"分类已存在"),
CUSTOMER_FORM_NOT_EXITS(8213,"客户未配置表单"),
RESI_NOT_FOUND(8214,"居民信息找不到"),
BUILDING_NAME_EXITED(8215,"楼栋名称已存在"),
DOOR_NAME_EXITED(8216,"门牌号已存在"),
NEIGHBOOR_NAME_EXITED(8217,"小区名称已存在"),
DEMAND_NAME_EXITED(8218, "分类名称已存在"),
DEMAND_CAN_NOT_CANCEL(8219, "需求已完成,不可取消"),
DEMAND_CAN_NOT_ASSIGN(8220, "当前状态,不可指派"),
DEMAND_CAN_NOT_FINISH(8221, "当前状态,不能评价"),
DEMAND_FINISHED(8222,"需求已完成"),
DEMAND_CAN_NOT_UPDATE(8223,"当前状态,不可更新需求"),
DEMAND_NOT_EXITS(8224,"需求不存在"),
DEMAND_SERVICE_NOT_EXITS(8225,"服务记录不存在"),
REQUIRE_PERMISSION(8301, "您没有足够的操作权限"),
THIRD_PLAT_REQUEST_ERROR(8302, "请求第三方平台错误"),
@ -128,6 +145,26 @@ public enum EpmetErrorCode {
PATROL_REPEATED_SUBMIT_ERROR(8521, "巡查已结束,请勿重复提交"),
PATROL_END_TIME_ERROR(8522, "巡查结束时间不能小于巡查开始时间"),
TIME_FORMAT_ERROR(8523, "时间格式错误"),
//社区党建
PARTY_UNIT_NAME_EXITED(8531, "单位名称已存在"),
// 社区自组织
COMMUNITY_SELF_ORGANIZATION_REPART_ERROR(8524, "社区自组织名称已存在"),
// 党群服务中心
PARTY_SERVICE_CENTER_ERROR(8525, "党群服务中心名称已存在"),
// 删除可预约事项存在预约记录时提示
MATTER_EXISTS_APPOINTMENT_ERROR(8526, "尚有未履行的预约存在,请确认后操作"),
// 预约某事项在某时间段存在记录时
APPOINTMENT_TIME_ERROR(8527, "该时间段已被预约,请选择其他时间段"),
APPOINTMENT_ERROR(8528, "%s尚有未履行的预约存在,请确认后操作"),
EXISTS_SAME_PHONE_ERROR(8529, "%s存在重复"),
COMMUNITY_SELF_ORGANIZATION_LIST_REPART_ERROR(8530, "%s社区自组织名称已存在"),
MATTER_NAME_EXISTS_APPOINTMENT_ERROR(8532, "存在重复预约事项"),
// 该错误不会提示给前端,只是后端传输错误信息用。
ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤SQL所需参数"),
OPER_ADD_CUSTOMER_ROOT_AGENCY_ERROR(8702, "添加客户根级组织失败"),
@ -212,8 +249,18 @@ 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,"删除失败"),
//通用错误码 start
//通用的 错误消息自己定义返回
EPMET_COMMON_OPERATION_FAIL(9999,"网络开小差..."),
//通用错误码 end
;
private int code;
private String msg;

96
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetException.java

@ -0,0 +1,96 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
* <p>
* https://www.renren.io
* <p>
* 版权所有侵权必究
*/
package com.epmet.commons.tools.exception;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.utils.MessageUtils;
import org.apache.commons.lang3.StringUtils;
/**
* Epmet产品 自定义异常
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
public class EpmetException extends RuntimeException {
private static final long serialVersionUID = 1L;
/**
* desc:错误码
*/
protected int code;
/**
* 显示给客户的消息
*/
protected String msg;
/**
* 内部消息用于服务之间传递错误信息排错用
*/
protected String internalMsg;
/**
* desc:指定错误码异常 外部异常内容为错误码对应的异常
* @param code
*/
public EpmetException(int code) {
this(code, StrConstant.EPMETY_STR);
}
/**
* desc:指定内部错误消息的异常 外部异常内容为错误码对应的异常
* @param code
* @param internalMsg
*/
public EpmetException(int code, String internalMsg) {
super(internalMsg);
this.code = code;
if (StringUtils.isBlank(internalMsg)) {
this.internalMsg = EpmetErrorCode.getMsg(code);
if (StringUtils.isBlank(this.internalMsg)) {
this.internalMsg = MessageUtils.getMessage(code, internalMsg);
}
} else {
this.internalMsg = internalMsg;
}
}
/**
* desc指定错误码 内外部错误消息异常
* @param code
* @param internalMsg
* @param externalMsg
*/
public EpmetException(int code, String internalMsg, String externalMsg) {
this(code, internalMsg);
this.msg = externalMsg;
}
/**
* desc:指定内部消息异常 外部错误码及消息为8000服务器开小差
* @param internalMsg
*/
public EpmetException(String internalMsg) {
super(internalMsg);
this.code = EpmetErrorCode.SERVER_ERROR.getCode();
this.internalMsg = internalMsg;
}
public int getCode() {
return code;
}
public String getMsg() {
return msg;
}
public String getInternalMsg() {
return internalMsg;
}
}

10
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenException.java

@ -35,11 +35,12 @@ public class RenException extends RuntimeException {
* 内部消息用于服务之间传递错误信息排错用
*/
private String internalMsg;
@Deprecated //已废弃 被EpmetException替代
public RenException(int code) {
this(code, "");
}
@Deprecated //已废弃 被EpmetException替代
public RenException(int code, String internalMsg) {
super(internalMsg);
this.code = code;
@ -53,11 +54,13 @@ public class RenException extends RuntimeException {
}
}
@Deprecated //已废弃 被EpmetException替代
public RenException(int code, String internalMsg, String msg, MessageMode mode) {
this(code, internalMsg);
this.msg = msg;
}
@Deprecated //已废弃 被EpmetException替代
public RenException(String internalMsg) {
super(internalMsg);
// this.code = ErrorCode.INTERNAL_SERVER_ERROR;
@ -65,15 +68,12 @@ public class RenException extends RuntimeException {
this.internalMsg = internalMsg;
}
@Deprecated //已废弃 被EpmetException替代
public RenException(String internalMsg, String msg) {
this(internalMsg);
this.msg = msg;
}
public RenException(int code, String... params) {
this.code = code;
this.internalMsg = EpmetErrorCode.getMsg(code);

21
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java

@ -2,11 +2,14 @@ package com.epmet.commons.tools.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.feign.fallback.CommonAggFeignClientFallBackFactory;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
@ -24,4 +27,22 @@ public interface CommonAggFeignClient {
*/
@PostMapping("/data/aggregator/epmetuser/getStaffInfo/{staffId}")
Result<CustomerStaffInfoCache> getStaffInfo(@PathVariable("staffId") String staffId);
/**
* @Description 查询组织信息
* @param agencyId
* @author zxc
* @date 2021/11/5 2:54 下午
*/
@PostMapping("/data/aggregator/org/agency")
Result<AgencyInfoCache> getAgencyInfo(@RequestParam("agencyId")String agencyId);
/**
* @Description 查询网格信息
* @param gridId
* @author zxc
* @date 2021/11/5 2:54 下午
*/
@PostMapping("/data/aggregator/org/grid")
Result<GridInfoCache> getGridInfo(@RequestParam("gridId")String gridId);
}

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日志
}
}

7
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/ResultDataResolver.java

@ -34,18 +34,19 @@ public interface ResultDataResolver {
* @return
* @param targetServiceName 目标service名称
* @param errorCode 错误码可以为空为空则使用上游服务抛出的错误码
* @param errorInternalMsg 错误信息可以为空为空则使用上游服务抛出的异常信息
* @param errorInternalMsg 内部错误信息可以为空为空则使用上游服务抛出的异常信息
* @param showMsg 展示给前端程序的错误信息可以为空为空则根据errorCode给定错误msg信息
* @author wxz
* @date 2021.06.07 22:45
*/
default <R> R getResultDataOrThrowsException(Result<R> result, String targetServiceName, Integer errorCode, String errorInternalMsg) {
default <R> R getResultDataOrThrowsException(Result<R> result, String targetServiceName, Integer errorCode, String errorInternalMsg, String showMsg) {
if (result == null) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), "调用{}服务发生错误,返回Result为null", targetServiceName);
}
if (!result.success()) {
Integer finalErrorCode = errorCode == null ? result.getCode() : errorCode;
String finalErrorInternalMsg = StringUtils.isBlank(errorInternalMsg) ? result.getInternalMsg() : errorInternalMsg;
throw new RenException(finalErrorCode, finalErrorInternalMsg);
throw new RenException(finalErrorCode, finalErrorInternalMsg, showMsg, RenException.MessageMode.CODE_INTERNAL_EXTERNAL);
}
return result.getData();
}

12
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java

@ -2,7 +2,9 @@ package com.epmet.commons.tools.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.feign.CommonAggFeignClient;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import org.springframework.stereotype.Component;
@ -20,4 +22,14 @@ public class CommonAggFeignClientFallback implements CommonAggFeignClient {
public Result<CustomerStaffInfoCache> getStaffInfo(String staffId) {
return ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "getStaffInfo", staffId);
}
@Override
public Result<AgencyInfoCache> getAgencyInfo(String agencyId) {
return ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "getAgencyInfo", agencyId);
}
@Override
public Result<GridInfoCache> getGridInfo(String gridId) {
return ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "getGridInfo", gridId);
}
}

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

@ -12,6 +12,7 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.utils.DateUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
/**
* @author Mark sunlightcs@gmail.com
@ -38,6 +39,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
*/
@ -341,6 +349,13 @@ public class RedisKeys {
return rootPrefix.concat("stats:calflag");
}
/**
* 插入大屏指标数据分布式锁 key
*/
public static String getScreenIndexDataLockKey() {
return rootPrefix.concat("stats:indexcal:lock");
}
/**
* footbar缓存key
* @param customerId
@ -351,12 +366,6 @@ public class RedisKeys {
return rootPrefix.concat("footbar").concat(":").concat(customerId).concat(":").concat(appType);
}
/**
* 插入大屏指标数据分布式锁 key
*/
public static String getScreenIndexDataLockKey() {
return rootPrefix.concat("stats:indexcal:lock");
}
/**
* @return
@ -547,4 +556,81 @@ 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);
}
/**
* desc:获取执行完毕的 业务 参数结果key
* @param bizMethod
* @return
*/
public static String getBackDoorbizExcuteResult(String bizMethod) {
return rootPrefix.concat("backdoor:").concat(bizMethod);
}
/**
* @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 getIcFormKeyForAdd(String formCode,String customerId) {
return rootPrefix.concat("icform:").concat(formCode).concat(":add:").concat(customerId);
}
public static String getIcFormKeyForExport(String formCode,String customerId) {
return rootPrefix.concat("icform:").concat(formCode).concat(":export:").concat(customerId);
}
/**
* icd form items key
* @param customerId
* @param formCode
* @return
*/
public static String getIcFormItemsKey(String customerId, String formCode) {
return rootPrefix.concat("icform:").concat(formCode).concat(":items:").concat(customerId);
}
/**
* desc导出居民信息时 临时存储居民信息 便于其他sheet复用信息
* @param resiId
* @return
*/
public static String getExportResiBaseInfoKey(String resiId) {
return rootPrefix.concat("resi:").concat("export").concat(":temp:").concat(resiId);
}
/**
* desc:获取客户的居民下载模版是否变更的key 1表示变更 0没有变更
* @param customerId
* @return
*/
public static String getResiTempChangedKey(String customerId) {
return rootPrefix.concat("resi:").concat("export").concat(":template:changed").concat(customerId);
}
}

93
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java

@ -0,0 +1,93 @@
package com.epmet.commons.tools.redis.common;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.CommonAggFeignClient;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.redis.common.bean.*;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import javax.annotation.PostConstruct;
import java.util.Map;
/**
* @Author zxc
* @DateTime 2021/11/5 2:29 下午
* @DESC
*/
@Slf4j
@Component
public class CustomerOrgRedis {
@Autowired
private RedisUtils redisUtils;
@Autowired
private CommonAggFeignClient commonAggFeignClient;
private static CustomerOrgRedis customerOrgRedis;
private static final String ROLE_MAP_KEY = "roleMap";
@PostConstruct
public void init() {
customerOrgRedis = this;
customerOrgRedis.redisUtils = this.redisUtils;
customerOrgRedis.commonAggFeignClient = this.commonAggFeignClient;
}
/**
* @Description 获取网格信息
* @param gridId
* @author zxc
* @date 2021/11/5 3:12 下午
*/
public static GridInfoCache getGridInfo(String gridId){
String key = RedisKeys.getGridInfoKey(gridId);
Map<String, Object> grid = customerOrgRedis.redisUtils.hGetAll(key);
if (!CollectionUtils.isEmpty(grid)) {
return ConvertUtils.mapToEntity(grid, GridInfoCache.class);
}
Result<GridInfoCache> gridInfoResult = customerOrgRedis.commonAggFeignClient.getGridInfo(gridId);
if (!gridInfoResult.success()){
throw new RenException("查询网格信息失败...");
}
if (null == gridInfoResult.getData()){
throw new RenException("没有此网格信息...");
}
Map<String, Object> map = BeanUtil.beanToMap(gridInfoResult.getData(), false, true);
customerOrgRedis.redisUtils.hMSet(key, map);
return gridInfoResult.getData();
}
/**
* @Description 获取组织信息
* @param agencyId
* @author zxc
* @date 2021/11/5 3:12 下午
*/
public static AgencyInfoCache getAgencyInfo(String agencyId){
String key = RedisKeys.getAgencyByIdKey(agencyId);
Map<String, Object> agency = customerOrgRedis.redisUtils.hGetAll(key);
if (!CollectionUtils.isEmpty(agency)) {
return ConvertUtils.mapToEntity(agency, AgencyInfoCache.class);
}
Result<AgencyInfoCache> agencyInfoResult = customerOrgRedis.commonAggFeignClient.getAgencyInfo(agencyId);
if (!agencyInfoResult.success()){
throw new RenException("查询组织信息失败...");
}
if (null == agencyInfoResult.getData()){
throw new RenException("没有此组织信息...");
}
Map<String, Object> map = BeanUtil.beanToMap(agencyInfoResult.getData(), false, true);
customerOrgRedis.redisUtils.hMSet(key, map);
return agencyInfoResult.getData();
}
}

142
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/AgencyInfoCache.java

@ -0,0 +1,142 @@
package com.epmet.commons.tools.redis.common.bean;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Author zxc
* @DateTime 2021/11/5 2:45 下午
* @DESC
*/
@Data
public class AgencyInfoCache implements Serializable {
private static final long serialVersionUID = -1332373159954084159L;
/**
* 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 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;
/**
* 坐标区域
*/
private String coordinates;
/**
* 中心位置经度
*/
private String longitude;
/**
* 中心位置纬度
*/
private String latitude;
}

116
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/GridInfoCache.java

@ -0,0 +1,116 @@
package com.epmet.commons.tools.redis.common.bean;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Author zxc
* @DateTime 2021/11/5 2:24 下午
* @DESC
*/
@Data
public class GridInfoCache implements Serializable {
private static final long serialVersionUID = -6159429894486235267L;
/**
* ID 唯一标识
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 网格名称
*/
private String gridName;
/** 组织-网格 */
private String gridNamePath;
/**
* 中心位置经度
*/
private String longitude;
/**
* 中心位置纬度
*/
private String latitude;
/**
* 所属地区码所属组织地区码
*/
private String areaCode;
/**
* 删除标识: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;
/**
* 坐标区域
*/
private String coordinates;
}

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);
}
}

13
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java

@ -6,7 +6,6 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
import java.util.List;
/**
@ -35,18 +34,6 @@ public class LoginUserUtil {
return userId;
}
/**
* 查询登录用户的客户Id
* @return
*/
public String getCurrentCustomerId() {
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
if (request == null) {
return null;
}
return request.getHeader(AppClientConstant.CUSTOMER_ID);
}
/**
* 登录用户的App头信息
* @return

93
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java

@ -11,6 +11,7 @@ package com.epmet.commons.tools.utils;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.form.TimeListResultDTO;
import com.google.common.collect.Maps;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.LocalDate;
@ -743,44 +744,6 @@ public class DateUtils {
return minusMonthId;
}
/**
* @Description 根据传入的时间维度判断格式
* @param dimension
* @return
* @author wangc
* @date 2020.09.24 10:11
**/
public static String identifyTimeDimension(String dimension){
//yyyyMMdd DATE_PATTERN_YYYYMMDD
//yyyyMM DATE_PATTERN_YYYYMM
//yyyy DATE_PATTERN_YYYY
//yyyyWcc
//yyyyQc
if(dimension.length() == NumConstant.EIGHT){
SimpleDateFormat df = new SimpleDateFormat(DATE_PATTERN_YYYYMMDD);
try{ df.parse(dimension); }catch (ParseException e){ return null; }
return "date";
}else if(dimension.length() == NumConstant.FOUR){
SimpleDateFormat df = new SimpleDateFormat(DATE_PATTERN_YYYY);
try{df.parse(dimension);}catch (ParseException e){return null;}
return "year";
}else if(dimension.length() == NumConstant.SEVEN){
if(dimension.contains("W")){
return "week";
}else return null;
}else if(dimension.length() == NumConstant.SIX){
if(dimension.contains("Q")){
return "quarter";
}else{
SimpleDateFormat df = new SimpleDateFormat(DATE_PATTERN_YYYYMM);
try{df.parse(dimension);}catch (ParseException e){return null;}
return "month";
}
}else return null;
}
/**
* 指定月份的开始时间
* @param date
@ -928,4 +891,58 @@ public class DateUtils {
format = DateUtils.format(DateUtils.getMonthEnd(dateIdDate), DateUtils.DATE_PATTERN_YYYYMMDD);
System.out.println(format);
}
/**
* @Author sun
* @Description 获取dateId对应的num天的dateId活monthId
* dateId yyyymmdd
* type[date;month]
* num[1;-1]
* 20211201 date 1 -> 20211202
* 20211201 month -1 -> 202111
**/
public static String dateOrmonthId(String dateId, String type, int num){
Calendar cal=Calendar.getInstance();
if (StringUtils.isNotBlank(dateId)){
cal.setTime(DateUtils.parseDate(dateId,DateUtils.DATE_PATTERN_YYYYMMDD));
}
if("date".equals(type)){
cal.add(Calendar.DATE, num);
}else if("month".equals(type)){
cal.add(Calendar.MONTH, num);
}
Date time=cal.getTime();
if("month".equals(type)){
return new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMM).format(time);
}
return new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD).format(time);
}
/**
* @Author sun
* @Description 获取dateId对应上一个月过去12个月的monthId
* dateId yyyymmdd
* 20211201 -> 202012-202111的值
**/
public static LinkedHashMap<String,String> getXproSub(String dateId){
java.time.format.DateTimeFormatter fmt = java.time.format.DateTimeFormatter.ofPattern("yyyyMM");
LinkedHashMap<String,String> xAxis = new LinkedHashMap<>();
Calendar cal=Calendar.getInstance();
cal.setTime(DateUtils.parseDate(dateId, DateUtils.DATE_PATTERN_YYYYMMDD));
TimeZone tz = cal.getTimeZone();
ZoneId zid = tz == null ? ZoneId.systemDefault() : tz.toZoneId();
java.time.LocalDate today = java.time.LocalDateTime.ofInstant(cal.toInstant(), zid).toLocalDate();
//java.time.LocalDate today = java.time.LocalDate.now();
for(int i = NumConstant.TWELVE;i > NumConstant.ZERO; i--){
java.time.LocalDate localDate = today.minusMonths(i);
String s = localDate.getMonth().getValue() + "月";
xAxis.put(localDate.format(fmt),s);
}
LinkedHashMap<String, String> result = Maps.newLinkedHashMap();
xAxis.entrySet().stream().sorted(Map.Entry.comparingByKey())
.forEachOrdered((e -> result.put(e.getKey(),e.getValue())));
return result;
}
}

276
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelPoiUtils.java

@ -0,0 +1,276 @@
package com.epmet.commons.tools.utils;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
public class ExcelPoiUtils {
/**
* excel 导出
*
* @param list 数据列表
* @param fileName 导出时的excel名称
* @param response
*/
public static void exportExcel(List<Map<String, Object>> list, String fileName, HttpServletResponse response) throws IOException {
defaultExport(list, fileName, response);
}
/**
* 默认的 excel 导出
*
* @param list 数据列表
* @param fileName 导出时的excel名称
* @param response
*/
private static void defaultExport(List<Map<String, Object>> list, String fileName, HttpServletResponse response) throws IOException {
//把数据添加到excel表格中
Workbook workbook = ExcelExportUtil.exportExcel(list, ExcelType.HSSF);
downLoadExcel(fileName, response, workbook);
}
/**
* excel 导出
*
* @param list 数据列表
* @param pojoClass pojo类型
* @param fileName 导出时的excel名称
* @param response
* @param exportParams 导出参数标题sheet名称是否创建表头表格类型
*/
private static void defaultExport(List<?> list, Class<?> pojoClass, String fileName, HttpServletResponse response, ExportParams exportParams) throws IOException {
//把数据添加到excel表格中
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, pojoClass, list);
downLoadExcel(fileName, response, workbook);
}
/**
* excel 导出
*
* @param list 数据列表
* @param pojoClass pojo类型
* @param fileName 导出时的excel名称
* @param exportParams 导出参数标题sheet名称是否创建表头表格类型
* @param response
*/
public static void exportExcel(List<?> list, Class<?> pojoClass, String fileName, ExportParams exportParams, HttpServletResponse response) throws IOException {
defaultExport(list, pojoClass, fileName, response, exportParams);
}
/**
* excel 导出
*
* @param list 数据列表
* @param title 表格内数据标题
* @param sheetName sheet名称
* @param pojoClass pojo类型
* @param fileName 导出时的excel名称
* @param response
*/
public static void exportExcel(List<?> list, String title, String sheetName, Class<?> pojoClass, String fileName, HttpServletResponse response) throws IOException {
defaultExport(list, pojoClass, fileName, response, new ExportParams(title, sheetName, ExcelType.XSSF));
}
/**
* excel 导出
*
* @param list 数据列表
* @param title 表格内数据标题
* @param sheetName sheet名称
* @param pojoClass pojo类型
* @param fileName 导出时的excel名称
* @param isCreateHeader 是否创建表头
* @param response
*/
public static void exportExcel(List<?> list, String title, String sheetName, Class<?> pojoClass, String fileName, boolean isCreateHeader, HttpServletResponse response) throws IOException {
ExportParams exportParams = new ExportParams(title, sheetName, ExcelType.XSSF);
exportParams.setCreateHeadRows(isCreateHeader);
defaultExport(list, pojoClass, fileName, response, exportParams);
}
/**
* 根据模板生成excel后导出
* @param templatePath 模板路径
* @param map 数据集合
* @param fileName 文件名
* @param response
* @throws IOException
*/
public static void exportExcel(TemplateExportParams templatePath, Map<String, Object> map, String fileName, HttpServletResponse response) throws IOException {
Workbook workbook = ExcelExportUtil.exportExcel(templatePath, map);
downLoadExcel(fileName, response, workbook);
}
/**
* excel下载
*
* @param fileName 下载时的文件名称
* @param response
* @param workbook excel数据
*/
private static void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) throws IOException {
try {
response.setCharacterEncoding("UTF-8");
response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName + ".xlsx", "UTF-8"));
workbook.write(response.getOutputStream());
} catch (Exception e) {
throw new IOException(e.getMessage());
}
}
/**
* excel 导入
*
* @param file excel文件
* @param pojoClass pojo类型
* @param <T>
* @return
*/
public static <T> List<T> importExcel(MultipartFile file, Class<T> pojoClass) throws IOException {
return importExcel(file, 1, 1, pojoClass);
}
/**
* excel 导入
*
* @param filePath excel文件路径
* @param titleRows 表格内数据标题行
* @param headerRows 表头行
* @param pojoClass pojo类型
* @param <T>
* @return
*/
public static <T> List<T> importExcel(String filePath, Integer titleRows, Integer headerRows, Class<T> pojoClass) throws IOException {
if (StringUtils.isBlank(filePath)) {
return null;
}
ImportParams params = new ImportParams();
params.setTitleRows(titleRows);
params.setHeadRows(headerRows);
params.setNeedSave(true);
params.setSaveUrl("/tmp/excel/");
try {
return ExcelImportUtil.importExcel(new File(filePath), pojoClass, params);
} catch (NoSuchElementException e) {
throw new IOException("模板不能为空");
} catch (Exception e) {
throw new IOException(e.getMessage());
}
}
/**
* excel 导入
*
* @param file 上传的文件
* @param titleRows 表格内数据标题行
* @param headerRows 表头行
* @param pojoClass pojo类型
* @param <T>
* @return
*/
public static <T> List<T> importExcel(MultipartFile file, Integer titleRows, Integer headerRows, Class<T> pojoClass) throws IOException {
if (file == null) {
return null;
}
try {
return importExcel(file.getInputStream(), titleRows, headerRows, pojoClass);
} catch (Exception e) {
throw new IOException(e.getMessage());
}
}
/**
* excel 导入
*
* @param inputStream 文件输入流
* @param titleRows 表格内数据标题行
* @param headerRows 表头行
* @param pojoClass pojo类型
* @param <T>
* @return
*/
public static <T> List<T> importExcel(InputStream inputStream, Integer titleRows, Integer headerRows, Class<T> pojoClass) throws IOException {
if (inputStream == null) {
return null;
}
ImportParams params = new ImportParams();
params.setTitleRows(titleRows);
params.setHeadRows(headerRows);
params.setSaveUrl("/tmp/excel/");
params.setNeedSave(true);
try {
return ExcelImportUtil.importExcel(inputStream, pojoClass, params);
} catch (NoSuchElementException e) {
throw new IOException("excel文件不能为空");
} catch (Exception e) {
throw new IOException(e.getMessage());
}
}
/**
* excel 导入有错误信息
*
* @param file 上传的文件
* @param pojoClass pojo类型
* @param <T>
* @return
*/
public static <T> ExcelImportResult<T> importExcelMore(MultipartFile file,Integer titleRows, Integer headerRows, Class<T> pojoClass) throws IOException {
if (file == null) {
return null;
}
try {
return importExcelMore(file.getInputStream(), titleRows, headerRows, pojoClass);
} catch (Exception e) {
throw new IOException(e.getMessage());
}
}
/**
* excel 导入
*
* @param inputStream 文件输入流
* @param pojoClass pojo类型
* @param <T>
* @return
*/
private static <T> ExcelImportResult<T> importExcelMore(InputStream inputStream,Integer titleRows, Integer headerRows, Class<T> pojoClass) throws IOException {
if (inputStream == null) {
return null;
}
ImportParams params = new ImportParams();
params.setTitleRows(titleRows);//表格内数据标题行
params.setHeadRows(headerRows);//表头行
params.setSaveUrl("/tmp/excel/");
params.setNeedSave(true);
params.setNeedVerify(true);
try {
return ExcelImportUtil.importExcelMore(inputStream, pojoClass, params);
} catch (NoSuchElementException e) {
throw new IOException("excel文件不能为空");
} catch (Exception e) {
throw new IOException(e.getMessage());
}
}
}

11
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelUtils.java

@ -19,8 +19,8 @@ import org.springframework.util.CollectionUtils;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
@ -121,5 +121,14 @@ public class ExcelUtils {
out.flush();
out.close();
}
public static OutputStream getOutputStreamForExcel(String fileName, HttpServletResponse response) throws Exception {
fileName = URLEncoder.encode(fileName, "UTF-8");
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf8");
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
response.addHeader("Access-Control-Expose-Headers", "Content-disposition");
return response.getOutputStream();
}
}

31
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelVerifyInfo.java

@ -0,0 +1,31 @@
package com.epmet.commons.tools.utils;
import cn.afterturn.easypoi.handler.inter.IExcelDataModel;
import cn.afterturn.easypoi.handler.inter.IExcelModel;
public class ExcelVerifyInfo implements IExcelModel, IExcelDataModel {
private String errorMsg;
private int rowNum;
@Override
public Integer getRowNum() {
return rowNum;
}
@Override
public void setRowNum(Integer rowNum) {
this.rowNum = rowNum;
}
@Override
public String getErrorMsg() {
return errorMsg;
}
@Override
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
}

11
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IpUtils.java

@ -12,6 +12,7 @@ import com.epmet.commons.tools.constant.StrConstant;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.commons.util.InetUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.server.reactive.ServerHttpRequest;
@ -127,12 +128,12 @@ public class IpUtils {
* 遍历本地网卡的方式在云平台虚拟机取不到真正的ip
* @return
*/
InetAddress localAddress = InetAddress.getLocalHost();
if (isValidAddress(localAddress)) {
return localAddress.getHostAddress();
InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class);
if (inetUtils == null || inetUtils.findFirstNonLoopbackHostInfo() == null) {
logger.warn("Could not get local host ip address");
} else {
SERVER_IP = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
}
logger.warn("Could not get local host ip address");
return null;
} catch (Exception e) {
logger.error("IpUtils getServerIp exception ", e);
}

10
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/Pinyin4jUtil.java

@ -31,7 +31,6 @@ public class Pinyin4jUtil {
duoyinMap.put('均',new String[]{"jun"});
duoyinMap.put('会', new String[]{"hui"});
duoyinMap.put('属', new String[]{"shu"});
duoyinMap.put('调', new String[]{"diao"});
}
/**
@ -43,6 +42,7 @@ public class Pinyin4jUtil {
*/
public static String getFirstSpellPinYin(String src, boolean isFullSpell) {
String targetStr = Pinyin4jUtil.makeStringByStringSet(Pinyin4jUtil.getPinyin(src, isFullSpell, 1));
System.out.println("targetStr="+targetStr);
String[] split = targetStr.split(",");
if (split.length > 1) {
targetStr = split[0];
@ -59,6 +59,7 @@ public class Pinyin4jUtil {
*/
public static String getSpellPinYin(String src, boolean isFullSpell,Integer preFont) {
String targetStr = Pinyin4jUtil.makeStringByStringSet(Pinyin4jUtil.getPinyin(src, isFullSpell, preFont));
System.out.println("targetStr="+targetStr);
String[] split = targetStr.split(",");
if (split.length > 1) {
targetStr = split[0];
@ -195,8 +196,9 @@ public class Pinyin4jUtil {
}
public static void main(String[] args) {
System.out.println(getFirstSpellPinYin("区直部门",false));
System.out.println(getSpellPinYin("党员提出话题数",false,4));
System.out.println(getSpellPinYin("社区超期项目数",false,4));
//System.out.println(getSpellPinYin("社区超期项目数",true,0));
System.out.println(getFirstSpellPinYin("区直部门",true));
//System.out.println(getSpellPinYin("党员提出话题数",false,4));
//System.out.println(getSpellPinYin("社区超期项目数",false,4));
}
}

11
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/validator/AssertUtils.java

@ -11,6 +11,7 @@ package com.epmet.commons.tools.validator;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ArrayUtil;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ErrorCode;
import com.epmet.commons.tools.exception.RenException;
import org.apache.commons.lang3.StringUtils;
@ -32,7 +33,7 @@ public class AssertUtils {
public static void isBlank(String str, Integer code, String... params) {
if(code == null){
throw new RenException(ErrorCode.NOT_NULL, "code");
throw new EpmetException(ErrorCode.NOT_NULL, "code");
}
if (StringUtils.isBlank(str)) {
@ -46,7 +47,7 @@ public class AssertUtils {
public static void isNull(Object object, Integer code, String... params) {
if(code == null){
throw new RenException(ErrorCode.NOT_NULL, "code");
throw new EpmetException(ErrorCode.NOT_NULL, "code");
}
if (object == null) {
@ -60,7 +61,7 @@ public class AssertUtils {
public static void isArrayEmpty(Object[] array, Integer code, String... params) {
if(code == null){
throw new RenException(ErrorCode.NOT_NULL, "code");
throw new EpmetException(ErrorCode.NOT_NULL, "code");
}
if(ArrayUtil.isEmpty(array)){
@ -74,7 +75,7 @@ public class AssertUtils {
public static void isListEmpty(List<?> list, Integer code, String... params) {
if(code == null){
throw new RenException(ErrorCode.NOT_NULL, "code");
throw new EpmetException(ErrorCode.NOT_NULL, "code");
}
if(CollUtil.isEmpty(list)){
@ -88,7 +89,7 @@ public class AssertUtils {
public static void isMapEmpty(Map map, Integer code, String... params) {
if(code == null){
throw new RenException(ErrorCode.NOT_NULL, "code");
throw new EpmetException(ErrorCode.NOT_NULL, "code");
}
if(MapUtil.isEmpty(map)){

4
epmet-gateway/deploy/docker-compose-prod.yml

@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-gateway-server:
container_name: epmet-gateway-server-prod
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-gateway:0.3.43
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-gateway:0.3.69
ports:
- "8080:8080"
network_mode: host # 使用现有网络
@ -15,4 +15,4 @@ services:
resources:
limits:
cpus: '0.1'
memory: 600M
memory: 600M

25
epmet-gateway/pom.xml

@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>0.3.43</version>
<version>0.3.69</version>
<parent>
<groupId>com.epmet</groupId>
<artifactId>epmet-cloud</artifactId>
@ -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>
@ -320,11 +323,11 @@
<!-- <gateway.routes.gov-issue-server.uri>http://localhost:8101</gateway.routes.gov-issue-server.uri>-->
<gateway.routes.gov-issue-server.uri>lb://gov-issue-server</gateway.routes.gov-issue-server.uri>
<!-- 23、政府工作端项目管理 -->
<!-- <gateway.routes.gov-project-server.uri>http://localhost:8102</gateway.routes.gov-project-server.uri>-->
<!-- <gateway.routes.gov-project-server.uri>http://localhost:8102</gateway.routes.gov-project-server.uri>-->
<gateway.routes.gov-project-server.uri>lb://gov-project-server</gateway.routes.gov-project-server.uri>
<!-- 24、公共服务 -->
<!--<gateway.routes.common-service-server.uri>lb://common-service-server</gateway.routes.common-service-server.uri>-->
<gateway.routes.common-service-server.uri>http://localhost:8103</gateway.routes.common-service-server.uri>
<gateway.routes.common-service-server.uri>lb://common-service-server</gateway.routes.common-service-server.uri>
<!--<gateway.routes.common-service-server.uri>http://localhost:8103</gateway.routes.common-service-server.uri>-->
<!-- 25、党建园地 -->
<gateway.routes.resi-home-server.uri>lb://resi-home-server</gateway.routes.resi-home-server.uri>
<!-- <gateway.routes.resi-home-server.uri>http://localhost:8104</gateway.routes.resi-home-server.uri>-->
@ -344,8 +347,8 @@
<gateway.routes.epmet-openapi-scan.uri>lb://epmet-openapi-scan</gateway.routes.epmet-openapi-scan.uri>
<!-- <gateway.routes.epmet-openapi-scan.uri>http://localhost:8107</gateway.routes.epmet-openapi-scan.uri>-->
<!-- 31、微信第三方平台 -->
<gateway.routes.epmet-third-server.uri>lb://epmet-third-server</gateway.routes.epmet-third-server.uri>
<!-- <gateway.routes.epmet-third-server.uri>http://localhost:8110</gateway.routes.epmet-third-server.uri>-->
<!-- <gateway.routes.epmet-third-server.uri>lb://epmet-third-server</gateway.routes.epmet-third-server.uri>-->
<gateway.routes.epmet-third-server.uri>http://localhost:8110</gateway.routes.epmet-third-server.uri>
<!-- 32、爱心互助 -->
<gateway.routes.epmet-heart-server.url>lb://epmet-heart-server</gateway.routes.epmet-heart-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>
@ -499,7 +508,7 @@
<nacos.ip/>
<!--是否开启服务列表变更监听-->
<nacos.service-list-changed-listening.enable>false</nacos.service-list-changed-listening.enable>
<nacos.service-list-changed-listening.enable>true</nacos.service-list-changed-listening.enable>
<!-- gateway routes -->
<!-- 1、认证服务 -->
@ -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>

6
epmet-gateway/src/main/java/com/epmet/GatewayApplication.java

@ -9,9 +9,9 @@
package com.epmet;
import com.epmet.commons.tools.aspect.ServletExceptionHandler;
import com.epmet.commons.tools.config.RedissonConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
@ -23,11 +23,11 @@ import org.springframework.context.annotation.FilterType;
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@SpringBootApplication()
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
//@ServletComponentScan
@ComponentScan(basePackages = {"com.epmet.*"}, excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {ServletExceptionHandler.class}))
@ComponentScan(basePackages = {"com.epmet.*"}, excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {RedissonConfig.class, ServletExceptionHandler.class}))
public class GatewayApplication {
public static void main(String[] args) {

2
epmet-gateway/src/main/java/com/epmet/config/CorsConfig.java

@ -117,7 +117,7 @@ class EpmetWebFilter implements WebFilter, ResultDataResolver {
adminOpenFeignClient.list(),
ServiceConstant.EPMET_ADMIN_SERVER,
EpmetErrorCode.SERVER_ERROR.getCode(),
"调用Admin服务查询Cors配置失败");
"调用Admin服务查询Cors配置失败", null);
} catch (Exception e) {
logger.error("调用Admin服务查询Cors配置失败");
}

15
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@
@ -476,13 +486,16 @@ epmet:
- /data/aggregator/**
- /gov/voice/**
- /resi/voice/**
- /epmet/point/**
# 内部认证url白名单(在白名单中的,就不会再校验登录了)
internalAuthUrlsWhiteList:
- /epmetuser/customerstaff/customerlist
- /auth/wechat/**
- /**/druid/**
- /gov/project/project/platformcallback
- /oper/customize/customerstartpage/homestartpage
- /tduck-api/**
- /epmet/point/mqCallback/**
# 外部应用认证,使用AccessToken等头进行认证
externalOpenUrls:

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";
}

21
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/FactAgencyProjectMonthResultDTO.java

@ -0,0 +1,21 @@
package com.epmet.dataaggre.dto.datastats.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 项目月数据-接口返参
* @Auth sun
*/
@Data
public class FactAgencyProjectMonthResultDTO implements Serializable {
private static final long serialVersionUID = 466974582608407121L;
//组织Id
private String agencyId;
//月维度Id
private String monthId;
//当月项目总数 【当前组织及下级前一月新增项目数】
private Integer projectIncr = 0;
}

35
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/FactAgencyProjectResultDTO.java

@ -0,0 +1,35 @@
package com.epmet.dataaggre.dto.datastats.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Description 项目总数-接口返参
* @Auth sun
*/
@Data
public class FactAgencyProjectResultDTO implements Serializable {
private static final long serialVersionUID = 466974582608407121L;
@JsonIgnore
BigDecimal bi = new BigDecimal(0);
//组织Id
private String agencyId;
//组织名称
private String dateId;
//月维度Id
private String monthId;
//项目总数
private Integer projectTotal = 0;
//处理中项目数
private Integer pendingTotal = 0;
//处理中项目占比
private String pendingRatio = "0%";
//已结案中项目数
private Integer closedTotal = 0;
//已结案中项目占比
private String closedRatio = "0%";
}

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;
}

5
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffPatrolDetailDTO.java

@ -17,9 +17,10 @@
package com.epmet.dataaggre.dto.epmetuser;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
@ -94,7 +95,7 @@ public class StaffPatrolDetailDTO implements Serializable {
private String horizontalaccuracy;
/**
* 地址暂时不用
* 地址
*/
private String address;

5
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffPatrolRecordDTO.java

@ -88,6 +88,11 @@ public class StaffPatrolRecordDTO implements Serializable {
*/
private String status;
/**
* 是否手动结束 手动:1定时任务传参:0
*/
private Integer isHandEnd;
/**
* 删除标识 0.未删除 1.已删除
*/

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

@ -93,4 +93,24 @@ public class CustomerStaffResultDTO implements Serializable {
*/
private String twoOrgName;
/**
* 社区名称0409
*/
private String community;
/**
* 组织级别
*/
private String level;
/**
* 中心位置经度
*/
private String longitude;
/**
* 中心位置纬度
*/
private String latitude;
}

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

@ -15,7 +15,7 @@ import java.io.Serializable;
public class PatrolDailySumResult implements Serializable {
private static final long serialVersionUID = 310405655189243944L;
private String fullAgencyId;
private String orgId;
private Integer patrolTotal;
private Integer totalTime;
}

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

@ -34,4 +34,9 @@ public class PatrolRecordDetailDTO implements Serializable {
* 后端返回开始巡查结束巡查此列只有集合第一条和最后一条有值
*/
private String flag;
/**
* 位置信息
*/
private String address;
}

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

@ -45,4 +45,9 @@ public class PatrolRecordListResultDTO implements Serializable {
*/
private List<PatrolRecordDetailDTO> details;
/**
* 是否手动结束 手动:1定时任务传参:0
*/
private Integer isHandEnd;
}

93
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueProjectCategoryDictDTO.java

@ -0,0 +1,93 @@
/**
* 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.dataaggre.dto.govissue;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 议题项目分类字典
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-12-08
*/
@Data
public class IssueProjectCategoryDictDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户id, 产品默认default
*/
private String customerId;
/**
* 上级分类ID 顶级此列存储0
*/
private String pid;
/**
* 所有上级分类ID用逗号分开
*/
private String pids;
/**
* 上级分类编码
*/
private String parentCategoryCode;
/**
* 分类编码分类编码+customer_id唯一
*/
private String categoryCode;
/**
* 分类名称
*/
private String categoryName;
/**
* 分类类别1,2,3,4....
*/
private String categoryType;
/**
* 排序
*/
private Integer sort;
/**
* 是否禁用(enable:启用 disable:禁用)
*/
private String isDisable;
/**
* 颜色
*/
private String color;
}

15
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerAgencyDTO.java

@ -142,4 +142,19 @@ public class CustomerAgencyDTO implements Serializable {
* 社区
*/
private String community;
/**
* 坐标
*/
private String coordinates;
/**
* 中心位置经度
*/
private String longitude;
/**
* 中心位置纬度
*/
private String latitude;
}

10
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerGridDTO.java

@ -59,6 +59,11 @@ public class CustomerGridDTO implements Serializable {
*/
private String latitude;
/**
* 坐标区域
*/
private String coordinates;
/**
* 所属地区码所属组织地区码
*/
@ -123,4 +128,9 @@ public class CustomerGridDTO implements Serializable {
* 所有上级组织名
*/
private String allParentName;
/**
* 组织-网格
*/
private String gridNamePath;
}

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

Loading…
Cancel
Save