Browse Source

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

# Conflicts:
#	epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java
#	epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerPartymemberDao.java
#	epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerPartymemberService.java
#	epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerPartymemberDao.xml
master
yinzuomei 5 years ago
parent
commit
0ed9c2921f
  1. 2
      epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/config/DynamicDataSource.java
  2. 6
      epmet-commons/epmet-commons-extapp-auth/pom.xml
  3. 32
      epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/annotation/InternalAppRequestAuth.java
  4. 122
      epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/aspect/ExternalAppRequestAuthAspect.java
  5. 41
      epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/jwt/JwtTokenProperties.java
  6. 130
      epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/jwt/JwtTokenUtils.java
  7. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java
  8. 6
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  9. 42
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityIndexFormDTO.java
  10. 42
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityListFormDTO.java
  11. 43
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthAblityListFormDTO.java
  12. 33
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthScoreListFormDTO.java
  13. 39
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/PeerComparisonFormDTO.java
  14. 25
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/RootAgencyFormDTO.java
  15. 38
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ScoreListFormDTO.java
  16. 17
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankYMFormDTO.java
  17. 51
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityIndexResultDTO.java
  18. 29
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java
  19. 5
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AnNingSubAgencyIndexRankResultDTO.java
  20. 25
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthAblityListResultDTO.java
  21. 48
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthScoreListResultDTO.java
  22. 29
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PeerComparisonResultDTO.java
  23. 26
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/RootAgencyResultDTO.java
  24. 33
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScoreListResultDTO.java
  25. 36
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/FactConstant.java
  26. 107
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/fact/FactIndexController.java
  27. 11
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java
  28. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java
  29. 6
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  30. 17
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java
  31. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataYearlyDao.java
  32. 50
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencyScoreDao.java
  33. 51
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencySubScoreDao.java
  34. 41
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunityScoreDao.java
  35. 51
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunitySubScoreDao.java
  36. 12
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridScoreDao.java
  37. 31
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridSubScoreDao.java
  38. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java
  39. 19
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java
  40. 18
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java
  41. 63
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/FactIndexService.java
  42. 277
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java
  43. 10
      epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml
  44. 33
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml
  45. 42
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml
  46. 29
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunityScoreDao.xml
  47. 42
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml
  48. 7
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridScoreDao.xml
  49. 7
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml
  50. 11
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml
  51. 68
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml
  52. 5
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataYearlyDao.xml
  53. 12
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/ScreenConstant.java
  54. 12
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactOriginProjectLogDailyDTO.java
  55. 10
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactOriginProjectMainDailyDTO.java
  56. 2
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/IssueLogDailyFormDTO.java
  57. 2
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/IssueMainDailyFormDTO.java
  58. 132
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/PartyBaseInfoFormDTO.java
  59. 2
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/AgencyInfoResultDTO.java
  60. 35
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/CustomerAgencyInfoResultDTO.java
  61. 3
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/IssueProcessInfoResultDTO.java
  62. 85
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/PartyInfoResultDTO.java
  63. 51
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/PartyMemberInfoResultDTO.java
  64. 35
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/UserCountResultDTO.java
  65. 12
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/ExtractGroupMemberActionRecordResultDTO.java
  66. 14
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/ProcessInfoDTO.java
  67. 2
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/DimCustomerPartyMemberFormDTO.java
  68. 2
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/result/GridBelongAgencyResultDTO.java
  69. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  70. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java
  71. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java
  72. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.java
  73. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencySelfSubScoreDao.java
  74. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunitySelfSubScoreDao.java
  75. 39
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/GridSelfSubScoreDao.java
  76. 30
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCpcBaseDataDao.java
  77. 27
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  78. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java
  79. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerPartymemberDao.java
  80. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserAgencyDailyDao.java
  81. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserGridDailyDao.java
  82. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectLogDailyEntity.java
  83. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectMainDailyEntity.java
  84. 25
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/AgencySelfSubScoreEntity.java
  85. 123
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/CommunitySelfSubScoreEntity.java
  86. 100
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexGridSelfSubScoreEntity.java
  87. 105
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/GridSelfSubScoreEntity.java
  88. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/project/ProjectProcessEntity.java
  89. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollCommunityServiceImpl.java
  90. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollStreetServiceImpl.java
  91. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java
  92. 17
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java
  93. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/GroupExtractService.java
  94. 35
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java
  95. 41
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java
  96. 69
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/GroupExtractServiceImpl.java
  97. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java
  98. 83
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java
  99. 263
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java
  100. 62
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java

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

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

@ -31,8 +31,11 @@ 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;
int ONE_THOUSAND = 1000;

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, "至少需要添加一个段落"),

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

@ -0,0 +1,42 @@
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 AblityIndexFormDTO implements Serializable {
private static final long serialVersionUID = -2880432640584616651L;
/**
* 查询月份的前12个月对应的monthId
*/
private String startMonthId;
/**
* 组织Id
*/
@NotBlank(message = "客户ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class})
private String customerId;
/**
* 组织Id
*/
@NotBlank(message = "组织ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class})
private String agencyId;
/**
* 月份Id格式202009
*/
@NotBlank(message = "月份ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class})
private String monthId;
/**
* 类型党建能力dangjiannengli治理能力zhilinengli服务能力fuwunengli
*/
private String indexCode;
public interface AddUserInternalGroup {}
}

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

@ -0,0 +1,42 @@
package com.epmet.evaluationindex.screen.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 按月查询各项指标数据--接口入参
* @Author sun
*/
@Data
public class AblityListFormDTO implements Serializable {
private static final long serialVersionUID = -2880432640584616651L;
/**
* 组织Id
*/
@NotBlank(message = "客户ID不能为空",groups = {AblityListFormDTO.AddUserInternalGroup.class})
private String customerId;
/**
* 组织Id
*/
@NotBlank(message = "组织ID不能为空",groups = {AblityListFormDTO.AddUserInternalGroup.class})
private String agencyId;
/**
* 月份Id格式202009
*/
@NotBlank(message = "月份ID不能为空",groups = {AblityListFormDTO.AddUserInternalGroup.class})
private String monthId;
/**
* 类型党建能力dangjiannengli治理能力zhilinengli服务能力fuwunengli
*/
@NotBlank(message = "类型不能为空",groups = {AblityListFormDTO.AddUserInternalGroup.class})
private String indexCode;
/**
* 所有有权重的指标code拼接的字符串 冒号隔开
*/
private String allParentIndexCode;
public interface AddUserInternalGroup {}
}

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

@ -0,0 +1,43 @@
package com.epmet.evaluationindex.screen.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 按月查询各项指标最近12个月数据--接口入参
* @Author sun
*/
@Data
public class MonthAblityListFormDTO implements Serializable {
private static final long serialVersionUID = -2880432640584616651L;
/**
* 组织Id
*/
@NotBlank(message = "客户ID不能为空",groups = {MonthAblityListFormDTO.AddUserInternalGroup.class})
private String customerId;
/**
* 组织Id
*/
@NotBlank(message = "组织ID不能为空",groups = {MonthAblityListFormDTO.AddUserInternalGroup.class})
private String agencyId;
/**
* 月份Id格式202009
*/
@NotBlank(message = "月份ID不能为空",groups = {MonthAblityListFormDTO.AddUserInternalGroup.class})
private String monthId;
/**
* 月份Id格式202009
*/
@NotBlank(message = "类型key不能为空",groups = {MonthAblityListFormDTO.AddUserInternalGroup.class})
private String key;
/**
* 查询月份的前12个月对应的monthId
*/
private String startMonthId;
public interface AddUserInternalGroup {}
}

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

@ -0,0 +1,33 @@
package com.epmet.evaluationindex.screen.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 能力指数--接口入参
* @Author sun
*/
@Data
public class MonthScoreListFormDTO implements Serializable {
private static final long serialVersionUID = -2880432640584616651L;
/**
* 组织Id
*/
@NotBlank(message = "客户ID不能为空",groups = {MonthScoreListFormDTO.AddUserInternalGroup.class})
private String customerId;
/**
* 组织Id
*/
@NotBlank(message = "组织ID不能为空",groups = {MonthScoreListFormDTO.AddUserInternalGroup.class})
private String agencyId;
/**
* 月份Id格式202009
*/
@NotBlank(message = "月份ID不能为空",groups = {MonthScoreListFormDTO.AddUserInternalGroup.class})
private String monthId;
public interface AddUserInternalGroup {}
}

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

@ -0,0 +1,39 @@
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 PeerComparisonFormDTO implements Serializable {
private static final long serialVersionUID = -2880432640584616651L;
/**
* 组织Id
*/
@NotBlank(message = "客户ID不能为空",groups = {PeerComparisonFormDTO.AddUserInternalGroup.class})
private String customerId;
/**
* 组织Id
*/
@NotBlank(message = "组织ID不能为空",groups = {PeerComparisonFormDTO.AddUserInternalGroup.class})
private String agencyId;
/**
* 类型党建能力dangjiannengli治理能力zhilinengli服务能力fuwunengli
*/
@NotBlank(message = "数据类型不能为空",groups = {PeerComparisonFormDTO.AddUserInternalGroup.class})
private String indexCode;
/**
* 查询条数
*/
@Min(value = 1, message = "查询条数必须大于0", groups = {PeerComparisonFormDTO.AddUserInternalGroup.class })
private Integer pageSize;
public interface AddUserInternalGroup {}
}

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

@ -0,0 +1,25 @@
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 RootAgencyFormDTO implements Serializable {
private static final long serialVersionUID = -2880432640584616651L;
/**
* 组织Id
*/
@NotBlank(message = "组织ID不能为空",groups = {RootAgencyFormDTO.AddUserInternalGroup.class})
private String agencyId;
public interface AddUserInternalGroup {}
}

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

@ -0,0 +1,38 @@
package com.epmet.evaluationindex.screen.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 按月份查询各项能力分数--接口入参
* @Author sun
*/
@Data
public class ScoreListFormDTO implements Serializable {
private static final long serialVersionUID = -2880432640584616651L;
/**
* 组织Id
*/
@NotBlank(message = "客户ID不能为空",groups = {ScoreListFormDTO.AddUserInternalGroup.class})
private String customerId;
/**
* 组织Id
*/
@NotBlank(message = "组织ID不能为空",groups = {ScoreListFormDTO.AddUserInternalGroup.class})
private String agencyId;
/**
* 月份Id格式202009
*/
@NotBlank(message = "月份ID不能为空",groups = {ScoreListFormDTO.AddUserInternalGroup.class})
private String monthId;
/**
* 类型党建能力dangjiannengli治理能力zhilinengli服务能力fuwunengli
*/
private String indexCode;
public interface AddUserInternalGroup {}
}

17
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,17 @@ 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;
}

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

@ -0,0 +1,51 @@
package com.epmet.evaluationindex.screen.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 能力指数--接口返参
* @Author sun
*/
@Data
public class AblityIndexResultDTO implements Serializable {
private static final long serialVersionUID = 3860268744336541373L;
/**
* 党建能力dangjiannengli治理能力zhilinengli服务能力fuwunengli
*/
private String indexCode;
/**
* 每项能力最近12月各项分数对象
*/
private List<AblityIndexResultDTO.ScoreListResultDTO> scoreList;
@Data
public static class ScoreListResultDTO implements Serializable {
/**
* 能力总分
*/
private Double indexTotal;
/**
* 本级能力分
*/
private Double agencyScore;
/**
* 下级能力分
*/
private Double subAgencyScore;
/**
* 横坐标202009
*/
private String monthId;
}
}

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

@ -0,0 +1,29 @@
package com.epmet.evaluationindex.screen.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* 按月查询各项指标数据--接口返参
* @Author sun
*/
@Data
public class AblityListResultDTO implements Serializable {
private static final long serialVersionUID = 3860268744336541373L;
/**
* 各项指标名称
*/
private String name;
/**
* 指标对应值数值或百分比
*/
private String value = "0";
/**
* 各项指标对应key值(index_dict字典表)
*/
private String key;
}

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

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

@ -0,0 +1,25 @@
package com.epmet.evaluationindex.screen.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* 按月查询各项指标最近12个月数据--接口返参
* @Author sun
*/
@Data
public class MonthAblityListResultDTO implements Serializable {
private static final long serialVersionUID = 3860268744336541373L;
/**
* 横坐标(202009)
*/
private String monthId;
/**
* 指标对应值数值或百分比
*/
private String ablity;
}

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

@ -0,0 +1,48 @@
package com.epmet.evaluationindex.screen.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 按月份查询各项能力最近12个月得分--接口返参
* @Author sun
*/
@Data
public class MonthScoreListResultDTO implements Serializable {
private static final long serialVersionUID = 3860268744336541373L;
/**
* 党建能力dangjiannengli治理能力zhilinengli服务能力fuwunengli
*/
private String indexCode;
/**
* 每项能力最近12月各项分数对象
*/
private List<MonthScoreListResultDTO.ScoreListResultDTO> scoreList;
@Data
public static class ScoreListResultDTO implements Serializable {
/**
* 能力总分
*/
private Double indexTotal;
/**
* 本级能力分
*/
private Double agencyScore;
/**
* 下级能力分
*/
private Double subAgencyScore;
/**
* 横坐标202009
*/
private String monthId;
}
}

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

@ -0,0 +1,29 @@
package com.epmet.evaluationindex.screen.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* 同级对比各项数据查询--接口返参
* @Author sun
*/
@Data
public class PeerComparisonResultDTO implements Serializable {
private static final long serialVersionUID = 3860268744336541373L;
/**
* 组织Id
*/
private String agencyId;
/**
* 组织名称
*/
private String agencyName;
/**
* 能力分值(保留一位小数)
*/
private Double score;
}

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

@ -0,0 +1,26 @@
package com.epmet.evaluationindex.screen.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* 是否根组织--接口返参
* @Author sun
*/
@Data
public class RootAgencyResultDTO implements Serializable {
private static final long serialVersionUID = 3860268744336541373L;
/**
* 是否根组织true false
*/
private Boolean isRoot = true;
/**
* 数据更新至上月月末时间
*/
private String date;
}

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

@ -0,0 +1,33 @@
package com.epmet.evaluationindex.screen.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* 按月份查询各项能力分数--接口返参
* @Author sun
*/
@Data
public class ScoreListResultDTO implements Serializable {
private static final long serialVersionUID = 3860268744336541373L;
/**
* 类型党建能力dangjiannengli治理能力zhilinengli服务能力fuwunengli
*/
private String indexCode;
/**
* 总分(保留一位小数)
*/
private Double indexTotal;
/**
* 本级分数(保留一位小数)
*/
private Double agencyScore;
/**
* 下级分数(保留一位小数)
*/
private Double subAgencyScore;
}

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

@ -0,0 +1,36 @@
package com.epmet.datareport.constant;
/**
* @author sun
* @dscription 数据
*/
public interface FactConstant {
/**
* 能力指标
*/
String NLZB = "nenglizhibiao";
/**
* 党建能力
*/
String DJNL = "dangjiannengli";
/**
* 治理能力
*/
String ZLNL = "zhilinengli";
/**
* 服务能力
*/
String FWNL = "fuwunengli";
/**
* 全区相关
*/
String QUAN_QU_XIANG_GUAN = "quanquxiangguan";
/**
* 街道相关
*/
String JIE_DAO_XIANG_GUAN = "jiedaoxiangguan";
/**
* 社区相关
*/
String SHE_QU_XIANG_GUAN = "shequxiangguan";
}

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

@ -0,0 +1,107 @@
package com.epmet.datareport.controller.fact;
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.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.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("fact")
public class FactIndexController {
@Autowired
private FactIndexService factIndexService;
/**
* @param tokenDTO
* @Description 能力指数
* @author sun
*/
@PostMapping("index/ablityindex")
public Result<List<AblityIndexResultDTO>> ablityIndex(@LoginUser TokenDto tokenDTO, @RequestBody AblityIndexFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, AblityIndexFormDTO.AddUserInternalGroup.class);
return new Result<List<AblityIndexResultDTO>>().ok(factIndexService.ablityIndex(formDTO));
}
/**
* @param tokenDTO
* @Description 按月份查询各项能力分数
* @author sun
*/
@PostMapping("index/scorelist")
public Result<List<ScoreListResultDTO>> scoreList(@LoginUser TokenDto tokenDTO, @RequestBody ScoreListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, ScoreListFormDTO.AddUserInternalGroup.class);
return new Result<List<ScoreListResultDTO>>().ok(factIndexService.scoreList(formDTO));
}
/**
* @param tokenDTO
* @Description 按月份查询各项能力最近12个月得分
* @author sun
*/
@PostMapping("index/monthscorelist")
public Result<List<MonthScoreListResultDTO>> monthScoreList(@LoginUser TokenDto tokenDTO, @RequestBody MonthScoreListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, MonthScoreListFormDTO.AddUserInternalGroup.class);
return new Result<List<MonthScoreListResultDTO>>().ok(factIndexService.monthScoreList(formDTO));
}
/**
* @param tokenDTO
* @Description 按月查询各项指标数据
* @author sun
*/
@PostMapping("index/ablitylist")
public Result<List<AblityListResultDTO>> ablityList(@LoginUser TokenDto tokenDTO, @RequestBody AblityListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, AblityListFormDTO.AddUserInternalGroup.class);
return new Result<List<AblityListResultDTO>>().ok(factIndexService.ablityList(formDTO));
}
/**
* @param tokenDTO
* @Description 按月查询各项指标最近12个月数据
* @author sun
*/
@PostMapping("index/monthablitylist")
public Result<List<MonthAblityListResultDTO>> monthAblityList(@LoginUser TokenDto tokenDTO, @RequestBody MonthAblityListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, MonthAblityListFormDTO.AddUserInternalGroup.class);
return new Result<List<MonthAblityListResultDTO>>().ok(factIndexService.monthAblityList(formDTO));
}
/**
* @param tokenDTO
* @Description 同级对比各项数据查询
* @author sun
*/
@PostMapping("index/peercomparison")
public Result<List<PeerComparisonResultDTO>> peerComparison(@LoginUser TokenDto tokenDTO, @RequestBody PeerComparisonFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, PeerComparisonFormDTO.AddUserInternalGroup.class);
return new Result<List<PeerComparisonResultDTO>>().ok(factIndexService.peerComparison(formDTO));
}
/**
* @param tokenDTO
* @Description 是否根组织
* @author sun
*/
@PostMapping("index/rootagency")
public Result<RootAgencyResultDTO> rootAgency(@LoginUser TokenDto tokenDTO, @RequestBody RootAgencyFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, RootAgencyFormDTO.AddUserInternalGroup.class);
return new Result<RootAgencyResultDTO>().ok(factIndexService.rootAgency(formDTO));
}
}

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

