Commit 56714b5d authored by yanzg's avatar yanzg

修改公式和计算帮助类

parent a6d551eb
...@@ -245,10 +245,10 @@ public class BaseRequestAspect { ...@@ -245,10 +245,10 @@ public class BaseRequestAspect {
// 日志请求不记录,防止死循环递归 // 日志请求不记录,防止死循环递归
boolean isLog = isLog(name, log.getActionSubKey()); boolean isLog = isLog(name, log.getActionSubKey());
if (isLog) { if (isLog) {
return; logLocal.remove(log);
} else {
logLocal.result(log, responseResult.getCode(), JsonHelper.serialize(responseResult));
} }
// 正常请求不记录
logLocal.result(log, responseResult.getCode(), JsonHelper.serialize(responseResult));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
......
...@@ -88,7 +88,7 @@ public class LogLocal implements ThreadNext.Next, InitializingBean { ...@@ -88,7 +88,7 @@ public class LogLocal implements ThreadNext.Next, InitializingBean {
*/ */
public void result(LogVo log, String status, String result) { public void result(LogVo log, String status, String result) {
Timeout<LogVo> timeout = cache.get(log.getLogId()); Timeout<LogVo> timeout = cache.get(log.getLogId());
result(timeout, log, status, result); result(timeout, log, status, result, true);
} }
/** /**
...@@ -98,7 +98,7 @@ public class LogLocal implements ThreadNext.Next, InitializingBean { ...@@ -98,7 +98,7 @@ public class LogLocal implements ThreadNext.Next, InitializingBean {
* @param result * @param result
* @return * @return
*/ */
public void result(Timeout timeout, LogVo log, String status, String result) { private void result(Timeout timeout, LogVo log, String status, String result, boolean write) {
if (timeout != null) { if (timeout != null) {
long useTime = System.currentTimeMillis() - timeout.getStart(); long useTime = System.currentTimeMillis() - timeout.getStart();
log.setUseTime((int) useTime); log.setUseTime((int) useTime);
...@@ -108,7 +108,19 @@ public class LogLocal implements ThreadNext.Next, InitializingBean { ...@@ -108,7 +108,19 @@ public class LogLocal implements ThreadNext.Next, InitializingBean {
if (!StringHelper.compare(status, MAX_TIME)) { if (!StringHelper.compare(status, MAX_TIME)) {
cache.remove(log.getLogId()); cache.remove(log.getLogId());
} }
logBase.addLog(log); if (write) {
logBase.addLog(log);
}
}
/**
* 删除请求信息
*
* @param log
*/
public void remove(LogVo log) {
Timeout<LogVo> timeout = cache.get(log.getLogId());
result(timeout, log, StringHelper.EMPTY, StringHelper.EMPTY, false);
} }
/** /**
...@@ -117,7 +129,7 @@ public class LogLocal implements ThreadNext.Next, InitializingBean { ...@@ -117,7 +129,7 @@ public class LogLocal implements ThreadNext.Next, InitializingBean {
* @return * @return
*/ */
private void writeTimeout(Timeout<LogVo> timeout) { private void writeTimeout(Timeout<LogVo> timeout) {
result(timeout, timeout.getData(), MAX_TIME, MAX_TIME_NAME); result(timeout, timeout.getData(), MAX_TIME, MAX_TIME_NAME, true);
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment