Browse Source

Merge remote-tracking branch 'origin/dev' into release

master
zxc 5 years ago
parent
commit
44fde9b313
  1. 421
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java
  2. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  3. 20
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeCustomerDTO.java
  4. 5
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeOperationHistoryDTO.java
  5. 112
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CodeVersionInfoResultDTO.java
  6. 2
      epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml
  7. 2
      epmet-module/epmet-third/epmet-third-server/pom.xml
  8. 8
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java
  9. 13
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java
  10. 47
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeCustomerDao.java
  11. 11
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerDao.java
  12. 21
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeCustomerEntity.java
  13. 5
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeOperationHistoryEntity.java
  14. 30
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeCustomerService.java
  15. 23
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeService.java
  16. 9
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java
  17. 15
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeCustomerServiceImpl.java
  18. 152
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java
  19. 8
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java
  20. 60
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java
  21. 8
      epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.6__thirdUpdate.sql
  22. 61
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml
  23. 20
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerDao.xml

421
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java

@ -17,6 +17,9 @@ import org.springframework.cloud.commons.util.InetUtils;
import org.springframework.core.env.Environment;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* desc: 发送日志消息
@ -25,150 +28,276 @@ import java.text.SimpleDateFormat;
* @author: jianjun liu
*/
public class LogMsgSendFilter extends LevelFilter {
private static final Logger logger = LoggerFactory.getLogger(LogMsgSendFilter.class);
private DingdingMsgSender msgSender = new DingdingMsgSender();
private String webHook;
private String secret;
private String appName;
private String activeEnv;
private String serverIp;
@Override
public FilterReply decide(ILoggingEvent event) {
//如果日志级别等于设置的日志级别 则发送消息
if (event.getLevel().isGreaterOrEqual(Level.ERROR)) {
try {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("【日志告警】\n");
stringBuilder.append("\n");
stringBuilder.append("告警级别:" + event.getLevel());
stringBuilder.append("\n");
if (StringUtils.isNotBlank(appName)) {
stringBuilder.append("服务名称:" + appName);
stringBuilder.append("\n");
}
getServerInfo();
if (StringUtils.isNotBlank(activeEnv)) {
stringBuilder.append("告警环境:" + EnvEnum.getEnum(activeEnv).getName());
stringBuilder.append("\n");
}
if (StringUtils.isNotBlank(serverIp)) {
stringBuilder.append("IP地址:" + serverIp);
stringBuilder.append("\n");
}
stringBuilder.append("故障时间:" + formatLongTime2Str(event.getTimeStamp()));
stringBuilder.append("\n");
stringBuilder.append("TraceId:" + Thread.currentThread().getName());
stringBuilder.append("\n");
stringBuilder.append("告警信息:" + event.getFormattedMessage());
stringBuilder.append("\n");
IThrowableProxy throwableProxy = event.getThrowableProxy();
//异常信息处理 暂时处理一级的5行数据
apendStackInfo(stringBuilder, throwableProxy);
DingTalkTextMsg msg = new DingTalkTextMsg();
msg.setContent(stringBuilder.toString());
if (StringUtils.isNotBlank(webHook)) {
msg.setWebHook(webHook);
}
if (StringUtils.isNotBlank(secret)) {
msg.setSecret(secret);
}
boolean flag = msgSender.sendMsgAsync(msg);
if (!flag) {
logger.warn("msgSender.sendMsg fail,param:{}", stringBuilder.toString());
}
} catch (Exception e) {
logger.warn("decide exception", e);
}
}
//交给其他filter继续向下处理
return super.decide(event);
}
/**
* desc:获取服务 ip及profile信息
*/
private void getServerInfo() {
try {
if (serverIp == null) {
InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class);
serverIp = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
}
} catch (Exception e) {
logger.warn("getServerInfo get bean InetUtils exception", e);
return;
}
try {
if (activeEnv == null) {
Environment environment = SpringContextUtils.getBean(Environment.class);
String[] activeProfiles = environment.getActiveProfiles();
if (activeProfiles != null && activeProfiles.length > 0) {
logger.info("activeProfiles:{}", activeProfiles);
activeEnv = activeProfiles[0];
}
}
} catch (Exception e) {
logger.warn("getServerInfo get bean Environment exception", e);
}
}
private void apendStackInfo(StringBuilder stringBuilder, IThrowableProxy throwableProxy) {
int defaultRowLine = 5;
if (throwableProxy != null) {
stringBuilder.append("异常信息:")
.append(throwableProxy.getClassName())
.append(" : ")
.append(throwableProxy.getMessage())
.append("\n");
StackTraceElementProxy[] stackTraceElementProxyArray = throwableProxy.getStackTraceElementProxyArray();
StackTraceElementProxy stackTraceElementProxy = null;
if (stackTraceElementProxyArray.length < defaultRowLine) {
defaultRowLine = stackTraceElementProxyArray.length;
}
for (int i = 0; i < defaultRowLine; i++) {
stackTraceElementProxy = stackTraceElementProxyArray[i];
StackTraceElement stackTraceElement = stackTraceElementProxy.getStackTraceElement();
stringBuilder.append("\t\tat ");
stringBuilder.append(stackTraceElement.getClassName());
stringBuilder.append(".");
stringBuilder.append(stackTraceElement.getMethodName());
stringBuilder.append("(");
stringBuilder.append(stackTraceElement.getFileName());
stringBuilder.append(":");
stringBuilder.append(stackTraceElement.getLineNumber());
stringBuilder.append(")");
stringBuilder.append("\n");
}
}
}
private String formatLongTime2Str(long timestamp) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
return dateFormat.format(timestamp);
}
public void setActiveEnv(String activeEnv) {
this.activeEnv = activeEnv;
}
public void setAppName(String appName) {
this.appName = appName;
}
public void setWebHook(String webHook) {
this.webHook = webHook;
}
public void setSecret(String secret) {
this.secret = secret;
}
private static final Logger logger = LoggerFactory.getLogger(LogMsgSendFilter.class);
private DingdingMsgSender msgSender = new DingdingMsgSender();
private String webHook;
private String secret;
private String appName;
private String activeEnv;
private String serverIp;
private String baseProjectPackage = "com.epmet";
@Override
public FilterReply decide(ILoggingEvent event) {
//如果日志级别等于设置的日志级别 则发送消息
if (event.getLevel().isGreaterOrEqual(Level.ERROR)) {
try {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("【日志告警】\n");
stringBuilder.append("\n");
stringBuilder.append("告警级别:" + event.getLevel());
stringBuilder.append("\n");
if (StringUtils.isNotBlank(appName)) {
stringBuilder.append("服务名称:" + appName);
stringBuilder.append("\n");
}
getServerInfo();
if (StringUtils.isNotBlank(activeEnv)) {
stringBuilder.append("告警环境:" + EnvEnum.getEnum(activeEnv).getName());
stringBuilder.append("\n");
}
if (StringUtils.isNotBlank(serverIp)) {
stringBuilder.append("IP地址:" + serverIp);
stringBuilder.append("\n");
}
stringBuilder.append("故障时间:" + formatLongTime2Str(event.getTimeStamp()));
stringBuilder.append("\n");
stringBuilder.append("TraceId:" + Thread.currentThread().getName());
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));
}
stringBuilder.append("告警信息:" + formattedMessage);
stringBuilder.append("\n");
//异常信息处理 暂时处理一级的5行数据
apendStackInfo(stringBuilder, throwableProxy);
DingTalkTextMsg msg = new DingTalkTextMsg();
msg.setContent(stringBuilder.toString());
if (StringUtils.isNotBlank(webHook)) {
msg.setWebHook(webHook);
}
if (StringUtils.isNotBlank(secret)) {
msg.setSecret(secret);
}
boolean flag = msgSender.sendMsgAsync(msg);
if (!flag) {
logger.warn("msgSender.sendMsg fail,param:{}", stringBuilder.toString());
}
} catch (Exception e) {
logger.warn("decide exception", e);
}
}
//交给其他filter继续向下处理
return super.decide(event);
}
/**
* desc:获取服务 ip及profile信息
*/
private void getServerInfo() {
try {
if (serverIp == null) {
InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class);
serverIp = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
}
} catch (Exception e) {
logger.warn("getServerInfo get bean InetUtils exception", e);
return;
}
try {
if (activeEnv == null) {
Environment environment = SpringContextUtils.getBean(Environment.class);
String[] activeProfiles = environment.getActiveProfiles();
if (activeProfiles != null && activeProfiles.length > 0) {
logger.info("activeProfiles:{}", activeProfiles);
activeEnv = activeProfiles[0];
}
}
} catch (Exception e) {
logger.warn("getServerInfo get bean Environment exception", e);
}
}
private void apendStackInfo(StringBuilder stringBuilder, IThrowableProxy throwableProxy) {
int defaultRowLine = 5;
if (throwableProxy != null) {
stringBuilder.append("异常信息:")
.append(throwableProxy.getClassName())
.append(" : ")
.append(throwableProxy.getMessage())
.append("\n");
StackTraceElementProxy[] stackTraceElementProxyArray = throwableProxy.getStackTraceElementProxyArray();
StackTraceElementProxy stackTraceElementProxy = null;
if (stackTraceElementProxyArray.length < defaultRowLine) {
defaultRowLine = stackTraceElementProxyArray.length;
}
for (int i = 0; i < defaultRowLine; i++) {
stackTraceElementProxy = stackTraceElementProxyArray[i];
StackTraceElement stackTraceElement = stackTraceElementProxy.getStackTraceElement();
stringBuilder.append("\t\tat ");
stringBuilder.append(stackTraceElement.getClassName());
stringBuilder.append(".");
stringBuilder.append(stackTraceElement.getMethodName());
stringBuilder.append("(");
stringBuilder.append(stackTraceElement.getFileName());
stringBuilder.append(":");
stringBuilder.append(stackTraceElement.getLineNumber());
stringBuilder.append(")");
stringBuilder.append("\n");
}
}
}
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(<generated>)\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(<generated>)\n" +
" at com.epmet.controller.ResiVolunteerController.authenticate(ResiVolunteerController.java:59)\n" +
" at com.epmet.controller.ResiVolunteerController$$FastClassBySpringCGLIB$$e023fb55.invoke(<generated>)\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(<generated>)\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)";
String substring = msg.substring(0, getCharacterPosition(msg, "com.epme1t", 5));
System.out.println(substring);
}
public static int getCharacterPosition(String string, String findStr, int time) {
Matcher slashMatcher = null;
try {
slashMatcher = Pattern.compile(findStr).matcher(string);
int mIdx = 0;
while (slashMatcher.find()) {
mIdx++;
if (mIdx == time) {
break;
}
}
return slashMatcher.start();
} catch (Exception e) {
logger.warn("getCharacterPosition no matche");
return 0;
}
}
private String formatLongTime2Str(long timestamp) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
return dateFormat.format(timestamp);
}
public void setActiveEnv(String activeEnv) {
this.activeEnv = activeEnv;
}
public void setAppName(String appName) {
this.appName = appName;
}
public void setWebHook(String webHook) {
this.webHook = webHook;
}
public void setSecret(String secret) {
this.secret = secret;
}
}

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

