Administrator
6 days ago 6e3fcdbde6ad62832753ddc8d3e1429f29ea58ee
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsService.java
@@ -2,6 +2,7 @@
import cc.mrbird.febs.common.entity.FebsResponse;
import cc.mrbird.febs.common.entity.QueryRequest;
import cc.mrbird.febs.common.utils.AppContants;
import cc.mrbird.febs.mall.conversion.MallGoodsConversion;
import cc.mrbird.febs.mall.dto.*;
import cc.mrbird.febs.mall.entity.*;
@@ -72,16 +73,18 @@
            return new FebsResponse().fail().message("商品编号不能重复");
        }
        Integer carriageType = addMallGoodsDto.getCarriageType();
        if(1 == carriageType){
            if(ObjectUtil.isEmpty(addMallGoodsDto.getCarriageAmount())
                    || BigDecimal.ZERO.compareTo(addMallGoodsDto.getCarriageAmount()) > 0){
                return new FebsResponse().fail().message("固定邮费不能小于零");
            }
        }else{
            Long carriageRuleId = addMallGoodsDto.getCarriageRuleId();
            MallCarriageRule mallCarriageRule = mallCarriageRuleMapper.selectById(carriageRuleId);
            if(ObjectUtil.isEmpty(mallCarriageRule)){
                return new FebsResponse().fail().message("邮费模板不能为空");
        if (addMallGoodsDto.getGoodsType() == 1) {
            if (1 == carriageType) {
                if (ObjectUtil.isEmpty(addMallGoodsDto.getCarriageAmount())
                        || BigDecimal.ZERO.compareTo(addMallGoodsDto.getCarriageAmount()) > 0) {
                    return new FebsResponse().fail().message("固定邮费不能小于零");
                }
            } else {
                Long carriageRuleId = addMallGoodsDto.getCarriageRuleId();
                MallCarriageRule mallCarriageRule = mallCarriageRuleMapper.selectById(carriageRuleId);
                if (ObjectUtil.isEmpty(mallCarriageRule)) {
                    return new FebsResponse().fail().message("邮费模板不能为空");
                }
            }
        }
@@ -863,6 +866,7 @@
        mallGoodsCoupon.setName(name);
        mallGoodsCoupon.setExpireDay(couponRuleAddDto.getExpireDay());
        mallGoodsCoupon.setCostAmount(couponRuleAddDto.getCostAmount());
        mallGoodsCoupon.setType(couponRuleAddDto.getType());
        mallGoodsCoupon.setRealAmount(couponRuleAddDto.getRealAmount());
        mallGoodsCouponMapper.insert(mallGoodsCoupon);
@@ -945,6 +949,7 @@
        mallGoodsCoupon.setName(adminMallGoodsCouponVo.getName());
        mallGoodsCoupon.setExpireDay(adminMallGoodsCouponVo.getExpireDay());
        mallGoodsCoupon.setCostAmount(adminMallGoodsCouponVo.getCostAmount());
        mallGoodsCoupon.setType(adminMallGoodsCouponVo.getType());
        mallGoodsCoupon.setRealAmount(adminMallGoodsCouponVo.getRealAmount());
        mallGoodsCouponMapper.updateById(mallGoodsCoupon);