Commit 56714b5d authored by yanzg's avatar yanzg

修改公式和计算帮助类

parent a6d551eb
......@@ -245,10 +245,10 @@ public class BaseRequestAspect {
// 日志请求不记录,防止死循环递归
boolean isLog = isLog(name, log.getActionSubKey());
if (isLog) {
return;
}
// 正常请求不记录
logLocal.remove(log);
} else {
logLocal.result(log, responseResult.getCode(), JsonHelper.serialize(responseResult));
}
} catch (Exception e) {
e.printStackTrace();
} finally {
......
......@@ -88,7 +88,7 @@ public class LogLocal implements ThreadNext.Next, InitializingBean {
*/
public void result(LogVo log, String status, String result) {
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 {
* @param result
* @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) {
long useTime = System.currentTimeMillis() - timeout.getStart();
log.setUseTime((int) useTime);
......@@ -108,8 +108,20 @@ public class LogLocal implements ThreadNext.Next, InitializingBean {
if (!StringHelper.compare(status, MAX_TIME)) {
cache.remove(log.getLogId());
}
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 {
* @return
*/
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