@ -1,5 +1,6 @@
package com.epmet.controller;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.dto.AgencySubTreeDto;
import com.epmet.service.StatsDemoService;
import lombok.extern.slf4j.Slf4j;
@ -28,8 +29,7 @@ public class DemoController {
@GetMapping("testAlarm")
public void testAlarm() {
//for (int i = 0; i < 20; i++) {
log.error("测试消息");
//}
throw new RenException("测试消息长度");
}
@GetMapping("testtx")

20
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeCustomerDTO.java

@ -92,6 +92,26 @@ public class CodeCustomerDTO implements Serializable {
* 二维码
*/
private String qrCode;
/**
* 发布模式 gary:分阶段发布total:全量发布
*/
private String releaseType;
/**
* 灰度值
*/
private Integer garyPercentage;
/**
* 上传时间
*/
private Date commitTime;
/**
* 提交审核时间
*/
private Date auditTime;
/**
* 发布时间
*/
private Date releaseTime;
/**
* 乐观锁

5
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeOperationHistoryDTO.java

@ -43,6 +43,11 @@ public class CodeOperationHistoryDTO implements Serializable {
*/
private String customerId;
/**
* 小程序类型 居民端resi,工作端work
*/
private String clientType;
/**
* 代码ID
*/

112
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CodeVersionInfoResultDTO.java

@ -0,0 +1,112 @@
package com.epmet.dto.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/8/7 14:00
*/
@NoArgsConstructor
@Data
public class CodeVersionInfoResultDTO implements Serializable {
private static final long serialVersionUID = 5822281118416848107L;
/**
*
*/
private CommitBean commit;
/**
*
*/
private AuditBean audit;
/**
*
*/
private ReleaseBean release;
@NoArgsConstructor
@Data
public static class CommitBean {
private String codeId;
/**
*
*/
private String version;
/**
*
*/
private String codeInfo;
/**
*
*/
private String commitTime;
/**
*
*/
private String modelId;
}
@NoArgsConstructor
@Data
public static class AuditBean {
private String codeId;
/**
*
*/
private String version;
/**
*
*/
private String codeInfo;
/**
*
*/
private String commitTime;
/**
*
*/
private String auditTime;
/**
*
*/
private String status;
}
@NoArgsConstructor
@Data
public static class ReleaseBean {
private String codeId;
/**
*
*/
private String version;
/**
*
*/
private String codeInfo;
/**
*
*/
private String commitTime;
/**
*
*/
private String auditTime;
/**
*
*/
private String releaseTime;
/**
*
*/
private String releaseType;
/**
*
*/
private int grayPercentage;
}
}

2
epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml

@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-third-server:
container_name: epmet-third-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.116
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.117
ports:
- "8110:8110"
network_mode: host # 使用现有网络

2
epmet-module/epmet-third/epmet-third-server/pom.xml

@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>0.0.116</version>
<version>0.0.117</version>
<parent>
<groupId>com.epmet</groupId>

8
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java

@ -207,4 +207,12 @@ public class CodeController {
codeService.setDomain(customerId);
return new Result<>();
}
@PostMapping("customers")
public Result<PageData> getCustomerList(@RequestBody UploadListFormDTO formDTO) {
PageData pageData = codeService.getCustomerList(formDTO);
return new Result<PageData>().ok(pageData);
}
}

13
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java

@ -179,5 +179,18 @@ public class PaCustomerController {
return new Result<AccountBasicInfoResultDTO>().ok(paCustomerService.getAccountBasicInfo(formDTO));
}
/**
* 获取客户小程序列表
* @author zhaoqifeng
* @date 2020/8/10 9:43
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.commons.tools.page.PageData>
*/
@PostMapping("miniprolist")
public Result<PageData> getCustomerList(@RequestBody UploadListFormDTO formDTO) {
PageData pageData = paCustomerService.getCustomerList(formDTO);
return new Result<PageData>().ok(pageData);
}
}

