jk-GitHub-coder 4 tahun lalu
induk
melakukan
f177e91f8c

+ 47 - 45
YijiaRestful/src/main/java/com/platform/yijia/controller/ElectronicMembershipCardController.java

@@ -424,54 +424,56 @@ public class ElectronicMembershipCardController {
                     }
 
                     //电子卡消费公众号通知
-                    if(cardInfo.getBlogOpenid() !=null){
-                        String gzhAppId ="";
-                        String gzhAppSecret ="";
-                        Map<String, String> m = stationService.getStationAppIdAndAppSecret(cardInfo.getStationId());
-                        if(m !=null && m.containsKey("stationName") && m.containsKey("gzhAppId") && m.containsKey("gzhAppSecret")){
-                            stationName = m.get("stationName");
-                            gzhAppId = m.get("gzhAppId");
-                            gzhAppSecret = m.get("gzhAppSecret");
-                            //推送模板
-                            List<WxMpTemplateData> wxMpTemplate = new ArrayList<>();
-                            wxMpTemplate.add(new WxMpTemplateData("first","尊敬的"+cardInfo.getCustomerName()+",您好:\n" + "您在"+stationName+"的最新消费交易信息如下"));
-                            wxMpTemplate.add(new WxMpTemplateData("keyword1", new SimpleDateFormat("yyyy年MM月dd日HH时mm分").format(new Date())));
-                            wxMpTemplate.add(new WxMpTemplateData("keyword2", stationName));
-                            wxMpTemplate.add(new WxMpTemplateData("keyword3", oilName));
-                            wxMpTemplate.add(new WxMpTemplateData("keyword4", "电子卡"));
-                            wxMpTemplate.add(new WxMpTemplateData("keyword5", amt));
-                            wxMpTemplate.add(new WxMpTemplateData("remark","感谢您在"+stationName+"本次消费,当前还剩余额 "+c.getAmt()+"元,祝您生活愉快~!"));
-                            GzhNewsTemplate gzhNewsTemplate = new GzhNewsTemplate();
-                            gzhNewsTemplate.setStationId(cardInfo.getStationId());
-                            gzhNewsTemplate.setTemplateType("5");
-                            GzhNewsTemplate gzhNewsTemplateInfo = gzhNewsTemplateService.getGzhNewsTemplate(gzhNewsTemplate);
-                            if(gzhNewsTemplateInfo !=null && gzhNewsTemplateInfo.getTemplateId() !=null){
-                                wxPushUtil.push(gzhAppId, gzhAppSecret, gzhNewsTemplateInfo.getTemplateId(), cardInfo.getBlogOpenid(), wxMpTemplate);
-                            }
-                        }
-                    }
+//                    if(cardInfo.getBlogOpenid() !=null){
+//                        String gzhAppId ="";
+//                        String gzhAppSecret ="";
+//                        Map<String, String> m = stationService.getStationAppIdAndAppSecret(cardInfo.getStationId());
+//                        if(m !=null && m.containsKey("stationName") && m.containsKey("gzhAppId") && m.containsKey("gzhAppSecret")){
+//                            stationName = m.get("stationName");
+//                            gzhAppId = m.get("gzhAppId");
+//                            gzhAppSecret = m.get("gzhAppSecret");
+//                            //推送模板
+//                            List<WxMpTemplateData> wxMpTemplate = new ArrayList<>();
+//                            wxMpTemplate.add(new WxMpTemplateData("first","尊敬的"+cardInfo.getCustomerName()+",您好:\n" + "您在"+stationName+"的最新消费交易信息如下"));
+//                            wxMpTemplate.add(new WxMpTemplateData("keyword1", new SimpleDateFormat("yyyy年MM月dd日HH时mm分").format(new Date())));
+//                            wxMpTemplate.add(new WxMpTemplateData("keyword2", stationName));
+//                            wxMpTemplate.add(new WxMpTemplateData("keyword3", oilName));
+//                            wxMpTemplate.add(new WxMpTemplateData("keyword4", "电子卡"));
+//                            wxMpTemplate.add(new WxMpTemplateData("keyword5", amt));
+//                            wxMpTemplate.add(new WxMpTemplateData("remark","感谢您在"+stationName+"本次消费,当前还剩余额 "+c.getAmt()+"元,祝您生活愉快~!"));
+//                            GzhNewsTemplate gzhNewsTemplate = new GzhNewsTemplate();
+//                            gzhNewsTemplate.setStationId(cardInfo.getStationId());
+//                            gzhNewsTemplate.setTemplateType("5");
+//                            GzhNewsTemplate gzhNewsTemplateInfo = gzhNewsTemplateService.getGzhNewsTemplate(gzhNewsTemplate);
+//                            if(gzhNewsTemplateInfo !=null && gzhNewsTemplateInfo.getTemplateId() !=null){
+//                                wxPushUtil.push(gzhAppId, gzhAppSecret, gzhNewsTemplateInfo.getTemplateId(), cardInfo.getBlogOpenid(), wxMpTemplate);
+//                            }
+//                        }
+//                    }
 