@ -1,6 +1,7 @@
package com.epmet.datareport.controller.screen;
import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth;
import com.epmet.commons.extappauth.annotation.InternalAppRequestAuth;
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
@ -82,17 +83,19 @@ 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
**/
@InternalAppRequestAuth
@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));
}
/**

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

@ -1,6 +1,7 @@
package com.epmet.datareport.controller.screen;
import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth;
import com.epmet.commons.extappauth.annotation.InternalAppRequestAuth;
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
@ -75,6 +76,7 @@ public class KcScreenController {
* @return
*/
@ExternalAppRequestAuth
@InternalAppRequestAuth
@PostMapping("issue/summary")
public Result getIssueSummary(ExternalAppRequestParam externalAppRequestParam) {
String customerId = externalAppRequestParam.getCustomerId();

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

@ -80,4 +80,10 @@ public interface ScreenCustomerAgencyDao {
*/
List<ParymemberDistributionResultDTO> selectParymemberDistribution(@Param("parentId")String parentId);
/**
* @param agencyId
* @Description 根据组织ID判断是否根组织
* @author sun
*/
int selectRootAgency(@Param("agencyId") String agencyId);
}

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

@ -17,13 +17,11 @@
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.result.AnNingSubAgencyIndexRankResultDTO;
import com.epmet.evaluationindex.screen.dto.result.MonthBarchartResult;
import com.epmet.evaluationindex.screen.dto.result.MonthPieChartResultDTO;
import com.epmet.evaluationindex.screen.dto.result.SubAgencyIndexRankResultDTO;
import com.epmet.evaluationindex.screen.dto.form.SubAgencyIndexRankYMFormDTO;
import com.epmet.evaluationindex.screen.dto.result.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -70,7 +68,7 @@ public interface ScreenIndexDataMonthlyDao{
* @Author zhangyong
* @Date 09:38 2020-09-08
**/
List<AnNingSubAgencyIndexRankResultDTO> selectAnNingSubAgencyIndexMonthlyRank(AnNingSubAgencyIndexRankFormDTO formDTO);
List<AnNingSubAgencyIndexRankResultDTO> selectSubAgencyOrGridIndexMonthlyRank(SubAgencyIndexRankYMFormDTO formDTO);
/**
* desc获取网格指标排行
@ -79,4 +77,11 @@ public interface ScreenIndexDataMonthlyDao{
* @return
*/
List<SubAgencyIndexRankResultDTO> selectIndexRankByOrgType(GridIndexRankFormDTO formDTO);
/**
* @param formDTO
* @Description 同级对比--根据组织Id的上级组织Id查询同级组织对应类型的得分排名查询最近一个月数据
* @author sun
*/
List<PeerComparisonResultDTO> selectScoreList(PeerComparisonFormDTO 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);
}

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

@ -0,0 +1,50 @@
/**
* 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.ScoreListFormDTO;
import com.epmet.evaluationindex.screen.dto.result.AblityIndexResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScoreListResultDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.LinkedList;
/**
* /街道相关分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-02
*/
@Mapper
public interface FactIndexAgencyScoreDao {
/**
* @param formDTO
* @Description 分别查询当前组织某一月份党建能力治理能力服务能力对应的总分本级分下级分
* @author sun
*/
ScoreListResultDTO selectScore(ScoreListFormDTO formDTO);
/**
* @param formDTO
* @Description 分别查询区县乡镇街道过去12个月党建能力治理能力服务能力每月总分本级得分下级得分数据
* @author sun
*/
LinkedList<AblityIndexResultDTO.ScoreListResultDTO> selectAblityIndex(AblityIndexFormDTO formDTO);
}

51
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencySubScoreDao.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 FactIndexAgencySubScoreDao {
/**
* @param formDTO
* @Description 查询区县级乡镇街道级组织某月份某项能力对应的各项指标
* @author sun
*/
List<AblityListResultDTO> selectAblityList(AblityListFormDTO formDTO);
/**
* @param formDTO
* @Description 查询区县级乡镇街道级组织某项能力对应的一项指标过去12个月份数据
* @author sun
*/
LinkedList<MonthAblityListResultDTO> selectMonthAblityList(MonthAblityListFormDTO formDTO);
}

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

@ -0,0 +1,41 @@
/**
* 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.result.AblityIndexResultDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.LinkedList;
/**
* 社区相关分数表
*
* @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);
}

51
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunitySubScoreDao.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 FactIndexCommunitySubScoreDao {
/**
* @param formDTO
* @Description 查询社区级组织某一月份某项能力对应的各项指标
* @author sun
*/
List<AblityListResultDTO> selectCommunityAblityList(AblityListFormDTO formDTO);
/**
* @param formDTO
* @Description 查询社区级组织某项能力对应的一项指标过去12个月份数据
* @author sun
*/
LinkedList<MonthAblityListResultDTO> selectCommunityMonthAblityList(MonthAblityListFormDTO formDTO);
}

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexGridSelfSubScoreDao.java → epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridScoreDao.java

@ -15,19 +15,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao.evaluationindex.indexcal;
package com.epmet.datareport.dao.fact;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.evaluationindex.indexcal.FactIndexGridSelfSubScoreEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 网格相关自身/下级分值记录表
* 网格相关分值记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-21
* @since v1.0.0 2020-09-02
*/
@Mapper
public interface FactIndexGridSelfSubScoreDao extends BaseDao<FactIndexGridSelfSubScoreEntity> {
public interface FactIndexGridScoreDao {
}
}

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

@ -0,0 +1,31 @@
/**
* 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 org.apache.ibatis.annotations.Mapper;
/**
* 网格相关分值记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-02
*/
@Mapper
public interface FactIndexGridSubScoreDao {
}

4
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:获取该客户下网格排行

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

@ -3,6 +3,7 @@ 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;
@ -13,6 +14,7 @@ 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;
@ -48,19 +50,24 @@ public class AgencyServiceImpl implements AgencyService {
// 验签关闭,customerId无法获取,暂时写死
if(StringUtils.isBlank(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);
}

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

@ -6,7 +6,6 @@ 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.*;
@ -19,6 +18,7 @@ import java.math.BigDecimal;
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 +39,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 +204,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()));

63
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/FactIndexService.java

@ -0,0 +1,63 @@
package com.epmet.datareport.service.fact;
import com.epmet.evaluationindex.screen.dto.form.*;
import com.epmet.evaluationindex.screen.dto.result.*;
import java.util.List;
/**
* 数据改版api
* @author sun
*/
public interface FactIndexService {
/**
* @param formDTO
* @Description 能力指数
* @author sun
*/
List<AblityIndexResultDTO> ablityIndex(AblityIndexFormDTO formDTO);
/**
* @param formDTO
* @Description 按月份查询各项能力分数
* @author sun
*/
List<ScoreListResultDTO> scoreList(ScoreListFormDTO formDTO);
/**
* @param formDTO
* @Description 按月份查询各项能力最近12个月得分
* @author sun
*/
List<MonthScoreListResultDTO> monthScoreList(MonthScoreListFormDTO formDTO);
/**
* @param formDTO
* @Description 按月查询各项指标数据
* @author sun
*/
List<AblityListResultDTO> ablityList(AblityListFormDTO formDTO);
/**
* @param formDTO
* @Description 按月查询各项指标最近12个月数据
* @author sun
*/
List<MonthAblityListResultDTO> monthAblityList(MonthAblityListFormDTO formDTO);
/**
* @param formDTO
* @Description 同级对比各项数据查询
* @author sun
*/
List<PeerComparisonResultDTO> peerComparison(PeerComparisonFormDTO formDTO);
/**
* @param formDTO
* @Description 是否根组织
* @author sun
*/
RootAgencyResultDTO rootAgency(RootAgencyFormDTO formDTO);
}

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

