diff --git a/epmet-cloud-generator/src/main/resources/application.yml b/epmet-cloud-generator/src/main/resources/application.yml index 49dbbb94d5..76cfc7865d 100644 --- a/epmet-cloud-generator/src/main/resources/application.yml +++ b/epmet-cloud-generator/src/main/resources/application.yml @@ -9,7 +9,7 @@ spring: type: com.alibaba.druid.pool.DruidDataSource #MySQL配置 driverClassName: com.mysql.jdbc.Driver - url: jdbc:mysql://192.168.1.130:3306/epmet_evaluation_index?useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://192.168.1.130:3306/epmet_data_statistical?useUnicode=true&characterEncoding=UTF-8&useSSL=false username: epmet_dba password: EpmEt-dbA-UsEr #oracle配置 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/Constant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java index 67aced6dbe..3636e2942d 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java @@ -96,6 +96,8 @@ public interface Constant { * authorization header */ String AUTHORIZATION_HEADER = "authorization"; + + String ACCESS_TOKEN_HEADER = "AccessToken"; /** * APP用户标识 */ 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 e906535166..75c8c1cac9 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,13 +31,18 @@ public interface NumConstant { int FOURTEEN=14; int TWENTY = 20; int THIRTY = 30; + int THIRTY_ONE = 31; int FORTY = 40; + int FORTY_ONE = 41; int FIFTY = 50; + int FIFTY_ONE = 51; int SIXTY = 60; int ONE_HUNDRED = 100; + BigDecimal ONE_HUNDRED_DECIMAL = new BigDecimal(100); int ONE_THOUSAND = 1000; int MAX = 99999999; int EIGHTY_EIGHT = 88; + int EIGHTY = 80; double ZERO_DOT_ZERO = 0.0; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/TimeListResultDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/TimeListResultDTO.java new file mode 100644 index 0000000000..89aed6547c --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/TimeListResultDTO.java @@ -0,0 +1,21 @@ +package com.epmet.commons.tools.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/9/15 5:41 下午 + */ +@Data +public class TimeListResultDTO implements Serializable { + + private static final long serialVersionUID = 1482639109300981626L; + + private String dateId; + private String weekId; + private String monthId; + private String quarterId; + private String yearId; +} 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-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/FeignConfig.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/FeignConfig.java index 0e99c52316..f7ae3265d0 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/FeignConfig.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/FeignConfig.java @@ -8,8 +8,10 @@ package com.epmet.commons.tools.feign; +import feign.Logger; import feign.RequestInterceptor; import feign.RequestTemplate; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; @@ -18,6 +20,7 @@ import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletRequest; import java.util.Enumeration; + /** * Feign调用,携带header * @@ -47,4 +50,9 @@ public class FeignConfig implements RequestInterceptor { } } + + @Bean + Logger.Level feignLoggerLevel() { + return Logger.Level.FULL;//控制台会输出debug日志 + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java index 75174f4216..a7a768b095 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java @@ -10,6 +10,7 @@ package com.epmet.commons.tools.utils; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.dto.form.TimeListResultDTO; import org.apache.commons.lang3.StringUtils; import org.joda.time.DateTime; import org.joda.time.LocalDate; @@ -18,7 +19,11 @@ import org.joda.time.format.DateTimeFormatter; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.time.DateTimeException; +import java.time.ZoneId; import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * 日期处理工具类 @@ -593,4 +598,87 @@ public class DateUtils { } return StrConstant.EPMETY_STR; } + + /** + * @Description 根据dateId获取时间集合 + * @param dateId + * @author zxc + * @date 2020/9/22 9:06 上午 + */ + public static TimeListResultDTO getTimeList(String dateId){ + TimeListResultDTO result = new TimeListResultDTO(); + result.setDateId(dateId); + String monthId = dateId.substring(NumConstant.ZERO, NumConstant.SIX); + result.setMonthId(monthId); + result.setQuarterId(getQuarterId(monthId)); + result.setYearId(getYearId(monthId)); + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd"); + try { + Date date = formatter.parse(dateId); + int weekOfYear = getWeekOfYear(date); + String weekId = dateId.substring(NumConstant.ZERO,NumConstant.FOUR).concat("W").concat(String.valueOf(weekOfYear)); + result.setWeekId(weekId); + } catch (ParseException e) { + e.printStackTrace(); + } + return result; + } + + /** + * @Description 根据monthId【yyyyMM】获取上一个月份ID + * @param monthId + * @author zxc + * @date 2020/9/21 2:43 下午 + */ + public static String minusMonthId(String monthId){ + String minusMonthId = null; + SimpleDateFormat sft = new SimpleDateFormat("yyyyMM"); + try { + Date parse = sft.parse(monthId); + java.time.LocalDate birth = parse.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + java.time.LocalDate localDate = birth.minusMonths(NumConstant.ONE); + minusMonthId = localDate.toString().substring(NumConstant.ZERO, NumConstant.FOUR).concat(localDate.toString().substring(NumConstant.FIVE, NumConstant.SEVEN)); + } catch (ParseException e) { + e.printStackTrace(); + } + return minusMonthId; + } + + /** + * @Description 根据传入的时间维度判断格式,日、周、月、季、年 + * @param dimension + * @return + * @author wangc + * @date 2020.09.24 10:11 + **/ + public static String identifyTimeDimension(String dimension){ + //yyyyMMdd DATE_PATTERN_YYYYMMDD + //yyyyMM DATE_PATTERN_YYYYMM + //yyyy DATE_PATTERN_YYYY + //yyyyWcc + //yyyyQc + if(dimension.length() == NumConstant.EIGHT){ + + SimpleDateFormat df = new SimpleDateFormat(DATE_PATTERN_YYYYMMDD); + try{ df.parse(dimension); }catch (ParseException e){ return null; } + return "date"; + + }else if(dimension.length() == NumConstant.FOUR){ + SimpleDateFormat df = new SimpleDateFormat(DATE_PATTERN_YYYY); + try{df.parse(dimension);}catch (ParseException e){return null;} + return "year"; + }else if(dimension.length() == NumConstant.SEVEN){ + if(dimension.contains("W")){ + return "week"; + }else return null; + }else if(dimension.length() == NumConstant.SIX){ + if(dimension.contains("Q")){ + return "quarter"; + }else{ + SimpleDateFormat df = new SimpleDateFormat(DATE_PATTERN_YYYYMM); + try{df.parse(dimension);}catch (ParseException e){return null;} + return "month"; + } + }else return null; + } } diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index cda5414c1b..4f3f2b06ae 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -58,6 +58,13 @@ 2.0.0 compile + + + + com.epmet + common-service-client + 2.0.0 + diff --git a/epmet-gateway/src/main/java/com/epmet/auth/AuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/AuthProcessor.java new file mode 100644 index 0000000000..4ef47a2eae --- /dev/null +++ b/epmet-gateway/src/main/java/com/epmet/auth/AuthProcessor.java @@ -0,0 +1,26 @@ +package com.epmet.auth; + +import com.alibaba.fastjson.JSON; +import org.springframework.cloud.gateway.filter.GatewayFilterChain; +import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.nio.charset.StandardCharsets; + +public abstract class AuthProcessor { + + abstract Mono auth(ServerWebExchange exchange, GatewayFilterChain chain); + + protected Mono response(ServerWebExchange exchange, Object object) { + String json = JSON.toJSONString(object); + DataBuffer buffer = exchange.getResponse().bufferFactory().wrap(json.getBytes(StandardCharsets.UTF_8)); + exchange.getResponse().getHeaders().setContentType(MediaType.APPLICATION_JSON_UTF8); + exchange.getResponse().setStatusCode(HttpStatus.OK); + return exchange.getResponse().writeWith(Flux.just(buffer)); + } + +} diff --git a/epmet-gateway/src/main/java/com/epmet/auth/ExtAppAuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/ExtAppAuthProcessor.java new file mode 100644 index 0000000000..507f2dc54d --- /dev/null +++ b/epmet-gateway/src/main/java/com/epmet/auth/ExtAppAuthProcessor.java @@ -0,0 +1,31 @@ +package com.epmet.auth; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.server.ServerWebExchange; + + +/** + * 外部应用认证处理器父类 + */ +public abstract class ExtAppAuthProcessor { + + private Logger logger = LoggerFactory.getLogger(getClass()); + + private int diffMillins = 1000 * 60 * 5; + + public abstract void auth(String appId, String token, Long ts, ServerWebExchange exchange); + + /** + * 时间戳校验 + * @param timestamp + * @return + */ + protected boolean validTimeStamp(Long timestamp) { + long now = System.currentTimeMillis(); + if (Math.abs(now - timestamp) > diffMillins) { + return false; + } + return true; + } +} diff --git a/epmet-gateway/src/main/java/com/epmet/auth/ExtAppJwtAuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/ExtAppJwtAuthProcessor.java new file mode 100644 index 0000000000..923e85c441 --- /dev/null +++ b/epmet-gateway/src/main/java/com/epmet/auth/ExtAppJwtAuthProcessor.java @@ -0,0 +1,92 @@ +package com.epmet.auth; + +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.SpringContextUtils; +import com.epmet.feign.EpmetCommonServiceOpenFeignClient; +import com.epmet.jwt.JwtTokenUtils; +import io.jsonwebtoken.Claims; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; + +/** + * jwt 认证处理器 + */ +@Component +public class ExtAppJwtAuthProcessor extends ExtAppAuthProcessor { + + private static Logger logger = LoggerFactory.getLogger(ExtAppJwtAuthProcessor.class); + + @Autowired + private JwtTokenUtils jwtTokenUtils; + + @Autowired + private RedisUtils redisUtils; + + @Override + public void auth(String appId, String token, Long ts, ServerWebExchange exchange) { + String secret; + if (StringUtils.isBlank(secret = getTokenFromCache(appId))) { + throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), String.format("根据AppId:【%s】没有找到对应的秘钥", appId)); + } + + Claims claim; + try { + claim = jwtTokenUtils.getClaimByToken(token, secret); + } catch (Exception e) { + String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); + logger.error("解析token失败:{}", errorStackTrace); + throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), "解析token失败"); + } + + String appIdIn = (String)claim.get("appId"); + String customerId = (String)claim.get("customerId"); + Long timestamp = (Long)claim.get("ts"); + + //校验时间戳,允许5分钟误差 + if (StringUtils.isAnyBlank(appIdIn, customerId) || timestamp == null) { + logger.error("access token不完整。{},{},{}", appIdIn, customerId, timestamp); + throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), "AccessToken不完整"); + } + + if (!validTimeStamp(timestamp)) { + logger.error("extapp token已经超时,请求被拒绝"); + throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), "AccessToken已经超时"); + } + + if (!appId.equals(appIdIn)) { + logger.error("AppId不对应,token外部的:{}, token内部解析出来的:{}", appId, appIdIn); + throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), "AppId不匹配"); + } + + // 添加客户ID等到请求头 + exchange.getRequest().mutate().header("CustomerId", customerId); + } + + /** + * 通过APP ID查询对应的秘钥 + * @param appId + * @return + */ + public String getTokenFromCache(String appId) { + String secret = (String)redisUtils.get(RedisKeys.getExternalAppSecretKey(appId)); + if (StringUtils.isBlank(secret)) { + EpmetCommonServiceOpenFeignClient commonService = SpringContextUtils.getBean(EpmetCommonServiceOpenFeignClient.class); + Result result = commonService.getSecret(appId); + if (!result.success()) { + throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), result.getInternalMsg()); + } + secret = result.getData(); + redisUtils.set(RedisKeys.getExternalAppSecretKey(appId), secret); + } + return secret; + } +} diff --git a/epmet-gateway/src/main/java/com/epmet/auth/ExtAppMD5AuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/ExtAppMD5AuthProcessor.java new file mode 100644 index 0000000000..c9fa8e5c2a --- /dev/null +++ b/epmet-gateway/src/main/java/com/epmet/auth/ExtAppMD5AuthProcessor.java @@ -0,0 +1,75 @@ +package com.epmet.auth; + +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.utils.Md5Util; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.SpringContextUtils; +import com.epmet.feign.EpmetCommonServiceOpenFeignClient; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; + +/** + * md5 认证处理器 + */ +@Component +public class ExtAppMD5AuthProcessor extends ExtAppAuthProcessor { + + private static Logger logger = LoggerFactory.getLogger(ExtAppMD5AuthProcessor.class); + + //@Autowired + //private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; + + @Autowired + private RedisUtils redisUtils; + + @Override + public void auth(String appId, String token, Long ts, ServerWebExchange exchange) { + if (ts == null) { + throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), "需要传入时间戳参数"); + } + String secret; + if (StringUtils.isBlank(secret = getTokenFromCache(appId))) { + throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), String.format("根据AppId:%s没有找到对应的秘钥", appId)); + } + + String localDigest = Md5Util.md5(secret.concat(":") + ts); + if (!localDigest.equals(token)) { + // 调用方生成的摘要跟本地生成的摘要不匹配 + throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), "签名不匹配,认证失败"); + } + + if (!validTimeStamp(ts)) { + logger.error("AccessToken已经超时,请求被拒绝"); + throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), "AccessToken已经超时,请求被拒绝"); + } + } + + /** + * 通过APP ID查询对应的秘钥 + * + * @param appId + * @return + */ + public String getTokenFromCache(String appId) { + String secret = (String) redisUtils.get(RedisKeys.getExternalAppSecretKey(appId)); + if (StringUtils.isBlank(secret)) { + EpmetCommonServiceOpenFeignClient commonService = SpringContextUtils.getBean(EpmetCommonServiceOpenFeignClient.class); + Result result = commonService.getSecret(appId); + if (!result.success()) { + throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), result.getInternalMsg()); + } + + secret = result.getData(); + redisUtils.set(RedisKeys.getExternalAppSecretKey(appId), secret); + } + return secret; + } + +} diff --git a/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java new file mode 100644 index 0000000000..c2614b488a --- /dev/null +++ b/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java @@ -0,0 +1,79 @@ +package com.epmet.auth; + +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.Result; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cloud.gateway.filter.GatewayFilterChain; +import org.springframework.http.HttpHeaders; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +/** + * 外部应用认证 + */ +@Component +public class ExternalAuthProcessor extends AuthProcessor { + + private Logger logger = LoggerFactory.getLogger(getClass()); + + // 头s + public static final String AUTHORIZATION_TOKEN_HEADER_KEY = "Authorization"; + public static final String ACCESS_TOKEN_HEADER_KEY = "AccessToken"; + public static final String APP_ID_HEADER_KEY = "appId"; + public static final String APP_ID_TIMESTAMP_KEY = "ts"; + public static final String APP_ID_CUSTOMER_ID_KEY = "CustomerId"; + public static final String APP_ID_AUTY_TYPE_KEY = "AuthType"; + + // 认证方式 + public static final String APP_AUTH_TYPE_JWT = "jwt"; + public static final String APP_AUTH_TYPE_MD5 = "md5"; + + + @Autowired + private ExtAppJwtAuthProcessor jwtAuthProcessor; + + @Autowired + private ExtAppMD5AuthProcessor md5AuthProcessor; + + @Override + public Mono auth(ServerWebExchange exchange, GatewayFilterChain chain) { + HttpHeaders headers = exchange.getRequest().getHeaders(); + + String token = headers.getFirst(ACCESS_TOKEN_HEADER_KEY); + String appId = headers.getFirst(APP_ID_HEADER_KEY); + String ts = headers.getFirst(APP_ID_TIMESTAMP_KEY); + String customerId = headers.getFirst(APP_ID_CUSTOMER_ID_KEY); + String authType = headers.getFirst(APP_ID_AUTY_TYPE_KEY); + + if (StringUtils.isAnyBlank(token, appId)) { + throw new RenException("请求头中的AccessToken和AppId不能为空"); + } + + logger.info("外部应用请求认证拦截Aspect执行,appId:{}, token:{}, ts:{}, customerId:{}, authType:{}", + appId, token, ts, customerId, authType); + + // 没传authType或者传的jwt都用jwtprocessor处理 + try { + if (StringUtils.isBlank(authType) || APP_AUTH_TYPE_JWT.equals(authType)) { + jwtAuthProcessor.auth(appId, token, StringUtils.isNotBlank(ts) ? new Long(ts) : null, exchange); + } else if (APP_AUTH_TYPE_MD5.equals(authType)) { + md5AuthProcessor.auth(appId, token, StringUtils.isNotBlank(ts) ? new Long(ts) : null, exchange); + } else { + throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), "未知的认证类型"); + } + } catch (RenException e) { + return response(exchange, new Result<>().error(e.getCode(), e.getMsg())); + } catch (Exception e) { + logger.error("外部应用请求认证发生未知错误:" + ExceptionUtils.getErrorStackTrace(e)); + return response(exchange, new Result<>().error("外部应用请求认证发生未知错误")); + } + + return chain.filter(exchange); + } +} diff --git a/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java new file mode 100644 index 0000000000..ee247c843b --- /dev/null +++ b/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java @@ -0,0 +1,175 @@ +package com.epmet.auth; + +import com.epmet.commons.tools.constant.AppClientConstant; +import com.epmet.commons.tools.constant.Constant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.security.dto.BaseTokenDto; +import com.epmet.commons.tools.security.dto.GovTokenDto; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.CpUserDetailRedis; +import com.epmet.commons.tools.utils.Result; +import com.epmet.jwt.JwtTokenUtils; +import io.jsonwebtoken.Claims; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cloud.gateway.filter.GatewayFilterChain; +import org.springframework.http.HttpHeaders; +import org.springframework.http.server.reactive.ServerHttpRequest; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +/** + * 内部认证处理器 + */ +@Component +public class InternalAuthProcessor extends AuthProcessor { + + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private JwtTokenUtils jwtTokenUtils; + + @Autowired + private CpUserDetailRedis cpUserDetailRedis; + + @Override + public Mono auth(ServerWebExchange exchange, GatewayFilterChain chain) { + ServerHttpRequest request = exchange.getRequest(); + String requestUri = request.getPath().pathWithinApplication().value(); + + logger.info("CpAuthGatewayFilterFactory当前requestUri=[" + requestUri + "]CpAuthGatewayFilterFactory拦截成功"); + String token = getTokenFromRequest(request); + //BaseTokenDto baseTokenDto = StringUtils.isNotBlank(token) ? getBaseTokenDto(token, jwtTokenUtils) : null; + BaseTokenDto baseTokenDto; + if(StringUtils.isNotBlank(token)){ + try{ + baseTokenDto = getBaseTokenDto(token, jwtTokenUtils); + }catch(RenException e){ + return response(exchange,new Result<>().error(e.getCode(),e.getMsg())); + } + }else{ + baseTokenDto = null; + } + + String customerId = ""; + + if (baseTokenDto != null) { + if (AppClientConstant.APP_RESI.equals(baseTokenDto.getApp())) { + // 居民端 + TokenDto resiTokenDto = getLoginUserInfoByToken(token, jwtTokenUtils, TokenDto.class); + if (resiTokenDto != null) { + customerId = resiTokenDto.getCustomerId(); + baseTokenDto = resiTokenDto; + } + } else if (AppClientConstant.APP_GOV.equals(baseTokenDto.getApp())) { + // 政府端 + GovTokenDto govTokenDto = getLoginUserInfoByToken(token, jwtTokenUtils, GovTokenDto.class); + if (govTokenDto != null) { + customerId = govTokenDto.getCustomerId(); + baseTokenDto = govTokenDto; + } + } else if(AppClientConstant.APP_OPER.equals(baseTokenDto.getApp())){ + //运营端 + TokenDto resiTokenDto = getLoginUserInfoByToken(token, jwtTokenUtils, TokenDto.class); + if (resiTokenDto != null) { + customerId = resiTokenDto.getCustomerId(); + baseTokenDto = resiTokenDto; + } + } + } + + // 校验token + if (StringUtils.isBlank(token)) { + return response(exchange,new Result<>().error(EpmetErrorCode.ERR10005.getCode(),EpmetErrorCode.ERR10005.getMsg())); + } + try { + validateTokenDto(baseTokenDto, token); + } catch (RenException e) { + return response(exchange,new Result<>().error(e.getCode(),e.getMsg())); + } + + // 添加header + if (baseTokenDto != null) { + String redisKey = baseTokenDto.getApp() + "-" + baseTokenDto.getClient() + "-" + baseTokenDto.getUserId(); + logger.info("redisKey=" + redisKey); + exchange.getRequest().mutate() + .header(Constant.APP_USER_KEY, redisKey) + .header(AppClientConstant.APP,baseTokenDto.getApp()) + .header(AppClientConstant.CLIENT,baseTokenDto.getClient()) + .header(AppClientConstant.USER_ID,baseTokenDto.getUserId()); + + if (StringUtils.equals(baseTokenDto.getApp(), "gov")) {//工作端 + if(StringUtils.isNotBlank(customerId)){ + exchange.getRequest().mutate().header(AppClientConstant.CUSTOMER_ID, customerId); + } + } else if (StringUtils.equals(baseTokenDto.getApp(), "public")) {//公众号端 + exchange.getRequest().mutate().header(AppClientConstant.CUSTOMER_ID, customerId); + } + ServerHttpRequest build = exchange.getRequest().mutate().build(); + return chain.filter(exchange.mutate().request(build).build()); + } + + return chain.filter(exchange); + } + + /** + * 从请求中获取token + * @param request + * @return + */ + private String getTokenFromRequest(ServerHttpRequest request) { + HttpHeaders headers = request.getHeaders(); + String token = headers.getFirst(Constant.AUTHORIZATION_HEADER); + if (StringUtils.isBlank(token)) { + token = headers.getFirst(Constant.TOKEN_HEADER); + } + if (StringUtils.isBlank(token)) { + token = request.getQueryParams().getFirst(Constant.AUTHORIZATION_HEADER); + } + return token; + } + + private BaseTokenDto getBaseTokenDto(String token, JwtTokenUtils jwtTokenUtils) { + //是否过期 + Claims claims = jwtTokenUtils.getClaimByToken(token); + if (claims == null || jwtTokenUtils.isTokenExpired(claims.getExpiration())) { + return null; + } + //获取用户ID + String app = (String) claims.get("app"); + String client = (String) claims.get("client"); + String userId = (String) claims.get("userId"); + return new BaseTokenDto(app, client, userId, token); + } + + private T getLoginUserInfoByToken(String token, JwtTokenUtils jwtTokenUtils, Class clz) { + BaseTokenDto baseTokenDto = getBaseTokenDto(token, jwtTokenUtils); + //查询Redis + return cpUserDetailRedis.get(baseTokenDto.getApp(), baseTokenDto.getClient(), baseTokenDto.getUserId(), clz); + } + + /** + * 校验Token是否异常 + * @param tokenDto + * @param tokenStr + */ + private void validateTokenDto(BaseTokenDto tokenDto, String tokenStr) { + if (null == tokenDto) { + //说明登录状态时效(超时) + throw new RenException(EpmetErrorCode.ERR10006.getCode()); + }else{ + //Redis中存在数据,取出token,进行比对 + if(StringUtils.equals(tokenDto.getToken(),tokenStr)){ + //用户携带token与Redis中一致 + + }else{ + //用户携带token与Redis中不一致,说明当前用户此次会话失效,提示重新登陆 + throw new RenException(EpmetErrorCode.ERR10007.getCode()); + } + } + } +} diff --git a/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java b/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java index 7c74fa6763..59f52483b2 100644 --- a/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java +++ b/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java @@ -2,16 +2,12 @@ package com.epmet.filter; import com.alibaba.fastjson.JSON; +import com.epmet.auth.ExternalAuthProcessor; +import com.epmet.auth.InternalAuthProcessor; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.exception.EpmetErrorCode; -import com.epmet.commons.tools.exception.RenException; -import com.epmet.commons.tools.security.dto.BaseTokenDto; -import com.epmet.commons.tools.security.dto.GovTokenDto; -import com.epmet.commons.tools.security.dto.TokenDto; -import com.epmet.commons.tools.utils.CpUserDetailRedis; import com.epmet.commons.tools.utils.Result; -import com.epmet.jwt.JwtTokenUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -40,16 +36,25 @@ import java.util.List; * @since 1.0.0 */ @Component("CpAuth") -public class CpAuthGatewayFilterFactory extends AbstractGatewayFilterFactory implements UserTokenFilter { +public class CpAuthGatewayFilterFactory extends AbstractGatewayFilterFactory { + private Logger logger = LoggerFactory.getLogger(getClass()); - @Autowired - private CpProperty cpProperty; + private final AntPathMatcher antPathMatcher = new AntPathMatcher(); + + public static final String AUTH_TYPE_INTERNAL = "internal"; + public static final String AUTH_TYPE_EXTERNAL = "external"; + public static final String AUTH_TYPE_NO_NEED = "no_need"; + public static final String AUTH_TYPE_UNKNOW = "unknow"; + @Autowired - private JwtTokenUtils jwtTokenUtils; + private CpProperty cpProperty; + @Autowired - private CpUserDetailRedis cpUserDetailRedis; + private InternalAuthProcessor internalAuthProcessor; + @Autowired + private ExternalAuthProcessor externalAuthProcessor; @Override public List shortcutFieldOrder() { @@ -67,82 +72,23 @@ public class CpAuthGatewayFilterFactory extends AbstractGatewayFilterFactory().error(e.getCode(),e.getMsg())); - } - }else{ - baseTokenDto = null; - } - - String customerId = ""; - - if (baseTokenDto != null) { - if (AppClientConstant.APP_RESI.equals(baseTokenDto.getApp())) { - // 居民端 - TokenDto resiTokenDto = getLoginUserInfoByToken(token, jwtTokenUtils, cpUserDetailRedis, TokenDto.class); - if (resiTokenDto != null) { - customerId = resiTokenDto.getCustomerId(); - baseTokenDto = resiTokenDto; - } - } else if (AppClientConstant.APP_GOV.equals(baseTokenDto.getApp())) { - // 政府端 - GovTokenDto govTokenDto = getLoginUserInfoByToken(token, jwtTokenUtils, cpUserDetailRedis, GovTokenDto.class); - if (govTokenDto != null) { - customerId = govTokenDto.getCustomerId(); - baseTokenDto = govTokenDto; - } - } else if(AppClientConstant.APP_OPER.equals(baseTokenDto.getApp())){ - //运营端 - TokenDto resiTokenDto = getLoginUserInfoByToken(token, jwtTokenUtils, cpUserDetailRedis, TokenDto.class); - if (resiTokenDto != null) { - customerId = resiTokenDto.getCustomerId(); - baseTokenDto = resiTokenDto; - } - } - } - - //需要认证 - if (needAuth(requestUri)) { - if (StringUtils.isBlank(token)) { - return response(exchange,new Result<>().error(EpmetErrorCode.ERR10005.getCode(),EpmetErrorCode.ERR10005.getMsg())); - } - // 校验token - try { - validateTokenDto(baseTokenDto, token); - } catch (RenException e) { - return response(exchange,new Result<>().error(e.getCode(),e.getMsg())); - } - } //添加流水号 exchange.getRequest().mutate().header(AppClientConstant.TRANSACTION_SERIAL_KEY, new String[]{getTransactionSerial()}); - if (baseTokenDto != null) { - String redisKey = baseTokenDto.getApp() + "-" + baseTokenDto.getClient() + "-" + baseTokenDto.getUserId(); - logger.info("redisKey=" + redisKey); - exchange.getRequest().mutate() - .header(Constant.APP_USER_KEY, redisKey) - .header(AppClientConstant.APP,baseTokenDto.getApp()) - .header(AppClientConstant.CLIENT,baseTokenDto.getClient()) - .header(AppClientConstant.USER_ID,baseTokenDto.getUserId()) - ; - if (StringUtils.equals(baseTokenDto.getApp(), "gov")) {//工作端 - if(StringUtils.isNotBlank(customerId)){ - exchange.getRequest().mutate().header(AppClientConstant.CUSTOMER_ID, customerId); - } - } else if (StringUtils.equals(baseTokenDto.getApp(), "public")) {//公众号端 - exchange.getRequest().mutate().header(AppClientConstant.CUSTOMER_ID, customerId); - } - ServerHttpRequest build = exchange.getRequest().mutate().build(); - return chain.filter(exchange.mutate().request(build).build()); + + ServerHttpRequest request = exchange.getRequest(); + + String authType = getAuthType(request); + + switch (authType) { + case AUTH_TYPE_EXTERNAL: + return externalAuthProcessor.auth(exchange, chain); + case AUTH_TYPE_INTERNAL: + return internalAuthProcessor.auth(exchange, chain); + case AUTH_TYPE_NO_NEED: + break; + default: + return response(exchange, new Result<>().error(EpmetErrorCode.ERR401.getCode(), + EpmetErrorCode.ERR401.getMsg())); } return chain.filter(exchange); @@ -150,85 +96,71 @@ public class CpAuthGatewayFilterFactory extends AbstractGatewayFilterFactory response(ServerWebExchange exchange, Object object) { - String json = JSON.toJSONString(object); - DataBuffer buffer = exchange.getResponse().bufferFactory().wrap(json.getBytes(StandardCharsets.UTF_8)); - exchange.getResponse().getHeaders().setContentType(MediaType.APPLICATION_JSON_UTF8); - exchange.getResponse().setStatusCode(HttpStatus.OK); - return exchange.getResponse().writeWith(Flux.just(buffer)); + /** + * 获取请求头 + * @param request + * @return + */ + private String getHeader(ServerHttpRequest request, String headerName) { + HttpHeaders headers = request.getHeaders(); + return headers.getFirst(headerName); } /** - * 是否需要认证 - * @param requestUri + * 获取事务流水号 * @return */ - private boolean needAuth(String requestUri) { - // 优先判断白名单,在白名单中的就直接放行 - for (String url : cpProperty.getUrlWhiteList()) { - if (antPathMatcher.match(url, requestUri)) { - return false; - } - } + public static String getTransactionSerial() { + String[] letterPool = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n" + , "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}; - for (String url : cpProperty.getSwaggerUrls()) { - if (antPathMatcher.match(url, requestUri)) { - return false; - } + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < 2; i++) { + sb.append(letterPool[(int) (Math.random() * 25)]); } - for (String url : cpProperty.getUrls()) { - if (antPathMatcher.match(url, requestUri)) { - return true; - } - } - return false; + sb.append(System.currentTimeMillis()); + return sb.toString(); } public static class CpAuthConfig { @@ -250,45 +182,12 @@ public class CpAuthGatewayFilterFactory extends AbstractGatewayFilterFactory response(ServerWebExchange exchange, Object object) { + String json = JSON.toJSONString(object); + DataBuffer buffer = exchange.getResponse().bufferFactory().wrap(json.getBytes(StandardCharsets.UTF_8)); + exchange.getResponse().getHeaders().setContentType(MediaType.APPLICATION_JSON_UTF8); + exchange.getResponse().setStatusCode(HttpStatus.OK); + return exchange.getResponse().writeWith(Flux.just(buffer)); } - /** - * 从请求中获取token - * @param request - * @return - */ - private String getTokenFromRequest(ServerHttpRequest request) { - HttpHeaders headers = request.getHeaders(); - String token = headers.getFirst(Constant.AUTHORIZATION_HEADER); - if (StringUtils.isBlank(token)) { - token = headers.getFirst(Constant.TOKEN_HEADER); - logger.info("token=" + token); - } else { - logger.info("authorization=" + token); - } - if (StringUtils.isBlank(token)) { - token = request.getQueryParams().getFirst(Constant.AUTHORIZATION_HEADER); - logger.info("params token:" + token); - } - return token; - } } diff --git a/epmet-gateway/src/main/java/com/epmet/filter/CpProperty.java b/epmet-gateway/src/main/java/com/epmet/filter/CpProperty.java index f52d8f13a2..84872c0fb2 100644 --- a/epmet-gateway/src/main/java/com/epmet/filter/CpProperty.java +++ b/epmet-gateway/src/main/java/com/epmet/filter/CpProperty.java @@ -17,12 +17,15 @@ import java.util.List; @ConfigurationProperties(prefix = "epmet") public class CpProperty { - private List urls; + /** + * 需要内部认证的url + */ + private List internalAuthUrls; /** - * 白名单 + * 需要外部认证的url */ - private List urlWhiteList; + private List externalAuthUrls; /** * 不处理token,直接通过 diff --git a/epmet-gateway/src/main/java/com/epmet/filter/UserTokenFilter.java b/epmet-gateway/src/main/java/com/epmet/filter/UserTokenFilter.java deleted file mode 100644 index f66b0e6707..0000000000 --- a/epmet-gateway/src/main/java/com/epmet/filter/UserTokenFilter.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.epmet.filter; - -import com.epmet.commons.tools.exception.EpmetErrorCode; -import com.epmet.commons.tools.exception.RenException; -import com.epmet.commons.tools.security.dto.BaseTokenDto; -import com.epmet.commons.tools.utils.CpUserDetailRedis; -import com.epmet.jwt.JwtTokenUtils; -import io.jsonwebtoken.Claims; - -/** - * 用户token的过滤器接口,提供通用的默认方法 - */ -public interface UserTokenFilter { - - default BaseTokenDto getBaseTokenDto(String token, JwtTokenUtils jwtTokenUtils) { - //是否过期 - Claims claims = jwtTokenUtils.getClaimByToken(token); - if (claims == null || jwtTokenUtils.isTokenExpired(claims.getExpiration())) { -// throw new RenException(EpmetErrorCode.ERR401.getCode()); - return null; - } - //获取用户ID - String app = (String) claims.get("app"); - String client = (String) claims.get("client"); - String userId = (String) claims.get("userId"); - return new BaseTokenDto(app, client, userId, token); - } - - default T getLoginUserInfoByToken(String token, JwtTokenUtils jwtTokenUtils, CpUserDetailRedis cpUserDetailRedis, Class clz) { - BaseTokenDto baseTokenDto = getBaseTokenDto(token, jwtTokenUtils); - //查询Redis - return cpUserDetailRedis.get(baseTokenDto.getApp(), baseTokenDto.getClient(), baseTokenDto.getUserId(), clz); - } - -} diff --git a/epmet-gateway/src/main/java/com/epmet/jwt/JwtTokenUtils.java b/epmet-gateway/src/main/java/com/epmet/jwt/JwtTokenUtils.java index 33baf31c52..452627b9a3 100644 --- a/epmet-gateway/src/main/java/com/epmet/jwt/JwtTokenUtils.java +++ b/epmet-gateway/src/main/java/com/epmet/jwt/JwtTokenUtils.java @@ -62,6 +62,18 @@ public class JwtTokenUtils { } } + public Claims getClaimByToken(String token, String secret) { + try { + return Jwts.parser() + .setSigningKey(secret) + .parseClaimsJws(token) + .getBody(); + } catch (Exception e) { + logger.debug("validate is token error, token = " + token, e); + return null; + } + } + /** * @return java.util.Date * @param token diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index 9748b1ca26..ed3a3961da 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -415,8 +415,8 @@ ribbon: ConnectTimeout: 300000 epmet: - # 党群e事通(校验是否登录) - urls: + # 内部认证,需要Authorization请求头 + internalAuthUrls: - /oper/customize/** - /oper/crm/** - /epmetuser/** @@ -438,11 +438,10 @@ epmet: - /resi/home/** - /data/report/** - # url认证白名单,先判断白名单,在白名单中的url直接放行,不再判断上述需要认证的名单 - urlWhiteList: - - /data/report/test/test - - /data/report/screen/** - - /data/report/kcscreen/** + # 外部应用认证,使用AccessToken等头进行认证 + externalAuthUrls: + - /data/report/** + - /data/stats/** - /epmetuser/customerstaff/customerlist swaggerUrls: 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 index 66da4e0e9e..738f8c88e1 100644 --- 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 @@ -3,7 +3,6 @@ package com.epmet.evaluationindex.screen.dto.form; import lombok.Data; -import javax.validation.constraints.Min; import javax.validation.constraints.NotBlank; import java.io.Serializable; @@ -14,21 +13,30 @@ import java.io.Serializable; @Data public class AblityIndexFormDTO implements Serializable { private static final long serialVersionUID = -2880432640584616651L; + public interface AddUserInternalGroup {} + /** + * 组织或网格Id + */ + @NotBlank(message = "组织或网格ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class}) + private String orgId; /** * 组织Id */ @NotBlank(message = "客户ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class}) private String customerId; /** - * 组织Id + * 组织或网格类型 */ - @NotBlank(message = "组织ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class}) - private String agencyId; + @NotBlank(message = "组织或网格类型不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class}) + private String orgType; + /** + * 查询月份的前12个月对应的monthId + */ + private String startMonthId; /** * 月份Id(格式:202009) */ @NotBlank(message = "月份ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class}) private String monthId; - public interface AddUserInternalGroup {} } 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 index f1c4221482..ab4a4696c6 100644 --- 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 @@ -14,15 +14,21 @@ import java.io.Serializable; public class AblityListFormDTO implements Serializable { private static final long serialVersionUID = -2880432640584616651L; /** - * 组织Id + * 客户Id */ @NotBlank(message = "客户ID不能为空",groups = {AblityListFormDTO.AddUserInternalGroup.class}) private String customerId; /** - * 组织Id + * 组织或网格Id */ - @NotBlank(message = "组织ID不能为空",groups = {AblityListFormDTO.AddUserInternalGroup.class}) - private String agencyId; + @NotBlank(message = "组织或网格ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class}) + private String orgId; + /** + * 组织或网格类型 + */ + @NotBlank(message = "组织或网格类型不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class}) + private String orgType; + public interface AddUserInternalGroup {} /** * 月份Id(格式:202009) */ @@ -37,6 +43,5 @@ public class AblityListFormDTO implements Serializable { * 所有有权重的指标code拼接的字符串 冒号隔开 */ private String allParentIndexCode; - public interface AddUserInternalGroup {} } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AdvancedBranchRankFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AdvancedBranchRankFormDTO.java new file mode 100644 index 0000000000..a6e5ecb9b3 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AdvancedBranchRankFormDTO.java @@ -0,0 +1,31 @@ +package com.epmet.evaluationindex.screen.dto.form; + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 先进排行-先进支部排行--接口入参 + * @Author sun + */ +@Data +public class AdvancedBranchRankFormDTO implements Serializable { + private static final long serialVersionUID = -8674763412362557239L; + /** + * 机关Id + * */ + @NotBlank(message = "机关Id不能为空" , groups = AdvancedBranchRankFormDTO.AddUserInternalGroup.class) + private String agencyId; + /** + * 显示多少条 + * */ + @Min(value = 1, message = "查询条数必须大于0", groups = {AdvancedBranchRankFormDTO.AddUserInternalGroup.class }) + private Integer topNum; + /** + * 月份Id + * */ + private String monthId; + public interface AddUserInternalGroup {} +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/IndexScoreFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/IndexScoreFormDTO.java new file mode 100644 index 0000000000..e75abb9f63 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/IndexScoreFormDTO.java @@ -0,0 +1,36 @@ +package com.epmet.evaluationindex.screen.dto.form; + + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 组织月度指数得分--接口入参 + * @Author sun + */ +@Data +public class IndexScoreFormDTO implements Serializable { + private static final long serialVersionUID = -2880432640584616651L; + /** + * 组织或网格Id + */ + @NotBlank(message = "组织或网格ID不能为空",groups = {IndexScoreFormDTO.AddUserInternalGroup.class}) + private String orgId; + /** + * 类型(组织:agency 网格:grid) + * 大屏接口此字段值为空 + */ + //@NotBlank(message = "数据类型不能为空",groups = {IndexScoreFormDTO.AddUserInternalGroup.class}) + private String orgType; + /** + * 月份Id eg:202009 + * 大屏接口此字段值为空 + */ + //@NotBlank(message = "月份Id不能为空",groups = {IndexScoreFormDTO.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/MonthAblityListFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthAblityListFormDTO.java index 365fdb2000..8289173d9e 100644 --- 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 @@ -14,15 +14,21 @@ import java.io.Serializable; public class MonthAblityListFormDTO implements Serializable { private static final long serialVersionUID = -2880432640584616651L; /** - * 组织Id + * 客户Id */ @NotBlank(message = "客户ID不能为空",groups = {MonthAblityListFormDTO.AddUserInternalGroup.class}) private String customerId; /** - * 组织Id + * 组织或网格Id */ - @NotBlank(message = "组织ID不能为空",groups = {MonthAblityListFormDTO.AddUserInternalGroup.class}) - private String agencyId; + @NotBlank(message = "组织或网格ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class}) + private String orgId; + /** + * 组织或网格类型 + */ + @NotBlank(message = "组织或网格类型不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class}) + private String orgType; + public interface AddUserInternalGroup {} /** * 月份Id(格式:202009) */ @@ -37,7 +43,5 @@ public class MonthAblityListFormDTO implements Serializable { * 查询月份的前12个月对应的monthId */ private String startMonthId; - public interface AddUserInternalGroup {} - } 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 index 3efeee665f..528c3805f0 100644 --- 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 @@ -13,21 +13,30 @@ import java.io.Serializable; @Data public class MonthScoreListFormDTO implements Serializable { private static final long serialVersionUID = -2880432640584616651L; + public interface AddUserInternalGroup {} + /** + * 组织或网格Id + */ + @NotBlank(message = "组织或网格ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class}) + private String orgId; /** * 组织Id */ @NotBlank(message = "客户ID不能为空",groups = {MonthScoreListFormDTO.AddUserInternalGroup.class}) private String customerId; /** - * 组织Id + * 组织或网格类型 */ - @NotBlank(message = "组织ID不能为空",groups = {MonthScoreListFormDTO.AddUserInternalGroup.class}) - private String agencyId; + @NotBlank(message = "组织或网格类型不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class}) + private String orgType; /** * 月份Id(格式:202009) */ @NotBlank(message = "月份ID不能为空",groups = {MonthScoreListFormDTO.AddUserInternalGroup.class}) private String monthId; - public interface AddUserInternalGroup {} + /** + * 查询月份的前12个月对应的monthId + */ + private String startMonthId; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/PartIndexScroeRankFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/PartIndexScroeRankFormDTO.java new file mode 100644 index 0000000000..da2d919c2f --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/PartIndexScroeRankFormDTO.java @@ -0,0 +1,35 @@ +package com.epmet.evaluationindex.screen.dto.form; + + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 党员(指标得分)排行--接口入参 + * @Author sun + */ +@Data +public class PartIndexScroeRankFormDTO implements Serializable { + private static final long serialVersionUID = -2880432640584616651L; + /** + * 组织或网格Id + */ + @NotBlank(message = "组织或网格ID不能为空",groups = {PartIndexScroeRankFormDTO.AddUserInternalGroup.class}) + private String orgId; + /** + * 类型(组织:agency 网格:grid) + */ + @NotBlank(message = "数据类型不能为空",groups = {PartIndexScroeRankFormDTO.AddUserInternalGroup.class}) + private String orgType; + /** + * 默认显示前5名 + */ + @Min(value = 1, message = "查询条数必须大于0", groups = {PartIndexScroeRankFormDTO.AddUserInternalGroup.class }) + private Integer topNum; + public interface AddUserInternalGroup {} + + +} 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 index 2d0b69bd2f..aff83eca85 100644 --- 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 @@ -15,15 +15,21 @@ import java.io.Serializable; public class PeerComparisonFormDTO implements Serializable { private static final long serialVersionUID = -2880432640584616651L; /** - * 组织Id + * 客户Id */ @NotBlank(message = "客户ID不能为空",groups = {PeerComparisonFormDTO.AddUserInternalGroup.class}) private String customerId; /** - * 组织Id + * 组织或网格Id */ - @NotBlank(message = "组织ID不能为空",groups = {PeerComparisonFormDTO.AddUserInternalGroup.class}) - private String agencyId; + @NotBlank(message = "组织或网格ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class}) + private String orgId; + /** + * 组织或网格类型 + */ + @NotBlank(message = "组织或网格类型不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class}) + private String orgType; + public interface AddUserInternalGroup {} /** * 类型(党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli;) */ @@ -34,6 +40,5 @@ public class PeerComparisonFormDTO implements Serializable { */ @Min(value = 1, message = "查询条数必须大于0", groups = {PeerComparisonFormDTO.AddUserInternalGroup.class }) private Integer pageSize; - public interface AddUserInternalGroup {} } 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 index 97355373a3..42a67c936f 100644 --- 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 @@ -3,7 +3,6 @@ package com.epmet.evaluationindex.screen.dto.form; import lombok.Data; -import javax.validation.constraints.Min; import javax.validation.constraints.NotBlank; import java.io.Serializable; @@ -14,12 +13,12 @@ import java.io.Serializable; @Data public class RootAgencyFormDTO implements Serializable { private static final long serialVersionUID = -2880432640584616651L; + public interface AddUserInternalGroup {} + /** * 组织Id */ @NotBlank(message = "组织ID不能为空",groups = {RootAgencyFormDTO.AddUserInternalGroup.class}) private String agencyId; - public interface AddUserInternalGroup {} - } 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 index ea430fa0a7..9b622eb568 100644 --- 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 @@ -13,26 +13,26 @@ import java.io.Serializable; @Data public class ScoreListFormDTO implements Serializable { private static final long serialVersionUID = -2880432640584616651L; + public interface AddUserInternalGroup {} + /** + * 组织或网格Id + */ + @NotBlank(message = "组织或网格ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class}) + private String orgId; /** * 组织Id */ @NotBlank(message = "客户ID不能为空",groups = {ScoreListFormDTO.AddUserInternalGroup.class}) private String customerId; /** - * 组织Id + * 组织或网格类型 */ - @NotBlank(message = "组织ID不能为空",groups = {ScoreListFormDTO.AddUserInternalGroup.class}) - private String agencyId; + @NotBlank(message = "组织或网格类型不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class}) + private String orgType; /** * 月份Id(格式:202009) */ @NotBlank(message = "月份ID不能为空",groups = {ScoreListFormDTO.AddUserInternalGroup.class}) private String monthId; - /** - * 类型(党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli;) - */ - private String indexCode; - - public interface AddUserInternalGroup {} } 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 59% 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..e973fefa50 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,22 @@ public class AnNingSubAgencyIndexRankFormDTO implements Serializable { /** * asc 正序, desc 降序 */ - @NotNull(message = "排序方式不能为空",groups = {SubAgencyIndexRank.class}) + @NotNull(message = "排序方式不能为空", groups = {SubAgencyIndexRank.class}) private String sort; /** * 年度:year 月度:month */ - @NotNull(message = "年度、月度不能为空",groups = {SubAgencyIndexRank.class}) + @NotNull(message = "年度、月度不能为空", groups = {SubAgencyIndexRank.class}) private String type; + + /** + * 月份Id + */ + private String monthId; + + /** + * 组织类型 组织:agency 网格:grid + */ + private String orgType; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/UserPointRankFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/UserPointRankFormDTO.java new file mode 100644 index 0000000000..cc1ad2bd36 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/UserPointRankFormDTO.java @@ -0,0 +1,35 @@ +package com.epmet.evaluationindex.screen.dto.form; + + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 热心市民积分排行列表--接口入参 + * @Author sun + */ +@Data +public class UserPointRankFormDTO implements Serializable { + private static final long serialVersionUID = -2880432640584616651L; + /** + * 组织或网格Id + */ + @NotBlank(message = "组织或网格ID不能为空",groups = {UserPointRankFormDTO.AddUserInternalGroup.class}) + private String orgId; + /** + * 类型(组织:agency 网格:grid) + */ + @NotBlank(message = "数据类型不能为空",groups = {UserPointRankFormDTO.AddUserInternalGroup.class}) + private String orgType; + /** + * 默认显示前5名 + */ + @Min(value = 1, message = "查询条数必须大于0", groups = {UserPointRankFormDTO.AddUserInternalGroup.class }) + private Integer topNum; + public interface AddUserInternalGroup {} + + +} 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 index d50bcdc137..2d14b4e42c 100644 --- 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 @@ -1,5 +1,6 @@ package com.epmet.evaluationindex.screen.dto.result; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -29,23 +30,16 @@ public class AblityIndexResultDTO implements Serializable { * 能力总分 */ private Double indexTotal; - /** - * 本级能力分 - */ - private Double agencyScore; - /** - * 下级能力分 - */ - private Double subAgencyScore; /** * 横坐标(202009) */ private String monthId; + /** + * 能力类型 党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli; + */ + @JsonIgnore + private String indexCode; } - - - - } 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 index 2df53bff05..97c32e1994 100644 --- 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 @@ -25,5 +25,9 @@ public class AblityListResultDTO implements Serializable { * 各项指标对应key值(index_dict字典表) */ private String key; + /** + * 指标值类型 无:none;整数:integer;小数: decimal;百分比:percent + */ + private String showType; } 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/IndexAdvanceBranchRankResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexAdvanceBranchRankResultDTO.java new file mode 100644 index 0000000000..cbe72572b6 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexAdvanceBranchRankResultDTO.java @@ -0,0 +1,53 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 先进排行-先进支部排行--接口返参 + * + * @Author sun + */ +@Data +public class IndexAdvanceBranchRankResultDTO implements Serializable { + private static final long serialVersionUID = 330099297596334388L; + + /** + * 名称 XXXX社区党委 + */ + private String name; + /** + * 指标得分 + */ + @JsonIgnore + private String totalScore; + private BigDecimal scroe; + /** + * 党员数 + */ + private Integer partyMemberNum; + + /** + * 议题数 + */ + private Integer issueNum; + + /** + * 项目数 + */ + private Integer projectNum; + + /** + * 满意度 90.64% 返回字符串,前端直接显示 + */ + private String satisfactionRatio; + + /** + * 结案率 94.3% 返回字符串,前端直接显示 + */ + private String closedProjectRatio; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexDictResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexDictResultDTO.java new file mode 100644 index 0000000000..196837f220 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexDictResultDTO.java @@ -0,0 +1,30 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 评价指标字典表数据--接口返参 + * @Author sun + */ +@Data +public class IndexDictResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 指标名 + */ + private String indexName; + /** + * 指标code + */ + private String indexCode; + /** + * 指标值类型 百分比:percent + */ + private String valueType; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexScoreResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexScoreResultDTO.java new file mode 100644 index 0000000000..33ffff9c5d --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexScoreResultDTO.java @@ -0,0 +1,55 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 组织月度指数得分--接口返参 + * @Author sun + */ +@Data +public class IndexScoreResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 年度平均指数(保留一位小数) + */ + @JsonIgnore + private String total; + private BigDecimal totalScore; + /** + * 党建能力(保留一位小数) + */ + @JsonIgnore + private String party; + private BigDecimal partyDevAbility; + /** + * 党建能力权重(保留一位小数) + */ + private String partyDevAbilityWeight; + /** + * 治理能力(保留一位小数) + */ + @JsonIgnore + private String govern; + private BigDecimal governAbility; + /** + * 治理能力权重(保留一位小数) + */ + private String governAbilityWeight; + /** + * 服务能力(保留一位小数) + */ + @JsonIgnore + private String service; + private BigDecimal serviceAbility; + /** + * 服务能力权重(保留一位小数) + */ + private String serviceAbilityWeight; + +} 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 index c40628cdd4..0acdbf9c73 100644 --- 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 @@ -1,5 +1,6 @@ package com.epmet.evaluationindex.screen.dto.result; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -41,6 +42,11 @@ public class MonthScoreListResultDTO implements Serializable { * 横坐标(202009) */ private String monthId; + /** + * 类型(党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli;) + */ + @JsonIgnore + private String indexCode; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PartIndexScroeRankResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PartIndexScroeRankResultDTO.java new file mode 100644 index 0000000000..16ab06acb0 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PartIndexScroeRankResultDTO.java @@ -0,0 +1,45 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 党员(指标得分)排行--接口返参 + * @Author sun + */ +@Data +public class PartIndexScroeRankResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 组织ID + */ + private String agencyId; + /** + * 组织名称 + */ + private String agencyName; + /** + * 用户Id + */ + private String userId; + /** + * 用户名称 + */ + private String userName; + /** + * 网格Id + */ + private String gridId; + /** + * 网格名称 + */ + private String gridName; + /** + * 党员指标得分 + */ + private Double indexScore; + +} 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 index 95e9545a8c..9a89c5daa8 100644 --- 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 @@ -14,13 +14,13 @@ public class PeerComparisonResultDTO implements Serializable { private static final long serialVersionUID = 3860268744336541373L; /** - * 组织Id + * 组织或网格Id */ - private String agencyId; + private String orgId; /** - * 组织名称 + * 组织或网格名称 */ - private String agencyName; + private String orgName; /** * 能力分值(保留一位小数) */ diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PublicPartiProfileResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PublicPartiProfileResultDTO.java index c5744d0cdd..6cc63810e2 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PublicPartiProfileResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PublicPartiProfileResultDTO.java @@ -4,6 +4,7 @@ import com.epmet.commons.tools.constant.NumConstant; import lombok.Data; import java.io.Serializable; +import java.math.BigDecimal; /** * @Description 3、公众参与概况返参DTO @@ -33,14 +34,17 @@ public class PublicPartiProfileResultDTO implements Serializable { /** * 较上月趋势:incr上升,decr下降 - * */ + */ private String issueCompareLatestTrend = ""; /** * 平均参与度 - * */ - private Integer averageJoin = NumConstant.ZERO; + */ + private BigDecimal averageJoin = new BigDecimal(NumConstant.ZERO); + /** + * 较上月百分比 + */ private String joinCompareLatestMonth = ""; private String joinCompareLatestTrend = ""; diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/UserJoinIndicatorGrowthRateResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/UserJoinIndicatorGrowthRateResultDTO.java index a64f02a279..5e174b0de7 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/UserJoinIndicatorGrowthRateResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/UserJoinIndicatorGrowthRateResultDTO.java @@ -38,8 +38,8 @@ public class UserJoinIndicatorGrowthRateResultDTO implements Serializable { /** * 平均参与度 - * */ - private Integer averageJoin; + */ + private BigDecimal averageJoin; private BigDecimal joinCompareLatestMonth; diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/UserPointRankListResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/UserPointRankListResultDTO.java new file mode 100644 index 0000000000..d2909faffd --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/UserPointRankListResultDTO.java @@ -0,0 +1,46 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 热心市民积分排行列表--接口返参 + * @Author sun + */ +@Data +public class UserPointRankListResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 组织ID + */ + private String agencyId; + /** + * 组织名称 + */ + private String agencyName; + /** + * 用户Id + */ + private String userId; + /** + * 用户名称 + */ + private String userName; + /** + * 网格Id + */ + private String gridId; + /** + * 网格名称 + */ + private String gridName; + /** + * 用户积分 + */ + private Integer pointTotal; + +} diff --git a/epmet-module/data-report/data-report-server/pom.xml b/epmet-module/data-report/data-report-server/pom.xml index 6313da7597..b16b2e8faa 100644 --- a/epmet-module/data-report/data-report-server/pom.xml +++ b/epmet-module/data-report/data-report-server/pom.xml @@ -62,11 +62,11 @@ 0.3.1 - + com.epmet 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 index 529563feb2..4e2449c81c 100644 --- 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 @@ -5,6 +5,14 @@ package com.epmet.datareport.constant; * @dscription 数据 */ public interface FactConstant { + /** + * 组织类型 + */ + String AGENCY = "agency"; + /** + * 网格类型 + */ + String GRID = "grid"; /** * 能力指标 */ @@ -33,4 +41,24 @@ public interface FactConstant { * 社区相关 */ String SHE_QU_XIANG_GUAN = "shequxiangguan"; + /** + * 网格相关 + */ + String WANG_GE_XIANG_GUAN = "wanggexiangguan"; + /** + * 评价指标类型-无 + */ + String NONE = "none"; + /** + * 评价指标类型-整数 + */ + String INTEGER = "integer"; + /** + * 评价指标类型-小数 + */ + String DECIMAL = "decimal"; + /** + * 评价指标类型-百分比 + */ + String PERCENT = "percent"; } 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 index 4399756545..5780a6e4c3 100644 --- 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 @@ -17,6 +17,7 @@ import java.util.List; /** * 数据改版api + * * @author sun */ @RestController @@ -27,78 +28,78 @@ public class FactIndexController { private FactIndexService factIndexService; /** - * @param tokenDTO - * @Description 能力指数 + * @param formDTO + * @Description 能力指数 * @author sun */ @PostMapping("index/ablityindex") - public Result> ablityIndex(@LoginUser TokenDto tokenDTO, @RequestBody AblityIndexFormDTO formDTO){ + public Result> ablityIndex(@RequestBody AblityIndexFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, AblityIndexFormDTO.AddUserInternalGroup.class); return new Result>().ok(factIndexService.ablityIndex(formDTO)); } /** - * @param tokenDTO - * @Description 按月份查询各项能力分数 + * @param formDTO + * @Description 按月份查询各项能力分数 * @author sun */ @PostMapping("index/scorelist") - public Result> scoreList(@LoginUser TokenDto tokenDTO, @RequestBody ScoreListFormDTO formDTO){ + public Result> scoreList(@RequestBody ScoreListFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, ScoreListFormDTO.AddUserInternalGroup.class); return new Result>().ok(factIndexService.scoreList(formDTO)); } /** - * @param tokenDTO - * @Description 按月份查询各项能力最近12个月得分 + * @param formDTO + * @Description 按月份查询各项能力最近12个月得分 * @author sun */ @PostMapping("index/monthscorelist") - public Result> monthScoreList(@LoginUser TokenDto tokenDTO, @RequestBody MonthScoreListFormDTO formDTO){ + public Result> monthScoreList(@RequestBody MonthScoreListFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, MonthScoreListFormDTO.AddUserInternalGroup.class); return new Result>().ok(factIndexService.monthScoreList(formDTO)); } /** - * @param tokenDTO - * @Description 按月查询各项指标数据 + * @param formDTO + * @Description 按月查询各项指标数据 * @author sun */ @PostMapping("index/ablitylist") - public Result> ablityList(@LoginUser TokenDto tokenDTO, @RequestBody AblityListFormDTO formDTO){ + public Result> ablityList(@RequestBody AblityListFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, AblityListFormDTO.AddUserInternalGroup.class); return new Result>().ok(factIndexService.ablityList(formDTO)); } /** - * @param tokenDTO - * @Description 按月查询各项指标最近12个月数据 + * @param formDTO + * @Description 按月查询各项指标最近12个月数据 * @author sun */ @PostMapping("index/monthablitylist") - public Result> monthAblityList(@LoginUser TokenDto tokenDTO, @RequestBody MonthAblityListFormDTO formDTO){ + public Result> monthAblityList(@RequestBody MonthAblityListFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, MonthAblityListFormDTO.AddUserInternalGroup.class); return new Result>().ok(factIndexService.monthAblityList(formDTO)); } /** - * @param tokenDTO - * @Description 同级对比各项数据查询 + * @param formDTO + * @Description 同级对比各项数据查询 * @author sun */ @PostMapping("index/peercomparison") - public Result> peerComparison(@LoginUser TokenDto tokenDTO, @RequestBody PeerComparisonFormDTO formDTO){ + public Result> peerComparison(@RequestBody PeerComparisonFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, PeerComparisonFormDTO.AddUserInternalGroup.class); return new Result>().ok(factIndexService.peerComparison(formDTO)); } /** - * @param tokenDTO - * @Description 是否根组织 + * @param formDTO + * @Description 是否根组织 * @author sun */ @PostMapping("index/rootagency") - public Result rootAgency(@LoginUser TokenDto tokenDTO, @RequestBody RootAgencyFormDTO formDTO){ + public Result rootAgency(@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/AgencyController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java index 1828f19ac8..035dab63d9 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java @@ -1,21 +1,13 @@ package com.epmet.datareport.controller.screen; -import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; -import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.datareport.service.evaluationindex.screen.AgencyService; import com.epmet.evaluationindex.screen.dto.form.CompartmentFormDTO; import com.epmet.evaluationindex.screen.dto.result.CompartmentResultDTO; import com.epmet.evaluationindex.screen.dto.result.TreeResultDTO; -import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.servlet.http.HttpServletRequest; +import org.springframework.web.bind.annotation.*; /** * 组织相关api @@ -31,19 +23,14 @@ public class AgencyController { private AgencyService agencyService; /** - * @Description 1、组织机构树 * @param + * @Description 1、组织机构树 只返回 is_display = '1'的 * @author zxc * @date 2020/8/18 2:04 下午 */ - @ExternalAppRequestAuth @PostMapping("tree") - public Result tree(HttpServletRequest request, ExternalAppRequestParam externalAppRequestParam){ - String customerId = request.getHeader("CustomerId"); - if(StringUtils.isBlank(externalAppRequestParam.getCustomerId())){ - externalAppRequestParam.setCustomerId(customerId); - } - return new Result().ok(agencyService.tree(externalAppRequestParam)); + public Result tree(@RequestHeader("CustomerId") String customerId){ + return new Result().ok(agencyService.tree(customerId)); } /** @@ -52,7 +39,6 @@ public class AgencyController { * @author zxc * @date 2020/8/18 2:33 下午 */ - @ExternalAppRequestAuth @PostMapping("compartment") public Result compartment(@RequestBody CompartmentFormDTO compartmentFormDTO){ ValidatorUtils.validateEntity(compartmentFormDTO, CompartmentFormDTO.Compartment.class); diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/DistributionController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/DistributionController.java index 30f0f82584..8c17f03238 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/DistributionController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/DistributionController.java @@ -1,6 +1,5 @@ package com.epmet.datareport.controller.screen; -import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.datareport.service.evaluationindex.screen.DistributionService; @@ -33,7 +32,6 @@ public class DistributionController { * @author zxc * @date 2020/8/18 10:59 上午 */ - @ExternalAppRequestAuth @PostMapping("branch") public Result> branch(@RequestBody BranchFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, BranchFormDTO.Branch.class); @@ -46,7 +44,6 @@ public class DistributionController { * @author zxc * @date 2020/8/18 11:10 上午 */ - @ExternalAppRequestAuth @PostMapping("user") public Result user(@RequestBody UserFormDTO userFormDTO){ ValidatorUtils.validateEntity(userFormDTO, UserFormDTO.User.class); @@ -59,7 +56,6 @@ public class DistributionController { * @author zxc * @date 2020/8/18 11:20 上午 */ - @ExternalAppRequestAuth @PostMapping("parymember") public Result parymember(@RequestBody ParymemberFormDTO parymemberFormDTO){ ValidatorUtils.validateEntity(parymemberFormDTO, ParymemberFormDTO.Parymember.class); @@ -72,7 +68,6 @@ public class DistributionController { * @author zxc * @date 2020/8/19 1:29 下午 */ - @ExternalAppRequestAuth @PostMapping("project") public Result> project(@RequestBody ProjectFormDTO projectFormDTO){ ValidatorUtils.validateEntity(projectFormDTO, ProjectFormDTO.Project.class); @@ -85,7 +80,6 @@ public class DistributionController { * @author zxc * @date 2020/8/19 1:52 下午 */ - @ExternalAppRequestAuth @PostMapping("topprofile") public Result topProfile(@RequestBody TopProfileFormDTO topProfileFormDTO){ ValidatorUtils.validateEntity(topProfileFormDTO, TopProfileFormDTO.TopProfile.class); diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassRootsGovernController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassRootsGovernController.java index 1ee85baeb4..4cec62dc66 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassRootsGovernController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassRootsGovernController.java @@ -1,6 +1,5 @@ package com.epmet.datareport.controller.screen; -import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.datareport.service.evaluationindex.screen.GrassRootsGovernService; @@ -39,7 +38,6 @@ public class GrassRootsGovernController { * @author wangc * @date 2020.08.20 11:16 **/ - @ExternalAppRequestAuth @PostMapping("userpointrank") public Result userPointRank(@RequestBody AgencyAndNumFormDTO param){ ValidatorUtils.validateEntity(param,AgencyFormDTO.CommonAgencyIdGroup.class); @@ -54,7 +52,6 @@ public class GrassRootsGovernController { * @author wangc * @date 2020.08.20 13:55 **/ - @ExternalAppRequestAuth @PostMapping("difficultprojects") public Result> difficultProject(@RequestBody AgencyNumTypeParamFormDTO param){ ValidatorUtils.validateEntity(param, AgencyNumTypeParamFormDTO.AgencyNumTypeParamGroup.class); @@ -69,7 +66,6 @@ public class GrassRootsGovernController { * @author wangc * @date 2020.08.20 14:37 **/ - @ExternalAppRequestAuth @PostMapping("publicpartiprofile") public Result publicPartiProfile(@RequestBody AgencyFormDTO param){ ValidatorUtils.validateEntity(param, AgencyFormDTO.CommonAgencyIdGroup.class); @@ -84,7 +80,6 @@ public class GrassRootsGovernController { * @author wangc * @date 2020.08.20 15:32 **/ - @ExternalAppRequestAuth @PostMapping("publicpartirank") public Result> publicPartiRank(@RequestBody AgencyAndNumFormDTO param){ ValidatorUtils.validateEntity(param,AgencyFormDTO.CommonAgencyIdGroup.class); @@ -99,7 +94,6 @@ public class GrassRootsGovernController { * @author wangc * @date 2020.08.20 17:46 **/ - @ExternalAppRequestAuth @PostMapping("governcapacityrank") public Result> governCapacityRank(@RequestBody AgencyAndNumFormDTO param){ ValidatorUtils.validateEntity(param,AgencyFormDTO.CommonAgencyIdGroup.class); diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassrootsPartyDevController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassrootsPartyDevController.java index db7c83089f..f7273b3da8 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassrootsPartyDevController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassrootsPartyDevController.java @@ -1,6 +1,5 @@ package com.epmet.datareport.controller.screen; -import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.datareport.service.evaluationindex.screen.GrassrootsPartyDevService; @@ -38,7 +37,6 @@ public class GrassrootsPartyDevController { * @author wangc * @date 2020.08.18 16:59 **/ - @ExternalAppRequestAuth @PostMapping("basicinfo") public Result baseInfo(@RequestBody ParymemberFormDTO param){ ValidatorUtils.validateEntity(param, ParymemberFormDTO.Parymember.class); @@ -53,7 +51,6 @@ public class GrassrootsPartyDevController { * @author wangc * @date 2020.08.18 17:54 **/ - @ExternalAppRequestAuth @PostMapping("ageinfo") public Result ageInfo(@RequestBody ParymemberFormDTO param){ ValidatorUtils.validateEntity(param, ParymemberFormDTO.Parymember.class); @@ -68,7 +65,6 @@ public class GrassrootsPartyDevController { * @author wangc * @date 2020.08.19 11:02 **/ - @ExternalAppRequestAuth @PostMapping("branchbuildtrend") public Result branchBuildTrend(@RequestBody BranchBuildTrendFormDTO param){ ValidatorUtils.validateEntity(param, BranchBuildTrendFormDTO.branchBuildTrendGroup.class); @@ -83,7 +79,6 @@ public class GrassrootsPartyDevController { * @author wangc * @date 2020.08.19 15:25 **/ - @ExternalAppRequestAuth @PostMapping("branchbuildrank") public Result branchBuildRank(@RequestBody BranchBuildRankFormDTO param){ ValidatorUtils.validateEntity(param, BranchBuildRankFormDTO.BranchBuildRankGroup.class); 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..100c35b293 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,7 +1,7 @@ package com.epmet.datareport.controller.screen; -import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; -import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.datareport.eum.OrgTypeEnum; @@ -9,10 +9,7 @@ import com.epmet.datareport.service.evaluationindex.screen.IndexService; import com.epmet.evaluationindex.screen.dto.form.*; import com.epmet.evaluationindex.screen.dto.result.*; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -35,7 +32,6 @@ public class IndexController { * @author zxc * @date 2020/8/19 2:53 下午 */ - @ExternalAppRequestAuth @PostMapping("yearaverageindex") public Result yearAverageIndex(@RequestBody YearAverageIndexFormDTO yearAverageIndexFormDTO){ ValidatorUtils.validateEntity(yearAverageIndexFormDTO, YearAverageIndexFormDTO.YearAverageIndex.class); @@ -48,7 +44,6 @@ public class IndexController { * @author zxc * @date 2020/8/19 3:17 下午 */ - @ExternalAppRequestAuth @PostMapping("monthindexanalysis/piechart") public Result monthPieChart(@RequestBody MonthPieChartFormDTO monthPieChartFormDTO){ ValidatorUtils.validateEntity(monthPieChartFormDTO, MonthPieChartFormDTO.MonthPieChart.class); @@ -61,7 +56,6 @@ public class IndexController { * @author zxc * @date 2020/8/19 5:27 下午 */ - @ExternalAppRequestAuth @PostMapping("monthindexanalysis/barchart") public Result monthBarchart(@RequestBody MonthBarchartFormDTO monthBarchartFormDTO){ ValidatorUtils.validateEntity(monthBarchartFormDTO, MonthBarchartFormDTO.MonthBarchart.class); @@ -74,7 +68,6 @@ public class IndexController { * @author zxc * @date 2020/8/20 10:02 上午 */ - @ExternalAppRequestAuth @PostMapping("subagencyindexrank") public Result> subAgencyIndexRank(@RequestBody SubAgencyIndexRankFormDTO subAgencyIndexRankFormDTO){ ValidatorUtils.validateEntity(subAgencyIndexRankFormDTO, SubAgencyIndexRankFormDTO.SubAgencyIndexRank.class); @@ -82,17 +75,17 @@ public class IndexController { } /** - * 5、下级部门指数排行(安宁数据段用) + * 5、下级部门指数排行(安宁数据段用) + * * @param formDTO * @return com.epmet.commons.tools.utils.Result> * @Author zhangyong * @Date 13:39 2020-09-11 **/ - @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)); } /** @@ -101,13 +94,35 @@ public class IndexController { * @author jianjun.liu * @date 2020/8/20 10:02 上午 */ - @ExternalAppRequestAuth @PostMapping("gridindexrank") - public Result> gridIndexRank(ExternalAppRequestParam extParam, @RequestBody GridIndexRankFormDTO formDTO) { - formDTO.setCustomerId(extParam.getCustomerId()); + public Result> gridIndexRank(@RequestHeader("CustomerId") String customerId, @RequestBody GridIndexRankFormDTO formDTO) { + formDTO.setCustomerId(customerId); ValidatorUtils.validateEntity(formDTO); formDTO.setOrgType(OrgTypeEnum.GRID.getCode()); return new Result>().ok(indexService.selectIndexRankByOrgType(formDTO)); } + /** + * @param formDTO + * @Description 组织月度指数得分 + * @author sun + */ + @PostMapping("month/indexscore") + public Result indexScore(@RequestBody IndexScoreFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, IndexScoreFormDTO.AddUserInternalGroup.class); + return new Result().ok(indexService.indexScore(formDTO)); + } + + /** + * @param formDTO + * @Description 先进排行-先进支部排行 + * @author sun + */ + @PostMapping("advancedbranchrank") + Result> advancedBranchRank(@RequestBody AdvancedBranchRankFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, AdvancedBranchRankFormDTO.AddUserInternalGroup.class); + return new Result>().ok(indexService.advancedBranchRank(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..855be093c1 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,7 +1,5 @@ package com.epmet.datareport.controller.screen; -import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; -import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.datareport.service.evaluationindex.screen.KcScreenService; @@ -16,10 +14,7 @@ import com.epmet.dto.result.issue.KcIssueSummary; import com.epmet.dto.result.issue.KcPartiTrendResultDTO; import com.epmet.evaluationindex.screen.dto.result.HomepageSummaryResultDTO; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -38,46 +33,37 @@ public class KcScreenController { /** - * @param externalAppRequestParam * @Description 首页-平台各类总数 * @author sun */ - @ExternalAppRequestAuth @PostMapping("homepage/summary") - public Result homepageSummary(ExternalAppRequestParam externalAppRequestParam){ - return new Result().ok(kcScreenService.homepageSummary(externalAppRequestParam)); + public Result homepageSummary(@RequestHeader("CustomerId") String customerId){ + return new Result().ok(kcScreenService.homepageSummary(customerId)); } /** - * @param externalAppRequestParam * @Description 公益互助-各类总数汇总 * @author sun */ - @ExternalAppRequestAuth @PostMapping("heart/summary") - public Result heartSummary(ExternalAppRequestParam externalAppRequestParam){ - return new Result().ok(kcScreenService.heartSummary(externalAppRequestParam)); + public Result heartSummary(@RequestHeader("CustomerId") String customerId){ + return new Result().ok(kcScreenService.heartSummary(customerId)); } /** - * @param externalAppRequestParam * @Description 公益互助-公益活动次数 * @author sun */ - @ExternalAppRequestAuth @PostMapping("heart/actcounttrend") - public Result heartActcounttrend(ExternalAppRequestParam externalAppRequestParam){ - return new Result().ok(kcScreenService.heartActcounttrend(externalAppRequestParam)); + public Result heartActcounttrend(@RequestHeader("CustomerId") String customerId){ + return new Result().ok(kcScreenService.heartActcounttrend(customerId)); } /** * 议题分析-各类总数 - * @param externalAppRequestParam * @return */ - @ExternalAppRequestAuth @PostMapping("issue/summary") - public Result getIssueSummary(ExternalAppRequestParam externalAppRequestParam) { - String customerId = externalAppRequestParam.getCustomerId(); + public Result getIssueSummary(@RequestHeader("CustomerId") String customerId) { //String customerId = "b09527201c4409e19d1dbc5e3c3429a1"; KcIssueSummary issueSummary = kcScreenService.getIssueSummary(customerId); return new Result().ok(issueSummary); @@ -85,326 +71,247 @@ public class KcScreenController { /** * 参与趋势 - * @param externalAppRequestParam * @return */ - @ExternalAppRequestAuth @PostMapping("issue/partitrend") - public Result getIssuePartiTrend(ExternalAppRequestParam externalAppRequestParam) { - String customerId = externalAppRequestParam.getCustomerId(); - //String customerId = "b09527201c4409e19d1dbc5e3c3429a1"; + public Result getIssuePartiTrend(@RequestHeader("CustomerId") String customerId) { KcPartiTrendResultDTO trendResultDTO = kcScreenService.getIssuePartiTrend(customerId); return new Result().ok(trendResultDTO); } /** * 按照议题数量排名 - * @param externalAppRequestParam * @return */ - @ExternalAppRequestAuth @PostMapping("issue/gridtotalrank") - public Result getIssueGridTotalRank(ExternalAppRequestParam externalAppRequestParam) { - String customerId = externalAppRequestParam.getCustomerId(); - //String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933"; + public Result getIssueGridTotalRank(@RequestHeader("CustomerId") String customerId) { return new Result().ok(kcScreenService.getIssueGridTotalRank(customerId)); } /** * 议题分析-审核效率排名 - * @param externalAppRequestParam * @return */ - @ExternalAppRequestAuth @PostMapping("issue/avgaudittimerank") - public Result getAvgAuditTimeRank(ExternalAppRequestParam externalAppRequestParam) { - String customerId = externalAppRequestParam.getCustomerId(); - //String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933"; + public Result getAvgAuditTimeRank(@RequestHeader("CustomerId") String customerId) { return new Result().ok(kcScreenService.getAvgAuditTimeRank(customerId)); } /** * 议题分析-议题效率 - * @param externalAppRequestParam * @return */ - @ExternalAppRequestAuth @PostMapping("issue/effective") - public Result getIssueEffective(ExternalAppRequestParam externalAppRequestParam) { - String customerId = externalAppRequestParam.getCustomerId(); + public Result getIssueEffective(@RequestHeader("CustomerId") String customerId) { //String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933"; return new Result().ok(kcScreenService.getIssueEffective(customerId)); } /** - * @param externalAppRequestParam * @Description 公益互助-志愿者画像 * @author sun */ - @ExternalAppRequestAuth @PostMapping("heart/volunteerportrayal") - public Result heartVolunteerportrayal(ExternalAppRequestParam externalAppRequestParam){ - return new Result().ok(kcScreenService.heartVolunteerportrayal(externalAppRequestParam)); + public Result heartVolunteerportrayal(@RequestHeader("CustomerId") String customerId){ + return new Result().ok(kcScreenService.heartVolunteerportrayal(customerId)); } /** - * @param externalAppRequestParam * @Description 公益互助-个人(志愿者)公益时长排名 * @author sun */ - @ExternalAppRequestAuth @PostMapping("heart/volunteerrank") - public Result> heartVolunteerrank(ExternalAppRequestParam externalAppRequestParam, @RequestBody HeartVolunteerrankFormDTO formDTO){ + public Result> heartVolunteerrank(@RequestHeader("CustomerId") String customerId, @RequestBody HeartVolunteerrankFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, HeartVolunteerrankFormDTO.AddUserInternalGroup.class); - formDTO.setCustomerId(externalAppRequestParam.getCustomerId()); + formDTO.setCustomerId(customerId); return new Result>().ok(kcScreenService.heartVolunteerrank(formDTO)); } /** - * @param externalAppRequestParam * @Description 邻里党群-各类总数 * @author sun */ - @ExternalAppRequestAuth @PostMapping("group/summary") - public Result groupSummary(ExternalAppRequestParam externalAppRequestParam){ - return new Result().ok(kcScreenService.groupSummary(externalAppRequestParam)); + public Result groupSummary(@RequestHeader("CustomerId") String customerId){ + return new Result().ok(kcScreenService.groupSummary(customerId)); } /** - * @param externalAppRequestParam * @Description 邻里党群-话题参与趋势 * @author sun */ - @ExternalAppRequestAuth @PostMapping("group/partitopictrend") - public Result groupPartitopictrend(ExternalAppRequestParam externalAppRequestParam){ - return new Result().ok(kcScreenService.groupPartitopictrend(externalAppRequestParam)); + public Result groupPartitopictrend(@RequestHeader("CustomerId") String customerId){ + return new Result().ok(kcScreenService.groupPartitopictrend(customerId)); } /** - * @param externalAppRequestParam * @Description 邻里党群-社群数量排名 * @author sun */ - @ExternalAppRequestAuth @PostMapping("group/gridgroupcountrank") - public Result groupGridgroupcountrank(ExternalAppRequestParam externalAppRequestParam){ - return new Result().ok(kcScreenService.groupGridgroupcountrank(externalAppRequestParam)); + public Result groupGridgroupcountrank(@RequestHeader("CustomerId") String customerId){ + return new Result().ok(kcScreenService.groupGridgroupcountrank(customerId)); } /** - * @param externalAppRequestParam * @Description 邻里党群-社群数量排名 * @author sun */ - @ExternalAppRequestAuth @PostMapping("group/usercountrank") - public Result> groupUserCountRank(ExternalAppRequestParam externalAppRequestParam, @RequestBody GroupUserCountRankFormDTO formDTO){ + public Result> groupUserCountRank(@RequestHeader("CustomerId") String customerId, @RequestBody GroupUserCountRankFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, GroupUserCountRankFormDTO.AddUserInternalGroup.class); - formDTO.setCustomerId(externalAppRequestParam.getCustomerId()); + formDTO.setCustomerId(customerId); return new Result>().ok(kcScreenService.groupUserCountRank(formDTO)); } /** - * @param externalAppRequestParam * @Description 邻里党群-话题转化率排名 * @author sun */ - @ExternalAppRequestAuth @PostMapping("group/topicshiftissueratiorank") - public Result> groupTopicShiftIssueRatioRank(ExternalAppRequestParam externalAppRequestParam, @RequestBody GroupTopicShiftIssueRatioRankFormDTO formDTO){ + public Result> groupTopicShiftIssueRatioRank(@RequestHeader("CustomerId") String customerId, @RequestBody GroupTopicShiftIssueRatioRankFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, GroupTopicShiftIssueRatioRankFormDTO.AddUserInternalGroup.class); - formDTO.setCustomerId(externalAppRequestParam.getCustomerId()); + formDTO.setCustomerId(customerId); return new Result>().ok(kcScreenService.groupTopicShiftIssueRatioRank(formDTO)); } /** * 项目各类总数汇总 - * @param externalAppRequestParam * @return */ - @ExternalAppRequestAuth @PostMapping("project/summary") - public Result getProjectSummary(ExternalAppRequestParam externalAppRequestParam){ - //String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933"; - String customerId = externalAppRequestParam.getCustomerId(); + public Result getProjectSummary(@RequestHeader("CustomerId") String customerId){ return new Result().ok(kcScreenService.getProjectSummary(customerId)); } /** * 项目分析-网格下项目数量排名 - * @param externalAppRequestParam * @return */ - @ExternalAppRequestAuth @PostMapping("project/gridcountrank") - public Result getProjectGridCountRank(ExternalAppRequestParam externalAppRequestParam){ - //String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933"; - String customerId = externalAppRequestParam.getCustomerId(); + public Result getProjectGridCountRank(@RequestHeader("CustomerId") String customerId){ return new Result().ok(kcScreenService.getGridProjectCountRank(customerId)); } /** * 项目分析-项目类别 - * @param externalAppRequestParam * @return */ - @ExternalAppRequestAuth @PostMapping("project/categoryanalysis") - public Result> getProjectCategoryAnalysis(ExternalAppRequestParam externalAppRequestParam){ - //String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933"; - String customerId = externalAppRequestParam.getCustomerId(); + public Result> getProjectCategoryAnalysis(@RequestHeader("CustomerId") String customerId){ return new Result>().ok(kcScreenService.getProjectCategoryAnalysis(customerId)); } /** * 网格项目平均结案时间 - * @param externalAppRequestParam * @return */ - @ExternalAppRequestAuth @PostMapping("project/avgclosedtimeanalysis") - public Result> getGridProjectAvgClosedTimeAnalysis(ExternalAppRequestParam externalAppRequestParam){ - //String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933"; - String customerId = externalAppRequestParam.getCustomerId(); + public Result> getGridProjectAvgClosedTimeAnalysis(@RequestHeader("CustomerId") String customerId){ return new Result>().ok(kcScreenService.getGridProjectAvgClosedTimeAnalysis(customerId)); } /** * 项目分析-居民满意度 - * @param externalAppRequestParam * @return */ - @ExternalAppRequestAuth @PostMapping("project/statis") - public Result getProjectSatisfactionAnalyze(ExternalAppRequestParam externalAppRequestParam){ - String customerId = externalAppRequestParam.getCustomerId(); + public Result getProjectSatisfactionAnalyze(@RequestHeader("CustomerId") String customerId){ return new Result().ok(kcScreenService.getProjectSatisfactionAnalyze(customerId)); } /** * 用户-summary - * @param externalAppRequestParam * @return */ - @ExternalAppRequestAuth @PostMapping("user/summary") - public Result getUserSummary(ExternalAppRequestParam externalAppRequestParam){ - String customerId = externalAppRequestParam.getCustomerId(); - //String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933"; + public Result getUserSummary(@RequestHeader("CustomerId") String customerId){ return new Result().ok(kcScreenService.getUserSummary(customerId)); } /** * 用户量趋势 - * @param externalAppRequestParam * @return */ - @ExternalAppRequestAuth @PostMapping("user/trend") - public Result getUserTrend(ExternalAppRequestParam externalAppRequestParam){ - String customerId = externalAppRequestParam.getCustomerId(); + public Result getUserTrend(@RequestHeader("CustomerId") String customerId){ return new Result().ok(kcScreenService.getUserTrend(customerId)); } /** * 网格用户数量排名 - * @param externalAppRequestParam * @return */ - @ExternalAppRequestAuth @PostMapping("user/griduserrank") - public Result getUserRank(ExternalAppRequestParam externalAppRequestParam){ - String customerId = externalAppRequestParam.getCustomerId(); + public Result getUserRank(@RequestHeader("CustomerId") String customerId){ return new Result().ok(kcScreenService.getUserRank(customerId)); } /** * 用户画像 - * @param externalAppRequestParam * @return */ - @ExternalAppRequestAuth @PostMapping("user/userportrayal") - public Result getUserPortrayal(ExternalAppRequestParam externalAppRequestParam){ - String customerId = externalAppRequestParam.getCustomerId(); + public Result getUserPortrayal(@RequestHeader("CustomerId") String customerId){ return new Result().ok(kcScreenService.getUserPortrayal(customerId)); } /** * 用户积分排名 - * @param externalAppRequestParam * @return */ - @ExternalAppRequestAuth @PostMapping("user/pointsrank") - public Result getUserPointsRank(ExternalAppRequestParam externalAppRequestParam, + public Result getUserPointsRank(@RequestHeader("CustomerId") String customerId, @RequestBody PageFormDTO form) { - String customerId = externalAppRequestParam.getCustomerId(); return new Result().ok(kcScreenService.getUserPointsRank(customerId, form.getPageNo(), form.getPageSize())); } /** * 党建声音-各类总数 - * @param externalAppRequestParam * @return */ - @ExternalAppRequestAuth @PostMapping("news/summary") - public Result getNewsSummary(ExternalAppRequestParam externalAppRequestParam){ - String customerId = externalAppRequestParam.getCustomerId(); + public Result getNewsSummary(@RequestHeader("CustomerId") String customerId){ return new Result().ok(kcScreenService.getNewsSummary(customerId)); } /** * 新闻阅读参与趋势 - * @param externalAppRequestParam * @return */ - @ExternalAppRequestAuth @PostMapping("news/partitrend") - public Result getNewsPartiTrend(ExternalAppRequestParam externalAppRequestParam){ - String customerId = externalAppRequestParam.getCustomerId(); + public Result getNewsPartiTrend(@RequestHeader("CustomerId") String customerId){ return new Result().ok(kcScreenService.getNewsPartiTrend(customerId)); } /** * 党建声音-分类的news数量 - * @param externalAppRequestParam * @return */ - @ExternalAppRequestAuth @PostMapping("news/category") - public Result> getNewsCountGroupByCategory(ExternalAppRequestParam externalAppRequestParam){ - String customerId = externalAppRequestParam.getCustomerId(); + public Result> getNewsCountGroupByCategory(@RequestHeader("CustomerId") String customerId){ return new Result>().ok(kcScreenService.getNewsCountOfCategory(customerId)); } /** * 党建声音-分类的用户参与数排行 - * @param externalAppRequestParam * @return */ - @ExternalAppRequestAuth @PostMapping("news/userparticategoryrank") - public Result getNewsPartiCategoryRank(ExternalAppRequestParam externalAppRequestParam){ - String customerId = externalAppRequestParam.getCustomerId(); + public Result getNewsPartiCategoryRank(@RequestHeader("CustomerId") String customerId){ return new Result().ok(kcScreenService.getNewsPartiCategoryRank(customerId)); } /** * 党建声音-热点新闻排行 - * @param externalAppRequestParam * @return */ - @ExternalAppRequestAuth @PostMapping("news/hotrank") - public Result> listNewsHotRank(ExternalAppRequestParam externalAppRequestParam, + public Result> listNewsHotRank(@RequestHeader("CustomerId") String customerId, @RequestBody PageFormDTO form){ - String customerId = externalAppRequestParam.getCustomerId(); return new Result>().ok(kcScreenService.getNewsHotRank(customerId, form.getPageNo(), form.getPageSize())); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java index 5530fae8b0..ca1104f534 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java @@ -1,6 +1,5 @@ package com.epmet.datareport.controller.screen; -import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.datareport.service.evaluationindex.screen.PartyMemberLeadService; @@ -33,7 +32,6 @@ public class PartyMemberLeadController { * @author zxc * @date 2020/8/20 1:56 下午 */ - @ExternalAppRequestAuth @PostMapping("fineexample") public Result fineExample(@RequestBody FineExampleFormDTO fineExampleFormDTO){ ValidatorUtils.validateEntity(fineExampleFormDTO, FineExampleFormDTO.FineExample.class); @@ -46,7 +44,6 @@ public class PartyMemberLeadController { * @author zxc * @date 2020/8/20 2:35 下午 */ - @ExternalAppRequestAuth @PostMapping("contactmasslinechart") public Result contactMassLineChart(@RequestBody ContactMassLineChartFormDTO contactMassLineChartFormDTO){ ValidatorUtils.validateEntity(contactMassLineChartFormDTO, ContactMassLineChartFormDTO.ContactMassLineChart.class); @@ -59,7 +56,6 @@ public class PartyMemberLeadController { * @author zxc * @date 2020/8/20 3:19 下午 */ - @ExternalAppRequestAuth @PostMapping("volunteerservice") public Result volunteerService(@RequestBody VolunteerServiceFormDTO volunteerServiceFormDTO){ ValidatorUtils.validateEntity(volunteerServiceFormDTO, VolunteerServiceFormDTO.VolunteerService.class); @@ -74,7 +70,6 @@ public class PartyMemberLeadController { * @author wangc * @date 2020.08.21 11:05 **/ - @ExternalAppRequestAuth @PostMapping("advancedbranchrank") Result> advancedBranchRank(@RequestBody AgencyAndNumFormDTO param){ ValidatorUtils.validateEntity(param, AgencyFormDTO.CommonAgencyIdGroup.class); @@ -89,7 +84,6 @@ public class PartyMemberLeadController { * @author wangc * @date 2020.08.21 14:22 **/ - @ExternalAppRequestAuth @PostMapping("advancedpartymemberrank") Result> advancedPartymemberRank(@RequestBody AgencyAndNumFormDTO param){ ValidatorUtils.validateEntity(param, AgencyFormDTO.CommonAgencyIdGroup.class); diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java index 5417767ee6..483e3edcc1 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java @@ -1,6 +1,5 @@ package com.epmet.datareport.controller.screen; -import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectService; @@ -31,7 +30,6 @@ public class ScreenProjectController { * @author zxc * @date 2020/8/19 4:36 下午 */ - @ExternalAppRequestAuth @PostMapping("detail") public Result projectDetail(@RequestBody ProjectDetailFormDTO projectDetailFormDTO){ ValidatorUtils.validateEntity(projectDetailFormDTO, ProjectDetailFormDTO.ProjectDetail.class); diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenUserController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenUserController.java new file mode 100644 index 0000000000..84d586306f --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenUserController.java @@ -0,0 +1,56 @@ +package com.epmet.datareport.controller.screen; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.datareport.service.evaluationindex.screen.ScreenUserService; +import com.epmet.evaluationindex.screen.dto.form.PartIndexScroeRankFormDTO; +import com.epmet.evaluationindex.screen.dto.form.UserPointRankFormDTO; +import com.epmet.evaluationindex.screen.dto.result.PartIndexScroeRankResultDTO; +import com.epmet.evaluationindex.screen.dto.result.UserPointRankListResultDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * 数据改版api + * + * @author sun + */ +@RestController +@RequestMapping("/screen/user") +public class ScreenUserController { + + @Autowired + private ScreenUserService screenUserService; + + /** + * @param formDTO + * @Description 热心市民积分排行列表 + * @author sun + */ + @PostMapping("userpointrank") + public Result> userPointRank(@RequestBody UserPointRankFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, UserPointRankFormDTO.AddUserInternalGroup.class); + return new Result>().ok(screenUserService.userPointRank(formDTO)); + } + + /** + * @param formDTO + * @Description 党员(指标得分)排行 + * @author sun + */ + @PostMapping("partindexscroerank") + public Result> partIndexScroeRank(@RequestBody PartIndexScroeRankFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, PartIndexScroeRankFormDTO.AddUserInternalGroup.class); + return new Result>().ok(screenUserService.partIndexScroeRank(formDTO)); + } + + + +} 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 c64d8dbef9..2c030eac41 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,10 +17,7 @@ package com.epmet.datareport.dao.evaluationindex.screen; -import com.epmet.evaluationindex.screen.dto.form.AnNingSubAgencyIndexRankFormDTO; -import com.epmet.evaluationindex.screen.dto.form.GridIndexRankFormDTO; -import com.epmet.evaluationindex.screen.dto.form.PeerComparisonFormDTO; -import com.epmet.evaluationindex.screen.dto.form.SubAgencyIndexRankFormDTO; +import com.epmet.evaluationindex.screen.dto.form.*; import com.epmet.evaluationindex.screen.dto.result.*; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -68,7 +65,7 @@ public interface ScreenIndexDataMonthlyDao{ * @Author zhangyong * @Date 09:38 2020-09-08 **/ - List selectAnNingSubAgencyIndexMonthlyRank(AnNingSubAgencyIndexRankFormDTO formDTO); + List selectSubAgencyOrGridIndexMonthlyRank(SubAgencyIndexRankYMFormDTO formDTO); /** * desc:获取网格指标排行 @@ -80,8 +77,22 @@ public interface ScreenIndexDataMonthlyDao{ /** * @param formDTO - * @Description 同级对比--根据组织Id的上级组织Id查询同级组织对应类型的得分排名(查询最近一个月数据) + * @Description 同级对比--根据组织或网格Id的上级组织Id查询同级组织或网格对应类型的得分排名(查询最近一个月数据) * @author sun */ List selectScoreList(PeerComparisonFormDTO formDTO); + + /** + * @param formDTO + * @Description 根据组织或网格Id以及月份Id查询各项月度指数得分 + * @author sun + */ + IndexScoreResultDTO selectMonthData(IndexScoreFormDTO formDTO); + + /** + * @param formDTO + * @Description 先进排行-先进支部排行 + * @author sun + */ + List selectRankList(AdvancedBranchRankFormDTO 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/evaluationindex/screen/ScreenPartyUserRankDataDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPartyUserRankDataDao.java index bc15ca191f..0f442931b5 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPartyUserRankDataDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPartyUserRankDataDao.java @@ -18,7 +18,11 @@ package com.epmet.datareport.dao.evaluationindex.screen; import com.epmet.dto.result.user.KcUserPointRankResultDTO; +import com.epmet.evaluationindex.screen.dto.form.PartIndexScroeRankFormDTO; +import com.epmet.evaluationindex.screen.dto.form.UserPointRankFormDTO; +import com.epmet.evaluationindex.screen.dto.result.PartIndexScroeRankResultDTO; import com.epmet.evaluationindex.screen.dto.result.PartyUserPointResultDTO; +import com.epmet.evaluationindex.screen.dto.result.UserPointRankListResultDTO; import com.epmet.evaluationindex.screen.dto.result.UserPointResultDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -53,4 +57,18 @@ public interface ScreenPartyUserRankDataDao{ List selectPartymemberPointOrder(@Param("agencyId")String agencyId); List listUserPoints(String customerId); + + /** + * @param formDTO + * @Description 查询组织下居民积分排行,按积分值降序 + * @author sun + */ + List selectAgencyUserPointList(UserPointRankFormDTO formDTO); + + /** + * @param formDTO + * @Description 查询组织下党员的积分排行,按积分值降序 + * @author sun + */ + List selectPartymemberPointList(PartIndexScroeRankFormDTO formDTO); } \ No newline at end of file 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 index 0ca569e995..66cbc46d42 100644 --- 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 @@ -17,10 +17,17 @@ package com.epmet.datareport.dao.fact; +import com.epmet.evaluationindex.screen.dto.form.AblityIndexFormDTO; +import com.epmet.evaluationindex.screen.dto.form.MonthScoreListFormDTO; import com.epmet.evaluationindex.screen.dto.form.ScoreListFormDTO; +import com.epmet.evaluationindex.screen.dto.result.AblityIndexResultDTO; +import com.epmet.evaluationindex.screen.dto.result.MonthScoreListResultDTO; import com.epmet.evaluationindex.screen.dto.result.ScoreListResultDTO; import org.apache.ibatis.annotations.Mapper; +import java.util.LinkedList; +import java.util.List; + /** * 区/街道相关分数表 * @@ -32,8 +39,22 @@ public interface FactIndexAgencyScoreDao { /** * @param formDTO - * @Description 分别查询当前组织某一月份党建能力、治理能力、服务能力对应的总分、本级分、下级分 + * @Description 分别查询区县、乡镇街道过去12个月党建能力、治理能力、服务能力每月总分、本级得分、下级得分数据 + * @author sun + */ + LinkedList selectAblityIndex(AblityIndexFormDTO formDTO); + + /** + * @param formDTO + * @Description 查询当前组织某一月份党建能力、治理能力、服务能力对应的总分、本级分、下级分 + * @author sun + */ + List selectScoreList(ScoreListFormDTO formDTO); + + /** + * @param formDTO + * @Description 分别查询区县、乡镇街道过去12个月党建能力、治理能力、服务能力每月总分、本级得分、下级得分数据 * @author sun */ - ScoreListResultDTO selectScore(ScoreListFormDTO formDTO); + LinkedList selectMonthScoreList(MonthScoreListFormDTO 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..0c7a7a7f65 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunityScoreDao.java @@ -0,0 +1,60 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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.MonthScoreListFormDTO; +import com.epmet.evaluationindex.screen.dto.form.ScoreListFormDTO; +import com.epmet.evaluationindex.screen.dto.result.AblityIndexResultDTO; +import com.epmet.evaluationindex.screen.dto.result.MonthScoreListResultDTO; +import com.epmet.evaluationindex.screen.dto.result.ScoreListResultDTO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.LinkedList; +import java.util.List; + +/** + * 社区相关分数表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-09-02 + */ +@Mapper +public interface FactIndexCommunityScoreDao { + + /** + * @param formDTO + * @Description 分别查询社区过去12个月党建能力、治理能力、服务能力每月总分、本级得分、下级得分数据 + * @author sun + */ + LinkedList selectCommunityAblityIndex(AblityIndexFormDTO formDTO); + + /** + * @param formDTO + * @Description 查询社区级组织某一月份党建能力、治理能力、服务能力对应的总分、本级分、下级分 + * @author sun + */ + List selectCommunityScoreList(ScoreListFormDTO formDTO); + + /** + * @param formDTO + * @Description 分别查询社区过去12个月党建能力、治理能力、服务能力每月总分、本级得分、下级得分数据 + * @author sun + */ + LinkedList selectCommunityMonthScoreList(MonthScoreListFormDTO formDTO); +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridScoreDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridScoreDao.java new file mode 100644 index 0000000000..c5153b0933 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridScoreDao.java @@ -0,0 +1,60 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

