Преглед изворни кода

Merge branch 'master' of http://47.100.37.243:10080/wutt/manHourHousekeeper

# Conflicts:
#	fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/util/CodeGenerator.java
wutt пре 5 година
родитељ
комит
7ea10161fe

+ 21 - 6
fhKeeper/formulahousekeeper/management-platform/pom.xml

@@ -81,13 +81,28 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-test</artifactId>
         </dependency>
+        <!--开启aop支持-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-aop</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-logging</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.aspectj</groupId>
+            <artifactId>aspectjweaver</artifactId>
+        </dependency>
 
-<!--        &lt;!&ndash; https://mvnrepository.com/artifact/at.bestsolution.efxclipse.eclipse/com.google.gson &ndash;&gt;-->
-<!--        <dependency>-->
-<!--            <groupId>at.bestsolution.efxclipse.eclipse</groupId>-->
-<!--            <artifactId>com.google.gson</artifactId>-->
-<!--            <version>2.2.4</version>-->
-<!--        </dependency>-->
+        <!--        &lt;!&ndash; https://mvnrepository.com/artifact/at.bestsolution.efxclipse.eclipse/com.google.gson &ndash;&gt;-->
+        <!--        <dependency>-->
+        <!--            <groupId>at.bestsolution.efxclipse.eclipse</groupId>-->
+        <!--            <artifactId>com.google.gson</artifactId>-->
+        <!--            <version>2.2.4</version>-->
+        <!--        </dependency>-->
 
 
     </dependencies>

+ 67 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/aop/AopLogConfiguration.java

@@ -0,0 +1,67 @@
+package com.management.platform.aop;
+
+import lombok.extern.slf4j.Slf4j;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.*;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
+
+/**
+ * Author: 吴涛涛 cuiyi@itany.com
+ * Date : 2019 - 08 - 30 13:59
+ * Description:<描述> 开启aop配置
+ * Version: 1.0
+ */
+@Slf4j
+@Aspect
+@Configuration
+public class AopLogConfiguration {
+    //切入点表达式
+    @Pointcut("execution(public * com.management.*.service.*.*(..)) || execution(public * com.management.*.controller.*.*(..))")
+    public void logPointcut(){
+
+    }
+
+    /**
+     * 前置通知
+     */
+    @Before("logPointcut()")
+    public void  methodBefore(JoinPoint joinPoint){
+        ServletRequestAttributes requestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
+        HttpServletRequest request = requestAttributes.getRequest();
+        //打印请求内容
+        log.info("---------------请求内容---------------");
+        log.info("请求地址:"+request.getRequestURL().toString());
+        log.info("请求方式:"+request.getMethod());
+        log.info("请求类方法:"+joinPoint.getSignature().getName());
+        log.info("请求类方法参数:"+ Arrays.toString(joinPoint.getArgs()));
+        log.info("---------------请求内容---------------");
+    }
+
+    /**
+     * 后置通知
+     */
+    @AfterReturning(returning = "o",pointcut = "logPointcut()")
+    public void methodAfterReturning(Object o){
+        log.info("===============返回内容===============");
+        log.info("返回的内容:"+ o.toString());
+        log.info("===============返回内容===============");
+    }
+
+    /**
+     * 异常通知
+     */
+    @AfterThrowing(pointcut = "logPointcut()",throwing = "e")
+    public void logThrowing(JoinPoint joinPoint,Throwable e){
+        log.info("***************抛出异常***************");
+
+        log.info("请求类方法:"+joinPoint.getSignature().getName());
+        log.info("异常内容:"+e);
+        log.info("***************抛出异常***************");
+    }
+
+}

+ 1 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ScreenshotController.java

@@ -15,8 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
  */
 @RestController
 @RequestMapping("/screenshot")
-public class 
-creenshotController {
+public class ScreenshotController {
 
 }
 

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Report.java

@@ -60,7 +60,7 @@ public class Report extends Model<Report> {
     /**
      * 报告内容
      */
-    @TableField("content", insertStrategy = FieldStrategy.IGNORED)
+    @TableField(value = "content", insertStrategy = FieldStrategy.IGNORED)
     private String content;
 
     /**