|
@@ -252,39 +252,34 @@ public class IntegralShoppingMallController {
|
|
|
map.put("surplusPoints", surplusPoints);
|
|
|
map.put("customerName", integralOrder.getCustomerName());
|
|
|
map.put("orderType", "3");
|
|
|
- String resultString = PosPrinterUtil.sendPosPrintDirectMessage(map);
|
|
|
- JSONObject jsonObject_pos = JSONObject.parseObject(resultString);
|
|
|
- if(jsonObject_pos.containsKey("code") && jsonObject_pos.get("code").toString().equals("200")){
|
|
|
- //如果打印成功 添加小票数量
|
|
|
- integralOrder.setPrinterStatus("1");
|
|
|
- integralOrderService.updateIntegralOrder(integralOrder);
|
|
|
- }
|
|
|
+ map.put("stationId", request.getStationId().toString());
|
|
|
+ this.posPrintReceipt(map);
|
|
|
|
|
|
//打印机打印小票
|
|
|
- List<Map<String, Object>> stationPrinterList = stationService.getStationPrinterList(request.getStationId());
|
|
|
- if(stationPrinterList != null && stationPrinterList.get(0).get("integralPrintFlag").toString().equals("1")){
|
|
|
- if(stationPrinterList.get(0).get("printerSn") !=null){
|
|
|
- String sn=stationPrinterList.get(0).get("printerSn").toString();
|
|
|
- String content1;
|
|
|
- content1 = "<CB>积分订单小票</CB><BR>";
|
|
|
- content1 += "订单号:"+integralOrderNo+" <BR>";
|
|
|
- content1 += "交易时间:"+new SimpleDateFormat(" yyyy-MM-dd HH:mm:ss").format(integralOrder.getExchangeTime())+" <BR>";
|
|
|
- content1 += "油站:"+stationName+" <BR>";
|
|
|
- content1 += "兑换商品:"+integralOrder.getWaresName()+" <BR>";
|
|
|
- content1 += "商品数量:x "+integralOrder.getExchangeNum()+" <BR>";
|
|
|
- content1 += "消耗积分: "+orderSumIntegral+" 分<BR>";
|
|
|
- content1 += "剩余积分: "+surplusPoints+" 分<BR>";
|
|
|
- //content1 += "<BOLD><B>消耗积分: "+orderSumIntegral+" 分</B></BOLD><BR>";
|
|
|
- content1 += "客户昵称: "+integralOrder.getCustomerName()+" <BR>";
|
|
|
- content1 += "<BR>";
|
|
|
- String printInfo = FeiEPrinterUtil.printReceipt(sn, content1);
|
|
|
- com.alibaba.fastjson.JSONObject jsonObject = JSONObject.parseObject(printInfo);
|
|
|
- if(jsonObject != null && jsonObject.getString("msg").equals("ok")){
|
|
|
- integralOrder.setPrinterStatus("1");
|
|
|
- integralOrderService.updateIntegralOrder(integralOrder);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// List<Map<String, Object>> stationPrinterList = stationService.getStationPrinterList(request.getStationId());
|
|
|
+// if(stationPrinterList != null && stationPrinterList.get(0).get("integralPrintFlag").toString().equals("1")){
|
|
|
+// if(stationPrinterList.get(0).get("printerSn") !=null){
|
|
|
+// String sn=stationPrinterList.get(0).get("printerSn").toString();
|
|
|
+// String content1;
|
|
|
+// content1 = "<CB>积分订单小票</CB><BR>";
|
|
|
+// content1 += "订单号:"+integralOrderNo+" <BR>";
|
|
|
+// content1 += "交易时间:"+new SimpleDateFormat(" yyyy-MM-dd HH:mm:ss").format(integralOrder.getExchangeTime())+" <BR>";
|
|
|
+// content1 += "油站:"+stationName+" <BR>";
|
|
|
+// content1 += "兑换商品:"+integralOrder.getWaresName()+" <BR>";
|
|
|
+// content1 += "商品数量:x "+integralOrder.getExchangeNum()+" <BR>";
|
|
|
+// content1 += "消耗积分: "+orderSumIntegral+" 分<BR>";
|
|
|
+// content1 += "剩余积分: "+surplusPoints+" 分<BR>";
|
|
|
+// //content1 += "<BOLD><B>消耗积分: "+orderSumIntegral+" 分</B></BOLD><BR>";
|
|
|
+// content1 += "客户昵称: "+integralOrder.getCustomerName()+" <BR>";
|
|
|
+// content1 += "<BR>";
|
|
|
+// String printInfo = FeiEPrinterUtil.printReceipt(sn, content1);
|
|
|
+// com.alibaba.fastjson.JSONObject jsonObject = JSONObject.parseObject(printInfo);
|
|
|
+// if(jsonObject != null && jsonObject.getString("msg").equals("ok")){
|
|
|
+// integralOrder.setPrinterStatus("1");
|
|
|
+// integralOrderService.updateIntegralOrder(integralOrder);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
}else {
|
|
|
resultData=ResultData.error(CodeMsg.REQUEST_FAIL);
|
|
|
}
|
|
@@ -301,27 +296,39 @@ public class IntegralShoppingMallController {
|
|
|
return gson.toJson(resultData);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- //获取公众号消息模板
|
|
|
-// @RequestMapping(value = "/getGzhNewsTemplate", method = RequestMethod.GET)
|
|
|
-// @ResponseBody
|
|
|
-// public String getGzhNewsTemplate(@RequestParam Integer stationId, String templateType){
|
|
|
-// Gson gson =new Gson();
|
|
|
-// //返回结果集
|
|
|
-// ResultData resultData = null;
|
|
|
-// if(stationId !=null){
|
|
|
-// GzhNewsTemplate gzhNewsTemplate = new GzhNewsTemplate();
|
|
|
-// gzhNewsTemplate.setStationId(stationId);
|
|
|
-// gzhNewsTemplate.setTemplateType(templateType);
|
|
|
-// GzhNewsTemplate gzhNewsTemplate1 = gzhNewsTemplateService.getGzhNewsTemplate(gzhNewsTemplate);
|
|
|
-// resultData=ResultData.success(gzhNewsTemplate1);
|
|
|
-// }else {
|
|
|
-// resultData=ResultData.success(CodeMsg.REQUEST_FAIL);
|
|
|
-// }
|
|
|
-// return gson.toJson(resultData);
|
|
|
-// }
|
|
|
+ //POS机打印小票
|
|
|
+ public void posPrintReceipt(Map map){
|
|
|
+ logger.info("要推送的订单的信息:" +map.toString());
|
|
|
+ //定义推送格式
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ params.put("messageTitle", "pos");
|
|
|
+ params.put("messageType", "sys");
|
|
|
+ //获取油枪绑定的POS机信息
|
|
|
+ StationDeviceManager stationDeviceManager = new StationDeviceManager();
|
|
|
+ stationDeviceManager.setDeviceType("2");
|
|
|
+ stationDeviceManager.setStationId(Integer.valueOf(map.get("stationId").toString()));
|
|
|
+ stationDeviceManager.setGunNo("1");
|
|
|
+ StationDeviceManager stationDeviceManagerInfo = stationService.getStationDeviceManager(stationDeviceManager);
|
|
|
+ if(stationDeviceManagerInfo !=null && stationDeviceManagerInfo.getPosFanoutExchange() !=null && stationDeviceManagerInfo.getPosQueue() !=null){
|
|
|
+ params.put("posFanoutExchange", stationDeviceManagerInfo.getPosFanoutExchange());
|
|
|
+ params.put("posQueue", stationDeviceManagerInfo.getPosQueue());
|
|
|
+ }
|
|
|
+ List<Map<String, Object>> list = new ArrayList<>();
|
|
|
+ list.add(map);
|
|
|
+ Map<String, Object> mm = new HashMap<>();
|
|
|
+ mm.put("contentData", list);
|
|
|
+ params.put("messageContent", mm);
|
|
|
+ //开始推送消息
|
|
|
+ logger.info("开始推送消息:" +JSONObject.toJSONString(params));
|
|
|
+ String resultString = PosPrinterUtil.sendPosPrintDirectMessage(params);
|
|
|
+ JSONObject jsonObject_pos = JSONObject.parseObject(resultString);
|
|
|
+ if(jsonObject_pos.containsKey("code") && jsonObject_pos.get("code").toString().equals("200")){
|
|
|
+ //如果打印成功 添加小票数量
|
|
|
+ IntegralOrder integralOrder = new IntegralOrder();
|
|
|
+ integralOrder.setPrinterStatus("1");
|
|
|
+ integralOrderService.updateIntegralOrder(integralOrder);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
//获取用户积分订单列表
|
|
|
@RequestMapping(value = "/getUserIntegralOrderList", method = RequestMethod.GET)
|