From 906e819de11a4f2a47545aff9fc551abd811adb5 Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Sat, 09 Jun 2018 12:16:59 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/main/java/com/moral/entity/MonitorPoint.java    |    3 +
 src/main/java/com/moral/security/WebLogAspect.java  |   59 +++++++++++++++++++++++++++++
 src/main/resources/i18n/exceptions_en_US.properties |    8 ++++
 3 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/moral/entity/MonitorPoint.java b/src/main/java/com/moral/entity/MonitorPoint.java
index 5909997..89cba1f 100644
--- a/src/main/java/com/moral/entity/MonitorPoint.java
+++ b/src/main/java/com/moral/entity/MonitorPoint.java
@@ -101,4 +101,7 @@
     private AreaNames areaNames;
     @Transient
     private Organization organization;
+
+    private Integer town_code;
+    private Integer village_code;
 }
\ No newline at end of file
diff --git a/src/main/java/com/moral/security/WebLogAspect.java b/src/main/java/com/moral/security/WebLogAspect.java
new file mode 100644
index 0000000..af535d6
--- /dev/null
+++ b/src/main/java/com/moral/security/WebLogAspect.java
@@ -0,0 +1,59 @@
+package com.moral.security;
+
+import java.util.Arrays;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.AfterReturning;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.annotation.Pointcut;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+@Aspect
+@Component
+public class WebLogAspect {
+
+    private static final Logger LOG = LoggerFactory.getLogger(WebLogAspect.class);
+
+    @Pointcut("execution(public * com.moral.controller.*.*(..))")//������..������������������������������������������������..������������������
+    public void logPointCut() {
+    }
+
+    @Before("logPointCut()")
+    public void doBefore(JoinPoint joinPoint) throws Throwable {
+        // ������������������������������������
+        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+        HttpServletRequest request = attributes.getRequest();
+
+        // ���������������������
+        LOG.info("������������ : " + request.getRequestURL().toString());
+        LOG.info("HTTP METHOD : " + request.getMethod());
+        LOG.info("IP : " + request.getRemoteAddr());
+        LOG.info("CLASS_METHOD : " + joinPoint.getSignature().getDeclaringTypeName() + "."
+                + joinPoint.getSignature().getName());
+        LOG.info("������ : " + Arrays.toString(joinPoint.getArgs()));
+
+    }
+
+    @AfterReturning(returning = "ret", pointcut = "logPointCut()")// returning���������doAfterReturning������������������
+    public void doAfterReturning(Object ret) throws Throwable {
+        // ������������������������������
+        LOG.info("��������� : " + ret);
+    }
+
+    @Around("logPointCut()")
+    public Object doAround(ProceedingJoinPoint pjp) throws Throwable {
+        long startTime = System.currentTimeMillis();
+        Object ob = pjp.proceed();// ob ���������������������
+        LOG.info("������ : " + (System.currentTimeMillis() - startTime));
+        return ob;
+    }
+}
\ No newline at end of file
diff --git a/src/main/resources/i18n/exceptions_en_US.properties b/src/main/resources/i18n/exceptions_en_US.properties
new file mode 100644
index 0000000..9657a28
--- /dev/null
+++ b/src/main/resources/i18n/exceptions_en_US.properties
@@ -0,0 +1,8 @@
+param.is.null=param.is.null
+name.is.null=name.is.null
+value.is.null=value.is.null
+id.error=id.error{0}
+
+name.repeat=name.repeat
+
+no.permission=no.permission
\ No newline at end of file

--
Gitblit v1.8.0