JK 4 سال پیش
والد
کامیت
ee0d3d8272

+ 8 - 24
YijiaRestful/src/main/java/com/platform/yijia/controller/ElectronicMembershipCardController.java

@@ -488,33 +488,17 @@ public class ElectronicMembershipCardController {
                         this.pushIntegral(customerPoints);  //推送积分
                     }
                     resultData = ResultData.success(CodeMsg.SUCCESS);
-                    Map map = new HashMap();
-                    map.put("stationId", stationId);
-                    map.put("oilGunNo", oilGun);
-                    List<Map> listDevices = stationOilGunService.getPrinterSnByStationIdAndOilGunNoList(map);
-                    if(listDevices !=null && listDevices.size() ==2){
-                        for(Map m : listDevices){
-                            if(m.get("deviceType").toString().equals("1")){
-                                //打印小票
-                                resultMap.put("sn", m.get("printerSn").toString());
-                                resultMap.put("printSetting", m.get("printSetting").toString());
+
+                    //油站小票打印方式
+                    if(stationInfos !=null && StringUtils.isNotBlank(stationInfo.getPrintDeviceType())){
+                        switch (stationInfos.getPrintDeviceType()){
+                            case "1":   //小票机打印
                                 this.printReceipt(payOrder);
-                            }else {
-                                //pos机打印小票
+                                break;
+                            case "2":   //POS机打印
                                 payOrder.setIntegral(String.valueOf(integral));
                                 this.posPrintReceipt(payOrder);
-                            }
-                        }
-                    }else if(listDevices !=null && listDevices.size() ==1){
-                        if(listDevices.get(0).get("deviceType").toString().equals("1")){
-                            //打印小票
-                            resultMap.put("sn", listDevices.get(0).get("printerSn").toString());
-                            resultMap.put("printSetting", listDevices.get(0).get("printSetting").toString());
-                            this.printReceipt(payOrder);
-                        }else {
-                            //POS机打印
-                            payOrder.setIntegral(String.valueOf(integral));
-                            this.posPrintReceipt(payOrder);
+                                break;
                         }
                     }
                 }else {

+ 13 - 24
YijiaRestful/src/main/java/com/platform/yijia/controller/PayController.java

@@ -598,33 +598,22 @@ public class PayController {
                                 this.pushIntegral(customerPoints);
                             }
 
-                            Map map = new HashMap();
-                            map.put("stationId", infoMap.get("stationId").toString());
-                            map.put("oilGunNo", infoMap.get("oilGun").toString());
-                            List<Map> listDevices = stationOilGunService.getPrinterSnByStationIdAndOilGunNoList(map);
-                            if(listDevices !=null && listDevices.size() ==2){
-                                for(Map m : listDevices){
-                                    if(m.get("deviceType").toString().equals("1")){
-                                        //打印小票
-                                        infoMap.put("sn", m.get("printerSn").toString());
-                                        infoMap.put("printSetting", m.get("printSetting").toString());
+                            if(stationInfos !=null && StringUtils.isNotBlank(stationInfo.getPrintDeviceType())){
+                                switch (stationInfos.getPrintDeviceType()){
+                                    case "1":   //小票机打印
+                                        Map map = new HashMap();
+                                        map.put("stationId", infoMap.get("stationId").toString());
+                                        map.put("oilGunNo", infoMap.get("oilGun").toString());
+                                        map.put("deviceType", stationInfos.getPrintDeviceType());
+                                        List<Map> listDevices = stationOilGunService.getPrinterSnByStationIdAndOilGunNoList(map);
+                                        infoMap.put("sn", listDevices.get(0).get("printerSn").toString());
+                                        infoMap.put("printSetting", stationInfos.getPrintSetting());
                                         this.printReceipt(infoMap);
-                                    }else {
-                                        //pos机打印小票
+                                        break;
+                                    case "2":   //POS机打印
                                         payOrder.setIntegral(String.valueOf(integral));
                                         this.posPrintReceipt(payOrder);
-                                    }
-                                }
-                            }else if(listDevices !=null && listDevices.size() ==1){
-                                if(listDevices.get(0).get("deviceType").toString().equals("1")){
-                                    //打印小票
-                                    infoMap.put("sn", listDevices.get(0).get("printerSn").toString());
-                                    infoMap.put("printSetting", listDevices.get(0).get("printSetting").toString());
-                                    this.printReceipt(infoMap);
-                                }else {
-                                    //POS机打印
-                                    payOrder.setIntegral(String.valueOf(integral));
-                                    this.posPrintReceipt(payOrder);
+                                        break;
                                 }
                             }
                         }else{

+ 9 - 0
YijiaRestful/src/main/java/com/platform/yijia/pojo/StationInfo.java

@@ -136,6 +136,15 @@ public class StationInfo {
     private String image3;
     private String image4;
     private String image5;
+    private String printDeviceType;     //小票打印方式的选择
+
+    public String getPrintDeviceType() {
+        return printDeviceType;
+    }
+
+    public void setPrintDeviceType(String printDeviceType) {
+        this.printDeviceType = printDeviceType;
+    }
 
     public String getImage2() {
         return image2;

+ 2 - 0
YijiaRestful/src/main/resources/mapper/StationInfoMapper.xml

@@ -30,6 +30,7 @@
     <result column="integral_rule_flag"   jdbcType="VARCHAR" property="integralRuleFlag" />
     <result column="single_station_flag"  jdbcType="VARCHAR" property="singleStationFlag" />
     <result column="card_rule_flag"       jdbcType="VARCHAR" property="cardRuleFlag" />
+    <result column="print_device_type"    jdbcType="VARCHAR" property="printDeviceType" />
     <result column="app_id"               jdbcType="VARCHAR" property="appId" />
     <result column="gzh_app_id"           jdbcType="VARCHAR" property="gzhAppId" />
   </resultMap>
@@ -129,6 +130,7 @@
         T1.card_enabled_flag,
         T1.integral_flag,
         T1.integral_print_flag,
+        T1.print_device_type,
         T2.card_rule_flag,
         T2.integral_rule_flag
     FROM          sys_dept      AS T1