From 2be17adffb5e055ed563ba73c928a5842c45a81e Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期四, 21 九月 2023 14:04:37 +0800
Subject: [PATCH] 属性对比

---
 server/service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/server/service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java
index 553ced0..0f972e2 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java
@@ -66,6 +66,8 @@
     @Autowired
     private CategoryMapper categoryMapper;
     @Autowired
+    private BaseCategoryMapper baseCategoryMapper;
+    @Autowired
     private CateAttrMapper cateAttrMapper;
     @Autowired
     private CateParamMapper cateParamMapper;
@@ -158,6 +160,11 @@
         if(category.getPlatCateId() == null){
             throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝璇峰墠寰�銆愮被鍒鐞嗐�戝厛鍏宠仈骞冲彴绫诲埆锛�");
         }
+        BaseCategory baseCategory = baseCategoryMapper.selectById(category.getPlatCateId());
+        if(baseCategory == null){
+            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝璇峰墠寰�銆愮被鍒鐞嗐�戝厛鍏宠仈骞冲彴绫诲埆锛�");
+        }
+
         BaseGoods bp = new BaseGoods();
         bp.setCategoryId(category.getPlatCateId());
         bp.setIsdeleted(Constants.ZERO);
@@ -185,6 +192,9 @@
         try{
             for(BaseGoods model : goodsList){
                 //閬嶅巻骞冲彴鍟嗗搧淇℃伅锛岃繘琛屽晢鍝佷俊鎭悓姝�
+                //鍒嗙被鍔犱环绯绘暟
+
+                model.setCateRatePrice(baseCategory.getPriceRate());
                 Goods goods = initGoodsPlatParam(user,model,param);
                 if(goods == null){
                     continue;
@@ -310,11 +320,11 @@
             throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"鏁版嵁寮傚父璇峰埛鏂伴噸璇�");
         }
         //濡傛灉娌℃湁閰嶇疆鍏ユ墜浠凤紝瀹夎鍔犱环绯绘暟鏉ヨ绠�
-//        if(model.getCateRatePrice()==null){
-//            model.setCateRatePrice(systemDictDataBiz.getGoodsPriceRate());
-//        }
+        if(model.getCateRatePrice()==null){
+            model.setCateRatePrice(systemDictDataBiz.getGoodsPriceRate());
+        }
         //杩斿洖 .multiply(model.getCateRatePrice())
-        return (Constants.formatBigdecimal(model.getPrice()).multiply(param.getRate())).setScale(0,BigDecimal.ROUND_CEILING);
+        return (Constants.formatBigdecimal(model.getPrice()).multiply(model.getCateRatePrice()).multiply(param.getRate())).setScale(0,BigDecimal.ROUND_CEILING);
 
     }
 
@@ -391,7 +401,10 @@
         if (CollectionUtils.isEmpty(ids)) {
             return;
         }
-        goodsMapper.deleteBatchIds(ids);
+        for(Integer id : ids){
+            deleteById(id);
+        }
+//        goodsMapper.deleteBatchIds(ids);
     }
 
     @Override

--
Gitblit v1.9.3