|
@@ -200,6 +200,12 @@ public class PayOrderController {
|
|
|
break;
|
|
|
}
|
|
|
payOrder.setOilType(orderType);
|
|
|
+ String stationCardEnabledFlag = electronicMembershipCardService.getStationCardEnabledFlag(payOrderRequest.getStationId());
|
|
|
+ //查询油站是否开启电子会员卡功能
|
|
|
+ if(stationCardEnabledFlag.equals("1")){
|
|
|
+ String balance = this.selectCardBalance(payOrderRequest.getStationId(), oilName, appUserInfoList.get(0).getUnionId());
|
|
|
+ resultMap.put("balance", balance);
|
|
|
+ }
|
|
|
StationInfo stationInfo = new StationInfo();
|
|
|
stationInfo.setStationId(payOrderRequest.getStationId());
|
|
|
StationInfo stationInfos = stationService.selectStationInfo(stationInfo);
|
|
@@ -208,7 +214,7 @@ public class PayOrderController {
|
|
|
resultMap.put("stationPic", stationInfos.getStationPic());
|
|
|
resultMap.put("stationName", stationInfos.getStationName());
|
|
|
}
|
|
|
- payOrder.setPayType("wx"); //支付类型
|
|
|
+ //payOrder.setPayType("wx"); //支付类型
|
|
|
switch (orderType){
|
|
|
case "1": //油品
|
|
|
payOrderMapper.insertSelective(payOrder);
|
|
@@ -240,6 +246,41 @@ public class PayOrderController {
|
|
|
return gson.toJson(resultData);
|
|
|
}
|
|
|
|
|
|
+ //查询用户电子会员卡余额
|
|
|
+ public String selectCardBalance(Integer stationId, String oilName, String unionId) {
|
|
|
+ String cardOilsType ="";
|
|
|
+ switch (oilName){ //根据油品名称存储电子卡油品类型 1.柴油 2 汽油
|
|
|
+ case "92#":
|
|
|
+ cardOilsType ="1";
|
|
|
+ break;
|
|
|
+ case "95#":
|
|
|
+ cardOilsType ="1";
|
|
|
+ break;
|
|
|
+ case "97#":
|
|
|
+ cardOilsType ="1";
|
|
|
+ break;
|
|
|
+ case "0#":
|
|
|
+ cardOilsType ="2";
|
|
|
+ break;
|
|
|
+ case "-10#":
|
|
|
+ cardOilsType ="2";
|
|
|
+ break;
|
|
|
+ case "-20#":
|
|
|
+ cardOilsType ="2";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ CustomerElectronicCard customerElectronicCard = new CustomerElectronicCard();
|
|
|
+ customerElectronicCard.setCardOilsType(cardOilsType);
|
|
|
+ customerElectronicCard.setStationId(stationId);
|
|
|
+ customerElectronicCard.setUnionId(unionId);
|
|
|
+ CustomerElectronicCard electronicCardInfo = electronicMembershipCardService.getElectronicCardInfoByUnionId(customerElectronicCard);
|
|
|
+ BigDecimal balance = null;
|
|
|
+ if(electronicCardInfo !=null){
|
|
|
+ balance = electronicCardInfo.getAmt();
|
|
|
+ }
|
|
|
+ return balance.toString();
|
|
|
+ }
|
|
|
+
|
|
|
/***
|
|
|
* 计算订单金额
|
|
|
* @return
|