|
@@ -54,6 +54,8 @@ public class ElectronicMembershipCardController {
|
|
private IntegralRuleService integralRuleService;
|
|
private IntegralRuleService integralRuleService;
|
|
@Resource
|
|
@Resource
|
|
private CustomerPointsRecordService customerPointsRecordService;
|
|
private CustomerPointsRecordService customerPointsRecordService;
|
|
|
|
+ @Resource
|
|
|
|
+ private StationOilGunService stationOilGunService;
|
|
|
|
|
|
//查询该油站是否启用电子会员卡
|
|
//查询该油站是否启用电子会员卡
|
|
@RequestMapping(value = "/getStationCardEnabledFlag", method = RequestMethod.GET)
|
|
@RequestMapping(value = "/getStationCardEnabledFlag", method = RequestMethod.GET)
|
|
@@ -80,11 +82,16 @@ public class ElectronicMembershipCardController {
|
|
ResultData resultData = null;
|
|
ResultData resultData = null;
|
|
logger.info("获取用户电子会员卡信息参数:油站ID:"+ stationId+"用户unionId:"+unionId);
|
|
logger.info("获取用户电子会员卡信息参数:油站ID:"+ stationId+"用户unionId:"+unionId);
|
|
if(stationId !=null && unionId !=null && unionId !=""){
|
|
if(stationId !=null && unionId !=null && unionId !=""){
|
|
- CustomerElectronicCard customerElectronicCard = new CustomerElectronicCard();
|
|
|
|
- customerElectronicCard.setStationId(stationId);
|
|
|
|
- customerElectronicCard.setUnionId(unionId);
|
|
|
|
- List<CustomerElectronicCard> electronicCardList = electronicMembershipCardService.getElectronicCardList(customerElectronicCard);
|
|
|
|
- resultData = ResultData.success(electronicCardList);
|
|
|
|
|
|
+ String stationCardEnabledFlag = electronicMembershipCardService.getStationCardEnabledFlag(stationId);
|
|
|
|
+ if(stationCardEnabledFlag.equals("1")){
|
|
|
|
+ CustomerElectronicCard customerElectronicCard = new CustomerElectronicCard();
|
|
|
|
+ customerElectronicCard.setStationId(stationId);
|
|
|
|
+ customerElectronicCard.setUnionId(unionId);
|
|
|
|
+ List<CustomerElectronicCard> electronicCardList = electronicMembershipCardService.getElectronicCardList(customerElectronicCard);
|
|
|
|
+ resultData = ResultData.success(electronicCardList);
|
|
|
|
+ }else {
|
|
|
|
+ resultData = ResultData.error(CodeMsg.NO_CARDENABLEFLAG);
|
|
|
|
+ }
|
|
}else {
|
|
}else {
|
|
resultData = ResultData.error(CodeMsg.REQUEST_FAIL);
|
|
resultData = ResultData.error(CodeMsg.REQUEST_FAIL);
|
|
}
|
|
}
|
|
@@ -338,6 +345,7 @@ public class ElectronicMembershipCardController {
|
|
payOrder.setReceivedAmt(Double.valueOf(amt));
|
|
payOrder.setReceivedAmt(Double.valueOf(amt));
|
|
payOrder.setDzkAmt(Double.valueOf(amt));
|
|
payOrder.setDzkAmt(Double.valueOf(amt));
|
|
payOrderService.getUpdatePayOrder(payOrder);
|
|
payOrderService.getUpdatePayOrder(payOrder);
|
|
|
|
+ resultMap.put("payTypep","dzk");
|
|
//更新客户表
|
|
//更新客户表
|
|
CustomerManage customerManage = new CustomerManage();
|
|
CustomerManage customerManage = new CustomerManage();
|
|
customerManage.setStationId(Integer.valueOf(stationId));
|
|
customerManage.setStationId(Integer.valueOf(stationId));
|
|
@@ -436,6 +444,8 @@ public class ElectronicMembershipCardController {
|
|
calculateIntegralAndPushIntegral(calculateIntegral, customerManage);
|
|
calculateIntegralAndPushIntegral(calculateIntegral, customerManage);
|
|
}
|
|
}
|
|
resultData = ResultData.success(CodeMsg.SUCCESS);
|
|
resultData = ResultData.success(CodeMsg.SUCCESS);
|
|
|
|
+ //打印小票
|
|
|
|
+ this.printReceipt(payOrder);
|
|
}else {
|
|
}else {
|
|
resultData=ResultData.error(CodeMsg.BALANCE_NOT_EENOUGH);
|
|
resultData=ResultData.error(CodeMsg.BALANCE_NOT_EENOUGH);
|
|
}
|
|
}
|
|
@@ -452,6 +462,153 @@ public class ElectronicMembershipCardController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 打印小票
|
|
|
|
+ */
|
|
|
|
+ public void printReceipt(PayOrder payOrder) {
|
|
|
|
+ Map<String, Object> infoMap = payOrderService.getOrderInfoAndUserInfoByOrderNo(payOrder);
|
|
|
|
+ //打印机打印小票
|
|
|
|
+ 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; //打印机编号
|
|
|
|
+
|
|
|
|
+ if(StringUtils.isNotBlank(infoMap.get("orderNo").toString())){
|
|
|
|
+ orderNoP =infoMap.get("orderNo").toString();
|
|
|
|
+ }
|
|
|
|
+ if(infoMap.containsKey("createdDate") && infoMap.get("createdDate") !=null ){
|
|
|
|
+ //格式化日期
|
|
|
|
+ SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
+ createdDateP =sdf.format(infoMap.get("createdDate"));
|
|
|
|
+ }
|
|
|
|
+ if(infoMap.containsKey("stationName") && infoMap.get("stationName") !=null ){
|
|
|
|
+ stationNameP =infoMap.get("stationName").toString();
|
|
|
|
+ }
|
|
|
|
+ if(infoMap.containsKey("oilName") && infoMap.get("oilName") !=null ){
|
|
|
|
+ oilNameP =infoMap.get("oilName").toString();
|
|
|
|
+ }
|
|
|
|
+ if(infoMap.containsKey("orderType") && infoMap.get("orderType").equals("1")) {
|
|
|
|
+ //加油升数
|
|
|
|
+ if (infoMap.containsKey("orderLiters") && infoMap.get("orderLiters") != null) {
|
|
|
|
+ orderLitersP = infoMap.get("orderLiters") + "";
|
|
|
|
+ }
|
|
|
|
+ //油价
|
|
|
|
+ if (infoMap.containsKey("oilPirce") && infoMap.get("oilPirce") != null) {
|
|
|
|
+ oilPirceP = infoMap.get("oilPirce") + "";
|
|
|
|
+ }
|
|
|
|
+ if(infoMap.containsKey("discountAmt") && infoMap.get("discountAmt") !=null ){
|
|
|
|
+ discountAmtP =infoMap.get("discountAmt")+"";
|
|
|
|
+ }
|
|
|
|
+ }else if(infoMap.containsKey("orderType") && infoMap.get("orderType").equals("2")) {
|
|
|
|
+ orderLitersP ="0.00";
|
|
|
|
+ oilPirceP = "0.00";
|
|
|
|
+ discountAmtP ="0.00";
|
|
|
|
+ receivableAmtP=infoMap.get("amt")+"";
|
|
|
|
+ }
|
|
|
|
+ if(infoMap.containsKey("receivableAmt") && infoMap.get("receivableAmt") !=null ){
|
|
|
|
+ receivableAmtP =infoMap.get("receivableAmt")+"";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(infoMap.containsKey("amt") && infoMap.get("amt") !=null ){
|
|
|
|
+ amtP =infoMap.get("amt")+"";
|
|
|
|
+ }
|
|
|
|
+ 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("payType") && infoMap.get("payType") !=null ){
|
|
|
|
+ if(infoMap.get("payType").equals("wx")){
|
|
|
|
+ payWayP ="微信";
|
|
|
|
+ }
|
|
|
|
+ if(infoMap.get("payType").equals("dzk")){
|
|
|
|
+ payWayP ="电子卡";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ content1 = "<CB>支付小票--顾客联</CB><BR>";
|
|
|
|
+ content1 += "订单号:"+orderNoP+" <BR>";
|
|
|
|
+ content1 += "时间:"+createdDateP+" <BR>";
|
|
|
|
+ content1 += "油站:"+stationNameP+" <BR>";
|
|
|
|
+ if(infoMap.containsKey("orderType") && infoMap.get("orderType").toString().equals("1")){
|
|
|
|
+ content1 += "油品: "+oilNameP+" <BR>";
|
|
|
|
+ content1 += "油量: "+orderLitersP+" 升<BR>";
|
|
|
|
+ content1 += "单价: "+oilPirceP+" L/元<BR>";
|
|
|
|
+ }
|
|
|
|
+ content1 += "<BOLD><B>原价: "+receivableAmtP+" 元</B></BOLD><BR>";
|
|
|
|
+ if(infoMap.containsKey("orderType") && infoMap.get("orderType").toString().equals("1")){
|
|
|
|
+ content1 += "优惠: "+discountAmtP+" 元<BR>";
|
|
|
|
+ }
|
|
|
|
+ content1 += "支付: "+amtP+" 元<BR>";
|
|
|
|
+ content1 += "支付方式: "+payWayP+" <BR>";
|
|
|
|
+ content1 += "<BR>";
|
|
|
|
+ //content1 += "--------------------------------<BR>";
|
|
|
|
+ content1 += "<BR>";
|
|
|
|
+
|
|
|
|
+ content2 = "<CB>支付小票--商户联</CB><BR>";
|
|
|
|
+ content2 += "订单号:"+orderNoP+" <BR>";
|
|
|
|
+ content2 += "时间:"+createdDateP+"<BR>";
|
|
|
|
+ content2 += "油站:"+stationNameP+" <BR>";
|
|
|
|
+ if(infoMap.containsKey("orderType") && infoMap.get("orderType").toString().equals("1")){
|
|
|
|
+ content2 += "油品: "+oilNameP+" <BR>";
|
|
|
|
+ content2 += "油量: "+orderLitersP+" 升<BR>";
|
|
|
|
+ content2 += "单价: "+oilPirceP+" L/元<BR>";
|
|
|
|
+ }
|
|
|
|
+ content2 += "<BOLD><B>原价: "+receivableAmtP+" 元</B></BOLD><BR>";
|
|
|
|
+ if(infoMap.containsKey("orderType") && infoMap.get("orderType").toString().equals("1")){
|
|
|
|
+ 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", infoMap.get("stationId").toString());
|
|
|
|
+ params.put("oilGunNo", infoMap.get("oilGun").toString());
|
|
|
|
+ Map m = stationOilGunService.getPrinterSnByStationIdAndOilGunNo(params);
|
|
|
|
+ if(m !=null && m.containsKey("printerSn") && m.get("printerSn").toString()!= null && m.get("printerSn").toString()!=""){
|
|
|
|
+ sn = m.get("printerSn").toString();
|
|
|
|
+ //开始打印
|
|
|
|
+ String printInfo=""; //打印信息
|
|
|
|
+ if(m.containsKey("printSetting") && m.get("printSetting").toString()!= null && m.get("printSetting").toString()!=""){
|
|
|
|
+ switch (m.get("printSetting").toString()){
|
|
|
|
+ case "1": //1 客户联
|
|
|
|
+ printInfo = FeiEPrinterUtil.printReceipt(sn, content1);
|
|
|
|
+ break;
|
|
|
|
+ case "2": //2 商户联
|
|
|
|
+ printInfo = FeiEPrinterUtil.printReceipt(sn, content2);
|
|
|
|
+ break;
|
|
|
|
+ case "3": //3商户联和客户联
|
|
|
|
+ printInfo = FeiEPrinterUtil.printReceipt(sn, content1 + content2);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(printInfo);
|
|
|
|
+ if(jsonObject != null && jsonObject.getString("msg").equals("ok")){
|
|
|
|
+ logger.info("打印成功:" + jsonObject.toString());
|
|
|
|
+ //如果打印成功 添加小票数量
|
|
|
|
+ PayOrder p = new PayOrder();
|
|
|
|
+ p.setPrintCount(1);
|
|
|
|
+ p.setOrderNo(infoMap.get("orderNo").toString());
|
|
|
|
+ payOrderService.getUpdatePayOrder(p);
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ logger.info("请正确配置打印机");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
//用户充值电子会员卡(储蓄卡)拉起随行付支付接口
|
|
//用户充值电子会员卡(储蓄卡)拉起随行付支付接口
|
|
@RequestMapping(value = "/rechargeBalanceSXFPay", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/rechargeBalanceSXFPay", method = RequestMethod.POST)
|
|
@ResponseBody
|
|
@ResponseBody
|