商品模块代码提交
This commit is contained in:
@@ -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;
|
||||
@@ -119,7 +120,7 @@ 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) {
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
@@ -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, "[]"));
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONWriter;
|
||||
import com.czg.enums.DeleteEnum;
|
||||
import com.czg.enums.YesNoEnum;
|
||||
import com.czg.exception.CzgException;
|
||||
@@ -124,13 +125,14 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
}
|
||||
|
||||
Product entity = BeanUtil.copyProperties(dto, Product.class);
|
||||
entity.setImages(JSON.toJSONString(dto.getImages()));
|
||||
entity.setImages(JSON.toJSONString(dto.getImages(), JSONWriter.Feature.WriteMapNullValue));
|
||||
entity.setGroupSnap("[]");
|
||||
//套餐
|
||||
if (ProductTypeEnum.PACKAGE.value().equals(dto.getType())) {
|
||||
//套餐内容
|
||||
if (CollUtil.isNotEmpty(dto.getProGroupVo())) {
|
||||
entity.setGroupSnap(JSON.toJSONString(dto.getProGroupVo()));
|
||||
String groupSnap = JSON.toJSONString(dto.getProGroupVo(), JSONWriter.Feature.WriteMapNullValue);
|
||||
entity.setGroupSnap(groupSnap);
|
||||
}
|
||||
}
|
||||
entity.setIsDel(DeleteEnum.NORMAL.value());
|
||||
@@ -163,13 +165,13 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
throw new CzgException("商品已存在");
|
||||
}
|
||||
Product entity = BeanUtil.copyProperties(dto, Product.class);
|
||||
entity.setImages(JSON.toJSONString(dto.getImages()));
|
||||
entity.setImages(JSON.toJSONString(dto.getImages(), JSONWriter.Feature.WriteMapNullValue));
|
||||
entity.setGroupSnap("[]");
|
||||
//套餐
|
||||
if (ProductTypeEnum.PACKAGE.value().equals(dto.getType())) {
|
||||
//套餐内容
|
||||
if (CollUtil.isNotEmpty(dto.getProGroupVo())) {
|
||||
entity.setGroupSnap(JSON.toJSONString(dto.getProGroupVo()));
|
||||
entity.setGroupSnap(JSON.toJSONString(dto.getProGroupVo(), JSONWriter.Feature.WriteMapNullValue));
|
||||
}
|
||||
}
|
||||
entity.setIsDel(DeleteEnum.NORMAL.value());
|
||||
|
||||
Reference in New Issue
Block a user