+ * 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 FactIndexGridSubScoreDao { + + /** + * @param formDTO + * @Description 查询网格某月份某项能力对应的各项指标 + * @author sun + */ + List selectGridAblityList(AblityListFormDTO formDTO); + + /** + * @param formDTO + * @Description 查询网格层级某项能力对应的一项指标过去12个月份数据 + * @author sun + */ + LinkedList selectGridMonthAblityList(MonthAblityListFormDTO formDTO); +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/IndexDictDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/IndexDictDao.java new file mode 100644 index 0000000000..893820cf1c --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/IndexDictDao.java @@ -0,0 +1,49 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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.result.IndexDictResultDTO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * 评价指标字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-09-02 + */ +@Mapper +public interface IndexDictDao { + + /** + * @param + * @Description 查询指标字典表是百分比类型的数据 + * @author sun + */ + List selectList(); + + /** + * @param + * @Description 根据indexCode查询指标字典表具体数据 + * @author sun + */ + IndexDictResultDTO selectIndexDict(@Param("indexCode") String indexCode); +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java index d633b94ea2..eee423ca41 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java @@ -1,6 +1,5 @@ package com.epmet.datareport.service.evaluationindex.screen; -import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; import com.epmet.evaluationindex.screen.dto.form.CompartmentFormDTO; import com.epmet.evaluationindex.screen.dto.result.CompartmentResultDTO; import com.epmet.evaluationindex.screen.dto.result.TreeResultDTO; @@ -14,12 +13,12 @@ import com.epmet.evaluationindex.screen.dto.result.TreeResultDTO; public interface AgencyService { /** - * @Description 1、组织机构树 * @param + * @Description 1、组织机构树 只返回 is_display = '1'的 * @author zxc * @date 2020/8/18 2:04 下午 */ - TreeResultDTO tree(ExternalAppRequestParam externalAppRequestParam); + TreeResultDTO tree(String customerId); /** * @Description 2、组织区域查询 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..3485770cc2 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:获取该客户下网格排行 @@ -62,4 +62,18 @@ public interface IndexService { * @return */ List selectIndexRankByOrgType(GridIndexRankFormDTO formDTO); + + /** + * @param formDTO + * @Description 组织月度指数得分 + * @author sun + */ + IndexScoreResultDTO indexScore(IndexScoreFormDTO formDTO); + + /** + * @param formDTO + * @Description 先进排行-先进支部排行 + * @author sun + */ + List advancedBranchRank(AdvancedBranchRankFormDTO formDTO); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java index d17df56ba1..480601a129 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java @@ -1,6 +1,5 @@ package com.epmet.datareport.service.evaluationindex.screen; -import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; import com.epmet.dto.result.issue.*; import com.epmet.dto.result.project.*; import com.epmet.dto.result.user.*; @@ -22,32 +21,28 @@ import com.epmet.evaluationindex.screen.dto.result.HomepageSummaryResultDTO; public interface KcScreenService { /** - * @param externalAppRequestParam * @Description 首页-平台各类总数 * @author sun */ - HomepageSummaryResultDTO homepageSummary(ExternalAppRequestParam externalAppRequestParam); + HomepageSummaryResultDTO homepageSummary(String customerId); /** - * @param externalAppRequestParam * @Description 公益互助-各类总数汇总 * @author sun */ - HeartSummaryResultDTO heartSummary(ExternalAppRequestParam externalAppRequestParam); + HeartSummaryResultDTO heartSummary(String customerId); /** - * @param externalAppRequestParam * @Description 公益互助-公益活动次数 * @author sun */ - HeartActcounttrendResultDTO heartActcounttrend(ExternalAppRequestParam externalAppRequestParam); + HeartActcounttrendResultDTO heartActcounttrend(String customerId); /** - * @param externalAppRequestParam * @Description 公益互助-志愿者画像 * @author sun */ - HeartVolunteerportrayalResultDTO heartVolunteerportrayal(ExternalAppRequestParam externalAppRequestParam); + HeartVolunteerportrayalResultDTO heartVolunteerportrayal(String customerId); /** * @param formDTO @@ -67,25 +62,22 @@ public interface KcScreenService { /** - * @param externalAppRequestParam * @Description 邻里党群-各类总数 * @author sun */ - GroupSummaryResultDTO groupSummary(ExternalAppRequestParam externalAppRequestParam); + GroupSummaryResultDTO groupSummary(String customerId); /** - * @param externalAppRequestParam * @Description 邻里党群-话题参与趋势 * @author sun */ - GroupPartitopictrendResultDTO groupPartitopictrend(ExternalAppRequestParam externalAppRequestParam); + GroupPartitopictrendResultDTO groupPartitopictrend(String customerId); /** - * @param externalAppRequestParam * @Description 邻里党群-社群数量排名 * @author sun */ - GroupGridgroupcountrankResultDTO groupGridgroupcountrank(ExternalAppRequestParam externalAppRequestParam); + GroupGridgroupcountrankResultDTO groupGridgroupcountrank(String customerId); /** * @param formDTO diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenUserService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenUserService.java new file mode 100644 index 0000000000..f5e2428f09 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenUserService.java @@ -0,0 +1,30 @@ +package com.epmet.datareport.service.evaluationindex.screen; + +import com.epmet.evaluationindex.screen.dto.form.PartIndexScroeRankFormDTO; +import com.epmet.evaluationindex.screen.dto.form.UserPointRankFormDTO; +import com.epmet.evaluationindex.screen.dto.result.PartIndexScroeRankResultDTO; +import com.epmet.evaluationindex.screen.dto.result.UserPointRankListResultDTO; + +import java.util.List; + +/** + * 数据改版 + * + * @author sun + */ +public interface ScreenUserService { + + /** + * @param formDTO + * @Description 热心市民积分排行列表 + * @author sun + */ + List userPointRank(UserPointRankFormDTO formDTO); + + /** + * @param formDTO + * @Description 党员(指标得分)排行 + * @author sun + */ + List partIndexScroeRank(PartIndexScroeRankFormDTO formDTO); +} 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..104e941333 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 @@ -1,8 +1,8 @@ package com.epmet.datareport.service.evaluationindex.screen.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; -import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; import com.epmet.constant.DataSourceConstant; import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerAgencyDao; import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerGridDao; @@ -12,7 +12,7 @@ import com.epmet.evaluationindex.screen.dto.form.CompartmentFormDTO; import com.epmet.evaluationindex.screen.dto.result.AgencyDistributionResultDTO; import com.epmet.evaluationindex.screen.dto.result.CompartmentResultDTO; import com.epmet.evaluationindex.screen.dto.result.TreeResultDTO; -import org.apache.commons.lang3.StringUtils; +import org.apache.ibatis.exceptions.TooManyResultsException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -42,25 +42,24 @@ public class AgencyServiceImpl implements AgencyService { */ @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) @Override - public TreeResultDTO tree(ExternalAppRequestParam externalAppRequestParam) { + public TreeResultDTO tree(String customerId) { // 1. 查询客户根组织ID - String customerId = externalAppRequestParam.getCustomerId(); - - // 验签关闭,customerId无法获取,暂时写死 - if(StringUtils.isBlank(customerId)){ - customerId = "b09527201c4409e19d1dbc5e3c3429a1"; - } - TreeResultDTO rootAgency = screenCustomerAgencyDao.selectRootAgencyId(customerId); - if (null == rootAgency){ - return new TreeResultDTO(); + TreeResultDTO rootAgency = null; + try { + rootAgency = screenCustomerAgencyDao.selectRootAgencyId(customerId); + if (null == rootAgency) { + return new TreeResultDTO(); + } + } catch (TooManyResultsException e) { + throw new RenException("根组织结构数据有误"); } List 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/GrassRootsGovernServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java index d750c1ee03..7afd0f4362 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java @@ -108,18 +108,17 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService { UserJoinIndicatorGrowthRateResultDTO latest = screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId); //保证获取公众参与概率数据的最大可能性 int time = NumConstant.TWELVE; - while(null == latest && time > NumConstant.ONE) - { - time --; - monthId = dateUtils.getPreviousMonthIdByDest(null,monthId); - latest = screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId); - } + while (null == latest && time > NumConstant.ONE) { + time--; + monthId = dateUtils.getPreviousMonthIdByDest(null, monthId); + latest = screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId); + } - if(null == latest) return new PublicPartiProfileResultDTO(); - PublicPartiProfileResultDTO result = ConvertUtils.sourceToTarget(latest,PublicPartiProfileResultDTO.class); - result.setMonthIncr(convertPercentStr(latest.getMonthIncr(),NumConstant.ZERO)); - result.setJoinCompareLatestMonth(convertPercentStr(latest.getJoinCompareLatestMonth(),NumConstant.ZERO)); - result.setIssueCompareLatestMonth(convertPercentStr(latest.getIssueCompareLatestMonth(),NumConstant.ZERO)); + if (null == latest) return new PublicPartiProfileResultDTO(); + PublicPartiProfileResultDTO result = ConvertUtils.sourceToTarget(latest, PublicPartiProfileResultDTO.class); + result.setMonthIncr(convertPercentStr(latest.getMonthIncr(), NumConstant.ZERO)); + result.setJoinCompareLatestMonth(convertPercentStr(latest.getJoinCompareLatestMonth().abs(), NumConstant.ZERO)); + result.setIssueCompareLatestMonth(convertPercentStr(latest.getIssueCompareLatestMonth().abs(), NumConstant.ZERO)); return result; } 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..872210194d 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 @@ -2,23 +2,27 @@ package com.epmet.datareport.service.evaluationindex.screen.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.DataSourceConstant; import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataMonthlyDao; import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataYearlyDao; import com.epmet.datareport.service.evaluationindex.screen.IndexService; -import com.epmet.datareport.utils.DateUtils; import com.epmet.evaluationindex.screen.constant.ScreenConstant; import com.epmet.evaluationindex.screen.dto.form.*; import com.epmet.evaluationindex.screen.dto.result.*; import org.apache.commons.lang3.StringUtils; +import org.jsoup.helper.DataUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import org.springframework.util.unit.DataUnit; import java.math.BigDecimal; +import java.text.NumberFormat; import java.time.LocalDate; import java.util.ArrayList; import java.util.Comparator; +import java.util.Date; import java.util.List; import java.util.stream.Collectors; @@ -39,7 +43,7 @@ public class IndexServiceImpl implements IndexService { @Autowired private PartyMemberLeadServiceImpl partyMemberLeadServiceImpl; @Autowired - private DateUtils dateUtils; + private com.epmet.datareport.utils.DateUtils dateUtils; /** * @Description 1、年度平均指数 @@ -204,16 +208,20 @@ public class IndexServiceImpl implements IndexService { return subAgencyIndexRankResultDTOS; } - @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) + @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override - public List 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())); @@ -254,4 +262,71 @@ public class IndexServiceImpl implements IndexService { BigDecimal b = bigDecimal.setScale(NumConstant.ONE, BigDecimal.ROUND_HALF_UP); return Double.valueOf(b.toString()); } + + /** + * @param formDTO + * @Description 组织月度指数得分 + * @author sun + */ + @Override + @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) + public IndexScoreResultDTO indexScore(IndexScoreFormDTO formDTO) { + //screen_index_data_monthly 根据组织id和月份获取月度指标得分 + //1.大屏接口 orgType和monthId字段不传值,默认查询上一个月数据 + if(null==formDTO.getMonthId()||"".equals(formDTO.getMonthId())){ + formDTO.setMonthId(DateUtils.getBeforeNMonth(1)); + } + //2.根据组织或网格Id以及月份Id查询各项月度指数得分 + IndexScoreResultDTO resultDTO = screenIndexDataMonthlyDao.selectMonthData(formDTO); + if (null == resultDTO) { + return resultDTO; + } + + //3.将数据改成正确格式 四舍五入保留一位小数 权重转成百分比 + NumberFormat nf = NumberFormat.getPercentInstance(); + nf.setMaximumFractionDigits(1); + + BigDecimal num1 = new BigDecimal(resultDTO.getParty()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros(); + resultDTO.setPartyDevAbility(num1); + resultDTO.setPartyDevAbilityWeight(nf.format(Double.parseDouble(resultDTO.getPartyDevAbilityWeight()))); + BigDecimal num2 = new BigDecimal(resultDTO.getGovern()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros(); + resultDTO.setGovernAbility(num2); + resultDTO.setGovernAbilityWeight(nf.format(Double.parseDouble(resultDTO.getGovernAbilityWeight()))); + BigDecimal num3 = new BigDecimal(resultDTO.getService()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros(); + resultDTO.setServiceAbility(num3); + resultDTO.setServiceAbilityWeight(nf.format(Double.parseDouble(resultDTO.getServiceAbilityWeight()))); + Double db = num1.doubleValue() + num2.doubleValue() + num3.doubleValue(); + BigDecimal num = new BigDecimal(db.toString()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros(); + resultDTO.setTotalScore(num); + + return resultDTO; + } + + /** + * @param formDTO + * @Description 先进排行-先进支部排行 + * @author sun + */ + @Override + @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) + public List advancedBranchRank(AdvancedBranchRankFormDTO formDTO) { + //根据当前所选组织,查询screen_index_data_monthly中类型为网格的按照总指数倒序,关联screen_org_rank_data表取其他数据 + //1.级联查询组织下所有网格的先进支部排行数据,按总指数降序 + formDTO.setMonthId(DateUtils.getBeforeNMonth(1)); + List list = screenIndexDataMonthlyDao.selectRankList(formDTO); + //2.遍历数据,小数保留一位小数,百分数添加百分号 + NumberFormat nf = NumberFormat.getPercentInstance(); + nf.setMaximumFractionDigits(1); + list.forEach(l->{ + BigDecimal num = new BigDecimal(l.getTotalScore()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros(); + l.setScroe(num); + BigDecimal num1 = new BigDecimal(l.getSatisfactionRatio()).setScale(1, BigDecimal.ROUND_HALF_UP); + l.setSatisfactionRatio(num1 + "%"); + BigDecimal num2 = new BigDecimal(l.getClosedProjectRatio()).setScale(1, BigDecimal.ROUND_HALF_UP); + l.setClosedProjectRatio(num2 + "%"); + }); + + return list; + } + } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java index b82d6b654f..6a84e531d7 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java @@ -1,7 +1,6 @@ package com.epmet.datareport.service.evaluationindex.screen.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; -import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.constant.DataSourceConstant; import com.epmet.datareport.dao.evaluationindex.screen.ScreenPartyUserRankDataDao; @@ -99,37 +98,34 @@ public class KcScreenServiceImpl implements KcScreenService { private ScreenKcNewsRankDao screenKcNewsRankDao; /** - * @param externalAppRequestParam * @Description 首页-平台各类总数 * @author sun */ @Override - public HomepageSummaryResultDTO homepageSummary(ExternalAppRequestParam externalAppRequestParam) { - return screenKcPlatformSummaryDailyDao.selectSummaryDaily(externalAppRequestParam.getCustomerId()); + public HomepageSummaryResultDTO homepageSummary(String customerId) { + return screenKcPlatformSummaryDailyDao.selectSummaryDaily(customerId); } /** - * @param externalAppRequestParam * @Description 公益互助-各类总数汇总 * @author sun */ @Override - public HeartSummaryResultDTO heartSummary(ExternalAppRequestParam externalAppRequestParam) { - return screenKcActSummaryDailyDao.selectHeartSummary(externalAppRequestParam.getCustomerId()); + public HeartSummaryResultDTO heartSummary(String customerId) { + return screenKcActSummaryDailyDao.selectHeartSummary(customerId); } /** - * @param externalAppRequestParam * @Description 公益互助-公益活动次数 * @author sun */ @Override - public HeartActcounttrendResultDTO heartActcounttrend(ExternalAppRequestParam externalAppRequestParam) { + public HeartActcounttrendResultDTO heartActcounttrend(String customerId) { HeartActcounttrendResultDTO resultDTO = new HeartActcounttrendResultDTO(); LinkedList xAxis = new LinkedList<>(); LinkedList actCountDataList = new LinkedList<>(); //1.按客户查询最近十二个月数据 - List list = screenKcActTrendMonthlyDao.selectActTrendMonthly(externalAppRequestParam.getCustomerId()); + List list = screenKcActTrendMonthlyDao.selectActTrendMonthly(customerId); //2.倒序遍历封装数据 for (int i = list.size() - 1; i >= 0; i--) { xAxis.add(list.get(i).getMonthId()); @@ -142,16 +138,15 @@ public class KcScreenServiceImpl implements KcScreenService { } /** - * @param externalAppRequestParam * @Description 公益互助-志愿者画像 * @author sun */ @Override - public HeartVolunteerportrayalResultDTO heartVolunteerportrayal(ExternalAppRequestParam externalAppRequestParam) { + public HeartVolunteerportrayalResultDTO heartVolunteerportrayal(String customerId) { HeartVolunteerportrayalResultDTO resultDTO = new HeartVolunteerportrayalResultDTO(); GenderDistributionResultDTO genderDistribution = new GenderDistributionResultDTO(); //1.根据客户Id查询最近日期志愿者统计数据 - AgeDistributionResultDTO ageDistribution = screenKcVolunteerSummaryDailyDao.selectVolunteerSummaryDaily(externalAppRequestParam.getCustomerId()); + AgeDistributionResultDTO ageDistribution = screenKcVolunteerSummaryDailyDao.selectVolunteerSummaryDaily(customerId); //2.封装数据并返回 if (null == ageDistribution) { resultDTO.setAgeDistribution(new AgeDistributionResultDTO()); @@ -219,14 +214,13 @@ public class KcScreenServiceImpl implements KcScreenService { } /** - * @param externalAppRequestParam * @Description 邻里党群-各类总数 * @author sun */ @Override - public GroupSummaryResultDTO groupSummary(ExternalAppRequestParam externalAppRequestParam) { + public GroupSummaryResultDTO groupSummary(String customerId) { //1.按客户查询最近一天各网格各项数据的汇总值 - GroupSummaryResultDTO resultDTO = screenKcGroupSummaryGridDailyDao.selectGroupSummaryDaily(externalAppRequestParam.getCustomerId()); + GroupSummaryResultDTO resultDTO = screenKcGroupSummaryGridDailyDao.selectGroupSummaryDaily(customerId); if (null == resultDTO) { return new GroupSummaryResultDTO(); } @@ -246,17 +240,16 @@ public class KcScreenServiceImpl implements KcScreenService { } /** - * @param externalAppRequestParam * @Description 邻里党群-话题参与趋势 * @author sun */ @Override - public GroupPartitopictrendResultDTO groupPartitopictrend(ExternalAppRequestParam externalAppRequestParam) { + public GroupPartitopictrendResultDTO groupPartitopictrend(String customerId) { GroupPartitopictrendResultDTO resultDTO = new GroupPartitopictrendResultDTO(); LinkedList xAxis = new LinkedList<>(); LinkedList actCountDataList = new LinkedList<>(); //1.按客户查询最近十二个月所有网格汇总数据 - List list = screenKcTopicTrendGridMonthlyDao.selectActTrendMonthly(externalAppRequestParam.getCustomerId()); + List list = screenKcTopicTrendGridMonthlyDao.selectActTrendMonthly(customerId); //2.倒序遍历封装数据 for (int i = list.size() - 1; i >= 0; i--) { xAxis.add(list.get(i).getMonthId()); @@ -269,17 +262,16 @@ public class KcScreenServiceImpl implements KcScreenService { } /** - * @param externalAppRequestParam * @Description 邻里党群-社群数量排名 * @author sun */ @Override - public GroupGridgroupcountrankResultDTO groupGridgroupcountrank(ExternalAppRequestParam externalAppRequestParam) { + public GroupGridgroupcountrankResultDTO groupGridgroupcountrank(String customerId) { GroupGridgroupcountrankResultDTO resultDTO = new GroupGridgroupcountrankResultDTO(); LinkedList gridNameDataList = new LinkedList<>(); LinkedList groupCountDataList = new LinkedList<>(); //1.按日期降序,查询客户最近一天所有网格数据,按每个网格的社区总数降序排列 - LinkedList list = screenKcGroupSummaryGridDailyDao.selectGridDailyList(externalAppRequestParam.getCustomerId()); + LinkedList list = screenKcGroupSummaryGridDailyDao.selectGridDailyList(customerId); //2.封装数据 list.forEach(l -> { gridNameDataList.add(l.getGridName()); diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenUserServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenUserServiceImpl.java new file mode 100644 index 0000000000..7721876c58 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenUserServiceImpl.java @@ -0,0 +1,62 @@ +package com.epmet.datareport.service.evaluationindex.screen.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.constant.DataSourceConstant; +import com.epmet.datareport.constant.FactConstant; +import com.epmet.datareport.dao.evaluationindex.screen.ScreenPartyUserRankDataDao; +import com.epmet.datareport.service.evaluationindex.screen.ScreenUserService; +import com.epmet.evaluationindex.screen.dto.form.PartIndexScroeRankFormDTO; +import com.epmet.evaluationindex.screen.dto.form.UserPointRankFormDTO; +import com.epmet.evaluationindex.screen.dto.result.PartIndexScroeRankResultDTO; +import com.epmet.evaluationindex.screen.dto.result.UserPointRankListResultDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 数据改版 + * + * @author sun + */ +@Service +@DataSource(DataSourceConstant.EVALUATION_INDEX) +public class ScreenUserServiceImpl implements ScreenUserService { + + @Autowired + private ScreenPartyUserRankDataDao screenPartyUserRankDataDao; + + /** + * @param formDTO + * @Description 热心市民积分排行列表 + * @author sun + */ + @Override + @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) + public List userPointRank(UserPointRankFormDTO formDTO) { + //1.参数校验 + if (!FactConstant.AGENCY.equals(formDTO.getOrgType()) && !FactConstant.GRID.equals(formDTO.getOrgType())) { + throw new RenException(String.format("入参格式错误,错误的组织或网格类型:%s", formDTO.getOrgType())); + } + //2.查询组织下居民积分排行,按积分值降序 screen_party_user_rank_data + return screenPartyUserRankDataDao.selectAgencyUserPointList(formDTO); + } + + /** + * @param formDTO + * @Description 党员(指标得分)排行 + * @author sun + */ + @Override + @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) + public List partIndexScroeRank(PartIndexScroeRankFormDTO formDTO) { + //1.参数校验 + if (!FactConstant.AGENCY.equals(formDTO.getOrgType()) && !FactConstant.GRID.equals(formDTO.getOrgType())) { + throw new RenException(String.format("入参格式错误,错误的组织或网格类型:%s", formDTO.getOrgType())); + } + //2.查询组织下党员的积分排行 screen_party_user_rank_data + return screenPartyUserRankDataDao.selectPartymemberPointList(formDTO); + } + +} \ No newline at end of file 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 index 52a9fe1d7a..d4543b4aa7 100644 --- 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 @@ -2,24 +2,26 @@ package com.epmet.datareport.service.fact.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; -import com.epmet.commons.tools.exception.ErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.constant.DataSourceConstant; import com.epmet.datareport.constant.FactConstant; import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerAgencyDao; import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataMonthlyDao; -import com.epmet.datareport.dao.fact.FactIndexAgencyScoreDao; -import com.epmet.datareport.dao.fact.FactIndexAgencySubScoreDao; -import com.epmet.datareport.dao.fact.FactIndexCommunitySubScoreDao; +import com.epmet.datareport.dao.fact.*; import com.epmet.datareport.service.fact.FactIndexService; import com.epmet.evaluationindex.screen.dto.form.*; import com.epmet.evaluationindex.screen.dto.result.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.math.BigDecimal; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.LinkedList; +import java.util.List; +import java.util.regex.Pattern; /** * 数据改版api @@ -39,7 +41,15 @@ public class FactIndexServiceImpl implements FactIndexService { @Autowired private FactIndexAgencySubScoreDao factIndexAgencySubScoreDao; @Autowired + private FactIndexCommunityScoreDao factIndexCommunityScoreDao; + @Autowired private FactIndexCommunitySubScoreDao factIndexCommunitySubScoreDao; + @Autowired + private FactIndexGridScoreDao factIndexGridScoreDao; + @Autowired + private FactIndexGridSubScoreDao factIndexGridSubScoreDao; + @Autowired + private IndexDictDao indexDictDao; /** * @param formDTO @@ -48,44 +58,105 @@ public class FactIndexServiceImpl implements FactIndexService { */ @Override public List ablityIndex(AblityIndexFormDTO formDTO) { - LinkedList resultDTO = new LinkedList<>(); - //分别查询过去12个月党建能力、治理能力、服务能力各自总分乘权重后的分值,每个月份三个分值的加和就是当月的能力指数的分值 fact_index_agency_score 按月份升序 - //1.查询组织过去12个月党建能力指标 - //LinkedList djList = factIndexAgencyScoreDao.; - LinkedList djList = null; - //2.查询组织过去12个月治理能力指标 - LinkedList zlList = null; - //3.查询组织过去12个月服务能力指标 - LinkedList fwList = null; - //4.遍历计算每个月能力指数 + LinkedList resultList = new LinkedList<>(); + LinkedList list = new LinkedList<>(); + LinkedList djList = new LinkedList<>(); + LinkedList zlList = new LinkedList<>(); + LinkedList fwList = new LinkedList<>(); + //1.计算所查月份前12个月的monthId + formDTO.setStartMonthId(getDate(formDTO.getMonthId())); + //2.根据类型判断是查询组织数据还是网格数据 + //组织层级数据 + if (FactConstant.AGENCY.equals(formDTO.getOrgType())) { + //3.根据组织Id查询组织信息 + CompartmentResultDTO agency = screenCustomerAgencyDao.getAgencyAreaInfo(formDTO.getOrgId()); + if (null == agency) { + //throw new RenException(String.format("根据组织Id未查询到组织信息,组织Id:%s", formDTO.getOrgId())); + return resultList; + } + //4.根据组织级别判断查询哪类数据表 + //区县级、乡镇街道级 + if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) { + //4-1.查询过去12个月党建能力、治理能力、服务能力每月总分数据 + list = factIndexAgencyScoreDao.selectAblityIndex(formDTO); + + //社区级 + } else if ("community".equals(agency.getLevel())) { + //4-1.查询过去12个月党建能力、治理能力、服务能力每月总分、本级得分、下级得分数据 + list = factIndexCommunityScoreDao.selectCommunityAblityIndex(formDTO); + } else { + //throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getOrgId())); + return resultList; + } + //网格层级数据 + } else if (FactConstant.GRID.equals(formDTO.getOrgType())) { + //5.查询网格过去12个月党建能力、治理能力、服务能力每月总分数据 + list = factIndexGridScoreDao.selectGridAblityIndex(formDTO); + } else { + throw new RenException(String.format("能力指数查询,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType())); + } + if (list.size() < NumConstant.ONE) { + return resultList; + } + + //6.遍历计算每个月能力指数 LinkedList nlList = new LinkedList<>(); - for (int i = 0; i < djList.size(); i++) { - AblityIndexResultDTO.ScoreListResultDTO nldto = new AblityIndexResultDTO.ScoreListResultDTO(); - nldto.setIndexTotal(djList.get(i).getIndexTotal() + zlList.get(i).getIndexTotal() + fwList.get(i).getIndexTotal()); - nldto.setAgencyScore(djList.get(i).getAgencyScore() + zlList.get(i).getAgencyScore() + fwList.get(i).getAgencyScore()); - nldto.setSubAgencyScore(djList.get(i).getSubAgencyScore() + zlList.get(i).getSubAgencyScore() + fwList.get(i).getSubAgencyScore()); - nldto.setMonthId(djList.get(i).getMonthId()); - nlList.add(nldto); + String monthId = list.get(0).getMonthId(); + Double dl = 0.0; + for (AblityIndexResultDTO.ScoreListResultDTO l : list) { + if (l.getMonthId().equals(monthId)) { + dl += l.getIndexTotal(); + } else { + AblityIndexResultDTO.ScoreListResultDTO nldto = new AblityIndexResultDTO.ScoreListResultDTO(); + double num1 = new BigDecimal(dl).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue(); + nldto.setIndexTotal(num1); + nldto.setMonthId(monthId); + nlList.add(nldto); + monthId = l.getMonthId(); + dl = l.getIndexTotal(); + } + if (FactConstant.DJNL.equals(l.getIndexCode())) { + djList.add(l); + } else if (FactConstant.ZLNL.equals(l.getIndexCode())) { + zlList.add(l); + } else if (FactConstant.FWNL.equals(l.getIndexCode())) { + fwList.add(l); + } } - //5.封装数据并返回 + //把最后一个月的能力指标数据放入集合 + AblityIndexResultDTO.ScoreListResultDTO nldto = new AblityIndexResultDTO.ScoreListResultDTO(); + double num1 = new BigDecimal(dl).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue(); + nldto.setIndexTotal(num1); + nldto.setMonthId(monthId); + nlList.add(nldto); + + //7.封装数据并返回 AblityIndexResultDTO nl = new AblityIndexResultDTO(); nl.setIndexCode(FactConstant.NLZB); - nl.setScoreList(djList); - resultDTO.add(nl); + nl.setScoreList(nlList); + if (null != nlList) { + resultList.add(nl); + } AblityIndexResultDTO dj = new AblityIndexResultDTO(); dj.setIndexCode(FactConstant.DJNL); dj.setScoreList(djList); - resultDTO.add(dj); + if (null != djList) { + resultList.add(dj); + } AblityIndexResultDTO zl = new AblityIndexResultDTO(); zl.setIndexCode(FactConstant.ZLNL); - zl.setScoreList(djList); - resultDTO.add(zl); + zl.setScoreList(zlList); + if (null != zlList) { + resultList.add(zl); + } AblityIndexResultDTO fw = new AblityIndexResultDTO(); fw.setIndexCode(FactConstant.FWNL); - fw.setScoreList(djList); - resultDTO.add(fw); + fw.setScoreList(fwList); + if (null != fwList) { + resultList.add(fw); + } - return resultDTO; + return resultList; } /** @@ -95,13 +166,39 @@ public class FactIndexServiceImpl implements FactIndexService { */ @Override public List scoreList(ScoreListFormDTO formDTO) { - //1.查询当前组织某一月份党建能力对应的总分、本级分、下级分 - formDTO.setIndexCode(FactConstant.DJNL); - ScoreListResultDTO dj = factIndexAgencyScoreDao.selectScore(formDTO); - //2.查询当前组织某一月份治理能力对应的总分、本级分、下级分 - //3.查询当前组织某一月份服务能力对应的总分、本级分、下级分 + List resultList = new LinkedList<>(); + //1.根据类型判断是查询组织数据还是网格数据 + //组织层级数据 + if (FactConstant.AGENCY.equals(formDTO.getOrgType())) { + //2.根据组织Id查询组织信息 + CompartmentResultDTO agency = screenCustomerAgencyDao.getAgencyAreaInfo(formDTO.getOrgId()); + if (null == agency) { + //throw new RenException(String.format("根据组织Id未查询到组织信息,组织Id:%s", formDTO.getOrgId())); + return resultList; + } + //3.根据组织级别判断查询哪类数据表 + //区县级、乡镇街道级 + if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) { + //3-1.查询当前组织某一月份党建能力、治理能力、服务能力对应的总分、本级分、下级分 + resultList = factIndexAgencyScoreDao.selectScoreList(formDTO); + //社区级 + } else if ("community".equals(agency.getLevel())) { + //3-1.查询当前组织某一月份党建能力、治理能力、服务能力对应的总分、本级分、下级分 + resultList = factIndexCommunityScoreDao.selectCommunityScoreList(formDTO); + } else { + //throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getOrgId())); + return resultList; + } + + //4.网格层级数据 + } else if (FactConstant.GRID.equals(formDTO.getOrgType())) { + //4-1.查询当前组织某一月份党建能力、治理能力、服务能力对应的总分、本级分、下级分 + resultList = factIndexGridScoreDao.selectGridScoreList(formDTO); + } else { + throw new RenException(String.format("按月份查询各项能力分数,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType())); + } - return null; + return resultList; } /** @@ -111,7 +208,74 @@ public class FactIndexServiceImpl implements FactIndexService { */ @Override public List monthScoreList(MonthScoreListFormDTO formDTO) { - return null; + LinkedList resultList = new LinkedList<>(); + LinkedList list = new LinkedList<>(); + LinkedList djList = new LinkedList<>(); + LinkedList zlList = new LinkedList<>(); + LinkedList fwList = new LinkedList<>(); + //1.计算所查月份前12个月的monthId + formDTO.setStartMonthId(getDate(formDTO.getMonthId())); + //2.根据类型判断是查询组织数据还是网格数据 + //组织层级数据 + if (FactConstant.AGENCY.equals(formDTO.getOrgType())) { + //3.根据组织Id查询组织信息 + CompartmentResultDTO agency = screenCustomerAgencyDao.getAgencyAreaInfo(formDTO.getOrgId()); + if (null == agency) { + //throw new RenException(String.format("根据组织Id未查询到组织信息,组织Id:%s", formDTO.getOrgId())); + return resultList; + } + //4.根据组织级别判断查询哪类数据表 + //区县级、乡镇街道级 + if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) { + //4-1.查询过去12个月党建能力、治理能力、服务能力每月总分、本级得分、下级得分数据 + list = factIndexAgencyScoreDao.selectMonthScoreList(formDTO); + + //社区级 + } else if ("community".equals(agency.getLevel())) { + //4-1.查询过去12个月党建能力、治理能力、服务能力每月总分、本级得分、下级得分数据 + list = factIndexCommunityScoreDao.selectCommunityMonthScoreList(formDTO); + } else { + //throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getOrgId())); + return resultList; + } + //网格层级数据 + } else if (FactConstant.GRID.equals(formDTO.getOrgType())) { + //5.查询网格过去12个月党建能力、治理能力、服务能力每月总分、本级得分、下级得分数据 + list = factIndexGridScoreDao.selectGridMonthScoreList(formDTO); + } else { + throw new RenException(String.format("能力指数查询,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType())); + } + + //5.封装数据并返回 + for (MonthScoreListResultDTO.ScoreListResultDTO l : list) { + if (FactConstant.DJNL.equals(l.getIndexCode())) { + djList.add(l); + } else if (FactConstant.ZLNL.equals(l.getIndexCode())) { + zlList.add(l); + } else if (FactConstant.FWNL.equals(l.getIndexCode())) { + fwList.add(l); + } + } + MonthScoreListResultDTO dj = new MonthScoreListResultDTO(); + dj.setIndexCode(FactConstant.DJNL); + dj.setScoreList(djList); + if (null != djList) { + resultList.add(dj); + } + MonthScoreListResultDTO zl = new MonthScoreListResultDTO(); + zl.setIndexCode(FactConstant.ZLNL); + zl.setScoreList(zlList); + if (null != zlList) { + resultList.add(zl); + } + MonthScoreListResultDTO fw = new MonthScoreListResultDTO(); + fw.setIndexCode(FactConstant.FWNL); + fw.setScoreList(fwList); + if (null != fwList) { + resultList.add(fw); + } + + return resultList; } /** @@ -122,30 +286,61 @@ public class FactIndexServiceImpl implements FactIndexService { @Override public List 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()); + //1.根据类型判断是查询组织数据还是网格数据 + //组织层级数据 + if (FactConstant.AGENCY.equals(formDTO.getOrgType())) { + //2.根据组织Id查询组织信息 + CompartmentResultDTO agency = screenCustomerAgencyDao.getAgencyAreaInfo(formDTO.getOrgId()); + if (null == agency) { + //throw new RenException(String.format("根据组织Id未查询到组织信息,组织Id:%s", formDTO.getOrgId())); + return resultList; } - resultList = factIndexAgencySubScoreDao.selectAblityList(formDTO); + //3.根据组织级别拼接查询条件,判断查询不同数据表 + //区县级、乡镇街道级 + if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) { + if ("district".equals(agency.getLevel())) { + formDTO.setAllParentIndexCode(FactConstant.QUAN_QU_XIANG_GUAN + ":" + formDTO.getIndexCode()); + } else { + formDTO.setAllParentIndexCode(FactConstant.JIE_DAO_XIANG_GUAN + ":" + formDTO.getIndexCode()); + } + resultList = factIndexAgencySubScoreDao.selectAblityList(formDTO); - //社区级 - } else if ("community".equals(agency.getLevel())) { - formDTO.setAllParentIndexCode(FactConstant.SHE_QU_XIANG_GUAN + ":" + formDTO.getIndexCode()); - resultList = factIndexCommunitySubScoreDao.selectCommunityAblityList(formDTO); + //社区级 + } else if ("community".equals(agency.getLevel())) { + formDTO.setAllParentIndexCode(FactConstant.SHE_QU_XIANG_GUAN + ":" + formDTO.getIndexCode()); + resultList = factIndexCommunitySubScoreDao.selectCommunityAblityList(formDTO); + } else { + //throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getOrgId())); + return resultList; + } + //网格层级数据 + } else if (FactConstant.GRID.equals(formDTO.getOrgType())) { + //4.查询网格层级各项能力对应指标数据 + formDTO.setAllParentIndexCode(FactConstant.WANG_GE_XIANG_GUAN + ":" + formDTO.getIndexCode()); + resultList = factIndexGridSubScoreDao.selectGridAblityList(formDTO); } else { - throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getAgencyId())); + throw new RenException(String.format("按月查询各项指标数据,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType())); } - //3.调用方法判断各项指标是数字指标还是百分比指标 //TODO + + //4.查询指标字典表数据 + List list = indexDictDao.selectList(); + //5.遍历数据,判断数据类型并处理 + resultList.forEach(result -> { + list.stream().filter(dto -> dto.getIndexCode().equals(result.getKey())).forEach(l -> { + result.setShowType(l.getValueType()); + //小数类型,四舍五入保留小数点后一位 + if (FactConstant.DECIMAL.equals(l.getValueType())) { + BigDecimal num = new BigDecimal(result.getValue()).setScale(1, BigDecimal.ROUND_HALF_UP); + result.setValue(num.toString()); + } + //百分数类型,四舍五入保留小数点后一位并转成百分比 + if (FactConstant.PERCENT.equals(l.getValueType())) { + BigDecimal num = new BigDecimal(result.getValue()).setScale(1, BigDecimal.ROUND_HALF_UP); + result.setValue(num + "%"); + } + }); + }); + return resultList; } @@ -159,28 +354,61 @@ public class FactIndexServiceImpl implements FactIndexService { LinkedList resultList = new LinkedList<>(); //1.计算所查月份前12个月的monthId formDTO.setStartMonthId(getDate(formDTO.getMonthId())); - //2.根据组织Id查询组织信息 - CompartmentResultDTO agency = screenCustomerAgencyDao.getAgencyAreaInfo(formDTO.getAgencyId()); - if (null == agency) { - throw new RenException(String.format("查询到组织信息失败,组织Id:%s", formDTO.getAgencyId())); + //2.根据类型判断是查询组织数据还是网格数据 + //组织层级数据 + if (FactConstant.AGENCY.equals(formDTO.getOrgType())) { + //3.根据组织Id查询组织信息 + CompartmentResultDTO agency = screenCustomerAgencyDao.getAgencyAreaInfo(formDTO.getOrgId()); + if (null == agency) { + //throw new RenException(String.format("查询组织信息失败,组织Id:%s", formDTO.getOrgId())); + return resultList; + } + //4.根据组织级别拼接查询条件,判断查询不同数据表 + //区县级、乡镇街道级 + if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) { + resultList = factIndexAgencySubScoreDao.selectMonthAblityList(formDTO); + //社区级 + } else if ("community".equals(agency.getLevel())) { + resultList = factIndexCommunitySubScoreDao.selectCommunityMonthAblityList(formDTO); + } else { + //throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getOrgId())); + return resultList; + } + //网格层级数据 + } else if (FactConstant.GRID.equals(formDTO.getOrgType())) { + //5.查询网格层级某项能力对应的一项指标过去12个月份数据 + resultList = factIndexGridSubScoreDao.selectGridMonthAblityList(formDTO); + } else { + throw new RenException(String.format("按月查询各项指标最近12个月数据,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType())); } - //3.根据组织级别拼接查询条件,判断查询不同数据表 - //区县级、乡镇街道级 - if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) { - resultList = factIndexAgencySubScoreDao.selectMonthAblityList(formDTO); + //6.查询指标字典表具体数据 + IndexDictResultDTO dictDTO = indexDictDao.selectIndexDict(formDTO.getKey()); + if (null == dictDTO) { + throw new RenException(String.format("根据评价指标indexCode未查询到字典表数据,indexCode值:%s", formDTO.getKey())); + } - //社区级 - } else if ("community".equals(agency.getLevel())) { - resultList = factIndexCommunitySubScoreDao.selectCommunityMonthAblityList(formDTO); - } else { - throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getAgencyId())); + //7.遍历数据,判断数据类型并处理 + //小数或百分数类型,四舍五入保留小数点后一位 + if (FactConstant.DECIMAL.equals(dictDTO.getValueType()) || FactConstant.PERCENT.equals(dictDTO.getValueType())) { + resultList.forEach(result -> { + BigDecimal num = new BigDecimal(result.getAblity()).setScale(1, BigDecimal.ROUND_HALF_UP); + result.setAblity(num.toString()); + }); } - //3.调用方法判断各项指标是数字指标还是百分比指标//TODO + return resultList; } + /** + * @param newDate + * @Description 计算monthId对应一年前的monthId + * @author sun + */ public String getDate(String newDate) { + if (!validDateEffecitive(newDate)) { + throw new RenException(String.format("monthId格式错误,monthId:%s", newDate)); + } String date = ""; SimpleDateFormat sdf = new SimpleDateFormat("yyyymm"); try { @@ -194,14 +422,41 @@ public class FactIndexServiceImpl implements FactIndexService { return date; } + /** + * @param newDate + * @Description 校验日期格式是否正确 + * @author sun + */ + public boolean validDateEffecitive(String newDate) { + //yyyy-MM-dd格式 + //String DATE_REGEX = "^([1-9]\\d{3}-)(([0]{0,1}[1-9]-)|([1][0-2]-))(([0-3]{0,1}[0-9]))$"; + //yyyymm格式 + String DATE_REGEX = "^([1-9]\\d{3})(([0]{0,1}[1-9])|([1][0-2]))$"; + boolean matches = Pattern.matches(DATE_REGEX, newDate); + if (!matches) { + return matches; + } + SimpleDateFormat sdf = new SimpleDateFormat("yyyymm"); + //设置日期格式转的严谨性 + sdf.setLenient(false); + try { + sdf.parse(newDate); + } catch (ParseException e) { + e.printStackTrace(); + return false; + } + return matches; + } + /** * @param formDTO * @Description 同级对比各项数据查询 * @author sun */ @Override + @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) public List peerComparison(PeerComparisonFormDTO formDTO) { - //1.根据组织Id的上级组织Id查询同级组织对应类型的得分排名(查询最近一个月数据) + //1.根据组织或网格Id的上级组织Id查询同级组织或网格对应类型的得分排名(查询最近一个月数据) List resultList = screenIndexDataMonthlyDao.selectScoreList(formDTO); return resultList; } @@ -212,6 +467,7 @@ public class FactIndexServiceImpl implements FactIndexService { * @author sun */ @Override + @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) public RootAgencyResultDTO rootAgency(RootAgencyFormDTO formDTO) { RootAgencyResultDTO resultDTO = new RootAgencyResultDTO(); //1.根据agencyId查询是否为根级组织 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 index 4ecea63f0a..484abef720 100644 --- 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 @@ -3,8 +3,66 @@ - + SELECT + fact.month_id AS "monthId", + ROUND(fact.score, 1) AS "indexTotal", + fact.index_code AS "indexCode" + FROM + fact_index_agency_score fact + WHERE + fact.del_flag = '0' + AND fact.is_total = '0' + AND fact.customer_id = #{customerId} + AND fact.agency_id = #{orgId} + AND fact.month_id > #{startMonthId} + AND fact.month_id <= #{monthId} + ORDER BY + fact.month_id ASC + + + + 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 index db62b6c918..9744157016 100644 --- 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 @@ -16,7 +16,7 @@ AND dict.del_flag = '0' AND fact.all_parent_index_code = #{allParentIndexCode} AND customer_id = #{customerId} - AND agency_id = #{agencyId} + AND agency_id = #{orgId} AND month_id = #{monthId} @@ -31,7 +31,7 @@ fact.del_flag = '0' AND dict.del_flag = '0' AND customer_id = #{customerId} - AND agency_id = #{agencyId} + AND agency_id = #{orgId} AND month_id <= #{monthId} AND month_id > #{startMonthId} AND fact.index_code = #{key} 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..a2a4e89303 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunityScoreDao.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + 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 index 324fbb8a13..197b6f9bf9 100644 --- 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 @@ -16,7 +16,7 @@ AND dict.del_flag = '0' AND fact.all_parent_index_code = #{allParentIndexCode} AND customer_id = #{customerId} - AND agency_id = #{agencyId} + AND agency_id = #{orgId} AND month_id = #{monthId} @@ -31,7 +31,7 @@ fact.del_flag = '0' AND dict.del_flag = '0' AND customer_id = #{customerId} - AND agency_id = #{agencyId} + AND agency_id = #{orgId} AND month_id <= #{monthId} AND month_id > #{startMonthId} AND fact.index_code = #{key} 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..65e511d43e --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridScoreDao.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + 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..1b317e2791 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml @@ -0,0 +1,42 @@ + + + + + + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/IndexDictDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/IndexDictDao.xml new file mode 100644 index 0000000000..fffd0604bf --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/IndexDictDao.xml @@ -0,0 +1,30 @@ + + + + + + + + + + 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 932149d9c5..969bcea847 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 @@ -16,6 +16,7 @@ WHERE del_flag = 0 AND pid = '0' + AND IS_DISPLAY = '1' AND customer_id = #{customerId} @@ -31,6 +32,7 @@ screen_customer_agency WHERE del_flag = '0' + AND IS_DISPLAY = '1' AND pids = #{subAgencyPids} ORDER BY created_time DESC diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml index 6cafd96036..b17fe0f6a8 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml @@ -77,6 +77,7 @@ screen_customer_grid WHERE del_flag = '0' + AND IS_DISPLAY = '1' AND parent_agency_id = #{agencyId} ORDER BY created_time DESC 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 d244c92906..3b655a6481 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,30 @@ 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 = #{orgType,jdbcType=VARCHAR} + + + AND ORG_TYPE != 'department' + + ORDER BY index_total ASC @@ -108,22 +117,22 @@ + + + + + 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..5b445202d5 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 @@ -13,26 +13,34 @@ screen_index_data_yearly WHERE del_flag = '0' - AND org_type = 'agency' AND org_id = #{agencyId} AND year_id = DATE_FORMAT(NOW(),'%Y') - + + + + + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml index cbbc5fe211..0bbd2d41d0 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml @@ -7,7 +7,7 @@ + SELECT + GRID_ID, + COUNT( ID ) AS partyCreateGroupCount + FROM + fact_origin_group_main_daily + WHERE + DEL_FLAG = '0' + AND CUSTOMER_ID = #{customerId} + AND MONTH_ID = #{monthId} + GROUP BY GRID_ID + + + + + + + + + DELETE FROM + fact_origin_group_main_daily + WHERE + CUSTOMER_ID = #{customerId} + + + + + + DELETE FROM + fact_origin_group_member_daily + WHERE + CUSTOMER_ID = #{customerId} + + + + AND MONTH_ID = #{dimId} + + + AND DATE_ID = #{dimId} + + + + + + + DELETE FROM + fact_origin_group_main_daily + + CUSTOMER_ID = #{customerId} + + ID = #{groupId} + + + + + + UPDATE fact_origin_group_main_daily + SET IS_OWNER_PARTY = 1 + + DEL_FLAG = '0' + AND CUSTOMER_ID = #{customerId} + + GROUP_OWNER_ID = #{ownerId} + + + + + + UPDATE fact_origin_group_main_daily + SET IS_OWNER_HEARTED = 1 + + DEL_FLAG = '0' + AND CUSTOMER_ID = #{customerId} + + (GROUP_OWNER_ID = #{item.userId} AND GRID_ID = #{item.gridId}) + + + + + + INSERT INTO fact_origin_group_main_daily + ( + + id, + customer_id, + group_state, + grid_id, + agency_id, + parent_id, + pids, + date_id, + week_id, + month_id, + quarter_id, + year_id, + resi_member_count, + member_total, + group_owner_id, + is_owner_hearted, + is_owner_party, + del_flag, + revision, + created_by, + created_time, + updated_by, + updated_time + )VALUES + + ( + #{item.id}, + #{item.customerId}, + #{item.groupState}, + #{item.gridId}, + #{item.agencyId}, + #{item.parentId}, + #{item.pids}, + #{item.dateId}, + #{item.weekId}, + #{item.monthId}, + #{item.quarterId}, + #{item.yearId}, + 0, + #{item.memberTotal}, + #{item.groupOwnerId}, + + + 0, + + + #{item.isOwnerHearted}, + + + + + + 0, + + + #{item.isOwnerParty}, + + + + '0', + 0, + 'CRAWLER_ROBOT', + now(), + 'CRAWLER_ROBOT', + now() + + ) + + + + + + INSERT INTO fact_origin_group_member_daily + ( + id, + group_id, + grid_id, + agency_id, + parent_id, + pids, + member_id, + customer_id, + leader_flag, + date_id, + week_id, + month_id, + quarter_id, + year_id, + action_code, + revision, + del_flag, + created_by, + created_time, + updated_by, + updated_time + )VALUES + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.groupId}, + #{item.gridId}, + #{item.agencyId}, + #{item.parentId}, + #{item.pids}, + #{item.memberId}, + #{item.customerId}, + #{item.leaderFlag}, + #{item.dateId}, + #{item.weekId}, + #{item.monthId}, + #{item.quarterId}, + #{item.yearId}, + #{item.actionCode}, + '0', + 0, + 'CRAWLER_ROBOT', + now(), + 'CRAWLER_ROBOT', + now() + ) + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml new file mode 100644 index 0000000000..d54794d323 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml @@ -0,0 +1,156 @@ + + + + + + + + INSERT INTO fact_origin_issue_log_daily ( + ID, + CUSTOMER_ID, + GRID_ID, + PID, + PIDS, + AGENCY_ID, + DATE_ID, + WEEK_ID, + MONTH_ID, + QUARTER_ID, + YEAR_ID, + ISSUE_ID, + OPERATION_USER_ID, + ACTION_CODE, + IS_PARTY, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME) + VALUES + + ( + REPLACE ( UUID(), '-', '' ), + #{item.customerId}, + #{item.gridId}, + #{item.pid}, + #{item.pids}, + #{item.agencyId}, + #{item.dateId}, + #{item.weekId}, + #{item.monthId}, + #{item.quarterId}, + #{item.yearId}, + #{item.issueId}, + #{item.operationUserId}, + #{item.actionCode}, + #{item.isParty}, + #{item.delFlag}, + #{item.revision}, + #{item.createdBy}, + NOW(), + #{item.updatedBy}, + NOW() + ) + + + + + + DELETE + FROM + fact_origin_issue_log_daily + WHERE + CUSTOMER_ID = #{customerId} + AND DATE_ID = #{dateId} + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml new file mode 100644 index 0000000000..42949df17b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml @@ -0,0 +1,294 @@ + + + + + + + + INSERT INTO fact_origin_issue_main_daily( + ID, + DATE_ID, + WEEK_ID, + MONTH_ID, + QUARTER_ID, + YEAR_ID, + CUSTOMER_ID, + IS_PARTY, + USER_ID, + CREATE_TOPIC_USER_ID, + TOPIC_ID, + GRID_ID, + PID, + PIDS, + AGENCY_ID, + ISSUE_STATUS, + RESOLVE_TYPE, + TOPIC_USER_IS_PARTY, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME) + VALUES + + ( + #{item.id}, + #{item.dateId}, + #{item.weekId}, + #{item.monthId}, + #{item.quarterId}, + #{item.yearId}, + #{item.customerId}, + #{item.isParty}, + #{item.userId}, + #{item.createTopicUserId}, + #{item.topicId}, + #{item.gridId}, + #{item.pid}, + #{item.pids}, + #{item.agencyId}, + #{item.issueStatus}, + #{item.resolveType}, + #{item.topicUserIsParty}, + #{item.delFlag}, + #{item.revision}, + #{item.createdBy}, + NOW(), + #{item.updatedBy}, + NOW() + ) + + + + + + update fact_origin_issue_main_daily + set ISSUE_STATUS = #{status} + where id = #{issueId} + + + + + DELETE + FROM + fact_origin_issue_main_daily + WHERE + CUSTOMER_ID = #{customerId} + AND DATE_ID = #{dateId} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml new file mode 100644 index 0000000000..9daf39ba7a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml @@ -0,0 +1,320 @@ + + + + + + DELETE FROM + fact_origin_project_log_daily + WHERE + CUSTOMER_ID = #{customerId} + + AND DATE_ID = #{date} + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml new file mode 100644 index 0000000000..2b64effbfd --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml @@ -0,0 +1,430 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DELETE FROM + fact_origin_project_main_daily + WHERE + CUSTOMER_ID = #{customerId} + + AND DATE_ID = #{date} + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml new file mode 100644 index 0000000000..0c1010e48c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DELETE FROM + fact_origin_project_org_period_daily + WHERE + DEL_FLAG = '0' + + PROJECT_ID = #{item} + + + + + + + + insert into fact_origin_project_org_period_daily + ( + id, + customer_id, + project_id, + org_id, + org_type, + pid, + pids, + informed_date, + handled_date, + total_period, + period_till_reply_firstly, + is_resolved, + operation, + del_flag, + revision, + created_time, + created_by, + updated_time, + updated_by + )values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.projectId}, + #{item.orgId}, + #{item.orgType}, + + 0, + #{item.pid}, + + #{item.pids}, + #{item.informedDate}, + #{item.handledDate}, + #{item.totalPeriod}, + #{item.periodTillReplyFirstly}, + #{item.isResolved}, + #{item.operation}, + '0', + 0, + now(), + 'CRAWLER_ROBOT', + now(), + 'CRAWLER_ROBOT' + ) + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicLogDailyDao.xml new file mode 100644 index 0000000000..1d7bc88cab --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicLogDailyDao.xml @@ -0,0 +1,146 @@ + + + + + + DELETE + FROM + fact_origin_topic_log_daily + WHERE + CUSTOMER_ID = #{customerId} + AND DATE_ID = #{dateId} + LIMIT #{deleteSize} + + + + insert into fact_origin_topic_log_daily + ( + ID, + CUSTOMER_ID, + GRID_ID, + AGENCY_ID, + PID, + DATE_ID, + WEEK_ID, + MONTH_ID, + QUARTER_ID, + YEAR_ID, + TOPIC_ID, + GROUP_ID, + ACTION_CODE, + OPERATE_USER_ID, + OPERATE_USER_IS_PARTY, + ORIGINAL_BUSINESS_TIME, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME, + PIDS + ) values + + ( + #{item.id}, + #{item.customerId}, + #{item.gridId}, + #{item.agencyId}, + #{item.pid}, + #{item.dateId}, + #{item.weekId}, + #{item.monthId}, + #{item.quarterId}, + #{item.yearId}, + #{item.topicId}, + #{item.groupId}, + #{item.actionCode}, + #{item.operateUserId}, + #{item.operateUserIsParty}, + #{item.originalBusinessTime}, + 0, + 0, + 'APP_USER', + now(), + 'APP_USER', + now(), + #{item.pids} + ) + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml new file mode 100644 index 0000000000..a4f2d9bbaa --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml @@ -0,0 +1,180 @@ + + + + + + + DELETE + FROM + fact_origin_topic_main_daily + WHERE + CUSTOMER_ID = #{customerId} + AND DATE_ID = #{dateId} + LIMIT #{deleteSize} + + + + insert into fact_origin_topic_main_daily + ( + ID, + CUSTOMER_ID, + GRID_ID, + AGENCY_ID, + PID, + DATE_ID, + WEEK_ID, + MONTH_ID, + QUARTER_ID, + YEAR_ID, + GROUP_ID, + TOPIC_STATUS, + CREATE_TOPIC_USER_ID, + CREATE_TOPIC_USER_IS_PARTY, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME, + PIDS, + CLOSED_STATUS + ) values + + ( + #{item.id}, + #{item.customerId}, + #{item.gridId}, + #{item.agencyId}, + #{item.pid}, + #{item.dateId}, + #{item.weekId}, + #{item.monthId}, + #{item.quarterId}, + #{item.yearId}, + #{item.groupId}, + #{item.topicStatus}, + #{item.createTopicUserId}, + #{item.createTopicUserIsParty}, + 0, + 0, + 'APP_USER', + now(), + 'APP_USER', + now(), + #{item.pids}, + #{item.closedStatus} + ) + + + + + + + + + + + + + + + + update fact_origin_topic_main_daily + set TOPIC_STATUS=#{topicStatus}, + CLOSED_STATUS=#{closedStatus}, + UPDATED_TIME=NOW() + where id = #{topicId} + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml index 65922677e5..9de83a3a9a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml @@ -101,13 +101,15 @@ PARENT_AGENCY_ID AS parentId FROM fact_index_agency_score fics + LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = fics.PARENT_AGENCY_ID WHERE fics.del_flag = '0' - AND fics.customer_id = #{customerId} - AND fics.month_id = #{monthId} - AND fics.index_code = #{indexCode} + AND sca.level = 'district' + AND fics.customer_id = #{customerId} + AND fics.month_id = #{monthId} + AND fics.index_code = #{indexCode} AND fics.DATA_TYPE = #{dataType} - GROUP BY fics.parent_agency_id + GROUP BY fics.parent_agency_id diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencySelfSubScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencySelfSubScoreDao.xml new file mode 100644 index 0000000000..4504a7fe6c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencySelfSubScoreDao.xml @@ -0,0 +1,46 @@ + + + + + + + delete from fact_index_agency_self_sub_score + where CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} + and DATA_TYPE = #{dataType,jdbcType=VARCHAR} + and MONTH_ID = #{monthId,jdbcType=VARCHAR} + and PARENT_INDEX_CODE = #{parentIndexCode,jdbcType=VARCHAR} + limit 1000 + + + + INSERT INTO fact_index_agency_self_sub_score + (ID, CUSTOMER_ID, AGENCY_ID, PARENT_AGENCY_ID, YEAR_ID, QUARTER_ID, MONTH_ID, + DATA_TYPE, SELF_SCORE, SUB_SCORE, PARENT_INDEX_CODE,ALL_PARENT_INDEX_CODE, + SELF_WEIGHT,SUB_WEIGHT,DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + VALUES + + ( + REPLACE ( UUID(), '-', '' ), + #{item.customerId}, + #{item.agencyId}, + #{item.parentAgencyId}, + #{item.yearId}, + #{item.quarterId}, + #{item.monthId}, + #{item.dataType}, + #{item.selfScore}, + #{item.subScore}, + #{item.parentIndexCode}, + #{item.allParentIndexCode}, + #{item.selfWeight}, + #{item.subWeight}, + #{item.delFlag}, + #{item.revision}, + #{item.createdBy}, + NOW(), + #{item.updatedBy}, + NOW() + ) + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencySubScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencySubScoreDao.xml index 37b2450690..b142e7349d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencySubScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencySubScoreDao.xml @@ -5,7 +5,7 @@ - INSERT INTO fact_index_agency_sub_score (ID, CUSTOMER_ID, AGENCY_ID, PARENT_AGENCY_ID, YEAR_ID, QUARTER_ID, MONTH_ID, DATA_TYPE, SCORE, INDEX_CODE,ALL_PARENT_INDEX_CODE, + INSERT INTO fact_index_agency_sub_score (ID, CUSTOMER_ID, AGENCY_ID, PARENT_AGENCY_ID, YEAR_ID, QUARTER_ID, MONTH_ID, DATA_TYPE, ORIGIN_VALUE, SCORE, INDEX_CODE,ALL_PARENT_INDEX_CODE, WEIGHT,DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) VALUES @@ -18,6 +18,7 @@ #{item.quarterId}, #{item.monthId}, #{item.dataType}, + #{item.originValue}, #{item.score}, #{item.indexCode}, #{item.allParentIndexCode}, @@ -45,4 +46,16 @@ LIMIT #{delNum} + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunityScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunityScoreDao.xml index aca5ce3669..8be2f83314 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunityScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunityScoreDao.xml @@ -83,6 +83,7 @@ WHERE fics.del_flag = '0' AND sca.DEL_FLAG = 0 + AND sca.level = 'street' AND fics.customer_id = #{customerId} AND fics.month_id = #{monthId} AND fics.index_code = #{indexCode} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunitySelfSubScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunitySelfSubScoreDao.xml new file mode 100644 index 0000000000..f9fa8c6d9b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunitySelfSubScoreDao.xml @@ -0,0 +1,61 @@ + + + + + + + delete from fact_index_community_self_sub_score + where CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} + AND MONTH_ID = #{monthId,jdbcType=VARCHAR} + AND PARENT_INDEX_CODE = #{parentIndexCode,jdbcType=VARCHAR} + limit 1000 + + + + INSERT INTO `fact_index_community_self_sub_score` ( + `ID`, + `CUSTOMER_ID`, + `AGENCY_ID`, + `PARENT_AGENCY_ID`, + `QUARTER_ID`, + `YEAR_ID`, + `MONTH_ID`, + `SELF_SCORE`, + `SUB_SCORE`, + `PARENT_INDEX_CODE`, + `ALL_PARENT_INDEX_CODE`, + `SELF_WEIGHT`, + `SUB_WEIGHT`, + `DEL_FLAG`, + `REVISION`, + `CREATED_BY`, + `CREATED_TIME`, + `UPDATED_BY`, + `UPDATED_TIME` + ) + VALUES + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.agencyId}, + #{item.parentAgencyId}, + #{item.quarterId}, + #{item.yearId}, + #{item.monthId}, + #{item.selfScore}, + #{item.subScore}, + #{item.parentIndexCode}, + #{item.allParentIndexCode}, + #{item.selfWeight}, + #{item.subWeight}, + 0, + 0, + 'APP_USER', + now(), + 'APP_USER', + now() + ) + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunitySubScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunitySubScoreDao.xml index bdf1146ae7..d3e94036f2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunitySubScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunitySubScoreDao.xml @@ -5,7 +5,7 @@ - INSERT INTO fact_index_community_sub_score ( ID, CUSTOMER_ID, AGENCY_ID, PARENT_AGENCY_ID, YEAR_ID, QUARTER_ID, MONTH_ID, SCORE, INDEX_CODE,ALL_PARENT_INDEX_CODE, + INSERT INTO fact_index_community_sub_score ( ID, CUSTOMER_ID, AGENCY_ID, PARENT_AGENCY_ID, YEAR_ID, QUARTER_ID, MONTH_ID, ORIGIN_VALUE, SCORE, INDEX_CODE,ALL_PARENT_INDEX_CODE, WEIGHT,DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) VALUES @@ -17,6 +17,7 @@ #{item.yearId}, #{item.quarterId}, #{item.monthId}, + #{item.originValue}, #{item.score}, #{item.indexCode}, #{item.allParentIndexCode}, @@ -43,4 +44,16 @@ LIMIT #{delNum} + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcScoreDao.xml index 8fbb50a81d..bf0cfd3d51 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcScoreDao.xml @@ -148,4 +148,18 @@ ) + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcSubScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcSubScoreDao.xml index 848323447a..ac0154854f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcSubScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcSubScoreDao.xml @@ -14,24 +14,9 @@ - - - - - - - - - - - - - - - + SELECT + ID, + CUSTOMER_ID, + DEPT_ID, + AGENCY_ID, + QUARTER_ID, + YEAR_ID, + MONTH_ID, + ORIGIN_VALUE, + SCORE, + INDEX_CODE, + ALL_PARENT_INDEX_CODE, + WEIGHT + FROM + fact_index_dept_sub_score + WHERE + DEL_FLAG = '0' + AND CUSTOMER_ID = #{customerId} + AND ALL_PARENT_INDEX_CODE = #{allIndexCodePath,jdbcType=VARCHAR} + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/FactIndexAgencySelfSubScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/FactIndexAgencySelfSubScoreDao.xml new file mode 100644 index 0000000000..0fd2472f7e --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/FactIndexAgencySelfSubScoreDao.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridScoreDao.xml index 499f3349f4..7f3912fa6f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridScoreDao.xml @@ -110,8 +110,8 @@ m.YEAR_ID, m.MONTH_ID, m.IS_TOTAL, - M.SCORE, - M.INDEX_CODE + m.SCORE, + m.INDEX_CODE FROM fact_index_grid_score m WHERE @@ -135,10 +135,11 @@ sca.pid AS parentId FROM fact_index_grid_score figc - LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = figc.AGENCY_ID + LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = figc.AGENCY_ID WHERE figc.del_flag = '0' AND sca.DEL_FLAG = 0 + AND sca.level = 'community' AND figc.customer_id = #{customerId} AND figc.month_id = #{monthId} AND figc.index_code = #{indexCode} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSelfSubScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSelfSubScoreDao.xml new file mode 100644 index 0000000000..cb7a33fc47 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSelfSubScoreDao.xml @@ -0,0 +1,58 @@ + + + + + + delete from fact_index_grid_self_sub_score where CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND MONTH_ID = #{monthId,jdbcType=VARCHAR} AND PARENT_INDEX_CODE = #{parentIndexCode,jdbcType=VARCHAR} limit 1000 + + + + INSERT INTO `fact_index_grid_self_sub_score` ( + `ID`, + `CUSTOMER_ID`, + `GRID_ID`, + `AGENCY_ID`, + `ALL_PARENT_IDS`, + `QUARTER_ID`, + `YEAR_ID`, + `MONTH_ID`, + `SELF_SCORE`, + `SUB_SCORE`, + `PARENT_INDEX_CODE`, + `ALL_PARENT_INDEX_CODE`, + `SELF_WEIGHT`, + `SUB_WEIGHT`, + `DEL_FLAG`, + `REVISION`, + `CREATED_BY`, + `CREATED_TIME`, + `UPDATED_BY`, + `UPDATED_TIME` + ) + VALUES + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.gridId}, + #{item.agencyId}, + #{item.allParentIds}, + #{item.quarterId}, + #{item.yearId}, + #{item.monthId}, + #{item.selfScore}, + #{item.subScore}, + #{item.parentIndexCode}, + #{item.allParentIndexCode}, + #{item.selfWeight}, + #{item.subWeight}, + 0, + 0, + 'APP_USER', + now(), + 'APP_USER', + now() + ) + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSubScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSubScoreDao.xml index 536f834564..63f4c618e4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSubScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSubScoreDao.xml @@ -14,6 +14,7 @@ `QUARTER_ID`, `YEAR_ID`, `MONTH_ID`, + `ORIGIN_VALUE`, `SCORE`, `INDEX_CODE`, ALL_PARENT_INDEX_CODE, @@ -36,6 +37,7 @@ #{item.quarterId}, #{item.yearId}, #{item.monthId}, + #{item.originValue}, #{item.score}, #{item.indexCode}, #{item.allParentIndexCode}, @@ -63,4 +65,27 @@ limit #{deleteSize} + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml index a84dff6a5c..e30d52c675 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml @@ -161,4 +161,106 @@ AND m.CUSTOMER_ID =#{customerId} AND m.MONTH_ID =#{monthId} + + + + + + + + + + + INSERT INTO fact_index_govrn_ablity_grid_monthly ( + ID, + CUSTOMER_ID, + AGENCY_ID, + GRID_ID, + MONTH_ID, + QUARTER_ID, + YEAR_ID, + ISSUE_TOTAL, + AVG_ISSUE_COUNT, + ISSUE_TO_PROJECT_RATIO, + PROJECT_TOTAL, + SELF_SOLVE_PROJECT_COUNT, + RESOLVE_PROJECT_COUNT, + TRANSFER_RIGHT_RATIO, + SATISFACTION_RATIO, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) + VALUES + + ( + REPLACE ( UUID(), '-', '' ), + #{item.customerId}, + #{item.agencyId}, + #{item.gridId}, + #{item.monthId}, + #{item.quarterId}, + #{item.yearId}, + #{item.issueTotal}, + #{item.avgIssueCount}, + #{item.issueToProjectRatio}, + #{item.projectTotal}, + #{item.selfSolveProjectCount}, + #{item.resolveProjectCount}, + #{item.transferRightRatio}, + #{item.satisfactionRatio}, + #{item.delFlag}, + #{item.revision}, + #{item.createdBy}, + NOW(), + #{item.updatedBy}, + NOW() + ) + + + + + + DELETE FROM fact_index_govrn_ablity_grid_monthly + WHERE CUSTOMER_ID = #{customerId} + AND MONTH_ID = #{monthId} + LIMIT 1000 + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml index eb9a582759..3a4250d1ad 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml @@ -33,6 +33,12 @@ AND MONTH_ID = #{monthId} limit 1000; + + delete from fact_index_govrn_ablity_org_monthly + where CUSTOMER_ID = #{customerId} + AND MONTH_ID = #{monthId} + AND DATA_TYPE = #{type} + insert into fact_index_govrn_ablity_org_monthly @@ -109,4 +115,18 @@ AND customer_id = #{customerId} AND month_id = #{monthId} + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml index 443d22edfa..788af38336 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml @@ -125,5 +125,63 @@ LIMIT #{offset},#{pageSize} - + + + insert into fact_index_party_ablity_cpc_monthly + ( + ID, + CUSTOMER_ID, + AGENCY_ID, + PARENT_ID, + GRID_ID, + MONTH_ID, + QUARTER_ID, + YEAR_ID, + CREATE_TOPIC_COUNT, + JOIN_TOPIC_COUNT, + SHIFT_ISSUE_COUNT, + SHIFT_PROJECT_COUNT, + JOIN_THREE_MEETS_COUNT, + GROUP_USER_COUNT, + GROUP_TOPIC_COUNT, + TOPIC_TO_ISSUE_RATIO, + GROUP_ACTIVE_USER_COUNT, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME, + USER_ID + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.agencyId}, + #{item.parentId}, + #{item.gridId}, + #{item.monthId}, + #{item.quarterId}, + #{item.yearId}, + #{item.createTopicCount}, + #{item.joinTopicCount}, + #{item.shiftIssueCount}, + #{item.shiftProjectCount}, + #{item.joinThreeMeetsCount}, + #{item.groupUserCount}, + #{item.groupTopicCount}, + #{item.topicToIssueRatio}, + #{item.groupActiveUserCount}, + 0, + 0, + 'APP_USER', + now(), + 'APP_USER', + now(), + #{item.userId} + ) + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityGridMonthlyDao.xml index 5f94b54fba..9208f9a533 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityGridMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityGridMonthlyDao.xml @@ -193,4 +193,78 @@ AND m.CUSTOMER_ID =#{customerId} AND m.MONTH_ID =#{monthId} + + + + INSERT INTO fact_index_party_ablity_grid_monthly ( + ID, + CUSTOMER_ID, + AGENCY_ID, + GRID_ID, + MONTH_ID, + QUARTER_ID, + YEAR_ID, + USER_COUNT, + PARTY_COUNT, + ACTIVE_USER_COUNT, + ACTIVE_PARTY_COUNT, + PARTY_AVG_TOPIC_COUNT, + USER_AVG_TOPIC_COUNT, + PARTY_AVG_SHIFT_PROJECT_COUNT, + USER_AVG_SHIFT_PROJECT_COUNT, + CREATE_GROUP_PARTY_COUNT, + PUBLISH_ARTICLE_COUNT, + ISSUE_TO_PROJECT_RATIO, + CREATE_THREE_MEETS_COUNT, + JOIN_THREE_MEETS_COUNT, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) + VALUES + + ( + REPLACE ( UUID(), '-', '' ), + #{item.customerId}, + #{item.agencyId}, + #{item.gridId}, + #{item.monthId}, + #{item.quarterId}, + #{item.yearId}, + #{item.userCount}, + #{item.partyCount}, + #{item.activeUserCount}, + #{item.activePartyCount}, + #{item.partyAvgTopicCount}, + #{item.userAvgTopicCount}, + #{item.partyAvgShiftProjectCount}, + #{item.userAvgShiftProjectCount}, + #{item.createGroupPartyCount}, + #{item.publishArticleCount}, + #{item.issueToProjectRatio}, + #{item.createThreeMeetsCount}, + #{item.joinThreeMeetsCount}, + #{item.delFlag}, + #{item.revision}, + #{item.createdBy}, + NOW(), + #{item.updatedBy}, + NOW() + ) + + + + + + DELETE + FROM + fact_index_party_ablity_grid_monthly + WHERE + CUSTOMER_ID = #{customerId} + AND MONTH_ID = #{monthId} + LIMIT 1000 + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml index 4aacf64da8..cf9146cc1f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml @@ -27,6 +27,12 @@ AND MONTH_ID = #{monthId} limit 1000; + + delete from fact_index_party_ablity_org_monthly + where CUSTOMER_ID = #{customerId} + AND MONTH_ID = #{monthId} + AND DATA_TYPE = #{type} + insert into fact_index_party_ablity_org_monthly diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexServiceAblityGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexServiceAblityGridMonthlyDao.xml index f3ec6462f2..2a4d8a7039 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexServiceAblityGridMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexServiceAblityGridMonthlyDao.xml @@ -132,4 +132,66 @@ AND m.CUSTOMER_ID =#{customerId} AND m.MONTH_ID =#{monthId} + + + + + + + insert into fact_index_service_ablity_grid_monthly + ( + ID, + CUSTOMER_ID, + AGENCY_ID, + GRID_ID, + MONTH_ID, + QUARTER_ID, + YEAR_ID, + ACTIVITY_COUNT, + VOLUNTEER_RATIO, + PARTY_VOLUNTEER_RATIO, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.agencyId}, + #{item.gridId}, + #{item.monthId}, + #{item.quarterId}, + #{item.yearId}, + #{item.activityCount}, + #{item.volunteerRatio}, + #{item.partyVolunteerRatio}, + 0, + 0, + 'APP_USER', + now(), + 'APP_USER', + now() + ) + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexServiceAblityOrgMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexServiceAblityOrgMonthlyDao.xml index e87e17874f..a72642ef9a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexServiceAblityOrgMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexServiceAblityOrgMonthlyDao.xml @@ -27,6 +27,12 @@ AND MONTH_ID = #{monthId} limit 1000; + + delete from fact_index_service_ablity_org_monthly + where CUSTOMER_ID = #{customerId} + AND MONTH_ID = #{monthId} + AND DATA_TYPE = #{type} + insert into fact_index_service_ablity_org_monthly diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDao.xml index 668ba89e2d..4f0c4d0c75 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDao.xml @@ -6,4 +6,8 @@ + + + delete from index_group where CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDetailDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDetailDao.xml index e3360e9ddf..d52791cbb4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDetailDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDetailDao.xml @@ -6,7 +6,7 @@ + select + ID,CUSTOMER_ID, INDEX_GROUP_ID, INDEX_ID, INDEX_CODE, WEIGHT, THRESHOLD, ALL_PARENT_INDEX_CODE, ALL_INDEX_CODE_PATH, CORRELATION + FROM index_group_detail + WHERE + CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} and STATUS = 'enable' and DEL_FLAG = '0' + and ALL_PARENT_INDEX_CODE like concat(#{allIndexCodePath,jdbcType=VARCHAR},'%') + + + + UPDATE index_group_detail + SET WEIGHT =#{weight},UPDATED_TIME=NOW() + WHERE + DEL_FLAG = '0' + AND CUSTOMER_ID = #{customerId} + AND INDEX_CODE = #{indexCode} + and ALL_PARENT_INDEX_CODE=#{allParentIndexCode} + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDetailTemplateDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDetailTemplateDao.xml index a8e5f55a2e..5769bd5818 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDetailTemplateDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDetailTemplateDao.xml @@ -7,7 +7,7 @@ delete from index_group_detail_template diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupTemplateDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupTemplateDao.xml index 92067e3247..e1fd380618 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupTemplateDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupTemplateDao.xml @@ -7,7 +7,7 @@ \ 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..9de96650b5 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,69 @@ limit 1000; + + + + + + insert into screen_cpc_base_data ( @@ -64,5 +127,74 @@ + + + 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} + + ) + LIMIT 1000 + 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 49ce41b17c..83a948ed38 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 @@ -81,7 +81,8 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml index 1533203d14..26c34d328b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml @@ -91,4 +91,76 @@ DEL_FLAG = '0' AND CUSTOMER_ID =#{customerId} + + + + + + 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 92486a3f10..9df4f5941f 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 @@ -126,11 +126,206 @@ SELECT GRID_ID gridId, GRID_NAME gridName, - PARENT_AGENCY_ID parentAgencyId + PARENT_AGENCY_ID parentAgencyId, + ALL_PARENT_IDS allParentIds FROM screen_customer_grid WHERE DEL_FLAG = '0' AND CUSTOMER_ID =#{customerId} + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenDifficultyDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenDifficultyDataDao.xml index 051f14cbcf..e27bfde00f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenDifficultyDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenDifficultyDataDao.xml @@ -70,4 +70,149 @@ + + + + + + + + UPDATE + screen_difficulty_data + SET + DATA_END_TIME = #{dateId} + WHERE + DEL_FLAG = '0' + AND + CUSTOMER_ID = #{customerId} + + + + + DELETE + FROM screen_difficulty_data + WHERE + CUSTOMER_ID = #{customerId} + + + EVENT_ID = #{projectId} + + + + + + DELETE + FROM screen_difficulty_img_data + + + EVENT_ID = #{projectId} + + + + + + insert into screen_difficulty_data + ( + ID, + CUSTOMER_ID, + ORG_TYPE, + ORG_ID, + PARENT_ID, + ORG_NAME, + EVENT_ID, + EVENT_IMG_URL, + EVENT_SOURCE, + EVENT_CONTENT, + EVENT_COST_TIME, + EVENT_RE_ORG, + EVENT_HANDLED_COUNT, + EVENT_CATEGORY_CODE, + EVENT_CATEGORY_NAME, + EVENT_STATUS_CODE, + EVENT_STATUS_DESC, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME, + LATEST_OPERATE_DESC, + DATA_END_TIME, + ALL_PARENT_IDS + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.orgType}, + #{item.orgId}, + #{item.parentId}, + #{item.orgName}, + #{item.eventId}, + #{item.eventImgUrl}, + #{item.eventSource}, + #{item.eventContent}, + #{item.eventCostTime}, + #{item.eventReOrg}, + #{item.eventHandledCount}, + #{item.eventCategoryCode}, + #{item.eventCategoryName}, + #{item.eventStatusCode}, + #{item.eventStatusDesc}, + 0, + 0, + 'CRAWLER_ROBOT', + now(), + 'CRAWLER_ROBOT', + now(), + #{item.latestOperateDesc}, + #{item.dataEndTime}, + #{item.allParentIds} + ) + + + + + + insert into screen_difficulty_img_data + ( + ID, + EVENT_ID, + EVENT_IMG_URL, + SORT, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.eventId}, + #{item.eventImgUrl}, + #{item.sort}, + 0, + 0, + 'CRAWLER_ROBOT', + now(), + 'CRAWLER_ROBOT', + now() + ) + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenGovernRankDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenGovernRankDataDao.xml index f569cb89a9..2b70609ca3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenGovernRankDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenGovernRankDataDao.xml @@ -8,6 +8,56 @@ where CUSTOMER_ID = #{customerId} AND MONTH_ID = #{monthId} limit 1000; + + delete from screen_govern_rank_data + where CUSTOMER_ID = #{customerId} + AND MONTH_ID = #{monthId} + + and ORG_TYPE=#{orgType} + + + and + ( + + ORG_ID = #{orgId} + + ) + + limit #{deleteSize} + + + insert into screen_govern_rank_data diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml index f192c1373c..91ecd0a870 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml @@ -19,6 +19,7 @@ ORG_TYPE, ORG_ID, PARENT_ID, + ALL_PARENT_IDS, ORG_NAME, INDEX_TOTAL, PARTY_DEV_ABLITY, @@ -43,6 +44,7 @@ #{item.orgType}, #{item.orgId}, #{item.parentId}, + #{item.allParentIds}, #{item.orgName}, #{item.indexTotal}, @@ -99,4 +101,10 @@ where CUSTOMER_ID = #{customerId} AND MONTH_ID = #{monthId} AND ORG_TYPE = #{orgType} limit 1000; + + + update screen_index_data_monthly m3 + SET m3.ALL_PARENT_IDS =#{allParentIds} + where m3.id=#{id} + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenOrgRankDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenOrgRankDataDao.xml index 2cf5f7dc33..8da6637ec1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenOrgRankDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenOrgRankDataDao.xml @@ -8,6 +8,66 @@ where CUSTOMER_ID = #{customerId} AND MONTH_ID = #{monthId} limit 1000; + + delete from screen_org_rank_data + where CUSTOMER_ID = #{customerId} + AND MONTH_ID = #{monthId} + + and ORG_TYPE=#{orgType} + + + and + ( + + ORG_ID = #{orgId} + + ) + + limit #{deleteSize} + + + insert into screen_org_rank_data diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyBranchDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyBranchDataDao.xml index a7058e4a08..c8b84d14b4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyBranchDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyBranchDataDao.xml @@ -58,4 +58,113 @@ ) + + + + INSERT INTO screen_party_branch_data ( + ID, + CUSTOMER_ID, + YEAR_ID, + MONTH_ID, + TYPE, + ORG_TYPE, + ORG_ID, + PARENT_ID, + ORG_NAME, + MEET_CATEGORY_ID, + MEET_CATEGORY_NAME, + ORGANIZE_COUNT, + JOIN_USER_COUNT, + AVERAGE_JOIN_USER_COUNT, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) + VALUES + + ( + REPLACE ( UUID(), '-', '' ), + #{item.customerId}, + #{item.yearId}, + #{item.monthId}, + #{item.type}, + #{item.orgType}, + #{item.orgId}, + #{item.parentId}, + #{item.orgName}, + #{item.meetCategoryId}, + #{item.meetCategoryName}, + #{item.organizeCount}, + #{item.joinUserCount}, + #{item.averageJoinUserCount}, + #{item.delFlag}, + #{item.revision}, + #{item.createdBy}, + NOW(), + #{item.updatedBy}, + NOW() + ) + + + + + + delete from screen_party_branch_data + where CUSTOMER_ID = #{customerId} + and MONTH_ID = #{monthId} + and + ( + + org_id = #{orgId} + + ) + LIMIT 1000 + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyLinkMassesDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyLinkMassesDataDao.xml index f6760538d1..f2c7adcb3d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyLinkMassesDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyLinkMassesDataDao.xml @@ -9,6 +9,40 @@ limit 1000; + + + delete from screen_party_link_masses_data + where CUSTOMER_ID = #{customerId} + and + ( + + org_id = #{orgId} + + ) + LIMIT 1000 + + + + + insert into screen_party_link_masses_data ( @@ -49,4 +83,29 @@ + + + INSERT INTO screen_party_link_masses_data ( ID, CUSTOMER_ID, ORG_TYPE, ORG_ID, PARENT_ID, ORG_NAME, CREATE_GROUP_TOTAL, GROUP_USER_TOTAL, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, DATA_END_TIME ) + VALUES + + ( + REPLACE ( UUID(), '-', '' ), + #{item.customerId}, + #{item.orgType}, + #{item.orgId}, + #{item.parentId}, + #{item.orgName}, + #{item.createGroupTotal}, + #{item.groupUserTotal}, + #{item.delFlag}, + #{item.revision}, + #{item.createdBy}, + NOW(), + #{item.updatedBy}, + NOW(), + #{item.dataEndTime} + ) + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyUserRankDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyUserRankDataDao.xml index d4089fcc30..2d59208760 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyUserRankDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyUserRankDataDao.xml @@ -9,6 +9,12 @@ limit 1000; + + delete from screen_party_user_rank_data + where CUSTOMER_ID = #{customerId} + limit 1000; + + insert into screen_party_user_rank_data ( @@ -24,6 +30,7 @@ `NAME`, USER_NAME, POINT_TOTAL, + INDEX_SCORE, DEL_FLAG, REVISION, CREATED_BY, @@ -47,6 +54,7 @@ #{item.name}, #{item.userName}, #{item.pointTotal}, + IFNULL(#{item.indexScore},0), 0, 0, 'APP_USER', @@ -59,4 +67,56 @@ + + insert into screen_party_user_rank_data + ( + ID, + CUSTOMER_ID, + GRID_ID, + GRID_NAME, + ORG_ID, + ORG_NAME, + PARTY_FLAG, + USER_ID, + SURNAME, + `NAME`, + USER_NAME, + POINT_TOTAL, + INDEX_SCORE, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME, + DATA_END_TIME, + ALL_PARENT_IDS + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.gridId}, + #{item.gridName}, + #{item.orgId}, + #{item.orgName}, + #{item.partyFlag}, + #{item.userId}, + #{item.surname}, + #{item.name}, + #{item.userName}, + #{item.pointTotal}, + #{item.indexScore}, + '0', + 0, + 'CRAWLER_ROBOT', + now(), + 'CRAWLER_ROBOT', + now(), + #{item.dataEndTime}, + #{item.allParentIds} + ) + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPioneerDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPioneerDataDao.xml index 91d8537c19..c2ad6b5722 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPioneerDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPioneerDataDao.xml @@ -3,10 +3,27 @@ - + delete from screen_pioneer_data where CUSTOMER_ID = #{customerId} - limit 1000; + limit #{deleteSize} + + + + delete from screen_pioneer_data + where CUSTOMER_ID = #{customerId} + + and ORG_TYPE=#{orgType} + + + and + ( + + ORG_ID = #{orgId} + + ) + + limit #{deleteSize} @@ -66,4 +83,139 @@ + + + + + + + + + + + + insert into screen_pioneer_data + ( + ID, + CUSTOMER_ID, + ORG_TYPE, + ORG_ID, + PARENT_ID, + ORG_NAME, + PUBLISH_ISSUE_TOTAL, + ISSUE_TOTAL, + TOPIC_TOTAL, + SHIFT_PROJECT_TOTAL, + RESOLVED_PROJECT_TOTAL, + PUBLISH_ISSUE_RATIO, + ISSUE_RATIO, + TOPIC_RATIO, + SHIFT_PROJECT_RATIO, + RESOLVED_PROJECT_RATIO, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME, + DATA_END_TIME + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.orgType}, + #{item.orgId}, + #{item.parentId}, + #{item.orgName}, + #{item.publishIssueTotal}, + #{item.issueTotal}, + #{item.topicTotal}, + #{item.shiftProjectTotal}, + #{item.resolvedProjectTotal}, + #{item.publishIssueRatio}, + #{item.issueRatio}, + #{item.topicRatio}, + #{item.shiftProjectRatio}, + #{item.resolvedProjectRatio}, + 0, + 0, + 'APP_USER', + now(), + 'APP_USER', + now(), + #{item.dataEndTime} + ) + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPublicPartiTotalDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPublicPartiTotalDataDao.xml index 0c2bfa9c51..1b33f8b0ea 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPublicPartiTotalDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPublicPartiTotalDataDao.xml @@ -77,5 +77,50 @@ - + + + insert into screen_public_parti_total_data + ( + ID, + CUSTOMER_ID, + ORG_TYPE, + ORG_ID, + PARENT_ID, + ORG_NAME, + DATA_END_TIME, + TOPIC_TOTAL, + ISSUE_TOTAL, + PROJECT_TOTAL, + REG_USER_TOTAL, + JOIN_USER_TOTAL, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.orgType}, + #{item.orgId}, + #{item.parentId}, + #{item.orgName}, + #{item.dataEndTime}, + #{item.topicTotal}, + #{item.issueTotal}, + #{item.projectTotal}, + #{item.regUserTotal}, + #{item.joinUserTotal}, + 0, + 0, + 'APP_USER', + now(), + 'APP_USER', + now() + ) + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserTotalDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserTotalDataDao.xml index ecf0039810..c3b3ef7de7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserTotalDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserTotalDataDao.xml @@ -57,4 +57,60 @@ + + insert into screen_user_total_data + ( + ID, + CUSTOMER_ID, + ORG_TYPE, + ORG_ID, + PARENT_ID, + ORG_NAME, + DATA_END_TIME, + USER_TOTAL, + PARTY_TOTAL, + GROUP_TOTAL, + TOPIC_TOTAL, + ISSUE_TOTAL, + PROJECT_TOTAL, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.orgType}, + #{item.orgId}, + #{item.parentId}, + #{item.orgName}, + #{item.dataEndTime}, + #{item.userTotal}, + #{item.partyTotal}, + #{item.groupTotal}, + #{item.topicTotal}, + #{item.issueTotal}, + #{item.projectTotal}, + 0, + 0, + 'CRAWLER_ROBOT', + now(), + 'CRAWLER_ROBOT', + now() + ) + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml index 0ed8f428fe..f47b266eba 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml @@ -155,5 +155,75 @@ rgm.resi_group_id + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActInfoDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActInfoDao.xml new file mode 100644 index 0000000000..d29bbb6cce --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActInfoDao.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActUserRelation.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActUserRelation.xml new file mode 100644 index 0000000000..4d49a71968 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActUserRelation.xml @@ -0,0 +1,26 @@ + + + + + + + + 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 2b6c50fb7f..945fd7b0e3 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 @@ -181,5 +181,111 @@ AND i.customer_id = #{customerId} + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml index 48c5176a78..ea0d0fc48b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml @@ -68,4 +68,21 @@ WHERE UPDATED_TIME >= #{startTime} AND UPDATED_TIME #{endTime} + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/partymember/PartyMemberDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/partymember/PartyMemberDao.xml new file mode 100644 index 0000000000..1a6a74ddd4 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/partymember/PartyMemberDao.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/point/UserPointDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/point/UserPointDao.xml new file mode 100644 index 0000000000..9c082f3ea2 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/point/UserPointDao.xml @@ -0,0 +1,19 @@ + + + + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml index ed572b8f52..08c8d78d5b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml @@ -76,5 +76,34 @@ AND CUSTOMER_ID = #{customerId} AND DATE_FORMAT(UPDATED_TIME, '%Y-%m-%d') = #{date} + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml index 5f6816ff3b..a1a4a7f483 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml @@ -19,5 +19,224 @@ ORDER BY pro.project_id,pro.CREATED_TIME ASC + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml index 3b7fb8b8ba..f0df043bf5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml @@ -299,4 +299,37 @@ limit 1 + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerDao.xml index 13bc6a3e01..54914e24d0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerDao.xml @@ -40,4 +40,9 @@ order by UPDATED_TIME desc limit 1; + + + \ No newline at end of file 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 new file mode 100644 index 0000000000..2d92d5d61b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerPartymemberDao.xml @@ -0,0 +1,143 @@ + + + + + + + + INSERT INTO dim_customer_partymember ( + ID, + CUSTOMER_ID, + GRID_ID, + AGENCY_ID, + PARENT_ID, + PIDS, + DATE_ID, + WEEK_ID, + MONTH_ID, + QUARTER_ID, + YEAR_ID, + USER_ID, + ID_CARD, + BIRTHDAY, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) + VALUES + + ( + REPLACE ( UUID(), '-', '' ), + #{item.customerId}, + #{item.gridId}, + #{item.agencyId}, + #{item.parentId}, + #{item.pids}, + #{item.dateId}, + #{item.weekId}, + #{item.monthId}, + #{item.quarterId}, + #{item.yearId}, + #{item.userId}, + #{item.idCard}, + #{item.birthday}, + #{item.delFlag}, + #{item.revision}, + #{item.createdBy}, + NOW(), + #{item.updatedBy}, + NOW() + ) + + + + + + DELETE FROM dim_customer_partymember + WHERE + CUSTOMER_ID = #{customerId} + AND DATE_ID = #{dateId} + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml index 4f0a68ed28..fdfc9a5c31 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml @@ -52,4 +52,16 @@ order by UPDATED_TIME desc limit 1 + \ 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 eef43456f7..b83e517441 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 @@ -15,7 +15,8 @@ SELECT ID, CUSTOMER_ID, - AGENCY_ID + AGENCY_ID, + GRID_NAME FROM dim_grid WHERE @@ -69,4 +70,45 @@ limit 1; + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyProjectDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyProjectDailyDao.xml index 34327672d6..b2333a5451 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyProjectDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyProjectDailyDao.xml @@ -25,4 +25,24 @@ AND date_id = #{dateId} + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedAgencyDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedAgencyDailyDao.xml index ea4debe1dc..aeef594371 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedAgencyDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedAgencyDailyDao.xml @@ -25,6 +25,19 @@ DELETE FROM fact_article_published_agency_daily WHERE CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND DATE_ID = #{dateId,jdbcType=VARCHAR} + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedDepartmentDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedDepartmentDailyDao.xml index abe5fafc0a..421a90c31b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedDepartmentDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedDepartmentDailyDao.xml @@ -25,6 +25,19 @@ DELETE FROM fact_article_published_department_daily WHERE CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND DATE_ID = #{dateId,jdbcType=VARCHAR} + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedGridDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedGridDailyDao.xml index b265d0b0c9..01af6f789d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedGridDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedGridDailyDao.xml @@ -41,5 +41,17 @@ DELETE FROM fact_article_published_grid_daily WHERE CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND DATE_ID = #{dateId,jdbcType=VARCHAR} + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupGridDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupGridDailyDao.xml index 8c8ab22e50..7b4c669324 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupGridDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupGridDailyDao.xml @@ -76,4 +76,24 @@ AND customer_id = #{customerId} + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueAgencyMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueAgencyMonthlyDao.xml index 45f53d10cc..2aab89ada4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueAgencyMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueAgencyMonthlyDao.xml @@ -71,4 +71,13 @@ da.ID + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueGridDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueGridDailyDao.xml index 998f24e343..de8596943f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueGridDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueGridDailyDao.xml @@ -50,4 +50,24 @@ + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueGridMonthlyDao.xml index 35ca051fa1..e02c95dcfb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueGridMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueGridMonthlyDao.xml @@ -67,7 +67,7 @@ SUM(IFNULL(CLOSED_CASE_UNRESOLVED_INCR, 0)) AS "closedCaseUnresolvedIncr" FROM dim_grid dg - LEFT JOIN fact_issue_grid_daily figd ON figd.GRID_ID = dg.ID AND figd.DEL_FLAG = 0 + LEFT JOIN fact_issue_grid_daily figd ON figd.GRID_ID = dg.ID AND figd.DEL_FLAG = '0' AND figd.MONTH_ID = #{monthId} WHERE dg.DEL_FLAG = 0 @@ -75,4 +75,14 @@ GROUP BY dg.AGENCY_ID, dg.ID + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicTotalGridDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicTotalGridDailyDao.xml index 537a46cebb..097fb515a3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicTotalGridDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicTotalGridDailyDao.xml @@ -90,4 +90,22 @@ + + \ No newline at end of file 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..30c5f5c39c 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 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserAgencyMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserAgencyMonthlyDao.xml index aa8548ff1c..7d01629a99 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserAgencyMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserAgencyMonthlyDao.xml @@ -101,5 +101,31 @@ AND CUSTOMER_ID = #{customerId} - + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridDailyDao.xml index f8d85b7ab9..855007785a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridDailyDao.xml @@ -106,4 +106,47 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridMonthlyDao.xml index f5f66265fe..209d13e228 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridMonthlyDao.xml @@ -106,5 +106,31 @@ + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/topic/TopicDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/topic/TopicDao.xml index c567d0c842..700c7fde61 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/topic/TopicDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/topic/TopicDao.xml @@ -128,5 +128,117 @@ order by TOPIC_ID + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml index 6b796d944e..90c573cb4a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml @@ -408,4 +408,92 @@ AND urole.CREATED_TIME =]]> #{startDate} AND urole.CREATED_TIME DATE_SUB( #{endDate}, INTERVAL - 1 DAY) AND erole.ROLE_NAME = '热心居民' + + + + + + + + + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/评价指标体系算法需求-备注.xlsx b/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/评价指标体系算法需求-备注.xlsx index 592e740466..9c90c24c9e 100644 Binary files a/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/评价指标体系算法需求-备注.xlsx and b/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/评价指标体系算法需求-备注.xlsx differ diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java index caa9bd6301..7ed9ff3f18 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java @@ -46,4 +46,11 @@ public interface EpmetCommonServiceOpenFeignClient { */ @PostMapping("/commonservice/externalapp/getcustomerids") Result> getExternalCustomerIds(); + + /** + * 查询秘钥(仅限内部使用) + * @return + */ + @PostMapping("/commonservice/externalapp/get-secret") + Result getSecret(@RequestBody String appId); } diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/fallback/EpmetCommonServiceOpenFeignClientFallback.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/fallback/EpmetCommonServiceOpenFeignClientFallback.java index f21808fc8c..4640f13b45 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/fallback/EpmetCommonServiceOpenFeignClientFallback.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/fallback/EpmetCommonServiceOpenFeignClientFallback.java @@ -34,4 +34,9 @@ public class EpmetCommonServiceOpenFeignClientFallback implements EpmetCommonSer public Result> getExternalCustomerIds() { return ModuleUtils.feignConError(ServiceConstant.EPMET_COMMON_SERVICE, "getExternalCustomerIds", null); } + + @Override + public Result getSecret(String appId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_COMMON_SERVICE, "getSecret", appId); + } } diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ExternalAppController.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ExternalAppController.java index ffab33bbbe..f1229c7902 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ExternalAppController.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ExternalAppController.java @@ -2,6 +2,7 @@ package com.epmet.controller; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.exception.ValidateException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -10,6 +11,7 @@ import com.epmet.dto.form.ExternalAppFormDTO; import com.epmet.dto.result.ExternalAppAuthResultDTO; import com.epmet.dto.result.ExternalAppResultDTO; import com.epmet.service.ExternalAppAuthService; +import com.epmet.service.ExternalAppSecretService; import com.epmet.service.ExternalAppService; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -34,6 +36,9 @@ public class ExternalAppController { @Autowired private ExternalAppService externalAppService; + @Autowired + private ExternalAppSecretService externalAppSecretService; + /** * 外部请求认证 * @param formDTO @@ -128,4 +133,17 @@ public class ExternalAppController { return new Result().ok(newSecret); } + /** + * 查询秘钥(仅限内部使用) + * @return + */ + @PostMapping("/get-secret") + public Result getSecret(@RequestBody String appId) { + if (StringUtils.isBlank(appId)) { + throw new ValidateException(EpmetErrorCode.CUSTOMER_VALIDATE_ERROR.getCode(), "缺少应用ID参数"); + } + String secret = externalAppSecretService.getSecretByAppId(appId); + return new Result().ok(secret); + } + } diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalAppSecretDao.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalAppSecretDao.java index fd2342c7c6..7faeae8ed4 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalAppSecretDao.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalAppSecretDao.java @@ -41,4 +41,6 @@ public interface ExternalAppSecretDao extends BaseDao { ExternalAppSecretEntity getSecretsByAppId(@Param("appId") String appId); int updateSecret(@Param("appId") String appId, @Param("secret") String secret); + + String getSecretByAppId(String appId); } \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppSecretService.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppSecretService.java index 7f6be4bd5a..3a68251684 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppSecretService.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppSecretService.java @@ -25,4 +25,5 @@ package com.epmet.service; * @since v1.0.0 2020-08-18 */ public interface ExternalAppSecretService { + String getSecretByAppId(String appId); } \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppSecretServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppSecretServiceImpl.java index 567baf3fb2..da89e8ce1c 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppSecretServiceImpl.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppSecretServiceImpl.java @@ -17,7 +17,9 @@ package com.epmet.service.impl; +import com.epmet.dao.ExternalAppSecretDao; import com.epmet.service.ExternalAppSecretService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** * 外部应用秘钥列表 @@ -28,4 +30,11 @@ import org.springframework.stereotype.Service; @Service public class ExternalAppSecretServiceImpl implements ExternalAppSecretService { + @Autowired + private ExternalAppSecretDao externalAppSecretDao; + + @Override + public String getSecretByAppId(String appId) { + return externalAppSecretDao.getSecretByAppId(appId); + } } \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/utils/externalapp/ExtAppJwtTokenUtils.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/utils/externalapp/ExtAppJwtTokenUtils.java index 490b2445e8..b945889b7c 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/utils/externalapp/ExtAppJwtTokenUtils.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/utils/externalapp/ExtAppJwtTokenUtils.java @@ -80,14 +80,18 @@ public class ExtAppJwtTokenUtils { //String appId = "acc4ad66c82a7b46e741364b4c62dce2"; // String customrId = "b09527201c4409e19d1dbc5e3c3429a1"; //孔村 - String secret = "657cd46d385a4c2ba6d9355aee24654ac3951deab7e6436e91201561b94969b5"; - String appId = "5efcfb775125d656f39583b8110a3d7d"; - String customrId = "2fe0065f70ca0e23ce4c26fca5f1d933"; +// String secret = "c4096eb0497943c78327c5192621b209c38f20592f6a49cc8c79e8b77f3bd5c8"; +// String appId = "f358d63a89f3670c197c62ca4c3a0366"; +// String customrId = "2fe0065f70ca0e23ce4c26fca5f1d933"; + + //测试-模拟客户 + String secret = "c4096eb0497943c78327c5192621b209c38f20592f6a49cc8c79e8b77f3bd5c8"; + String appId = "f358d63a89f3670c197c62ca4c3a0366"; + String customrId = "45687aa479955f9d06204d415238f7cc"; claim.put("customerId", customrId); claim.put("appId", appId); - claim.put("customerId", customrId); - long ts = System.currentTimeMillis() - 1000 * 60 * 4; + long ts = System.currentTimeMillis() + 1000 * 60 * 1; System.out.println("时间戳:" + ts); claim.put("ts", ts); diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppSecretDao.xml b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppSecretDao.xml index a192df36b1..f363e43d7c 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppSecretDao.xml +++ b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppSecretDao.xml @@ -40,5 +40,13 @@ AND DEL_FLAG = 0 + + + \ No newline at end of file diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/DimPartyMemberService.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/DimPartyMemberService.java new file mode 100644 index 0000000000..d33490b2eb --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/DimPartyMemberService.java @@ -0,0 +1,13 @@ +package com.epmet.service; + +import com.epmet.commons.tools.utils.Result; + +/** + * @Author zxc + * @DateTime 2020/9/17 3:05 下午 + */ +public interface DimPartyMemberService { + + Result getPartyInfo(String date); + +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/FactOriginExtractTaskService.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/FactOriginExtractTaskService.java new file mode 100644 index 0000000000..b41295af10 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/FactOriginExtractTaskService.java @@ -0,0 +1,23 @@ +package com.epmet.service; + + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.extract.form.ExtractOriginFormDTO; + +/** + * desc: 业务数据抽取到统计库服务类 + * + * @return: + * @date: 2020/6/22 10:24 + * @author: jianjun liu + */ +public interface FactOriginExtractTaskService { + + /** + * desc: 【日】抽取 小组 话题 议题 项目数据到统计库 + * + * @date: 2020/6/22 9:09 + * @author: jianjun liu + */ + Result factOriginExtractJob(ExtractOriginFormDTO formDTO); +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/IndexOriginExtractTaskService.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/IndexOriginExtractTaskService.java new file mode 100644 index 0000000000..5416375c13 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/IndexOriginExtractTaskService.java @@ -0,0 +1,24 @@ +package com.epmet.service; + + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.extract.form.ExtractIndexFormDTO; + +/** + * desc: 统计库数据抽取到指标库服务类 + * + * @return: + * @date: 2020/6/22 10:24 + * @author: jianjun liu + */ +public interface IndexOriginExtractTaskService { + + /** + * desc: 【月】抽取 数据到指标库 + * + * @param formDTO + * @date: 2020/6/22 9:09 + * @author: jianjun liu + */ + Result indexOriginExtractJob(ExtractIndexFormDTO formDTO); +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/ScreenExtractTaskService.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/ScreenExtractTaskService.java new file mode 100644 index 0000000000..25a4244301 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/ScreenExtractTaskService.java @@ -0,0 +1,22 @@ +package com.epmet.service; + +import com.epmet.commons.tools.utils.Result; + +/** + * @Author zxc + * @DateTime 2020/9/24 10:21 上午 + */ +public interface ScreenExtractTaskService { + + + Result screenExtractDaily(String params); + + /** + * @return com.epmet.commons.tools.utils.Result + * @param params + * @author yinzuomei + * @description 大屏数据抽取-按月统计 + * @Date 2020/9/28 10:49 + **/ + Result screenExtractMonthly(String params); +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/DimPartyMemberServiceImpl.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/DimPartyMemberServiceImpl.java new file mode 100644 index 0000000000..2fc5ea1378 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/DimPartyMemberServiceImpl.java @@ -0,0 +1,37 @@ +package com.epmet.service.impl; + +import com.alibaba.druid.util.StringUtils; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; +import com.epmet.feign.DataStatisticalOpenFeignClient; +import com.epmet.service.DimPartyMemberService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.time.LocalDate; + +/** + * @Author zxc + * @DateTime 2020/9/17 3:06 下午 + */ +@Service +public class DimPartyMemberServiceImpl implements DimPartyMemberService { + + @Autowired + private DataStatisticalOpenFeignClient statsFeignClient; + + + @Override + public Result getPartyInfo(String dateId) { + CustomerIdAndDateIdFormDTO c = new CustomerIdAndDateIdFormDTO(); + if (!StringUtils.isEmpty(dateId)) { + c.setDateId(dateId); + }else { + String now = LocalDate.now().minusDays(NumConstant.ONE).toString(); + String concat = now.substring(NumConstant.ZERO, NumConstant.FOUR).concat(now.substring(NumConstant.FIVE, NumConstant.SEVEN)).concat(now.substring(NumConstant.EIGHT, NumConstant.TEN)); + c.setDateId(concat); + } + return statsFeignClient.getPartyInfo(c); + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/FactOriginExtractTaskServiceImpl.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/FactOriginExtractTaskServiceImpl.java new file mode 100644 index 0000000000..41244194c0 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/FactOriginExtractTaskServiceImpl.java @@ -0,0 +1,30 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.extract.form.ExtractOriginFormDTO; +import com.epmet.feign.DataStatisticalOpenFeignClient; +import com.epmet.service.FactOriginExtractTaskService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * desc:数据统计 任务服务类 + */ +@Service +public class FactOriginExtractTaskServiceImpl implements FactOriginExtractTaskService { + @Autowired + private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; + + + /** + * desc: 【日】抽取 小组 话题 议题 项目数据到统计库 + * + * @param formDTO + * @date: 2020/6/22 9:09 + * @author: jianjun liu + */ + @Override + public Result factOriginExtractJob(ExtractOriginFormDTO formDTO) { + return dataStatisticalOpenFeignClient.factOriginExtractAll(formDTO); + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/IndexOriginExtractTaskServiceImpl.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/IndexOriginExtractTaskServiceImpl.java new file mode 100644 index 0000000000..e734004bd7 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/IndexOriginExtractTaskServiceImpl.java @@ -0,0 +1,30 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.extract.form.ExtractIndexFormDTO; +import com.epmet.feign.DataStatisticalOpenFeignClient; +import com.epmet.service.IndexOriginExtractTaskService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * desc:指标原始数据统计 任务服务类 + */ +@Service +public class IndexOriginExtractTaskServiceImpl implements IndexOriginExtractTaskService { + @Autowired + private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; + + + /** + * desc: 【月】抽取 统计库对象数据到统计库 + * + * @param formDTO + * @date: 2020/6/22 9:09 + * @author: jianjun liu + */ + @Override + public Result indexOriginExtractJob(ExtractIndexFormDTO formDTO) { + return dataStatisticalOpenFeignClient.indexOriginExtractAll(formDTO); + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/ScreenExtractTaskServiceImpl.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/ScreenExtractTaskServiceImpl.java new file mode 100644 index 0000000000..698a3ec7b3 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/ScreenExtractTaskServiceImpl.java @@ -0,0 +1,50 @@ +package com.epmet.service.impl; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.extract.form.ExtractOriginFormDTO; +import com.epmet.dto.extract.form.ExtractScreenFormDTO; +import com.epmet.feign.DataStatisticalOpenFeignClient; +import com.epmet.service.ScreenExtractTaskService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * @Author zxc + * @DateTime 2020/9/24 10:22 上午 + */ +@Service +@Slf4j +public class ScreenExtractTaskServiceImpl implements ScreenExtractTaskService { + + @Autowired + private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; + + + @Override + public Result screenExtractDaily(String params) { + ExtractOriginFormDTO extractOriginFormDTO = new ExtractOriginFormDTO(); + if (StringUtils.isNotBlank(params)) { + extractOriginFormDTO = JSON.parseObject(params, ExtractOriginFormDTO.class); + } + return dataStatisticalOpenFeignClient.extractDailyAll(extractOriginFormDTO); + } + + /** + * @param params + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 大屏数据抽取-按月统计 + * @Date 2020/9/28 10:49 + **/ + @Override + public Result screenExtractMonthly(String params) { + ExtractScreenFormDTO extractScreenFormDTO=new ExtractScreenFormDTO(); + if(StringUtils.isNotBlank(params)){ + extractScreenFormDTO=JSON.parseObject(params,ExtractScreenFormDTO.class); + } + return dataStatisticalOpenFeignClient.extractMonthlyAll(extractScreenFormDTO); + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/DimPartyMemberTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/DimPartyMemberTask.java new file mode 100644 index 0000000000..1998cbe6fa --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/DimPartyMemberTask.java @@ -0,0 +1,30 @@ +package com.epmet.task; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.service.DimPartyMemberService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @Author zxc + * @DateTime 2020/9/17 3:04 下午 + */ +@Slf4j +@Component("dimPartyMemberTask") +public class DimPartyMemberTask implements ITask{ + + @Autowired + private DimPartyMemberService dimPartyMemberService; + + @Override + public void run(String params) { + log.info("dimPartyMemberTask定时任务正在执行,参数为:{}", params); + Result result = dimPartyMemberService.getPartyInfo(params); + if (result.success()){ + log.info("dimPartyMemberTask定时任务执行成功"); + }else { + log.error("dimPartyMemberTask定时任务执行失败:" + result.getMsg()); + } + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/EvaIndexScreenDimInitTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/EvaIndexScreenDimInitTask.java new file mode 100644 index 0000000000..c89e4f4271 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/EvaIndexScreenDimInitTask.java @@ -0,0 +1,32 @@ +package com.epmet.task; + +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.feign.DataStatisticalOpenFeignClient; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Slf4j +@Component("evaIndexScreenDimInitTask") +public class EvaIndexScreenDimInitTask implements ITask { + + @Autowired + private DataStatisticalOpenFeignClient feignClient; + + @Override + public void run(String params) { + log.debug("EvaIndexScreenDimInitTask定时任务正在执行,参数为:{}", params); + Result result = null; + try { + result = feignClient.initAllEIDims(); + } catch (Exception e) { + log.error("EvaIndexScreenDimInitTask定时任务正在执行定时任务执行失败:{}", ExceptionUtils.getErrorStackTrace(e)); + } + if (result.success()){ + log.debug("EvaIndexScreenDimInitTask定时任务正在执行定时任务执行成功"); + }else { + log.debug("EvaIndexScreenDimInitTask定时任务正在执行定时任务执行失败:" + result.getMsg()); + } + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/FactOriginExtractTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/FactOriginExtractTask.java new file mode 100644 index 0000000000..92f58cf22b --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/FactOriginExtractTask.java @@ -0,0 +1,48 @@ +package com.epmet.task; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.StatsFormDTO; +import com.epmet.dto.extract.form.ExtractOriginFormDTO; +import com.epmet.service.FactOriginExtractTaskService; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * desc:数据抽取定时任务 定时任务 + */ +@Component("factOriginExtractTask") +public class FactOriginExtractTask implements ITask { + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private FactOriginExtractTaskService factOriginExtractTaskService; + + + @Override + public void run(String params) { + logger.info("FactOriginExtractTask定时任务正在执行,参数为:{}", params); + ExtractOriginFormDTO formDTO = new ExtractOriginFormDTO(); + if (StringUtils.isNotBlank(params)) { + formDTO = JSON.parseObject(params, ExtractOriginFormDTO.class); + } + Result result = factOriginExtractTaskService.factOriginExtractJob(formDTO); + if (result.success()) { + logger.info("FactOriginExtractTask定时任务执行成功"); + } else { + logger.error("FactOriginExtractTask定时任务执行失败:" + result.getMsg()); + } + } + + public static void main(String[] args) { + StatsFormDTO formDTO = new StatsFormDTO(); + String params = "{'date':'\"2020-06-20','customerId':'123'}"; + if (StringUtils.isNotBlank(params)) { + formDTO = JSON.parseObject(params, StatsFormDTO.class); + } + System.out.println(JSON.toJSONString(formDTO)); + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/IndexOriginExtractTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/IndexOriginExtractTask.java new file mode 100644 index 0000000000..4567910487 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/IndexOriginExtractTask.java @@ -0,0 +1,38 @@ +package com.epmet.task; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.extract.form.ExtractIndexFormDTO; +import com.epmet.service.IndexOriginExtractTaskService; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * desc:数据抽取定时任务 定时任务 + */ +@Component("indexOriginExtractTask") +public class IndexOriginExtractTask implements ITask { + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private IndexOriginExtractTaskService indexOriginExtractTaskService; + + + @Override + public void run(String params) { + logger.info("indexOriginExtractTask定时任务正在执行,参数为:{}", params); + ExtractIndexFormDTO formDTO = new ExtractIndexFormDTO(); + if (StringUtils.isNotBlank(params)) { + formDTO = JSON.parseObject(params, ExtractIndexFormDTO.class); + } + Result result = indexOriginExtractTaskService.indexOriginExtractJob(formDTO); + if (result.success()) { + logger.info("indexOriginExtractTask定时任务执行成功"); + } else { + logger.error("indexOriginExtractTask定时任务执行失败:" + result.getMsg()); + } + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ScreenExtractDailyTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ScreenExtractDailyTask.java new file mode 100644 index 0000000000..3e5c130e1a --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ScreenExtractDailyTask.java @@ -0,0 +1,33 @@ +package com.epmet.task; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.service.ScreenExtractTaskService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @Author zxc + * @DateTime 2020/9/24 10:26 上午 + */ +@Component("screenExtractDailyTask") +public class ScreenExtractDailyTask implements ITask{ + + @Autowired + private ScreenExtractTaskService screenExtractTaskService; + + private Logger logger = LoggerFactory.getLogger(getClass()); + + + @Override + public void run(String params) { + logger.info("ScreenExtractDailyTask定时任务正在执行,参数为:{}", params); + Result result = screenExtractTaskService.screenExtractDaily(params); + if (result.success()){ + logger.info("ScreenExtractDailyTask定时任务执行成功"); + }else { + logger.error("ScreenExtractDailyTask定时任务执行失败:" + result.getMsg()); + } + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ScreenExtractMonthlyTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ScreenExtractMonthlyTask.java new file mode 100644 index 0000000000..9e4cc24222 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ScreenExtractMonthlyTask.java @@ -0,0 +1,34 @@ +package com.epmet.task; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.service.ScreenExtractTaskService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 大屏数据抽取-按月统计 + * + * @author yinzuomei@elink-cn.com + * @date 2020/9/28 10:39 + */ +@Component("screenExtractMonthlyTask") +public class ScreenExtractMonthlyTask implements ITask{ + @Autowired + private ScreenExtractTaskService screenExtractTaskService; + + private Logger logger = LoggerFactory.getLogger(getClass()); + + + @Override + public void run(String params) { + logger.info("ScreenExtractMonthlyTask定时任务正在执行,参数为:{}", params); + Result result = screenExtractTaskService.screenExtractMonthly(params); + if (result.success()){ + logger.info("ScreenExtractMonthlyTask定时任务执行成功"); + }else { + logger.error("ScreenExtractMonthlyTask定时任务执行失败:" + result.getMsg()); + } + } +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/CommonPageUserFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/CommonPageUserFormDTO.java index c37afa2921..6ccb0b2a51 100644 --- a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/CommonPageUserFormDTO.java +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/CommonPageUserFormDTO.java @@ -27,6 +27,6 @@ public class CommonPageUserFormDTO implements Serializable { private Integer pageSize = 10; - @NotBlank(message = "获取不到用户Id" , groups = PageUserGroup.class) + @NotBlank(message = "获取不到客户Id" , groups = PageUserGroup.class) private String customerId; } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java index 0fc60dcbb5..38f5ac64a7 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java @@ -458,6 +458,9 @@ public class ProjectServiceImpl extends BaseServiceImpl