jk 3 lat temu
rodzic
commit
6fd73f015f

+ 11 - 4
YijiaRestful/src/main/java/com/platform/yijia/controller/PayOrderController.java

@@ -304,23 +304,28 @@ public class PayOrderController {
         BigDecimal sellAmt = new BigDecimal(0);         //油站结算价支付金额
         BigDecimal discountPrice = oilPrice;                //司机销售价
         BigDecimal sellPrice = discountPrice;              //油站销售价
+        BigDecimal sellSumAmt = amt;
+        BigDecimal sellSumDiscount = new BigDecimal("0");
         //加油升数
         oilLiters = receivableAmt.divide(oilPrice,2, BigDecimal.ROUND_HALF_UP);
 //        if(!oilLiters.toString().substring(oilLiters.toString().indexOf(".") + 1).equals("00")){
 //            oilLiters = receivableAmt.divide(oilPrice,2, BigDecimal.ROUND_UP);
 //        }
         // settlementType:结算价类型(1.直降,2.折扣);  settlementPrice:结算价;  driverPrice:司机价;
-        String settlementType = params.get("settlementType").toString();
+
         if(params.containsKey("settlementType") && params.get("settlementType") !=null && params.get("settlementType").toString() !=""){
+            String settlementType = params.get("settlementType").toString();
             switch (settlementType){
                 case "1":   //直降
                     //优惠价(销售价)
                     if(params.containsKey("settlementPrice") && params.get("settlementPrice").toString() !=null && params.get("settlementPrice").toString() !=""){
                         sellPrice = oilPrice.subtract(new BigDecimal(params.get("settlementPrice").toString()));
-                        sellAmt = new BigDecimal(params.get("settlementPrice").toString()).multiply(oilLiters);
+                        sellAmt = new BigDecimal(params.get("settlementPrice").toString()).multiply(oilLiters); //优惠
                         sellDiscountAmt = receivableAmt.subtract(sellAmt);
                         sellDiscountAmt = sellDiscountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
                         //sellPrice = sellPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
+                        sellSumAmt = sellDiscountAmt;
+                        sellSumDiscount = sellAmt;
                     }
                     break;
                 case "2":   //折扣
@@ -331,6 +336,8 @@ public class PayOrderController {
                         sellDiscountAmt = receivableAmt.subtract(sellAmt);
                         sellDiscountAmt = sellDiscountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
                         //sellPrice = sellPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
+                        sellSumAmt = sellAmt;
+                        sellSumDiscount = sellDiscountAmt;
                     }
                     break;
             }
@@ -357,9 +364,9 @@ public class PayOrderController {
         payOrderResultInfo.setOilPrice(oilPrice.toString());            //油机价
         payOrderResultInfo.setAmt(amt.toString());                      //司机价后时候金额
         payOrderResultInfo.setDiscountPrice(discountPrice.toString());  //司机价
-        payOrderResultInfo.setDiscountAmt(discountAmt.toString());      //司机价后优惠金额
+        payOrderResultInfo.setDiscountAmt(sellSumDiscount.toString());      //司机价后优惠金额
 
-        payOrderResultInfo.setSellAmt(sellDiscountAmt.toString());                      //销售价后支付金额
+        payOrderResultInfo.setSellAmt(sellSumAmt.toString());                      //销售价后支付金额
         sellPrice.setScale(2, BigDecimal.ROUND_HALF_UP);               //销售价
         payOrderResultInfo.setSellPrice(sellPrice.toString());                  //销售价
         payOrderResultInfo.setSellDiscountAmt(sellAmt.toString());      //销售价后优惠金额