商品模块代码提交

This commit is contained in:
Tankaikai
2025-02-18 15:17:45 +08:00
parent 78d7c32638
commit f8658d3386
3 changed files with 16 additions and 9 deletions

View File

@@ -7,6 +7,7 @@ import cn.hutool.extra.servlet.JakartaServletUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.JSONWriter;
import com.czg.log.annotation.OperationLog;
import com.czg.log.enums.LogTypeEnum;
import com.czg.log.enums.OperationStatusEnum;
@@ -99,7 +100,7 @@ public class OperationLogAspect {
log.set("shopId", shopId);
log.set("type", LogTypeEnum.INFO.value());
if(StrUtil.isNotBlank(errorInfo)){
if (StrUtil.isNotBlank(errorInfo)) {
log.set("type", LogTypeEnum.ERROR.value());
}
log.set("status", status);
@@ -119,10 +120,10 @@ public class OperationLogAspect {
Object[] args = joinPoint.getArgs();
Map<String, String> param = JakartaServletUtil.getParamMap(request);
try {
String params = JSON.toJSONString(args[0]);
String params = JSON.toJSONString(args[0], JSONWriter.Feature.WriteMapNullValue);
log.set("requestParams", params);
boolean isJsonObject = JSONUtil.isTypeJSONObject(params);
if(isJsonObject){
if (isJsonObject) {
JSONObject reqData = JSON.parseObject(params);
param.forEach(reqData::putIfAbsent);
log.set("requestParams", reqData.toJSONString());
@@ -132,6 +133,6 @@ public class OperationLogAspect {
}
log.set("id", new SnowFlakeIDKeyGenerator().nextId());
//保存到Redis队列里
logProducer.saveLog(JSON.toJSONString(log.toUnderlineKeysMap()));
logProducer.saveLog(JSON.toJSONString(log.toUnderlineKeysMap(), JSONWriter.Feature.WriteMapNullValue));
}
}

View File

@@ -104,7 +104,7 @@ public class ProductDTO implements Serializable {
/**
* 套餐内容
*/
private String groupSnap;
private Object groupSnap;
/**
* 库存警戒线
*/
@@ -222,4 +222,8 @@ public class ProductDTO implements Serializable {
public Object getSelectSpecInfo() {
return JSON.parseObject(Convert.toStr(selectSpecInfo, "{}"));
}
public Object getGroupSnap() {
return JSON.parseArray(Convert.toStr(groupSnap, "[]"));
}
}