Browse Source

Merge remote-tracking branch 'remotes/origin/dev_screen_data_2.0' into dev

# Conflicts:
#	epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/IndexGroupDetailDao.java
#	epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDetailDao.xml
dev_shibei_match
jianjun 5 years ago
parent
commit
9fbbae502e
  1. 2
      epmet-cloud-generator/src/main/resources/application.yml
  2. 2
      epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/config/DynamicDataSource.java
  3. 6
      epmet-commons/epmet-commons-extapp-auth/pom.xml
  4. 32
      epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/annotation/InternalAppRequestAuth.java
  5. 122
      epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/aspect/ExternalAppRequestAuthAspect.java
  6. 41
      epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/jwt/JwtTokenProperties.java
  7. 130
      epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/jwt/JwtTokenUtils.java
  8. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java
  9. 5
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java
  10. 21
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/TimeListResultDTO.java
  11. 6
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  12. 8
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/FeignConfig.java
  13. 88
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java
  14. 7
      epmet-gateway/pom.xml
  15. 26
      epmet-gateway/src/main/java/com/epmet/auth/AuthProcessor.java
  16. 31
      epmet-gateway/src/main/java/com/epmet/auth/ExtAppAuthProcessor.java
  17. 92
      epmet-gateway/src/main/java/com/epmet/auth/ExtAppJwtAuthProcessor.java
  18. 75
      epmet-gateway/src/main/java/com/epmet/auth/ExtAppMD5AuthProcessor.java
  19. 79
      epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java
  20. 175
      epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java
  21. 275
      epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java
  22. 9
      epmet-gateway/src/main/java/com/epmet/filter/CpProperty.java
  23. 35
      epmet-gateway/src/main/java/com/epmet/filter/UserTokenFilter.java
  24. 12
      epmet-gateway/src/main/java/com/epmet/jwt/JwtTokenUtils.java
  25. 13
      epmet-gateway/src/main/resources/bootstrap.yml
  26. 18
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityIndexFormDTO.java
  27. 15
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityListFormDTO.java
  28. 31
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AdvancedBranchRankFormDTO.java
  29. 36
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/IndexScoreFormDTO.java
  30. 16
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthAblityListFormDTO.java
  31. 17
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthScoreListFormDTO.java
  32. 35
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/PartIndexScroeRankFormDTO.java
  33. 15
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/PeerComparisonFormDTO.java
  34. 5
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/RootAgencyFormDTO.java
  35. 18
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ScoreListFormDTO.java
  36. 22
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankYMFormDTO.java
  37. 35
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/UserPointRankFormDTO.java
  38. 18
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityIndexResultDTO.java
  39. 4
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java
  40. 5
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AnNingSubAgencyIndexRankResultDTO.java
  41. 53
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexAdvanceBranchRankResultDTO.java
  42. 30
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexDictResultDTO.java
  43. 55
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexScoreResultDTO.java
  44. 6
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthScoreListResultDTO.java
  45. 45
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PartIndexScroeRankResultDTO.java
  46. 8
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PeerComparisonResultDTO.java
  47. 10
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PublicPartiProfileResultDTO.java
  48. 4
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/UserJoinIndicatorGrowthRateResultDTO.java
  49. 46
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/UserPointRankListResultDTO.java
  50. 4
      epmet-module/data-report/data-report-server/pom.xml
  51. 28
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/FactConstant.java
  52. 43
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/fact/FactIndexController.java
  53. 22
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java
  54. 6
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/DistributionController.java
  55. 6
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassRootsGovernController.java
  56. 5
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassrootsPartyDevController.java
  57. 51
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java
  58. 175
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java
  59. 6
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java
  60. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java
  61. 56
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenUserController.java
  62. 23
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java
  63. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataYearlyDao.java
  64. 18
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPartyUserRankDataDao.java
  65. 25
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencyScoreDao.java
  66. 60
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunityScoreDao.java
  67. 60
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridScoreDao.java
  68. 51
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridSubScoreDao.java
  69. 49
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/IndexDictDao.java
  70. 5
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java
  71. 18
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java
  72. 22
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java
  73. 30
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenUserService.java
  74. 27
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java
  75. 21
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java
  76. 89
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java
  77. 36
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java
  78. 62
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenUserServiceImpl.java
  79. 402
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java
  80. 10
      epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml
  81. 60
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml
  82. 4
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml
  83. 68
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunityScoreDao.xml
  84. 4
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml
  85. 70
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridScoreDao.xml
  86. 42
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml
  87. 30
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/IndexDictDao.xml
  88. 2
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml
  89. 1
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml
  90. 77
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml
  91. 14
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataYearlyDao.xml
  92. 54
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml
  93. 2
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml
  94. 4
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java
  95. 39
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/ExtractConstant.java
  96. 11
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/OrgSourceTypeConstant.java
  97. 19
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/ProjectEvaluateConstant.java
  98. 29
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/ScreenConstant.java
  99. 13
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/StatsConstant.java
  100. 91
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/DimObjectActionDTO.java

2
epmet-cloud-generator/src/main/resources/application.yml

@ -9,7 +9,7 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource
#MySQL配置
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://192.168.1.130:3306/epmet_evaluation_index?useUnicode=true&characterEncoding=UTF-8&useSSL=false
url: jdbc:mysql://192.168.1.130:3306/epmet_data_statistical?useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: epmet_dba
password: EpmEt-dbA-UsEr
#oracle配置

2
epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/config/DynamicDataSource.java

@ -25,7 +25,7 @@ public class DynamicDataSource extends AbstractRoutingDataSource {
@Override
protected Object determineCurrentLookupKey() {
String ds = DynamicContextHolder.peek();
logger.info("动态数据源:{}" + ds);
logger.debug("动态数据源:{}", ds);
return ds;
}

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

@ -27,6 +27,12 @@
</properties>
<dependencies>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.7.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>

32
epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/annotation/InternalAppRequestAuth.java

@ -0,0 +1,32 @@
/**
* Copyright 2018 人人开源 http://www.renren.io
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.epmet.commons.extappauth.annotation;
import java.lang.annotation.*;
/**
* 需要认证的内部请求
* @Author wxz
* @Description
* @Date 2020/4/23 16:17
**/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface InternalAppRequestAuth {
}

122
epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/aspect/ExternalAppRequestAuthAspect.java

@ -1,14 +1,24 @@
package com.epmet.commons.extappauth.aspect;
import cn.hutool.core.bean.BeanUtil;
import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth;
import com.epmet.commons.extappauth.annotation.InternalAppRequestAuth;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.commons.extappauth.jwt.JwtTokenUtils;
import com.epmet.commons.tools.exception.EpmetErrorCode;
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.security.dto.BaseTokenDto;
import com.epmet.commons.tools.security.dto.GovTokenDto;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.ExternalAppAuthFormDTO;
import com.epmet.dto.result.ExternalAppAuthResultDTO;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import io.jsonwebtoken.Claims;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
@ -19,12 +29,14 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
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.lang.reflect.Parameter;
import java.util.Map;
/**
* 外部应用请求认证切面
@ -36,6 +48,7 @@ public class ExternalAppRequestAuthAspect {
private static Logger logger = LoggerFactory.getLogger(ExternalAppRequestAuthAspect.class);
public static final String AUTHORIZATION_TOKEN_HEADER_KEY = "Authorization";
public static final String ACCESS_TOKEN_HEADER_KEY = "AccessToken";
public static final String APP_ID_HEADER_KEY = "appId";
public static final String APP_ID_TIMESTAMP_KEY = "ts";
@ -45,15 +58,121 @@ public class ExternalAppRequestAuthAspect {
@Autowired
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient;
@Autowired
private JwtTokenUtils jwtTokenUtils;
@Autowired
private RedisUtils redisUtils;
/**
* 拦截加了ExternalRequestAuth注解的方法
*
* @param point
* @throws Throwable
*/
@Before("@annotation(com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth)")
@Before("@annotation(com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth) " +
"|| @annotation(com.epmet.commons.extappauth.annotation.InternalAppRequestAuth)")
public void auth(JoinPoint point) throws Throwable {
MethodSignature signature = (MethodSignature) point.getSignature();
HttpServletRequest request = getRequest();
if (signature.getMethod().getAnnotation(ExternalAppRequestAuth.class) != null
&& StringUtils.isNotBlank(request.getHeader(ACCESS_TOKEN_HEADER_KEY))) {
// 走外部应用认证
extAppAuth(signature, point, request);
} else if (signature.getMethod().getAnnotation(InternalAppRequestAuth.class) != null
&& StringUtils.isNotBlank(request.getHeader(AUTHORIZATION_TOKEN_HEADER_KEY))) {
// 走内部应用认证
internalAppAuth(signature, point, request);
} else {
logger.error("根据header无法找到适用的认证方式");
throw new RenException(EpmetErrorCode.ERR401.getCode(), EpmetErrorCode.ERR401.getMsg());
}
}
/**
* 内部应用认证
* @param signature
* @param point
* @param request
* @return
*/
private void internalAppAuth(MethodSignature signature, JoinPoint point, HttpServletRequest request) {
String authorization = request.getHeader(AUTHORIZATION_TOKEN_HEADER_KEY);
BaseTokenDto tokenDTO = getTokenDTO(authorization);
Map<String, Object> tokenMap = redisUtils.hGetAll(RedisKeys.getCpUserKey(tokenDTO.getApp(), tokenDTO.getClient(), tokenDTO.getUserId()));
if (CollectionUtils.isEmpty(tokenMap)) {
logger.error("内部应用认证,redis中没有找到登录缓存信息");
throw new RenException(EpmetErrorCode.ERR10006.getCode(), EpmetErrorCode.ERR10006.getMsg());
}
BaseTokenDto baseTokenDto = null;
String customerId;
if ("gov".equals(tokenDTO.getApp())) {
GovTokenDto govTokenDto = BeanUtil.mapToBean(tokenMap, GovTokenDto.class, true);
customerId = govTokenDto.getCustomerId();
baseTokenDto = govTokenDto;
} else {
TokenDto tokenDto = BeanUtil.mapToBean(tokenMap, TokenDto.class, true);
customerId = tokenDto.getCustomerId();
baseTokenDto = tokenDTO;
}
if (baseTokenDto == null) {
logger.error("内部应用认证,redis中没有找到登录缓存信息");
throw new RenException(EpmetErrorCode.ERR10006.getCode(), EpmetErrorCode.ERR10006.getMsg());
}
if (!authorization.equals(baseTokenDto.getToken())) {
logger.error("内部应用认证,redis中找到的token与header里面传入的不一致,可能发生了别处登录");
throw new RenException(EpmetErrorCode.ERR10007.getCode(), EpmetErrorCode.ERR10007.getMsg());
}
// header参数赋值
Parameter[] parameters = signature.getMethod().getParameters();
if (parameters != null && parameters.length != 0) {
for (int i = 0; i < parameters.length; i++) {
if (parameters[i].getType() == ExternalAppRequestParam.class) {
ExternalAppRequestParam requestParam = (ExternalAppRequestParam) point.getArgs()[i];
requestParam.setCustomerId(customerId);
}
}
}
}
private BaseTokenDto getTokenDTO(String authorization) {
if (StringUtils.isBlank(authorization)) {
logger.error("内部应用认证,没有携带authorization头信息");
throw new RenException(EpmetErrorCode.ERR401.getCode(), EpmetErrorCode.ERR401.getMsg());
}
//是否过期
Claims claims = jwtTokenUtils.getClaimByToken(authorization);
if (claims == null) {
logger.error("内部应用认证,Claims为空");
throw new RenException(EpmetErrorCode.ERR401.getCode(), EpmetErrorCode.ERR401.getMsg());
}
if (jwtTokenUtils.isTokenExpired(claims.getExpiration())) {
logger.error("内部应用认证,token过期");
throw new RenException(EpmetErrorCode.ERR10006.getCode(), EpmetErrorCode.ERR10006.getMsg());
}
//获取用户ID
String app = (String) claims.get("app");
String client = (String) claims.get("client");
String userId = (String) claims.get("userId");
return new BaseTokenDto(app, client, userId, authorization);
}
/**
* 外部应用认证
*
* @param signature
* @param point
*/
public void extAppAuth(MethodSignature signature, JoinPoint point, HttpServletRequest request) {
String token = request.getHeader(ACCESS_TOKEN_HEADER_KEY);
String appId = request.getHeader(APP_ID_HEADER_KEY);
String ts = request.getHeader(APP_ID_TIMESTAMP_KEY);
@ -90,7 +209,6 @@ public class ExternalAppRequestAuthAspect {
// header参数赋值
MethodSignature signature = (MethodSignature) point.getSignature();
Parameter[] parameters = signature.getMethod().getParameters();
if (parameters != null && parameters.length != 0) {
for (int i = 0; i < parameters.length; i++) {

41
epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/jwt/JwtTokenProperties.java

@ -0,0 +1,41 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.commons.extappauth.jwt;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
/**
* Jwt
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Configuration
@ConfigurationProperties(prefix = "jwt.token")
public class JwtTokenProperties {
private String secret;
private int expire;
public String getSecret() {
return secret;
}
public void setSecret(String secret) {
this.secret = secret;
}
public int getExpire() {
return expire;
}
public void setExpire(int expire) {
this.expire = expire;
}
}

130
epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/jwt/JwtTokenUtils.java

@ -0,0 +1,130 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
* <p>
* https://www.renren.io
* <p>
* 版权所有侵权必究
*/
package com.epmet.commons.extappauth.jwt;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* Jwt工具类
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Component
public class JwtTokenUtils {
private static final Logger logger = LoggerFactory.getLogger(JwtTokenUtils.class);
@Autowired
private JwtTokenProperties jwtProperties;
/**
* 生成jwt token 弃用
*/
@Deprecated
public String generateToken(String userId) {
return Jwts.builder()
.setHeaderParam("typ", "JWT")
.setSubject(userId)
.setIssuedAt(new Date())
.setExpiration(DateTime.now().plusSeconds(jwtProperties.getExpire()).toDate())
.signWith(SignatureAlgorithm.HS512, jwtProperties.getSecret())
.compact();
}
public Claims getClaimByToken(String token) {
try {
return Jwts.parser()
.setSigningKey(jwtProperties.getSecret())
.parseClaimsJws(token)
.getBody();
} catch (Exception e) {
logger.debug("validate is token error, token = " + token, e);
return null;
}
}
/**
* @return java.util.Date
* @param token
* @Author yinzuomei
* @Description 获取token的有效期截止时间
* @Date 2020/3/18 22:17
**/
public Date getExpiration(String token){
try {
return Jwts.parser()
.setSigningKey(jwtProperties.getSecret())
.parseClaimsJws(token)
.getBody().getExpiration();
} catch (Exception e) {
logger.debug("validate is token error, token = " + token, e);
return null;
}
}
/**
* @param map
* @return java.lang.String
* @Author yinzuomei
* @Description 根据app+client+userId生成token
* @Date 2020/3/18 22:29
**/
public String createToken(Map<String, Object> map) {
return Jwts.builder()
.setHeaderParam("typ", "JWT")
.setClaims(map)
.setIssuedAt(new Date())
.setExpiration(DateTime.now().plusSeconds(jwtProperties.getExpire()).toDate())
.signWith(SignatureAlgorithm.HS512, jwtProperties.getSecret())
.compact();
}
/**
* token是否过期
*
* @return true过期
*/
public boolean isTokenExpired(Date expiration) {
return expiration.before(new Date());
}
public static void main(String[] args) {
Map<String, Object> map=new HashMap<>();
map.put("app","gov");
map.put("client","wxmp");
map.put("userId","100526ABC");
String tokenStr=Jwts.builder()
.setHeaderParam("typ", "JWT")
.setClaims(map)
.setIssuedAt(new Date())
.setExpiration(DateTime.now().plusSeconds(604800).toDate())
.signWith(SignatureAlgorithm.HS512, "7016867071f0ebf1c46f123eaaf4b9d6[elink.epmet]")
.compact();
System.out.println(tokenStr);
Claims claims= Jwts.parser()
.setSigningKey("7016867071f0ebf1c46f123eaaf4b9d6[elink.epmet]")
.parseClaimsJws(tokenStr)
.getBody();
System.out.println("app="+ claims.get("app"));
System.out.println("client="+ claims.get("client"));
System.out.println("userId="+ claims.get("userId"));
}
}

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

@ -96,6 +96,8 @@ public interface Constant {
* authorization header
*/
String AUTHORIZATION_HEADER = "authorization";
String ACCESS_TOKEN_HEADER = "AccessToken";
/**
* APP用户标识
*/

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

@ -31,13 +31,18 @@ public interface NumConstant {
int FOURTEEN=14;
int TWENTY = 20;
int THIRTY = 30;
int THIRTY_ONE = 31;
int FORTY = 40;
int FORTY_ONE = 41;
int FIFTY = 50;
int FIFTY_ONE = 51;
int SIXTY = 60;
int ONE_HUNDRED = 100;
BigDecimal ONE_HUNDRED_DECIMAL = new BigDecimal(100);
int ONE_THOUSAND = 1000;
int MAX = 99999999;
int EIGHTY_EIGHT = 88;
int EIGHTY = 80;
double ZERO_DOT_ZERO = 0.0;

21
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/TimeListResultDTO.java

@ -0,0 +1,21 @@
package com.epmet.commons.tools.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/9/15 5:41 下午
*/
@Data
public class TimeListResultDTO implements Serializable {
private static final long serialVersionUID = 1482639109300981626L;
private String dateId;
private String weekId;
private String monthId;
private String quarterId;
private String yearId;
}

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

@ -107,9 +107,9 @@ public enum EpmetErrorCode {
OPER_EXTERNAL_APP_AUTH_ERROR(8709, "外部应用认证失败"),
OPER_EXTERNAL_CUSTOMER_NOT_EXISTS(8710, "该客户不存在"),
OPER_EXTERNAL_APP_EXISTS(8711, "应用已存在"),
OPER_CUSTOMER_FOOTBAR_EXISTS(8712, "footbar已存在"),
OPER_CUSTOMER_FOOTBAR_NOT_FOUND(8713, "footbar不存在"),
OPER_EXT_APP_SECRET_RESET_FAIL(8713, "秘钥更新失败"),
OPER_CUSTOMER_FOOTBAR_EXISTS(8712, "footbar已存在"),
OPER_CUSTOMER_FOOTBAR_NOT_FOUND(8713, "footbar不存在"),
OPER_EXT_APP_SECRET_RESET_FAIL(8714, "秘钥更新失败"),
// 党建声音 前端提示 88段
DRAFT_CONTENT_IS_NULL(8801, "至少需要添加一个段落"),

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

@ -8,8 +8,10 @@
package com.epmet.commons.tools.feign;
import feign.Logger;
import feign.RequestInterceptor;
import feign.RequestTemplate;
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;
@ -18,6 +20,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
/**
* Feign调用携带header
*
@ -47,4 +50,9 @@ public class FeignConfig implements RequestInterceptor {
}
}
@Bean
Logger.Level feignLoggerLevel() {
return Logger.Level.FULL;//控制台会输出debug日志
}
}

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

@ -10,6 +10,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 org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.LocalDate;
@ -18,7 +19,11 @@ import org.joda.time.format.DateTimeFormatter;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.DateTimeException;
import java.time.ZoneId;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 日期处理工具类
@ -593,4 +598,87 @@ public class DateUtils {
}
return StrConstant.EPMETY_STR;
}
/**
* @Description 根据dateId获取时间集合
* @param dateId
* @author zxc
* @date 2020/9/22 9:06 上午
*/
public static TimeListResultDTO getTimeList(String dateId){
TimeListResultDTO result = new TimeListResultDTO();
result.setDateId(dateId);
String monthId = dateId.substring(NumConstant.ZERO, NumConstant.SIX);
result.setMonthId(monthId);
result.setQuarterId(getQuarterId(monthId));
result.setYearId(getYearId(monthId));
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
try {
Date date = formatter.parse(dateId);
int weekOfYear = getWeekOfYear(date);
String weekId = dateId.substring(NumConstant.ZERO,NumConstant.FOUR).concat("W").concat(String.valueOf(weekOfYear));
result.setWeekId(weekId);
} catch (ParseException e) {
e.printStackTrace();
}
return result;
}
/**
* @Description 根据monthIdyyyyMM获取上一个月份ID
* @param monthId
* @author zxc
* @date 2020/9/21 2:43 下午
*/
public static String minusMonthId(String monthId){
String minusMonthId = null;
SimpleDateFormat sft = new SimpleDateFormat("yyyyMM");
try {
Date parse = sft.parse(monthId);
java.time.LocalDate birth = parse.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
java.time.LocalDate localDate = birth.minusMonths(NumConstant.ONE);
minusMonthId = localDate.toString().substring(NumConstant.ZERO, NumConstant.FOUR).concat(localDate.toString().substring(NumConstant.FIVE, NumConstant.SEVEN));
} catch (ParseException e) {
e.printStackTrace();
}
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;
}
}

7
epmet-gateway/pom.xml

@ -58,6 +58,13 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<!--用于外部应用认证的查询-->
<dependency>
<groupId>com.epmet</groupId>
<artifactId>common-service-client</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
<build>

26
epmet-gateway/src/main/java/com/epmet/auth/AuthProcessor.java

@ -0,0 +1,26 @@
package com.epmet.auth;
import com.alibaba.fastjson.JSON;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import java.nio.charset.StandardCharsets;
public abstract class AuthProcessor {
abstract Mono<Void> auth(ServerWebExchange exchange, GatewayFilterChain chain);
protected Mono<Void> response(ServerWebExchange exchange, Object object) {
String json = JSON.toJSONString(object);
DataBuffer buffer = exchange.getResponse().bufferFactory().wrap(json.getBytes(StandardCharsets.UTF_8));
exchange.getResponse().getHeaders().setContentType(MediaType.APPLICATION_JSON_UTF8);
exchange.getResponse().setStatusCode(HttpStatus.OK);
return exchange.getResponse().writeWith(Flux.just(buffer));
}
}

31
epmet-gateway/src/main/java/com/epmet/auth/ExtAppAuthProcessor.java

@ -0,0 +1,31 @@
package com.epmet.auth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.server.ServerWebExchange;
/**
* 外部应用认证处理器父类
*/
public abstract class ExtAppAuthProcessor {
private Logger logger = LoggerFactory.getLogger(getClass());
private int diffMillins = 1000 * 60 * 5;
public abstract void auth(String appId, String token, Long ts, ServerWebExchange exchange);
/**
* 时间戳校验
* @param timestamp
* @return
*/
protected boolean validTimeStamp(Long timestamp) {
long now = System.currentTimeMillis();
if (Math.abs(now - timestamp) > diffMillins) {
return false;
}
return true;
}
}

92
epmet-gateway/src/main/java/com/epmet/auth/ExtAppJwtAuthProcessor.java

@ -0,0 +1,92 @@
package com.epmet.auth;
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.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.jwt.JwtTokenUtils;
import io.jsonwebtoken.Claims;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
/**
* jwt 认证处理器
*/
@Component
public class ExtAppJwtAuthProcessor extends ExtAppAuthProcessor {
private static Logger logger = LoggerFactory.getLogger(ExtAppJwtAuthProcessor.class);
@Autowired
private JwtTokenUtils jwtTokenUtils;
@Autowired
private RedisUtils redisUtils;
@Override
public void auth(String appId, String token, Long ts, ServerWebExchange exchange) {
String secret;
if (StringUtils.isBlank(secret = getTokenFromCache(appId))) {
throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), String.format("根据AppId:【%s】没有找到对应的秘钥", appId));
}
Claims claim;
try {
claim = jwtTokenUtils.getClaimByToken(token, secret);
} catch (Exception e) {
String errorStackTrace = ExceptionUtils.getErrorStackTrace(e);
logger.error("解析token失败:{}", errorStackTrace);
throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), "解析token失败");
}
String appIdIn = (String)claim.get("appId");
String customerId = (String)claim.get("customerId");
Long timestamp = (Long)claim.get("ts");
//校验时间戳,允许5分钟误差
if (StringUtils.isAnyBlank(appIdIn, customerId) || timestamp == null) {
logger.error("access token不完整。{},{},{}", appIdIn, customerId, timestamp);
throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), "AccessToken不完整");
}
if (!validTimeStamp(timestamp)) {
logger.error("extapp token已经超时,请求被拒绝");
throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), "AccessToken已经超时");
}
if (!appId.equals(appIdIn)) {
logger.error("AppId不对应,token外部的:{}, token内部解析出来的:{}", appId, appIdIn);
throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), "AppId不匹配");
}
// 添加客户ID等到请求头
exchange.getRequest().mutate().header("CustomerId", customerId);
}
/**
* 通过APP ID查询对应的秘钥
* @param appId
* @return
*/
public String getTokenFromCache(String appId) {
String secret = (String)redisUtils.get(RedisKeys.getExternalAppSecretKey(appId));
if (StringUtils.isBlank(secret)) {
EpmetCommonServiceOpenFeignClient commonService = SpringContextUtils.getBean(EpmetCommonServiceOpenFeignClient.class);
Result<String> result = commonService.getSecret(appId);
if (!result.success()) {
throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), result.getInternalMsg());
}
secret = result.getData();
redisUtils.set(RedisKeys.getExternalAppSecretKey(appId), secret);
}
return secret;
}
}