@ -0,0 +1,277 @@
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.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.FactIndexCommunityScoreDao;
import com.epmet.datareport.dao.fact.FactIndexCommunitySubScoreDao;
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.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedList;
import java.util.List;
/**
* 数据改版api
*
* @author sun
*/
@Service
@DataSource(DataSourceConstant.EVALUATION_INDEX)
public class FactIndexServiceImpl implements FactIndexService {
@Autowired
private ScreenCustomerAgencyDao screenCustomerAgencyDao;
@Autowired
private ScreenIndexDataMonthlyDao screenIndexDataMonthlyDao;
@Autowired
private FactIndexAgencyScoreDao factIndexAgencyScoreDao;
@Autowired
private FactIndexAgencySubScoreDao factIndexAgencySubScoreDao;
@Autowired
private FactIndexCommunityScoreDao factIndexCommunityScoreDao;
@Autowired
private FactIndexCommunitySubScoreDao factIndexCommunitySubScoreDao;
/**
* @param formDTO
* @Description 能力指数
* @author sun
*/
@Override
public List<AblityIndexResultDTO> ablityIndex(AblityIndexFormDTO formDTO) {
LinkedList<AblityIndexResultDTO> resultDTO = new LinkedList<>();
LinkedList<AblityIndexResultDTO.ScoreListResultDTO> djList = null;
LinkedList<AblityIndexResultDTO.ScoreListResultDTO> zlList = null;
LinkedList<AblityIndexResultDTO.ScoreListResultDTO> fwList = null;
//分别查询过去12个月党建能力、治理能力、服务能力各自总分乘权重后的分值,每个月份三个分值的加和就是当月的能力指数的分值 fact_index_agency_score 按月份升序
//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未查询到组织信息,组织Id:%s", formDTO.getAgencyId()));
}
//1.根据组织级别判断查询哪类数据表
//区县级、乡镇街道级
if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) {
//2-1.查询过去12个月党建能力每月总分、本级得分、下级得分数据(不想写union)
formDTO.setIndexCode(FactConstant.DJNL);
djList = factIndexAgencyScoreDao.selectAblityIndex(formDTO);
//2-2.查询过去12个月治理能力每月总分、本级得分、下级得分数据
formDTO.setIndexCode(FactConstant.ZLNL);
zlList = factIndexAgencyScoreDao.selectAblityIndex(formDTO);
//2-3.查询过去12个月服务能力每月总分、本级得分、下级得分数据
formDTO.setIndexCode(FactConstant.FWNL);
fwList = factIndexAgencyScoreDao.selectAblityIndex(formDTO);
//社区级
} else if ("community".equals(agency.getLevel())) {
//2-1.查询过去12个月党建能力每月总分、本级得分、下级得分数据
formDTO.setIndexCode(FactConstant.DJNL);
djList = factIndexCommunityScoreDao.selectCommunityAblityIndex(formDTO);
//2-2.查询过去12个月治理能力每月总分、本级得分、下级得分数据
formDTO.setIndexCode(FactConstant.ZLNL);
zlList = factIndexCommunityScoreDao.selectCommunityAblityIndex(formDTO);
//2-3.查询过去12个月服务能力每月总分、本级得分、下级得分数据
formDTO.setIndexCode(FactConstant.FWNL);
fwList = factIndexCommunityScoreDao.selectCommunityAblityIndex(formDTO);
} else {
throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getAgencyId()));
}
//3.遍历计算每个月能力指数
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);
}
//5.封装数据并返回
AblityIndexResultDTO nl = new AblityIndexResultDTO();
nl.setIndexCode(FactConstant.NLZB);
nl.setScoreList(djList);
resultDTO.add(nl);
AblityIndexResultDTO dj = new AblityIndexResultDTO();
dj.setIndexCode(FactConstant.DJNL);
dj.setScoreList(djList);
resultDTO.add(dj);
AblityIndexResultDTO zl = new AblityIndexResultDTO();
zl.setIndexCode(FactConstant.ZLNL);
zl.setScoreList(djList);
resultDTO.add(zl);
AblityIndexResultDTO fw = new AblityIndexResultDTO();
fw.setIndexCode(FactConstant.FWNL);
fw.setScoreList(djList);
resultDTO.add(fw);
return resultDTO;
}
/**
* @param formDTO
* @Description 按月份查询各项能力分数
* @author sun
*/
@Override
public List<ScoreListResultDTO> scoreList(ScoreListFormDTO formDTO) {
//1.查询当前组织某一月份党建能力对应的总分、本级分、下级分
formDTO.setIndexCode(FactConstant.DJNL);
ScoreListResultDTO dj = factIndexAgencyScoreDao.selectScore(formDTO);
//2.查询当前组织某一月份治理能力对应的总分、本级分、下级分
//3.查询当前组织某一月份服务能力对应的总分、本级分、下级分
return null;
}
/**
* @param formDTO
* @Description 按月份查询各项能力最近12个月得分
* @author sun
*/
@Override
public List<MonthScoreListResultDTO> monthScoreList(MonthScoreListFormDTO formDTO) {
return null;
}
/**
* @param formDTO
* @Description 按月查询各项指标数据
* @author sun
*/
@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());
}
resultList = factIndexAgencySubScoreDao.selectAblityList(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.getAgencyId()));
}
//3.调用方法判断各项指标是数字指标还是百分比指标 //TODO
return resultList;
}
/**
* @param formDTO
* @Description 按月查询各项指标最近12个月数据
* @author sun
*/
@Override
public List<MonthAblityListResultDTO> monthAblityList(MonthAblityListFormDTO formDTO) {
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()));
}
//3.根据组织级别拼接查询条件,判断查询不同数据表
//区县级、乡镇街道级
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.getAgencyId()));
}
//3.调用方法判断各项指标是数字指标还是百分比指标//TODO
return resultList;
}
/**
* @param newDate
* @Description 计算monthId对应一年前的monthId
* @author sun
*/
public String getDate(String newDate) {
String date = "";
SimpleDateFormat sdf = new SimpleDateFormat("yyyymm");
try {
Calendar ds = Calendar.getInstance();
ds.setTime(sdf.parse(newDate));
ds.add(Calendar.YEAR, -1);
date = sdf.format(ds.getTime());
} catch (RenException | ParseException e) {
e.printStackTrace();
}
return date;
}
/**
* @param formDTO
* @Description 同级对比各项数据查询
* @author sun
*/
@Override
public List<PeerComparisonResultDTO> peerComparison(PeerComparisonFormDTO formDTO) {
//1.根据组织Id的上级组织Id查询同级组织对应类型的得分排名(查询最近一个月数据)
List<PeerComparisonResultDTO> resultList = screenIndexDataMonthlyDao.selectScoreList(formDTO);
return resultList;
}
/**
* @param formDTO
* @Description 是否根组织
* @author sun
*/
@Override
public RootAgencyResultDTO rootAgency(RootAgencyFormDTO formDTO) {
RootAgencyResultDTO resultDTO = new RootAgencyResultDTO();
//1.根据agencyId查询是否为根级组织
int num = screenCustomerAgencyDao.selectRootAgency(formDTO.getAgencyId());
if (num < NumConstant.ONE) {
resultDTO.setIsRoot(false);
}
//2.计算统计数据更新时间
SimpleDateFormat d = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
//获取当前月第一天日期
calendar.add(Calendar.MONTH, 0);
calendar.set(Calendar.DAY_OF_MONTH, 1);
//获取上月最后一天日期
calendar.set(Calendar.HOUR, -24);
resultDTO.setDate(d.format(calendar.getTime()));
return resultDTO;
}
}

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

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

@ -0,0 +1,33 @@
<?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.FactIndexAgencyScoreDao">
<select id="selectScore" resultType="com.epmet.evaluationindex.screen.dto.result.ScoreListResultDTO">
</select>
<select id="selectAblityIndex" resultType="com.epmet.evaluationindex.screen.dto.result.AblityIndexResultDTO$ScoreListResultDTO">
SELECT
fact.month_id AS "monthId",
ROUND(fact.score * fact.weight, 1) AS "indexTotal",
ROUND(self.self_score * self.self_weight,1) AS "agencyScore",
ROUND(self.sub_score * self.sub_weight,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.customer_id = #{customerId}
AND fact.agency_id = #{agencyId}
AND fact.month_id &gt; #{startMonthId}
AND fact.month_id &lt;= #{monthId}
AND fact.index_code = #{indexCode}
ORDER BY
fact.month_id ASC
</select>
</mapper>

42
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.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.FactIndexAgencySubScoreDao">
<select id="selectAblityList" 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_agency_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 agency_id = #{agencyId}
AND month_id = #{monthId}
</select>
<select id="selectMonthAblityList" 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_agency_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 agency_id = #{agencyId}
AND month_id &lt;= #{monthId}
AND month_id &gt; #{startMonthId}
AND fact.index_code = #{key}
ORDER BY
fact.month_id ASC
</select>
</mapper>

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

@ -0,0 +1,29 @@
<?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 * fact.weight, 1) AS "indexTotal",
ROUND(self.self_score * self.self_weight,1) AS "agencyScore",
ROUND(self.sub_score * self.sub_weight,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.customer_id = #{customerId}
AND fact.agency_id = #{agencyId}
AND fact.month_id &gt; #{startMonthId}
AND fact.month_id &lt;= #{monthId}
AND fact.index_code = #{indexCode}
ORDER BY
fact.month_id ASC
</select>
</mapper>

42
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.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.FactIndexCommunitySubScoreDao">
<select id="selectCommunityAblityList" 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_community_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 agency_id = #{agencyId}
AND month_id = #{monthId}
</select>
<select id="selectCommunityMonthAblityList" 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_community_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 agency_id = #{agencyId}
AND month_id &lt;= #{monthId}
AND month_id &gt; #{startMonthId}
AND fact.index_code = #{key}
ORDER BY
fact.month_id ASC
</select>
</mapper>

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

@ -0,0 +1,7 @@
<?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">
</mapper>

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

@ -0,0 +1,7 @@
<?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">
</mapper>

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

@ -101,4 +101,15 @@
AND sutd.parent_id = #{parentId}
</select>
<select id="selectRootAgency" resultType="java.lang.Integer">
SELECT
COUNT(id)
FROM
screen_customer_agency
WHERE
del_flag = '0'
AND pid = '0'
AND agency_id = #{agencyId}
</select>
</mapper>

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

@ -61,21 +61,23 @@
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}
AND ORG_TYPE != 'department'
<if test="sort == 'asc'">
ORDER BY index_total ASC
</if>
@ -105,4 +107,62 @@
ORDER BY index_total DESC
LIMIT #{topNum}
</select>
<select id="selectScoreList" resultType="com.epmet.evaluationindex.screen.dto.result.PeerComparisonResultDTO">
SELECT
org_id AS "agencyId",
org_name AS "agencyName",
<if test="indexCode != null and indexCode != '' and indexCode == 'dangjiannengli'">
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),1) AS "score"
</if>
<if test="indexCode != null and indexCode != '' and indexCode == 'fuwunengli'">
round((service_ablity * service_ablity_weight),1) AS "score"
</if>
FROM
screen_index_data_monthly
WHERE
del_flag = '0'
AND org_type = 'agency'
AND customer_id = #{customerId}
AND parent_id = (
select
parent_id
from
screen_index_data_monthly
where
del_flag = '0'
and org_type = 'agency'
and customer_id = #{customerId}
and org_id = #{agencyId}
order by
created_time desc
limit 1
)
AND MONTH_ID = (
select
month_id
from
screen_index_data_monthly
where
del_flag = '0'
and customer_id = #{customerId}
order by
month_id desc
limit 1
)
ORDER BY
<if test="indexCode != null and indexCode != '' and indexCode == 'dangjiannengli'">
(party_dev_ablity * party_dev_weight) DESC
</if>
<if test="indexCode != null and indexCode != '' and indexCode == 'zhilinengli'">
(govern_ablity * govern_ablity_weight) DESC
</if>
<if test="indexCode != null and indexCode != '' and indexCode == 'fuwunengli'">
(service_ablity * service_ablity_weight) DESC
</if>
LIMIT #{pageSize}
</select>
</mapper>

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

@ -19,14 +19,15 @@
</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

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

@ -8,10 +8,22 @@ 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";
}

12
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactOriginProjectLogDailyDTO.java

