From 567bda85a658740dd502e175d280ecac096df2e6 Mon Sep 17 00:00:00 2001
From: Loki <654612@qq.com>
Date: Mon, 5 Dec 2022 13:30:14 +0800
Subject: [PATCH] =?UTF-8?q?:-1:=20=E5=88=A0=E9=99=A4dubbo=20=E4=BF=AE?=
=?UTF-8?q?=E5=A4=8D=E6=9C=AC=E5=9C=B0=E5=9F=9F=E5=90=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../yudao-spring-boot-starter-web/pom.xml | 12 +-
.../core/handler/GlobalExceptionHandler.java | 10 +-
.../yudao/server/YudaoServerApplication.java | 1 -
.../src/main/resources/application-local.yaml | 2 +-
.../app/common/aspect/AppLogAspect.java | 202 +++++++++---------
5 files changed, 113 insertions(+), 114 deletions(-)
diff --git a/yudao-framework/yudao-spring-boot-starter-web/pom.xml b/yudao-framework/yudao-spring-boot-starter-web/pom.xml
index 43261b87..11a1b82d 100644
--- a/yudao-framework/yudao-spring-boot-starter-web/pom.xml
+++ b/yudao-framework/yudao-spring-boot-starter-web/pom.xml
@@ -59,12 +59,12 @@
resilience4j-ratelimiter
provided
-
- org.apache.dubbo
- dubbo
- 3.0.9
- compile
-
+
+
+
+
+
+
diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java
index b2ffaca3..7b0a6382 100644
--- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java
+++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java
@@ -17,7 +17,7 @@ import io.github.resilience4j.ratelimiter.RequestNotPermitted;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.exception.ExceptionUtils;
-import org.apache.dubbo.rpc.RpcException;
+//import org.apache.dubbo.rpc.RpcException;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.util.Assert;
import org.springframework.validation.BindException;
@@ -96,10 +96,10 @@ public class GlobalExceptionHandler {
return accessDeniedExceptionHandler(request, (AccessDeniedException) ex);
}
- if (ex instanceof RpcException){
- log.error("dubbo错误", ex);
- return null;
- }
+// if (ex instanceof RpcException){
+// log.error("dubbo错误", ex);
+// return null;
+// }
return defaultExceptionHandler(request, ex);
}
diff --git a/yudao-server/src/main/java/cn/iocoder/yudao/server/YudaoServerApplication.java b/yudao-server/src/main/java/cn/iocoder/yudao/server/YudaoServerApplication.java
index a43a35ee..ae3f8f2c 100644
--- a/yudao-server/src/main/java/cn/iocoder/yudao/server/YudaoServerApplication.java
+++ b/yudao-server/src/main/java/cn/iocoder/yudao/server/YudaoServerApplication.java
@@ -1,6 +1,5 @@
package cn.iocoder.yudao.server;
-import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.system.ApplicationHome;
diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml
index 8f17baf6..2a1963dd 100644
--- a/yudao-server/src/main/resources/application-local.yaml
+++ b/yudao-server/src/main/resources/application-local.yaml
@@ -270,7 +270,7 @@ dubbo:
bxg:
shop:
# API_URL: http://192.168.10.113:48080/bxgApp
- API_URL: http://45288535.r5.cpolar.top
+ API_URL: http://yudao.test.yixinhuixiang.com
SITE_URL: http://192.168.10.113:48080/bxgApp
UNI_SITE_URL: http://192.168.10.113:48080/bxgApp
ADMIN_API_URL: http://192.168.10.113:48080/bxg
diff --git a/zsw-bxg/src/main/java/co/yixiang/app/common/aspect/AppLogAspect.java b/zsw-bxg/src/main/java/co/yixiang/app/common/aspect/AppLogAspect.java
index 0d5e96ff..07080021 100644
--- a/zsw-bxg/src/main/java/co/yixiang/app/common/aspect/AppLogAspect.java
+++ b/zsw-bxg/src/main/java/co/yixiang/app/common/aspect/AppLogAspect.java
@@ -1,101 +1,101 @@
-/**
- * Copyright (C) 2018-2022
- * All rights reserved, Designed By www.yixiang.co
-
- */
-package co.yixiang.app.common.aspect;
-
-import co.yixiang.app.common.bean.LocalUser;
-import co.yixiang.logging.domain.Log;
-import co.yixiang.logging.service.LogService;
-import co.yixiang.utils.RequestHolder;
-import co.yixiang.utils.StringUtils;
-import co.yixiang.utils.ThrowableUtil;
-import lombok.extern.slf4j.Slf4j;
-import org.aspectj.lang.JoinPoint;
-import org.aspectj.lang.ProceedingJoinPoint;
-import org.aspectj.lang.annotation.AfterThrowing;
-import org.aspectj.lang.annotation.Around;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.Pointcut;
-import org.springframework.stereotype.Component;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * @author hupeng
- * @date 2018-11-24
- */
-@Component
-@Aspect
-@Slf4j
-public class AppLogAspect {
-
- private final LogService logService;
-
- ThreadLocal currentTime = new ThreadLocal<>();
-
- public AppLogAspect(LogService logService) {
- this.logService = logService;
- }
-
- /**
- * 配置切入点
- */
- @Pointcut("@annotation(co.yixiang.logging.aop.log.AppLog)")
- public void logPointcut() {
- // 该方法无方法体,主要为了让同类中其他方法使用此切入点
- }
-
- /**
- * 配置环绕通知,使用在方法logPointcut()上注册的切入点
- *
- * @param joinPoint join point for advice
- */
- @Around("logPointcut()")
- public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable {
- Object result;
- currentTime.set(System.currentTimeMillis());
- result = joinPoint.proceed();
- Log log = new Log("INFO",System.currentTimeMillis() - currentTime.get());
- currentTime.remove();
- HttpServletRequest request = RequestHolder.getHttpServletRequest();
- logService.saveApp(getUsername(),
- StringUtils.getIp(RequestHolder.getHttpServletRequest()),joinPoint,
- log,getUid());
- return result;
- }
-
- /**
- * 配置异常通知
- *
- * @param joinPoint join point for advice
- * @param e exception
- */
- @AfterThrowing(pointcut = "logPointcut()", throwing = "e")
- public void logAfterThrowing(JoinPoint joinPoint, Throwable e) {
- Log log = new Log("ERROR",System.currentTimeMillis() - currentTime.get());
- currentTime.remove();
- log.setExceptionDetail(ThrowableUtil.getStackTrace(e).getBytes());
- HttpServletRequest request = RequestHolder.getHttpServletRequest();
- logService.save(getUsername(),
- StringUtils.getIp(RequestHolder.getHttpServletRequest()),
- (ProceedingJoinPoint)joinPoint, log,getUid());
- }
-
- public String getUsername() {
- try {
- return LocalUser.getUser().getUsername();
- }catch (Exception e){
- return "";
- }
- }
-
- public Long getUid(){
- try {
- return LocalUser.getUser().getUid();
- }catch (Exception e){
- return 0L;
- }
- }
-}
+///**
+// * Copyright (C) 2018-2022
+// * All rights reserved, Designed By www.yixiang.co
+//
+// */
+//package co.yixiang.app.common.aspect;
+//
+//import co.yixiang.app.common.bean.LocalUser;
+//import co.yixiang.logging.domain.Log;
+//import co.yixiang.logging.service.LogService;
+//import co.yixiang.utils.RequestHolder;
+//import co.yixiang.utils.StringUtils;
+//import co.yixiang.utils.ThrowableUtil;
+//import lombok.extern.slf4j.Slf4j;
+//import org.aspectj.lang.JoinPoint;
+//import org.aspectj.lang.ProceedingJoinPoint;
+//import org.aspectj.lang.annotation.AfterThrowing;
+//import org.aspectj.lang.annotation.Around;
+//import org.aspectj.lang.annotation.Aspect;
+//import org.aspectj.lang.annotation.Pointcut;
+//import org.springframework.stereotype.Component;
+//
+//import javax.servlet.http.HttpServletRequest;
+//
+///**
+// * @author hupeng
+// * @date 2018-11-24
+// */
+//@Component
+//@Aspect
+//@Slf4j
+//public class AppLogAspect {
+//
+// private final LogService logService;
+//
+// ThreadLocal currentTime = new ThreadLocal<>();
+//
+// public AppLogAspect(LogService logService) {
+// this.logService = logService;
+// }
+//
+// /**
+// * 配置切入点
+// */
+// @Pointcut("@annotation(co.yixiang.logging.aop.log.AppLog)")
+// public void logPointcut() {
+// // 该方法无方法体,主要为了让同类中其他方法使用此切入点
+// }
+//
+// /**
+// * 配置环绕通知,使用在方法logPointcut()上注册的切入点
+// *
+// * @param joinPoint join point for advice
+// */
+// @Around("logPointcut()")
+// public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable {
+// Object result;
+// currentTime.set(System.currentTimeMillis());
+// result = joinPoint.proceed();
+// Log log = new Log("INFO",System.currentTimeMillis() - currentTime.get());
+// currentTime.remove();
+// HttpServletRequest request = RequestHolder.getHttpServletRequest();
+// logService.saveApp(getUsername(),
+// StringUtils.getIp(RequestHolder.getHttpServletRequest()),joinPoint,
+// log,getUid());
+// return result;
+// }
+//
+// /**
+// * 配置异常通知
+// *
+// * @param joinPoint join point for advice
+// * @param e exception
+// */
+// @AfterThrowing(pointcut = "logPointcut()", throwing = "e")
+// public void logAfterThrowing(JoinPoint joinPoint, Throwable e) {
+// Log log = new Log("ERROR",System.currentTimeMillis() - currentTime.get());
+// currentTime.remove();
+// log.setExceptionDetail(ThrowableUtil.getStackTrace(e).getBytes());
+// HttpServletRequest request = RequestHolder.getHttpServletRequest();
+// logService.save(getUsername(),
+// StringUtils.getIp(RequestHolder.getHttpServletRequest()),
+// (ProceedingJoinPoint)joinPoint, log,getUid());
+// }
+//
+// public String getUsername() {
+// try {
+// return LocalUser.getUser().getUsername();
+// }catch (Exception e){
+// return "";
+// }
+// }
+//
+// public Long getUid(){
+// try {
+// return LocalUser.getUser().getUid();
+// }catch (Exception e){
+// return 0L;
+// }
+// }
+//}