licailing 5 lat temu
rodzic
commit
6e14842d11

+ 11 - 2
src/main/java/com/izouma/dingdong/service/merchant/GoodsService.java

@@ -72,18 +72,26 @@ public class GoodsService {
             goods.setStatus(ApplyStatus.PENDING);
         }
 
+        MerchantClassification classification = merchantClassificationRepo.findByMerchantIdAndName(goods.getMerchantId(), Constants.CLASSIFICATION_NAME2);
+
         //折扣价不参与满减
         if (i == 0) {
             goods.setIsFullReduction(true);
+
+            //移除折扣商品
+            if (goods.getId() != null)
+                classification.getGoodsIds().remove(goods.getId());
+
         } else {
             goods.setIsFullReduction(false);
         }
 
+
         goods = goodsRepo.save(goods);
 
         if (i > 0) {
             //如果有折扣价,自动加入折扣分类
-            MerchantClassification classification = merchantClassificationRepo.findByMerchantIdAndName(goods.getMerchantId(), Constants.CLASSIFICATION_NAME2);
+            //MerchantClassification classification = merchantClassificationRepo.findByMerchantIdAndName(goods.getMerchantId(), Constants.CLASSIFICATION_NAME2);
             if (!classification.getIsShow() || ObjectUtil.isNull(classification.getIsShow())) {
                 classification.setIsShow(true);
                 merchantClassificationRepo.save(classification);
@@ -135,8 +143,9 @@ public class GoodsService {
 
     /**
      * 审核
+     *
      * @param goodsId 商品ID
-     * @param pass 是否通过
+     * @param pass    是否通过
      */
     public void audit(Long goodsId, Boolean pass) {
         Goods goods = goodsRepo.findById(goodsId).orElseThrow(new BusinessException("无商品"));

+ 1 - 0
src/main/java/com/izouma/dingdong/web/merchant/GoodsController.java

@@ -36,6 +36,7 @@ public class GoodsController extends BaseController {
     public Goods save(@RequestBody Goods record) {
         if (record.getId() != null) {
             Goods orig = goodsRepo.findById(record.getId()).orElseThrow(new BusinessException("无记录"));
+            //if (record.getName())
             ObjUtils.merge(orig, record);
             return goodsService.save(orig);
         }