Merge branch 'master' into prod

This commit is contained in:
2025-03-27 11:31:45 +08:00
2 changed files with 16 additions and 2 deletions

View File

@@ -2,6 +2,8 @@ package com.czg.controller.admin;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import com.czg.annotation.SaStaffCheckPermission;
import com.czg.config.RabbitPublisher;
import com.czg.exception.CzgException;
@@ -63,11 +65,22 @@ public class ProductController {
public CzgResult<List<ProductDTO>> getProductList(ProductDTO param) {
Long shopId = StpKit.USER.getShopId(0L);
param.setShopId(shopId);
List<ProductDTO> data = productService.getProductList(param);
List<ProductDTO> data = getProductCacheList(param);
productService.refreshProductStock(param, data);
return CzgResult.success(data);
}
private List<ProductDTO> getProductCacheList(ProductDTO param) {
List<ProductDTO> productList = productService.getProductList(param);
if (StrUtil.isNotEmpty(param.getName())) {
productList = productList.stream().filter(obj -> StrUtil.contains(obj.getName(), param.getName())).toList();
}
if (ObjUtil.isNotNull(param.getCategoryId())) {
productList = productList.stream().filter(obj -> param.getCategoryId().equals(obj.getCategoryId())).toList();
}
return productList;
}
/**
* 商品-详情
*/
@@ -141,6 +154,7 @@ public class ProductController {
/**
* 商品-删除
*
* @param id 商品ID
*/
@DeleteMapping("{id}")

View File

@@ -49,7 +49,7 @@ public class ControllerAspect {
String params = JSONObject.toJSONString(args);
if(params.contains("jndi:rmi:")){
return new RuntimeException("gun");
throw new RuntimeException("gun");
}
// 执行被拦截的方法
Object result = pjp.proceed();