diff --git a/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/config/DynamicDataSource.java b/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/config/DynamicDataSource.java index 62939c595f..a70cac86ae 100644 --- a/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/config/DynamicDataSource.java +++ b/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; } diff --git a/epmet-commons/epmet-commons-extapp-auth/pom.xml b/epmet-commons/epmet-commons-extapp-auth/pom.xml index de7060d57f..b563afcb7d 100644 --- a/epmet-commons/epmet-commons-extapp-auth/pom.xml +++ b/epmet-commons/epmet-commons-extapp-auth/pom.xml @@ -27,6 +27,12 @@ + + io.jsonwebtoken + jjwt + 0.7.0 + + org.springframework.boot spring-boot-starter-web diff --git a/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/annotation/InternalAppRequestAuth.java b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/annotation/InternalAppRequestAuth.java new file mode 100644 index 0000000000..921860627c --- /dev/null +++ b/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 + *

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

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * 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 { + +} diff --git a/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/aspect/ExternalAppRequestAuthAspect.java b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/aspect/ExternalAppRequestAuthAspect.java index 5585cfaa79..060b882cf5 100644 --- a/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/aspect/ExternalAppRequestAuthAspect.java +++ b/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 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++) { diff --git a/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/jwt/JwtTokenProperties.java b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/jwt/JwtTokenProperties.java new file mode 100644 index 0000000000..8c7dcc2636 --- /dev/null +++ b/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; + } +} diff --git a/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/jwt/JwtTokenUtils.java b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/jwt/JwtTokenUtils.java new file mode 100644 index 0000000000..bd5eff1beb --- /dev/null +++ b/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. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +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 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 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")); + } + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java index 1d727fb297..bcef31dc14 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java +++ b/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; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index a61c25d8cf..e4832a1c8b 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -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, "至少需要添加一个段落"), diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityIndexFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityIndexFormDTO.java new file mode 100644 index 0000000000..bdf6aa34c5 --- /dev/null +++ b/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 {} + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityListFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityListFormDTO.java new file mode 100644 index 0000000000..f1c4221482 --- /dev/null +++ b/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 {} + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthAblityListFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthAblityListFormDTO.java new file mode 100644 index 0000000000..365fdb2000 --- /dev/null +++ b/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 {} + + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthScoreListFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthScoreListFormDTO.java new file mode 100644 index 0000000000..3efeee665f --- /dev/null +++ b/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 {} + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/PeerComparisonFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/PeerComparisonFormDTO.java new file mode 100644 index 0000000000..2d0b69bd2f --- /dev/null +++ b/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 {} + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/RootAgencyFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/RootAgencyFormDTO.java new file mode 100644 index 0000000000..97355373a3 --- /dev/null +++ b/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 {} + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ScoreListFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ScoreListFormDTO.java new file mode 100644 index 0000000000..ea430fa0a7 --- /dev/null +++ b/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 {} + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AnNingSubAgencyIndexRankFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankYMFormDTO.java similarity index 63% rename from epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AnNingSubAgencyIndexRankFormDTO.java rename to epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankYMFormDTO.java index 683aebbe7c..fc7e43593e 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AnNingSubAgencyIndexRankFormDTO.java +++ b/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; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityIndexResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityIndexResultDTO.java new file mode 100644 index 0000000000..d50bcdc137 --- /dev/null +++ b/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 scoreList; + + @Data + public static class ScoreListResultDTO implements Serializable { + /** + * 能力总分 + */ + private Double indexTotal; + /** + * 本级能力分 + */ + private Double agencyScore; + /** + * 下级能力分 + */ + private Double subAgencyScore; + /** + * 横坐标(202009) + */ + private String monthId; + + } + + + + + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java new file mode 100644 index 0000000000..2df53bff05 --- /dev/null +++ b/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; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AnNingSubAgencyIndexRankResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AnNingSubAgencyIndexRankResultDTO.java index f93b98b16d..c4653c9a71 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AnNingSubAgencyIndexRankResultDTO.java +++ b/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 = ""; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthAblityListResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthAblityListResultDTO.java new file mode 100644 index 0000000000..86e9372e78 --- /dev/null +++ b/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; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthScoreListResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthScoreListResultDTO.java new file mode 100644 index 0000000000..c40628cdd4 --- /dev/null +++ b/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 scoreList; + + @Data + public static class ScoreListResultDTO implements Serializable { + /** + * 能力总分 + */ + private Double indexTotal; + /** + * 本级能力分 + */ + private Double agencyScore; + /** + * 下级能力分 + */ + private Double subAgencyScore; + /** + * 横坐标(202009) + */ + private String monthId; + + } + + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PeerComparisonResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PeerComparisonResultDTO.java new file mode 100644 index 0000000000..95e9545a8c --- /dev/null +++ b/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; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/RootAgencyResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/RootAgencyResultDTO.java new file mode 100644 index 0000000000..910e56eaa3 --- /dev/null +++ b/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; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScoreListResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScoreListResultDTO.java new file mode 100644 index 0000000000..9672f58bfe --- /dev/null +++ b/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; + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/FactConstant.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/FactConstant.java new file mode 100644 index 0000000000..529563feb2 --- /dev/null +++ b/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"; +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/fact/FactIndexController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/fact/FactIndexController.java new file mode 100644 index 0000000000..4399756545 --- /dev/null +++ b/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> ablityIndex(@LoginUser TokenDto tokenDTO, @RequestBody AblityIndexFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, AblityIndexFormDTO.AddUserInternalGroup.class); + return new Result>().ok(factIndexService.ablityIndex(formDTO)); + } + + /** + * @param tokenDTO + * @Description 按月份查询各项能力分数 + * @author sun + */ + @PostMapping("index/scorelist") + public Result> scoreList(@LoginUser TokenDto tokenDTO, @RequestBody ScoreListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ScoreListFormDTO.AddUserInternalGroup.class); + return new Result>().ok(factIndexService.scoreList(formDTO)); + } + + /** + * @param tokenDTO + * @Description 按月份查询各项能力最近12个月得分 + * @author sun + */ + @PostMapping("index/monthscorelist") + public Result> monthScoreList(@LoginUser TokenDto tokenDTO, @RequestBody MonthScoreListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, MonthScoreListFormDTO.AddUserInternalGroup.class); + return new Result>().ok(factIndexService.monthScoreList(formDTO)); + } + + /** + * @param tokenDTO + * @Description 按月查询各项指标数据 + * @author sun + */ + @PostMapping("index/ablitylist") + public Result> ablityList(@LoginUser TokenDto tokenDTO, @RequestBody AblityListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, AblityListFormDTO.AddUserInternalGroup.class); + return new Result>().ok(factIndexService.ablityList(formDTO)); + } + + /** + * @param tokenDTO + * @Description 按月查询各项指标最近12个月数据 + * @author sun + */ + @PostMapping("index/monthablitylist") + public Result> monthAblityList(@LoginUser TokenDto tokenDTO, @RequestBody MonthAblityListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, MonthAblityListFormDTO.AddUserInternalGroup.class); + return new Result>().ok(factIndexService.monthAblityList(formDTO)); + } + + /** + * @param tokenDTO + * @Description 同级对比各项数据查询 + * @author sun + */ + @PostMapping("index/peercomparison") + public Result> peerComparison(@LoginUser TokenDto tokenDTO, @RequestBody PeerComparisonFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, PeerComparisonFormDTO.AddUserInternalGroup.class); + return new Result>().ok(factIndexService.peerComparison(formDTO)); + } + + /** + * @param tokenDTO + * @Description 是否根组织 + * @author sun + */ + @PostMapping("index/rootagency") + public Result rootAgency(@LoginUser TokenDto tokenDTO, @RequestBody RootAgencyFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, RootAgencyFormDTO.AddUserInternalGroup.class); + return new Result().ok(factIndexService.rootAgency(formDTO)); + } + + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java index f2a7ebd151..162065563b 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java +++ b/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> * @Author zhangyong * @Date 13:39 2020-09-11 **/ + @InternalAppRequestAuth @ExternalAppRequestAuth @PostMapping("dataclient/subagencyindexrank") - public Result> anNingSubAgencyIndexRank(@RequestBody AnNingSubAgencyIndexRankFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO, AnNingSubAgencyIndexRankFormDTO.SubAgencyIndexRank.class); - return new Result>().ok(indexService.anNingSubAgencyIndexRank(formDTO)); + public Result> getSubAgencyIndexRank(@RequestBody SubAgencyIndexRankYMFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, SubAgencyIndexRankYMFormDTO.SubAgencyIndexRank.class); + return new Result>().ok(indexService.getSubAgencyIndexRank(formDTO)); } /** diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java index 210c950e78..c56c3e8df8 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java +++ b/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(); diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index 17c48ae989..88aaf3ae2f 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/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 selectParymemberDistribution(@Param("parentId")String parentId); + /** + * @param agencyId + * @Description 根据组织ID判断是否根组织 + * @author sun + */ + int selectRootAgency(@Param("agencyId") String agencyId); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java index 6448f9902b..3374c24026 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java +++ b/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 selectAnNingSubAgencyIndexMonthlyRank(AnNingSubAgencyIndexRankFormDTO formDTO); + List selectSubAgencyOrGridIndexMonthlyRank(SubAgencyIndexRankYMFormDTO formDTO); /** * desc:获取网格指标排行 @@ -79,4 +77,11 @@ public interface ScreenIndexDataMonthlyDao{ * @return */ List selectIndexRankByOrgType(GridIndexRankFormDTO formDTO); + + /** + * @param formDTO + * @Description 同级对比--根据组织Id的上级组织Id查询同级组织对应类型的得分排名(查询最近一个月数据) + * @author sun + */ + List selectScoreList(PeerComparisonFormDTO formDTO); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataYearlyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataYearlyDao.java index 70f0f1b5a6..4300b76ea3 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataYearlyDao.java +++ b/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 selectAnNingSubAgencyIndexYearlyRank(AnNingSubAgencyIndexRankFormDTO formDTO); + List selectAnNingSubAgencyIndexYearlyRank(SubAgencyIndexRankYMFormDTO formDTO); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencyScoreDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencyScoreDao.java new file mode 100644 index 0000000000..b57cb76571 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 selectAblityIndex(AblityIndexFormDTO formDTO); +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencySubScoreDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencySubScoreDao.java new file mode 100644 index 0000000000..0fd8e29c06 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 selectAblityList(AblityListFormDTO formDTO); + + /** + * @param formDTO + * @Description 查询区县级、乡镇街道级组织某项能力对应的一项指标过去12个月份数据 + * @author sun + */ + LinkedList selectMonthAblityList(MonthAblityListFormDTO formDTO); +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunityScoreDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunityScoreDao.java new file mode 100644 index 0000000000..ed9be12d6d --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 selectCommunityAblityIndex(AblityIndexFormDTO formDTO); +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunitySubScoreDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunitySubScoreDao.java new file mode 100644 index 0000000000..1689ab0b3c --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 selectCommunityAblityList(AblityListFormDTO formDTO); + + /** + * @param formDTO + * @Description 查询社区级组织某项能力对应的一项指标过去12个月份数据 + * @author sun + */ + LinkedList selectCommunityMonthAblityList(MonthAblityListFormDTO formDTO); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexGridSelfSubScoreDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridScoreDao.java similarity index 70% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexGridSelfSubScoreDao.java rename to epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridScoreDao.java index af45b61b0e..7944793f56 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexGridSelfSubScoreDao.java +++ b/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 . */ -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 { +public interface FactIndexGridScoreDao { -} \ No newline at end of file +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridSubScoreDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridSubScoreDao.java new file mode 100644 index 0000000000..2edc0a1965 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 { + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java index a7742172d9..21b6bd2554 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java +++ b/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 subAgencyIndexRank(SubAgencyIndexRankFormDTO subAgencyIndexRankFormDTO); /** - * 5、下级部门指数排行(安宁数据段用) + * 5、按月或年 下级组织指数排行 * * @param formDTO * @return java.util.List * @Author zhangyong * @Date 09:38 2020-09-08 **/ - List anNingSubAgencyIndexRank(AnNingSubAgencyIndexRankFormDTO formDTO); + List getSubAgencyIndexRank(SubAgencyIndexRankYMFormDTO formDTO); /** * desc:获取该客户下网格排行 diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java index 6d6632dbdf..c5bf2bab81 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java +++ b/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 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 treeResultDTOS = screenCustomerGridDao.selectGridInfo(rootAgency.getValue()); rootAgency.setChildren(treeResultDTOS); - }else { + } else { List departmentList = this.getDepartmentList(("".equals(rootAgency.getPids()) || rootAgency.getPids().equals(NumConstant.ZERO_STR)) ? rootAgency.getValue() : rootAgency.getPids().concat(",").concat(rootAgency.getValue())); rootAgency.setChildren(departmentList); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java index 7777739c0c..087034645d 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java +++ b/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 anNingSubAgencyIndexRank(AnNingSubAgencyIndexRankFormDTO formDTO) { + public List getSubAgencyIndexRank(SubAgencyIndexRankYMFormDTO formDTO) { List 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())); diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/FactIndexService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/FactIndexService.java new file mode 100644 index 0000000000..475549a522 --- /dev/null +++ b/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 ablityIndex(AblityIndexFormDTO formDTO); + + /** + * @param formDTO + * @Description 按月份查询各项能力分数 + * @author sun + */ + List scoreList(ScoreListFormDTO formDTO); + + /** + * @param formDTO + * @Description 按月份查询各项能力最近12个月得分 + * @author sun + */ + List monthScoreList(MonthScoreListFormDTO formDTO); + + /** + * @param formDTO + * @Description 按月查询各项指标数据 + * @author sun + */ + List ablityList(AblityListFormDTO formDTO); + + /** + * @param formDTO + * @Description 按月查询各项指标最近12个月数据 + * @author sun + */ + List monthAblityList(MonthAblityListFormDTO formDTO); + + /** + * @param formDTO + * @Description 同级对比各项数据查询 + * @author sun + */ + List peerComparison(PeerComparisonFormDTO formDTO); + + /** + * @param formDTO + * @Description 是否根组织 + * @author sun + */ + RootAgencyResultDTO rootAgency(RootAgencyFormDTO formDTO); + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java new file mode 100644 index 0000000000..0ee79681fb --- /dev/null +++ b/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 ablityIndex(AblityIndexFormDTO formDTO) { + LinkedList resultDTO = new LinkedList<>(); + LinkedList djList = null; + LinkedList zlList = null; + LinkedList 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 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 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 monthScoreList(MonthScoreListFormDTO formDTO) { + return null; + } + + /** + * @param formDTO + * @Description 按月查询各项指标数据 + * @author sun + */ + @Override + public List ablityList(AblityListFormDTO formDTO) { + List 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 monthAblityList(MonthAblityListFormDTO formDTO) { + LinkedList 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 peerComparison(PeerComparisonFormDTO formDTO) { + //1.根据组织Id的上级组织Id查询同级组织对应类型的得分排名(查询最近一个月数据) + List 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; + } + +} diff --git a/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml b/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml index d3ebec947d..34d40361e4 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml +++ b/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@ \ No newline at end of file + secret: @dingTalk.robot.secret@ + + +jwt: + token: + #秘钥 + secret: 7016867071f0ebf1c46f123eaaf4b9d6[elink.epmet] + #token有效时长,默认7天,单位秒 + expire: 604800 \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml new file mode 100644 index 0000000000..87a08ed389 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml @@ -0,0 +1,33 @@ + + + + + + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml new file mode 100644 index 0000000000..db62b6c918 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml @@ -0,0 +1,42 @@ + + + + + + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunityScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunityScoreDao.xml new file mode 100644 index 0000000000..10756a9e75 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunityScoreDao.xml @@ -0,0 +1,29 @@ + + + + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml new file mode 100644 index 0000000000..324fbb8a13 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml @@ -0,0 +1,42 @@ + + + + + + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridScoreDao.xml new file mode 100644 index 0000000000..4ff2a2b66c --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridScoreDao.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml new file mode 100644 index 0000000000..ff7c0031c7 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml index 22a62be6d0..932149d9c5 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml @@ -101,4 +101,15 @@ AND sutd.parent_id = #{parentId} + + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml index 36b89ffefe..0676fb2177 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml @@ -61,21 +61,23 @@ LIMIT #{topNum} - - 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' ORDER BY index_total ASC @@ -105,4 +107,62 @@ ORDER BY index_total DESC LIMIT #{topNum} + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataYearlyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataYearlyDao.xml index 4aeae5361a..6c0ebfb5e8 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataYearlyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataYearlyDao.xml @@ -19,14 +19,15 @@ - SELECT - CUSTOMER_ID customerId, - GRID_ID gridId, - AGENCY_ID agencyId, - YEAR_ID yearId, - MONTH_ID monthId, - IS_TOTAL isTotal, - SCORE score, - INDEX_CODE indexCode, - WEIGHT weight + `ID`, + `CUSTOMER_ID`, + `GRID_ID`, + `AGENCY_ID`, + `ALL_PARENT_IDS`, + `QUARTER_ID`, + `YEAR_ID`, + `MONTH_ID`, + `ORIGIN_VALUE`, + `SCORE`, + `INDEX_CODE`, + `ALL_PARENT_INDEX_CODE`, + WEIGHT FROM - fact_index_grid_score + fact_index_grid_sub_score WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} - AND MONTH_ID = #{monthId} + AND ALL_PARENT_INDEX_CODE = #{allIndexCodePath,jdbcType=VARCHAR} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCpcBaseDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCpcBaseDataDao.xml index 03270712ee..7700490255 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCpcBaseDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCpcBaseDataDao.xml @@ -9,6 +9,35 @@ limit 1000; + + + insert into screen_cpc_base_data ( @@ -64,5 +93,73 @@ + + + insert into screen_cpc_base_data + ( + ID, + CUSTOMER_ID, + ORG_TYPE, + ORG_ID, + PARENT_ID, + ORG_NAME, + DATA_END_TIME, + REGISTER_USER_COUNT, + RESI_TOTAL, + PARTY_MEMBER_COUNT, + AGE_LEVEL_1, + AGE_LEVEL_2, + AGE_LEVEL_3, + AGE_LEVEL_4, + AGE_LEVEL_5, + AGE_LEVEL_6, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) values + + ( + REPLACE(UUID(), '-', ''), + #{item.customerId}, + #{item.orgType}, + #{item.orgId}, + #{item.parentId}, + #{item.orgName}, + #{item.dataEndTime}, + #{item.registerUserCount}, + #{item.resiTotal}, + #{item.partyMemberCount}, + #{item.ageLevel1}, + #{item.ageLevel2}, + #{item.ageLevel3}, + #{item.ageLevel4}, + #{item.ageLevel5}, + #{item.ageLevel6}, + #{item.delFlag}, + #{item.revision}, + #{item.createdBy}, + now(), + #{item.updatedBy}, + now() + ) + + + + + + + delete from screen_cpc_base_data + where CUSTOMER_ID = #{customerId} + and DATA_END_TIME = #{dateId} + and + ( + + org_id = #{orgId} + + ) + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml index 7067515e0a..1a66ff709b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml @@ -243,4 +243,47 @@ from screen_customer_agency sca where sca.AGENCY_ID = #{agencyId} + + + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml index 3a15aae8e7..419674a89d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml @@ -217,4 +217,20 @@ where DEL_FLAG = 0 and GRID_ID = #{gridId} + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml index f38b7a5715..e226e3964d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml @@ -209,7 +209,9 @@ SELECT id AS agencyId, - pid + pid, + pids FROM dim_agency WHERE diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerPartymemberDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerPartymemberDao.xml index 3075cedca7..252fcad8b2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerPartymemberDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerPartymemberDao.xml @@ -11,6 +11,7 @@ GRID_ID, AGENCY_ID, PARENT_ID, + PIDS, DATE_ID, WEEK_ID, MONTH_ID, @@ -34,6 +35,7 @@ #{item.gridId}, #{item.agencyId}, #{item.parentId}, + #{item.pids}, #{item.dateId}, #{item.weekId}, #{item.monthId}, @@ -87,4 +89,29 @@ dcp.DEL_FLAG = '0' AND dcp.CUSTOMER_ID =#{customerId} + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml index bbc7e463e1..8b74563b15 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml @@ -74,7 +74,8 @@ SELECT dg.id AS gridId, dg.AGENCY_ID AS agencyId, - da.PID AS parentId + da.PID AS parentId, + da.pids FROM dim_grid dg LEFT JOIN dim_agency da ON da.id = dg.agency_id diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserAgencyDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserAgencyDailyDao.xml index b41b6f89dd..f23abdcbf1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserAgencyDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserAgencyDailyDao.xml @@ -102,5 +102,19 @@ + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserGridDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserGridDailyDao.xml index 575cea1844..96e16db5be 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserGridDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserGridDailyDao.xml @@ -107,5 +107,19 @@ + + + \ No newline at end of file