huliguo
2025-06-16 a966dafb8877552267a94fe8c544c5ea72cf5650
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/goods/GoodsServiceImpl.java
@@ -10,7 +10,6 @@
import com.ruoyi.common.core.utils.uuid.IdUtils;
import com.ruoyi.common.security.utils.CodeFactoryUtil;
import com.ruoyi.goods.domain.dto.*;
import com.ruoyi.system.api.domain.poji.activity.Activity;
import com.ruoyi.goods.domain.pojo.goods.GoodsTotal;
import com.ruoyi.goods.domain.vo.*;
import com.ruoyi.goods.mapper.goods.GoodsMapper;
@@ -26,6 +25,7 @@
import com.ruoyi.system.api.domain.dto.MerGoodsPriceListDto;
import com.ruoyi.system.api.domain.dto.MgtBaseGetDto;
import com.ruoyi.system.api.domain.dto.MgtClassNumDto;
import com.ruoyi.system.api.domain.poji.activity.Activity;
import com.ruoyi.system.api.domain.poji.activity.ActivityGoods;
import com.ruoyi.system.api.domain.poji.config.SysClassification;
import com.ruoyi.system.api.domain.poji.goods.Goods;
@@ -83,10 +83,11 @@
    @Resource
    private RemoteShopService remoteShopService;
    /**
    * @description 获取推荐商品列表
    * @param page shopId
    * @return List<AppSimpleGoodsVo>
     * @description 获取推荐商品列表
    * @author jqs34
    * @date 2023/6/4 16:27
    */
@@ -188,7 +189,18 @@
        if(shopGoods!=null){
            appGoodsInfoVo.setSalesPrice(shopGoods.getSalesPrice());
            appGoodsInfoVo.setServiceNum(shopGoods.getServiceNum());
        } else {
            //经销商定制价格
            Shop shop = remoteShopService.getShop(appGoodsInfoGetDto.getShopId()).getData();
            Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData();
            shopGoods = shopGoodsService.getByShopIdAndGoodsId(belongShop.getShopId(), goods.getGoodsId());
            if (1 == belongShop.getModifyPricePermission() && null != shopGoods) {
                appGoodsInfoVo.setSalesPrice(shopGoods.getSalesPrice());
                appGoodsInfoVo.setServiceNum(shopGoods.getServiceNum());
        }
        }
        GoodsTotal goodsTotal = goodsTotalService.getById(goods.getGoodsId());
        appGoodsInfoVo.setSalesNum(goodsTotal.getBuyNumCount());
        //活动商品判断
@@ -275,10 +287,20 @@
    /**
     * 修改商户商品
     *
     * @param merShopGoodsEditDto
     */
    @Override
    public void editMerShopGoods(MerShopGoodsEditDto merShopGoodsEditDto){
        Shop shop = remoteShopService.getShop(merShopGoodsEditDto.getShopId()).getData();
        if (2 == shop.getShopType()) {
            Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData();
            ShopGoods shopGoods = shopGoodsService.getByShopIdAndGoodsId(shop.getBelongShopId(), merShopGoodsEditDto.getGoodsId());
            if (1 == belongShop.getModifyPricePermission() && null != shopGoods) {
                throw new ServiceException("经销商开启了统一价格管理");
            }
        }
        Goods goods = this.getById(merShopGoodsEditDto.getGoodsId());
        if(merShopGoodsEditDto.getSalePrice().compareTo(goods.getMininumPrice())<0){
            throw new ServiceException(AppErrorConstant.SALESPRICE_MIN+goods.getMininumPrice().toString()+"元");