75
epmet-gateway/src/main/java/com/epmet/auth/ExtAppMD5AuthProcessor.java

@ -0,0 +1,75 @@
package com.epmet.auth;
import com.epmet.commons.tools.exception.EpmetErrorCode;
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.Md5Util;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
/**
* md5 认证处理器
*/
@Component
public class ExtAppMD5AuthProcessor extends ExtAppAuthProcessor {
private static Logger logger = LoggerFactory.getLogger(ExtAppMD5AuthProcessor.class);
//@Autowired
//private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient;
@Autowired
private RedisUtils redisUtils;
@Override
public void auth(String appId, String token, Long ts, ServerWebExchange exchange) {
if (ts == null) {
throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), "需要传入时间戳参数");
}
String secret;
if (StringUtils.isBlank(secret = getTokenFromCache(appId))) {
throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), String.format("根据AppId:%s没有找到对应的秘钥", appId));
}
String localDigest = Md5Util.md5(secret.concat(":") + ts);
if (!localDigest.equals(token)) {
// 调用方生成的摘要跟本地生成的摘要不匹配
throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), "签名不匹配,认证失败");
}
if (!validTimeStamp(ts)) {
logger.error("AccessToken已经超时,请求被拒绝");
throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), "AccessToken已经超时,请求被拒绝");
}
}
/**
* 通过APP ID查询对应的秘钥
*
* @param appId
* @return
*/
public String getTokenFromCache(String appId) {
String secret = (String) redisUtils.get(RedisKeys.getExternalAppSecretKey(appId));
if (StringUtils.isBlank(secret)) {
EpmetCommonServiceOpenFeignClient commonService = SpringContextUtils.getBean(EpmetCommonServiceOpenFeignClient.class);
Result<String> result = commonService.getSecret(appId);
if (!result.success()) {
throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), result.getInternalMsg());
}
secret = result.getData();
redisUtils.set(RedisKeys.getExternalAppSecretKey(appId), secret);
}
return secret;
}
}

79
epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java

@ -0,0 +1,79 @@
package com.epmet.auth;
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.utils.Result;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;
/**
* 外部应用认证
*/
@Component
public class ExternalAuthProcessor extends AuthProcessor {
private Logger logger = LoggerFactory.getLogger(getClass());
// 头s
public static final String AUTHORIZATION_TOKEN_HEADER_KEY = "Authorization";
public static final String ACCESS_TOKEN_HEADER_KEY = "AccessToken";
public static final String APP_ID_HEADER_KEY = "appId";
public static final String APP_ID_TIMESTAMP_KEY = "ts";
public static final String APP_ID_CUSTOMER_ID_KEY = "CustomerId";
public static final String APP_ID_AUTY_TYPE_KEY = "AuthType";
// 认证方式
public static final String APP_AUTH_TYPE_JWT = "jwt";
public static final String APP_AUTH_TYPE_MD5 = "md5";
@Autowired
private ExtAppJwtAuthProcessor jwtAuthProcessor;
@Autowired
private ExtAppMD5AuthProcessor md5AuthProcessor;
@Override
public Mono<Void> auth(ServerWebExchange exchange, GatewayFilterChain chain) {
HttpHeaders headers = exchange.getRequest().getHeaders();
String token = headers.getFirst(ACCESS_TOKEN_HEADER_KEY);
String appId = headers.getFirst(APP_ID_HEADER_KEY);
String ts = headers.getFirst(APP_ID_TIMESTAMP_KEY);
String customerId = headers.getFirst(APP_ID_CUSTOMER_ID_KEY);
String authType = headers.getFirst(APP_ID_AUTY_TYPE_KEY);
if (StringUtils.isAnyBlank(token, appId)) {
throw new RenException("请求头中的AccessToken和AppId不能为空");
}
logger.info("外部应用请求认证拦截Aspect执行,appId:{}, token:{}, ts:{}, customerId:{}, authType:{}",
appId, token, ts, customerId, authType);
// 没传authType或者传的jwt都用jwtprocessor处理
try {
if (StringUtils.isBlank(authType) || APP_AUTH_TYPE_JWT.equals(authType)) {
jwtAuthProcessor.auth(appId, token, StringUtils.isNotBlank(ts) ? new Long(ts) : null, exchange);
} else if (APP_AUTH_TYPE_MD5.equals(authType)) {
md5AuthProcessor.auth(appId, token, StringUtils.isNotBlank(ts) ? new Long(ts) : null, exchange);
} else {
throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), "未知的认证类型");
}
} catch (RenException e) {
return response(exchange, new Result<>().error(e.getCode(), e.getMsg()));
} catch (Exception e) {
logger.error("外部应用请求认证发生未知错误:" + ExceptionUtils.getErrorStackTrace(e));
return response(exchange, new Result<>().error("外部应用请求认证发生未知错误"));
}
return chain.filter(exchange);
}
}

175
epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java

@ -0,0 +1,175 @@
package com.epmet.auth;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.BaseTokenDto;
import com.epmet.commons.tools.security.dto.GovTokenDto;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.CpUserDetailRedis;
import com.epmet.commons.tools.utils.Result;
import com.epmet.jwt.JwtTokenUtils;
import io.jsonwebtoken.Claims;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.http.HttpHeaders;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;
/**
* 内部认证处理器
*/
@Component
public class InternalAuthProcessor extends AuthProcessor {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private JwtTokenUtils jwtTokenUtils;
@Autowired
private CpUserDetailRedis cpUserDetailRedis;
@Override
public Mono<Void> auth(ServerWebExchange exchange, GatewayFilterChain chain) {
ServerHttpRequest request = exchange.getRequest();
String requestUri = request.getPath().pathWithinApplication().value();
logger.info("CpAuthGatewayFilterFactory当前requestUri=[" + requestUri + "]CpAuthGatewayFilterFactory拦截成功");
String token = getTokenFromRequest(request);
//BaseTokenDto baseTokenDto = StringUtils.isNotBlank(token) ? getBaseTokenDto(token, jwtTokenUtils) : null;
BaseTokenDto baseTokenDto;
if(StringUtils.isNotBlank(token)){
try{
baseTokenDto = getBaseTokenDto(token, jwtTokenUtils);
}catch(RenException e){
return response(exchange,new Result<>().error(e.getCode(),e.getMsg()));
}
}else{
baseTokenDto = null;
}
String customerId = "";
if (baseTokenDto != null) {
if (AppClientConstant.APP_RESI.equals(baseTokenDto.getApp())) {
// 居民端
TokenDto resiTokenDto = getLoginUserInfoByToken(token, jwtTokenUtils, TokenDto.class);
if (resiTokenDto != null) {
customerId = resiTokenDto.getCustomerId();
baseTokenDto = resiTokenDto;
}
} else if (AppClientConstant.APP_GOV.equals(baseTokenDto.getApp())) {
// 政府端
GovTokenDto govTokenDto = getLoginUserInfoByToken(token, jwtTokenUtils, GovTokenDto.class);
if (govTokenDto != null) {
customerId = govTokenDto.getCustomerId();
baseTokenDto = govTokenDto;
}
} else if(AppClientConstant.APP_OPER.equals(baseTokenDto.getApp())){
//运营端
TokenDto resiTokenDto = getLoginUserInfoByToken(token, jwtTokenUtils, TokenDto.class);
if (resiTokenDto != null) {
customerId = resiTokenDto.getCustomerId();
baseTokenDto = resiTokenDto;
}
}
}
// 校验token
if (StringUtils.isBlank(token)) {
return response(exchange,new Result<>().error(EpmetErrorCode.ERR10005.getCode(),EpmetErrorCode.ERR10005.getMsg()));
}
try {
validateTokenDto(baseTokenDto, token);
} catch (RenException e) {
return response(exchange,new Result<>().error(e.getCode(),e.getMsg()));
}
// 添加header
if (baseTokenDto != null) {
String redisKey = baseTokenDto.getApp() + "-" + baseTokenDto.getClient() + "-" + baseTokenDto.getUserId();
logger.info("redisKey=" + redisKey);
exchange.getRequest().mutate()
.header(Constant.APP_USER_KEY, redisKey)
.header(AppClientConstant.APP,baseTokenDto.getApp())
.header(AppClientConstant.CLIENT,baseTokenDto.getClient())
.header(AppClientConstant.USER_ID,baseTokenDto.getUserId());
if (StringUtils.equals(baseTokenDto.getApp(), "gov")) {//工作端
if(StringUtils.isNotBlank(customerId)){
exchange.getRequest().mutate().header(AppClientConstant.CUSTOMER_ID, customerId);
}
} else if (StringUtils.equals(baseTokenDto.getApp(), "public")) {//公众号端
exchange.getRequest().mutate().header(AppClientConstant.CUSTOMER_ID, customerId);
}
ServerHttpRequest build = exchange.getRequest().mutate().build();
return chain.filter(exchange.mutate().request(build).build());
}
return chain.filter(exchange);
}
/**
* 从请求中获取token
* @param request
* @return
*/
private String getTokenFromRequest(ServerHttpRequest request) {
HttpHeaders headers = request.getHeaders();
String token = headers.getFirst(Constant.AUTHORIZATION_HEADER);
if (StringUtils.isBlank(token)) {
token = headers.getFirst(Constant.TOKEN_HEADER);
}
if (StringUtils.isBlank(token)) {
token = request.getQueryParams().getFirst(Constant.AUTHORIZATION_HEADER);
}
return token;
}
private BaseTokenDto getBaseTokenDto(String token, JwtTokenUtils jwtTokenUtils) {
//是否过期
Claims claims = jwtTokenUtils.getClaimByToken(token);
if (claims == null || jwtTokenUtils.isTokenExpired(claims.getExpiration())) {
return null;
}
//获取用户ID
String app = (String) claims.get("app");
String client = (String) claims.get("client");
String userId = (String) claims.get("userId");
return new BaseTokenDto(app, client, userId, token);
}
private <T> T getLoginUserInfoByToken(String token, JwtTokenUtils jwtTokenUtils, Class<T> clz) {
BaseTokenDto baseTokenDto = getBaseTokenDto(token, jwtTokenUtils);
//查询Redis
return cpUserDetailRedis.get(baseTokenDto.getApp(), baseTokenDto.getClient(), baseTokenDto.getUserId(), clz);
}
/**
* 校验Token是否异常
* @param tokenDto
* @param tokenStr
*/
private void validateTokenDto(BaseTokenDto tokenDto, String tokenStr) {
if (null == tokenDto) {
//说明登录状态时效(超时)
throw new RenException(EpmetErrorCode.ERR10006.getCode());
}else{
//Redis中存在数据,取出token,进行比对
if(StringUtils.equals(tokenDto.getToken(),tokenStr)){
//用户携带token与Redis中一致
}else{
//用户携带token与Redis中不一致,说明当前用户此次会话失效,提示重新登陆
throw new RenException(EpmetErrorCode.ERR10007.getCode());
}
}
}
}

275
epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java

