jk-GitHub-coder 3 lat temu
rodzic
commit
da8d4081eb

+ 25 - 9
YijiaRestful/src/main/java/com/platform/yijia/controller/PayController.java

@@ -596,7 +596,7 @@ public class PayController {
                                 //等于1表示次要业务:LNG集团平台加气(可能会出现); 插入油站余额记录
                                 StationBalanceChange stationBalanceChange = new StationBalanceChange();
                                 stationBalanceChange.setStationId(stationInfos.getStationId());
-                                stationBalanceChange.setAmt(Double.valueOf(infoMap.get("driverAmt").toString()));
+                                stationBalanceChange.setAmt(Double.valueOf(infoMap.get("sellAmt").toString()));
                                 stationBalanceChange.setCreateTime(new SimpleDateFormat("yyyy-MM-dd hh-mm-ss").parse(infoMap.get("payDate").toString()));
                                 stationBalanceChange.setType("-");
                                 stationBalanceChange.setOrderNo(ordNo);
@@ -674,12 +674,17 @@ public class PayController {
                                             logger.info("小票机打印方式");
                                             infoMap.put("sn", stationDeviceManagerList.get(0).getDeviceNo());
                                             infoMap.put("printSetting", stationInfos.getPrintSetting());
+                                            infoMap.put("isLngFlagGroup", stationInfos.getIsLngFlagGroup());
                                             this.printReceipt(infoMap);
                                             break;
                                         case "2":
                                             logger.info("POS机打印方式");
                                             payOrder.setIntegral(String.valueOf(integral));
                                             payOrder.setPrintSetting(stationInfos.getPrintSetting());
+                                            payOrder.setIsLngFlagGroup(stationInfos.getIsLngFlagGroup());
+                                            if(stationInfos.getIsLngFlagGroup() !=null && stationInfos.getIsLngFlagGroup().equals("1")){
+                                                payOrder.setSellAmt(Double.valueOf(infoMap.get("sellAmt").toString()));
+                                            }
                                             if(stationDeviceManagerList.get(0).getPosFanoutExchange() !=null && stationDeviceManagerList.get(0).getPosQueue() !=null){
                                                 logger.info("POS设备交换机信息:" + stationDeviceManagerList.get(0).getPosFanoutExchange());
                                                 payOrder.setPosFanoutExchange(stationDeviceManagerList.get(0).getPosFanoutExchange());
@@ -829,15 +834,22 @@ public class PayController {
         if(infoMap !=null && infoMap.containsKey("orderNo") && infoMap.get("orderNo") !=null){
             m.put("orderNo", infoMap.get("orderNo").toString());
         }
-        if(infoMap !=null && infoMap.containsKey("amt") && infoMap.get("amt") !=null){
-            m.put("amt", infoMap.get("amt").toString());
-        }
+        //if(infoMap !=null && infoMap.containsKey("amt") && infoMap.get("amt") !=null){
+            if(payOrder.getIsLngFlagGroup() !=null && payOrder.getIsLngFlagGroup().equals("1")){
+                m.put("amt", infoMap.get("sellAmt").toString());
+                m.put("discountAmt", infoMap.get("sellDiscountAmt").toString());
+            }else {
+                m.put("amt", infoMap.get("amt").toString());
+                m.put("discountAmt", infoMap.get("discountAmt").toString());
+            }
+
+        //}
         if(infoMap !=null && infoMap.containsKey("receivableAmt") && infoMap.get("receivableAmt") !=null){
             m.put("receivableAmt", infoMap.get("receivableAmt").toString());
         }
-        if(infoMap !=null && infoMap.containsKey("discountAmt") && infoMap.get("discountAmt") !=null){
-            m.put("discountAmt", infoMap.get("discountAmt").toString());
-        }
+//        if(infoMap !=null && infoMap.containsKey("discountAmt") && infoMap.get("discountAmt") !=null){
+//            m.put("discountAmt", infoMap.get("discountAmt").toString());
+//        }
         if(infoMap !=null && infoMap.containsKey("oilName") && infoMap.get("oilName") !=null){
             m.put("oilName", infoMap.get("oilName").toString());
         }
@@ -981,7 +993,9 @@ public class PayController {
             if (infoMap.containsKey("oilPirce") && infoMap.get("oilPirce") != null) {
                 oilPirceP = infoMap.get("oilPirce") + "";
             }
-            if(infoMap.containsKey("discountAmt") && infoMap.get("discountAmt") !=null ){
+            if(infoMap.containsKey("isLngFlagGroup") && infoMap.get("isLngFlagGroup") !=null && infoMap.get("isLngFlagGroup").toString().equals("1")){
+                discountAmtP =infoMap.get("sellDiscountAmt")+"";
+            }else {
                 discountAmtP =infoMap.get("discountAmt")+"";
             }
             receiptNameP = "油品订单";
@@ -996,7 +1010,9 @@ public class PayController {
             receivableAmtP =infoMap.get("receivableAmt")+"";
         }
 
-        if(infoMap.containsKey("amt") && infoMap.get("amt") !=null ){
+        if(infoMap.containsKey("isLngFlagGroup") && infoMap.get("isLngFlagGroup") !=null && infoMap.get("isLngFlagGroup").toString().equals("1")){
+            amtP =infoMap.get("sellAmt")+"";
+        }else {
             amtP =infoMap.get("amt")+"";
         }
         if(infoMap.containsKey("mobilePhone") && infoMap.get("mobilePhone") !=null ){

+ 3 - 2
YijiaRestful/src/main/java/com/platform/yijia/controller/PayOrderController.java

@@ -173,6 +173,7 @@ public class PayOrderController {
                         resultMap.put("amt", payOrderResultInfo.getAmt());                   //实收价格
                         if(payOrderRequest.getIsLngFlagGroup() !=null && payOrderRequest.getIsLngFlagGroup().equals("1")){
                             payOrder.setSellAmt(Double.valueOf(payOrderResultInfo.getSellAmt()));
+                            payOrder.setSellDiscountAmt(Double.valueOf(payOrderResultInfo.getSellDiscountAmt()));
                         }
                         resultMap.put("receivableAmt", payOrderResultInfo.getReceivableAmt());         //应收价格
                         resultMap.put("oilLiters", payOrderResultInfo.getOilLiters());
@@ -320,7 +321,7 @@ public class PayOrderController {
                 case "2":   //折扣
                     //优惠价(销售价)
                     if(params.containsKey("settlementPrice") && params.get("settlementPrice").toString() !=null && params.get("settlementPrice").toString() !=""){
-                        discountPrice = oilPrice.multiply(new BigDecimal(params.get("settlementPrice").toString()));
+                        discountPrice = oilPrice.multiply(new BigDecimal(params.get("settlementPrice").toString())).divide(new BigDecimal("100"));
                         discountAmt = discountPrice.multiply(oilLiters);
                         discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
                     }
@@ -330,7 +331,7 @@ public class PayOrderController {
 
         if(params.containsKey("driverPrice") && params.get("driverPrice").toString() !=null && params.get("driverPrice").toString() !=""){
             //司机价
-            sellPrice = discountPrice.multiply(new BigDecimal(params.get("driverPrice").toString()));
+            sellPrice = discountPrice.multiply(new BigDecimal(params.get("driverPrice").toString())).divide(new BigDecimal("100"));
             sellDiscountAmt = sellPrice.multiply(oilLiters);
             sellDiscountAmt = sellDiscountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
         }

+ 3 - 1
YijiaRestful/src/main/java/com/platform/yijia/pojo/PayOrder.java

@@ -87,7 +87,9 @@ public class PayOrder implements Serializable {
     private String posQueue;
     private String deviceNo;
 
-    //
+    //LNG加气平台参数
     private Double sellAmt;
+    private Double sellDiscountAmt;     //销售价后优惠金额
+    private String isLngFlagGroup;
 
 }

+ 11 - 1
YijiaRestful/src/main/resources/mapper/PayOrderMapper.xml

@@ -11,7 +11,10 @@
     <result column="consumer_id"            jdbcType="INTEGER"   property="consumerId" />
     <result column="consumer"               jdbcType="VARCHAR"   property="consumer" />
     <result column="amt"                    jdbcType="DOUBLE"    property="amt" />
+
     <result column="sell_amt"               jdbcType="DOUBLE"    property="sellAmt" />
+    <result column="sell_discount_amt"      jdbcType="DOUBLE"    property="sellDiscountAmt" />
+
     <result column="station_id"             jdbcType="INTEGER"   property="stationId" />
     <result column="status"                 jdbcType="VARCHAR"   property="status" />
     <result column="order_liters"           jdbcType="VARCHAR"   property="orderLiters" />
@@ -600,6 +603,9 @@
       <if test="sellAmt != null">
         sell_amt,
       </if>
+        <if test="sellDiscountAmt != null">
+            sell_discount_amt,
+        </if>
       <if test="stationId != null">
         station_id,
       </if>
@@ -728,6 +734,9 @@
       <if test="sellAmt != null">
         #{sellAmt,jdbcType=DOUBLE},
       </if>
+        <if test="sellDiscountAmt != null">
+            #{sellDiscountAmt,jdbcType=DOUBLE},
+        </if>
       <if test="stationId != null">
         #{stationId,jdbcType=INTEGER},
       </if>
@@ -992,7 +1001,8 @@
         A.oil_type              AS oilType,
         A.order_liters 			AS orderLiters,
         A.amt 					AS amt,
-        A.driver_amt            AS driverAmt,
+        A.sell_amt              AS sellAmt,
+        A.sell_discount_amt     AS sellDiscountAmt,
         A.dzk_amt               AS dzkAmt,
         A.order_type 			AS orderType,
         A.oil_pirce             AS oilPirce,

+ 1 - 1
YijiaRestful/src/main/resources/mapper/StationInfoMapper.xml

@@ -92,7 +92,7 @@
     FROM            sys_dept                AS T1
         LEFT JOIN   station_oil_price       AS T2 ON T1.dept_id = T2.station_id
         LEFT JOIN   sys_dept                AS T3 ON T1.parent_id = T3.dept_id
-        LEFT JOIN station_settlement_price  AS T4 ON T2.oil_price_id = T4.station_oil_price_id
+        LEFT JOIN station_settlement_price  AS T4 ON T2.station_id = T4.station_id
     <where>
       <if test="stationId !='' and stationId != null" >
         T1.dept_id = #{stationId}

+ 5 - 0
YijiaRestful/src/test/java/com/palatform/yijia/test.java

@@ -17,6 +17,11 @@ public class test {
 
     public static void main(String[] args) {
 
+        BigDecimal discountPrice = new BigDecimal("5.36");
+        BigDecimal sellPrice = discountPrice.multiply(new BigDecimal("98")).divide(new BigDecimal("100"));
+        System.out.println(sellPrice.toString());
+
+
         //QRcodeUtils.encode();
         //QRcodeUtils.imgContainQRcode();