Browse Source

修改提交订单

lijun 5 years ago
parent
commit
8edcdb28bb
1 changed files with 20 additions and 3 deletions
  1. 20 3
      src/main/java/com/caimei/service/order/impl/OrderServiceImpl.java

+ 20 - 3
src/main/java/com/caimei/service/order/impl/OrderServiceImpl.java

@@ -83,7 +83,8 @@ public class OrderServiceImpl implements OrderService {
         List<CmMallShop> cmMallShopList = orderMapper.findShop(list);
         List<CmMallShop> cmMallShopList = orderMapper.findShop(list);
         for (CmMallShop cmMallShop : cmMallShopList) {
         for (CmMallShop cmMallShop : cmMallShopList) {
             List<CmMallOrganizeProducts> productsList = new ArrayList();
             List<CmMallOrganizeProducts> productsList = new ArrayList();
-            Double totalPrice = 0d;
+            Double retailPrice = 0d;//单价
+            Double totalPrice = 0d;//单个商品总售价
             if (count == null) {
             if (count == null) {
                 //购物车购买
                 //购物车购买
                 Map<String, Object> params = new HashMap();
                 Map<String, Object> params = new HashMap();
@@ -93,14 +94,30 @@ public class OrderServiceImpl implements OrderService {
                 productsList = orderMapper.findAllCommodity(params);
                 productsList = orderMapper.findAllCommodity(params);
                 for (CmMallOrganizeProducts products : productsList) {
                 for (CmMallOrganizeProducts products : productsList) {
                     products.setMainImage(AppUtils.getImageURL("product", products.getMainImage(), 0, domain));
                     products.setMainImage(AppUtils.getImageURL("product", products.getMainImage(), 0, domain));
-                    totalPrice += products.getRetailPrice() * products.getProductCount();
+                    if(StringUtils.equals("1",products.getLadderPriceFlag())){//阶梯价格
+                        List<CmMallProductLadderPrice> ladderPriceList = detailsMapper.findLadderPrice(products.getId());
+                        //更加商品购买数量获取商品对应阶梯价格
+                        retailPrice = getLadderPrice(products.getProductCount(), ladderPriceList);
+                        totalPrice += retailPrice * products.getProductCount();
+                        products.setRetailPrice(retailPrice);//重置阶梯价格售价
+                    }else{
+                        totalPrice += products.getRetailPrice() * products.getProductCount();
+                    }
                 }
                 }
             } else {
             } else {
                 //立即购买
                 //立即购买
                 CmMallOrganizeProducts products = orderMapper.findCommodity(productIDs, cmMallShop.getShopID());
                 CmMallOrganizeProducts products = orderMapper.findCommodity(productIDs, cmMallShop.getShopID());
                 products.setMainImage(AppUtils.getImageURL("product", products.getMainImage(), 0, domain));
                 products.setMainImage(AppUtils.getImageURL("product", products.getMainImage(), 0, domain));
                 products.setProductCount(count);
                 products.setProductCount(count);
-                totalPrice = products.getRetailPrice() * products.getProductCount();
+                if(StringUtils.equals("1",products.getLadderPriceFlag())){//阶梯价格
+                    List<CmMallProductLadderPrice> ladderPriceList = detailsMapper.findLadderPrice(products.getId());
+                    //更加商品购买数量获取商品对应阶梯价格
+                    retailPrice = getLadderPrice(products.getProductCount(), ladderPriceList);
+                    totalPrice += retailPrice * products.getProductCount();
+                    products.setRetailPrice(retailPrice);//重置阶梯价格售价
+                }else{
+                    totalPrice = products.getRetailPrice() * products.getProductCount();
+                }
                 productsList.add(products);
                 productsList.add(products);
             }
             }
             cmMallShop.setLogo(AppUtils.getImageURL("shopLogo", cmMallShop.getLogo(), 0, domain));
             cmMallShop.setLogo(AppUtils.getImageURL("shopLogo", cmMallShop.getLogo(), 0, domain));