47
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeCustomerDao.java

@ -94,4 +94,51 @@ public interface CodeCustomerDao extends BaseDao<CodeCustomerEntity> {
*/
CodeCustomerDTO selectUploadCodeByCustomer(@Param("customerId") String customerId, @Param("clientType") String clientType);
/**
* 开发版
* @author zhaoqifeng
* @date 2020/8/7 15:02
* @param customerId
* @param clientType
* @return com.epmet.dto.CodeCustomerDTO
*/
CodeCustomerDTO selectCommitInfo(@Param("customerId") String customerId, @Param("clientType") String clientType);
/**
* 审核版
* @author zhaoqifeng
* @date 2020/8/7 15:02
* @param customerId
* @param clientType
* @return com.epmet.dto.CodeCustomerDTO
*/
CodeCustomerDTO selectAuditInfo(@Param("customerId") String customerId, @Param("clientType") String clientType);
/**
* 线上版
* @author zhaoqifeng
* @date 2020/8/7 15:02
* @param customerId
* @param clientType
* @return com.epmet.dto.CodeCustomerDTO
*/
CodeCustomerDTO selectReleaseInfo(@Param("customerId") String customerId, @Param("clientType") String clientType);
/**
* 上一个已发布版本
* @author zhaoqifeng
* @date 2020/8/7 15:12
* @param customerId
* @param clientType
* @return com.epmet.dto.CodeCustomerDTO
*/
CodeCustomerDTO selectLastVersion(@Param("customerId") String customerId, @Param("clientType") String clientType);
/**
* 激活上一版本
* @author zhaoqifeng
* @date 2020/8/7 15:18
* @param codeId
* @return void
*/
void updateVersion(@Param("codeId") String codeId);
}

11
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerDao.java

