|
@@ -559,57 +559,64 @@ public class PayController {
|
|
|
logger.info("不存在客户 新增时参数: " + customerManage.toString());
|
|
|
payOrderService.insertCustomer(customerManage);
|
|
|
}
|
|
|
- }else{
|
|
|
- logger.info("该用户无手机号!");
|
|
|
- }
|
|
|
|
|
|
+ //打印机打印小票
|
|
|
+ String content1;
|
|
|
+ String content2;
|
|
|
+ String orderNoP = "";
|
|
|
+ String createdDateP ="";
|
|
|
+ String stationNameP ="";
|
|
|
+ String oilNameP ="";
|
|
|
+ String orderLitersP ="";
|
|
|
+ String oilPirceP ="";
|
|
|
+ String receivableAmtP = "";
|
|
|
+ String discountAmtP = "";
|
|
|
+ String amtP = "";
|
|
|
+ String mobilePhoneP = "";
|
|
|
+ String payWayP = "";
|
|
|
+ String sn; //打印机编号
|
|
|
+ //logger.info("要打印小票的订单信息: "+ listUp);
|
|
|
|
|
|
- //开始打印
|
|
|
- List<PayOrder> listUp = payOrderService.getPayOrderList(ordNo);
|
|
|
- String content1;
|
|
|
- String content2;
|
|
|
- String orderNoP = "";
|
|
|
- String createdDateP ="";
|
|
|
- String stationNameP ="";
|
|
|
- String oilNameP ="";
|
|
|
- String orderLitersP ="";
|
|
|
- String oilPirceP ="";
|
|
|
- String receivableAmtP = "";
|
|
|
- String discountAmtP = "";
|
|
|
- String amtP = "";
|
|
|
- String sn; //打印机编号
|
|
|
- if(listUp != null && listUp.size() == 1){
|
|
|
- logger.info("要打印小票的订单信息: "+ listUp);
|
|
|
-
|
|
|
- if(StringUtils.isNotBlank(listUp.get(0).getOrderNo())){
|
|
|
- orderNoP =listUp.get(0).getOrderNo();
|
|
|
+ if(StringUtils.isNotBlank(infoMap.get("orderNo").toString())){
|
|
|
+ orderNoP =infoMap.get("orderNo").toString();
|
|
|
}
|
|
|
- if(listUp.get(0).getCreatedDate() !=null && listUp.get(0).getCreatedDate().toString() !=""){
|
|
|
+ if(infoMap.containsKey("createdDate") && infoMap.get("createdDate") !=null ){
|
|
|
//格式化日期
|
|
|
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- createdDateP =sdf.format(listUp.get(0).getCreatedDate());
|
|
|
+ createdDateP =sdf.format(infoMap.get("createdDate"));
|
|
|
+ }
|
|
|
+ if(infoMap.containsKey("stationName") && infoMap.get("stationName") !=null ){
|
|
|
+ stationNameP =infoMap.get("stationName").toString();
|
|
|
}
|
|
|
- if(StringUtils.isNotBlank(listUp.get(0).getStationName())){
|
|
|
- stationNameP =listUp.get(0).getStationName();
|
|
|
+ if(infoMap.containsKey("oilName") && infoMap.get("oilName") !=null ){
|
|
|
+ oilNameP =infoMap.get("oilName").toString();
|
|
|
}
|
|
|
- if(StringUtils.isNotBlank(listUp.get(0).getOilName())){
|
|
|
- oilNameP =listUp.get(0).getOilName();
|
|
|
+ //加油升数
|
|
|
+ if(infoMap.containsKey("orderLiters") && infoMap.get("orderLiters") !=null ){
|
|
|
+ orderLitersP =infoMap.get("orderLiters")+"";
|
|
|
}
|
|
|
//油价
|
|
|
- if(listUp.get(0).getOrderLiters() !=null && listUp.get(0).getOrderLiters() !=""){
|
|
|
- orderLitersP =listUp.get(0).getOrderLiters()+"";
|
|
|
+ if(infoMap.containsKey("oilPirce") && infoMap.get("oilPirce") !=null ){
|
|
|
+ oilPirceP =infoMap.get("oilPirce")+"";
|
|
|
}
|
|
|
- if(listUp.get(0).getOilPirce() !=null && listUp.get(0).getOilPirce() != "" ){
|
|
|
- oilPirceP =listUp.get(0).getOilPirce()+"";
|
|
|
+ if(infoMap.containsKey("receivableAmt") && infoMap.get("receivableAmt") !=null ){
|
|
|
+ receivableAmtP =infoMap.get("receivableAmt")+"";
|
|
|
}
|
|
|
- if(listUp.get(0).getReceivableAmt() !=null && listUp.get(0).getReceivableAmt().toString() !=""){
|
|
|
- receivableAmtP =listUp.get(0).getReceivableAmt()+"";
|
|
|
+ if(infoMap.containsKey("discountAmt") && infoMap.get("discountAmt") !=null ){
|
|
|
+ discountAmtP =infoMap.get("discountAmt")+"";
|
|
|
}
|
|
|
- if(listUp.get(0).getDiscountAmt() != null && listUp.get(0).getDiscountAmt().toString() !=""){
|
|
|
- discountAmtP =listUp.get(0).getDiscountAmt()+"";
|
|
|
+ if(infoMap.containsKey("amt") && infoMap.get("amt") !=null ){
|
|
|
+ amtP =infoMap.get("amt")+"";
|
|
|
}
|
|
|
- if(listUp.get(0).getAmt() !=null && listUp.get(0).getAmt().toString() !=""){
|
|
|
- amtP =listUp.get(0).getAmt().toString()+"";
|
|
|
+ if(infoMap.containsKey("mobilePhone") && infoMap.get("mobilePhone") !=null ){
|
|
|
+ String phone =infoMap.get("mobilePhone")+"";
|
|
|
+ //手机号中间四位****代替
|
|
|
+ mobilePhoneP = phone.substring(0, 3) + "****" + phone.substring(7, phone.length());
|
|
|
+ }
|
|
|
+ if(infoMap.containsKey("payWay") && infoMap.get("payWay") !=null ){
|
|
|
+ if(infoMap.get("payWay").equals("02") || infoMap.get("payWay").equals("03")){
|
|
|
+ payWayP ="微信";
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
content1 = "<CB>支付小票--商户联</CB><BR>";
|
|
@@ -619,9 +626,11 @@ public class PayController {
|
|
|
content1 += "油品: "+oilNameP+" <BR>";
|
|
|
content1 += "油量: "+orderLitersP+" 升<BR>";
|
|
|
content1 += "单价: "+oilPirceP+" L/元<BR>";
|
|
|
- content1 += "金额: "+receivableAmtP+" 元<BR>";
|
|
|
+ content1 += "<BOLD><B>原价: "+receivableAmtP+" 元</B></BOLD><BR>";
|
|
|
content1 += "优惠: "+discountAmtP+" 元<BR>";
|
|
|
content1 += "支付: "+amtP+" 元<BR>";
|
|
|
+ content1 += "手机号: "+mobilePhoneP+" <BR>";
|
|
|
+ content1 += "支付方式: "+payWayP+" <BR>";
|
|
|
content1 += "<BR>";
|
|
|
content1 += "--------------------------------<BR>";
|
|
|
content1 += "<BR>";
|
|
@@ -633,15 +642,17 @@ public class PayController {
|
|
|
content2 += "油品: "+oilNameP+" <BR>";
|
|
|
content2 += "油量: "+orderLitersP+" 升<BR>";
|
|
|
content2 += "单价: "+oilPirceP+" L/元<BR>";
|
|
|
- content2 += "金额: "+receivableAmtP+" 元<BR>";
|
|
|
+ content2 += "<BOLD><B>原价: "+receivableAmtP+" 元</B></BOLD><BR>";
|
|
|
content2 += "优惠: "+discountAmtP+" 元<BR>";
|
|
|
content2 += "支付: "+amtP+" 元<BR>";
|
|
|
+ content2 += "手机号: "+mobilePhoneP+" <BR>";
|
|
|
+ content2 += "支付方式: "+payWayP+" <BR>";
|
|
|
content2 += "<BR>";
|
|
|
//获取打印机编号
|
|
|
//sn = "921611605"; //测试打印机 sn:921611605 key:72338zma
|
|
|
Map params =new HashMap();
|
|
|
- params.put("stationId", listUp.get(0).getStationId());
|
|
|
- params.put("oilGunNo", listUp.get(0).getOilGun());
|
|
|
+ params.put("stationId", infoMap.get("stationId").toString());
|
|
|
+ params.put("oilGunNo", infoMap.get("oilGun").toString());
|
|
|
Map m = stationOilGunService.getPrinterSnByStationIdAndOilGunNo(params);
|
|
|
if(m.containsKey("printerSn") && m.get("printerSn").toString()!= null && m.get("printerSn").toString()!=""){
|
|
|
sn = m.get("printerSn").toString();
|
|
@@ -649,17 +660,17 @@ public class PayController {
|
|
|
// JSONObject jsonPrintStatus = JSONObject.parseObject(FeiEPrinterUtil.queryPrinterStatus(sn));
|
|
|
// if(jsonPrintStatus.getString("data").equals("\\u5728\u7ebf\\uff0c\\u5de5\\u4f5c\\u72b6\u6001\\u6b63\\u5e38\\u3002")){
|
|
|
// logger.info("打印机在线,工作状态正常:" + jsonPrintStatus.toString());
|
|
|
- //开始打印
|
|
|
- String printInfo = FeiEPrinterUtil.printReceipt(sn, content1 + content2);
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(printInfo);
|
|
|
- if(jsonObject.getString("msg").equals("ok")){
|
|
|
- logger.info("打印成功:" + jsonObject.toString());
|
|
|
- //如果打印成功 添加小票数量
|
|
|
- PayOrder p = new PayOrder();
|
|
|
- p.setPrintCount(1);
|
|
|
- p.setOrderNo(ordNo);
|
|
|
- payOrderService.getUpdatePayOrder(p);
|
|
|
- }
|
|
|
+ //开始打印
|
|
|
+ String printInfo = FeiEPrinterUtil.printReceipt(sn, content1 + content2);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(printInfo);
|
|
|
+ if(jsonObject.getString("msg").equals("ok")){
|
|
|
+ logger.info("打印成功:" + jsonObject.toString());
|
|
|
+ //如果打印成功 添加小票数量
|
|
|
+ PayOrder p = new PayOrder();
|
|
|
+ p.setPrintCount(1);
|
|
|
+ p.setOrderNo(ordNo);
|
|
|
+ payOrderService.getUpdatePayOrder(p);
|
|
|
+ }
|
|
|
// }else if(jsonPrintStatus.getString("data").equals("\\u79bb\\u7ebf\\u3002")){
|
|
|
// logger.info("打印机离线:" + jsonPrintStatus.toString());
|
|
|
// }else if(jsonPrintStatus.getString("data").equals("\\u5728\\u7ebf\\uff0c\\u5de5\\u4f5c\\u72b6\\u6001\\u4e0d\\u6b63\\u5e38\\u3002")){
|
|
@@ -668,6 +679,8 @@ public class PayController {
|
|
|
}else {
|
|
|
logger.info("请正确配置打印机");
|
|
|
}
|
|
|
+ }else{
|
|
|
+ logger.info("该用户无手机号!");
|
|
|
}
|
|
|
}
|
|
|
}
|