Просмотр исходного кода

Merge remote-tracking branch 'origin/developer' into developerA

chao 3 лет назад
Родитель
Сommit
474cf928b4

+ 2 - 1
src/main/java/com/caimei365/order/components/OrderCommonService.java

@@ -74,11 +74,12 @@ public class OrderCommonService {
             List<OrderProductVo> orderProductList = orderCommonMapper.getShopOrderProduct(shopOrder.getShopOrderId());
             orderProductList.removeIf(Objects::isNull);
             orderProductList.forEach(orderProduct -> {
-                // 不含税可开票商品,单价在原基础上加上税费(折后单价discountPrice下单时已加上税费)
+                // 不含税可开票商品,单价/折后单价在原基础上加上税费
                 boolean taxFlag = (Integer.valueOf(0).equals(orderProduct.getIncludedTax()) && (Integer.valueOf(1).equals(orderProduct.getInvoiceType()) || Integer.valueOf(2).equals(orderProduct.getInvoiceType())));
                 if (taxFlag) {
                     Double valueTax = MathUtil.div(MathUtil.mul(orderProduct.getPrice(), orderProduct.getTaxRate()), 100).doubleValue();
                     orderProduct.setPrice(MathUtil.add(orderProduct.getPrice(), valueTax).doubleValue());
+                    orderProduct.setDiscountPrice(MathUtil.add(orderProduct.getDiscountPrice(), orderProduct.getAddedValueTax()).doubleValue());
                 }
                 orderProduct.setImage(ImageUtil.getImageUrl("product", orderProduct.getImage(), domain));
                 // 查询订单下商品的促销活动

+ 5 - 5
src/main/java/com/caimei365/order/service/impl/SubmitServiceImpl.java

@@ -576,14 +576,14 @@ public class SubmitServiceImpl implements SubmitService {
                     product.setPrice(productPrice);
                     // 商品税后价格
                     Double productTaxPrice = MathUtil.add(productPrice, productTax).doubleValue();
-                    // 折后单价
-                    discountPrice = MathUtil.add(discountPrice, discountTax).doubleValue();
+                    // 折后税后单价
+                    Double discountTaxPrice = MathUtil.add(productPrice, productTax).doubleValue();
                     // 折扣率 = 折后单价/机构价
-                    Double discountRate = MathUtil.mul(MathUtil.div(discountPrice, productTaxPrice), 100).doubleValue();
+                    Double discountRate = MathUtil.mul(MathUtil.div(discountTaxPrice, productTaxPrice), 100).doubleValue();
                     // 单个商品的金额
                     Double productAmount = MathUtil.mul(productTaxPrice, productNum).doubleValue();
                     // 单个商品的折后金额
-                    Double productFee = MathUtil.mul(discountPrice, productNum).doubleValue();
+                    Double productFee = MathUtil.mul(discountTaxPrice, productNum).doubleValue();
                     // 单个商品总税费
                     Double taxFee = MathUtil.mul(discountTax, productNum).doubleValue();
                     if (hasActProductFlag && null != promotions) {
@@ -612,7 +612,7 @@ public class SubmitServiceImpl implements SubmitService {
                             PromotionPriceVo promotionPrice = new PromotionPriceVo();
                             promotionPrice.setProductId(productId);
                             promotionPrice.setNumber(productNum);
-                            promotionPrice.setPrice(discountPrice);
+                            promotionPrice.setPrice(discountTaxPrice);
                             if (null == promotions.getProductList()){
                                 promotions.setProductList(new ArrayList<>());
                             }

+ 1 - 1
src/main/resources/mapper/OrderCommonMapper.xml

@@ -230,7 +230,7 @@
         FROM cm_order_product cop
         LEFT JOIN product p ON cop.productID = p.productID
         WHERE orderID = #{orderId}
-        ORDER BY shopID ASC, productID ASC
+        ORDER BY cop.discountPrice DESC
     </select>
     <select id="countReturnedNum" resultType="java.lang.Integer">
         SELECT SUM(crpp.actualReturnedNum)