@ -21,9 +21,11 @@ import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.PaCustomerDTO;
import com.epmet.dto.form.ModifyCustomerFormDTO;
import com.epmet.dto.form.RegisterByAuthFormDTO;
import com.epmet.dto.form.UploadListFormDTO;
import com.epmet.dto.result.CustomerAgencyResultDTO;
import com.epmet.dto.result.CustomerAndUserResultDTO;
import com.epmet.dto.result.RegisterByAuthResultDTO;
import com.epmet.dto.result.UploadListResultDTO;
import com.epmet.entity.PaCustomerEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -86,6 +88,15 @@ public interface PaCustomerDao extends BaseDao<PaCustomerEntity> {
*/
String selectCustomerName(@Param("customerId") String customerId);
/**
* 获取已初始化客户列表
* @author zhaoqifeng
* @date 2020/8/7 17:44
* @param formDTO
* @return java.util.List<com.epmet.dto.result.UploadListResultDTO>
*/
List<UploadListResultDTO> selectInitCustomerList(UploadListFormDTO formDTO);
/**
* @author sun
* @Description 查询客户及管理员信息

21
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeCustomerEntity.java

@ -93,5 +93,26 @@ public class CodeCustomerEntity extends BaseEpmetEntity {
*/
private String qrCode;
/**
* 发布模式 gary:分阶段发布total:全量发布
*/
private String releaseType;
/**
* 灰度值
*/
private Integer garyPercentage;
/**
* 上传时间
*/
private Date commitTime;
/**
* 提交审核时间
*/
private Date auditTime;
/**
* 发布时间
*/
private Date releaseTime;
}

5
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeOperationHistoryEntity.java

@ -43,6 +43,11 @@ public class CodeOperationHistoryEntity extends BaseEpmetEntity {
*/
private String customerId;
/**
* 小程序类型 居民端resi,工作端work
*/
private String clientType;
/**
* 代码ID
*/

30
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeCustomerService.java

@ -131,4 +131,34 @@ public interface CodeCustomerService extends BaseService<CodeCustomerEntity> {
* @return void
*/
void deleteCode(String customerId, String clientType);
/**
* 开发版
* @author zhaoqifeng
* @date 2020/8/7 15:34
* @param customerId
* @param clientType
* @return com.epmet.dto.CodeCustomerDTO
*/
CodeCustomerDTO getCommitInfo(String customerId, String clientType);
/**
* 审核版
* @author zhaoqifeng
* @date 2020/8/7 15:34
* @param customerId
* @param clientType
* @return com.epmet.dto.CodeCustomerDTO
*/
CodeCustomerDTO getAuditInfo(String customerId, String clientType);
/**
* 线上版
* @author zhaoqifeng
* @date 2020/8/7 15:34
* @param customerId
* @param clientType
* @return com.epmet.dto.CodeCustomerDTO
*/
CodeCustomerDTO getReleaseInfo(String customerId, String clientType);
}

23
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeService.java

@ -2,10 +2,7 @@ package com.epmet.service;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.form.*;
import com.epmet.dto.result.CategoryResultDTO;
import com.epmet.dto.result.QrCodeResultDTO;
import com.epmet.dto.result.ReasonResultDTO;
import com.epmet.dto.result.TemplateListResultDTO;
import com.epmet.dto.result.*;
import java.util.List;
@ -54,6 +51,15 @@ public interface CodeService {
*/
PageData uploadList(UploadListFormDTO formDTO);
/**
* 获取版本信息
* @author zhaoqifeng
* @date 2020/8/7 15:30
* @param formDTO
* @return com.epmet.dto.result.CodeVersionInfoResultDTO
*/
CodeVersionInfoResultDTO version(CustomerClientFormDTO formDTO);
/**
* 提交审核
*
@ -148,4 +154,13 @@ public interface CodeService {
*/
void setDomain(String customerId);
/**
* 已初始化客户列表
* @author zhaoqifeng
* @date 2020/8/7 17:57
* @param formDTO
* @return com.epmet.commons.tools.page.PageData
*/
PageData getCustomerList(UploadListFormDTO formDTO);
}

9
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java

@ -204,4 +204,13 @@ public interface PaCustomerService extends BaseService<PaCustomerEntity> {
* @return com.epmet.dto.result.AccountBasicInfoResultDTO
*/
AccountBasicInfoResultDTO getAccountBasicInfo(CustomerClientFormDTO formDTO);
/**
* 获取已初始化客户列表
* @author zhaoqifeng
* @date 2020/8/7 17:41
* @param formDTO
* @return com.epmet.commons.tools.page.PageData
*/
PageData getCustomerList(UploadListFormDTO formDTO);
}

15
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeCustomerServiceImpl.java

@ -129,5 +129,20 @@ public class CodeCustomerServiceImpl extends BaseServiceImpl<CodeCustomerDao, Co
baseDao.deleteCode(customerId, clientType);
}
@Override
public CodeCustomerDTO getCommitInfo(String customerId, String clientType) {
return baseDao.selectCommitInfo(customerId, clientType);
}
@Override
public CodeCustomerDTO getAuditInfo(String customerId, String clientType) {
return baseDao.selectAuditInfo(customerId, clientType);
}
@Override
public CodeCustomerDTO getReleaseInfo(String customerId, String clientType) {
return baseDao.selectReleaseInfo(customerId, clientType);
}
}

152
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java