@ -58,6 +58,18 @@ public class FactOriginProjectLogDailyDTO implements Serializable {
*/
private String agencyId;
/**
* 操作人所在父Id当orgType不为空时agencyId与pid一致
* 当orgType为空时pid是agencyId的上级没有上级则默认为0
* */
private String pid;
/**
* 操作人所在所有父机Id集合当orgType不为空时pids最后一节一定包含pid
* 当orgType为空时pids是agencyId的所有上级没有上级则为空串
* */
private String pids;
/**
* 日期ID
*/

10
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactOriginProjectMainDailyDTO.java

@ -93,6 +93,11 @@ public class FactOriginProjectMainDailyDTO implements Serializable {
*/
private String pid;
/**
* 所有上级Id集合 (项目来源)
* */
private String pids;
/**
* 组织ID网格所属组织ID
*/
@ -103,6 +108,11 @@ public class FactOriginProjectMainDailyDTO implements Serializable {
*/
private String projectStatus;
/**
* resolved unresolved
* */
private String isResolved;
/**
* 创建话题用户的ID
*/

2
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/IssueLogDailyFormDTO.java

@ -33,6 +33,8 @@ public class IssueLogDailyFormDTO implements Serializable {
*/
private String pid;
private String pids;
/**
* 机关ID
*/

2
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/IssueMainDailyFormDTO.java

@ -79,6 +79,8 @@ public class IssueMainDailyFormDTO implements Serializable {
*/
private String pid;
private String pids;
/**
* 议题组织ID网格所属组织ID
*/

132
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/PartyBaseInfoFormDTO.java

@ -0,0 +1,132 @@
package com.epmet.dto.extract.form;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/9/22 3:19 下午
*/
@Data
public class PartyBaseInfoFormDTO implements Serializable {
private static final long serialVersionUID = 1685776533893300943L;
/**
* ID 主键
*/
private String id;
/**
* 客户Id
*/
private String customerId;
/**
* 组织类别 agency组织部门department网格grid
*/
private String orgType;
/**
* 组织Id 可以为网格机关id
*/
private String orgId;
/**
* 上级组织Id
*/
private String parentId;
/**
* 组织名称
*/
private String orgName;
/**
* 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增)
*/
private String dataEndTime;
/**
* 注册用户数
*/
private Integer registerUserCount;
/**
* 群众用户数
*/
private Integer resiTotal;
/**
* 注册党员数
*/
private Integer partyMemberCount;
/**
* 小于20岁的党员总人数
*/
private Integer ageLevel1;
/**
* 20-30岁的党员总人数
*/
private Integer ageLevel2;
/**
* 31-40岁的党员总人数
*/
private Integer ageLevel3;
/**
* 41-50岁的党员总人数
*/
private Integer ageLevel4;
/**
* 51-60岁的党员总人数
*/
private Integer ageLevel5;
/**
* 60+岁的党员总人数
*/
private Integer ageLevel6;
/**
* 删除标识 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 更新人
*/
private String updatedBy;
public PartyBaseInfoFormDTO() {
this.registerUserCount = NumConstant.ZERO;
this.resiTotal = NumConstant.ZERO;
this.partyMemberCount = NumConstant.ZERO;
this.ageLevel1 = NumConstant.ZERO;
this.ageLevel2 = NumConstant.ZERO;
this.ageLevel3 = NumConstant.ZERO;
this.ageLevel4 = NumConstant.ZERO;
this.ageLevel5 = NumConstant.ZERO;
this.ageLevel6 = NumConstant.ZERO;
this.delFlag = NumConstant.ZERO_STR;
this.revision = NumConstant.ZERO;
this.createdBy = "APP_USER";
this.updatedBy = "APP_USER";
}
}

2
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/AgencyInfoResultDTO.java

@ -22,4 +22,6 @@ public class AgencyInfoResultDTO implements Serializable {
* 机关的父ID
*/
private String pid;
private String pids;
}

35
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/CustomerAgencyInfoResultDTO.java

@ -0,0 +1,35 @@
package com.epmet.dto.extract.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/9/22 4:21 下午
*/
@Data
public class CustomerAgencyInfoResultDTO implements Serializable {
private static final long serialVersionUID = -584952326059903779L;
/**
* 机关ID
*/
private String agencyId;
/**
* 机关名称
*/
private String agencyName;
/**
* 机关父级ID
*/
private String pid;
/**
* 机关级别
*/
private String level;
}

3
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/IssueProcessInfoResultDTO.java

@ -3,6 +3,7 @@ package com.epmet.dto.extract.result;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Author zxc
@ -42,4 +43,6 @@ public class IssueProcessInfoResultDTO implements Serializable {
* 用户ID
*/
private String userId;
private Date createTime;
}

85
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/PartyInfoResultDTO.java

@ -0,0 +1,85 @@
package com.epmet.dto.extract.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/9/23 1:58 下午
*/
@Data
public class PartyInfoResultDTO implements Serializable {
private static final long serialVersionUID = -5275089831499409888L;
/**
* 客户Id
*/
private String customerId;
/**
* 组织类别 agency组织部门department网格grid
*/
private String orgType;
/**
* 组织Id 可以为网格机关id
*/
private String orgId;
/**
* 上级组织Id
*/
private String parentId;
/**
* 组织名称
*/
private String orgName;
/**
* 注册用户数
*/
private Integer registerUserCount;
/**
* 群众用户数
*/
private Integer resiTotal;
/**
* 注册党员数
*/
private Integer partyMemberCount;
/**
* 小于20岁的党员总人数
*/
private Integer ageLevel1;
/**
* 20-30岁的党员总人数
*/
private Integer ageLevel2;
/**
* 31-40岁的党员总人数
*/
private Integer ageLevel3;
/**
* 41-50岁的党员总人数
*/
private Integer ageLevel4;
/**
* 51-60岁的党员总人数
*/
private Integer ageLevel5;
/**
* 60+岁的党员总人数
*/
private Integer ageLevel6;
}

51
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/PartyMemberInfoResultDTO.java

@ -0,0 +1,51 @@
package com.epmet.dto.extract.result;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Author zxc
* @DateTime 2020/9/22 5:23 下午
*/
@Data
public class PartyMemberInfoResultDTO implements Serializable {
private static final long serialVersionUID = 6591845785373556485L;
/**
* 网格ID
*/
private String gridId;
/**
* 机关ID
*/
private String agencyId;
/**
* 父级ID
*/
private String parentId;
/**
* 生日
*/
private Date birthday;
/**
* 年龄
*/
private Integer age;
/**
* 网格名称
*/
private String gridName;
/**
* 机关名称
*/
private String agencyName;
}

35
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/UserCountResultDTO.java

@ -0,0 +1,35 @@
package com.epmet.dto.extract.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/9/23 9:54 上午
*/
@Data
public class UserCountResultDTO implements Serializable {
private static final long serialVersionUID = -6349371693110337172L;
/**
* 群众用户数
*/
private Integer resiTotal;
/**
* 注册用户数
*/
private Integer registerUserCount;
/**
* 注册党员数
*/
private Integer partyMemberCount;
/**
* 网格ID / 机关ID
*/
private String orgId;
}

12
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/ExtractGroupMemberActionRecordResultDTO.java

@ -6,7 +6,7 @@ import java.io.Serializable;
import java.util.Date;
/**
* @Description
* @Description 数据抽取 - 小组成员DTO 目前查询和插入都使用这一个
* @ClassName ExtractGroupMemberActionRecordResultDTO
* @Auth wangc
* @Date 2020-09-18 21:18
@ -18,6 +18,14 @@ public class ExtractGroupMemberActionRecordResultDTO implements Serializable {
private String groupId;
private String gridId;
private String agencyId;
private String parentId;
private String pids;
private String memberId;
private String leaderFlag;
@ -35,7 +43,7 @@ public class ExtractGroupMemberActionRecordResultDTO implements Serializable {
private Date joinDate;
/**
* 目前只有join leader也是join
* 目前只有join leader入群也是join
* */
private String actionCode;
}

14
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/ProcessInfoDTO.java

@ -15,7 +15,7 @@ public class ProcessInfoDTO implements Serializable {
private static final long serialVersionUID = 4586424046147127143L;
private String agencyId;
private String departmentId;
private String gridId;
private String gridId; //可能是负责人所属的网格Id,也可能是满意度评价的居民所属网格Id
private String projectId;
/**
* 处理结案close退回return部门流转transfer创建项目created
@ -27,4 +27,16 @@ public class ProcessInfoDTO implements Serializable {
private String staffId;
private Date createdTime;
/**
* 操作人所在父Id当orgType不为空时agencyId与pid一致
* 当orgType为空时pid是agencyId的上级没有上级则默认为0
* */
private String pid;
/**
* 操作人所在所有父机Id集合当orgType不为空时pids最后一节一定包含pid
* 当orgType为空时pids是agencyId的所有上级没有上级则为空串
* */
private String pids;
}

2
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/DimCustomerPartyMemberFormDTO.java

@ -35,6 +35,8 @@ public class DimCustomerPartyMemberFormDTO implements Serializable {
*/
private String parentId;
private String pids;
/**
* 党员认证成功的日期yyyyMMdd
*/

2
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/result/GridBelongAgencyResultDTO.java

@ -27,4 +27,6 @@ public class GridBelongAgencyResultDTO implements Serializable {
* 机关的上级ID
*/
private String parentId;
private String pids;
}

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

@ -178,13 +178,13 @@ public class DemoController {
@PostMapping("zxc2")
public Result getZxc2(){
indexCalculateCommunityService.calCommunityAll("b09527201c4409e19d1dbc5e3c3429a1","202008");
indexCalculateCommunityService.calCommunityAll("epmettest", "202008");
return new Result();
}
@PostMapping("testcalculategridcorrelation")
public Result testcalculateGridCorreLation(){
CalculateCommonFormDTO formDTO=new CalculateCommonFormDTO("b09527201c4409e19d1dbc5e3c3429a1","202008");
CalculateCommonFormDTO formDTO = new CalculateCommonFormDTO("epmettest", "202008");
gridCorreLationService.calculateGridCorreLation(formDTO);
return new Result();
}
@ -579,7 +579,7 @@ public class DemoController {
@PostMapping("responseration")
public Result<Map<String,BigDecimal>> responseRatio(){
return new Result<Map<String,BigDecimal>>().ok(
factOriginProjectLogDailyService.getAgencyResponseRatio("3ef7e4bb195eb9e622d68b52509aa940","202006","month")
factOriginProjectLogDailyService.getAgencyWorkPieceRatio("3ef7e4bb195eb9e622d68b52509aa940","202006","month")
);
}
@ -637,8 +637,8 @@ public class DemoController {
private PartyBaseInfoService partyBaseInfoService;
@PostMapping("zxczxczxc")
public Result getZxcZxcZxc(){
partyBaseInfoService.statsPartyMemberBaseInfoToScreen("45687aa479955f9d06204d415238f7cc","20200922");
public Result getZxcZxcZxc(@RequestBody CustomerIdAndDateIdFormDTO formDTO){
partyBaseInfoService.statsPartyMemberBaseInfoToScreen(formDTO.getCustomerId(),formDTO.getDateId());
return new Result();
}

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java

@ -26,6 +26,7 @@ import com.epmet.entity.evaluationindex.extract.FactOriginGroupMainDailyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
@ -72,7 +73,7 @@ public interface FactOriginGroupMainDailyDao extends BaseDao<FactOriginGroupMain
* @author wangc
* @date 2020.09.20 09:58
**/
void deleteBatchMemberByCustomerId(@Param("customerId")String customerId);
void deleteBatchMemberByCustomerId(@Param("customerId")String customerId,@Param("dimId") String dimId,@Param("dateType") String dateType);
/**
* @Description 按照组Id清除组和组员数据

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java

@ -110,6 +110,16 @@ public interface FactOriginIssueMainDailyDao extends BaseDao<FactOriginIssueMain
* @Date 2020/9/20 22:54
**/
Integer selectIssueTotalTwoMonth(@Param("list") List<String> topicIdList);
/**
* @Description 更新议题状态
* @param issueId
* @param status
* @author zxc
* @date 2020/9/23 5:08 下午
*/
void updateIssueStatus(@Param("issueId")String issueId,@Param("status")String status);
/**
* @return int
* @param customerId

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.java

@ -80,7 +80,7 @@ public interface FactOriginProjectOrgPeriodDailyDao extends BaseDao<FactOriginPr
void insertBatch(@Param("list") List<FactOriginProjectOrgPeriodDailyEntity> list);
/**
* @Description 查找网格部门对项目的响应系数
* @Description 查找网格部门对项目的办结系数
* @param customerId
* @return
* @author wangc
@ -89,7 +89,7 @@ public interface FactOriginProjectOrgPeriodDailyDao extends BaseDao<FactOriginPr
List<OrgResponseTimeResultDTO> selectSubOrgResponseCoefficient(@Param("customerId") String customerId,@Param("dimId") String dimId, @Param("dateType") String dateType);
/**
* @Description 查找机关对项目的响应系数
* @Description 查找机关对项目的办结系数
* @param customerId
* @return
* @author wangc

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexAgencySelfSubScoreDao.java → epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencySelfSubScoreDao.java

@ -18,8 +18,11 @@
package com.epmet.dao.evaluationindex.indexcal;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.evaluationindex.indexcal.FactIndexAgencySelfSubScoreEntity;
import com.epmet.entity.evaluationindex.indexcal.AgencySelfSubScoreEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* /街道相关 自身和下级分数表
@ -28,6 +31,9 @@ import org.apache.ibatis.annotations.Mapper;
* @since v1.0.0 2020-09-21
*/
@Mapper
public interface FactIndexAgencySelfSubScoreDao extends BaseDao<FactIndexAgencySelfSubScoreEntity> {
public interface AgencySelfSubScoreDao extends BaseDao<AgencySelfSubScoreEntity> {
int deleteByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId);
int insertBatch(@Param("list") List<AgencySelfSubScoreEntity> list);
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexCommunitySelfSubScoreDao.java → epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunitySelfSubScoreDao.java

@ -18,7 +18,7 @@
package com.epmet.dao.evaluationindex.indexcal;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.evaluationindex.indexcal.FactIndexCommunitySelfSubScoreEntity;
import com.epmet.entity.evaluationindex.indexcal.CommunitySelfSubScoreEntity;
import org.apache.ibatis.annotations.Mapper;
/**
@ -28,6 +28,6 @@ import org.apache.ibatis.annotations.Mapper;
* @since v1.0.0 2020-09-21
*/
@Mapper
public interface FactIndexCommunitySelfSubScoreDao extends BaseDao<FactIndexCommunitySelfSubScoreEntity> {
public interface CommunitySelfSubScoreDao extends BaseDao<CommunitySelfSubScoreEntity> {
}

39
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/GridSelfSubScoreDao.java

@ -0,0 +1,39 @@
/**
* 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.dao.evaluationindex.indexcal;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.evaluationindex.indexcal.GridSelfSubScoreEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 网格相关自身/下级分值记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-21
*/
@Mapper
public interface GridSelfSubScoreDao extends BaseDao<GridSelfSubScoreEntity> {
int deleteByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("parentIndexCode") String parentIndexCode);
int insertBatch(@Param("list") List<GridSelfSubScoreEntity> list);
}

30
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCpcBaseDataDao.java

@ -18,6 +18,8 @@
package com.epmet.dao.evaluationindex.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.extract.form.PartyBaseInfoFormDTO;
import com.epmet.dto.extract.result.PartyInfoResultDTO;
import com.epmet.dto.screencoll.form.CpcBaseDataFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenCpcBaseDataEntity;
import org.apache.ibatis.annotations.Mapper;
@ -55,4 +57,32 @@ public interface ScreenCpcBaseDataDao extends BaseDao<ScreenCpcBaseDataEntity> {
* @Date 10:52 2020-08-18
**/
void batchInsertCpcBaseData(@Param("list") List<CpcBaseDataFormDTO> list, @Param("customerId")String customerId);
/**
* @Description 插入党员基本信息
* @param baseInfos
* @author zxc
* @date 2020/9/22 3:28 下午
*/
void insertPartyBaseInfo(@Param("baseInfos") List<PartyBaseInfoFormDTO> baseInfos);
/**
* @Description 删除旧的党员基本信息
* @param customerId
* @param dateId
* @param orgIds
* @author zxc
* @date 2020/9/22 3:28 下午
*/
Integer deleteOldPartyBaseInfo(@Param("customerId") String customerId,@Param("dateId") String dateId,@Param("orgIds")List<String> orgIds);
/**
* @Description 查询党员信息根据agencyId来查
* @param customerId
* @param dateId
* @param agencyId
* @author zxc
* @date 2020/9/23 2:01 下午
*/
List<PartyInfoResultDTO> selectPartyInfo(@Param("customerId") String customerId,@Param("dateId") String dateId, String agencyId);
}

27
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java

@ -18,6 +18,8 @@
package com.epmet.dao.evaluationindex.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.extract.form.PartyBaseInfoFormDTO;
import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO;
import com.epmet.dto.screen.result.TreeResultDTO;
import com.epmet.dto.screencoll.form.CustomerAgencyFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity;
@ -120,9 +122,34 @@ public interface ScreenCustomerAgencyDao extends BaseDao<ScreenCustomerAgencyEnt
*/
List<TreeResultDTO> selectSubAgencyList(@Param("pids") String pids);
/**
* @Description 查询客户下所有机关ID
* @param customerId
* @author zxc
* @date 2020/9/22 4:06 下午
*/
List<CustomerAgencyInfoResultDTO> selectAllAgencyId(@Param("customerId") String customerId);
ScreenCustomerAgencyEntity getLastAddedAgency();
ScreenCustomerAgencyEntity getLastUpdatedAgency();
ScreenCustomerAgencyEntity selectByAgencyId(String agencyId);
/**
* @Description 查询下一级机关的ID即以agencyId为pid的agency
* @param agencyId
* @param customerId
* @author zxc
* @date 2020/9/23 11:11 上午
*/
List<String> selectSubAgencyId(@Param("agencyId") String agencyId,@Param("customerId") String customerId);
/**
* @Description 查询客户下所有机关ID
* @param customerId
* @author zxc
* @date 2020/9/23 3:10 下午
*/
List<PartyBaseInfoFormDTO> selectAllAgencyIdToParty(@Param("customerId")String customerId,@Param("dateId")String dateId);
}

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java

@ -19,6 +19,7 @@ package com.epmet.dao.evaluationindex.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.ScreenCustomerGridDTO;
import com.epmet.dto.extract.form.PartyBaseInfoFormDTO;
import com.epmet.dto.indexcal.PageQueryGridFormDTO;
import com.epmet.dto.screencoll.form.CustomerGridFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity;
@ -128,4 +129,13 @@ public interface ScreenCustomerGridDao extends BaseDao<ScreenCustomerGridEntity>
ScreenCustomerGridEntity getLastUpdateGrid();
ScreenCustomerGridEntity getByGridId(String gridId);
/**
* @Description 查询客户下所有网格ID
* @param customerId
* @param dateId
* @author zxc
* @date 2020/9/23 3:10 下午
*/
List<PartyBaseInfoFormDTO> selectAllGridIdToParty(String customerId, String dateId);
}

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerPartymemberDao.java

@ -18,6 +18,7 @@
package com.epmet.dao.stats;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.extract.result.PartyMemberInfoResultDTO;
import com.epmet.dto.stats.form.DimCustomerPartyMemberFormDTO;
import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity;
import com.epmet.entity.stats.DimCustomerPartymemberEntity;
@ -61,6 +62,15 @@ public interface DimCustomerPartymemberDao extends BaseDao<DimCustomerPartymembe
**/
List<FactIndexPartyAblityCpcMonthlyEntity> selectPartyMemberList(String customerId);
/**
* @Description 查询党员信息
* @param customerId
* @param gridIds
* @author zxc
* @date 2020/9/22 5:26 下午
*/
List<PartyMemberInfoResultDTO> selectPartyMemberInfo(@Param("customerId")String customerId,@Param("gridIds") List<String> gridIds);
/**
* @return java.util.List<java.lang.String>
* @param customerId

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserAgencyDailyDao.java

@ -18,6 +18,7 @@
package com.epmet.dao.stats.user;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.extract.result.UserCountResultDTO;
import com.epmet.dto.stats.user.FactParticipationUserAgencyDailyDTO;
import com.epmet.entity.stats.user.FactParticipationUserAgencyDailyEntity;
import org.apache.ibatis.annotations.Mapper;
@ -38,4 +39,13 @@ public interface FactParticipationUserAgencyDailyDao extends BaseDao<FactPartici
void deleteByParams(@Param("dateId")String dateId,@Param("customerId")String customerId);
/**
* @Description 查询机关下用户信息
* @param customerId
* @param dateId
* @author zxc
* @date 2020/9/23 9:57 上午
*/
List<UserCountResultDTO> selectUserCount(String customerId, String dateId);
}

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserGridDailyDao.java

@ -18,6 +18,7 @@
package com.epmet.dao.stats.user;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.extract.result.UserCountResultDTO;
import com.epmet.dto.stats.user.FactParticipationUserGridDailyDTO;
import com.epmet.entity.stats.user.FactParticipationUserGridDailyEntity;
import org.apache.ibatis.annotations.Mapper;
@ -38,4 +39,13 @@ public interface FactParticipationUserGridDailyDao extends BaseDao<FactParticipa
void deleteByParams(@Param("dateId")String dateId,@Param("customerId")String customerId);
/**
* @Description 查询网格下用户信息
* @param customerId
* @param dateId
* @author zxc
* @date 2020/9/23 9:57 上午
*/
List<UserCountResultDTO> selectUserCount(String customerId, String dateId);
}

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectLogDailyEntity.java

@ -56,6 +56,18 @@ public class FactOriginProjectLogDailyEntity extends BaseEpmetEntity {
*/
private String agencyId;
/**
* 操作人所在父Id当orgType不为空时agencyId与pid一致
* 当orgType为空时pid是agencyId的上级没有上级则默认为0
* */
private String pid;
/**
* 操作人所在所有父机Id集合当orgType不为空时pids最后一节一定包含pid
* 当orgType为空时pids是agencyId的所有上级没有上级则为空串
* */
private String pids;
/**
* 日期ID
*/

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectMainDailyEntity.java

@ -93,6 +93,11 @@ public class FactOriginProjectMainDailyEntity extends BaseEpmetEntity {
*/
private String pid;
/**
* 所有上级Id集合 (项目来源)
* */
private String pids;
/**
* 组织ID网格所属组织ID
*/
@ -103,6 +108,11 @@ public class FactOriginProjectMainDailyEntity extends BaseEpmetEntity {
*/
private String projectStatus;
/**
* resolved unresolved
* */
private String isResolved;
/**
* 创建话题用户的ID
*/

25
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexAgencySelfSubScoreEntity.java → epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/AgencySelfSubScoreEntity.java

@ -28,12 +28,12 @@ import java.math.BigDecimal;
* /街道相关 自身和下级分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-21
* @since v1.0.0 2020-09-23
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("fact_index_agency_self_sub_score")
public class FactIndexAgencySelfSubScoreEntity extends BaseEpmetEntity {
public class AgencySelfSubScoreEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
@ -73,19 +73,19 @@ public class FactIndexAgencySelfSubScoreEntity extends BaseEpmetEntity {
private String dataType;
/**
* 分数类型self自身得分sub下级得分
* 自身指标得分
*/
private String scoreType;
private BigDecimal selfScore;
/**
*
* 下级指标得
*/
private BigDecimal score;
private BigDecimal subScore;
/**
* 党建能力dangjiannengli治理能力zhilinengli服务能力fuwunengli街道相关jiedaoxiangguan全区相关:quanquxiangguan
* 党建能力dangjiannengli治理能力zhilinengli服务能力fuwunengli
*/
private String indexCode;
private String parentIndexCode;
/**
* 所有指标code拼接的字符串 冒号隔开
@ -93,8 +93,13 @@ public class FactIndexAgencySelfSubScoreEntity extends BaseEpmetEntity {
private String allParentIndexCode;
/**
* 权重
* 自身指标权重
*/
private BigDecimal weight;
private BigDecimal selfWeight;
/**
* 下级指标权重
*/
private BigDecimal subWeight;
}

123
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexCommunitySelfSubScoreEntity.java → epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/CommunitySelfSubScoreEntity.java

@ -28,68 +28,73 @@ import java.math.BigDecimal;
* 社区相关 自身/下级分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-21
* @since v1.0.0 2020-09-23
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("fact_index_community_self_sub_score")
public class FactIndexCommunitySelfSubScoreEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
private String customerId;
/**
* 组织id
*/
private String agencyId;
/**
* 社区上一级组织id
*/
private String parentAgencyId;
/**
* 年度ID: yyyy
*/
private String yearId;
/**
* 季度id: yyyyQ1yyyyQ2yyyyQ3yyyyQ4
*/
private String quarterId;
/**
* 月维度Id: yyyyMM
*/
private String monthId;
/**
* 分数类型self自身得分sub下级得分
*/
private String scoreType;
/**
* 分值
*/
private BigDecimal score;
/**
* 党建能力dangjiannengli治理能力zhilinengli服务能力fuwunengli社区相关shequxiangguan
*/
private String indexCode;
/**
* 所有指标code拼接的字符串 冒号隔开
*/
private String allParentIndexCode;
/**
* 权重
*/
private BigDecimal weight;
public class CommunitySelfSubScoreEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
private String customerId;
/**
* 组织id
*/
private String agencyId;
/**
* 社区上一级组织id
*/
private String parentAgencyId;
/**
* 年度ID: yyyy
*/
private String yearId;
/**
* 季度id: yyyyQ1yyyyQ2yyyyQ3yyyyQ4
*/
private String quarterId;
/**
* 月维度Id: yyyyMM
*/
private String monthId;
/**
* 自身指标得分
*/
private BigDecimal selfScore;
/**
* 下级指标得分
*/
private BigDecimal subScore;
/**
* 党建能力dangjiannengli治理能力zhilinengli服务能力fuwunengli
*/
private String parentIndexCode;
/**
* 所有指标code拼接的字符串 冒号隔开
*/
private String allParentIndexCode;
/**
* 自身指标权重
*/
private BigDecimal selfWeight;
/**
* 下级指标权重
*/
private BigDecimal subWeight;
}

100
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexGridSelfSubScoreEntity.java

@ -1,100 +0,0 @@
/**
* 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.entity.evaluationindex.indexcal;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
/**
* 网格相关自身/下级分值记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-21
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("fact_index_grid_self_sub_score")
public class FactIndexGridSelfSubScoreEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
private String customerId;
/**
* 网格Id
*/
private String gridId;
/**
* 网格所属的机关Id
*/
private String agencyId;
/**
* 所有上级ID用英文逗号分开
*/
private String allParentIds;
/**
* 季度id: yyyyQ1yyyyQ2yyyyQ3yyyyQ4
*/
private String quarterId;
/**
* 年度ID: yyyy
*/
private String yearId;
/**
* 月维度Id: yyyyMM
*/
private String monthId;
/**
* 分数类型self自身得分sub下级得分
*/
private String scoreType;
/**
* 分值
*/
private BigDecimal score;
/**
* 党建能力dangjiannengli治理能力zhilinengli服务能力fuwunengli网格相关wanggexiangguan
*/
private String indexCode;
/**
* 所有指标code拼接的字符串 冒号隔开
*/
private String allParentIndexCode;
/**
* 权重
*/
private BigDecimal weight;
}

105
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/GridSelfSubScoreEntity.java

@ -0,0 +1,105 @@
/**
* 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.entity.evaluationindex.indexcal;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
/**
* 网格相关自身/下级分值记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-23
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("fact_index_grid_self_sub_score")
public class GridSelfSubScoreEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
private String customerId;
/**
* 网格Id
*/
private String gridId;
/**
* 网格所属的机关Id
*/
private String agencyId;
/**
* 所有上级ID用英文逗号分开
*/
private String allParentIds;
/**
* 季度id: yyyyQ1yyyyQ2yyyyQ3yyyyQ4
*/
private String quarterId;
/**
* 年度ID: yyyy
*/
private String yearId;
/**
* 月维度Id: yyyyMM
*/
private String monthId;
/**
* 自身指标得分
*/
private BigDecimal selfScore;
/**
* 下级指标得分
*/
private BigDecimal subScore;
/**
* 党建能力dangjiannengli治理能力zhilinengli服务能力fuwunengli
*/
private String parentIndexCode;
/**
* 所有指标code拼接的字符串 冒号隔开
*/
private String allParentIndexCode;
/**
* 自身指标权重
*/
private BigDecimal selfWeight;
/**
* 下级指标权重
*/
private BigDecimal subWeight;
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/project/ProjectProcessEntity.java

@ -87,4 +87,9 @@ public class ProjectProcessEntity extends BaseEpmetEntity {
*/
private String costWorkdays;
/**
* 是否解决
* */
private String isResolved;
}

15
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollCommunityServiceImpl.java

@ -127,20 +127,25 @@ public class IndexCollCommunityServiceImpl implements IndexCollCommunityService
//办结数
Map<String, Integer> agencyHandleCount = factOriginProjectLogDailyService.getProjectHandledAgency(customerId,dimId.getMonthId(),"month");
Map<String,BigDecimal> responseMap = factOriginProjectLogDailyService.getAgencyResponseRatio(customerId,dimId.getMonthId(),"month");
Map<String,Integer> agencyParticipatedCount = factOriginProjectLogDailyService.getCountOfProjectsHandledByAgency(customerId,dimId.getMonthId(),"month");
Map<String,BigDecimal> efficiencyMap = factOriginProjectLogDailyService.getAgencyWorkPieceRatio(customerId,dimId.getMonthId(),"month");
list.forEach(entity ->{
entity.setClosedProjectCount(agencyHandleCount.get(entity.getAgencyId()) == null? NumConstant.ZERO : agencyHandleCount.get(entity.getAgencyId()));
BigDecimal element = entity.getClosedProjectRatio();
if (entity.getTransferedCount() != NumConstant.ZERO) {
BigDecimal element = new BigDecimal(entity.getClosedProjectCount());
//分母,即机关参与过的项目数(去重)
Integer denominator = agencyParticipatedCount.get(entity.getAgencyId());
if (agencyParticipatedCount.get(entity.getAgencyId()) != NumConstant.ZERO) {
//办结率
entity.setClosedProjectRatio(
element.divide(new BigDecimal(entity.getTransferedCount()), NumConstant.SIX, RoundingMode.HALF_UP)
element.divide(new BigDecimal(denominator), NumConstant.SIX, RoundingMode.HALF_UP)
);
}
//响应度
//办结效率
entity.setHandleProjectRatio(efficiencyMap.get(entity.getAgencyId()));
});
factIndexGovrnAblityOrgMonthlyService.deleteByCustomer(customerId, dimId.getMonthId(), OrgTypeConstant.COMMUNITY);
factIndexGovrnAblityOrgMonthlyService.saveList(list);

15
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollStreetServiceImpl.java

@ -78,6 +78,7 @@ public class IndexCollStreetServiceImpl implements IndexCollStreetService {
//办结项目率
entity.setClosedProjectRatio(new BigDecimal(NumConstant.ZERO));
entity.setSatisfactionRatio(new BigDecimal(NumConstant.ZERO));
//街道办结项目的处理效率
entity.setHandleProjectRatio(new BigDecimal(NumConstant.ZERO));
return entity;
}).collect(Collectors.toList());
@ -117,17 +118,21 @@ public class IndexCollStreetServiceImpl implements IndexCollStreetService {
}
//办结数
Map<String, Integer> agencyHandleCount = factOriginProjectLogDailyService.getProjectHandledAgency(customerId,dimId.getMonthId(),"month");
Map<String,BigDecimal> responseMap = factOriginProjectLogDailyService.getAgencyResponseRatio(customerId,dimId.getMonthId(),"month");
Map<String,Integer> agencyParticipatedCount = factOriginProjectLogDailyService.getCountOfProjectsHandledByAgency(customerId,dimId.getMonthId(),"month");
Map<String,BigDecimal> efficiencyMap = factOriginProjectLogDailyService.getAgencyWorkPieceRatio(customerId,dimId.getMonthId(),"month");
list.forEach(entity ->{
entity.setClosedProjectCount(agencyHandleCount.get(entity.getAgencyId()) == null? NumConstant.ZERO : agencyHandleCount.get(entity.getAgencyId()));
BigDecimal element = entity.getClosedProjectRatio();
if (entity.getTransferedCount() != NumConstant.ZERO) {
BigDecimal element = new BigDecimal(entity.getClosedProjectCount());
//分母,即机关参与过的项目数(去重)
Integer denominator = agencyParticipatedCount.get(entity.getAgencyId());
if (agencyParticipatedCount.get(entity.getAgencyId()) != NumConstant.ZERO) {
//办结率
entity.setClosedProjectRatio(
element.divide(new BigDecimal(entity.getTransferedCount()), NumConstant.SIX, RoundingMode.HALF_UP)
element.divide(new BigDecimal(denominator), NumConstant.SIX, RoundingMode.HALF_UP)
);
}
//响应度
//办结效率
entity.setHandleProjectRatio(efficiencyMap.get(entity.getAgencyId()));
});
factIndexGovrnAblityOrgMonthlyService.deleteByCustomer(customerId, dimId.getMonthId(), OrgTypeConstant.STREET);

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java

@ -18,6 +18,8 @@
package com.epmet.service.evaluationindex.extract.todata;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dto.extract.FactOriginGroupMainDailyDTO;
import com.epmet.dto.group.result.ExtractGroupMemberActionRecordResultDTO;
import com.epmet.entity.evaluationindex.extract.FactOriginGroupMainDailyEntity;
import java.util.List;
@ -49,4 +51,15 @@ public interface FactOriginGroupMainDailyService extends BaseService<FactOriginG
* @Date 2020/9/21 16:13
**/
List<String> selectGroupMemberList(List<String> groupIdList);
/**
* @Description 插入组相关业务抽取数据 为了保证原子性操作封装到一个方法中
* @param isFirst
* @param customerId
* @param originGroupData
* @return
* @author wangc
* @date 2020.09.23 16:30
**/
boolean insertExtractedData(boolean isFirst,String customerId,String dateId,List<FactOriginGroupMainDailyDTO> originGroupData,List<ExtractGroupMemberActionRecordResultDTO> memberList);
}

17
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java

@ -169,21 +169,32 @@ public interface FactOriginProjectLogDailyService extends BaseService<FactOrigin
List<OrgStatisticsResultDTO> getDepTransferCount(String customerId, String monthId, String level);
/**
* @Description 查询各机关办结了多少项目
* @Description 查询各机关办结(办结的含义指每个项目的结点中最高的机关)了多少项目
* @param customerId
* @return
* @author wangc
* @date 2020.09.20 23:46
**/
Map<String,Integer> getProjectHandledAgency(String customerId, String dimId,String dateType);
/**
* @Description 查询机关单位经手的项目数
* @param customerId
* @param dimId
* @param dateType - 日期维度类型 month date week quarter year
* @return
* @author wangc
* @date 2020.09.23 10:06
**/
Map<String,Integer> getCountOfProjectsHandledByAgency(String customerId, String dimId,String dateType);
/**
* @Description 计算机关响应度
* @Description 计算机关办结项目效率
* @param customerId
* @return
* @author wangc
* @date 2020.09.21 02:16
**/
Map<String, BigDecimal> getAgencyResponseRatio(String customerId, String dimId,String dateType);
Map<String, BigDecimal> getAgencyWorkPieceRatio(String customerId, String dimId,String dateType);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/GroupExtractService.java

@ -24,7 +24,7 @@ public interface GroupExtractService {
/**
* @Description 业务抽取 - 小组祥光
* @Description 业务抽取 - 小组数据
* @param param
* @return
* @author wangc

35
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java

@ -18,12 +18,18 @@
package com.epmet.service.evaluationindex.extract.todata.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.dao.evaluationindex.extract.FactOriginGroupMainDailyDao;
import com.epmet.dto.extract.FactOriginGroupMainDailyDTO;
import com.epmet.dto.group.result.ExtractGroupMemberActionRecordResultDTO;
import com.epmet.entity.evaluationindex.extract.FactOriginGroupMainDailyEntity;
import com.epmet.service.evaluationindex.extract.todata.FactOriginGroupMainDailyService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.stream.Collectors;
/**
@ -62,4 +68,33 @@ public class FactOriginGroupMainDailyServiceImpl extends BaseServiceImpl<FactOri
List<String> memberIdList = baseDao.selectGroupMemberList(groupIdList);
return memberIdList;
}
/**
* @Description 插入组相关业务抽取数据 为了保证原子性操作封装到一个方法中
* @param isFirst
* @param customerId
* @param originGroupData
* @return
* @author wangc
* @date 2020.09.23 16:30
**/
@Override
@Transactional(rollbackFor = Exception.class)
public boolean insertExtractedData(boolean isFirst, String customerId, String dateId,List<FactOriginGroupMainDailyDTO> originGroupData, List<ExtractGroupMemberActionRecordResultDTO> memberList) {
if (isFirst) {
//isFirst
baseDao.deleteBatchMemberByCustomerId(customerId,null,null);
} else {
//删除要插入的组主表数据
baseDao.deleteBatchByGroupId(customerId,originGroupData.stream().map(FactOriginGroupMainDailyDTO :: getId).distinct().collect(Collectors.toList()));
if(StringUtils.isNotBlank(dateId)){
baseDao.deleteBatchMemberByCustomerId(customerId,dateId,"date");
}
}
baseDao.insertBatchMain(originGroupData);
baseDao.insertBatchMembers(memberList);
return true;
}
}

41
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java

@ -165,7 +165,7 @@ public class FactOriginProjectLogDailyServiceImpl extends BaseServiceImpl<FactOr
}
/**
* @Description 查询各项目经受了多少机关
* @Description 查询各项目经手的最高机关Id
* @param customerId
* @return
* @author wangc
@ -197,16 +197,44 @@ public class FactOriginProjectLogDailyServiceImpl extends BaseServiceImpl<FactOr
return result;
}
/**
* @Description 查询机关单位经手的项目数
* @param customerId
* @param dimId
* @param dateType - 日期维度类型 month date week quarter year
* @return
* @author wangc
* @date 2020.09.23 10:06
**/
@Override
public Map<String, Integer> getCountOfProjectsHandledByAgency(String customerId, String dimId, String dateType) {
Map<String,Integer> result = new HashMap<>();
List<ProjectParticipatedAgencyResultDTO> projectAgencyCount = baseDao.selectProjectParticipatedAgency(customerId,dimId,dateType);
if(!CollectionUtils.isEmpty(projectAgencyCount)){
Map<String,List<ProjectParticipatedAgencyResultDTO>> map =
projectAgencyCount.stream().collect(Collectors.groupingBy(ProjectParticipatedAgencyResultDTO :: getProjectId));
map.forEach((agency,handledProjectList) -> {
result.put(agency,handledProjectList.size());
});
return result;
}
return result;
}
/**
* @Description 计算机关响应度
* @Description 计算机关办结项目效率
* @param customerId
* @return
* @author wangc
* @date 2020.09.21 02:16
**/
@Override
public Map<String, BigDecimal> getAgencyResponseRatio(String customerId, String dimId, String dateType) {
public Map<String, BigDecimal> getAgencyWorkPieceRatio(String customerId, String dimId, String dateType) {
//网格、部门的办结系数
List<OrgResponseTimeResultDTO> gridDeptResponse = projectOrgPeriodDailyDao.selectSubOrgResponseCoefficient(customerId, dimId, dateType);
//机关的办结系数
List<OrgResponseTimeResultDTO> agencyResponse = projectOrgPeriodDailyDao.selectAgencyResponseCoefficient(customerId, dimId, dateType);
Map<String,BigDecimal> consumingMap = new HashMap<>();
Map<String,BigDecimal> timeMap = new HashMap<>();
@ -229,13 +257,14 @@ public class FactOriginProjectLogDailyServiceImpl extends BaseServiceImpl<FactOr
}
});
}
Map<String,BigDecimal> ratioMap = new HashMap<>();
//效率map
Map<String,BigDecimal> efficiencyMap = new HashMap<>();
if(!CollectionUtils.isEmpty(consumingMap)) {
consumingMap.keySet().forEach(agencyId -> {
ratioMap.put(agencyId, consumingMap.get(agencyId).divide(timeMap.get(agencyId), NumConstant.SIX, RoundingMode.HALF_UP));
efficiencyMap.put(agencyId, consumingMap.get(agencyId).divide(timeMap.get(agencyId), NumConstant.SIX, RoundingMode.HALF_UP));
});
}
return ratioMap;
return efficiencyMap;
}

69
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/GroupExtractServiceImpl.java

@ -9,6 +9,7 @@ import com.epmet.dto.extract.form.GridHeartedFormDTO;
import com.epmet.dto.extract.result.PartyCreateGroupCountResultDTO;
import com.epmet.dto.group.result.ExtractGroupMemberActionRecordResultDTO;
import com.epmet.dto.stats.result.GridAttributesResultDTO;
import com.epmet.service.evaluationindex.extract.todata.FactOriginGroupMainDailyService;
import com.epmet.service.evaluationindex.extract.todata.GroupExtractService;
import com.epmet.service.group.GroupDataService;
import com.epmet.service.stats.DimGridService;
@ -40,6 +41,16 @@ public class GroupExtractServiceImpl implements GroupExtractService {
@Autowired
private FactOriginGroupMainDailyDao groupMainDailyDao;
@Autowired
private FactOriginGroupMainDailyService factOriginGroupMainDailyService;
@Autowired
private GroupDataService groupDataService;
@Autowired
private FactOriginGroupMainDailyDao factOriginGroupMainDailyDao;
@Autowired
private UserService userService;
@Autowired
private DimGridService dimGridService;
/**
* @Description 查询建群党员数
@ -52,14 +63,7 @@ public class GroupExtractServiceImpl implements GroupExtractService {
public List<PartyCreateGroupCountResultDTO> selectPartyCreateGroupCount(String customerId, String monthId) {
return groupMainDailyDao.selectPartyCreateGroupCount(customerId, monthId);
}
@Autowired
private GroupDataService groupDataService;
@Autowired
private FactOriginGroupMainDailyDao factOriginGroupMainDailyDao;
@Autowired
private UserService userService;
@Autowired
private DimGridService dimGridService;
/**
* @Description 业务抽取 - 小组祥光
@ -92,19 +96,6 @@ public class GroupExtractServiceImpl implements GroupExtractService {
gridList.stream().collect(Collectors.toMap(GridAttributesResultDTO::getGridId, Function.identity(), (key1, key2) -> key2));
if (!CollectionUtils.isEmpty(originGroupData)) {
originGroupData.forEach(group -> {
if (!CollectionUtils.isEmpty(group.getMembers())) {
group.setMemberTotal(group.getMembers().size());
group.getMembers().forEach(member -> {
DimIdGenerator.DimIdBean dateInfo = DimIdGenerator.getDimIdBean(member.getJoinDate());
member.setDateId(dateInfo.getDateId());
member.setWeekId(dateInfo.getWeekId());
member.setMonthId(dateInfo.getMonthId());
member.setQuarterId(dateInfo.getQuarterId());
member.setYearId(dateInfo.getYearId());
memberList.add(member);
});
}
GridAttributesResultDTO attr = gridMap.get(group.getGridId());
if (null != attr) {
group.setAgencyId(attr.getAgencyId());
@ -119,19 +110,37 @@ public class GroupExtractServiceImpl implements GroupExtractService {
group.setQuarterId(dateInfo.getQuarterId());
group.setYearId(dateInfo.getYearId());
}
if (!CollectionUtils.isEmpty(group.getMembers())) {
group.setMemberTotal(group.getMembers().size());
group.getMembers().forEach(member -> {
DimIdGenerator.DimIdBean dateInfo = DimIdGenerator.getDimIdBean(member.getJoinDate());
member.setDateId(dateInfo.getDateId());
member.setWeekId(dateInfo.getWeekId());
member.setMonthId(dateInfo.getMonthId());
member.setQuarterId(dateInfo.getQuarterId());
member.setYearId(dateInfo.getYearId());
if(null != attr){
member.setAgencyId(attr.getAgencyId());
member.setParentId(attr.getParentId());
member.setPids(attr.getPids());
}
memberList.add(member);
});
}
});
}
factOriginGroupMainDailyService.insertExtractedData(
count <= NumConstant.ZERO ? true : false,
param.getDateId(),
param.getCustomerId(),
originGroupData,
memberList
);
if (count <= NumConstant.ZERO) {
//isFirst
factOriginGroupMainDailyDao.deleteBatchMemberByCustomerId(param.getCustomerId());
factOriginGroupMainDailyDao.insertBatchMain(originGroupData);
factOriginGroupMainDailyDao.insertBatchMembers(memberList);
} else {
factOriginGroupMainDailyDao.deleteBatchByGroupId(param.getCustomerId(),originGroupData.stream().map(FactOriginGroupMainDailyDTO :: getId).distinct().collect(Collectors.toList()));
factOriginGroupMainDailyDao.insertBatchMembers(memberList);
}
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java

@ -1,6 +1,7 @@
package com.epmet.service.evaluationindex.extract.todata.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.form.TimeListResultDTO;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils;
@ -26,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -126,6 +128,7 @@ public class IssueExtractServiceImpl implements IssueExtractService {
agencyInfoList.forEach(pid -> {
if (r.getAgencyId().equals(pid.getAgencyId())){
r.setPid(pid.getPid());
r.setPids(pid.getPids());
}
});
});
@ -164,6 +167,11 @@ public class IssueExtractServiceImpl implements IssueExtractService {
log.warn("issueExtractMain issueExtractLog return empty,customerId:{},dateId:{}", customerId, dateId);
return true;
}
Map<String, List<IssueProcessInfoResultDTO>> groupByIssue = listResult.stream().collect(Collectors.groupingBy(IssueProcessInfoResultDTO::getIssueId));
groupByIssue.forEach((issueId,process) -> {
List<IssueProcessInfoResultDTO> descByCreateTime = process.stream().sorted(Comparator.comparing(IssueProcessInfoResultDTO::getCreateTime).reversed()).collect(Collectors.toList());
issueMainDailyDao.updateIssueStatus(issueId,descByCreateTime.get(NumConstant.ZERO).getActionCode());
});
listResult.forEach(issueProcess -> {
IssueLogDailyFormDTO issueLogDailyFormDTO = ConvertUtils.sourceToTarget(issueProcess, IssueLogDailyFormDTO.class);
issueLogDailyFormDTO.setOperationUserId(issueProcess.getUserId());
@ -219,6 +227,7 @@ public class IssueExtractServiceImpl implements IssueExtractService {
agencyInfoList.forEach(agency -> {
if (r.getAgencyId().equals(agency.getAgencyId())){
r.setPid(agency.getPid());
r.setPids(agency.getPids());
}
});
});

83
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java

@ -30,6 +30,7 @@ import com.epmet.service.project.ProjectProcessService;
import com.epmet.service.project.ProjectService;
import com.epmet.service.topic.TopicService;
import com.epmet.util.DimIdGenerator;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -48,6 +49,7 @@ import java.util.stream.Collectors;
* @date 2020/9/15 14:00
*/
@Service
@Slf4j
public class ProjectExtractServiceImpl implements ProjectExtractService {
@Autowired
@ -73,6 +75,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
public void saveOriginProjectDaily(ExtractFormDTO extractFormDTO) {
String dateString = extractFormDTO.getDateId();
String customerId = extractFormDTO.getCustomerId();
List<FactOriginProjectMainDailyEntity> list = new LinkedList<>();
//获取已关闭项目列表
List<ProjectProcessEntity> closedList = projectProcessService.getClosedProjectList(customerId, dateString);
List<FactOriginProjectMainDailyDTO> pendingList = factOriginProjectMainDailyService.getPendingList(customerId);
@ -85,6 +88,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
entity.setProjectStatus("close");
entity.setCreatedTime(DateUtils.stringToDate(pending.getDateId(), DateUtils.DATE_PATTERN_YYYYMMDD));
entity.setUpdatedTime(process.getUpdatedTime());
entity.setIsResolved(process.getIsResolved());
return entity;
})).collect(Collectors.toList());
@ -117,7 +121,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
//获取网格认证党员
List<PartyMemberDTO> partyMemberList = partyMemberService.getPartyMemberByCustomer(customerId);
//生成DTO
List<FactOriginProjectMainDailyEntity> list = projectList.stream().map(project -> {
list = projectList.stream().map(project -> {
//获取日期相关维度
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(project.getCreatedTime());
FactOriginProjectMainDailyEntity entity = new FactOriginProjectMainDailyEntity();
@ -131,13 +135,17 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
entity.setDateId(dimId.getDateId());
entity.setIssueId(project.getOriginId());
entity.setProjectStatus(project.getStatus());
entity.setIsResolved(project.getClosedStatus());
entity.setCreatedTime(project.getCreatedTime());
entity.setUpdatedTime(project.getUpdatedTime());
entity.setPids(project.getOrgIdPath());
String[] pIds = project.getOrgIdPath().split(":");
if (pIds.length > 1) {
entity.setPid(pIds[pIds.length - 2]);
} else {
} else if(pIds.length == 1){
entity.setPid(pIds[0]);
} else {
entity.setPid(NumConstant.ZERO_STR);
}
entity.setIsParty(NumConstant.ZERO_STR);
entity.setIsOverdue(NumConstant.ZERO_STR);
@ -168,7 +176,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
factOriginProjectMainDailyService.insertBatch(list);
}
}
final List<FactOriginProjectMainDailyEntity> mainList = list;
//节点发起人
List<ProcessInfoDTO> processList = projectProcessService.getProcessListByCustomer(customerId, dateString);
if (null != processList && !processList.isEmpty()) {
@ -186,12 +194,47 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
entity.setOperationUserId(process.getStaffId());
entity.setActionCode(process.getOperation());
entity.setIsActive(NumConstant.ONE);
entity.setOrgType("grid");
entity.setPids(process.getPids());
if (StringUtils.isNotBlank(process.getDepartmentId())) {
entity.setOrgType("department");
entity.setOrgId(process.getDepartmentId());
entity.setPid(process.getAgencyId());
}else if (StringUtils.isNotBlank(process.getGridId())) {
entity.setOrgType("grid");
entity.setOrgId(process.getGridId());
entity.setPid(process.getAgencyId());
}else{
if(!process.getPids().contains(":")){
entity.setPids("");
entity.setPid(NumConstant.ZERO_STR);
}else{
String[] orgArray = process.getPids().split(":");
if(null != orgArray && orgArray.length > NumConstant.ONE){
entity.setPid(orgArray[orgArray.length - NumConstant.TWO]);
String path = process.getPids().replaceAll(process.getAgencyId(),"");
if(path.endsWith(":")){
path =path.substring(NumConstant.ZERO,path.length() - NumConstant.ONE);
}
entity.setPids(path);
}else{
log.warn("【data-statistical】业务数据抽取模块,ProjectExtractServiceImpl.saveOriginProjectDaily:查询出的项目节点发起人所属的orgIdPath不正确,agencyId->{},orgIdPath->{}",process.getAgencyId(),process.getPids());
entity.setPid(NumConstant.ZERO_STR);
entity.setPids("");
}
}
}
return entity;
}).collect(Collectors.toList());
//项目评论人
List<ProcessInfoDTO> satisfactionRecordList = projectProcessService.getSatisfactionRecord(customerId, dateString);
satisfactionRecordList.forEach(log -> mainList.stream().filter(project -> log.getProjectId().equals(project.getId())).forEach(main -> {
//进行满意度评价的居民的所属机关的父机机关信息
log.setPid(main.getPid());
log.setPids(main.getPids());
}));
logList.addAll(satisfactionRecordList.stream().map(process -> {
//获取日期相关维度
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(process.getCreatedTime());
@ -206,14 +249,13 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
entity.setOperationUserId(process.getStaffId());
entity.setActionCode(process.getOperation());
entity.setIsActive(NumConstant.ONE);
entity.setOrgId(process.getGridId());
entity.setOrgType("grid");
entity.setPids(process.getPids());
entity.setPid(process.getPid());
return entity;
}).collect(Collectors.toList()));
List<FactOriginProjectMainDailyDTO> projectMainList = factOriginProjectMainDailyService.getProjectByCustomer(customerId);
logList.forEach(log -> projectMainList.stream().filter(project -> log.getProjectId().equals(project.getId())).forEach(main -> {
log.setOrgId(main.getGridId());
}));
//节点接收人
List<ProcessInfoDTO> processStaffList = projectProcessService.getProcessStaffByCustomer(customerId, dateString);
@ -231,13 +273,34 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
entity.setOperationUserId(process.getStaffId());
entity.setActionCode(process.getOperation());
entity.setIsActive(NumConstant.ZERO);
entity.setPids(process.getPids());
if (StringUtils.isNotBlank(process.getDepartmentId())) {
entity.setOrgType("department");
entity.setOrgId(process.getDepartmentId());
}
if (StringUtils.isNotBlank(process.getGridId())) {
entity.setPid(process.getAgencyId());
}else if (StringUtils.isNotBlank(process.getGridId())) {
entity.setOrgType("grid");
entity.setOrgId(process.getGridId());
entity.setPid(process.getAgencyId());
}else{
if(!process.getPids().contains(":")){
entity.setPids("");
entity.setPid(NumConstant.ZERO_STR);
}else{
String[] orgArray = process.getPids().split(":");
if(null != orgArray && orgArray.length > NumConstant.ONE){
entity.setPid(orgArray[orgArray.length - NumConstant.TWO]);
String path = process.getPids().replaceAll(process.getAgencyId(),"");
if(path.endsWith(":")){
path =path.substring(NumConstant.ZERO,path.length() - NumConstant.ONE);
}
entity.setPids(path);
}else{
log.warn("【data-statistical】业务数据抽取模块,ProjectExtractServiceImpl.saveOriginProjectDaily:查询出的项目节点发起人所属的orgIdPath不正确,agencyId->{},orgIdPath->{}",process.getAgencyId(),process.getPids());
entity.setPid(NumConstant.ZERO_STR);
entity.setPids("");
}
}
}
return entity;
}).collect(Collectors.toList()));

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

@ -1,12 +1,34 @@
package com.epmet.service.evaluationindex.extract.toscreen.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.dto.extract.form.PartyBaseInfoFormDTO;
import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO;
import com.epmet.dto.extract.result.PartyInfoResultDTO;
import com.epmet.dto.extract.result.PartyMemberInfoResultDTO;
import com.epmet.dto.extract.result.UserCountResultDTO;
import com.epmet.service.evaluationindex.extract.toscreen.PartyBaseInfoService;
import com.epmet.service.evaluationindex.screen.ScreenCpcBaseDataService;
import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService;
import com.epmet.service.evaluationindex.screen.ScreenCustomerGridService;
import com.epmet.service.stats.DimCustomerPartymemberService;
import com.epmet.service.stats.user.FactParticipationUserAgencyDailyService;
import com.epmet.service.stats.user.FactParticipationUserGridDailyService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.ListUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import com.epmet.constant.ScreenConstant;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Desciption 党员基本情况
@ -19,6 +41,16 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService {
@Autowired
private ScreenCustomerAgencyService agencyService;
@Autowired
private ScreenCustomerGridService gridService;
@Autowired
private DimCustomerPartymemberService partyMemberService;
@Autowired
private FactParticipationUserGridDailyService userGridDailyService;
@Autowired
private FactParticipationUserAgencyDailyService userAgencyDailyService;
@Autowired
private ScreenCpcBaseDataService cpcBaseDataService;
/**
* @Description 统计基层党建-党员基本情况
@ -29,9 +61,232 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService {
*/
@Override
public Boolean statsPartyMemberBaseInfoToScreen(String customerId, String dateId) {
String agencyId = "cyagstrbee8711eaa1fac03fd56f7847";
Map<String, Object> stringObjectMap = agencyService.selectAllSubAgencyId(agencyId, customerId);
System.out.println(stringObjectMap);
return null;
List<CustomerAgencyInfoResultDTO> agencyIdList = agencyService.selectAllAgencyId(customerId);
if (!CollectionUtils.isEmpty(agencyIdList)){
Map<String, List<CustomerAgencyInfoResultDTO>> groupByLevel = agencyIdList.stream().collect(Collectors.groupingBy(CustomerAgencyInfoResultDTO::getLevel));
if (groupByLevel.containsKey(ScreenConstant.COMMUNITY)){
List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.COMMUNITY);
disPose(customerGridInfoList,true,customerId,dateId);
}
if (groupByLevel.containsKey(ScreenConstant.STREET)){
List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.STREET);
disPose(customerGridInfoList,false,customerId,dateId);
}
if (groupByLevel.containsKey(ScreenConstant.DISTRICT)){
List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.DISTRICT);
disPose(customerGridInfoList,false,customerId,dateId);
}
if (groupByLevel.containsKey(ScreenConstant.CITY)){
List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.CITY);
disPose(customerGridInfoList,false,customerId,dateId);
}
if (groupByLevel.containsKey(ScreenConstant.PROVINCE)){
List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.PROVINCE);
disPose(customerGridInfoList,false,customerId,dateId);
}
}
return true;
}
/**
* @Description
* @param isGrid true:level = community
* @author zxc
* @date 2020/9/22 4:48 下午
*/
public void disPose(List<CustomerAgencyInfoResultDTO> agencyIdList, Boolean isGrid, String customerId, String dateId){
if (!CollectionUtils.isEmpty(agencyIdList)){
List<String> orgIds = agencyIdList.stream().map(m -> m.getAgencyId()).collect(Collectors.toList());
List<PartyBaseInfoFormDTO> result = new ArrayList<>();
if (isGrid == true){
List<UserCountResultDTO> userCountList = userGridDailyService.selectUserCount(customerId, dateId);
agencyIdList.forEach(agency -> {
// 1. 处理社区下的所有网格中的党员信息
String agencyId = agency.getAgencyId();
Map<String, Object> agencyMap = agencyService.selectAllSubAgencyId(agencyId, customerId);
List<String> gridIds = (List<String>) agencyMap.get(agencyId);
orgIds.addAll(gridIds);
List<PartyMemberInfoResultDTO> partyMemberInfoList = partyMemberService.selectPartyMemberInfo(customerId, gridIds);
if (!CollectionUtils.isEmpty(partyMemberInfoList)){
// 为每个人赋值年龄
partyMemberInfoList.forEach(party -> {
party.setAge(getAge(party.getBirthday()));
});
Map<String, List<PartyMemberInfoResultDTO>> groupByGridId = partyMemberInfoList.stream().collect(Collectors.groupingBy(PartyMemberInfoResultDTO::getGridId));
groupByGridId.forEach((gridId,partyInfos) -> {
PartyBaseInfoFormDTO form = new PartyBaseInfoFormDTO();
form.setOrgType(ScreenConstant.GRID);
form.setOrgId(gridId);
form.setOrgName(partyInfos.get(NumConstant.ZERO).getGridName());
form.setAgeLevel1(disposeAge(partyInfos,NumConstant.TWENTY,false));
form.setAgeLevel2(disposeAgeArea(partyInfos,NumConstant.TWENTY,NumConstant.THIRTY));
form.setAgeLevel3(disposeAgeArea(partyInfos,NumConstant.THIRTY_ONE,NumConstant.FORTY));
form.setAgeLevel4(disposeAgeArea(partyInfos,NumConstant.FORTY_ONE,NumConstant.FIFTY));
form.setAgeLevel5(disposeAgeArea(partyInfos,NumConstant.FIFTY_ONE,NumConstant.SIXTY));
form.setAgeLevel6(disposeAge(partyInfos,NumConstant.SIXTY,true));
form.setCustomerId(customerId);
form.setDataEndTime(dateId);
form.setParentId(partyInfos.get(NumConstant.ZERO).getAgencyId());
if (!CollectionUtils.isEmpty(userCountList)){
userCountList.forEach(user -> {
if (gridId.equals(user.getOrgId())){
form.setResiTotal(user.getResiTotal());
form.setRegisterUserCount(user.getRegisterUserCount());
form.setPartyMemberCount(user.getPartyMemberCount());
}
});
}
result.add(form);
});
}
});
// 2. 处理社区级别的党员信息
Map<String, List<PartyBaseInfoFormDTO>> groupByAgency = result.stream().collect(Collectors.groupingBy(PartyBaseInfoFormDTO::getParentId));
groupByAgency.forEach((commAgencyId,party) -> {
PartyBaseInfoFormDTO form = new PartyBaseInfoFormDTO();
form.setOrgName(party.get(NumConstant.ZERO).getOrgName());
form.setOrgId(commAgencyId);
form.setCustomerId(customerId);
form.setDataEndTime(dateId);
form.setOrgType(ScreenConstant.AGENCY);
form.setParentId(party.get(NumConstant.ZERO).getParentId());
form.setAgeLevel1(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel1)));
form.setAgeLevel2(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel2)));
form.setAgeLevel3(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel3)));
form.setAgeLevel4(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel4)));
form.setAgeLevel5(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel5)));
form.setAgeLevel6(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel6)));
form.setPartyMemberCount(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getPartyMemberCount)));
form.setResiTotal(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getResiTotal)));
form.setRegisterUserCount(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getRegisterUserCount)));
result.add(form);
});
delAndInsert(result,customerId,dateId,orgIds);
}else {
agencyIdList.forEach(agency -> {
String agencyId = agency.getAgencyId();
List<PartyInfoResultDTO> partyInfoList = cpcBaseDataService.selectPartyInfo(customerId, dateId, agencyId);
if (!CollectionUtils.isEmpty(partyInfoList)){
PartyBaseInfoFormDTO form = new PartyBaseInfoFormDTO();
form.setOrgName(partyInfoList.get(NumConstant.ZERO).getOrgName());
form.setOrgId(agencyId);
form.setCustomerId(customerId);
form.setDataEndTime(dateId);
form.setOrgType(ScreenConstant.AGENCY);
form.setParentId(partyInfoList.get(NumConstant.ZERO).getParentId());
form.setAgeLevel1(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel1)));
form.setAgeLevel2(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel2)));
form.setAgeLevel3(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel3)));
form.setAgeLevel4(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel4)));
form.setAgeLevel5(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel5)));
form.setAgeLevel6(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel6)));
form.setPartyMemberCount(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getPartyMemberCount)));
form.setResiTotal(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getResiTotal)));
form.setRegisterUserCount(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getRegisterUserCount)));
result.add(form);
}
});
delAndInsert(result,customerId,dateId,orgIds);
}
}
}
/**
* @Description 根据生日计算年龄
* @param birthday
* @author zxc
* @date 2020/9/22 5:34 下午
*/
public Integer getAge(Date birthday){
LocalDate now = LocalDate.now();
int nowYear = now.getYear();
int nowMonth = now.getMonthValue();
int nowDayOfMonth = now.getDayOfMonth();
LocalDate birth = birthday.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
int birthDayYear = birth.getYear();
int birthDayMonth = birth.getMonthValue();
int birthDayOfMonth = birth.getDayOfMonth();
int age = nowYear - birthDayYear;
if (nowMonth < birthDayMonth || (nowMonth == birthDayMonth && nowDayOfMonth < birthDayOfMonth)) {
age--;
}
return age;
}
/**
* @Description 处理年龄段之间的人数
* @param partyMemberInfoList
* @param startAge
* @param endAge
* @author zxc
* @date 2020/9/22 5:45 下午
*/
public Integer disposeAgeArea(List<PartyMemberInfoResultDTO> partyMemberInfoList, Integer startAge,Integer endAge ){
if (!CollectionUtils.isEmpty(partyMemberInfoList)){
List<PartyMemberInfoResultDTO> collect = partyMemberInfoList.stream().filter(p -> p.getAge() >= startAge).filter(p -> p.getAge() <= endAge).collect(Collectors.toList());
return collect.size();
}
return NumConstant.ZERO;
}
/**
* @Description 计算 大于/小于 年龄的人数
* @param partyMemberInfoList
* @param age
* @param isGreater 是否是 大于
* @author zxc
* @date 2020/9/22 5:49 下午
*/
public Integer disposeAge(List<PartyMemberInfoResultDTO> partyMemberInfoList, Integer age , Boolean isGreater){
if (!CollectionUtils.isEmpty(partyMemberInfoList)){
List<PartyMemberInfoResultDTO> collect = new ArrayList<>();
if (isGreater == true){
collect = partyMemberInfoList.stream().filter(p -> p.getAge() > age).collect(Collectors.toList());
}else {
collect = partyMemberInfoList.stream().filter(p -> p.getAge() < age).collect(Collectors.toList());
}
return collect.size();
}
return NumConstant.ZERO;
}
/**
* @Description
* @param result
* @param customerId
* @param dateId
* @author zxc
* @date 2020/9/23 10:13 上午
*/
@Transactional(rollbackFor = Exception.class)
public void delAndInsert(List<PartyBaseInfoFormDTO> result, String customerId, String dateId, List<String> orgIds){
List<PartyBaseInfoFormDTO> partyBaseInfoList = agencyService.selectAllAgencyIdToParty(customerId,dateId);
List<PartyBaseInfoFormDTO> resultList = gridService.selectAllGridIdToParty(customerId, dateId);
resultList.addAll(partyBaseInfoList);
List<PartyBaseInfoFormDTO> finalResult = new ArrayList<>();
resultList.forEach(rl -> {
orgIds.forEach(orgId -> {
if (rl.getOrgId().equals(orgId)){
finalResult.add(rl);
}
});
});
if (!CollectionUtils.isEmpty(result)){
finalResult.forEach(fr -> {
result.forEach(r -> {
if (fr.getOrgId().equals(r.getOrgId())){
BeanUtils.copyProperties(r,fr);
}
});
});
}
Integer delNum;
do {
delNum = cpcBaseDataService.deleteOldPartyBaseInfo(customerId, dateId, orgIds);
}while (delNum > NumConstant.ZERO);
List<List<PartyBaseInfoFormDTO>> partition = ListUtils.partition(finalResult, NumConstant.ONE_HUNDRED);
partition.forEach(p -> {
cpcBaseDataService.insertPartyBaseInfo(p);
});
}
}