@ -2,16 +2,12 @@
package com.epmet.filter;
import com.alibaba.fastjson.JSON;
import com.epmet.auth.ExternalAuthProcessor;
import com.epmet.auth.InternalAuthProcessor;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.BaseTokenDto;
import com.epmet.commons.tools.security.dto.GovTokenDto;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.CpUserDetailRedis;
import com.epmet.commons.tools.utils.Result;
import com.epmet.jwt.JwtTokenUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -40,16 +36,25 @@ import java.util.List;
* @since 1.0.0
*/
@Component("CpAuth")
public class CpAuthGatewayFilterFactory extends AbstractGatewayFilterFactory<CpAuthGatewayFilterFactory.CpAuthConfig> implements UserTokenFilter {
public class CpAuthGatewayFilterFactory extends AbstractGatewayFilterFactory<CpAuthGatewayFilterFactory.CpAuthConfig> {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private CpProperty cpProperty;
private final AntPathMatcher antPathMatcher = new AntPathMatcher();
public static final String AUTH_TYPE_INTERNAL = "internal";
public static final String AUTH_TYPE_EXTERNAL = "external";
public static final String AUTH_TYPE_NO_NEED = "no_need";
public static final String AUTH_TYPE_UNKNOW = "unknow";
@Autowired
private JwtTokenUtils jwtTokenUtils;
private CpProperty cpProperty;
@Autowired
private CpUserDetailRedis cpUserDetailRedis;
private InternalAuthProcessor internalAuthProcessor;
@Autowired
private ExternalAuthProcessor externalAuthProcessor;
@Override
public List<String> shortcutFieldOrder() {
@ -67,82 +72,23 @@ public class CpAuthGatewayFilterFactory extends AbstractGatewayFilterFactory<CpA
return chain.filter(exchange);
}
ServerHttpRequest request = exchange.getRequest();
String requestUri = request.getPath().pathWithinApplication().value();
logger.info("CpAuthGatewayFilterFactory当前requestUri=[" + requestUri + "]CpAuthGatewayFilterFactory拦截成功");
String token = getTokenFromRequest(request);
//BaseTokenDto baseTokenDto = StringUtils.isNotBlank(token) ? getBaseTokenDto(token, jwtTokenUtils) : null;
BaseTokenDto baseTokenDto;
if(StringUtils.isNotBlank(token)){
try{
baseTokenDto = getBaseTokenDto(token, jwtTokenUtils);
}catch(RenException e){
return response(exchange,new Result<>().error(e.getCode(),e.getMsg()));
}
}else{
baseTokenDto = null;
}
String customerId = "";
if (baseTokenDto != null) {
if (AppClientConstant.APP_RESI.equals(baseTokenDto.getApp())) {
// 居民端
TokenDto resiTokenDto = getLoginUserInfoByToken(token, jwtTokenUtils, cpUserDetailRedis, TokenDto.class);
if (resiTokenDto != null) {
customerId = resiTokenDto.getCustomerId();
baseTokenDto = resiTokenDto;
}
} else if (AppClientConstant.APP_GOV.equals(baseTokenDto.getApp())) {
// 政府端
GovTokenDto govTokenDto = getLoginUserInfoByToken(token, jwtTokenUtils, cpUserDetailRedis, GovTokenDto.class);
if (govTokenDto != null) {
customerId = govTokenDto.getCustomerId();
baseTokenDto = govTokenDto;
}
} else if(AppClientConstant.APP_OPER.equals(baseTokenDto.getApp())){
//运营端
TokenDto resiTokenDto = getLoginUserInfoByToken(token, jwtTokenUtils, cpUserDetailRedis, TokenDto.class);
if (resiTokenDto != null) {
customerId = resiTokenDto.getCustomerId();
baseTokenDto = resiTokenDto;
}
}
}
//需要认证
if (needAuth(requestUri)) {
if (StringUtils.isBlank(token)) {
return response(exchange,new Result<>().error(EpmetErrorCode.ERR10005.getCode(),EpmetErrorCode.ERR10005.getMsg()));
}
// 校验token
try {
validateTokenDto(baseTokenDto, token);
} catch (RenException e) {
return response(exchange,new Result<>().error(e.getCode(),e.getMsg()));
}
}
//添加流水号
exchange.getRequest().mutate().header(AppClientConstant.TRANSACTION_SERIAL_KEY, new String[]{getTransactionSerial()});
if (baseTokenDto != null) {
String redisKey = baseTokenDto.getApp() + "-" + baseTokenDto.getClient() + "-" + baseTokenDto.getUserId();
logger.info("redisKey=" + redisKey);
exchange.getRequest().mutate()
.header(Constant.APP_USER_KEY, redisKey)
.header(AppClientConstant.APP,baseTokenDto.getApp())
.header(AppClientConstant.CLIENT,baseTokenDto.getClient())
.header(AppClientConstant.USER_ID,baseTokenDto.getUserId())
;
if (StringUtils.equals(baseTokenDto.getApp(), "gov")) {//工作端
if(StringUtils.isNotBlank(customerId)){
exchange.getRequest().mutate().header(AppClientConstant.CUSTOMER_ID, customerId);
}
} else if (StringUtils.equals(baseTokenDto.getApp(), "public")) {//公众号端
exchange.getRequest().mutate().header(AppClientConstant.CUSTOMER_ID, customerId);
}
ServerHttpRequest build = exchange.getRequest().mutate().build();
return chain.filter(exchange.mutate().request(build).build());
ServerHttpRequest request = exchange.getRequest();
String authType = getAuthType(request);
switch (authType) {
case AUTH_TYPE_EXTERNAL:
return externalAuthProcessor.auth(exchange, chain);
case AUTH_TYPE_INTERNAL:
return internalAuthProcessor.auth(exchange, chain);
case AUTH_TYPE_NO_NEED:
break;
default:
return response(exchange, new Result<>().error(EpmetErrorCode.ERR401.getCode(),
EpmetErrorCode.ERR401.getMsg()));
}
return chain.filter(exchange);
@ -150,85 +96,71 @@ public class CpAuthGatewayFilterFactory extends AbstractGatewayFilterFactory<CpA
}
/**
* 获取事务流水号
* 判断需要执行的认证方式(内部应用认证还是外部应用认证)
* @return
*/
public static String getTransactionSerial() {
String[] letterPool = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n"
, "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};
private String getAuthType(ServerHttpRequest request) {
String requestUri = request.getPath().pathWithinApplication().value();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 2; i++) {
sb.append(letterPool[(int) (Math.random() * 25)]);
boolean existsInInternal = false;
boolean existsInExternal = false;
for (String url : cpProperty.getInternalAuthUrls()) {
if (antPathMatcher.match(url, requestUri)) {
existsInInternal = true;
}
}
sb.append(System.currentTimeMillis());
return sb.toString();
for (String url : cpProperty.getExternalAuthUrls()) {
if (antPathMatcher.match(url, requestUri)) {
existsInExternal = true;
}
}
if (!existsInInternal && !existsInExternal) {
// 既不再内部认证url,也不在外部认证url,那么不需要认证
return AUTH_TYPE_NO_NEED;
}
// 内部认证
if (StringUtils.isNotBlank(getHeader(request, Constant.AUTHORIZATION_HEADER))
&& existsInInternal) {
return AUTH_TYPE_INTERNAL;
}
if (StringUtils.isNotBlank(getHeader(request, Constant.ACCESS_TOKEN_HEADER))
&& existsInExternal) {
return AUTH_TYPE_EXTERNAL;
}
return AUTH_TYPE_UNKNOW;
}
//public TokenDto getLoginUserInfo(String token) {
// //是否过期
// Claims claims = jwtTokenUtils.getClaimByToken(token);
// if (claims == null || jwtTokenUtils.isTokenExpired(claims.getExpiration())) {
// throw new RenException(ErrorCode.ERR401.getCode(),ErrorCode.ERR401.getMsg());
// }
// //获取用户ID
// String app = (String) claims.get("app");
// String client = (String) claims.get("client");
// String userId = (String) claims.get("userId");
// //查询Redis
// TokenDto tokenDto = cpUserDetailRedis.get(app, client, userId);
// if (null == tokenDto) {
// //说明登录状态时效(超时)
// throw new RenException(ErrorCode.ERR10006.getCode(),ErrorCode.ERR10006.getMsg());
// }else{
// //Redis中存在数据,取出token,进行比对
// if(StringUtils.equals(tokenDto.getToken(),token)){
// //用户携带token与Redis中一致
//
// }else{
// //用户携带token与Redis中不一致,说明当前用户此次会话失效,提示重新登陆
// throw new RenException(ErrorCode.ERR10007.getCode(),ErrorCode.ERR10007.getMsg());
// }
//
// }
//
// return tokenDto;
//}
private Mono<Void> response(ServerWebExchange exchange, Object object) {
String json = JSON.toJSONString(object);
DataBuffer buffer = exchange.getResponse().bufferFactory().wrap(json.getBytes(StandardCharsets.UTF_8));
exchange.getResponse().getHeaders().setContentType(MediaType.APPLICATION_JSON_UTF8);
exchange.getResponse().setStatusCode(HttpStatus.OK);
return exchange.getResponse().writeWith(Flux.just(buffer));
/**
* 获取请求头
* @param request
* @return
*/
private String getHeader(ServerHttpRequest request, String headerName) {
HttpHeaders headers = request.getHeaders();
return headers.getFirst(headerName);
}
/**
* 是否需要认证
* @param requestUri
* 获取事务流水号
* @return
*/
private boolean needAuth(String requestUri) {
// 优先判断白名单,在白名单中的就直接放行
for (String url : cpProperty.getUrlWhiteList()) {
if (antPathMatcher.match(url, requestUri)) {
return false;
}
}
public static String getTransactionSerial() {
String[] letterPool = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n"
, "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};
for (String url : cpProperty.getSwaggerUrls()) {
if (antPathMatcher.match(url, requestUri)) {
return false;
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 2; i++) {
sb.append(letterPool[(int) (Math.random() * 25)]);
}
for (String url : cpProperty.getUrls()) {
if (antPathMatcher.match(url, requestUri)) {
return true;
}
}
return false;
sb.append(System.currentTimeMillis());
return sb.toString();
}
public static class CpAuthConfig {
@ -250,45 +182,12 @@ public class CpAuthGatewayFilterFactory extends AbstractGatewayFilterFactory<CpA
}
}
/**
* 校验Token是否异常
* @param tokenDto
* @param tokenStr
*/
public void validateTokenDto(BaseTokenDto tokenDto, String tokenStr) {
if (null == tokenDto) {
//说明登录状态时效(超时)
throw new RenException(EpmetErrorCode.ERR10006.getCode());
}else{
//Redis中存在数据,取出token,进行比对
if(StringUtils.equals(tokenDto.getToken(),tokenStr)){
//用户携带token与Redis中一致
}else{
//用户携带token与Redis中不一致,说明当前用户此次会话失效,提示重新登陆
throw new RenException(EpmetErrorCode.ERR10007.getCode());
}
}
protected Mono<Void> response(ServerWebExchange exchange, Object object) {
String json = JSON.toJSONString(object);
DataBuffer buffer = exchange.getResponse().bufferFactory().wrap(json.getBytes(StandardCharsets.UTF_8));
exchange.getResponse().getHeaders().setContentType(MediaType.APPLICATION_JSON_UTF8);
exchange.getResponse().setStatusCode(HttpStatus.OK);
return exchange.getResponse().writeWith(Flux.just(buffer));
}
/**
* 从请求中获取token
* @param request
* @return
*/
private String getTokenFromRequest(ServerHttpRequest request) {
HttpHeaders headers = request.getHeaders();
String token = headers.getFirst(Constant.AUTHORIZATION_HEADER);
if (StringUtils.isBlank(token)) {
token = headers.getFirst(Constant.TOKEN_HEADER);
logger.info("token=" + token);
} else {
logger.info("authorization=" + token);
}
if (StringUtils.isBlank(token)) {
token = request.getQueryParams().getFirst(Constant.AUTHORIZATION_HEADER);
logger.info("params token:" + token);
}
return token;
}
}

9
epmet-gateway/src/main/java/com/epmet/filter/CpProperty.java

@ -17,12 +17,15 @@ import java.util.List;
@ConfigurationProperties(prefix = "epmet")
public class CpProperty {
private List<String> urls;
/**
* 需要内部认证的url
*/
private List<String> internalAuthUrls;
/**
* 白名单
* 需要外部认证的url
*/
private List<String> urlWhiteList;
private List<String> externalAuthUrls;
/**
* 不处理token直接通过

35
epmet-gateway/src/main/java/com/epmet/filter/UserTokenFilter.java

@ -1,35 +0,0 @@
package com.epmet.filter;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.BaseTokenDto;
import com.epmet.commons.tools.utils.CpUserDetailRedis;
import com.epmet.jwt.JwtTokenUtils;
import io.jsonwebtoken.Claims;
/**
* 用户token的过滤器接口提供通用的默认方法
*/
public interface UserTokenFilter {
default BaseTokenDto getBaseTokenDto(String token, JwtTokenUtils jwtTokenUtils) {
//是否过期
Claims claims = jwtTokenUtils.getClaimByToken(token);
if (claims == null || jwtTokenUtils.isTokenExpired(claims.getExpiration())) {
// throw new RenException(EpmetErrorCode.ERR401.getCode());
return null;
}
//获取用户ID
String app = (String) claims.get("app");
String client = (String) claims.get("client");
String userId = (String) claims.get("userId");
return new BaseTokenDto(app, client, userId, token);
}
default <T> T getLoginUserInfoByToken(String token, JwtTokenUtils jwtTokenUtils, CpUserDetailRedis cpUserDetailRedis, Class<T> clz) {
BaseTokenDto baseTokenDto = getBaseTokenDto(token, jwtTokenUtils);
//查询Redis
return cpUserDetailRedis.get(baseTokenDto.getApp(), baseTokenDto.getClient(), baseTokenDto.getUserId(), clz);
}
}

12
epmet-gateway/src/main/java/com/epmet/jwt/JwtTokenUtils.java

@ -62,6 +62,18 @@ public class JwtTokenUtils {
}
}
public Claims getClaimByToken(String token, String secret) {
try {
return Jwts.parser()
.setSigningKey(secret)
.parseClaimsJws(token)
.getBody();
} catch (Exception e) {
logger.debug("validate is token error, token = " + token, e);
return null;
}
}
/**
* @return java.util.Date
* @param token

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

@ -415,8 +415,8 @@ ribbon:
ConnectTimeout: 300000
epmet:
# 党群e事通(校验是否登录)
urls:
# 内部认证,需要Authorization请求头
internalAuthUrls:
- /oper/customize/**
- /oper/crm/**
- /epmetuser/**
@ -438,11 +438,10 @@ epmet:
- /resi/home/**
- /data/report/**
# url认证白名单,先判断白名单,在白名单中的url直接放行,不再判断上述需要认证的名单
urlWhiteList:
- /data/report/test/test
- /data/report/screen/**
- /data/report/kcscreen/**
# 外部应用认证,使用AccessToken等头进行认证
externalAuthUrls:
- /data/report/**
- /data/stats/**
- /epmetuser/customerstaff/customerlist
swaggerUrls:

18
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityIndexFormDTO.java

@ -3,7 +3,6 @@ package com.epmet.evaluationindex.screen.dto.form;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
@ -14,21 +13,30 @@ import java.io.Serializable;
@Data
public class AblityIndexFormDTO implements Serializable {
private static final long serialVersionUID = -2880432640584616651L;
public interface AddUserInternalGroup {}
/**
* 组织或网格Id
*/
@NotBlank(message = "组织或网格ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class})
private String orgId;
/**
* 组织Id
*/
@NotBlank(message = "客户ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class})
private String customerId;
/**
* 组织Id
* 组织或网格类型
*/
@NotBlank(message = "组织ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class})
private String agencyId;
@NotBlank(message = "组织或网格类型不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class})
private String orgType;
/**
* 查询月份的前12个月对应的monthId
*/
private String startMonthId;
/**
* 月份Id格式202009
*/
@NotBlank(message = "月份ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class})
private String monthId;
public interface AddUserInternalGroup {}
}

15
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityListFormDTO.java

@ -14,15 +14,21 @@ import java.io.Serializable;
public class AblityListFormDTO implements Serializable {
private static final long serialVersionUID = -2880432640584616651L;
/**
* 组织Id
* 客户Id
*/
@NotBlank(message = "客户ID不能为空",groups = {AblityListFormDTO.AddUserInternalGroup.class})
private String customerId;
/**
* 组织Id
* 组织或网格Id
*/
@NotBlank(message = "组织ID不能为空",groups = {AblityListFormDTO.AddUserInternalGroup.class})
private String agencyId;
@NotBlank(message = "组织或网格ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class})
private String orgId;
/**
* 组织或网格类型
*/
@NotBlank(message = "组织或网格类型不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class})
private String orgType;
public interface AddUserInternalGroup {}
/**
* 月份Id格式202009
*/
@ -37,6 +43,5 @@ public class AblityListFormDTO implements Serializable {
* 所有有权重的指标code拼接的字符串 冒号隔开
*/
private String allParentIndexCode;
public interface AddUserInternalGroup {}
}

31
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AdvancedBranchRankFormDTO.java

@ -0,0 +1,31 @@
package com.epmet.evaluationindex.screen.dto.form;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 先进排行-先进支部排行--接口入参
* @Author sun
*/
@Data
public class AdvancedBranchRankFormDTO implements Serializable {
private static final long serialVersionUID = -8674763412362557239L;
/**
* 机关Id
* */
@NotBlank(message = "机关Id不能为空" , groups = AdvancedBranchRankFormDTO.AddUserInternalGroup.class)
private String agencyId;
/**
* 显示多少条
* */
@Min(value = 1, message = "查询条数必须大于0", groups = {AdvancedBranchRankFormDTO.AddUserInternalGroup.class })
private Integer topNum;
/**
* 月份Id
* */
private String monthId;
public interface AddUserInternalGroup {}
}

36
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/IndexScoreFormDTO.java

@ -0,0 +1,36 @@
package com.epmet.evaluationindex.screen.dto.form;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 组织月度指数得分--接口入参
* @Author sun
*/
@Data
public class IndexScoreFormDTO implements Serializable {
private static final long serialVersionUID = -2880432640584616651L;
/**
* 组织或网格Id
*/
@NotBlank(message = "组织或网格ID不能为空",groups = {IndexScoreFormDTO.AddUserInternalGroup.class})
private String orgId;
/**
* 类型组织agency 网格grid
* 大屏接口此字段值为空
*/
//@NotBlank(message = "数据类型不能为空",groups = {IndexScoreFormDTO.AddUserInternalGroup.class})
private String orgType;
/**
* 月份Id eg202009
* 大屏接口此字段值为空
*/
//@NotBlank(message = "月份Id不能为空",groups = {IndexScoreFormDTO.AddUserInternalGroup.class})
private String monthId;
public interface AddUserInternalGroup {}
}

16
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthAblityListFormDTO.java

@ -14,15 +14,21 @@ import java.io.Serializable;
public class MonthAblityListFormDTO implements Serializable {
private static final long serialVersionUID = -2880432640584616651L;
/**
* 组织Id
* 客户Id
*/
@NotBlank(message = "客户ID不能为空",groups = {MonthAblityListFormDTO.AddUserInternalGroup.class})
private String customerId;
/**
* 组织Id
* 组织或网格Id
*/
@NotBlank(message = "组织ID不能为空",groups = {MonthAblityListFormDTO.AddUserInternalGroup.class})
private String agencyId;
@NotBlank(message = "组织或网格ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class})
private String orgId;
/**
* 组织或网格类型
*/
@NotBlank(message = "组织或网格类型不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class})
private String orgType;
public interface AddUserInternalGroup {}
/**
* 月份Id格式202009
*/
@ -37,7 +43,5 @@ public class MonthAblityListFormDTO implements Serializable {
* 查询月份的前12个月对应的monthId
*/
private String startMonthId;
public interface AddUserInternalGroup {}
}

17
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthScoreListFormDTO.java

@ -13,21 +13,30 @@ import java.io.Serializable;
@Data
public class MonthScoreListFormDTO implements Serializable {
private static final long serialVersionUID = -2880432640584616651L;
public interface AddUserInternalGroup {}
/**
* 组织或网格Id
*/
@NotBlank(message = "组织或网格ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class})
private String orgId;
/**
* 组织Id
*/
@NotBlank(message = "客户ID不能为空",groups = {MonthScoreListFormDTO.AddUserInternalGroup.class})
private String customerId;
/**
* 组织Id
* 组织或网格类型
*/
@NotBlank(message = "组织ID不能为空",groups = {MonthScoreListFormDTO.AddUserInternalGroup.class})
private String agencyId;
@NotBlank(message = "组织或网格类型不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class})
private String orgType;
/**
* 月份Id格式202009
*/
@NotBlank(message = "月份ID不能为空",groups = {MonthScoreListFormDTO.AddUserInternalGroup.class})
private String monthId;
public interface AddUserInternalGroup {}
/**
* 查询月份的前12个月对应的monthId
*/
private String startMonthId;
}

35
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/PartIndexScroeRankFormDTO.java

@ -0,0 +1,35 @@
package com.epmet.evaluationindex.screen.dto.form;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 党员指标得分排行--接口入参
* @Author sun
*/
@Data
public class PartIndexScroeRankFormDTO implements Serializable {
private static final long serialVersionUID = -2880432640584616651L;
/**
* 组织或网格Id
*/
@NotBlank(message = "组织或网格ID不能为空",groups = {PartIndexScroeRankFormDTO.AddUserInternalGroup.class})
private String orgId;
/**
* 类型组织agency 网格grid
*/
@NotBlank(message = "数据类型不能为空",groups = {PartIndexScroeRankFormDTO.AddUserInternalGroup.class})
private String orgType;
/**
* 默认显示前5名
*/
@Min(value = 1, message = "查询条数必须大于0", groups = {PartIndexScroeRankFormDTO.AddUserInternalGroup.class })
private Integer topNum;
public interface AddUserInternalGroup {}
}

15
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/PeerComparisonFormDTO.java

@ -15,15 +15,21 @@ import java.io.Serializable;
public class PeerComparisonFormDTO implements Serializable {
private static final long serialVersionUID = -2880432640584616651L;
/**
* 组织Id
* 客户Id
*/
@NotBlank(message = "客户ID不能为空",groups = {PeerComparisonFormDTO.AddUserInternalGroup.class})
private String customerId;
/**
* 组织Id
* 组织或网格Id
*/
@NotBlank(message = "组织ID不能为空",groups = {PeerComparisonFormDTO.AddUserInternalGroup.class})
private String agencyId;
@NotBlank(message = "组织或网格ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class})
private String orgId;
/**
* 组织或网格类型
*/
@NotBlank(message = "组织或网格类型不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class})
private String orgType;
public interface AddUserInternalGroup {}
/**
* 类型党建能力dangjiannengli治理能力zhilinengli服务能力fuwunengli
*/
@ -34,6 +40,5 @@ public class PeerComparisonFormDTO implements Serializable {
*/
@Min(value = 1, message = "查询条数必须大于0", groups = {PeerComparisonFormDTO.AddUserInternalGroup.class })
private Integer pageSize;
public interface AddUserInternalGroup {}
}

5
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/RootAgencyFormDTO.java

@ -3,7 +3,6 @@ package com.epmet.evaluationindex.screen.dto.form;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
@ -14,12 +13,12 @@ import java.io.Serializable;
@Data
public class RootAgencyFormDTO implements Serializable {
private static final long serialVersionUID = -2880432640584616651L;
public interface AddUserInternalGroup {}
/**
* 组织Id
*/
@NotBlank(message = "组织ID不能为空",groups = {RootAgencyFormDTO.AddUserInternalGroup.class})
private String agencyId;
public interface AddUserInternalGroup {}
}

18
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ScoreListFormDTO.java

@ -13,26 +13,26 @@ import java.io.Serializable;
@Data
public class ScoreListFormDTO implements Serializable {
private static final long serialVersionUID = -2880432640584616651L;
public interface AddUserInternalGroup {}
/**
* 组织或网格Id
*/
@NotBlank(message = "组织或网格ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class})
private String orgId;
/**
* 组织Id
*/
@NotBlank(message = "客户ID不能为空",groups = {ScoreListFormDTO.AddUserInternalGroup.class})
private String customerId;
/**
* 组织Id
* 组织或网格类型
*/
@NotBlank(message = "组织ID不能为空",groups = {ScoreListFormDTO.AddUserInternalGroup.class})
private String agencyId;
@NotBlank(message = "组织或网格类型不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class})
private String orgType;
/**
* 月份Id格式202009
*/
@NotBlank(message = "月份ID不能为空",groups = {ScoreListFormDTO.AddUserInternalGroup.class})
private String monthId;
/**
* 类型党建能力dangjiannengli治理能力zhilinengli服务能力fuwunengli
*/
private String indexCode;
public interface AddUserInternalGroup {}
}

22
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AnNingSubAgencyIndexRankFormDTO.java → epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankYMFormDTO.java

@ -8,20 +8,22 @@ import java.io.Serializable;
/**
* 5下级部门指数排行安宁数据段用 入参
*
* @Author zhangyong
* @DateTime 2020/09/08 9:54
*/
@Data
public class AnNingSubAgencyIndexRankFormDTO implements Serializable {
public class SubAgencyIndexRankYMFormDTO implements Serializable {
private static final long serialVersionUID = -2920561669035794486L;
public interface SubAgencyIndexRank{}
public interface SubAgencyIndexRank {
}
/**
* 机关ID
*/
@NotBlank(message = "组织id不能为空",groups = {SubAgencyIndexRank.class})
@NotBlank(message = "组织id不能为空", groups = {SubAgencyIndexRank.class})
private String agencyId;
/**
@ -33,12 +35,22 @@ public class AnNingSubAgencyIndexRankFormDTO implements Serializable {
/**
* asc 正序 desc 降序
*/
@NotNull(message = "排序方式不能为空",groups = {SubAgencyIndexRank.class})
@NotNull(message = "排序方式不能为空", groups = {SubAgencyIndexRank.class})
private String sort;
/**
* 年度year 月度month
*/
@NotNull(message = "年度、月度不能为空",groups = {SubAgencyIndexRank.class})
@NotNull(message = "年度、月度不能为空", groups = {SubAgencyIndexRank.class})
private String type;
/**
* 月份Id
*/
private String monthId;
/**
* 组织类型 组织agency 网格grid
*/
private String orgType;
}

35
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/UserPointRankFormDTO.java

@ -0,0 +1,35 @@
package com.epmet.evaluationindex.screen.dto.form;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 热心市民积分排行列表--接口入参
* @Author sun
*/
@Data
public class UserPointRankFormDTO implements Serializable {
private static final long serialVersionUID = -2880432640584616651L;
/**
* 组织或网格Id
*/
@NotBlank(message = "组织或网格ID不能为空",groups = {UserPointRankFormDTO.AddUserInternalGroup.class})
private String orgId;
/**
* 类型组织agency 网格grid
*/
@NotBlank(message = "数据类型不能为空",groups = {UserPointRankFormDTO.AddUserInternalGroup.class})
private String orgType;
/**
* 默认显示前5名
*/
@Min(value = 1, message = "查询条数必须大于0", groups = {UserPointRankFormDTO.AddUserInternalGroup.class })
private Integer topNum;
public interface AddUserInternalGroup {}
}

18
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityIndexResultDTO.java

@ -1,5 +1,6 @@
package com.epmet.evaluationindex.screen.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
@ -29,23 +30,16 @@ public class AblityIndexResultDTO implements Serializable {
* 能力总分
*/
private Double indexTotal;
/**
* 本级能力分
*/
private Double agencyScore;
/**
* 下级能力分
*/
private Double subAgencyScore;
/**
* 横坐标202009
*/
private String monthId;
/**
* 能力类型 党建能力dangjiannengli治理能力zhilinengli服务能力fuwunengli
*/
@JsonIgnore
private String indexCode;
}
}

4
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java

@ -25,5 +25,9 @@ public class AblityListResultDTO implements Serializable {
* 各项指标对应key值(index_dict字典表)
*/
private String key;
/**
* 指标值类型 none整数integer小数: decimal;百分比percent
*/
private String showType;
}

5
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AnNingSubAgencyIndexRankResultDTO.java

@ -42,4 +42,9 @@ public class AnNingSubAgencyIndexRankResultDTO implements Serializable {
* 组织id或者网格id
*/
private String orgId = "";
/**
* 组织类型
*/
private String orgType = "";
}

53
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexAdvanceBranchRankResultDTO.java

@ -0,0 +1,53 @@
package com.epmet.evaluationindex.screen.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 先进排行-先进支部排行--接口返参
*
* @Author sun
*/
@Data
public class IndexAdvanceBranchRankResultDTO implements Serializable {
private static final long serialVersionUID = 330099297596334388L;
/**
* 名称 XXXX社区党委
*/
private String name;
/**
* 指标得分
*/
@JsonIgnore
private String totalScore;
private BigDecimal scroe;
/**
* 党员数
*/
private Integer partyMemberNum;
/**
* 议题数
*/
private Integer issueNum;
/**
* 项目数
*/
private Integer projectNum;
/**
* 满意度 90.64% 返回字符串前端直接显示
*/
private String satisfactionRatio;
/**
* 结案率 94.3% 返回字符串前端直接显示
*/
private String closedProjectRatio;
}

30
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexDictResultDTO.java

@ -0,0 +1,30 @@
package com.epmet.evaluationindex.screen.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 评价指标字典表数据--接口返参
* @Author sun
*/
@Data
public class IndexDictResultDTO implements Serializable {
private static final long serialVersionUID = 3860268744336541373L;
/**
* 指标名
*/
private String indexName;
/**
* 指标code
*/
private String indexCode;
/**
* 指标值类型 百分比percent
*/
private String valueType;
}

55
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexScoreResultDTO.java

@ -0,0 +1,55 @@
package com.epmet.evaluationindex.screen.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 组织月度指数得分--接口返参
* @Author sun
*/
@Data
public class IndexScoreResultDTO implements Serializable {
private static final long serialVersionUID = 3860268744336541373L;
/**
* 年度平均指数(保留一位小数)
*/
@JsonIgnore
private String total;
private BigDecimal totalScore;
/**
* 党建能力(保留一位小数)
*/
@JsonIgnore
private String party;
private BigDecimal partyDevAbility;
/**
* 党建能力权重(保留一位小数)
*/
private String partyDevAbilityWeight;
/**
* 治理能力(保留一位小数)
*/
@JsonIgnore
private String govern;
private BigDecimal governAbility;
/**
* 治理能力权重(保留一位小数)
*/
private String governAbilityWeight;
/**
* 服务能力(保留一位小数)
*/
@JsonIgnore
private String service;
private BigDecimal serviceAbility;
/**
* 服务能力权重(保留一位小数)
*/
private String serviceAbilityWeight;
}

6
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthScoreListResultDTO.java

@ -1,5 +1,6 @@
package com.epmet.evaluationindex.screen.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
@ -41,6 +42,11 @@ public class MonthScoreListResultDTO implements Serializable {
* 横坐标202009
*/
private String monthId;
/**
* 类型党建能力dangjiannengli治理能力zhilinengli服务能力fuwunengli
*/
@JsonIgnore
private String indexCode;
}

45
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PartIndexScroeRankResultDTO.java

@ -0,0 +1,45 @@
package com.epmet.evaluationindex.screen.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* 党员指标得分排行--接口返参
* @Author sun
*/
@Data
public class PartIndexScroeRankResultDTO implements Serializable {
private static final long serialVersionUID = 3860268744336541373L;
/**
* 组织ID
*/
private String agencyId;
/**
* 组织名称
*/
private String agencyName;
/**
* 用户Id
*/
private String userId;
/**
* 用户名称
*/
private String userName;
/**
* 网格Id
*/
private String gridId;
/**
* 网格名称
*/
private String gridName;
/**
* 党员指标得分
*/
private Double indexScore;
}

8
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PeerComparisonResultDTO.java

@ -14,13 +14,13 @@ public class PeerComparisonResultDTO implements Serializable {
private static final long serialVersionUID = 3860268744336541373L;
/**
* 组织Id
* 组织或网格Id
*/
private String agencyId;
private String orgId;
/**
* 组织名称
* 组织或网格名称
*/
private String agencyName;
private String orgName;
/**
* 能力分值(保留一位小数)
*/

10
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PublicPartiProfileResultDTO.java

@ -4,6 +4,7 @@ import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Description 3公众参与概况返参DTO
@ -33,14 +34,17 @@ public class PublicPartiProfileResultDTO implements Serializable {
/**
* 较上月趋势incr上升decr下降
* */
*/
private String issueCompareLatestTrend = "";
/**
* 平均参与度
* */
private Integer averageJoin = NumConstant.ZERO;
*/
private BigDecimal averageJoin = new BigDecimal(NumConstant.ZERO);
/**
* 较上月百分比
*/
private String joinCompareLatestMonth = "";
private String joinCompareLatestTrend = "";

4
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/UserJoinIndicatorGrowthRateResultDTO.java

@ -38,8 +38,8 @@ public class UserJoinIndicatorGrowthRateResultDTO implements Serializable {
/**
* 平均参与度
* */
private Integer averageJoin;
*/
private BigDecimal averageJoin;
private BigDecimal joinCompareLatestMonth;

46
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/UserPointRankListResultDTO.java

@ -0,0 +1,46 @@
package com.epmet.evaluationindex.screen.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 热心市民积分排行列表--接口返参
* @Author sun
*/
@Data
public class UserPointRankListResultDTO implements Serializable {
private static final long serialVersionUID = 3860268744336541373L;
/**
* 组织ID
*/
private String agencyId;
/**
* 组织名称
*/
private String agencyName;
/**
* 用户Id
*/
private String userId;
/**
* 用户名称
*/
private String userName;
/**
* 网格Id
*/
private String gridId;
/**
* 网格名称
*/
private String gridName;
/**
* 用户积分
*/
private Integer pointTotal;
}

4
epmet-module/data-report/data-report-server/pom.xml

@ -62,11 +62,11 @@
<version>0.3.1</version>
</dependency>
<dependency>
<!--<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-extapp-auth</artifactId>
<version>2.0.0</version>
</dependency>
</dependency>-->
<!--动态数据源-->
<dependency>
<groupId>com.epmet</groupId>

28
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/FactConstant.java

@ -5,6 +5,14 @@ package com.epmet.datareport.constant;
* @dscription 数据
*/
public interface FactConstant {
/**
* 组织类型
*/
String AGENCY = "agency";
/**
* 网格类型
*/
String GRID = "grid";
/**
* 能力指标
*/
@ -33,4 +41,24 @@ public interface FactConstant {
* 社区相关
*/
String SHE_QU_XIANG_GUAN = "shequxiangguan";
/**
* 网格相关
*/
String WANG_GE_XIANG_GUAN = "wanggexiangguan";
/**
* 评价指标类型-
*/
String NONE = "none";
/**
* 评价指标类型-整数
*/
String INTEGER = "integer";
/**
* 评价指标类型-小数
*/
String DECIMAL = "decimal";
/**
* 评价指标类型-百分比
*/
String PERCENT = "percent";
}

43
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/fact/FactIndexController.java

@ -17,6 +17,7 @@ import java.util.List;
/**
* 数据改版api
*
* @author sun
*/
@RestController
@ -27,78 +28,78 @@ public class FactIndexController {
private FactIndexService factIndexService;
/**
* @param tokenDTO
* @Description 能力指数
* @param formDTO
* @Description 能力指数
* @author sun
*/
@PostMapping("index/ablityindex")
public Result<List<AblityIndexResultDTO>> ablityIndex(@LoginUser TokenDto tokenDTO, @RequestBody AblityIndexFormDTO formDTO){
public Result<List<AblityIndexResultDTO>> ablityIndex(@RequestBody AblityIndexFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, AblityIndexFormDTO.AddUserInternalGroup.class);
return new Result<List<AblityIndexResultDTO>>().ok(factIndexService.ablityIndex(formDTO));
}
/**
* @param tokenDTO
* @Description 按月份查询各项能力分数
* @param formDTO
* @Description 按月份查询各项能力分数
* @author sun
*/
@PostMapping("index/scorelist")
public Result<List<ScoreListResultDTO>> scoreList(@LoginUser TokenDto tokenDTO, @RequestBody ScoreListFormDTO formDTO){
public Result<List<ScoreListResultDTO>> scoreList(@RequestBody ScoreListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, ScoreListFormDTO.AddUserInternalGroup.class);
return new Result<List<ScoreListResultDTO>>().ok(factIndexService.scoreList(formDTO));
}
/**
* @param tokenDTO
* @Description 按月份查询各项能力最近12个月得分
* @param formDTO
* @Description 按月份查询各项能力最近12个月得分
* @author sun
*/
@PostMapping("index/monthscorelist")
public Result<List<MonthScoreListResultDTO>> monthScoreList(@LoginUser TokenDto tokenDTO, @RequestBody MonthScoreListFormDTO formDTO){
public Result<List<MonthScoreListResultDTO>> monthScoreList(@RequestBody MonthScoreListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, MonthScoreListFormDTO.AddUserInternalGroup.class);
return new Result<List<MonthScoreListResultDTO>>().ok(factIndexService.monthScoreList(formDTO));
}
/**
* @param tokenDTO
* @Description 按月查询各项指标数据
* @param formDTO
* @Description 按月查询各项指标数据
* @author sun
*/
@PostMapping("index/ablitylist")
public Result<List<AblityListResultDTO>> ablityList(@LoginUser TokenDto tokenDTO, @RequestBody AblityListFormDTO formDTO){
public Result<List<AblityListResultDTO>> ablityList(@RequestBody AblityListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, AblityListFormDTO.AddUserInternalGroup.class);
return new Result<List<AblityListResultDTO>>().ok(factIndexService.ablityList(formDTO));
}
/**
* @param tokenDTO
* @Description 按月查询各项指标最近12个月数据
* @param formDTO
* @Description 按月查询各项指标最近12个月数据
* @author sun
*/
@PostMapping("index/monthablitylist")
public Result<List<MonthAblityListResultDTO>> monthAblityList(@LoginUser TokenDto tokenDTO, @RequestBody MonthAblityListFormDTO formDTO){
public Result<List<MonthAblityListResultDTO>> monthAblityList(@RequestBody MonthAblityListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, MonthAblityListFormDTO.AddUserInternalGroup.class);
return new Result<List<MonthAblityListResultDTO>>().ok(factIndexService.monthAblityList(formDTO));
}
/**
* @param tokenDTO
* @Description 同级对比各项数据查询
* @param formDTO
* @Description 同级对比各项数据查询
* @author sun
*/
@PostMapping("index/peercomparison")
public Result<List<PeerComparisonResultDTO>> peerComparison(@LoginUser TokenDto tokenDTO, @RequestBody PeerComparisonFormDTO formDTO){
public Result<List<PeerComparisonResultDTO>> peerComparison(@RequestBody PeerComparisonFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, PeerComparisonFormDTO.AddUserInternalGroup.class);
return new Result<List<PeerComparisonResultDTO>>().ok(factIndexService.peerComparison(formDTO));
}
/**
* @param tokenDTO
* @Description 是否根组织
* @param formDTO
* @Description 是否根组织
* @author sun
*/
@PostMapping("index/rootagency")
public Result<RootAgencyResultDTO> rootAgency(@LoginUser TokenDto tokenDTO, @RequestBody RootAgencyFormDTO formDTO){
public Result<RootAgencyResultDTO> rootAgency(@RequestBody RootAgencyFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, RootAgencyFormDTO.AddUserInternalGroup.class);
return new Result<RootAgencyResultDTO>().ok(factIndexService.rootAgency(formDTO));
}

22
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java

@ -1,21 +1,13 @@
package com.epmet.datareport.controller.screen;
import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth;
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.evaluationindex.screen.AgencyService;
import com.epmet.evaluationindex.screen.dto.form.CompartmentFormDTO;
import com.epmet.evaluationindex.screen.dto.result.CompartmentResultDTO;
import com.epmet.evaluationindex.screen.dto.result.TreeResultDTO;
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 javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
/**
* 组织相关api
@ -31,19 +23,14 @@ public class AgencyController {
private AgencyService agencyService;
/**
* @Description 1组织机构树
* @param
* @Description 1组织机构树 只返回 is_display = '1'
* @author zxc
* @date 2020/8/18 2:04 下午
*/
@ExternalAppRequestAuth
@PostMapping("tree")
public Result<TreeResultDTO> tree(HttpServletRequest request, ExternalAppRequestParam externalAppRequestParam){
String customerId = request.getHeader("CustomerId");
if(StringUtils.isBlank(externalAppRequestParam.getCustomerId())){
externalAppRequestParam.setCustomerId(customerId);
}
return new Result<TreeResultDTO>().ok(agencyService.tree(externalAppRequestParam));
public Result<TreeResultDTO> tree(@RequestHeader("CustomerId") String customerId){
return new Result<TreeResultDTO>().ok(agencyService.tree(customerId));
}
/**
@ -52,7 +39,6 @@ public class AgencyController {
* @author zxc
* @date 2020/8/18 2:33 下午
*/
@ExternalAppRequestAuth
@PostMapping("compartment")
public Result<CompartmentResultDTO> compartment(@RequestBody CompartmentFormDTO compartmentFormDTO){
ValidatorUtils.validateEntity(compartmentFormDTO, CompartmentFormDTO.Compartment.class);

6
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/DistributionController.java

@ -1,6 +1,5 @@
package com.epmet.datareport.controller.screen;
import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.evaluationindex.screen.DistributionService;
@ -33,7 +32,6 @@ public class DistributionController {
* @author zxc
* @date 2020/8/18 10:59 上午
*/
@ExternalAppRequestAuth
@PostMapping("branch")
public Result<List<BranchResultDTO>> branch(@RequestBody BranchFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, BranchFormDTO.Branch.class);
@ -46,7 +44,6 @@ public class DistributionController {
* @author zxc
* @date 2020/8/18 11:10 上午
*/
@ExternalAppRequestAuth
@PostMapping("user")
public Result<UserResultDTO> user(@RequestBody UserFormDTO userFormDTO){
ValidatorUtils.validateEntity(userFormDTO, UserFormDTO.User.class);
@ -59,7 +56,6 @@ public class DistributionController {
* @author zxc
* @date 2020/8/18 11:20 上午
*/
@ExternalAppRequestAuth
@PostMapping("parymember")
public Result<ParymemberResultDTO> parymember(@RequestBody ParymemberFormDTO parymemberFormDTO){
ValidatorUtils.validateEntity(parymemberFormDTO, ParymemberFormDTO.Parymember.class);
@ -72,7 +68,6 @@ public class DistributionController {
* @author zxc
* @date 2020/8/19 1:29 下午
*/
@ExternalAppRequestAuth
@PostMapping("project")
public Result<List<ProjectResultDTO>> project(@RequestBody ProjectFormDTO projectFormDTO){
ValidatorUtils.validateEntity(projectFormDTO, ProjectFormDTO.Project.class);
@ -85,7 +80,6 @@ public class DistributionController {
* @author zxc
* @date 2020/8/19 1:52 下午
*/
@ExternalAppRequestAuth
@PostMapping("topprofile")
public Result<TopProfileResultDTO> topProfile(@RequestBody TopProfileFormDTO topProfileFormDTO){
ValidatorUtils.validateEntity(topProfileFormDTO, TopProfileFormDTO.TopProfile.class);

6
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassRootsGovernController.java

@ -1,6 +1,5 @@
package com.epmet.datareport.controller.screen;
import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.evaluationindex.screen.GrassRootsGovernService;
@ -39,7 +38,6 @@ public class GrassRootsGovernController {
* @author wangc
* @date 2020.08.20 11:16
**/
@ExternalAppRequestAuth
@PostMapping("userpointrank")
public Result<UserPointRankResultDTO> userPointRank(@RequestBody AgencyAndNumFormDTO param){
ValidatorUtils.validateEntity(param,AgencyFormDTO.CommonAgencyIdGroup.class);
@ -54,7 +52,6 @@ public class GrassRootsGovernController {
* @author wangc
* @date 2020.08.20 13:55
**/
@ExternalAppRequestAuth
@PostMapping("difficultprojects")
public Result<List<DifficultProjectResultDTO>> difficultProject(@RequestBody AgencyNumTypeParamFormDTO param){
ValidatorUtils.validateEntity(param, AgencyNumTypeParamFormDTO.AgencyNumTypeParamGroup.class);
@ -69,7 +66,6 @@ public class GrassRootsGovernController {
* @author wangc
* @date 2020.08.20 14:37
**/
@ExternalAppRequestAuth
@PostMapping("publicpartiprofile")
public Result<PublicPartiProfileResultDTO> publicPartiProfile(@RequestBody AgencyFormDTO param){
ValidatorUtils.validateEntity(param, AgencyFormDTO.CommonAgencyIdGroup.class);
@ -84,7 +80,6 @@ public class GrassRootsGovernController {
* @author wangc
* @date 2020.08.20 15:32
**/
@ExternalAppRequestAuth
@PostMapping("publicpartirank")
public Result<List<PublicPartiRankResultDTO>> publicPartiRank(@RequestBody AgencyAndNumFormDTO param){
ValidatorUtils.validateEntity(param,AgencyFormDTO.CommonAgencyIdGroup.class);
@ -99,7 +94,6 @@ public class GrassRootsGovernController {
* @author wangc
* @date 2020.08.20 17:46
**/
@ExternalAppRequestAuth
@PostMapping("governcapacityrank")
public Result<List<GovernCapacityRankResultDTO>> governCapacityRank(@RequestBody AgencyAndNumFormDTO param){
ValidatorUtils.validateEntity(param,AgencyFormDTO.CommonAgencyIdGroup.class);

5
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassrootsPartyDevController.java

@ -1,6 +1,5 @@
package com.epmet.datareport.controller.screen;
import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.evaluationindex.screen.GrassrootsPartyDevService;
@ -38,7 +37,6 @@ public class GrassrootsPartyDevController {
* @author wangc
* @date 2020.08.18 16:59
**/
@ExternalAppRequestAuth
@PostMapping("basicinfo")
public Result<PartymemberPercentResultDTO> baseInfo(@RequestBody ParymemberFormDTO param){
ValidatorUtils.validateEntity(param, ParymemberFormDTO.Parymember.class);
@ -53,7 +51,6 @@ public class GrassrootsPartyDevController {
* @author wangc
* @date 2020.08.18 17:54
**/
@ExternalAppRequestAuth
@PostMapping("ageinfo")
public Result<PartymemberAgeDistributionResultDTO> ageInfo(@RequestBody ParymemberFormDTO param){
ValidatorUtils.validateEntity(param, ParymemberFormDTO.Parymember.class);
@ -68,7 +65,6 @@ public class GrassrootsPartyDevController {
* @author wangc
* @date 2020.08.19 11:02
**/
@ExternalAppRequestAuth
@PostMapping("branchbuildtrend")
public Result<BranchBuildTrendResultDTO> branchBuildTrend(@RequestBody BranchBuildTrendFormDTO param){
ValidatorUtils.validateEntity(param, BranchBuildTrendFormDTO.branchBuildTrendGroup.class);
@ -83,7 +79,6 @@ public class GrassrootsPartyDevController {
* @author wangc
* @date 2020.08.19 15:25
**/
@ExternalAppRequestAuth
@PostMapping("branchbuildrank")
public Result<BranchBuildRankResultDTO> branchBuildRank(@RequestBody BranchBuildRankFormDTO param){
ValidatorUtils.validateEntity(param, BranchBuildRankFormDTO.BranchBuildRankGroup.class);

51
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java

@ -1,7 +1,7 @@
package com.epmet.datareport.controller.screen;
import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth;
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.eum.OrgTypeEnum;
@ -9,10 +9,7 @@ import com.epmet.datareport.service.evaluationindex.screen.IndexService;
import com.epmet.evaluationindex.screen.dto.form.*;
import com.epmet.evaluationindex.screen.dto.result.*;
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 org.springframework.web.bind.annotation.*;
import java.util.List;
@ -35,7 +32,6 @@ public class IndexController {
* @author zxc
* @date 2020/8/19 2:53 下午
*/
@ExternalAppRequestAuth
@PostMapping("yearaverageindex")
public Result<YearAverageIndexResultDTO> yearAverageIndex(@RequestBody YearAverageIndexFormDTO yearAverageIndexFormDTO){
ValidatorUtils.validateEntity(yearAverageIndexFormDTO, YearAverageIndexFormDTO.YearAverageIndex.class);
@ -48,7 +44,6 @@ public class IndexController {
* @author zxc
* @date 2020/8/19 3:17 下午
*/
@ExternalAppRequestAuth
@PostMapping("monthindexanalysis/piechart")
public Result<MonthPieChartResultDTO> monthPieChart(@RequestBody MonthPieChartFormDTO monthPieChartFormDTO){
ValidatorUtils.validateEntity(monthPieChartFormDTO, MonthPieChartFormDTO.MonthPieChart.class);
@ -61,7 +56,6 @@ public class IndexController {
* @author zxc
* @date 2020/8/19 5:27 下午
*/
@ExternalAppRequestAuth
@PostMapping("monthindexanalysis/barchart")
public Result<MonthBarchartResultDTO> monthBarchart(@RequestBody MonthBarchartFormDTO monthBarchartFormDTO){
ValidatorUtils.validateEntity(monthBarchartFormDTO, MonthBarchartFormDTO.MonthBarchart.class);
@ -74,7 +68,6 @@ public class IndexController {
* @author zxc
* @date 2020/8/20 10:02 上午
*/
@ExternalAppRequestAuth
@PostMapping("subagencyindexrank")
public Result<List<SubAgencyIndexRankResultDTO>> subAgencyIndexRank(@RequestBody SubAgencyIndexRankFormDTO subAgencyIndexRankFormDTO){
ValidatorUtils.validateEntity(subAgencyIndexRankFormDTO, SubAgencyIndexRankFormDTO.SubAgencyIndexRank.class);
@ -82,17 +75,17 @@ public class IndexController {
}
/**
* 5下级部门指数排行安宁数据段用
* 5下级部门指数排行安宁数据段用
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.evaluationindex.screen.dto.result.AnNingSubAgencyIndexRankResultDTO>>
* @Author zhangyong
* @Date 13:39 2020-09-11
**/
@ExternalAppRequestAuth
@PostMapping("dataclient/subagencyindexrank")
public Result<List<AnNingSubAgencyIndexRankResultDTO>> anNingSubAgencyIndexRank(@RequestBody AnNingSubAgencyIndexRankFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, AnNingSubAgencyIndexRankFormDTO.SubAgencyIndexRank.class);
return new Result<List<AnNingSubAgencyIndexRankResultDTO>>().ok(indexService.anNingSubAgencyIndexRank(formDTO));
public Result<List<AnNingSubAgencyIndexRankResultDTO>> getSubAgencyIndexRank(@RequestBody SubAgencyIndexRankYMFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, SubAgencyIndexRankYMFormDTO.SubAgencyIndexRank.class);
return new Result<List<AnNingSubAgencyIndexRankResultDTO>>().ok(indexService.getSubAgencyIndexRank(formDTO));
}
/**
@ -101,13 +94,35 @@ public class IndexController {
* @author jianjun.liu
* @date 2020/8/20 10:02 上午
*/
@ExternalAppRequestAuth
@PostMapping("gridindexrank")
public Result<List<SubAgencyIndexRankResultDTO>> gridIndexRank(ExternalAppRequestParam extParam, @RequestBody GridIndexRankFormDTO formDTO) {
formDTO.setCustomerId(extParam.getCustomerId());
public Result<List<SubAgencyIndexRankResultDTO>> gridIndexRank(@RequestHeader("CustomerId") String customerId, @RequestBody GridIndexRankFormDTO formDTO) {
formDTO.setCustomerId(customerId);
ValidatorUtils.validateEntity(formDTO);
formDTO.setOrgType(OrgTypeEnum.GRID.getCode());
return new Result<List<SubAgencyIndexRankResultDTO>>().ok(indexService.selectIndexRankByOrgType(formDTO));
}
/**
* @param formDTO
* @Description 组织月度指数得分
* @author sun
*/
@PostMapping("month/indexscore")
public Result<IndexScoreResultDTO> indexScore(@RequestBody IndexScoreFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, IndexScoreFormDTO.AddUserInternalGroup.class);
return new Result<IndexScoreResultDTO>().ok(indexService.indexScore(formDTO));
}
/**
* @param formDTO
* @Description 先进排行-先进支部排行
* @author sun
*/
@PostMapping("advancedbranchrank")
Result<List<IndexAdvanceBranchRankResultDTO>> advancedBranchRank(@RequestBody AdvancedBranchRankFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, AdvancedBranchRankFormDTO.AddUserInternalGroup.class);
return new Result<List<IndexAdvanceBranchRankResultDTO>>().ok(indexService.advancedBranchRank(formDTO));
}
}

175
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java

@ -1,7 +1,5 @@
package com.epmet.datareport.controller.screen;
import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth;
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.evaluationindex.screen.KcScreenService;
@ -16,10 +14,7 @@ import com.epmet.dto.result.issue.KcIssueSummary;
import com.epmet.dto.result.issue.KcPartiTrendResultDTO;
import com.epmet.evaluationindex.screen.dto.result.HomepageSummaryResultDTO;
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 org.springframework.web.bind.annotation.*;
import java.util.List;
@ -38,46 +33,37 @@ public class KcScreenController {
/**
* @param externalAppRequestParam
* @Description 首页-平台各类总数
* @author sun
*/
@ExternalAppRequestAuth
@PostMapping("homepage/summary")
public Result<HomepageSummaryResultDTO> homepageSummary(ExternalAppRequestParam externalAppRequestParam){
return new Result<HomepageSummaryResultDTO>().ok(kcScreenService.homepageSummary(externalAppRequestParam));
public Result<HomepageSummaryResultDTO> homepageSummary(@RequestHeader("CustomerId") String customerId){
return new Result<HomepageSummaryResultDTO>().ok(kcScreenService.homepageSummary(customerId));
}
/**
* @param externalAppRequestParam
* @Description 公益互助-各类总数汇总
* @author sun
*/
@ExternalAppRequestAuth
@PostMapping("heart/summary")
public Result<HeartSummaryResultDTO> heartSummary(ExternalAppRequestParam externalAppRequestParam){
return new Result<HeartSummaryResultDTO>().ok(kcScreenService.heartSummary(externalAppRequestParam));
public Result<HeartSummaryResultDTO> heartSummary(@RequestHeader("CustomerId") String customerId){
return new Result<HeartSummaryResultDTO>().ok(kcScreenService.heartSummary(customerId));
}
/**
* @param externalAppRequestParam
* @Description 公益互助-公益活动次数
* @author sun
*/
@ExternalAppRequestAuth
@PostMapping("heart/actcounttrend")
public Result<HeartActcounttrendResultDTO> heartActcounttrend(ExternalAppRequestParam externalAppRequestParam){
return new Result<HeartActcounttrendResultDTO>().ok(kcScreenService.heartActcounttrend(externalAppRequestParam));
public Result<HeartActcounttrendResultDTO> heartActcounttrend(@RequestHeader("CustomerId") String customerId){
return new Result<HeartActcounttrendResultDTO>().ok(kcScreenService.heartActcounttrend(customerId));
}
/**
* 议题分析-各类总数
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("issue/summary")
public Result getIssueSummary(ExternalAppRequestParam externalAppRequestParam) {
String customerId = externalAppRequestParam.getCustomerId();
public Result getIssueSummary(@RequestHeader("CustomerId") String customerId) {
//String customerId = "b09527201c4409e19d1dbc5e3c3429a1";
KcIssueSummary issueSummary = kcScreenService.getIssueSummary(customerId);
return new Result().ok(issueSummary);
@ -85,326 +71,247 @@ public class KcScreenController {
/**
* 参与趋势
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("issue/partitrend")
public Result getIssuePartiTrend(ExternalAppRequestParam externalAppRequestParam) {
String customerId = externalAppRequestParam.getCustomerId();
//String customerId = "b09527201c4409e19d1dbc5e3c3429a1";
public Result getIssuePartiTrend(@RequestHeader("CustomerId") String customerId) {
KcPartiTrendResultDTO trendResultDTO = kcScreenService.getIssuePartiTrend(customerId);
return new Result().ok(trendResultDTO);
}
/**
* 按照议题数量排名
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("issue/gridtotalrank")
public Result getIssueGridTotalRank(ExternalAppRequestParam externalAppRequestParam) {
String customerId = externalAppRequestParam.getCustomerId();
//String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933";
public Result getIssueGridTotalRank(@RequestHeader("CustomerId") String customerId) {
return new Result().ok(kcScreenService.getIssueGridTotalRank(customerId));
}
/**
* 议题分析-审核效率排名
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("issue/avgaudittimerank")
public Result getAvgAuditTimeRank(ExternalAppRequestParam externalAppRequestParam) {
String customerId = externalAppRequestParam.getCustomerId();
//String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933";
public Result getAvgAuditTimeRank(@RequestHeader("CustomerId") String customerId) {
return new Result().ok(kcScreenService.getAvgAuditTimeRank(customerId));
}
/**
* 议题分析-议题效率
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("issue/effective")
public Result getIssueEffective(ExternalAppRequestParam externalAppRequestParam) {
String customerId = externalAppRequestParam.getCustomerId();
public Result getIssueEffective(@RequestHeader("CustomerId") String customerId) {
//String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933";
return new Result().ok(kcScreenService.getIssueEffective(customerId));
}
/**
* @param externalAppRequestParam
* @Description 公益互助-志愿者画像
* @author sun
*/
@ExternalAppRequestAuth
@PostMapping("heart/volunteerportrayal")
public Result<HeartVolunteerportrayalResultDTO> heartVolunteerportrayal(ExternalAppRequestParam externalAppRequestParam){
return new Result<HeartVolunteerportrayalResultDTO>().ok(kcScreenService.heartVolunteerportrayal(externalAppRequestParam));
public Result<HeartVolunteerportrayalResultDTO> heartVolunteerportrayal(@RequestHeader("CustomerId") String customerId){
return new Result<HeartVolunteerportrayalResultDTO>().ok(kcScreenService.heartVolunteerportrayal(customerId));
}
/**
* @param externalAppRequestParam
* @Description 公益互助-个人志愿者公益时长排名
* @author sun
*/
@ExternalAppRequestAuth
@PostMapping("heart/volunteerrank")
public Result<List<HeartVolunteerrankResultDTO>> heartVolunteerrank(ExternalAppRequestParam externalAppRequestParam, @RequestBody HeartVolunteerrankFormDTO formDTO){
public Result<List<HeartVolunteerrankResultDTO>> heartVolunteerrank(@RequestHeader("CustomerId") String customerId, @RequestBody HeartVolunteerrankFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, HeartVolunteerrankFormDTO.AddUserInternalGroup.class);
formDTO.setCustomerId(externalAppRequestParam.getCustomerId());
formDTO.setCustomerId(customerId);
return new Result<List<HeartVolunteerrankResultDTO>>().ok(kcScreenService.heartVolunteerrank(formDTO));
}
/**
* @param externalAppRequestParam
* @Description 邻里党群-各类总数
* @author sun
*/
@ExternalAppRequestAuth
@PostMapping("group/summary")
public Result<GroupSummaryResultDTO> groupSummary(ExternalAppRequestParam externalAppRequestParam){
return new Result<GroupSummaryResultDTO>().ok(kcScreenService.groupSummary(externalAppRequestParam));
public Result<GroupSummaryResultDTO> groupSummary(@RequestHeader("CustomerId") String customerId){
return new Result<GroupSummaryResultDTO>().ok(kcScreenService.groupSummary(customerId));
}
/**
* @param externalAppRequestParam
* @Description 邻里党群-话题参与趋势
* @author sun
*/
@ExternalAppRequestAuth
@PostMapping("group/partitopictrend")
public Result<GroupPartitopictrendResultDTO> groupPartitopictrend(ExternalAppRequestParam externalAppRequestParam){
return new Result<GroupPartitopictrendResultDTO>().ok(kcScreenService.groupPartitopictrend(externalAppRequestParam));
public Result<GroupPartitopictrendResultDTO> groupPartitopictrend(@RequestHeader("CustomerId") String customerId){
return new Result<GroupPartitopictrendResultDTO>().ok(kcScreenService.groupPartitopictrend(customerId));
}
/**
* @param externalAppRequestParam
* @Description 邻里党群-社群数量排名
* @author sun
*/
@ExternalAppRequestAuth
@PostMapping("group/gridgroupcountrank")
public Result<GroupGridgroupcountrankResultDTO> groupGridgroupcountrank(ExternalAppRequestParam externalAppRequestParam){
return new Result<GroupGridgroupcountrankResultDTO>().ok(kcScreenService.groupGridgroupcountrank(externalAppRequestParam));
public Result<GroupGridgroupcountrankResultDTO> groupGridgroupcountrank(@RequestHeader("CustomerId") String customerId){
return new Result<GroupGridgroupcountrankResultDTO>().ok(kcScreenService.groupGridgroupcountrank(customerId));
}
/**
* @param externalAppRequestParam
* @Description 邻里党群-社群数量排名
* @author sun
*/
@ExternalAppRequestAuth
@PostMapping("group/usercountrank")
public Result<List<GroupUserCountRankResultDTO>> groupUserCountRank(ExternalAppRequestParam externalAppRequestParam, @RequestBody GroupUserCountRankFormDTO formDTO){
public Result<List<GroupUserCountRankResultDTO>> groupUserCountRank(@RequestHeader("CustomerId") String customerId, @RequestBody GroupUserCountRankFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, GroupUserCountRankFormDTO.AddUserInternalGroup.class);
formDTO.setCustomerId(externalAppRequestParam.getCustomerId());
formDTO.setCustomerId(customerId);
return new Result<List<GroupUserCountRankResultDTO>>().ok(kcScreenService.groupUserCountRank(formDTO));
}
/**
* @param externalAppRequestParam
* @Description 邻里党群-话题转化率排名
* @author sun
*/
@ExternalAppRequestAuth
@PostMapping("group/topicshiftissueratiorank")
public Result<List<GroupTopicShiftIssueRatioRankResultDTO>> groupTopicShiftIssueRatioRank(ExternalAppRequestParam externalAppRequestParam, @RequestBody GroupTopicShiftIssueRatioRankFormDTO formDTO){
public Result<List<GroupTopicShiftIssueRatioRankResultDTO>> groupTopicShiftIssueRatioRank(@RequestHeader("CustomerId") String customerId, @RequestBody GroupTopicShiftIssueRatioRankFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, GroupTopicShiftIssueRatioRankFormDTO.AddUserInternalGroup.class);
formDTO.setCustomerId(externalAppRequestParam.getCustomerId());
formDTO.setCustomerId(customerId);
return new Result<List<GroupTopicShiftIssueRatioRankResultDTO>>().ok(kcScreenService.groupTopicShiftIssueRatioRank(formDTO));
}
/**
* 项目各类总数汇总
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("project/summary")
public Result<ProjectSummaryResultDTO> getProjectSummary(ExternalAppRequestParam externalAppRequestParam){
//String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933";
String customerId = externalAppRequestParam.getCustomerId();
public Result<ProjectSummaryResultDTO> getProjectSummary(@RequestHeader("CustomerId") String customerId){
return new Result<ProjectSummaryResultDTO>().ok(kcScreenService.getProjectSummary(customerId));
}
/**
* 项目分析-网格下项目数量排名
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("project/gridcountrank")
public Result<GridProjectCountRankResultDTO> getProjectGridCountRank(ExternalAppRequestParam externalAppRequestParam){
//String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933";
String customerId = externalAppRequestParam.getCustomerId();
public Result<GridProjectCountRankResultDTO> getProjectGridCountRank(@RequestHeader("CustomerId") String customerId){
return new Result<GridProjectCountRankResultDTO>().ok(kcScreenService.getGridProjectCountRank(customerId));
}
/**
* 项目分析-项目类别
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("project/categoryanalysis")
public Result<List<ProjectCategoryAnalysisResultDTO>> getProjectCategoryAnalysis(ExternalAppRequestParam externalAppRequestParam){
//String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933";
String customerId = externalAppRequestParam.getCustomerId();
public Result<List<ProjectCategoryAnalysisResultDTO>> getProjectCategoryAnalysis(@RequestHeader("CustomerId") String customerId){
return new Result<List<ProjectCategoryAnalysisResultDTO>>().ok(kcScreenService.getProjectCategoryAnalysis(customerId));
}
/**
* 网格项目平均结案时间
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("project/avgclosedtimeanalysis")
public Result<List<ProjectAvgClosedTimeResultDTO>> getGridProjectAvgClosedTimeAnalysis(ExternalAppRequestParam externalAppRequestParam){
//String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933";
String customerId = externalAppRequestParam.getCustomerId();
public Result<List<ProjectAvgClosedTimeResultDTO>> getGridProjectAvgClosedTimeAnalysis(@RequestHeader("CustomerId") String customerId){
return new Result<List<ProjectAvgClosedTimeResultDTO>>().ok(kcScreenService.getGridProjectAvgClosedTimeAnalysis(customerId));
}
/**
* 项目分析-居民满意度
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("project/statis")
public Result<ProjectSatisfactionResultDTO> getProjectSatisfactionAnalyze(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
public Result<ProjectSatisfactionResultDTO> getProjectSatisfactionAnalyze(@RequestHeader("CustomerId") String customerId){
return new Result<ProjectSatisfactionResultDTO>().ok(kcScreenService.getProjectSatisfactionAnalyze(customerId));
}
/**
* 用户-summary
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("user/summary")
public Result<UserSummaryResultDTO> getUserSummary(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
//String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933";
public Result<UserSummaryResultDTO> getUserSummary(@RequestHeader("CustomerId") String customerId){
return new Result<UserSummaryResultDTO>().ok(kcScreenService.getUserSummary(customerId));
}
/**
* 用户量趋势
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("user/trend")
public Result<KcUserTrendResultDTO> getUserTrend(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
public Result<KcUserTrendResultDTO> getUserTrend(@RequestHeader("CustomerId") String customerId){
return new Result<KcUserTrendResultDTO>().ok(kcScreenService.getUserTrend(customerId));
}
/**
* 网格用户数量排名
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("user/griduserrank")
public Result<KcUserRankResultDTO> getUserRank(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
public Result<KcUserRankResultDTO> getUserRank(@RequestHeader("CustomerId") String customerId){
return new Result<KcUserRankResultDTO>().ok(kcScreenService.getUserRank(customerId));
}
/**
* 用户画像
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("user/userportrayal")
public Result<KcUserPortrayalResultDTO> getUserPortrayal(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
public Result<KcUserPortrayalResultDTO> getUserPortrayal(@RequestHeader("CustomerId") String customerId){
return new Result<KcUserPortrayalResultDTO>().ok(kcScreenService.getUserPortrayal(customerId));
}
/**
* 用户积分排名
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("user/pointsrank")
public Result<KcUserPointRankResultDTO> getUserPointsRank(ExternalAppRequestParam externalAppRequestParam,
public Result<KcUserPointRankResultDTO> getUserPointsRank(@RequestHeader("CustomerId") String customerId,
@RequestBody PageFormDTO form) {
String customerId = externalAppRequestParam.getCustomerId();
return new Result<KcUserPointRankResultDTO>().ok(kcScreenService.getUserPointsRank(customerId, form.getPageNo(), form.getPageSize()));
}
/**
* 党建声音-各类总数
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("news/summary")
public Result<ScreenKcNewsSummaryResultDTO> getNewsSummary(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
public Result<ScreenKcNewsSummaryResultDTO> getNewsSummary(@RequestHeader("CustomerId") String customerId){
return new Result<ScreenKcNewsSummaryResultDTO>().ok(kcScreenService.getNewsSummary(customerId));
}
/**
* 新闻阅读参与趋势
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("news/partitrend")
public Result<ScreenKcNewsPartiTrendResultDTO> getNewsPartiTrend(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
public Result<ScreenKcNewsPartiTrendResultDTO> getNewsPartiTrend(@RequestHeader("CustomerId") String customerId){
return new Result<ScreenKcNewsPartiTrendResultDTO>().ok(kcScreenService.getNewsPartiTrend(customerId));
}
/**
* 党建声音-分类的news数量
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("news/category")
public Result<List<ScreenKcCategoryNewsCountResultDTO>> getNewsCountGroupByCategory(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
public Result<List<ScreenKcCategoryNewsCountResultDTO>> getNewsCountGroupByCategory(@RequestHeader("CustomerId") String customerId){
return new Result<List<ScreenKcCategoryNewsCountResultDTO>>().ok(kcScreenService.getNewsCountOfCategory(customerId));
}
/**
* 党建声音-分类的用户参与数排行
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("news/userparticategoryrank")
public Result<ScreenKcCategoryNewsRankResultDTO> getNewsPartiCategoryRank(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
public Result<ScreenKcCategoryNewsRankResultDTO> getNewsPartiCategoryRank(@RequestHeader("CustomerId") String customerId){
return new Result<ScreenKcCategoryNewsRankResultDTO>().ok(kcScreenService.getNewsPartiCategoryRank(customerId));
}
/**
* 党建声音-热点新闻排行
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("news/hotrank")
public Result<List<ScreenKcNewsHotRankResultDTO>> listNewsHotRank(ExternalAppRequestParam externalAppRequestParam,
public Result<List<ScreenKcNewsHotRankResultDTO>> listNewsHotRank(@RequestHeader("CustomerId") String customerId,
@RequestBody PageFormDTO form){
String customerId = externalAppRequestParam.getCustomerId();
return new Result<List<ScreenKcNewsHotRankResultDTO>>().ok(kcScreenService.getNewsHotRank(customerId, form.getPageNo(), form.getPageSize()));
}

6
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java

@ -1,6 +1,5 @@
package com.epmet.datareport.controller.screen;
import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.evaluationindex.screen.PartyMemberLeadService;
@ -33,7 +32,6 @@ public class PartyMemberLeadController {
* @author zxc
* @date 2020/8/20 1:56 下午
*/
@ExternalAppRequestAuth
@PostMapping("fineexample")
public Result<FineExampleResultDTO> fineExample(@RequestBody FineExampleFormDTO fineExampleFormDTO){
ValidatorUtils.validateEntity(fineExampleFormDTO, FineExampleFormDTO.FineExample.class);
@ -46,7 +44,6 @@ public class PartyMemberLeadController {
* @author zxc
* @date 2020/8/20 2:35 下午
*/
@ExternalAppRequestAuth
@PostMapping("contactmasslinechart")
public Result<ContactMassLineChartResultDTO> contactMassLineChart(@RequestBody ContactMassLineChartFormDTO contactMassLineChartFormDTO){
ValidatorUtils.validateEntity(contactMassLineChartFormDTO, ContactMassLineChartFormDTO.ContactMassLineChart.class);
@ -59,7 +56,6 @@ public class PartyMemberLeadController {
* @author zxc
* @date 2020/8/20 3:19 下午
*/
@ExternalAppRequestAuth
@PostMapping("volunteerservice")
public Result<VolunteerServiceResultDTO> volunteerService(@RequestBody VolunteerServiceFormDTO volunteerServiceFormDTO){
ValidatorUtils.validateEntity(volunteerServiceFormDTO, VolunteerServiceFormDTO.VolunteerService.class);
@ -74,7 +70,6 @@ public class PartyMemberLeadController {
* @author wangc
* @date 2020.08.21 11:05
**/
@ExternalAppRequestAuth
@PostMapping("advancedbranchrank")
Result<List<AdvanceBranchRankResultDTO>> advancedBranchRank(@RequestBody AgencyAndNumFormDTO param){
ValidatorUtils.validateEntity(param, AgencyFormDTO.CommonAgencyIdGroup.class);
@ -89,7 +84,6 @@ public class PartyMemberLeadController {
* @author wangc
* @date 2020.08.21 14:22
**/
@ExternalAppRequestAuth
@PostMapping("advancedpartymemberrank")
Result<List<PartyUserPointResultDTO>> advancedPartymemberRank(@RequestBody AgencyAndNumFormDTO param){
ValidatorUtils.validateEntity(param, AgencyFormDTO.CommonAgencyIdGroup.class);

2
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java

@ -1,6 +1,5 @@
package com.epmet.datareport.controller.screen;
import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectService;
@ -31,7 +30,6 @@ public class ScreenProjectController {
* @author zxc
* @date 2020/8/19 4:36 下午
*/
@ExternalAppRequestAuth
@PostMapping("detail")
public Result<ProjectDetailResultDTO> projectDetail(@RequestBody ProjectDetailFormDTO projectDetailFormDTO){
ValidatorUtils.validateEntity(projectDetailFormDTO, ProjectDetailFormDTO.ProjectDetail.class);

56
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenUserController.java

@ -0,0 +1,56 @@
package com.epmet.datareport.controller.screen;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.evaluationindex.screen.ScreenUserService;
import com.epmet.evaluationindex.screen.dto.form.PartIndexScroeRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.UserPointRankFormDTO;
import com.epmet.evaluationindex.screen.dto.result.PartIndexScroeRankResultDTO;
import com.epmet.evaluationindex.screen.dto.result.UserPointRankListResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 数据改版api
*
* @author sun
*/
@RestController
@RequestMapping("/screen/user")
public class ScreenUserController {
@Autowired
private ScreenUserService screenUserService;
/**
* @param formDTO
* @Description 热心市民积分排行列表
* @author sun
*/
@PostMapping("userpointrank")
public Result<List<UserPointRankListResultDTO>> userPointRank(@RequestBody UserPointRankFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, UserPointRankFormDTO.AddUserInternalGroup.class);
return new Result<List<UserPointRankListResultDTO>>().ok(screenUserService.userPointRank(formDTO));
}
/**
* @param formDTO
* @Description 党员指标得分排行
* @author sun
*/
@PostMapping("partindexscroerank")
public Result<List<PartIndexScroeRankResultDTO>> partIndexScroeRank(@RequestBody PartIndexScroeRankFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, PartIndexScroeRankFormDTO.AddUserInternalGroup.class);
return new Result<List<PartIndexScroeRankResultDTO>>().ok(screenUserService.partIndexScroeRank(formDTO));
}
}

23
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java

@ -17,10 +17,7 @@
package com.epmet.datareport.dao.evaluationindex.screen;
import com.epmet.evaluationindex.screen.dto.form.AnNingSubAgencyIndexRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.GridIndexRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.PeerComparisonFormDTO;
import com.epmet.evaluationindex.screen.dto.form.SubAgencyIndexRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.*;
import com.epmet.evaluationindex.screen.dto.result.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -68,7 +65,7 @@ public interface ScreenIndexDataMonthlyDao{
* @Author zhangyong
* @Date 09:38 2020-09-08
**/
List<AnNingSubAgencyIndexRankResultDTO> selectAnNingSubAgencyIndexMonthlyRank(AnNingSubAgencyIndexRankFormDTO formDTO);
List<AnNingSubAgencyIndexRankResultDTO> selectSubAgencyOrGridIndexMonthlyRank(SubAgencyIndexRankYMFormDTO formDTO);
/**
* desc获取网格指标排行
@ -80,8 +77,22 @@ public interface ScreenIndexDataMonthlyDao{
/**
* @param formDTO
* @Description 同级对比--根据组织Id的上级组织Id查询同级组织对应类型的得分排名查询最近一个月数据
* @Description 同级对比--根据组织或网格Id的上级组织Id查询同级组织或网格对应类型的得分排名查询最近一个月数据
* @author sun
*/
List<PeerComparisonResultDTO> selectScoreList(PeerComparisonFormDTO formDTO);
/**
* @param formDTO
* @Description 根据组织或网格Id以及月份Id查询各项月度指数得分
* @author sun
*/
IndexScoreResultDTO selectMonthData(IndexScoreFormDTO formDTO);
/**
* @param formDTO
* @Description 先进排行-先进支部排行
* @author sun
*/
List<IndexAdvanceBranchRankResultDTO> selectRankList(AdvancedBranchRankFormDTO formDTO);
}

4
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataYearlyDao.java

@ -17,7 +17,7 @@
package com.epmet.datareport.dao.evaluationindex.screen;
import com.epmet.evaluationindex.screen.dto.form.AnNingSubAgencyIndexRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.SubAgencyIndexRankYMFormDTO;
import com.epmet.evaluationindex.screen.dto.result.AnNingSubAgencyIndexRankResultDTO;
import com.epmet.evaluationindex.screen.dto.result.YearAverageIndexResultDTO;
import org.apache.ibatis.annotations.Mapper;
@ -50,5 +50,5 @@ public interface ScreenIndexDataYearlyDao{
* @Author zhangyong
* @Date 09:38 2020-09-08
**/
List<AnNingSubAgencyIndexRankResultDTO> selectAnNingSubAgencyIndexYearlyRank(AnNingSubAgencyIndexRankFormDTO formDTO);
List<AnNingSubAgencyIndexRankResultDTO> selectAnNingSubAgencyIndexYearlyRank(SubAgencyIndexRankYMFormDTO formDTO);
}

18
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPartyUserRankDataDao.java

@ -18,7 +18,11 @@
package com.epmet.datareport.dao.evaluationindex.screen;
import com.epmet.dto.result.user.KcUserPointRankResultDTO;
import com.epmet.evaluationindex.screen.dto.form.PartIndexScroeRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.UserPointRankFormDTO;
import com.epmet.evaluationindex.screen.dto.result.PartIndexScroeRankResultDTO;
import com.epmet.evaluationindex.screen.dto.result.PartyUserPointResultDTO;
import com.epmet.evaluationindex.screen.dto.result.UserPointRankListResultDTO;
import com.epmet.evaluationindex.screen.dto.result.UserPointResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -53,4 +57,18 @@ public interface ScreenPartyUserRankDataDao{
List<PartyUserPointResultDTO> selectPartymemberPointOrder(@Param("agencyId")String agencyId);
List<KcUserPointRankResultDTO.KcUserPoint> listUserPoints(String customerId);
/**
* @param formDTO
* @Description 查询组织下居民积分排行按积分值降序
* @author sun
*/
List<UserPointRankListResultDTO> selectAgencyUserPointList(UserPointRankFormDTO formDTO);
/**
* @param formDTO
* @Description 查询组织下党员的积分排行按积分值降序
* @author sun
*/
List<PartIndexScroeRankResultDTO> selectPartymemberPointList(PartIndexScroeRankFormDTO formDTO);
}

25
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencyScoreDao.java

@ -17,10 +17,17 @@
package com.epmet.datareport.dao.fact;
import com.epmet.evaluationindex.screen.dto.form.AblityIndexFormDTO;
import com.epmet.evaluationindex.screen.dto.form.MonthScoreListFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ScoreListFormDTO;
import com.epmet.evaluationindex.screen.dto.result.AblityIndexResultDTO;
import com.epmet.evaluationindex.screen.dto.result.MonthScoreListResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScoreListResultDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.LinkedList;
import java.util.List;
/**
* /街道相关分数表
*
@ -32,8 +39,22 @@ public interface FactIndexAgencyScoreDao {
/**
* @param formDTO
* @Description 分别查询当前组织某一月份党建能力治理能力服务能力对应的总分本级分下级分
* @Description 分别查询区县乡镇街道过去12个月党建能力治理能力服务能力每月总分本级得分下级得分数据
* @author sun
*/
LinkedList<AblityIndexResultDTO.ScoreListResultDTO> selectAblityIndex(AblityIndexFormDTO formDTO);
/**
* @param formDTO
* @Description 查询当前组织某一月份党建能力治理能力服务能力对应的总分本级分下级分
* @author sun
*/
List<ScoreListResultDTO> selectScoreList(ScoreListFormDTO formDTO);
/**
* @param formDTO
* @Description 分别查询区县乡镇街道过去12个月党建能力治理能力服务能力每月总分本级得分下级得分数据
* @author sun
*/
ScoreListResultDTO selectScore(ScoreListFormDTO formDTO);
LinkedList<MonthScoreListResultDTO.ScoreListResultDTO> selectMonthScoreList(MonthScoreListFormDTO formDTO);
}

60
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunityScoreDao.java

@ -0,0 +1,60 @@
/**
* 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.datareport.dao.fact;
import com.epmet.evaluationindex.screen.dto.form.AblityIndexFormDTO;
import com.epmet.evaluationindex.screen.dto.form.MonthScoreListFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ScoreListFormDTO;
import com.epmet.evaluationindex.screen.dto.result.AblityIndexResultDTO;
import com.epmet.evaluationindex.screen.dto.result.MonthScoreListResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScoreListResultDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.LinkedList;
import java.util.List;
/**
* 社区相关分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-02
*/
@Mapper
public interface FactIndexCommunityScoreDao {
/**
* @param formDTO
* @Description 分别查询社区过去12个月党建能力治理能力服务能力每月总分本级得分下级得分数据
* @author sun
*/
LinkedList<AblityIndexResultDTO.ScoreListResultDTO> selectCommunityAblityIndex(AblityIndexFormDTO formDTO);
/**
* @param formDTO
* @Description 查询社区级组织某一月份党建能力治理能力服务能力对应的总分本级分下级分
* @author sun
*/
List<ScoreListResultDTO> selectCommunityScoreList(ScoreListFormDTO formDTO);
/**
* @param formDTO
* @Description 分别查询社区过去12个月党建能力治理能力服务能力每月总分本级得分下级得分数据
* @author sun
*/
LinkedList<MonthScoreListResultDTO.ScoreListResultDTO> selectCommunityMonthScoreList(MonthScoreListFormDTO formDTO);
}

60
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridScoreDao.java

@ -0,0 +1,60 @@
/**
* 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.datareport.dao.fact;
import com.epmet.evaluationindex.screen.dto.form.AblityIndexFormDTO;
import com.epmet.evaluationindex.screen.dto.form.MonthScoreListFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ScoreListFormDTO;
import com.epmet.evaluationindex.screen.dto.result.AblityIndexResultDTO;
import com.epmet.evaluationindex.screen.dto.result.MonthScoreListResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScoreListResultDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.LinkedList;
import java.util.List;
/**
* 网格相关分值记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-02
*/
@Mapper
public interface FactIndexGridScoreDao {
/**
* @param formDTO
* @Description 分别查网格过去12个月党建能力治理能力服务能力每月总分本级得分下级得分数据
* @author sun
*/
LinkedList<AblityIndexResultDTO.ScoreListResultDTO> selectGridAblityIndex(AblityIndexFormDTO formDTO);
/**
* @param formDTO
* @Description 分别查网格某一月份党建能力治理能力服务能力对应的总分本级分下级分
* @author sun
*/
List<ScoreListResultDTO> selectGridScoreList(ScoreListFormDTO formDTO);
/**
* @param formDTO
* @Description 分别查网格过去12个月党建能力治理能力服务能力每月总分本级得分下级得分数据
* @author sun
*/
LinkedList<MonthScoreListResultDTO.ScoreListResultDTO> selectGridMonthScoreList(MonthScoreListFormDTO formDTO);
}

51
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridSubScoreDao.java

@ -0,0 +1,51 @@
/**
* 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.datareport.dao.fact;
import com.epmet.evaluationindex.screen.dto.form.AblityListFormDTO;
import com.epmet.evaluationindex.screen.dto.form.MonthAblityListFormDTO;
import com.epmet.evaluationindex.screen.dto.result.AblityListResultDTO;
import com.epmet.evaluationindex.screen.dto.result.MonthAblityListResultDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.LinkedList;
import java.util.List;
/**
* 网格相关分值记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-02
*/
@Mapper
public interface FactIndexGridSubScoreDao {
/**
* @param formDTO
* @Description 查询网格某月份某项能力对应的各项指标
* @author sun
*/
List<AblityListResultDTO> selectGridAblityList(AblityListFormDTO formDTO);
/**
* @param formDTO
* @Description 查询网格层级某项能力对应的一项指标过去12个月份数据
* @author sun
*/
LinkedList<MonthAblityListResultDTO> selectGridMonthAblityList(MonthAblityListFormDTO formDTO);
}

49
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/IndexDictDao.java

@ -0,0 +1,49 @@
/**
* 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.datareport.dao.fact;
import com.epmet.evaluationindex.screen.dto.result.IndexDictResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 评价指标字典
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-02
*/
@Mapper
public interface IndexDictDao {
/**
* @param
* @Description 查询指标字典表是百分比类型的数据
* @author sun
*/
List<IndexDictResultDTO> selectList();
/**
* @param
* @Description 根据indexCode查询指标字典表具体数据
* @author sun
*/
IndexDictResultDTO selectIndexDict(@Param("indexCode") String indexCode);
}

5
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java

@ -1,6 +1,5 @@
package com.epmet.datareport.service.evaluationindex.screen;
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.evaluationindex.screen.dto.form.CompartmentFormDTO;
import com.epmet.evaluationindex.screen.dto.result.CompartmentResultDTO;
import com.epmet.evaluationindex.screen.dto.result.TreeResultDTO;
@ -14,12 +13,12 @@ import com.epmet.evaluationindex.screen.dto.result.TreeResultDTO;
public interface AgencyService {
/**
* @Description 1组织机构树
* @param
* @Description 1组织机构树 只返回 is_display = '1'
* @author zxc
* @date 2020/8/18 2:04 下午
*/
TreeResultDTO tree(ExternalAppRequestParam externalAppRequestParam);
TreeResultDTO tree(String customerId);
/**
* @Description 2组织区域查询

18
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java

@ -46,14 +46,14 @@ public interface IndexService {
List<SubAgencyIndexRankResultDTO> subAgencyIndexRank(SubAgencyIndexRankFormDTO subAgencyIndexRankFormDTO);
/**
* 5下级部门指数排行安宁数据段用
* 5按月或年 下级组织指数排行
*
* @param formDTO
* @return java.util.List<com.epmet.evaluationindex.screen.dto.result.AnNingSubAgencyIndexRankResultDTO>
* @Author zhangyong
* @Date 09:38 2020-09-08
**/
List<AnNingSubAgencyIndexRankResultDTO> anNingSubAgencyIndexRank(AnNingSubAgencyIndexRankFormDTO formDTO);
List<AnNingSubAgencyIndexRankResultDTO> getSubAgencyIndexRank(SubAgencyIndexRankYMFormDTO formDTO);
/**
* desc:获取该客户下网格排行
@ -62,4 +62,18 @@ public interface IndexService {
* @return
*/
List<SubAgencyIndexRankResultDTO> selectIndexRankByOrgType(GridIndexRankFormDTO formDTO);
/**
* @param formDTO
* @Description 组织月度指数得分
* @author sun
*/
IndexScoreResultDTO indexScore(IndexScoreFormDTO formDTO);
/**
* @param formDTO
* @Description 先进排行-先进支部排行
* @author sun
*/
List<IndexAdvanceBranchRankResultDTO> advancedBranchRank(AdvancedBranchRankFormDTO formDTO);
}

22
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java

@ -1,6 +1,5 @@
package com.epmet.datareport.service.evaluationindex.screen;
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.dto.result.issue.*;
import com.epmet.dto.result.project.*;
import com.epmet.dto.result.user.*;
@ -22,32 +21,28 @@ import com.epmet.evaluationindex.screen.dto.result.HomepageSummaryResultDTO;
public interface KcScreenService {
/**
* @param externalAppRequestParam
* @Description 首页-平台各类总数
* @author sun
*/
HomepageSummaryResultDTO homepageSummary(ExternalAppRequestParam externalAppRequestParam);
HomepageSummaryResultDTO homepageSummary(String customerId);
/**
* @param externalAppRequestParam
* @Description 公益互助-各类总数汇总
* @author sun
*/
HeartSummaryResultDTO heartSummary(ExternalAppRequestParam externalAppRequestParam);
HeartSummaryResultDTO heartSummary(String customerId);
/**
* @param externalAppRequestParam
* @Description 公益互助-公益活动次数
* @author sun
*/
HeartActcounttrendResultDTO heartActcounttrend(ExternalAppRequestParam externalAppRequestParam);
HeartActcounttrendResultDTO heartActcounttrend(String customerId);
/**
* @param externalAppRequestParam
* @Description 公益互助-志愿者画像
* @author sun
*/
HeartVolunteerportrayalResultDTO heartVolunteerportrayal(ExternalAppRequestParam externalAppRequestParam);
HeartVolunteerportrayalResultDTO heartVolunteerportrayal(String customerId);
/**
* @param formDTO
@ -67,25 +62,22 @@ public interface KcScreenService {
/**
* @param externalAppRequestParam
* @Description 邻里党群-各类总数
* @author sun
*/
GroupSummaryResultDTO groupSummary(ExternalAppRequestParam externalAppRequestParam);
GroupSummaryResultDTO groupSummary(String customerId);
/**
* @param externalAppRequestParam
* @Description 邻里党群-话题参与趋势
* @author sun
*/
GroupPartitopictrendResultDTO groupPartitopictrend(ExternalAppRequestParam externalAppRequestParam);
GroupPartitopictrendResultDTO groupPartitopictrend(String customerId);
/**
* @param externalAppRequestParam
* @Description 邻里党群-社群数量排名
* @author sun
*/
GroupGridgroupcountrankResultDTO groupGridgroupcountrank(ExternalAppRequestParam externalAppRequestParam);
GroupGridgroupcountrankResultDTO groupGridgroupcountrank(String customerId);
/**
* @param formDTO

30
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenUserService.java

@ -0,0 +1,30 @@
package com.epmet.datareport.service.evaluationindex.screen;
import com.epmet.evaluationindex.screen.dto.form.PartIndexScroeRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.UserPointRankFormDTO;
import com.epmet.evaluationindex.screen.dto.result.PartIndexScroeRankResultDTO;
import com.epmet.evaluationindex.screen.dto.result.UserPointRankListResultDTO;
import java.util.List;
/**
* 数据改版
*
* @author sun
*/
public interface ScreenUserService {
/**
* @param formDTO
* @Description 热心市民积分排行列表
* @author sun
*/
List<UserPointRankListResultDTO> userPointRank(UserPointRankFormDTO formDTO);
/**
* @param formDTO
* @Description 党员指标得分排行
* @author sun
*/
List<PartIndexScroeRankResultDTO> partIndexScroeRank(PartIndexScroeRankFormDTO formDTO);
}

27
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java

@ -1,8 +1,8 @@
package com.epmet.datareport.service.evaluationindex.screen.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerAgencyDao;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerGridDao;
@ -12,7 +12,7 @@ import com.epmet.evaluationindex.screen.dto.form.CompartmentFormDTO;
import com.epmet.evaluationindex.screen.dto.result.AgencyDistributionResultDTO;
import com.epmet.evaluationindex.screen.dto.result.CompartmentResultDTO;
import com.epmet.evaluationindex.screen.dto.result.TreeResultDTO;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.exceptions.TooManyResultsException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -42,25 +42,24 @@ public class AgencyServiceImpl implements AgencyService {
*/
@DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true)
@Override
public TreeResultDTO tree(ExternalAppRequestParam externalAppRequestParam) {
public TreeResultDTO tree(String customerId) {
// 1. 查询客户根组织ID
String customerId = externalAppRequestParam.getCustomerId();
// 验签关闭,customerId无法获取,暂时写死
if(StringUtils.isBlank(customerId)){
customerId = "b09527201c4409e19d1dbc5e3c3429a1";
}
TreeResultDTO rootAgency = screenCustomerAgencyDao.selectRootAgencyId(customerId);
if (null == rootAgency){
return new TreeResultDTO();
TreeResultDTO rootAgency = null;
try {
rootAgency = screenCustomerAgencyDao.selectRootAgencyId(customerId);
if (null == rootAgency) {
return new TreeResultDTO();
}
} catch (TooManyResultsException e) {
throw new RenException("根组织结构数据有误");
}
List<Double> centerMark = this.getCenterMark(rootAgency.getCenterMarkA());
rootAgency.setCenterMark(centerMark.size() == NumConstant.ZERO ? new ArrayList<>() : centerMark);
if (rootAgency.getLevel().equals(ScreenConstant.COMMUNITY)){
if (rootAgency.getLevel().equals(ScreenConstant.COMMUNITY)) {
List<TreeResultDTO> treeResultDTOS = screenCustomerGridDao.selectGridInfo(rootAgency.getValue());
rootAgency.setChildren(treeResultDTOS);
}else {
} else {
List<TreeResultDTO> departmentList = this.getDepartmentList(("".equals(rootAgency.getPids()) || rootAgency.getPids().equals(NumConstant.ZERO_STR)) ? rootAgency.getValue() : rootAgency.getPids().concat(",").concat(rootAgency.getValue()));
rootAgency.setChildren(departmentList);
}

21
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java

@ -108,18 +108,17 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService {
UserJoinIndicatorGrowthRateResultDTO latest = screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId);
//保证获取公众参与概率数据的最大可能性
int time = NumConstant.TWELVE;
while(null == latest && time > NumConstant.ONE)
{
time --;
monthId = dateUtils.getPreviousMonthIdByDest(null,monthId);
latest = screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId);
}
while (null == latest && time > NumConstant.ONE) {
time--;
monthId = dateUtils.getPreviousMonthIdByDest(null, monthId);
latest = screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId);
}
if(null == latest) return new PublicPartiProfileResultDTO();
PublicPartiProfileResultDTO result = ConvertUtils.sourceToTarget(latest,PublicPartiProfileResultDTO.class);
result.setMonthIncr(convertPercentStr(latest.getMonthIncr(),NumConstant.ZERO));
result.setJoinCompareLatestMonth(convertPercentStr(latest.getJoinCompareLatestMonth(),NumConstant.ZERO));
result.setIssueCompareLatestMonth(convertPercentStr(latest.getIssueCompareLatestMonth(),NumConstant.ZERO));
if (null == latest) return new PublicPartiProfileResultDTO();
PublicPartiProfileResultDTO result = ConvertUtils.sourceToTarget(latest, PublicPartiProfileResultDTO.class);
result.setMonthIncr(convertPercentStr(latest.getMonthIncr(), NumConstant.ZERO));
result.setJoinCompareLatestMonth(convertPercentStr(latest.getJoinCompareLatestMonth().abs(), NumConstant.ZERO));
result.setIssueCompareLatestMonth(convertPercentStr(latest.getIssueCompareLatestMonth().abs(), NumConstant.ZERO));
return result;
}

89
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java

@ -2,23 +2,27 @@ package com.epmet.datareport.service.evaluationindex.screen.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataMonthlyDao;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataYearlyDao;
import com.epmet.datareport.service.evaluationindex.screen.IndexService;
import com.epmet.datareport.utils.DateUtils;
import com.epmet.evaluationindex.screen.constant.ScreenConstant;
import com.epmet.evaluationindex.screen.dto.form.*;
import com.epmet.evaluationindex.screen.dto.result.*;
import org.apache.commons.lang3.StringUtils;
import org.jsoup.helper.DataUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.unit.DataUnit;
import java.math.BigDecimal;
import java.text.NumberFormat;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@ -39,7 +43,7 @@ public class IndexServiceImpl implements IndexService {
@Autowired
private PartyMemberLeadServiceImpl partyMemberLeadServiceImpl;
@Autowired
private DateUtils dateUtils;
private com.epmet.datareport.utils.DateUtils dateUtils;
/**
* @Description 1年度平均指数
@ -204,16 +208,20 @@ public class IndexServiceImpl implements IndexService {
return subAgencyIndexRankResultDTOS;
}
@DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true)
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
@Override
public List<AnNingSubAgencyIndexRankResultDTO> anNingSubAgencyIndexRank(AnNingSubAgencyIndexRankFormDTO formDTO) {
public List<AnNingSubAgencyIndexRankResultDTO> getSubAgencyIndexRank(SubAgencyIndexRankYMFormDTO formDTO) {
List<AnNingSubAgencyIndexRankResultDTO> subAgencyIndexRankResultDTOS = new ArrayList<>();
if (ScreenConstant.YEAR_ID.equals(formDTO.getType())){
if (ScreenConstant.YEAR_ID.equals(formDTO.getType())) {
// 年 指数排行
subAgencyIndexRankResultDTOS = screenIndexDataYearlyDao.selectAnNingSubAgencyIndexYearlyRank(formDTO);
} else if (ScreenConstant.MONTH_ID.equals(formDTO.getType())){
} else if (ScreenConstant.MONTH_ID.equals(formDTO.getType())) {
// 月(上一个月) 指数排行
subAgencyIndexRankResultDTOS = screenIndexDataMonthlyDao.selectAnNingSubAgencyIndexMonthlyRank(formDTO);
if (StringUtils.isBlank(formDTO.getMonthId())) {
String monthId = com.epmet.commons.tools.utils.DateUtils.format(com.epmet.commons.tools.utils.DateUtils.addDateMonths(new Date(), -1), "yyyyMMdd");
formDTO.setMonthId(monthId);
}
subAgencyIndexRankResultDTOS = screenIndexDataMonthlyDao.selectSubAgencyOrGridIndexMonthlyRank(formDTO);
subAgencyIndexRankResultDTOS.forEach(rank -> {
rank.setPartyDevAbility(getRound(rank.getPartyDevAbility()));
rank.setGovernAbility(getRound(rank.getGovernAbility()));
@ -254,4 +262,71 @@ public class IndexServiceImpl implements IndexService {
BigDecimal b = bigDecimal.setScale(NumConstant.ONE, BigDecimal.ROUND_HALF_UP);
return Double.valueOf(b.toString());
}
/**
* @param formDTO
* @Description 组织月度指数得分
* @author sun
*/
@Override
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
public IndexScoreResultDTO indexScore(IndexScoreFormDTO formDTO) {
//screen_index_data_monthly 根据组织id和月份获取月度指标得分
//1.大屏接口 orgType和monthId字段不传值,默认查询上一个月数据
if(null==formDTO.getMonthId()||"".equals(formDTO.getMonthId())){
formDTO.setMonthId(DateUtils.getBeforeNMonth(1));
}
//2.根据组织或网格Id以及月份Id查询各项月度指数得分
IndexScoreResultDTO resultDTO = screenIndexDataMonthlyDao.selectMonthData(formDTO);
if (null == resultDTO) {
return resultDTO;
}
//3.将数据改成正确格式 四舍五入保留一位小数 权重转成百分比
NumberFormat nf = NumberFormat.getPercentInstance();
nf.setMaximumFractionDigits(1);
BigDecimal num1 = new BigDecimal(resultDTO.getParty()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
resultDTO.setPartyDevAbility(num1);
resultDTO.setPartyDevAbilityWeight(nf.format(Double.parseDouble(resultDTO.getPartyDevAbilityWeight())));
BigDecimal num2 = new BigDecimal(resultDTO.getGovern()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
resultDTO.setGovernAbility(num2);
resultDTO.setGovernAbilityWeight(nf.format(Double.parseDouble(resultDTO.getGovernAbilityWeight())));
BigDecimal num3 = new BigDecimal(resultDTO.getService()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
resultDTO.setServiceAbility(num3);
resultDTO.setServiceAbilityWeight(nf.format(Double.parseDouble(resultDTO.getServiceAbilityWeight())));
Double db = num1.doubleValue() + num2.doubleValue() + num3.doubleValue();
BigDecimal num = new BigDecimal(db.toString()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
resultDTO.setTotalScore(num);
return resultDTO;
}
/**
* @param formDTO
* @Description 先进排行-先进支部排行
* @author sun
*/
@Override
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
public List<IndexAdvanceBranchRankResultDTO> advancedBranchRank(AdvancedBranchRankFormDTO formDTO) {
//根据当前所选组织,查询screen_index_data_monthly中类型为网格的按照总指数倒序,关联screen_org_rank_data表取其他数据
//1.级联查询组织下所有网格的先进支部排行数据,按总指数降序
formDTO.setMonthId(DateUtils.getBeforeNMonth(1));
List<IndexAdvanceBranchRankResultDTO> list = screenIndexDataMonthlyDao.selectRankList(formDTO);
//2.遍历数据,小数保留一位小数,百分数添加百分号
NumberFormat nf = NumberFormat.getPercentInstance();
nf.setMaximumFractionDigits(1);
list.forEach(l->{
BigDecimal num = new BigDecimal(l.getTotalScore()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
l.setScroe(num);
BigDecimal num1 = new BigDecimal(l.getSatisfactionRatio()).setScale(1, BigDecimal.ROUND_HALF_UP);
l.setSatisfactionRatio(num1 + "%");
BigDecimal num2 = new BigDecimal(l.getClosedProjectRatio()).setScale(1, BigDecimal.ROUND_HALF_UP);
l.setClosedProjectRatio(num2 + "%");
});
return list;
}
}

36
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java

@ -1,7 +1,6 @@
package com.epmet.datareport.service.evaluationindex.screen.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenPartyUserRankDataDao;
@ -99,37 +98,34 @@ public class KcScreenServiceImpl implements KcScreenService {
private ScreenKcNewsRankDao screenKcNewsRankDao;
/**
* @param externalAppRequestParam
* @Description 首页-平台各类总数
* @author sun
*/
@Override
public HomepageSummaryResultDTO homepageSummary(ExternalAppRequestParam externalAppRequestParam) {
return screenKcPlatformSummaryDailyDao.selectSummaryDaily(externalAppRequestParam.getCustomerId());
public HomepageSummaryResultDTO homepageSummary(String customerId) {
return screenKcPlatformSummaryDailyDao.selectSummaryDaily(customerId);
}
/**
* @param externalAppRequestParam
* @Description 公益互助-各类总数汇总
* @author sun
*/
@Override
public HeartSummaryResultDTO heartSummary(ExternalAppRequestParam externalAppRequestParam) {
return screenKcActSummaryDailyDao.selectHeartSummary(externalAppRequestParam.getCustomerId());
public HeartSummaryResultDTO heartSummary(String customerId) {
return screenKcActSummaryDailyDao.selectHeartSummary(customerId);
}
/**
* @param externalAppRequestParam
* @Description 公益互助-公益活动次数
* @author sun
*/
@Override
public HeartActcounttrendResultDTO heartActcounttrend(ExternalAppRequestParam externalAppRequestParam) {
public HeartActcounttrendResultDTO heartActcounttrend(String customerId) {
HeartActcounttrendResultDTO resultDTO = new HeartActcounttrendResultDTO();
LinkedList<String> xAxis = new LinkedList<>();
LinkedList<String> actCountDataList = new LinkedList<>();
//1.按客户查询最近十二个月数据
List<ActTrendMonthlyResultDTO> list = screenKcActTrendMonthlyDao.selectActTrendMonthly(externalAppRequestParam.getCustomerId());
List<ActTrendMonthlyResultDTO> list = screenKcActTrendMonthlyDao.selectActTrendMonthly(customerId);
//2.倒序遍历封装数据
for (int i = list.size() - 1; i >= 0; i--) {
xAxis.add(list.get(i).getMonthId());
@ -142,16 +138,15 @@ public class KcScreenServiceImpl implements KcScreenService {
}
/**
* @param externalAppRequestParam
* @Description 公益互助-志愿者画像
* @author sun
*/
@Override
public HeartVolunteerportrayalResultDTO heartVolunteerportrayal(ExternalAppRequestParam externalAppRequestParam) {
public HeartVolunteerportrayalResultDTO heartVolunteerportrayal(String customerId) {
HeartVolunteerportrayalResultDTO resultDTO = new HeartVolunteerportrayalResultDTO();
GenderDistributionResultDTO genderDistribution = new GenderDistributionResultDTO();
//1.根据客户Id查询最近日期志愿者统计数据
AgeDistributionResultDTO ageDistribution = screenKcVolunteerSummaryDailyDao.selectVolunteerSummaryDaily(externalAppRequestParam.getCustomerId());
AgeDistributionResultDTO ageDistribution = screenKcVolunteerSummaryDailyDao.selectVolunteerSummaryDaily(customerId);
//2.封装数据并返回
if (null == ageDistribution) {
resultDTO.setAgeDistribution(new AgeDistributionResultDTO());
@ -219,14 +214,13 @@ public class KcScreenServiceImpl implements KcScreenService {
}
/**
* @param externalAppRequestParam
* @Description 邻里党群-各类总数
* @author sun
*/
@Override
public GroupSummaryResultDTO groupSummary(ExternalAppRequestParam externalAppRequestParam) {
public GroupSummaryResultDTO groupSummary(String customerId) {
//1.按客户查询最近一天各网格各项数据的汇总值
GroupSummaryResultDTO resultDTO = screenKcGroupSummaryGridDailyDao.selectGroupSummaryDaily(externalAppRequestParam.getCustomerId());
GroupSummaryResultDTO resultDTO = screenKcGroupSummaryGridDailyDao.selectGroupSummaryDaily(customerId);
if (null == resultDTO) {
return new GroupSummaryResultDTO();
}
@ -246,17 +240,16 @@ public class KcScreenServiceImpl implements KcScreenService {
}
/**
* @param externalAppRequestParam
* @Description 邻里党群-话题参与趋势
* @author sun
*/
@Override
public GroupPartitopictrendResultDTO groupPartitopictrend(ExternalAppRequestParam externalAppRequestParam) {
public GroupPartitopictrendResultDTO groupPartitopictrend(String customerId) {
GroupPartitopictrendResultDTO resultDTO = new GroupPartitopictrendResultDTO();
LinkedList<String> xAxis = new LinkedList<>();
LinkedList<Integer> actCountDataList = new LinkedList<>();
//1.按客户查询最近十二个月所有网格汇总数据
List<KcTopicTrendGridMonthlyResultDTO> list = screenKcTopicTrendGridMonthlyDao.selectActTrendMonthly(externalAppRequestParam.getCustomerId());
List<KcTopicTrendGridMonthlyResultDTO> list = screenKcTopicTrendGridMonthlyDao.selectActTrendMonthly(customerId);
//2.倒序遍历封装数据
for (int i = list.size() - 1; i >= 0; i--) {
xAxis.add(list.get(i).getMonthId());
@ -269,17 +262,16 @@ public class KcScreenServiceImpl implements KcScreenService {
}
/**
* @param externalAppRequestParam
* @Description 邻里党群-社群数量排名
* @author sun
*/
@Override
public GroupGridgroupcountrankResultDTO groupGridgroupcountrank(ExternalAppRequestParam externalAppRequestParam) {
public GroupGridgroupcountrankResultDTO groupGridgroupcountrank(String customerId) {
GroupGridgroupcountrankResultDTO resultDTO = new GroupGridgroupcountrankResultDTO();
LinkedList<String> gridNameDataList = new LinkedList<>();
LinkedList<Integer> groupCountDataList = new LinkedList<>();
//1.按日期降序,查询客户最近一天所有网格数据,按每个网格的社区总数降序排列
LinkedList<GridNameGroupCountResultDTO> list = screenKcGroupSummaryGridDailyDao.selectGridDailyList(externalAppRequestParam.getCustomerId());
LinkedList<GridNameGroupCountResultDTO> list = screenKcGroupSummaryGridDailyDao.selectGridDailyList(customerId);
//2.封装数据
list.forEach(l -> {
gridNameDataList.add(l.getGridName());

62
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenUserServiceImpl.java

@ -0,0 +1,62 @@
package com.epmet.datareport.service.evaluationindex.screen.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.constant.FactConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenPartyUserRankDataDao;
import com.epmet.datareport.service.evaluationindex.screen.ScreenUserService;
import com.epmet.evaluationindex.screen.dto.form.PartIndexScroeRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.UserPointRankFormDTO;
import com.epmet.evaluationindex.screen.dto.result.PartIndexScroeRankResultDTO;
import com.epmet.evaluationindex.screen.dto.result.UserPointRankListResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 数据改版
*
* @author sun
*/
@Service
@DataSource(DataSourceConstant.EVALUATION_INDEX)
public class ScreenUserServiceImpl implements ScreenUserService {
@Autowired
private ScreenPartyUserRankDataDao screenPartyUserRankDataDao;
/**
* @param formDTO
* @Description 热心市民积分排行列表
* @author sun
*/
@Override
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
public List<UserPointRankListResultDTO> userPointRank(UserPointRankFormDTO formDTO) {
//1.参数校验
if (!FactConstant.AGENCY.equals(formDTO.getOrgType()) && !FactConstant.GRID.equals(formDTO.getOrgType())) {
throw new RenException(String.format("入参格式错误,错误的组织或网格类型:%s", formDTO.getOrgType()));
}
//2.查询组织下居民积分排行,按积分值降序 screen_party_user_rank_data
return screenPartyUserRankDataDao.selectAgencyUserPointList(formDTO);
}
/**
* @param formDTO
* @Description 党员指标得分排行
* @author sun
*/
@Override
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
public List<PartIndexScroeRankResultDTO> partIndexScroeRank(PartIndexScroeRankFormDTO formDTO) {
//1.参数校验
if (!FactConstant.AGENCY.equals(formDTO.getOrgType()) && !FactConstant.GRID.equals(formDTO.getOrgType())) {
throw new RenException(String.format("入参格式错误,错误的组织或网格类型:%s", formDTO.getOrgType()));
}
//2.查询组织下党员的积分排行 screen_party_user_rank_data
return screenPartyUserRankDataDao.selectPartymemberPointList(formDTO);
}
}

402
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java

@ -2,24 +2,26 @@ package com.epmet.datareport.service.fact.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.ErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.constant.FactConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerAgencyDao;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataMonthlyDao;
import com.epmet.datareport.dao.fact.FactIndexAgencyScoreDao;
import com.epmet.datareport.dao.fact.FactIndexAgencySubScoreDao;
import com.epmet.datareport.dao.fact.FactIndexCommunitySubScoreDao;
import com.epmet.datareport.dao.fact.*;
import com.epmet.datareport.service.fact.FactIndexService;
import com.epmet.evaluationindex.screen.dto.form.*;
import com.epmet.evaluationindex.screen.dto.result.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedList;
import java.util.List;
import java.util.regex.Pattern;
/**
* 数据改版api
@ -39,7 +41,15 @@ public class FactIndexServiceImpl implements FactIndexService {
@Autowired
private FactIndexAgencySubScoreDao factIndexAgencySubScoreDao;
@Autowired
private FactIndexCommunityScoreDao factIndexCommunityScoreDao;
@Autowired
private FactIndexCommunitySubScoreDao factIndexCommunitySubScoreDao;
@Autowired
private FactIndexGridScoreDao factIndexGridScoreDao;
@Autowired
private FactIndexGridSubScoreDao factIndexGridSubScoreDao;
@Autowired
private IndexDictDao indexDictDao;
/**
* @param formDTO
@ -48,44 +58,105 @@ public class FactIndexServiceImpl implements FactIndexService {
*/
@Override
public List<AblityIndexResultDTO> ablityIndex(AblityIndexFormDTO formDTO) {
LinkedList<AblityIndexResultDTO> resultDTO = new LinkedList<>();
//分别查询过去12个月党建能力、治理能力、服务能力各自总分乘权重后的分值,每个月份三个分值的加和就是当月的能力指数的分值 fact_index_agency_score 按月份升序
//1.查询组织过去12个月党建能力指标
//LinkedList<AblityIndexResultDTO.MonthScoreResultDTO.ScoreListResultDTO> djList = factIndexAgencyScoreDao.;
LinkedList<AblityIndexResultDTO.ScoreListResultDTO> djList = null;
//2.查询组织过去12个月治理能力指标
LinkedList<AblityIndexResultDTO.ScoreListResultDTO> zlList = null;
//3.查询组织过去12个月服务能力指标
LinkedList<AblityIndexResultDTO.ScoreListResultDTO> fwList = null;
//4.遍历计算每个月能力指数
LinkedList<AblityIndexResultDTO> resultList = new LinkedList<>();
LinkedList<AblityIndexResultDTO.ScoreListResultDTO> list = new LinkedList<>();
LinkedList<AblityIndexResultDTO.ScoreListResultDTO> djList = new LinkedList<>();
LinkedList<AblityIndexResultDTO.ScoreListResultDTO> zlList = new LinkedList<>();
LinkedList<AblityIndexResultDTO.ScoreListResultDTO> fwList = new LinkedList<>();
//1.计算所查月份前12个月的monthId
formDTO.setStartMonthId(getDate(formDTO.getMonthId()));
//2.根据类型判断是查询组织数据还是网格数据
//组织层级数据
if (FactConstant.AGENCY.equals(formDTO.getOrgType())) {
//3.根据组织Id查询组织信息
CompartmentResultDTO agency = screenCustomerAgencyDao.getAgencyAreaInfo(formDTO.getOrgId());
if (null == agency) {
//throw new RenException(String.format("根据组织Id未查询到组织信息,组织Id:%s", formDTO.getOrgId()));
return resultList;
}
//4.根据组织级别判断查询哪类数据表
//区县级、乡镇街道级
if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) {
//4-1.查询过去12个月党建能力、治理能力、服务能力每月总分数据
list = factIndexAgencyScoreDao.selectAblityIndex(formDTO);
//社区级
} else if ("community".equals(agency.getLevel())) {
//4-1.查询过去12个月党建能力、治理能力、服务能力每月总分、本级得分、下级得分数据
list = factIndexCommunityScoreDao.selectCommunityAblityIndex(formDTO);
} else {
//throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getOrgId()));
return resultList;
}
//网格层级数据
} else if (FactConstant.GRID.equals(formDTO.getOrgType())) {
//5.查询网格过去12个月党建能力、治理能力、服务能力每月总分数据
list = factIndexGridScoreDao.selectGridAblityIndex(formDTO);
} else {
throw new RenException(String.format("能力指数查询,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType()));
}
if (list.size() < NumConstant.ONE) {
return resultList;
}
//6.遍历计算每个月能力指数
LinkedList<AblityIndexResultDTO.ScoreListResultDTO> nlList = new LinkedList<>();
for (int i = 0; i < djList.size(); i++) {
AblityIndexResultDTO.ScoreListResultDTO nldto = new AblityIndexResultDTO.ScoreListResultDTO();
nldto.setIndexTotal(djList.get(i).getIndexTotal() + zlList.get(i).getIndexTotal() + fwList.get(i).getIndexTotal());
nldto.setAgencyScore(djList.get(i).getAgencyScore() + zlList.get(i).getAgencyScore() + fwList.get(i).getAgencyScore());
nldto.setSubAgencyScore(djList.get(i).getSubAgencyScore() + zlList.get(i).getSubAgencyScore() + fwList.get(i).getSubAgencyScore());
nldto.setMonthId(djList.get(i).getMonthId());
nlList.add(nldto);
String monthId = list.get(0).getMonthId();
Double dl = 0.0;
for (AblityIndexResultDTO.ScoreListResultDTO l : list) {
if (l.getMonthId().equals(monthId)) {
dl += l.getIndexTotal();
} else {
AblityIndexResultDTO.ScoreListResultDTO nldto = new AblityIndexResultDTO.ScoreListResultDTO();
double num1 = new BigDecimal(dl).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
nldto.setIndexTotal(num1);
nldto.setMonthId(monthId);
nlList.add(nldto);
monthId = l.getMonthId();
dl = l.getIndexTotal();
}
if (FactConstant.DJNL.equals(l.getIndexCode())) {
djList.add(l);
} else if (FactConstant.ZLNL.equals(l.getIndexCode())) {
zlList.add(l);
} else if (FactConstant.FWNL.equals(l.getIndexCode())) {
fwList.add(l);
}
}
//5.封装数据并返回
//把最后一个月的能力指标数据放入集合
AblityIndexResultDTO.ScoreListResultDTO nldto = new AblityIndexResultDTO.ScoreListResultDTO();
double num1 = new BigDecimal(dl).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
nldto.setIndexTotal(num1);
nldto.setMonthId(monthId);
nlList.add(nldto);
//7.封装数据并返回
AblityIndexResultDTO nl = new AblityIndexResultDTO();
nl.setIndexCode(FactConstant.NLZB);
nl.setScoreList(djList);
resultDTO.add(nl);
nl.setScoreList(nlList);
if (null != nlList) {
resultList.add(nl);
}
AblityIndexResultDTO dj = new AblityIndexResultDTO();
dj.setIndexCode(FactConstant.DJNL);
dj.setScoreList(djList);
resultDTO.add(dj);
if (null != djList) {
resultList.add(dj);
}
AblityIndexResultDTO zl = new AblityIndexResultDTO();
zl.setIndexCode(FactConstant.ZLNL);
zl.setScoreList(djList);
resultDTO.add(zl);
zl.setScoreList(zlList);
if (null != zlList) {
resultList.add(zl);
}
AblityIndexResultDTO fw = new AblityIndexResultDTO();
fw.setIndexCode(FactConstant.FWNL);
fw.setScoreList(djList);
resultDTO.add(fw);
fw.setScoreList(fwList);
if (null != fwList) {
resultList.add(fw);
}
return resultDTO;
return resultList;
}
/**
@ -95,13 +166,39 @@ public class FactIndexServiceImpl implements FactIndexService {
*/
@Override
public List<ScoreListResultDTO> scoreList(ScoreListFormDTO formDTO) {
//1.查询当前组织某一月份党建能力对应的总分、本级分、下级分
formDTO.setIndexCode(FactConstant.DJNL);
ScoreListResultDTO dj = factIndexAgencyScoreDao.selectScore(formDTO);
//2.查询当前组织某一月份治理能力对应的总分、本级分、下级分
//3.查询当前组织某一月份服务能力对应的总分、本级分、下级分
List<ScoreListResultDTO> resultList = new LinkedList<>();
//1.根据类型判断是查询组织数据还是网格数据
//组织层级数据
if (FactConstant.AGENCY.equals(formDTO.getOrgType())) {
//2.根据组织Id查询组织信息
CompartmentResultDTO agency = screenCustomerAgencyDao.getAgencyAreaInfo(formDTO.getOrgId());
if (null == agency) {
//throw new RenException(String.format("根据组织Id未查询到组织信息,组织Id:%s", formDTO.getOrgId()));
return resultList;
}
//3.根据组织级别判断查询哪类数据表
//区县级、乡镇街道级
if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) {
//3-1.查询当前组织某一月份党建能力、治理能力、服务能力对应的总分、本级分、下级分
resultList = factIndexAgencyScoreDao.selectScoreList(formDTO);
//社区级
} else if ("community".equals(agency.getLevel())) {
//3-1.查询当前组织某一月份党建能力、治理能力、服务能力对应的总分、本级分、下级分
resultList = factIndexCommunityScoreDao.selectCommunityScoreList(formDTO);
} else {
//throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getOrgId()));
return resultList;
}
//4.网格层级数据
} else if (FactConstant.GRID.equals(formDTO.getOrgType())) {
//4-1.查询当前组织某一月份党建能力、治理能力、服务能力对应的总分、本级分、下级分
resultList = factIndexGridScoreDao.selectGridScoreList(formDTO);
} else {
throw new RenException(String.format("按月份查询各项能力分数,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType()));
}
return null;
return resultList;
}
/**
@ -111,7 +208,74 @@ public class FactIndexServiceImpl implements FactIndexService {
*/
@Override
public List<MonthScoreListResultDTO> monthScoreList(MonthScoreListFormDTO formDTO) {
return null;
LinkedList<MonthScoreListResultDTO> resultList = new LinkedList<>();
LinkedList<MonthScoreListResultDTO.ScoreListResultDTO> list = new LinkedList<>();
LinkedList<MonthScoreListResultDTO.ScoreListResultDTO> djList = new LinkedList<>();
LinkedList<MonthScoreListResultDTO.ScoreListResultDTO> zlList = new LinkedList<>();
LinkedList<MonthScoreListResultDTO.ScoreListResultDTO> fwList = new LinkedList<>();
//1.计算所查月份前12个月的monthId
formDTO.setStartMonthId(getDate(formDTO.getMonthId()));
//2.根据类型判断是查询组织数据还是网格数据
//组织层级数据
if (FactConstant.AGENCY.equals(formDTO.getOrgType())) {
//3.根据组织Id查询组织信息
CompartmentResultDTO agency = screenCustomerAgencyDao.getAgencyAreaInfo(formDTO.getOrgId());
if (null == agency) {
//throw new RenException(String.format("根据组织Id未查询到组织信息,组织Id:%s", formDTO.getOrgId()));
return resultList;
}
//4.根据组织级别判断查询哪类数据表
//区县级、乡镇街道级
if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) {
//4-1.查询过去12个月党建能力、治理能力、服务能力每月总分、本级得分、下级得分数据
list = factIndexAgencyScoreDao.selectMonthScoreList(formDTO);
//社区级
} else if ("community".equals(agency.getLevel())) {
//4-1.查询过去12个月党建能力、治理能力、服务能力每月总分、本级得分、下级得分数据
list = factIndexCommunityScoreDao.selectCommunityMonthScoreList(formDTO);
} else {
//throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getOrgId()));
return resultList;
}
//网格层级数据
} else if (FactConstant.GRID.equals(formDTO.getOrgType())) {
//5.查询网格过去12个月党建能力、治理能力、服务能力每月总分、本级得分、下级得分数据
list = factIndexGridScoreDao.selectGridMonthScoreList(formDTO);
} else {
throw new RenException(String.format("能力指数查询,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType()));
}
//5.封装数据并返回
for (MonthScoreListResultDTO.ScoreListResultDTO l : list) {
if (FactConstant.DJNL.equals(l.getIndexCode())) {
djList.add(l);
} else if (FactConstant.ZLNL.equals(l.getIndexCode())) {
zlList.add(l);
} else if (FactConstant.FWNL.equals(l.getIndexCode())) {
fwList.add(l);
}
}
MonthScoreListResultDTO dj = new MonthScoreListResultDTO();
dj.setIndexCode(FactConstant.DJNL);
dj.setScoreList(djList);
if (null != djList) {
resultList.add(dj);
}
MonthScoreListResultDTO zl = new MonthScoreListResultDTO();
zl.setIndexCode(FactConstant.ZLNL);
zl.setScoreList(zlList);
if (null != zlList) {
resultList.add(zl);
}
MonthScoreListResultDTO fw = new MonthScoreListResultDTO();
fw.setIndexCode(FactConstant.FWNL);
fw.setScoreList(fwList);
if (null != fwList) {
resultList.add(fw);
}
return resultList;
}
/**
@ -122,30 +286,61 @@ public class FactIndexServiceImpl implements FactIndexService {
@Override
public List<AblityListResultDTO> ablityList(AblityListFormDTO formDTO) {
List<AblityListResultDTO> resultList = new ArrayList<>();
//按月份查询当前组织各项指标数据 fact_index_agency_sub_score
//1.根据组织Id查询组织信息
CompartmentResultDTO agency = screenCustomerAgencyDao.getAgencyAreaInfo(formDTO.getAgencyId());
if (null == agency) {
throw new RenException(String.format("根据组织Id未查询到组织信息,组织Id:%s", formDTO.getAgencyId()));
}
//2.根据组织级别拼接查询条件,判断查询不同数据表
//区县级、乡镇街道级
if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) {
if ("district".equals(agency.getLevel())) {
formDTO.setAllParentIndexCode(FactConstant.QUAN_QU_XIANG_GUAN + ":" + formDTO.getIndexCode());
} else {
formDTO.setAllParentIndexCode(FactConstant.JIE_DAO_XIANG_GUAN + ":" + formDTO.getIndexCode());
//1.根据类型判断是查询组织数据还是网格数据
//组织层级数据
if (FactConstant.AGENCY.equals(formDTO.getOrgType())) {
//2.根据组织Id查询组织信息
CompartmentResultDTO agency = screenCustomerAgencyDao.getAgencyAreaInfo(formDTO.getOrgId());
if (null == agency) {
//throw new RenException(String.format("根据组织Id未查询到组织信息,组织Id:%s", formDTO.getOrgId()));
return resultList;
}
resultList = factIndexAgencySubScoreDao.selectAblityList(formDTO);
//3.根据组织级别拼接查询条件,判断查询不同数据表
//区县级、乡镇街道级
if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) {
if ("district".equals(agency.getLevel())) {
formDTO.setAllParentIndexCode(FactConstant.QUAN_QU_XIANG_GUAN + ":" + formDTO.getIndexCode());
} else {
formDTO.setAllParentIndexCode(FactConstant.JIE_DAO_XIANG_GUAN + ":" + formDTO.getIndexCode());
}
resultList = factIndexAgencySubScoreDao.selectAblityList(formDTO);
//社区级
} else if ("community".equals(agency.getLevel())) {
formDTO.setAllParentIndexCode(FactConstant.SHE_QU_XIANG_GUAN + ":" + formDTO.getIndexCode());
resultList = factIndexCommunitySubScoreDao.selectCommunityAblityList(formDTO);
//社区级
} else if ("community".equals(agency.getLevel())) {
formDTO.setAllParentIndexCode(FactConstant.SHE_QU_XIANG_GUAN + ":" + formDTO.getIndexCode());
resultList = factIndexCommunitySubScoreDao.selectCommunityAblityList(formDTO);
} else {
//throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getOrgId()));
return resultList;
}
//网格层级数据
} else if (FactConstant.GRID.equals(formDTO.getOrgType())) {
//4.查询网格层级各项能力对应指标数据
formDTO.setAllParentIndexCode(FactConstant.WANG_GE_XIANG_GUAN + ":" + formDTO.getIndexCode());
resultList = factIndexGridSubScoreDao.selectGridAblityList(formDTO);
} else {
throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getAgencyId()));
throw new RenException(String.format("按月查询各项指标数据,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType()));
}
//3.调用方法判断各项指标是数字指标还是百分比指标 //TODO
//4.查询指标字典表数据
List<IndexDictResultDTO> list = indexDictDao.selectList();
//5.遍历数据,判断数据类型并处理
resultList.forEach(result -> {
list.stream().filter(dto -> dto.getIndexCode().equals(result.getKey())).forEach(l -> {
result.setShowType(l.getValueType());
//小数类型,四舍五入保留小数点后一位
if (FactConstant.DECIMAL.equals(l.getValueType())) {
BigDecimal num = new BigDecimal(result.getValue()).setScale(1, BigDecimal.ROUND_HALF_UP);
result.setValue(num.toString());
}
//百分数类型,四舍五入保留小数点后一位并转成百分比
if (FactConstant.PERCENT.equals(l.getValueType())) {
BigDecimal num = new BigDecimal(result.getValue()).setScale(1, BigDecimal.ROUND_HALF_UP);
result.setValue(num + "%");
}
});
});
return resultList;
}
@ -159,28 +354,61 @@ public class FactIndexServiceImpl implements FactIndexService {
LinkedList<MonthAblityListResultDTO> resultList = new LinkedList<>();
//1.计算所查月份前12个月的monthId
formDTO.setStartMonthId(getDate(formDTO.getMonthId()));
//2.根据组织Id查询组织信息
CompartmentResultDTO agency = screenCustomerAgencyDao.getAgencyAreaInfo(formDTO.getAgencyId());
if (null == agency) {
throw new RenException(String.format("查询到组织信息失败,组织Id:%s", formDTO.getAgencyId()));
//2.根据类型判断是查询组织数据还是网格数据
//组织层级数据
if (FactConstant.AGENCY.equals(formDTO.getOrgType())) {
//3.根据组织Id查询组织信息
CompartmentResultDTO agency = screenCustomerAgencyDao.getAgencyAreaInfo(formDTO.getOrgId());
if (null == agency) {
//throw new RenException(String.format("查询组织信息失败,组织Id:%s", formDTO.getOrgId()));
return resultList;
}
//4.根据组织级别拼接查询条件,判断查询不同数据表
//区县级、乡镇街道级
if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) {
resultList = factIndexAgencySubScoreDao.selectMonthAblityList(formDTO);
//社区级
} else if ("community".equals(agency.getLevel())) {
resultList = factIndexCommunitySubScoreDao.selectCommunityMonthAblityList(formDTO);
} else {
//throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getOrgId()));
return resultList;
}
//网格层级数据
} else if (FactConstant.GRID.equals(formDTO.getOrgType())) {
//5.查询网格层级某项能力对应的一项指标过去12个月份数据
resultList = factIndexGridSubScoreDao.selectGridMonthAblityList(formDTO);
} else {
throw new RenException(String.format("按月查询各项指标最近12个月数据,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType()));
}
//3.根据组织级别拼接查询条件,判断查询不同数据表
//区县级、乡镇街道级
if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) {
resultList = factIndexAgencySubScoreDao.selectMonthAblityList(formDTO);
//6.查询指标字典表具体数据
IndexDictResultDTO dictDTO = indexDictDao.selectIndexDict(formDTO.getKey());
if (null == dictDTO) {
throw new RenException(String.format("根据评价指标indexCode未查询到字典表数据,indexCode值:%s", formDTO.getKey()));
}
//社区级
} else if ("community".equals(agency.getLevel())) {
resultList = factIndexCommunitySubScoreDao.selectCommunityMonthAblityList(formDTO);
} else {
throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getAgencyId()));
//7.遍历数据,判断数据类型并处理
//小数或百分数类型,四舍五入保留小数点后一位
if (FactConstant.DECIMAL.equals(dictDTO.getValueType()) || FactConstant.PERCENT.equals(dictDTO.getValueType())) {
resultList.forEach(result -> {
BigDecimal num = new BigDecimal(result.getAblity()).setScale(1, BigDecimal.ROUND_HALF_UP);
result.setAblity(num.toString());
});
}
//3.调用方法判断各项指标是数字指标还是百分比指标//TODO
return resultList;
}
/**
* @param newDate
* @Description 计算monthId对应一年前的monthId
* @author sun
*/
public String getDate(String newDate) {
if (!validDateEffecitive(newDate)) {
throw new RenException(String.format("monthId格式错误,monthId:%s", newDate));
}
String date = "";
SimpleDateFormat sdf = new SimpleDateFormat("yyyymm");
try {
@ -194,14 +422,41 @@ public class FactIndexServiceImpl implements FactIndexService {
return date;
}
/**
* @param newDate
* @Description 校验日期格式是否正确
* @author sun
*/
public boolean validDateEffecitive(String newDate) {
//yyyy-MM-dd格式
//String DATE_REGEX = "^([1-9]\\d{3}-)(([0]{0,1}[1-9]-)|([1][0-2]-))(([0-3]{0,1}[0-9]))$";
//yyyymm格式
String DATE_REGEX = "^([1-9]\\d{3})(([0]{0,1}[1-9])|([1][0-2]))$";
boolean matches = Pattern.matches(DATE_REGEX, newDate);
if (!matches) {
return matches;
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyymm");
//设置日期格式转的严谨性
sdf.setLenient(false);
try {
sdf.parse(newDate);
} catch (ParseException e) {
e.printStackTrace();
return false;
}
return matches;
}
/**
* @param formDTO
* @Description 同级对比各项数据查询
* @author sun
*/
@Override
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
public List<PeerComparisonResultDTO> peerComparison(PeerComparisonFormDTO formDTO) {
//1.根据组织Id的上级组织Id查询同级组织对应类型的得分排名(查询最近一个月数据)
//1.根据组织或网格Id的上级组织Id查询同级组织或网格对应类型的得分排名(查询最近一个月数据)
List<PeerComparisonResultDTO> resultList = screenIndexDataMonthlyDao.selectScoreList(formDTO);
return resultList;
}
@ -212,6 +467,7 @@ public class FactIndexServiceImpl implements FactIndexService {
* @author sun
*/
@Override
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
public RootAgencyResultDTO rootAgency(RootAgencyFormDTO formDTO) {
RootAgencyResultDTO resultDTO = new RootAgencyResultDTO();
//1.根据agencyId查询是否为根级组织

10
epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml

@ -140,4 +140,12 @@ pagehelper:
dingTalk:
robot:
webHook: @dingTalk.robot.webHook@
secret: @dingTalk.robot.secret@
secret: @dingTalk.robot.secret@
jwt:
token:
#秘钥
secret: 7016867071f0ebf1c46f123eaaf4b9d6[elink.epmet]
#token有效时长,默认7天,单位秒
expire: 604800

60
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml

@ -3,8 +3,66 @@
<mapper namespace="com.epmet.datareport.dao.fact.FactIndexAgencyScoreDao">
<select id="selectScore" resultType="com.epmet.evaluationindex.screen.dto.result.ScoreListResultDTO">
<select id="selectAblityIndex" resultType="com.epmet.evaluationindex.screen.dto.result.AblityIndexResultDTO$ScoreListResultDTO">
SELECT
fact.month_id AS "monthId",
ROUND(fact.score, 1) AS "indexTotal",
fact.index_code AS "indexCode"
FROM
fact_index_agency_score fact
WHERE
fact.del_flag = '0'
AND fact.is_total = '0' <!-- 表示只查询三大能力的数据 -->
AND fact.customer_id = #{customerId}
AND fact.agency_id = #{orgId}
AND fact.month_id &gt; #{startMonthId}
AND fact.month_id &lt;= #{monthId}
ORDER BY
fact.month_id ASC
</select>
<select id="selectScoreList" resultType="com.epmet.evaluationindex.screen.dto.result.ScoreListResultDTO">
SELECT
fact.index_code AS "indexCode",
ROUND(fact.score, 1) AS "indexTotal",
ROUND(self.self_score, 1) AS "agencyScore",
ROUND(self.sub_score, 1) AS "subAgencyScore"
FROM
fact_index_agency_score fact
INNER JOIN fact_index_agency_self_sub_score self ON fact.agency_id = self.agency_id
AND fact.month_id = self.month_id
AND fact.index_code = self.parent_index_code
WHERE
fact.del_flag = '0'
AND self.del_flag = '0'
AND fact.is_total = '0' <!-- 表示只查询三大能力的数据 -->
AND fact.customer_id = #{customerId}
AND fact.agency_id = #{orgId}
AND fact.month_id = #{monthId}
</select>
<select id="selectMonthScoreList" resultType="com.epmet.evaluationindex.screen.dto.result.MonthScoreListResultDTO$ScoreListResultDTO">
SELECT
fact.month_id AS "monthId",
ROUND(fact.score, 1) AS "indexTotal",
ROUND(self.self_score, 1) AS "agencyScore",
ROUND(self.sub_score, 1) AS "subAgencyScore",
fact.index_code AS "indexCode"
FROM
fact_index_agency_score fact
INNER JOIN fact_index_agency_self_sub_score self ON fact.agency_id = self.agency_id
AND fact.month_id = self.month_id
AND fact.index_code = self.parent_index_code
WHERE
fact.del_flag = '0'
AND self.del_flag = '0'
AND fact.is_total = '0' <!-- 表示只查询三大能力的数据 -->
AND fact.customer_id = #{customerId}
AND fact.agency_id = #{orgId}
AND fact.month_id &gt; #{startMonthId}
AND fact.month_id &lt;= #{monthId}
ORDER BY
fact.month_id ASC
</select>
</mapper>

4
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml

@ -16,7 +16,7 @@
AND dict.del_flag = '0'
AND fact.all_parent_index_code = #{allParentIndexCode}
AND customer_id = #{customerId}
AND agency_id = #{agencyId}
AND agency_id = #{orgId}
AND month_id = #{monthId}
</select>
@ -31,7 +31,7 @@
fact.del_flag = '0'
AND dict.del_flag = '0'
AND customer_id = #{customerId}
AND agency_id = #{agencyId}
AND agency_id = #{orgId}
AND month_id &lt;= #{monthId}
AND month_id &gt; #{startMonthId}
AND fact.index_code = #{key}

68
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunityScoreDao.xml

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.datareport.dao.fact.FactIndexCommunityScoreDao">
<select id="selectCommunityAblityIndex" resultType="com.epmet.evaluationindex.screen.dto.result.AblityIndexResultDTO$ScoreListResultDTO">
SELECT
fact.month_id AS "monthId",
ROUND(fact.score, 1) AS "indexTotal",
fact.index_code AS "indexCode"
FROM
fact_index_community_score fact
WHERE
fact.del_flag = '0'
AND fact.is_total = '0' <!-- 表示只查询三大能力的数据 -->
AND fact.customer_id = #{customerId}
AND fact.agency_id = #{orgId}
AND fact.month_id &gt; #{startMonthId}
AND fact.month_id &lt;= #{monthId}
ORDER BY
fact.month_id ASC
</select>
<select id="selectCommunityScoreList" resultType="com.epmet.evaluationindex.screen.dto.result.ScoreListResultDTO">
SELECT
fact.index_code AS "indexCode",
ROUND(fact.score, 1) AS "indexTotal",
ROUND(self.self_score, 1) AS "agencyScore",
ROUND(self.sub_score, 1) AS "subAgencyScore"
FROM
fact_index_community_score fact
INNER JOIN fact_index_community_self_sub_score self ON fact.agency_id = self.agency_id
AND fact.month_id = self.month_id
AND fact.index_code = self.parent_index_code
WHERE
fact.del_flag = '0'
AND self.del_flag = '0'
AND fact.is_total = '0' <!-- 表示只查询三大能力的数据 -->
AND fact.customer_id = #{customerId}
AND fact.agency_id = #{orgId}
AND fact.month_id = #{monthId}
</select>
<select id="selectCommunityMonthScoreList" resultType="com.epmet.evaluationindex.screen.dto.result.MonthScoreListResultDTO$ScoreListResultDTO">
SELECT
fact.month_id AS "monthId",
ROUND(fact.score, 1) AS "indexTotal",
ROUND(self.self_score, 1) AS "agencyScore",
ROUND(self.sub_score, 1) AS "subAgencyScore",
fact.index_code AS "indexCode"
FROM
fact_index_community_score fact
INNER JOIN fact_index_community_self_sub_score self ON fact.agency_id = self.agency_id
AND fact.month_id = self.month_id
AND fact.index_code = self.parent_index_code
WHERE
fact.del_flag = '0'
AND self.del_flag = '0'
AND fact.is_total = '0' <!-- 表示只查询三大能力的数据 -->
AND fact.customer_id = #{customerId}
AND fact.agency_id = #{orgId}
AND fact.month_id &gt; #{startMonthId}
AND fact.month_id &lt;= #{monthId}
ORDER BY
fact.month_id ASC
</select>
</mapper>

4
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml

@ -16,7 +16,7 @@
AND dict.del_flag = '0'
AND fact.all_parent_index_code = #{allParentIndexCode}
AND customer_id = #{customerId}
AND agency_id = #{agencyId}
AND agency_id = #{orgId}
AND month_id = #{monthId}
</select>
@ -31,7 +31,7 @@
fact.del_flag = '0'
AND dict.del_flag = '0'
AND customer_id = #{customerId}
AND agency_id = #{agencyId}
AND agency_id = #{orgId}
AND month_id &lt;= #{monthId}
AND month_id &gt; #{startMonthId}
AND fact.index_code = #{key}

70
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridScoreDao.xml

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.datareport.dao.fact.FactIndexGridScoreDao">
<select id="selectGridAblityIndex" resultType="com.epmet.evaluationindex.screen.dto.result.AblityIndexResultDTO$ScoreListResultDTO">
SELECT
fact.month_id AS "monthId",
ROUND(fact.score, 1) AS "indexTotal",
fact.index_code AS "indexCode"
FROM
fact_index_grid_score fact
WHERE
fact.del_flag = '0'
AND fact.is_total = '0' <!-- 表示只查询三大能力的数据 -->
AND fact.customer_id = #{customerId}
AND fact.grid_id = #{orgId}
AND fact.month_id &gt; #{startMonthId}
AND fact.month_id &lt;= #{monthId}
ORDER BY
fact.month_id ASC
</select>
<select id="selectGridScoreList" resultType="com.epmet.evaluationindex.screen.dto.result.ScoreListResultDTO">
SELECT
fact.index_code AS "indexCode",
ROUND(fact.score, 1) AS "indexTotal",
ROUND(self.self_score, 1) AS "agencyScore",
ROUND(self.sub_score, 1) AS "subAgencyScore"
FROM
fact_index_grid_score fact
INNER JOIN fact_index_grid_self_sub_score self ON fact.grid_id = self.grid_id
AND fact.agency_id = self.agency_id
AND fact.month_id = self.month_id
AND fact.index_code = self.parent_index_code
WHERE
fact.del_flag = '0'
AND self.del_flag = '0'
AND fact.is_total = '0' <!-- 表示只查询三大能力的数据 -->
AND fact.customer_id = #{customerId}
AND fact.grid_id = #{orgId}
AND fact.month_id = #{monthId}
</select>
<select id="selectGridMonthScoreList" resultType="com.epmet.evaluationindex.screen.dto.result.MonthScoreListResultDTO$ScoreListResultDTO">
SELECT
fact.month_id AS "monthId",
ROUND(fact.score, 1) AS "indexTotal",
ROUND(self.self_score, 1) AS "agencyScore",
ROUND(self.sub_score, 1) AS "subAgencyScore",
fact.index_code AS "indexCode"
FROM
fact_index_grid_score fact
INNER JOIN fact_index_grid_self_sub_score self ON fact.grid_id = self.grid_id
AND fact.agency_id = self.agency_id
AND fact.month_id = self.month_id
AND fact.index_code = self.parent_index_code
WHERE
fact.del_flag = '0'
AND self.del_flag = '0'
AND fact.is_total = '0' <!-- 表示只查询三大能力的数据 -->
AND fact.customer_id = #{customerId}
AND fact.grid_id = #{orgId}
AND fact.month_id &gt; #{startMonthId}
AND fact.month_id &lt;= #{monthId}
ORDER BY
fact.month_id ASC
</select>
</mapper>

42
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.datareport.dao.fact.FactIndexGridSubScoreDao">
<select id="selectGridAblityList" resultType="com.epmet.evaluationindex.screen.dto.result.AblityListResultDTO">
SELECT
fact.index_code AS "key",
IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "value",
dict.index_name AS "name"
FROM
fact_index_grid_sub_score fact
LEFT JOIN index_dict dict ON fact.index_code = dict.index_code
WHERE
fact.del_flag = '0'
AND dict.del_flag = '0'
AND fact.all_parent_index_code = #{allParentIndexCode}
AND customer_id = #{customerId}
AND grid_id = #{orgId}
AND month_id = #{monthId}
</select>
<select id="selectGridMonthAblityList" resultType="com.epmet.evaluationindex.screen.dto.result.MonthAblityListResultDTO">
SELECT
fact.month_id AS "monthId",
IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "ablity"
FROM
fact_index_grid_sub_score fact
LEFT JOIN index_dict dict ON fact.index_code = dict.index_code
WHERE
fact.del_flag = '0'
AND dict.del_flag = '0'
AND customer_id = #{customerId}
AND grid_id = #{orgId}
AND month_id &lt;= #{monthId}
AND month_id &gt; #{startMonthId}
AND fact.index_code = #{key}
ORDER BY
fact.month_id ASC
</select>
</mapper>

30
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/IndexDictDao.xml

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.datareport.dao.fact.IndexDictDao">
<select id="selectList" resultType="com.epmet.evaluationindex.screen.dto.result.IndexDictResultDTO">
SELECT
index_name AS "indexName",
index_code AS "indexCode",
value_type AS "valueType"
FROM
index_dict
WHERE
del_flag = '0'
</select>
<select id="selectIndexDict" resultType="com.epmet.evaluationindex.screen.dto.result.IndexDictResultDTO">
SELECT
index_name AS "indexName",
index_code AS "indexCode",
value_type AS "valueType"
FROM
index_dict
WHERE
del_flag = '0'
AND index_code = #{indexCode}
LIMIT 1
</select>
</mapper>

2
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml

@ -16,6 +16,7 @@
WHERE
del_flag = 0
AND pid = '0'
AND IS_DISPLAY = '1'
AND customer_id = #{customerId}
</select>
@ -31,6 +32,7 @@
screen_customer_agency
WHERE
del_flag = '0'
AND IS_DISPLAY = '1'
AND pids = #{subAgencyPids}
ORDER BY
created_time DESC

1
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml

@ -77,6 +77,7 @@
screen_customer_grid
WHERE
del_flag = '0'
AND IS_DISPLAY = '1'
AND parent_agency_id = #{agencyId}
ORDER BY
created_time DESC

77
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml

@ -61,21 +61,30 @@
LIMIT #{topNum}
</select>
<!-- 下级部门指数排行 安宁 --->
<select id="selectAnNingSubAgencyIndexMonthlyRank" parameterType="com.epmet.evaluationindex.screen.dto.form.AnNingSubAgencyIndexRankFormDTO"
<!-- 下级部门指数排行(不包含部门) 安宁 --->
<select id="selectSubAgencyOrGridIndexMonthlyRank" parameterType="com.epmet.evaluationindex.screen.dto.form.SubAgencyIndexRankYMFormDTO"
resultType="com.epmet.evaluationindex.screen.dto.result.AnNingSubAgencyIndexRankResultDTO">
SELECT
org_name AS `NAME`,
service_ablity * SERVICE_ABLITY_WEIGHT AS serviceAbility,
party_dev_ablity * PARTY_DEV_WEIGHT AS partyDevAbility,
govern_ablity * GOVERN_ABLITY_WEIGHT AS governAbility,
ORG_ID orgId
ORG_ID orgId,
ORG_TYPE orgType
FROM
screen_index_data_monthly
WHERE
del_flag = '0'
AND parent_id = #{agencyId}
AND month_id = left(replace(DATE_SUB( CURDATE(),INTERVAL 1 MONTH),'-',''),6)
AND month_id = #{monthId,jdbcType=VARCHAR}
<choose>
<when test="orgType != null and orgType != ''">
AND ORG_TYPE = #{orgType,jdbcType=VARCHAR}
</when>
<otherwise>
AND ORG_TYPE != 'department'
</otherwise>
</choose>
<if test="sort == 'asc'">
ORDER BY index_total ASC
</if>
@ -108,22 +117,22 @@
<select id="selectScoreList" resultType="com.epmet.evaluationindex.screen.dto.result.PeerComparisonResultDTO">
SELECT
org_id AS "agencyId",
org_name AS "agencyName",
org_id AS "orgId",
org_name AS "orgName",
<if test="indexCode != null and indexCode != '' and indexCode == 'dangjiannengli'">
round((party_dev_ablity * party_dev_weight),2) AS "score"
round((party_dev_ablity * party_dev_weight),1) AS "score"
</if>
<if test="indexCode != null and indexCode != '' and indexCode == 'zhilinengli'">
round((govern_ablity * govern_ablity_weight),2) AS "score"
round((govern_ablity * govern_ablity_weight),1) AS "score"
</if>
<if test="indexCode != null and indexCode != '' and indexCode == 'fuwunengli'">
round((service_ablity * service_ablity_weight),2) AS "score"
round((service_ablity * service_ablity_weight),1) AS "score"
</if>
FROM
screen_index_data_monthly
WHERE
del_flag = '0'
AND org_type = 'agency'
AND org_type = #{orgType}
AND customer_id = #{customerId}
AND parent_id = (
select
@ -132,9 +141,9 @@
screen_index_data_monthly
where
del_flag = '0'
and org_type = 'agency'
and org_type = #{orgType}
and customer_id = #{customerId}
and org_id = #{agencyId}
and org_id = #{orgId}
order by
created_time desc
limit 1
@ -163,4 +172,48 @@
</if>
LIMIT #{pageSize}
</select>
<select id="selectMonthData" resultType="com.epmet.evaluationindex.screen.dto.result.IndexScoreResultDTO">
SELECT
index_total AS "total",
(party_dev_ablity * party_dev_weight) AS "party",
party_dev_weight AS "partyDevAbilityWeight",
(govern_ablity * govern_ablity_weight) AS "govern",
govern_ablity_weight AS "governAbilityWeight",
(service_ablity * service_ablity_weight) AS "service",
service_ablity_weight AS "serviceAbilityWeight"
FROM
screen_index_data_monthly
WHERE
del_flag = '0'
AND org_id = #{orgId}
<if test="orgType != null and orgType != '' ">
AND org_type = #{orgType}
</if>
AND month_id = #{monthId}
</select>
<select id="selectRankList" resultType="com.epmet.evaluationindex.screen.dto.result.IndexAdvanceBranchRankResultDTO">
SELECT
dm.org_name AS "name",
dm.index_total AS "totalScore",
rd.party_total AS "partyMemberNum",
rd.issue_total AS "issueNum",
rd.project_total AS "projectNum",
rd.close_project_ratio AS "closedProjectRatio",
rd.satisfaction_ratio AS "satisfactionRatio"
FROM
screen_index_data_monthly dm
INNER JOIN screen_org_rank_data rd ON dm.org_id = rd.org_id
AND dm.month_id = rd.month_id
WHERE
dm.del_flag = '0'
AND rd.del_flag = '0'
AND dm.org_type = 'grid'
AND dm.month_id = #{monthId}
AND dm.all_parent_ids LIKE concat('%', #{agencyId}, '%')
ORDER BY dm.index_total DESC
LIMIT #{topNum}
</select>
</mapper>

14
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataYearlyDao.xml

@ -13,26 +13,34 @@
screen_index_data_yearly
WHERE
del_flag = '0'
AND org_type = 'agency'
AND org_id = #{agencyId}
AND year_id = DATE_FORMAT(NOW(),'%Y')
</select>
<!-- 下级部门指数排行 安宁 --->
<select id="selectAnNingSubAgencyIndexYearlyRank" parameterType="com.epmet.evaluationindex.screen.dto.form.AnNingSubAgencyIndexRankFormDTO"
<select id="selectAnNingSubAgencyIndexYearlyRank" parameterType="com.epmet.evaluationindex.screen.dto.form.SubAgencyIndexRankYMFormDTO"
resultType="com.epmet.evaluationindex.screen.dto.result.AnNingSubAgencyIndexRankResultDTO">
SELECT
org_name AS `NAME`,
govern_ablity AS governAbility,
party_dev_ablity AS partyDevAbility,
service_ablity AS serviceAbility,
ORG_ID orgId
ORG_ID orgId,
ORG_TYPE orgType
FROM
screen_index_data_yearly
WHERE
del_flag = '0'
AND parent_id = #{agencyId}
AND year_id = YEAR(CURDATE())
<choose>
<when test="orgType != null and orgType != ''">
AND ORG_TYPE = #{orgType,jdbcType=VARCHAR}
</when>
<otherwise>
AND ORG_TYPE != 'department'
</otherwise>
</choose>
<if test="sort == 'asc'">
ORDER BY index_total ASC
</if>

54
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml

@ -44,4 +44,58 @@
and ur.CUSTOMER_ID = #{customerId}
order by ur.POINT_TOTAL desc
</select>
<select id="selectAgencyUserPointList" resultType="com.epmet.evaluationindex.screen.dto.result.UserPointRankListResultDTO">
SELECT
org_id AS "agencyId",
org_name AS "agencyName",
grid_id AS "gridId",
grid_name AS "gridName",
user_id AS "userId",
user_name AS "userName",
point_total AS "pointTotal"
FROM
screen_party_user_rank_data
WHERE
del_flag = '0'
<if test="orgType != null and orgType !=''">
<if test="orgType == 'agency'">
AND all_parent_ids LIKE CONCAT('%',#{orgId},'%')
</if>
<if test="orgType == 'grid'">
AND grid_id = #{orgId}
</if>
</if>
ORDER BY
point_total DESC
LIMIT #{topNum}
</select>
<select id="selectPartymemberPointList" resultType="com.epmet.evaluationindex.screen.dto.result.PartIndexScroeRankResultDTO">
SELECT
org_id AS "agencyId",
org_name AS "agencyName",
grid_id AS "gridId",
grid_name AS "gridName",
user_id AS "userId",
user_name AS "userName",
round(index_score, 1) AS "indexScore"
FROM
screen_party_user_rank_data
WHERE
del_flag = '0'
AND party_flag = '1'<!-- 是否是党员标志:1是。0不是党员 -->
<if test="orgType != null and orgType !=''">
<if test="orgType == 'agency'">
AND all_parent_ids LIKE CONCAT('%',#{orgId},'%')
</if>
<if test="orgType == 'grid'">
AND grid_id = #{orgId}
</if>
</if>
ORDER BY
index_score DESC
LIMIT #{topNum}
</select>
</mapper>

2
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml

@ -7,7 +7,7 @@
<select id="selectUserJoinData" resultType="com.epmet.evaluationindex.screen.dto.result.UserJoinIndicatorGrowthRateResultDTO">
SELECT
JOIN_TOTAL AS total,
AVG_JOIN AS averageJoin,
ROUND( AVG_JOIN, 1 ) AS averageJoin,
JOIN_TOTAL_UP_RATE AS monthIncr,
JOIN_TOTAL_UP_FLAG AS monthTrend,
AVG_ISSUE AS averageIssue,

4
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java

@ -12,5 +12,7 @@ public interface DataSourceConstant {
String RESI_GROUP = "resiGroup";
String EPMET_USER = "epmetuser";
String EVALUATION_INDEX = "evaluationIndex";
String PARTY_MEMBER = "partyMember";
String EPMET_HEART="epmetHeart";
String EPMET_POINT = "epmetPoint";
}

39
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/ExtractConstant.java

@ -0,0 +1,39 @@
package com.epmet.constant;
/**
* @Author zxc
* @DateTime 2020/9/16 3:56 下午
*/
public interface ExtractConstant {
String PARTY = "党员";
String STRANGER = "陌生人";
String ISSUE_INFO = "查询议题信息为空";
String CREATED_TOPIC_USER_IDENTITY = "查询创建话题用户身份信息为空";
String PARENT_AGENCY_ID_LIST = "查询组织上级ID集合为空......";
String ISSUE_PROCESS = "查询查询议题process集合为空";
String SHIFT_PROJECT = "shift_project";
String CLOSE = "close";
String CLOSED = "closed";
String GRID_ORG_TYPE = "grid";
String RETURN_ACTION_CODE = "return";
String EVALUATE_BAD = "bad";
String EVALUATE_GOOD = "good";
String EVALUATE_PERFECT = "perfect";
String CUSTOMER_INFO_NULL = "客户【%s】未查出网格信息";
}

11
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/OrgSourceTypeConstant.java

@ -0,0 +1,11 @@
package com.epmet.constant;
public interface OrgSourceTypeConstant {
// 外部
String EXTERNAL = "external";
// 内部
String INTERNAL = "internal";
}

19
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/ProjectEvaluateConstant.java

@ -0,0 +1,19 @@
package com.epmet.constant;
import com.epmet.commons.tools.constant.NumConstant;
/**
* @Author zxc
* @DateTime 2020/9/18 3:49 下午
*/
public interface ProjectEvaluateConstant {
// BigDecimal BAD = new BigDecimal(NumConstant.SIXTY);
// BigDecimal GOOD = new BigDecimal(NumConstant.EIGHTY);
// BigDecimal PERFECT = new BigDecimal(NumConstant.ONE_HUNDRED);
Integer BAD = NumConstant.SIXTY;
Integer GOOD = NumConstant.EIGHTY;
Integer PERFECT = NumConstant.ONE_HUNDRED;
}

29
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/ScreenConstant.java

@ -0,0 +1,29 @@
package com.epmet.constant;
/**
* @Author zxc
* @DateTime 2020/9/22 2:19 下午
*/
public interface ScreenConstant {
String COMMUNITY = "community";
String STREET = "street";
String DISTRICT = "district";
String CITY = "city";
String PROVINCE = "province";
String LEVEL = "level";
String STR_NULL = "";
String ENGLISH_COMMA = ",";
String GRID = "grid";
String AGENCY = "agency";
}

13
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/StatsConstant.java

@ -0,0 +1,13 @@
package com.epmet.constant;
/**
* @Author zxc
* @DateTime 2020/9/17 2:56 下午
*/
public interface StatsConstant {
String PARTY_INFO_LIST = "客户【%s】查询党员信息集合为空......";
String CUSTOMER_INFO_NULL = "查询所有客户ID为空";
}

91
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/DimObjectActionDTO.java

@ -0,0 +1,91 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.extract;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 对象行为动作维度表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-15
*/
@Data
public class DimObjectActionDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 行为code
*/
private String actionCode;
/**
* 行为描述
*/
private String actionDesc;
/**
* 行为类型 topic,issue,project,article,group
*/
private String actionType;
/**
* 父级ID(本表id)
*/
private String pid;
/**
* 删除标识
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

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

Loading…
Cancel
Save