headers = new HashMap();
long timestamp = System.currentTimeMillis();
- headers.put(JcetConstants.PLAT_HEADER_OPEN_TIMESTAMP, String.valueOf(timestamp));
- headers.put(JcetConstants.PLAT_HEADER_OPEN_APP_ID, jcetThirdplatProps.getAppkey());
- String encryptContent = jcetThirdplatProps.getAppkey() + timestamp + bodyLength;
- headers.put(JcetConstants.PLAT_HEADER_OPEN_SIGN, SignUtils.generate(encryptContent, jcetThirdplatProps.getAppsecret()));
+ headers.put(JcetConstants.PLAT_HEADER_OPEN_TIMESTAMP, timestamp);
+ headers.put(JcetConstants.PLAT_HEADER_OPEN_APP_ID, appKey);
+ String encryptContent = appKey + timestamp + bodyLength;
+ headers.put(JcetConstants.PLAT_HEADER_OPEN_SIGN, SignUtils.generate(encryptContent, appSecret));
return headers;
}
diff --git a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/pyld/PyldApiService.java b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/pyld/PyldApiService.java
index 958fd8b1bb..b5307c2951 100644
--- a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/pyld/PyldApiService.java
+++ b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/pyld/PyldApiService.java
@@ -40,6 +40,11 @@ public class PyldApiService extends AbstractApiService {
pyldThirdplatProps = props.getPyld();
}
+ @Override
+ public ThirdPlatUserInfo getCUserInfoByTicket(String ticket) throws Exception {
+ return null;
+ }
+
/**
* @return
* @Description 通过第三方平台ticket获取用户信息
@@ -47,7 +52,7 @@ public class PyldApiService extends AbstractApiService {
* @date 2021.01.19 10:26
*/
@Override
- public ThirdPlatUserInfo getUserInfoByTicket(String platformToken) {
+ public ThirdPlatUserInfo getGUserInfoBySSOToken(String platformToken) {
logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口开始>>>>>>>>>>>>");
logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口入参 platformToken:{}", platformToken);
diff --git a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetUserInfoResultDTO.java b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetCUserInfoResultDTO.java
similarity index 91%
rename from epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetUserInfoResultDTO.java
rename to epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetCUserInfoResultDTO.java
index 8c025e5b9b..765126025d 100644
--- a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetUserInfoResultDTO.java
+++ b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetCUserInfoResultDTO.java
@@ -3,7 +3,7 @@ package com.epmet.commons.thirdplat.dto.result.jcet;
import lombok.Data;
@Data
-public class JcetUserInfoResultDTO {
+public class JcetCUserInfoResultDTO {
private String id;
/**
* 用户名称
diff --git a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetGUserInfoResultDTO.java b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetGUserInfoResultDTO.java
new file mode 100644
index 0000000000..24f2faf27c
--- /dev/null
+++ b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetGUserInfoResultDTO.java
@@ -0,0 +1,25 @@
+package com.epmet.commons.thirdplat.dto.result.jcet;
+
+import lombok.Data;
+
+@Data
+public class JcetGUserInfoResultDTO {
+ private String uid;
+ /**
+ * 手机号码
+ */
+ private String mobile;
+ /**
+ * 姓名
+ */
+ private String name;
+ /**
+ * 账号
+ */
+ private String account;
+
+ /**
+ * 用户编码
+ */
+ private String code;
+}
diff --git a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/ThirdplatProps.java b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/ThirdplatProps.java
index 4c9b46b9e0..441d1f0839 100644
--- a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/ThirdplatProps.java
+++ b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/ThirdplatProps.java
@@ -6,10 +6,13 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@Data
@ConfigurationProperties(prefix = "thirdplat")
public class ThirdplatProps {
- /**
- * 泸州 酒城e通
- */
- private JcetThirdplatProps jcet;
+
+ // C端
+ private JcetThirdplatProps jcetCend;
+
+ // G端
+ private JcetThirdplatProps jcetGend;
+
/**
* 平阴联动指挥平台
*/
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationFailedEventListener.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationFailedEventListener.java
new file mode 100644
index 0000000000..5c219ab095
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationFailedEventListener.java
@@ -0,0 +1,84 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.commons.tools.aspect;
+
+import com.alibaba.fastjson.JSON;
+import com.dingtalk.api.DefaultDingTalkClient;
+import com.dingtalk.api.DingTalkClient;
+import com.dingtalk.api.request.OapiRobotSendRequest;
+import com.dingtalk.api.response.OapiRobotSendResponse;
+import com.epmet.commons.tools.enums.EnvEnum;
+import com.epmet.commons.tools.utils.SpringContextUtils;
+import com.taobao.api.ApiException;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.context.event.ApplicationFailedEvent;
+import org.springframework.cloud.commons.util.InetUtils;
+import org.springframework.context.ApplicationListener;
+import org.springframework.stereotype.Component;
+
+/**
+ * 应用 启动健康检查 通知类
+ * CustomerApplicationRunner
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+@Component
+public class ApplicationFailedEventListener implements ApplicationListener {
+ private static Logger logger = LogManager.getLogger(ApplicationFailedEventListener.class);
+ @Value("${spring.application.name}")
+ private String appName;
+ @Value("${server.version}")
+ private String version;
+
+ @Override
+ public void onApplicationEvent(ApplicationFailedEvent applicationFailedEvent) {
+ Throwable exception = applicationFailedEvent.getException();
+ EnvEnum currentEnv = EnvEnum.getCurrentEnv();
+ logger.info(currentEnv);
+ if (!EnvEnum.DEV.getCode().equals(currentEnv.getCode()) && !EnvEnum.LOCAL.getCode().equals(currentEnv.getCode())) {
+ sendDingMarkDownMsg(exception);
+ }
+ }
+
+
+ private String getServerIp() {
+ InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class);
+ return inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
+ }
+
+ private void sendDingMarkDownMsg(Throwable exception) {
+ DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/robot/send?access_token=ffd7c972b0525e249283df1a16b65a8b9d0012601f3a458dfc588c2eac497bb5");
+ OapiRobotSendRequest request = new OapiRobotSendRequest();
+ request.setMsgtype("markdown");
+ OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown();
+ markdown.setTitle("部署失败通知");
+
+ markdown.setText("部署失败通知 \n" +
+ "> 服务:" + appName + "\n\n" +
+ "> 版本:" + version + "\n\n" +
+ "> 环境:" + EnvEnum.getCurrentEnv().getName() + "\n\n" +
+ "> IP: " + getServerIp() + "\n\n" +
+ "> 异常:" + exception.getMessage() + "\n\n"
+ );
+ request.setMarkdown(markdown);
+ OapiRobotSendRequest.At at = new OapiRobotSendRequest.At();
+ at.setIsAtAll(true);
+ request.setAt(at);
+ try {
+ OapiRobotSendResponse execute = client.execute(request);
+ logger.info("=====通知结果===>" + JSON.toJSONString(execute));
+ } catch (ApiException e) {
+ logger.error("sendDingMarkDownMsg exception", e);
+ }
+ }
+
+}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationReadyEventListener.java
similarity index 90%
rename from epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java
rename to epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationReadyEventListener.java
index 4537414335..901163e7ac 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationReadyEventListener.java
@@ -22,10 +22,9 @@ import com.taobao.api.ApiException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.ApplicationArguments;
-import org.springframework.boot.ApplicationRunner;
+import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.cloud.commons.util.InetUtils;
-import org.springframework.core.annotation.Order;
+import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
/**
@@ -36,16 +35,15 @@ import org.springframework.stereotype.Component;
* @since 1.0.0
*/
@Component
-@Order(value = 99)
-public class CustomerApplicationRunner implements ApplicationRunner {
- private static Logger logger = LogManager.getLogger(CustomerApplicationRunner.class);
+public class ApplicationReadyEventListener implements ApplicationListener {
+ private static Logger logger = LogManager.getLogger(ApplicationReadyEventListener.class);
@Value("${spring.application.name}")
private String appName;
@Value("${server.version}")
private String version;
@Override
- public void run(ApplicationArguments args) {
+ public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
EnvEnum currentEnv = EnvEnum.getCurrentEnv();
logger.info(currentEnv);
if (!EnvEnum.DEV.getCode().equals(currentEnv.getCode()) && !EnvEnum.LOCAL.getCode().equals(currentEnv.getCode())) {
@@ -107,4 +105,5 @@ public class CustomerApplicationRunner implements ApplicationRunner {
}
}
+
}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java
index ff877a04be..4b3496ee36 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java
@@ -1,6 +1,7 @@
package com.epmet.commons.tools.aspect;
import com.epmet.commons.tools.constant.AppClientConstant;
+import com.epmet.commons.tools.constant.ThreadLocalConstant;
import com.epmet.commons.tools.exception.*;
import com.epmet.commons.tools.utils.Result;
import org.apache.commons.lang3.StringUtils;
@@ -12,6 +13,7 @@ import org.springframework.dao.DuplicateKeyException;
import javax.servlet.http.HttpServletRequest;
import java.time.Duration;
import java.time.LocalDateTime;
+import java.util.Arrays;
/**
* 日志切面
@@ -61,6 +63,7 @@ public abstract class BaseRequestLogAspect {
try {
Object[] args = point.getArgs();
+ ThreadLocalConstant.requestParam.set(Arrays.toString(point.getArgs()));
log.info(">>>>>>>>请求信息>>>>>>>>:事务流水号:{},url:{} ,method:{},请求参数:{}", transactionSerial, requestURI, method, objectsToString(args));
result = point.proceed();
resultInfoLog(transactionSerial, getExecPeriod(startTime), result);
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java
index 03233b7c47..41302f5e32 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java
@@ -81,4 +81,6 @@ public interface StrConstant {
String MIN="MIN";
String MAX="MAX";
+
+ String SPECIAL_CUSTOMER = "150282ed25c14ff0785e7e06283b6283";
}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ThreadLocalConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ThreadLocalConstant.java
index 2dad0d6dba..6a2b304cfa 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ThreadLocalConstant.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ThreadLocalConstant.java
@@ -1,7 +1,5 @@
package com.epmet.commons.tools.constant;
-import com.epmet.commons.tools.dto.form.LoginUserInfoResultDTO;
-
/**
* ThreadLocal常亮
*/
@@ -16,4 +14,9 @@ public class ThreadLocalConstant {
* 用于向DataFilterInterceptor传递权限过滤的sql片段(需要在Controller相关的AOP中进行清理,防止变量残留)
*/
public static final ThreadLocal sqlFilter = new ThreadLocal();
+
+ /**
+ * 用于本次的获取请求参数
+ */
+ public static final ThreadLocal requestParam = new ThreadLocal();
}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java
index 4e2f0d16ab..942e4a6570 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java
@@ -6,6 +6,7 @@ import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.spi.IThrowableProxy;
import ch.qos.logback.classic.spi.StackTraceElementProxy;
import ch.qos.logback.core.spi.FilterReply;
+import com.epmet.commons.tools.constant.ThreadLocalConstant;
import com.epmet.commons.tools.dto.form.DingTalkTextMsg;
import com.epmet.commons.tools.enums.EnvEnum;
import com.epmet.commons.tools.utils.DingdingMsgSender;
@@ -15,9 +16,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.commons.util.InetUtils;
import org.springframework.core.env.Environment;
+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.text.SimpleDateFormat;
-import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -64,14 +68,26 @@ public class LogMsgSendFilter extends LevelFilter {
stringBuilder.append("IP地址:" + serverIp);
stringBuilder.append("\n");
}
+
stringBuilder.append("故障时间:" + formatLongTime2Str(event.getTimeStamp()));
stringBuilder.append("\n");
stringBuilder.append("TraceId:" + Thread.currentThread().getName());
stringBuilder.append("\n");
+
+ HttpServletRequest request = getRequest();
+ if (request != null) {
+ String requestURI = request.getRequestURI();
+ stringBuilder.append("请求路径:" + requestURI);
+ stringBuilder.append("\n");
+
+ stringBuilder.append("请求参数:" + ThreadLocalConstant.requestParam.get());
+ stringBuilder.append("\n");
+ }
+
String formattedMessage = event.getFormattedMessage();
IThrowableProxy throwableProxy = event.getThrowableProxy();
if (throwableProxy == null && formattedMessage.length() > 1000) {
- formattedMessage = formattedMessage.substring(0, getCharacterPosition(formattedMessage, baseProjectPackage, 5));
+ formattedMessage = formattedMessage.substring(0, getCharacterPosition(formattedMessage, baseProjectPackage, 5));
}
stringBuilder.append("告警信息:" + formattedMessage);
stringBuilder.append("\n");
@@ -159,105 +175,19 @@ public class LogMsgSendFilter extends LevelFilter {
}
}
- public static void main(String[] args) {
- String msg = "<<<<<<<<异常响应<<<<<<<<:事务流水号:na1597027822634, 执行时长:59ms, 响应数据:{\"code\":8102,\"internalMsg\":\"验证码错误\",\"msg\":\"验证码错误\"}, 异常信息:验证码错误, 堆栈信息:com.epmet.commons.tools.exception.RenException: \n" +
- " at com.epmet.service.impl.VolunteerInfoServiceImpl.authenticate(VolunteerInfoServiceImpl.java:91)\n" +
- " at com.epmet.service.impl.VolunteerInfoServiceImpl$$FastClassBySpringCGLIB$$7babb2e8.invoke()\n" +
- " at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)\n" +
- " at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:750)\n" +
- " at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)\n" +
- " at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295)\n" +
- " at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)\n" +
- " at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)\n" +
- " at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)\n" +
- " at com.epmet.service.impl.VolunteerInfoServiceImpl$$EnhancerBySpringCGLIB$$f78b4778.authenticate()\n" +
- " at com.epmet.controller.ResiVolunteerController.authenticate(ResiVolunteerController.java:59)\n" +
- " at com.epmet.controller.ResiVolunteerController$$FastClassBySpringCGLIB$$e023fb55.invoke()\n" +
- " at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)\n" +
- " at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:750)\n" +
- " at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)\n" +
- " at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:56)\n" +
- " at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)\n" +
- " at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)\n" +
- " at com.epmet.commons.tools.aspect.BaseRequestLogAspect.proceed(BaseRequestLogAspect.java:66)\n" +
- " at com.epmet.aspect.RequestLogAspect.proceed(RequestLogAspect.java:26)\n" +
- " at sun.reflect.GeneratedMethodAccessor195.invoke(Unknown Source)\n" +
- " at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n" +
- " at java.lang.reflect.Method.invoke(Method.java:498)\n" +
- " at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)\n" +
- " at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)\n" +
- " at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)\n" +
- " at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)\n" +
- " at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93)\n" +
- " at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)\n" +
- " at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)\n" +
- " at com.epmet.controller.ResiVolunteerController$$EnhancerBySpringCGLIB$$1c0751c0.authenticate()\n" +
- " at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n" +
- " at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n" +
- " at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n" +
- " at java.lang.reflect.Method.invoke(Method.java:498)\n" +
- " at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)\n" +
- " at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)\n" +
- " at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105)\n" +
- " at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:893)\n" +
- " at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:798)\n" +
- " at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)\n" +
- " at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)\n" +
- " at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)\n" +
- " at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)\n" +
- " at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)\n" +
- " at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)\n" +
- " at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)\n" +
- " at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)\n" +
- " at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)\n" +
- " at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" +
- " at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)\n" +
- " at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" +
- " at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" +
- " at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:88)\n" +
- " at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n" +
- " at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" +
- " at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" +
- " at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)\n" +
- " at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n" +
- " at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" +
- " at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" +
- " at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)\n" +
- " at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n" +
- " at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" +
- " at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" +
- " at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:94)\n" +
- " at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n" +
- " at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" +
- " at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" +
- " at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:114)\n" +
- " at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:104)\n" +
- " at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n" +
- " at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" +
- " at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" +
- " at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)\n" +
- " at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n" +
- " at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" +
- " at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" +
- " at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)\n" +
- " at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)\n" +
- " at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:526)\n" +
- " at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)\n" +
- " at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)\n" +
- " at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)\n" +
- " at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)\n" +
- " at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367)\n" +
- " at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)\n" +
- " at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860)\n" +
- " at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1591)\n" +
- " at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)\n" +
- " at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\n" +
- " at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\n" +
- " at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)\n" +
- " at java.lang.Thread.run(Thread.java:745)";
+ /**
+ * 获取Request对象
+ *
+ * @return
+ */
+ private HttpServletRequest getRequest() {
+ RequestAttributes ra = RequestContextHolder.getRequestAttributes();
+ ServletRequestAttributes sra = (ServletRequestAttributes) ra;
+ if (sra == null){
+ return null;
+ }
+ return sra.getRequest();
- String substring = msg.substring(0, getCharacterPosition(msg, "com.epme1t", 5));
- System.out.println(substring);
}
@@ -274,7 +204,7 @@ public class LogMsgSendFilter extends LevelFilter {
}
return slashMatcher.start();
} catch (Exception e) {
- logger.warn("getCharacterPosition no matche");
+ logger.warn("getCharacterPosition no matche", e);
return 0;
}
}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java
index fe48e711e7..2481664829 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java
@@ -349,7 +349,7 @@ public class HttpClientManager {
}
}
- public Result sendGet(String url, boolean isHttps, Map params, Map headerMap) {
+ public Result sendGet(String url, boolean isHttps, Map params, Map headerMap) {
try {
URIBuilder builder = new URIBuilder(url);
@@ -364,7 +364,9 @@ public class HttpClientManager {
httpGet.setConfig(requestConfig);
if (null != headerMap){
headerMap.forEach((k,v) -> {
- httpGet.addHeader(k,v);
+ if (StringUtils.isNotBlank(k)) {
+ httpGet.addHeader(k, v == null ? null : v.toString());
+ }
});
}
return execute(httpGet, isHttps);
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/RSASignature.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/RSASignature.java
new file mode 100644
index 0000000000..6de665f7eb
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/RSASignature.java
@@ -0,0 +1,251 @@
+package com.epmet.commons.tools.utils;
+
+import javax.crypto.Cipher;
+import java.security.*;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.security.spec.X509EncodedKeySpec;
+import java.util.Base64;
+
+/**
+ * @author jianjun liu
+ * @date 2020-06-05 16:48
+ **/
+
+public class RSASignature {
+
+
+ //非对称密钥算法
+ private static final String KEY_ALGORITHM = "RSA";
+ //密钥长度,在512到65536位之间,建议不要太长,否则速度很慢,生成的加密数据很长
+ private static final int KEY_SIZE = 512;
+ //字符编码
+ private static final String CHARSET = "UTF-8";
+
+ /**
+ * 生成密钥对
+ *
+ * @return KeyPair 密钥对
+ */
+ public static KeyPair getKeyPair() throws Exception {
+ return getKeyPair(null);
+ }
+
+ /**
+ * 生成密钥对
+ *
+ * @param password 生成密钥对的密码
+ * @return
+ * @throws Exception
+ */
+ public static KeyPair getKeyPair(String password) throws Exception {
+ //实例化密钥生成器
+ KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(KEY_ALGORITHM);
+ //初始化密钥生成器
+ if (password == null) {
+ keyPairGenerator.initialize(KEY_SIZE);
+ } else {
+ SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");
+ secureRandom.setSeed(password.getBytes(CHARSET));
+ keyPairGenerator.initialize(KEY_SIZE, secureRandom);
+ }
+ //生成密钥对
+ return keyPairGenerator.generateKeyPair();
+ }
+
+ /**
+ * 取得私钥
+ *
+ * @param keyPair 密钥对
+ * @return byte[] 私钥
+ */
+ public static byte[] getPrivateKeyBytes(KeyPair keyPair) {
+ return keyPair.getPrivate().getEncoded();
+ }
+
+ /**
+ * 取得Base64编码的私钥
+ *
+ * @param keyPair 密钥对
+ * @return String Base64编码的私钥
+ */
+ public static String getPrivateKey(KeyPair keyPair) {
+ return Base64.getEncoder().encodeToString(getPrivateKeyBytes(keyPair));
+ }
+
+ /**
+ * 取得公钥
+ *
+ * @param keyPair 密钥对
+ * @return byte[] 公钥
+ */
+ public static byte[] getPublicKeyBytes(KeyPair keyPair) {
+ return keyPair.getPublic().getEncoded();
+ }
+
+ /**
+ * 取得Base64编码的公钥
+ *
+ * @param keyPair 密钥对
+ * @return String Base64编码的公钥
+ */
+ public static String getPublicKey(KeyPair keyPair) {
+ return Base64.getEncoder().encodeToString(getPublicKeyBytes(keyPair));
+ }
+
+ /**
+ * 私钥加密
+ *
+ * @param data 待加密数据
+ * @param privateKey 私钥字节数组
+ * @return byte[] 加密数据
+ */
+ public static byte[] encryptByPrivateKey(byte[] data, byte[] privateKey) throws Exception {
+ //实例化密钥工厂
+ KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
+ //生成私钥
+ PrivateKey key = keyFactory.generatePrivate(new PKCS8EncodedKeySpec(privateKey));
+ //数据加密
+ Cipher cipher = Cipher.getInstance(KEY_ALGORITHM);
+ cipher.init(Cipher.ENCRYPT_MODE, key);
+ return cipher.doFinal(data);
+ }
+
+ /**
+ * 私钥加密
+ *
+ * @param data 待加密数据
+ * @param privateKey Base64编码的私钥
+ * @return String Base64编码的加密数据
+ */
+ public static String encryptByPrivateKey(String data, String privateKey) throws Exception {
+ byte[] key = Base64.getDecoder().decode(privateKey);
+ return Base64.getEncoder().encodeToString(encryptByPrivateKey(data.getBytes(CHARSET), key));
+ }
+
+ /**
+ * 公钥加密
+ *
+ * @param data 待加密数据
+ * @param publicKey 公钥字节数组
+ * @return byte[] 加密数据
+ */
+ public static byte[] encryptByPublicKey(byte[] data, byte[] publicKey) throws Exception {
+ //实例化密钥工厂
+ KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
+ //生成公钥
+ PublicKey key = keyFactory.generatePublic(new X509EncodedKeySpec(publicKey));
+ //数据加密
+ Cipher cipher = Cipher.getInstance(KEY_ALGORITHM);
+ cipher.init(Cipher.ENCRYPT_MODE, key);
+ return cipher.doFinal(data);
+ }
+
+ /**
+ * 公钥加密
+ *
+ * @param data 待加密数据
+ * @param publicKey Base64编码的公钥
+ * @return String Base64编码的加密数据
+ */
+ public static String encryptByPublicKey(String data, String publicKey) throws Exception {
+ byte[] key = Base64.getDecoder().decode(publicKey);
+ return Base64.getEncoder().encodeToString(encryptByPublicKey(data.getBytes(CHARSET), key));
+ }
+
+ /**
+ * 私钥解密
+ *
+ * @param data 待解密数据
+ * @param privateKey 私钥字节数组
+ * @return byte[] 解密数据
+ */
+ public static byte[] decryptByPrivateKey(byte[] data, byte[] privateKey) throws Exception {
+ //实例化密钥工厂
+ KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
+ //生成私钥
+ PrivateKey key = keyFactory.generatePrivate(new PKCS8EncodedKeySpec(privateKey));
+ //数据解密
+ Cipher cipher = Cipher.getInstance(KEY_ALGORITHM);
+ cipher.init(Cipher.DECRYPT_MODE, key);
+ return cipher.doFinal(data);
+ }
+
+ /**
+ * 私钥解密
+ *
+ * @param data Base64编码的待解密数据
+ * @param privateKey Base64编码的私钥
+ * @return String 解密数据
+ */
+ public static String decryptByPrivateKey(String data, String privateKey) throws Exception {
+ byte[] key = Base64.getDecoder().decode(privateKey);
+ return new String(decryptByPrivateKey(Base64.getDecoder().decode(data), key), CHARSET);
+ }
+
+ /**
+ * 公钥解密
+ *
+ * @param data 待解密数据
+ * @param publicKey 公钥字节数组
+ * @return byte[] 解密数据
+ */
+ public static byte[] decryptByPublicKey(byte[] data, byte[] publicKey) throws Exception {
+ //实例化密钥工厂
+ KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
+ //产生公钥
+ PublicKey key = keyFactory.generatePublic(new X509EncodedKeySpec(publicKey));
+ //数据解密
+ Cipher cipher = Cipher.getInstance(KEY_ALGORITHM);
+ cipher.init(Cipher.DECRYPT_MODE, key);
+ return cipher.doFinal(data);
+ }
+
+ /**
+ * 公钥解密
+ *
+ * @param data Base64编码的待解密数据
+ * @param publicKey Base64编码的公钥
+ * @return String 解密数据
+ */
+ public static String decryptByPublicKey(String data, String publicKey) throws Exception {
+ byte[] key = Base64.getDecoder().decode(publicKey);
+ return new String(decryptByPublicKey(Base64.getDecoder().decode(data), key), CHARSET);
+ }
+
+ /**
+ * 测试加解密方法
+ *
+ * @param args
+ * @throws Exception
+ */
+ public static void main(String[] args) throws Exception {
+ //生成密钥对,一般生成之后可以放到配置文件中
+ KeyPair keyPair = RSASignature.getKeyPair();
+ //公钥
+ String publicKey = RSASignature.getPublicKey(keyPair);
+ //私钥
+ String privateKey = RSASignature.getPrivateKey(keyPair);
+
+ System.out.println("公钥:\n" + publicKey);
+ System.out.println("私钥:\n" + privateKey);
+
+ String data = "RSA 加解密测试!";
+ {
+ System.out.println("\n===========私钥加密,公钥解密==============");
+ String s1 = RSASignature.encryptByPrivateKey(data, privateKey);
+ System.out.println("加密后的数据:" + s1);
+ String s2 = RSASignature.decryptByPublicKey(s1, publicKey);
+ System.out.println("解密后的数据:" + s2 + "\n\n");
+ }
+ //=====
+ {
+ System.out.println("\n===========公钥加密,私钥解密==============");
+ String s1 = RSASignature.encryptByPublicKey(data, publicKey);
+ System.out.println("加密后的数据:" + s1);
+ String s2 = RSASignature.decryptByPrivateKey(s1, privateKey);
+ System.out.println("解密后的数据:" + s2 + "\n\n");
+ }
+
+ }
+
+}
diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/UserAnalysisController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/UserAnalysisController.java
index dda6b177cf..a78d744487 100644
--- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/UserAnalysisController.java
+++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/UserAnalysisController.java
@@ -1,5 +1,7 @@
package com.epmet.datareport.controller.user;
+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.dto.form.user.UserIncrTrendFormDTO;
@@ -50,9 +52,9 @@ public class UserAnalysisController {
* @Date 2020/6/22 13:30
**/
@PostMapping("subagency")
- public Result> subAgency(@RequestBody UserSubAgencyFormDTO formDTO) {
+ public Result> subAgency(@LoginUser TokenDto tokenDto, @RequestBody UserSubAgencyFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO,UserSubAgencyFormDTO.AddUserInternalGroup.class);
- List userSubAgencyResultDTO = userService.subAgency(formDTO);
+ List userSubAgencyResultDTO = userService.subAgency(tokenDto, formDTO);
return new Result>().ok(userSubAgencyResultDTO);
}
@@ -64,9 +66,9 @@ public class UserAnalysisController {
* @Date 2020/6/22 13:33
**/
@PostMapping("subgrid")
- public Result> subGrid(@RequestBody UserSubGridFormDTO formDTO) {
+ public Result> subGrid(@LoginUser TokenDto tokenDto, @RequestBody UserSubGridFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, UserSubGridFormDTO.AddUserInternalGroup.class);
- List userSubGridResultDTO = userService.subGrid(formDTO);
+ List userSubGridResultDTO = userService.subGrid(tokenDto, formDTO);
return new Result>().ok(userSubGridResultDTO);
}
@@ -78,9 +80,9 @@ public class UserAnalysisController {
* @Date 2020/6/22 13:36
**/
@PostMapping("incrtrend")
- public Result> incrTrend(@RequestBody UserIncrTrendFormDTO formDTO) {
+ public Result> incrTrend(@LoginUser TokenDto tokenDto, @RequestBody UserIncrTrendFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, UserIncrTrendFormDTO.AddUserInternalGroup.class);
- List userIncrTrendResultDTO = userService.incrTrendV2(formDTO);
+ List userIncrTrendResultDTO = userService.incrTrendV2(tokenDto, formDTO);
return new Result>().ok(userIncrTrendResultDTO);
}
diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/UserAnalysisService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/UserAnalysisService.java
index 47c304f1b2..e7e31c78a1 100644
--- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/UserAnalysisService.java
+++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/UserAnalysisService.java
@@ -1,6 +1,7 @@
package com.epmet.datareport.service.user;
+import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.form.user.UserIncrTrendFormDTO;
import com.epmet.dto.form.user.UserSubAgencyFormDTO;
import com.epmet.dto.form.user.UserSubGridFormDTO;
@@ -32,7 +33,7 @@ public interface UserAnalysisService {
* @description 直属机关柱状图查询
* @Date 2020/6/22 13:42
**/
- List subAgency(UserSubAgencyFormDTO formDTO);
+ List subAgency(TokenDto tokenDto, UserSubAgencyFormDTO formDTO);
/**
* @param formDTO
@@ -41,7 +42,7 @@ public interface UserAnalysisService {
* @description 直属网格柱状图查询
* @Date 2020/6/22 13:42
**/
- List subGrid(UserSubGridFormDTO formDTO);
+ List subGrid(TokenDto tokenDto, UserSubGridFormDTO formDTO);
/**
* @param formDTO
@@ -60,7 +61,7 @@ public interface UserAnalysisService {
* @description 按日、按月查询注册用户数(参与用户数)增量折线图
* @Date 2020/6/22 13:42
**/
- List incrTrendV2(UserIncrTrendFormDTO formDTO);
+ List incrTrendV2(TokenDto tokenDto, UserIncrTrendFormDTO formDTO);
/**
* @return com.epmet.dto.result.user.UserAgencyInfoResultDTO
diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/UserAnalysisServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/UserAnalysisServiceImpl.java
index 88e39067b4..c4bf48603a 100644
--- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/UserAnalysisServiceImpl.java
+++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/UserAnalysisServiceImpl.java
@@ -2,7 +2,9 @@ package com.epmet.datareport.service.user.impl;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.constant.NumConstant;
+import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.RenException;
+import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
@@ -74,6 +76,7 @@ public class UserAnalysisServiceImpl implements UserAnalysisService {
logger.info(String.format("用户%s的所属机关id为%s",loginUserDetailsFormDTO.getUserId(),result.getData().getAgencyId()));
return result.getData().getAgencyId();
}
+
/**
* @param formDTO
* @return com.epmet.user.result.UserSummaryInfoResultDTO
@@ -120,11 +123,11 @@ public class UserAnalysisServiceImpl implements UserAnalysisService {
* @Date 2020/6/22 13:42
**/
@Override
- public List subAgency(UserSubAgencyFormDTO formDTO) {
+ public List subAgency(TokenDto tokenDto, UserSubAgencyFormDTO formDTO) {
//获取用户所属机关id
String myAgencyId = this.getMyAgency();
//初始化横坐标(用户所机关的下级机关列表)
- List dimList = this.initUserSubAgencyResultDTO(myAgencyId);
+ List dimList = this.initUserSubAgencyResultDTO(tokenDto.getCustomerId(), myAgencyId);
if(CollectionUtils.isEmpty(dimList)){
logger.info(String.format("当前机关(agencyId=%s)下没有下级机关",myAgencyId));
return new ArrayList<>();
@@ -199,7 +202,7 @@ public class UserAnalysisServiceImpl implements UserAnalysisService {
return dimList;
}
- private List initUserSubAgencyResultDTO(String myAgencyId) {
+ private List initUserSubAgencyResultDTO(String customerId, String myAgencyId) {
List list=new ArrayList<>();
List dimAgencyDTOS=userAnalysisDao.selectSubAgencyList(myAgencyId);
for(DimAgencyDTO agencyDTO:dimAgencyDTOS){
@@ -208,7 +211,11 @@ public class UserAnalysisServiceImpl implements UserAnalysisService {
resi.setAgencyId(agencyDTO.getId());
resi.setName(agencyDTO.getAgencyName());
resi.setValue(NumConstant.ZERO);
- resi.setType(UserAnalysisConstant.REGISTERED_RESI);
+ if (StrConstant.SPECIAL_CUSTOMER.equals(customerId)) {
+ resi.setType("学员");
+ } else {
+ resi.setType(UserAnalysisConstant.REGISTERED_RESI);
+ }
resi.setTotal(NumConstant.ZERO);
list.add(resi);
//热心居民
@@ -216,7 +223,11 @@ public class UserAnalysisServiceImpl implements UserAnalysisService {
warm.setAgencyId(agencyDTO.getId());
warm.setName(agencyDTO.getAgencyName());
warm.setValue(NumConstant.ZERO);
- warm.setType(UserAnalysisConstant.WARMHEARTED);
+ if (StrConstant.SPECIAL_CUSTOMER.equals(customerId)) {
+ warm.setType("组长");
+ } else {
+ warm.setType(UserAnalysisConstant.WARMHEARTED);
+ }
warm.setTotal(NumConstant.ZERO);
list.add(warm);
//党员
@@ -239,11 +250,11 @@ public class UserAnalysisServiceImpl implements UserAnalysisService {
* @Date 2020/6/22 13:42
**/
@Override
- public List subGrid(UserSubGridFormDTO formDTO) {
+ public List subGrid(TokenDto tokenDto, UserSubGridFormDTO formDTO) {
//获取用户所属机关id
String myAgencyId = this.getMyAgency();
//初始化横坐标(用户所机关的直属网格)
- List dimList = this.initUserSubGridResultDTO(myAgencyId);
+ List dimList = this.initUserSubGridResultDTO(tokenDto.getCustomerId(), myAgencyId);
if(CollectionUtils.isEmpty(dimList)){
logger.info(String.format("当前机关(agencyId=%s)下没有网格",myAgencyId));
return new ArrayList<>();
@@ -315,7 +326,7 @@ public class UserAnalysisServiceImpl implements UserAnalysisService {
return dimList;
}
- private List initUserSubGridResultDTO(String myAgencyId) {
+ private List initUserSubGridResultDTO(String customerId, String myAgencyId) {
List list=new ArrayList<>();
List gridList=userAnalysisDao.selectSubGridList(myAgencyId);
for(DimGridDTO grid:gridList){
@@ -324,7 +335,11 @@ public class UserAnalysisServiceImpl implements UserAnalysisService {
resi.setGridId(grid.getId());
resi.setName(grid.getGridName());
resi.setValue(NumConstant.ZERO);
- resi.setType(UserAnalysisConstant.REGISTERED_RESI);
+ if (StrConstant.SPECIAL_CUSTOMER.equals(customerId)) {
+ resi.setType("学员");
+ } else {
+ resi.setType(UserAnalysisConstant.REGISTERED_RESI);
+ }
resi.setTotal(NumConstant.ZERO);
list.add(resi);
//热心居民
@@ -332,7 +347,11 @@ public class UserAnalysisServiceImpl implements UserAnalysisService {
warm.setGridId(grid.getId());
warm.setName(grid.getGridName());
warm.setValue(NumConstant.ZERO);
- warm.setType(UserAnalysisConstant.WARMHEARTED);
+ if (StrConstant.SPECIAL_CUSTOMER.equals(customerId)) {
+ warm.setType("组长");
+ } else {
+ warm.setType(UserAnalysisConstant.WARMHEARTED);
+ }
warm.setTotal(NumConstant.ZERO);
list.add(warm);
//党员
@@ -411,7 +430,7 @@ public class UserAnalysisServiceImpl implements UserAnalysisService {
}
@Override
- public List incrTrendV2(UserIncrTrendFormDTO formDTO) {
+ public List incrTrendV2(TokenDto tokenDto, UserIncrTrendFormDTO formDTO) {
//获取用户所属机关id
String myAgencyId = this.getMyAgency();
List resultList=new ArrayList<>();
@@ -443,14 +462,22 @@ public class UserAnalysisServiceImpl implements UserAnalysisService {
UserIncrTrendResultDTO reg=new UserIncrTrendResultDTO();
reg.setDateOrMonthId(userIncrTrendResDTO.getDateIdOrMonthId());
reg.setDate(date);
- reg.setType(UserAnalysisConstant.REGISTERED_RESI);
+ if (StrConstant.SPECIAL_CUSTOMER.equals(tokenDto.getCustomerId())) {
+ reg.setType("学员");
+ } else {
+ reg.setType(UserAnalysisConstant.REGISTERED_RESI);
+ }
reg.setValue(userIncrTrendResDTO.getRegIncr());
resultList.add(reg);
UserIncrTrendResultDTO warm=new UserIncrTrendResultDTO();
warm.setDateOrMonthId(userIncrTrendResDTO.getDateIdOrMonthId());
warm.setDate(date);
- warm.setType(UserAnalysisConstant.WARMHEARTED);
+ if (StrConstant.SPECIAL_CUSTOMER.equals(tokenDto.getCustomerId())) {
+ warm.setType("组长");
+ } else {
+ warm.setType(UserAnalysisConstant.WARMHEARTED);
+ }
warm.setValue(userIncrTrendResDTO.getWarmIncr());
resultList.add(warm);
diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/SubCommunityAvgResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/SubCommunityAvgResultDTO.java
index 06b06109f1..a2c167eaeb 100644
--- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/SubCommunityAvgResultDTO.java
+++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/SubCommunityAvgResultDTO.java
@@ -1,5 +1,6 @@
package com.epmet.dto.indexcal;
+import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import java.io.Serializable;
@@ -47,5 +48,10 @@ public class SubCommunityAvgResultDTO implements Serializable {
/**
* 分数
*/
- private BigDecimal score;
+ private BigDecimal score = NumConstant.ZERO_DECIMAL;
+
+ /**
+ * 赋值状态
+ */
+ private Boolean scoreStatus = false;
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java
index 5e0d0585be..2593996a1b 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java
@@ -70,7 +70,8 @@ public interface AgencyScoreDao extends BaseDao {
* @author zxc
* @date 2021/1/15 下午4:23
*/
- List selectAgencyScoreInfoExistsSub(@Param("areaCode") String areaCode,@Param("areaCodeLength") Integer areaCodeLength, @Param("monthId")String monthId, @Param("dataType")String dataType);
+ List selectAgencyScoreInfoExistsSub(@Param("areaCode") String areaCode, @Param("monthId")String monthId, @Param("dataType")String dataType,@Param("customerId")String customerId);
+ List selectAgencyScoreInfoExistsSubSelf(@Param("areaCode") String areaCode, @Param("monthId")String monthId, @Param("dataType")String dataType,@Param("customerId")String customerId);
/**
* @Description 区下级街道得分平均值
@@ -90,7 +91,8 @@ public interface AgencyScoreDao extends BaseDao {
* @author zxc
* @date 2021/1/18 上午9:09
*/
- List selectAgencyScoreAvgExistsSub(@Param("monthId")String monthId, @Param("indexCode")String indexCode,@Param("dataType")String dataType,@Param("areaCode")String areaCode,@Param("areaCodeLength")Integer areaCodeLength);
+ List selectAgencyScoreAvgExistsSub(@Param("monthId")String monthId, @Param("indexCode")String indexCode,@Param("areaCode")String areaCode);
+ List selectAgencyScoreAvgByOrgIds(@Param("monthId")String monthId, @Param("indexCode")String indexCode,@Param("orgIds")List orgIds);
/**
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunityScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunityScoreDao.java
index d88c05e053..104f53bb42 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunityScoreDao.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunityScoreDao.java
@@ -68,7 +68,7 @@ public interface CommunityScoreDao extends BaseDao selectCommunityInfoExistsSub(@Param("areaCode") String areaCode,@Param("monthId")String monthId);
+ List selectCommunityInfoExistsSub(@Param("areaCode") String areaCode,@Param("monthId")String monthId,@Param("customerId")String customerId);
/**
* 根据入参查询 查询社区相关信息
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java
index a22317c371..cc35dbb875 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java
@@ -77,6 +77,7 @@ public interface DeptScoreDao extends BaseDao {
* @date 2021/1/18 上午9:31
*/
List selectGovernDeptScoreAvgExistsSub(@Param("areaCode")String areaCode, @Param("monthId")String monthId, @Param("indexCode")String indexCode);
+ List selectGovernDeptScoreAvgExistsSubNotSelf(@Param("areaCode")String areaCode, @Param("monthId")String monthId, @Param("indexCode")String indexCode);
/**
* @return int
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.java
index 72888053f3..24f48eef4f 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.java
@@ -75,7 +75,15 @@ public interface FactIndexGovrnAblityOrgMonthlyDao extends BaseDao> selectCommunityGovernAbilityExistsSub(@Param("monthId")String monthId,@Param("areaCode")String areaCode);
- List