62
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java

@ -11,6 +11,7 @@ import com.epmet.constant.DataSourceConstant;
import com.epmet.constant.IndexCalConstant;
import com.epmet.dao.evaluationindex.indexcal.CpcScoreDao;
import com.epmet.dao.evaluationindex.indexcal.GridScoreDao;
import com.epmet.dao.evaluationindex.indexcal.GridSelfSubScoreDao;
import com.epmet.dao.evaluationindex.indexcal.GridSubScoreDao;
import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyDao;
import com.epmet.dao.evaluationindex.indexcoll.FactIndexPartyAblityGridMonthlyDao;
@ -20,6 +21,7 @@ import com.epmet.dao.evaluationindex.screen.ScreenCustomerGridDao;
import com.epmet.dto.ScreenCustomerGridDTO;
import com.epmet.dto.indexcal.*;
import com.epmet.entity.evaluationindex.indexcal.GridScoreEntity;
import com.epmet.entity.evaluationindex.indexcal.GridSelfSubScoreEntity;
import com.epmet.entity.evaluationindex.indexcal.GridSubScoreEntity;
import com.epmet.entity.evaluationindex.screen.IndexGroupDetailEntity;
import com.epmet.eum.IndexCodeEnum;
@ -74,6 +76,8 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
private GridSubScoreDao gridSubScoreDao;
@Autowired
private IndexGroupDetailDao indexGroupDetailDao;
@Autowired
private GridSelfSubScoreDao gridSelfSubScoreDao;
/**
@ -110,16 +114,68 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
indexList.forEach(index -> {
String levelIndexPath = index.getAllParentIndexCode().concat(StrConstant.COLON).concat(index.getIndexCode());
//获取出指标之间的关系
List<IndexGroupDetailEntity> slefsubIndexList = indexGroupDetailDao.selectSelfSubIndex(formDTO.getCustomerId(), levelIndexPath);
if (CollectionUtils.isEmpty(slefsubIndexList)) {
log.error("calculateSelfSubScore customerId:{} have not any indexGroupDetail", formDTO.getCustomerId());
List<IndexGroupDetailEntity> selfSubIndexList = indexGroupDetailDao.selectSelfSubIndex(formDTO.getCustomerId(), levelIndexPath);
if (CollectionUtils.isEmpty(selfSubIndexList)) {
log.error("calculateSelfSubScore indexGroupDetailDao.selectSelfSubIndex return empty,customerId:{}", formDTO.getCustomerId());
return;
}
//获取该能力下的分数
List<GridSubScoreEntity> subScore = gridSubScoreDao.selectSubListByPath(formDTO.getCustomerId(), formDTO.getMonthId(), levelIndexPath);
if (CollectionUtils.isEmpty(subScore)) {
log.error("calculateSelfSubScore gridSubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId());
return;
}
Map<String, Set<String>> selfSubParentMap = new HashMap<>();
selfSubParentMap.put("zishen", new HashSet<>());
selfSubParentMap.put("xiaji", new HashSet<>());
selfSubIndexList.forEach(o -> {
//找出自身 和下级的指标
if (o.getAllIndexCodePath().indexOf("xiaji") > -1) {
selfSubParentMap.get("xiaji").add(o.getIndexCode());
} else {
selfSubParentMap.get("zishen").add(o.getIndexCode());
}
});
Map<String, GridSelfSubScoreEntity> insertMap = new HashMap<>();
subScore.forEach(score -> {
String key = score.getGridId().concat(index.getIndexCode());
GridSelfSubScoreEntity scoreEntity = insertMap.get(key);
if (scoreEntity == null) {
scoreEntity = ConvertUtils.sourceToTarget(score, GridSelfSubScoreEntity.class);
insertMap.put(key, scoreEntity);
scoreEntity.setSelfScore(new BigDecimal(0));
scoreEntity.setSubScore(new BigDecimal(0));
scoreEntity.setParentIndexCode(index.getIndexCode());
scoreEntity.setSelfWeight(new BigDecimal(0));
scoreEntity.setSubWeight(new BigDecimal(0));
}
BigDecimal partScore = score.getScore().multiply(score.getWeight());
BigDecimal partWeight = score.getScore().multiply(score.getWeight());
if (selfSubParentMap.get("xiaji").contains(score.getIndexCode())) {
scoreEntity.setSubScore(scoreEntity.getSubScore().add(partScore));
scoreEntity.setSubWeight(scoreEntity.getSubWeight().add(score.getWeight()));
} else {
scoreEntity.setSelfScore(scoreEntity.getSelfScore().add(partScore));
scoreEntity.setSelfWeight(scoreEntity.getSelfWeight().add(score.getWeight()));
}
log.debug("=====key" + key + ",grid:{},originScore:{},weight:{},finalScore:{},total", score.getGridId(), score.getScore(), score.getWeight(), partScore);
System.out.println("=====grid:" + score.getGridId() + ",originScore:" + score.getScore() + ",weight:" + score.getWeight() + ",finalScore:" + partScore + " ,selftotal:" + scoreEntity.getSelfScore() + ",subScore:" + scoreEntity.getSubScore());
});
deleteAndInsertSelfSubScore(formDTO, index.getIndexCode(), insertMap);
});
}
@Transactional(rollbackFor = Exception.class)
public void deleteAndInsertSelfSubScore(CalculateCommonFormDTO formDTO, String indexCode, Map<String, GridSelfSubScoreEntity> insertMap) {
int effectRow = 0;
do {
gridSelfSubScoreDao.deleteByMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), indexCode);
} while (effectRow > 0);
gridSelfSubScoreDao.insertBatch(new ArrayList<>(insertMap.values()));
}
/**
* @param formDTO
* @return void

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

Loading…
Cancel
Save