This commit is contained in:
2025-12-17 10:11:09 +08:00
parent 01ca38079b
commit bf2eb85233
7 changed files with 93 additions and 27 deletions

View File

@@ -3,7 +3,6 @@ package com.czg.service.market.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.czg.account.service.ShopInfoService;
import com.czg.exception.CzgException;
import com.czg.market.dto.GbWareDTO;
import com.czg.market.dto.GbWareQueryParamDTO;
import com.czg.market.entity.GbWare;
@@ -11,11 +10,11 @@ import com.czg.market.service.GbWareService;
import com.czg.sa.StpKit;
import com.czg.service.market.mapper.GbWareMapper;
import com.czg.utils.AssertUtil;
import com.czg.utils.CzgStrUtils;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Service;
/**
@@ -29,6 +28,14 @@ public class GbWareServiceImpl extends ServiceImpl<GbWareMapper, GbWare> impleme
@DubboReference
private ShopInfoService shopInfoService;
@CacheEvict(cacheNames = "shopInfo", key = "#shopId")
@Override
public boolean upShopConfig(Integer status, Long shopId) {
return false;
}
@Override
public Page<GbWare> getGbWarePage(GbWareQueryParamDTO param, Long shopId) {
Long mainShopId = shopInfoService.getMainIdByShopId(shopId);
@@ -62,13 +69,6 @@ public class GbWareServiceImpl extends ServiceImpl<GbWareMapper, GbWare> impleme
return save(gbWare);
}
@Override
public boolean editGbWareOnlineStatus(Long id, Integer onlineStatus) {
GbWare gbWare = new GbWare();
gbWare.setOnlineStatus(onlineStatus);
return update(gbWare, query().eq(GbWare::getId, id).eq(GbWare::getShopId, StpKit.USER.getShopId()));
}
@Override
public boolean updateGbWareById(GbWareDTO param) {
@@ -88,8 +88,6 @@ public class GbWareServiceImpl extends ServiceImpl<GbWareMapper, GbWare> impleme
private void checkStatus(Long id) {
GbWare ware = getById(id);
if (ware.getOnlineStatus() == 1) {
throw new CzgException("操作失败,请下架后,重试");
}
AssertUtil.isNotEqual(ware.getOnlineStatus(), 1, "操作失败,请下架后,重试");
}
}