|
@@ -440,7 +440,7 @@ public class ElectronicMembershipCardController {
|
|
|
customerManage.setLiters(customerManageInfo.getLiters().add(new BigDecimal(oilLiters)));
|
|
|
logger.info("存在客户 更新时手机号参数: " + customerManage.getPhoneNumber());
|
|
|
List<Map> customerGradeInfo = customerGradeServices.getCustomerGradeListOrderByDesc(params_1); //直降
|
|
|
- logger.info("该站直降等级信息:"+ customerGradeInfo);
|
|
|
+ //logger.info("该站直降等级信息:"+ customerGradeInfo);
|
|
|
for (Map m: customerGradeInfo){
|
|
|
if(Double.valueOf(customerManage.getAmt().toString()) >= Double.valueOf(m.get("memberConditStart").toString())){
|
|
|
customerManage.setGrade(m.get("id").toString()); //存入等级ID
|
|
@@ -459,7 +459,7 @@ public class ElectronicMembershipCardController {
|
|
|
customerManage.setUnionId(unionId);
|
|
|
customerManage.setRegtime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(registeDate));
|
|
|
List<Map> customerGradeInfo = customerGradeServices.getCustomerGradeList(params_1); //直降
|
|
|
- logger.info("该站直降等级信息:"+ customerGradeInfo);
|
|
|
+ //logger.info("该站直降等级信息:"+ customerGradeInfo);
|
|
|
if(customerGradeInfo !=null && customerGradeInfo.size() >0){
|
|
|
customerManage.setGrade(customerGradeInfo.get(0).get("id").toString()); //存入等级ID
|
|
|
}
|
|
@@ -491,14 +491,6 @@ public class ElectronicMembershipCardController {
|
|
|
stationName = m.get("stationName");
|
|
|
gzhAppId = m.get("gzhAppId");
|
|
|
gzhAppSecret = m.get("gzhAppSecret");
|
|
|
-// Oil oil_1 = new Oil();
|
|
|
-// oil.setOilsType(customerCardUseRecordInfo.getCardOilsType());
|
|
|
-// if(customerCardUseRecordInfo.getCardOilsType().equals("1") || customerCardUseRecordInfo.getCardOilsType().equals("2")){
|
|
|
-// oil.setDictType("oil");
|
|
|
-// }else {
|
|
|
-// oil.setDictType("oil_name");
|
|
|
-// }
|
|
|
-// String cardName =sysDictDataService.selectOilType(oil).getOilName();
|
|
|
//推送模板
|
|
|
List<WxMpTemplateData> wxMpTemplate = new ArrayList<>();
|
|
|
wxMpTemplate.add(new WxMpTemplateData("first","尊敬的"+consumer+",您好:\n" + "您在"+stationName+"的最新消费交易信息如下"));
|
|
@@ -519,9 +511,6 @@ public class ElectronicMembershipCardController {
|
|
|
}
|
|
|
int integral =0;
|
|
|
//是否启用积分功能
|
|
|
-// StationInfo stationInfo = new StationInfo();
|
|
|
-// stationInfo.setStationId(Integer.valueOf(stationId));
|
|
|
-// StationInfo stationInfos = stationService.selectStationInfo(stationInfo);
|
|
|
CalculateIntegral calculateIntegral = new CalculateIntegral();
|
|
|
calculateIntegral.setGroupId(stationInfos.getGroupId());
|
|
|
calculateIntegral.setNickName(consumer);
|
|
@@ -542,7 +531,6 @@ public class ElectronicMembershipCardController {
|
|
|
CalculateIntegral calculateIntegralInfos;
|
|
|
if(stationInfos.getIntegralRuleFlagGroup().equals("1")){ //表示积分共享
|
|
|
if(stationInfos.getIntegralFlagGroup().equals("1")){ //集团开启积分功能
|
|
|
- //calculateIntegral.setGroupId(stationInfos.getGroupId());
|
|
|
calculateIntegralInfos = this.calculateIntegral(calculateIntegral);
|
|
|
//插入客户所得积分
|
|
|
customerPoints = this.insertUserIntegral(calculateIntegralInfos);
|
|
@@ -552,7 +540,6 @@ public class ElectronicMembershipCardController {
|
|
|
}
|
|
|
}else {
|
|
|
if(stationInfos.getIntegralFlag().equals("1")){
|
|
|
- //calculateIntegral.setStationId(stationInfos.getStationId());
|
|
|
calculateIntegralInfos = this.calculateIntegral(calculateIntegral);
|
|
|
integral =calculateIntegralInfos.getIntegral();
|
|
|
//插入客户所得积分
|
|
@@ -563,22 +550,59 @@ public class ElectronicMembershipCardController {
|
|
|
}
|
|
|
resultData = ResultData.success(CodeMsg.SUCCESS);
|
|
|
|
|
|
- //油站小票打印方式
|
|
|
- if(stationInfos !=null && stationInfos.getPrintDeviceType() !=null){
|
|
|
- logger.info("小票打印方式:" + stationInfo.getPrintDeviceType());
|
|
|
- switch (stationInfos.getPrintDeviceType()){
|
|
|
- case "1": //小票机打印
|
|
|
- logger.info("小票机打印");
|
|
|
- this.printReceipt(payOrder);
|
|
|
- break;
|
|
|
- case "2": //POS机打印
|
|
|
- logger.info("POS打印");
|
|
|
- payOrder.setIntegral(String.valueOf(integral));
|
|
|
- payOrder.setPrintSetting(stationInfos.getPrintSetting());
|
|
|
- this.posPrintReceipt(payOrder);
|
|
|
- break;
|
|
|
+ //获取油枪绑定的POS机信息
|
|
|
+ StationDeviceManager stationDeviceManager = new StationDeviceManager();
|
|
|
+ stationDeviceManager.setGunNo(resultMap.get("oilGun").toString());
|
|
|
+ stationDeviceManager.setStationId(Integer.valueOf(stationId));
|
|
|
+ List<StationDeviceManager> stationDeviceManagerList = stationService.getStationDeviceManagerList(stationDeviceManager);
|
|
|
+ if(stationDeviceManagerList !=null && stationDeviceManagerList.size() >0){
|
|
|
+ String deviceType = stationDeviceManagerList.get(0).getDeviceType();
|
|
|
+ if(deviceType !=null && deviceType !=""){
|
|
|
+ switch (deviceType){
|
|
|
+ case "1":
|
|
|
+ logger.info("小票机打印方式");
|
|
|
+ if(stationDeviceManagerList.get(0).getDeviceNo() !=null){
|
|
|
+ payOrder.setDeviceNo(stationDeviceManagerList.get(0).getDeviceNo());
|
|
|
+ payOrder.setPrintSetting(stationInfos.getPrintSetting());
|
|
|
+ this.printReceipt(payOrder);
|
|
|
+ }else {
|
|
|
+ logger.info("小票机配置错误,请正确配置打印机");
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "2":
|
|
|
+ logger.info("POS机打印方式");
|
|
|
+ payOrder.setIntegral(String.valueOf(integral));
|
|
|
+ payOrder.setPrintSetting(stationInfos.getPrintSetting());
|
|
|
+ if(stationDeviceManagerList.get(0).getDeviceNo()!=null && stationDeviceManagerList.get(0).getPosFanoutExchange() !=null && stationDeviceManagerList.get(0).getPosQueue() !=null){
|
|
|
+ payOrder.setPosFanoutExchange(stationDeviceManagerList.get(0).getPosFanoutExchange());
|
|
|
+ payOrder.setPosQueue(stationDeviceManagerList.get(0).getPosFanoutExchange());
|
|
|
+ payOrder.setDeviceNo(stationDeviceManagerList.get(0).getDeviceNo());
|
|
|
+ this.posPrintReceipt(payOrder);
|
|
|
+ }else {
|
|
|
+ logger.info("POS机配置错误,请正确配置打印机");
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ //油站小票打印方式
|
|
|
+// if(stationInfos !=null && stationInfos.getPrintDeviceType() !=null){
|
|
|
+// logger.info("小票打印方式:" + stationInfo.getPrintDeviceType());
|
|
|
+// switch (stationInfos.getPrintDeviceType()){
|
|
|
+// case "1": //小票机打印
|
|
|
+// logger.info("小票机打印");
|
|
|
+// this.printReceipt(payOrder);
|
|
|
+// break;
|
|
|
+// case "2": //POS机打印
|
|
|
+// logger.info("POS打印");
|
|
|
+// payOrder.setIntegral(String.valueOf(integral));
|
|
|
+// payOrder.setPrintSetting(stationInfos.getPrintSetting());
|
|
|
+// this.posPrintReceipt(payOrder);
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
}else {
|
|
|
resultData=ResultData.error(CodeMsg.BALANCE_NOT_EENOUGH);
|
|
|
}
|
|
@@ -674,15 +698,15 @@ public class ElectronicMembershipCardController {
|
|
|
params.put("messageTitle", "pos");
|
|
|
params.put("messageType", "sys");
|
|
|
//获取油枪绑定的POS机信息
|
|
|
- StationDeviceManager stationDeviceManager = new StationDeviceManager();
|
|
|
- stationDeviceManager.setDeviceType("2");
|
|
|
- stationDeviceManager.setStationId(Integer.valueOf(infoMap.get("stationId").toString()));
|
|
|
- stationDeviceManager.setGunNo(infoMap.get("oilGun").toString());
|
|
|
- StationDeviceManager stationDeviceManagerInfo = stationService.getStationDeviceManager(stationDeviceManager);
|
|
|
- if(stationDeviceManagerInfo !=null && stationDeviceManagerInfo.getPosFanoutExchange() !=null && stationDeviceManagerInfo.getPosQueue() !=null){
|
|
|
- params.put("posFanoutExchange", stationDeviceManagerInfo.getPosFanoutExchange());
|
|
|
- params.put("posQueue", stationDeviceManagerInfo.getPosQueue());
|
|
|
- params.put("tusn", stationDeviceManagerInfo.getDeviceNo());
|
|
|
+// StationDeviceManager stationDeviceManager = new StationDeviceManager();
|
|
|
+// stationDeviceManager.setDeviceType("2");
|
|
|
+// stationDeviceManager.setStationId(Integer.valueOf(infoMap.get("stationId").toString()));
|
|
|
+// stationDeviceManager.setGunNo(infoMap.get("oilGun").toString());
|
|
|
+// StationDeviceManager stationDeviceManagerInfo = stationService.getStationDeviceManager(stationDeviceManager);
|
|
|
+// if(stationDeviceManagerInfo !=null && stationDeviceManagerInfo.getPosFanoutExchange() !=null && stationDeviceManagerInfo.getPosQueue() !=null){
|
|
|
+ params.put("posFanoutExchange", payOrder.getPosFanoutExchange());
|
|
|
+ params.put("posQueue", payOrder.getPosQueue());
|
|
|
+ params.put("tusn", payOrder.getDeviceNo());
|
|
|
params.put("printSetting", payOrder.getPrintSetting()); //小票打印方式
|
|
|
List<Map<String, Object>> list = new ArrayList<>();
|
|
|
list.add(m);
|
|
@@ -699,7 +723,7 @@ public class ElectronicMembershipCardController {
|
|
|
p.setOrderNo(infoMap.get("orderNo").toString());
|
|
|
payOrderService.getUpdatePayOrder(p);
|
|
|
}
|
|
|
- }
|
|
|
+ //}
|
|
|
|
|
|
}
|
|
|
|
|
@@ -837,39 +861,28 @@ public class ElectronicMembershipCardController {
|
|
|
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());
|
|
|
- params.put("deviceType", "1");
|
|
|
- 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);
|
|
|
+ //开始打印
|
|
|
+ sn = payOrder.getDeviceNo();
|
|
|
+ String printInfo=""; //打印信息
|
|
|
+ switch (payOrder.getPrintSetting()){
|
|
|
+ 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;
|
|
|
}
|
|
|
- }else {
|
|
|
- logger.info("请正确配置打印机");
|
|
|
+ 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);
|
|
|
}
|
|
|
}
|
|
|
|