字典管理

资源管理
资源类型管理
团购卷订单管理
团购卷订单退款
团购卷商品(套餐商品修改与保存)
This commit is contained in:
2024-05-15 16:32:34 +08:00
parent a4cbb3798e
commit 6ba4aadccb
49 changed files with 1778 additions and 393 deletions

View File

@@ -2,6 +2,8 @@ package cn.ysk.cashier.config;
import cn.ysk.cashier.utils.FastJsonUtils;
import cn.ysk.cashier.utils.SpringContextHolder;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.ProceedingJoinPoint;
@@ -42,6 +44,7 @@ public class AppApiMethodAspect {
Map<String, Object> params = new HashMap<>();
Object result = null;
String requestJson="";
try {
// 获取方法参数
Object[] args = pjp.getArgs();
@@ -49,37 +52,42 @@ public class AppApiMethodAspect {
for (int i = 0; i < args.length; i++) {
params.put(paramNames[i], FastJsonUtils.toJSONString(args[i]));
}
requestJson=FastJsonUtils.toJSONString(params);
// 执行被拦截的方法
result = pjp.proceed();
String resultJson = FastJsonUtils.toJSONString(result);
if (resultJson.length() > 300) {
resultJson = resultJson.substring(0, 300);
}
log.info("\n>>>>>>{} {}\n>>>>>>{}\n>>>>>>Request: {}\n>>>>>>Response: {}"
, req.getMethod(), req.getRequestURL(), req.getRemoteAddr(),
FastJsonUtils.toJSONString(params),
FastJsonUtils.toJSONString(result)
requestJson,
resultJson
);
return result;
} catch (RuntimeException e) {
if (StringUtils.isBlank(e.getMessage())) {
log.error("\n>>>>>>{} {}\n>>>>>>{}\n>>>>>>Request: {}\n>>>>>>Exception: {}"
log.error("\n>>>>>>{} {} {}\n>>>>>>Request: {}\n>>>>>>Exception: {}"
, req.getMethod(), req.getRequestURL(), req.getRemoteAddr(),
FastJsonUtils.toJSONString(params),
requestJson,
e);
} else {
log.error("\n>>>>>>{} {}\n>>>>>>{}\n>>>>>>Request: {}\n>>>>>>Exception: {}"
log.error("\n>>>>>>{} {} {}\n>>>>>>Request: {}\n>>>>>>Exception: {}"
, req.getMethod(), req.getRequestURL(), req.getRemoteAddr(),
FastJsonUtils.toJSONString(params),
requestJson,
e.getMessage());
}
throw e;
} catch (Error e) {
log.error("\n>>>>>>{} {}\n>>>>>>{}\n>>>>>>Request: {}\n>>>>>>Exception: {}"
log.error("\n>>>>>>{} {} {}\n>>>>>>Request: {}\n>>>>>>Exception: {}"
, req.getMethod(), req.getRequestURL(), req.getRemoteAddr(),
FastJsonUtils.toJSONString(params),
requestJson,
e);
throw e;
} catch (Throwable e) {
log.error("\n>>>>>>{} {}\n>>>>>>{}\n>>>>>>Request: {}\n>>>>>>Exception: {}"
log.error("\n>>>>>>{} {} {}\n>>>>>>Request: {}\n>>>>>>Exception: {}"
, req.getMethod(), req.getRequestURL(), req.getRemoteAddr(),
FastJsonUtils.toJSONString(params),
requestJson,
e);
throw new RuntimeException(e);
}