@ -108,13 +108,7 @@ public class CodeServiceImpl implements CodeService {
@Override
@Transactional(rollbackFor = Exception.class)
public void upload(CodeUploadFormDTO formDTO) {
//获取上传代码信息
CodeCustomerDTO uploadCode = codeCustomerService.getUploadCodeByCustomer(formDTO.getCustomerId(), formDTO.getClientType());
if (null != uploadCode) {
if (CodeConstant.AUDITING.equals(uploadCode.getStatus())) {
throw new RenException("已经有正在审核的版本,请等待审核完毕或者撤回审核后再上传");
}
}
//是否授权
if (!customerMpService.getAuthFlag(formDTO.getCustomerId(), formDTO.getClientType())) {
throw new RenException("未授权");
@ -147,15 +141,14 @@ public class CodeServiceImpl implements CodeService {
WxResult wxResult = wxMaCodeService.commit(authInfo.getAuthorizerAccessToken(), request);
//上传失败,抛出异常
if (!wxResult.success()) {
saveOperation(formDTO.getCustomerId(), null, formDTO.getUserVersion(), CodeConstant.OPER_UPLOAD, wxResult.getErrorMsg());
saveOperation(formDTO.getCustomerId(), formDTO.getClientType(), null, formDTO.getUserVersion(), CodeConstant.OPER_UPLOAD,
wxResult.getErrorMsg());
throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg());
}
//获取客户信息
CustomerDTO customerDTO = new CustomerDTO();
customerDTO.setId(formDTO.getCustomerId());
PaCustomerDTO paCustomerDTO = paCustomerService.get(formDTO.getCustomerId());
//将之前上传信息删除
codeCustomerService.deleteCode(formDTO.getCustomerId(), formDTO.getClientType());
//将上传信息存入表中
CodeCustomerDTO codeCustomerDTO = ConvertUtils.sourceToTarget(formDTO, CodeCustomerDTO.class);
@ -166,47 +159,77 @@ public class CodeServiceImpl implements CodeService {
codeCustomerDTO.setStatus(CodeConstant.UNAUDITED);
String codeId = codeCustomerService.save(codeCustomerDTO);
saveOperation(formDTO.getCustomerId(), codeId, formDTO.getUserVersion(), CodeConstant.OPER_UPLOAD, "上传成功");
saveOperation(formDTO.getCustomerId(), formDTO.getClientType(), codeId, formDTO.getUserVersion(), CodeConstant.OPER_UPLOAD, "上传成功");
}
@Override
public PageData uploadList(UploadListFormDTO formDTO) {
List<CodeCustomerDTO> auditingList = codeCustomerService.getAuditingCodeList(formDTO.getSource());
String customerId = formDTO.getCustomerId();
if (null != auditingList && auditingList.size() > NumConstant.ZERO) {
auditingList.forEach(code -> {
//获取小程序调用令牌
AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(code.getCustomerId(), code.getClientType());
//获取审核结果信息
CodeAuditResultDTO auditResult = codeAuditResultService.getAuditResultByCodeId(code.getId());
//调用微信API获取最新审核状态
WxMaCodeAuditStatusReq request = new WxMaCodeAuditStatusReq();
request.setAuditId(auditResult.getAuditId());
WxResult<WxMaAuditStatusResult> wxAuditResult = wxMaCodeService.getAuditStatus(authInfo.getAuthorizerAccessToken(), request);
if (wxAuditResult.success()) {
WxMaAuditStatusResult result = wxAuditResult.getData();
if (result.getStatus() == NumConstant.ZERO) {
code.setStatus(CodeConstant.AUDIT_SUCCESS);
auditResult.setResult(CodeConstant.AUDIT_SUCCESS);
saveOperation(customerId, code.getId(), code.getUserVersion(), CodeConstant.OPER_SUCCESS, "审核成功");
} else if (result.getStatus() == NumConstant.ONE) {
code.setStatus(CodeConstant.AUDIT_FAILED);
auditResult.setResult(CodeConstant.AUDIT_FAILED);
auditResult.setReason(result.getReason());
auditResult.setScreenShot(result.getScreenshot());
saveOperation(customerId, code.getId(), code.getUserVersion(), CodeConstant.OPER_FAILED, result.getReason());
} else if (result.getStatus() == NumConstant.FOUR) {
code.setStatus(CodeConstant.DELAY);
auditResult.setResult(CodeConstant.DELAY);
auditResult.setReason(result.getReason());
saveOperation(customerId, code.getId(), code.getUserVersion(), CodeConstant.OPER_DELAY, result.getReason());
}
codeCustomerService.update(code);
codeAuditResultService.update(auditResult);
return codeCustomerService.getCodeList(formDTO);
}
@Override
public CodeVersionInfoResultDTO version(CustomerClientFormDTO formDTO) {
CodeVersionInfoResultDTO resultDTO = new CodeVersionInfoResultDTO();
//开发版本
CodeCustomerDTO commit = codeCustomerService.getCommitInfo(formDTO.getCustomerId(), formDTO.getClientType());
resultDTO.getCommit().setCodeId(commit.getId());
resultDTO.getCommit().setCodeInfo(commit.getUserDesc());
resultDTO.getCommit().setModelId(commit.getTemplateId());
resultDTO.getCommit().setVersion(commit.getUserVersion());
resultDTO.getCommit().setCommitTime(DateUtils.format(commit.getCommitTime(), DateUtils.DATE_TIME_PATTERN));
//审核版本
CodeCustomerDTO audit = codeCustomerService.getAuditInfo(formDTO.getCustomerId(), formDTO.getClientType());
resultDTO.getAudit().setCodeId(audit.getId());
resultDTO.getAudit().setVersion(audit.getUserVersion());
resultDTO.getAudit().setCodeInfo(audit.getUserDesc());
if (CodeConstant.AUDITING.equals(audit.getStatus())) {
//获取小程序调用令牌
AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), formDTO.getClientType());
//获取审核结果信息
CodeAuditResultDTO auditResult = codeAuditResultService.getAuditResultByCodeId(audit.getId());
//调用微信API获取最新审核状态
WxMaCodeAuditStatusReq request = new WxMaCodeAuditStatusReq();
request.setAuditId(auditResult.getAuditId());
WxResult<WxMaAuditStatusResult> wxAuditResult = wxMaCodeService.getAuditStatus(authInfo.getAuthorizerAccessToken(), request);
if (wxAuditResult.success()) {
WxMaAuditStatusResult result = wxAuditResult.getData();
if (result.getStatus() == NumConstant.ZERO) {
audit.setStatus(CodeConstant.AUDIT_SUCCESS);
auditResult.setResult(CodeConstant.AUDIT_SUCCESS);
saveOperation(formDTO.getCustomerId(), formDTO.getClientType(), audit.getId(), audit.getUserVersion(), CodeConstant.OPER_SUCCESS
, "审核成功");
} else if (result.getStatus() == NumConstant.ONE) {
audit.setStatus(CodeConstant.AUDIT_FAILED);
auditResult.setResult(CodeConstant.AUDIT_FAILED);
auditResult.setReason(result.getReason());
auditResult.setScreenShot(result.getScreenshot());
saveOperation(formDTO.getCustomerId(), formDTO.getClientType(), audit.getId(), audit.getUserVersion(), CodeConstant.OPER_FAILED,
result.getReason());
} else if (result.getStatus() == NumConstant.FOUR) {
audit.setStatus(CodeConstant.DELAY);
auditResult.setResult(CodeConstant.DELAY);
auditResult.setReason(result.getReason());
saveOperation(formDTO.getCustomerId(), formDTO.getClientType(), audit.getId(), audit.getUserVersion(), CodeConstant.OPER_DELAY,
result.getReason());
}
});
codeCustomerService.update(audit);
codeAuditResultService.update(auditResult);
}
}
return codeCustomerService.getCodeList(formDTO);
resultDTO.getAudit().setStatus(audit.getStatus());
resultDTO.getAudit().setCommitTime(DateUtils.format(audit.getCommitTime(), DateUtils.DATE_TIME_PATTERN));
resultDTO.getAudit().setAuditTime(DateUtils.format(audit.getAuditTime(), DateUtils.DATE_TIME_PATTERN));
//线上版本
CodeCustomerDTO release = codeCustomerService.getReleaseInfo(formDTO.getCustomerId(), formDTO.getClientType());
resultDTO.getRelease().setCodeId(release.getId());
resultDTO.getRelease().setCodeInfo(release.getUserDesc());
resultDTO.getRelease().setCommitTime(DateUtils.format(release.getCommitTime(), DateUtils.DATE_TIME_PATTERN));
resultDTO.getRelease().setAuditTime(DateUtils.format(release.getAuditTime(), DateUtils.DATE_TIME_PATTERN));
resultDTO.getRelease().setReleaseTime(DateUtils.format(release.getReleaseTime(), DateUtils.DATE_TIME_PATTERN));
resultDTO.getRelease().setReleaseType(release.getReleaseType());
resultDTO.getRelease().setGrayPercentage(release.getGaryPercentage());
resultDTO.getRelease().setVersion(release.getUserVersion());
return resultDTO;
}
@Override
@ -233,8 +256,8 @@ public class CodeServiceImpl implements CodeService {
request.setUgcDeclare(formDTO.getUgcDeclare());
WxResult<String> wxResult = wxMaCodeService.submitAudit(authInfo.getAuthorizerAccessToken(), request);
if (!wxResult.success()) {
saveOperation(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getId(), codeCustomerDTO.getUserVersion(), CodeConstant.OPER_SUBMIT,
wxResult.getErrorMsg());
saveOperation(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType(), codeCustomerDTO.getId(),
codeCustomerDTO.getUserVersion(), CodeConstant.OPER_SUBMIT, wxResult.getErrorMsg());
throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg());
}
if(formDTO.getIsSpeed()) {
@ -243,8 +266,8 @@ public class CodeServiceImpl implements CodeService {
speedRequest.setAuditId(wxResult.getData());
WxResult wxSpeedResult = wxMaCodeService.speedUpAudit(authInfo.getAuthorizerAccessToken(), speedRequest);
if (!wxSpeedResult.success()) {
saveOperation(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getId(), codeCustomerDTO.getUserVersion(), CodeConstant.OPER_SUBMIT,
wxSpeedResult.getErrorMsg());
saveOperation(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType(), codeCustomerDTO.getId(),
codeCustomerDTO.getUserVersion(), CodeConstant.OPER_SUBMIT, wxSpeedResult.getErrorMsg());
throw new RenException(wxSpeedResult.getErrorCode(), wxSpeedResult.getErrorMsg());
}
}
@ -270,8 +293,8 @@ public class CodeServiceImpl implements CodeService {
//更新代码表状态
codeCustomerDTO.setStatus(CodeConstant.AUDITING);
codeCustomerService.update(codeCustomerDTO);
saveOperation(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getId(), codeCustomerDTO.getUserVersion(), CodeConstant.OPER_SUBMIT,
"审核中");
saveOperation(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType(), codeCustomerDTO.getId(), codeCustomerDTO.getUserVersion(),
CodeConstant.OPER_SUBMIT, "审核中");
}
@Override
@ -302,8 +325,8 @@ public class CodeServiceImpl implements CodeService {
//调用微信API撤销审核
WxResult wxResult = wxMaCodeService.undoCodeAudit(authInfo.getAuthorizerAccessToken());
if (!wxResult.success()) {
saveOperation(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getId(), codeCustomerDTO.getUserVersion(), CodeConstant.OPER_UNDO,
wxResult.getErrorMsg());
saveOperation(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType(), codeCustomerDTO.getId(),
codeCustomerDTO.getUserVersion(), CodeConstant.OPER_UNDO, wxResult.getErrorMsg());
throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg());
}
//更新审核结果
@ -315,8 +338,8 @@ public class CodeServiceImpl implements CodeService {
//更新审核操作记录描述
codeOperationHistoryService.updateDescribe(codeCustomerDTO.getId(), "已撤回");
saveOperation(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getId(), codeCustomerDTO.getUserVersion(), CodeConstant.OPER_UNDO,
"成功");
saveOperation(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType(), codeCustomerDTO.getId(), codeCustomerDTO.getUserVersion(),
CodeConstant.OPER_UNDO, "成功");
}
@Override
@ -338,15 +361,18 @@ public class CodeServiceImpl implements CodeService {
//更新代码表状态
codeCustomerDTO.setStatus(CodeConstant.RELEASE_FAILED);
codeCustomerService.update(codeCustomerDTO);
saveOperation(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getId(), codeCustomerDTO.getUserVersion(), CodeConstant.OPER_RELEASE,
wxResult.getErrorMsg());
saveOperation(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType(), codeCustomerDTO.getId(),
codeCustomerDTO.getUserVersion(), CodeConstant.OPER_RELEASE, wxResult.getErrorMsg());
throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg());
}
//将之前上传信息删除
codeCustomerService.deleteCode(formDTO.getCustomerId(), codeCustomerDTO.getClientType());
//更新代码表状态
codeCustomerDTO.setStatus(CodeConstant.RELEASE_SUCCESS);
codeCustomerService.update(codeCustomerDTO);
saveOperation(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getId(), codeCustomerDTO.getUserVersion(), CodeConstant.OPER_RELEASE,
"发布成功");
saveOperation(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType(), codeCustomerDTO.getId(), codeCustomerDTO.getUserVersion(),
CodeConstant.OPER_RELEASE, "发布成功");
}
@Override
@ -522,9 +548,15 @@ public class CodeServiceImpl implements CodeService {
});
}
private void saveOperation(String customerId, String codeId, String version, String operation, String describe) {
@Override
public PageData getCustomerList(UploadListFormDTO formDTO) {
return paCustomerService.getCustomerList(formDTO);
}
private void saveOperation(String customerId, String clientType, String codeId, String version, String operation, String describe) {
CodeOperationHistoryDTO operationDTO = new CodeOperationHistoryDTO();
operationDTO.setCustomerId(customerId);
operationDTO.setClientType(clientType);
operationDTO.setCodeId(codeId);
operationDTO.setVersion(version);
operationDTO.setOperation(operation);

8
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java

@ -633,4 +633,12 @@ public class PaCustomerServiceImpl extends BaseServiceImpl<PaCustomerDao, PaCust
return result;
}
@Override
public PageData getCustomerList(UploadListFormDTO formDTO) {
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize());
List<UploadListResultDTO> list = baseDao.selectInitCustomerList(formDTO);
PageInfo<UploadListResultDTO> pageInfo = new PageInfo<>(list);
return new PageData<>(list, pageInfo.getTotal());
}
}

