管理端查询分类去除过滤

This commit is contained in:
liyj 2025-12-23 11:20:59 +08:00
parent f0ce87c78e
commit ee4a2d3a6f
2 changed files with 65 additions and 1 deletions

View File

@ -63,7 +63,7 @@ public class ShopBaseProductCategoryController {
public CommonResult getList(ShopBaseProductCategory category) { public CommonResult getList(ShopBaseProductCategory category) {
QueryWrapper<ShopBaseProductCategory> queryWrapper = new QueryWrapper<>(); QueryWrapper<ShopBaseProductCategory> queryWrapper = new QueryWrapper<>();
new FilterUtils<ShopBaseProductCategory>().applyStoreFilter(queryWrapper); new FilterUtils<ShopBaseProductCategory>().applyStoreFilter(queryWrapper);
queryWrapper.eq("category_is_enable", 1); //queryWrapper.eq("category_is_enable", 1);
Integer category_parent_id = category.getCategory_parent_id(); Integer category_parent_id = category.getCategory_parent_id();
if (category_parent_id == null) category_parent_id = 0; if (category_parent_id == null) category_parent_id = 0;
return CommonResult.success(shopBaseProductCategoryService.getCategoryTree(queryWrapper, category_parent_id)); return CommonResult.success(shopBaseProductCategoryService.getCategoryTree(queryWrapper, category_parent_id));

View File

@ -16,6 +16,7 @@ import com.suisung.mall.common.api.ResultCode;
import com.suisung.mall.common.api.StateCode; import com.suisung.mall.common.api.StateCode;
import com.suisung.mall.common.constant.CommonConstant; import com.suisung.mall.common.constant.CommonConstant;
import com.suisung.mall.common.domain.UserDto; import com.suisung.mall.common.domain.UserDto;
import com.suisung.mall.common.enums.DicEnum;
import com.suisung.mall.common.exception.ApiException; import com.suisung.mall.common.exception.ApiException;
import com.suisung.mall.common.exception.ApiUserException; import com.suisung.mall.common.exception.ApiUserException;
import com.suisung.mall.common.feignService.AccountService; import com.suisung.mall.common.feignService.AccountService;
@ -38,6 +39,7 @@ import com.suisung.mall.common.service.MessageService;
import com.suisung.mall.common.utils.CheckUtil; import com.suisung.mall.common.utils.CheckUtil;
import com.suisung.mall.common.utils.I18nUtil; import com.suisung.mall.common.utils.I18nUtil;
import com.suisung.mall.common.utils.StringUtils; import com.suisung.mall.common.utils.StringUtils;
import com.suisung.mall.core.web.service.RedisService;
import com.suisung.mall.core.web.service.impl.BaseServiceImpl; import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
import com.suisung.mall.shop.base.service.AccountBaseConfigService; import com.suisung.mall.shop.base.service.AccountBaseConfigService;
import com.suisung.mall.shop.base.service.ShopBaseStateCodeService; import com.suisung.mall.shop.base.service.ShopBaseStateCodeService;
@ -50,6 +52,7 @@ import com.suisung.mall.shop.product.pojo.vo.FixOrderVo;
import com.suisung.mall.shop.product.pojo.vo.ProductVo; import com.suisung.mall.shop.product.pojo.vo.ProductVo;
import com.suisung.mall.shop.product.service.*; import com.suisung.mall.shop.product.service.*;
import com.suisung.mall.shop.store.service.*; import com.suisung.mall.shop.store.service.*;
import com.suisung.mall.shop.sync.keymanage.RedisKey;
import com.suisung.mall.shop.user.mapper.ShopUserCartMapper; import com.suisung.mall.shop.user.mapper.ShopUserCartMapper;
import com.suisung.mall.shop.user.service.ShopUserCartService; import com.suisung.mall.shop.user.service.ShopUserCartService;
import com.suisung.mall.shop.user.service.ShopUserDeliveryAddressService; import com.suisung.mall.shop.user.service.ShopUserDeliveryAddressService;
@ -157,6 +160,12 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
@Autowired @Autowired
private ShopStoreSameCityTransportBaseService shopStoreSameCityTransportBaseService; private ShopStoreSameCityTransportBaseService shopStoreSameCityTransportBaseService;
@Autowired
private RedisService redisService;
@Autowired
private ShopStoreMemberService shopStoreMemberService;
@Override @Override
@Transactional @Transactional
public Map getLists(Integer store_id, Integer chain_id, Integer page, Integer rows) { public Map getLists(Integer store_id, Integer chain_id, Integer page, Integer rows) {
@ -412,6 +421,10 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
throw new ApiException(ResultCode.NEED_LOGIN); throw new ApiException(ResultCode.NEED_LOGIN);
} }
//购物车控制活动的商品数量 todo
if(null!=activity_id&&0!=activity_id){
checkActivity(activity_id,user_id);
}
data.put("item_id", item_id); data.put("item_id", item_id);
data.put("cart_quantity", cart_quantity >= 0 ? Math.max(1, cart_quantity) : Math.min(-1, cart_quantity)); // 购买商品数量 data.put("cart_quantity", cart_quantity >= 0 ? Math.max(1, cart_quantity) : Math.min(-1, cart_quantity)); // 购买商品数量
data.put("cart_type", cart_type); data.put("cart_type", cart_type);
@ -3160,4 +3173,55 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
return BigDecimal.ZERO; return BigDecimal.ZERO;
} }
/**
* 校验限购
* @param activityId
* @return
*/
private boolean checkActivity(Integer activityId,Integer user_id){
QueryWrapper<ShopStoreActivityBase> shopStoreActivityBaseQueryWrapper=new QueryWrapper<>();
shopStoreActivityBaseQueryWrapper.eq("activity_id", activityId);
List<ShopStoreActivityBase> shopStoreActivityBases= shopStoreActivityBaseService.list(shopStoreActivityBaseQueryWrapper);
if(shopStoreActivityBases.isEmpty()){
throw new ApiException("活动不存在");
}
ShopStoreActivityBase shopStoreActivityBase=shopStoreActivityBases.get(0);
Integer person_limit= shopStoreActivityBase.getPerson_limit();
Integer order_limit=shopStoreActivityBase.getOrder_limit();
String is_new_person_shop=shopStoreActivityBase.getIs_new_person_shop();
if(DicEnum.YESORNO_1.getCode().equals(is_new_person_shop)){
Integer store_id=shopStoreActivityBase.getStore_id();
boolean isNewUser=checkoutNewPerson(user_id,store_id);
if(!isNewUser){
throw new ApiException("店铺新人才能购买");
}
}
return true;
}
/**
* 检查是否为新用户
* @param user_id
*/
private boolean checkoutNewPerson(Integer user_id,Integer store_id){
boolean isNewUser=false;
String key= RedisKey.store_member_storeId_userId+":"+store_id+":"+user_id;
if(!redisService.hasKey(key)) {
QueryWrapper<ShopStoreMember> shopStoreMemberQueryWrapper=new QueryWrapper();
shopStoreMemberQueryWrapper.eq("userId",user_id);
shopStoreMemberQueryWrapper.eq("store_id",store_id);
long count=shopStoreMemberService.count(shopStoreMemberQueryWrapper);
if(count==0){
Map userData=new HashMap();
userData.put(key,user_id);
redisService.lPush(key,userData);
isNewUser=true;
}
}else {
isNewUser=true;
}
return isNewUser;
}
} }