-                    StationPayManage stationPayManage = new StationPayManage();
-                    stationPayManage.setStationId(Integer.valueOf(stationId));
-                    StationPayManage stationPayManageInfo = stationService.selectStationPayManage(stationPayManage);
-                    //是否启用积分功能
-                    if(stationPayManageInfo !=null && stationPayManageInfo.getIntegralFlag().equals("1")){
-                        //计算积分
-                        CalculateIntegral calculateIntegral = new CalculateIntegral();
-                        calculateIntegral.setAmt(new BigDecimal(amt));
-                        calculateIntegral.setReceivableAmt(new BigDecimal(receivableAmt));
-                        calculateIntegral.setOilLiters(new BigDecimal(oilLiters));
-                        calculateIntegral.setOilName(oilName);
-                        calculateIntegral.setOilType(orderType);
-                        calculateIntegral.setStationId(Integer.valueOf(stationId));
-                        calculateIntegral.setUnionId(unionId);
-                        calculateIntegral.setOpenId(minaOpenid);   //小程序openId
-                        //计算积分且推送积分
-                        calculateIntegralAndPushIntegral(calculateIntegral, customerManage);
-                    }
+//                    StationPayManage stationPayManage = new StationPayManage();
+//                    stationPayManage.setStationId(Integer.valueOf(stationId));
+//                    StationPayManage stationPayManageInfo = stationService.selectStationPayManage(stationPayManage);
+//                    //是否启用积分功能
+//                    if(stationPayManageInfo !=null && stationPayManageInfo.getIntegralFlag().equals("1")){
+//                        //计算积分
+//                        CalculateIntegral calculateIntegral = new CalculateIntegral();
+//                        calculateIntegral.setAmt(new BigDecimal(amt));
+//                        calculateIntegral.setReceivableAmt(new BigDecimal(receivableAmt));
+//                        calculateIntegral.setOilLiters(new BigDecimal(oilLiters));
+//                        calculateIntegral.setOilName(oilName);
+//                        calculateIntegral.setOilType(orderType);
+//                        calculateIntegral.setStationId(Integer.valueOf(stationId));
+//                        calculateIntegral.setUnionId(unionId);
+//                        calculateIntegral.setOpenId(minaOpenid);   //小程序openId
+//                        //计算积分且推送积分
+//                        calculateIntegralAndPushIntegral(calculateIntegral, customerManage);
+//                    }
                     resultData = ResultData.success(CodeMsg.SUCCESS);
                     //打印小票
-                    this.printReceipt(payOrder);
+                    //this.printReceipt(payOrder);
+                    Map<String, Object> infoMap = payOrderService.getOrderInfoAndUserInfoByOrderNo(payOrder);
+                    PosPrinterUtil.sendPosPrintDirectMessage(infoMap);
                 }else {
                     resultData=ResultData.error(CodeMsg.BALANCE_NOT_EENOUGH);
                 }

+ 1 - 2
YijiaRestful/src/main/java/com/platform/yijia/utils/PosPrinterUtil.java

@@ -46,13 +46,13 @@ public class PosPrinterUtil {
         list.add(args);
         Map<String, Object> map = new HashMap<>();
         map.put("contentData", list);
+        //map.put("contentDataPrint", list);
         params.put("messageContent", map);
         logger.info("开始推送消息:" +JSONObject.toJSONString(params));
         //创建请求
         CloseableHttpClient httpClients = HttpClients.createDefault();
         CloseableHttpResponse response = null;
         try {
-
             // 创建Http Post请求
             HttpPost httpPost = new HttpPost(SEND_POS_PRINT_MESSAGE_URL);
             // 创建请求内容
@@ -61,7 +61,6 @@ public class PosPrinterUtil {
             // 执行http请求
             response = httpClients.execute(httpPost);
             String resultString = EntityUtils.toString(response.getEntity(), "utf-8");
-
             logger.info("POS推送订单消息结果:" +resultString);
         } catch (Exception e) {
             e.printStackTrace();