60
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java

@ -189,13 +189,11 @@ public class WarrantServiceImpl implements WarrantService {
Object createTime = xml.get(ModuleConstant.CREATE_TIME);
Date date = componentVerifyTicketServiceImpl.sToDate(createTime.toString());
messagePushTextFormDTO.setWeChatCreateTime(date);
// messagePushTextDao.insertMessageText(messagePushTextFormDTO);
String content = messagePushTextFormDTO.getContent();
log.info(String.format(ThirdRunTimeInfoConstant.CONTENT,content));
if(ModuleConstant.TESTCOMPONENT_MSG_TYPE_TEXT.equals(content)){
log.info("收到消息,要回复了......");
// String returnContent = content+ModuleConstant._CALL_BACK;
String returnContent = "TESTCOMPONENT_MSG_TYPE_TEXT_callback";
String returnContent = content+ModuleConstant._CALL_BACK;
log.info("拼接的回复内容【普通】:"+returnContent);
replyTextMessage(request, response, returnContent, toUserName, fromUserName);
@ -240,18 +238,21 @@ public class WarrantServiceImpl implements WarrantService {
"> 客户端:"+clientType+"\n\n"+
"> 延时原因:"+result);
break;
default:
markdown.setText("机器人生病了......");
log.info("event为:"+event);
break;
}
request.setMarkdown(markdown);
log.info("robot需要发送的内容为:"+markdown.getTitle());
log.info("robot需要发送的内容为:"+markdown.getText());
String url = "https://oapi.dingtalk.com/robot/send?access_token=2438902efbcc15909deb7076963c5cbe2d6fdbfdb9d66750faab2f2cce6eb09f";
String secret = "SECe3c785dd254659608667a4a623acc5a0395636143411617f6e36838b48941e74";
this.sendCodeMsg(request,url,secret);
}
/*
public static void main(String[] args) {
WarrantServiceImpl w = new WarrantServiceImpl();
w.dingDingRobot("审核失败","weapp_audit_fail","机器人测试","居民端");
}*/
// public static void main(String[] args) {
// WarrantServiceImpl w = new WarrantServiceImpl();
// w.dingDingRobot("审核失败","weapp_audit_fail","机器人测试","居民端");
// }
public Result<String> sendCodeMsg(OapiRobotSendRequest request,String url,String secret) {
Long timestamp = System.currentTimeMillis();
@ -263,7 +264,10 @@ public class WarrantServiceImpl implements WarrantService {
String sign = URLEncoder.encode(new String(Base64.encodeBase64(signData)), "UTF-8");
log.info("sign为:"+sign);
url = url.concat("&timestamp=" + timestamp + "&sign=" + sign);
Result<String> stringResult = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(request));
log.info("发送url:"+url);
String requestString = JSON.toJSONString(request);
log.info("发送内容:"+requestString);
Result<String> stringResult = HttpClientManager.getInstance().sendPostByJSON(url, requestString);
log.info("robot发送消息结果为:"+stringResult.getData());
return stringResult;
} catch (Exception e) {
@ -294,22 +298,6 @@ public class WarrantServiceImpl implements WarrantService {
replyTextMessage(request, response, content, toUserName, fromUserName);
}
/**
* 立马回应文本消息并最终触达粉丝
* @param content 文本
* @param toUserName 发送接收人
* @param fromUserName 发送人
* @author zxc
*/
public void processTextMessage(HttpServletRequest request, HttpServletResponse response,
String content,String toUserName, String fromUserName)
throws IOException, DocumentException{
}
/**
* 方法描述: 直接返回给微信开放平台
* @param request
@ -383,24 +371,4 @@ public class WarrantServiceImpl implements WarrantService {
log.info("客服发送接口返回值:"+data);
}
/**
* 方法描述: 返回数据到请求方
* @param data 数据
* @param response
* @author zxc
*/
public void returnJSON(Object data,HttpServletResponse response) {
try {
ObjectMapper objectMapper = new ObjectMapper();
JsonEncoding encoding = JsonEncoding.UTF8;
response.setContentType(ModuleConstant.APPLICATION_JSON);
JsonGenerator generator = objectMapper.getJsonFactory().
createJsonGenerator(response.getOutputStream(), encoding);
objectMapper.writeValue(generator, data);
} catch (Exception e) {
e.printStackTrace();
}
}
}

