src/main/java/com/moon/server/aspect/LogAspect.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/moon/server/interceptor/ProxyFilter.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/moon/server/aspect/LogAspect.java
@@ -3,6 +3,7 @@ import com.moon.server.annotation.SysLog; import com.moon.server.entity.sys.OperateEntity; import com.moon.server.entity.sys.UserEntity; import com.moon.server.helper.AsyncHelper; import com.moon.server.helper.WebHelper; import com.moon.server.service.sys.OperateService; import com.moon.server.service.sys.TokenService; @@ -19,6 +20,7 @@ import javax.servlet.http.HttpServletRequest; import java.lang.reflect.Method; import java.util.TimerTask; /** * 日志切面类 @@ -115,7 +117,14 @@ oe.setUserid(ue.getId()); } operateService.insertOperate(oe); // operateService.insertOperate(oe) AsyncHelper helper = new AsyncHelper(); helper.execute(new TimerTask() { @Override public void run() { operateService.insertOperate(oe); } }); } catch (Exception ex) { log.error(ex.getMessage(), ex); } src/main/java/com/moon/server/interceptor/ProxyFilter.java
@@ -8,6 +8,7 @@ import com.moon.server.entity.sys.TokenEntity; import com.moon.server.entity.sys.UserEntity; import com.moon.server.helper.AsyncHelper; import com.moon.server.helper.HttpHelper; import com.moon.server.helper.StringHelper; import com.moon.server.helper.WebHelper; import com.moon.server.service.all.PermsService; @@ -71,6 +72,8 @@ } insertLog(req, ue, resId); String url = getSourceUrl(req, resId); proxy(req, res, url); } catch (Exception ex) { log.error(ex.getMessage(), ex); } @@ -248,4 +251,20 @@ return -1; } } /** * 获取原始Url */ private String getSourceUrl(HttpServletRequest req, int resId) { return ""; } /** * 代理服务 */ private void proxy(HttpServletRequest request, HttpServletResponse response, String url) throws Exception { HttpHelper httpHelper = new HttpHelper(); httpHelper.service(request, response, url, null); } }