8
epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.6__thirdUpdate.sql

@ -0,0 +1,8 @@
alter table code_customer add RELEASE_TYPE varchar(10) NULL comment '发布模式 gary:分阶段发布,total:全量发布' after QR_CODE;
alter table code_customer add GARY_PERCENTAGE int(11) NULL comment '灰度值' after RELEASE_TYPE;
alter table code_customer add COMMIT_TIME datetime NULL comment '上传时间' after GARY_PERCENTAGE;
alter table code_customer add AUDIT_TIME datetime NULL comment '提交审核时间' after COMMIT_TIME;
alter table code_customer add RELEASE_TIME datetime NULL comment '发布时间' after AUDIT_TIME;
alter table code_operation_history add CLIENT_TYPE datetime NULL comment '小程序类型 居民端resi,工作端work' after CUSTOMER_ID;

61
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml

@ -21,6 +21,7 @@
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="selectCodeList" resultType="com.epmet.dto.result.UploadListResultDTO" parameterType="com.epmet.dto.form.UploadListFormDTO">
SELECT
cc.ID,
@ -86,7 +87,7 @@
AND template_id = #{templateId}
</select>
<select id="selectAuditingCodeList" resultType="com.epmet.dto.CodeCustomerDTO">
select * FROM code_customer WHERE DEL_FLAG = '0' AND STATUS = 'auditing' AND SOURCE = #{source}
select * FROM code_customer WHERE DEL_FLAG = '0' AND STATUS = 'auditing' AND SOURCE = #{source}
</select>
<select id="selectUploadCodeByCustomer" resultType="com.epmet.dto.CodeCustomerDTO">
SELECT
@ -103,7 +104,63 @@
DEL_FLAG = '1'
WHERE CUSTOMER_ID = #{customerId}
AND CLIENT_TYPE = #{clientType}
AND STATUS = 'release_success'
AND DEL_FLAG = '0'
</update>
<select id="selectCommitInfo" resultType="com.epmet.dto.CodeCustomerDTO">
SELECT ID,
USER_VERSION,
USER_DESC,
TEMPLATE_ID,
COMMIT_TIME
FROM code_customer
WHERE CUSTOMER_ID = #{customerId}
AND CLIENT_TYPE = #{clientType}
AND STATUS = 'unaudited'
AND DEL_FLAG = '0'
</select>
<select id="selectAuditInfo" resultType="com.epmet.dto.CodeCustomerDTO">
SELECT ID,
USER_VERSION,
USER_DESC,
COMMIT_TIME,
AUDIT_TIME,
STATUS
FROM code_customer
WHERE CUSTOMER_ID = #{customerId}
AND CLIENT_TYPE = #{clientType}
AND (STATUS = 'auditing' OR STATUS = 'audit_success' OR STATUS = 'audit_failed' OR STATUS = 'withdrawn' OR STATUS = 'delay' OR STATUS = 'release_failed')
AND DEL_FLAG = '0'
</select>
<select id="selectReleaseInfo" resultType="com.epmet.dto.CodeCustomerDTO">
SELECT ID,
USER_VERSION,
USER_DESC,
COMMIT_TIME,
AUDIT_TIME,
RELEASE_TIME,
RELEASE_TYPE,
GARY_PERCENTAGE
FROM code_customer
WHERE CUSTOMER_ID = #{customerId}
AND CLIENT_TYPE = #{clientType}
AND STATUS = 'release_success'
AND DEL_FLAG = '0'
</select>
<select id="selectLastVersion" resultType="com.epmet.dto.CodeCustomerDTO">
SELECT ID
FROM code_customer
WHERE CUSTOMER_ID = #{customerId}
AND CLIENT_TYPE = #{clientType}
AND STATUS = 'release_success'
AND DEL_FLAG = '1'
ORDER BY RELEASE_TIME DESC
LIMIT 1
</select>
<update id="updateVersion">
UPDATE code_customer
SET
DEL_FLAG = '0'
WHERE ID = #{codeId}
</update>
</mapper>

20
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerDao.xml

@ -81,6 +81,26 @@
del_flag = 0
AND id = #{customerId}
</select>
<select id="selectInitCustomerList" resultType="com.epmet.dto.result.UploadListResultDTO" parameterType="com.epmet.dto.form.UploadListFormDTO">
SELECT pc.ID AS "customerId",
pc.CUSTOMER_NAME,
ai.CLIENT_TYPE,
ai.AUTHORIZER_APPID AS "appId"
FROM pa_customer pc
INNER JOIN authorization_info ai ON pc.ID = ai.CUSTOMER_ID AND ai.DEL_FLAG = 0
WHERE pc.DEL_FLAG = 0
AND pc.SOURCE = #{source}
AND pc.IS_INITIALIZE = 1
<if test="customerId != null and customerId.trim() != ''">
AND pc.ID = #{customerId}
</if>
<if test="clientType != null and clientType.trim() != ''">
AND ai.CLIENT_TYPE = #{clientType}
</if>
ORDER BY
pc.CUSTOMER_NAME,
ai.CLIENT_TYPE
</select>
<select id="selectCustomerAndUser" resultType="com.epmet.dto.result.CustomerAndUserResultDTO">
SELECT

Loading…
Cancel
Save