diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/MerchantConfig.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/MerchantConfig.java index 3c38fd687..0b61f658b 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/MerchantConfig.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/MerchantConfig.java @@ -62,6 +62,10 @@ public class MerchantConfig extends BaseEntity implements Serializable { * 账户金额 */ private Double amount; + /** + * 小程序appid + */ + private String appid; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java index a4488c8fd..1e6eae96b 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java @@ -337,13 +337,12 @@ public class FyPayServiceImpl implements FyPayService { map.put("mchnt_order_no",orderNo); map.put("order_amt", allAmount); map.put("sub_openid", map1.get("openId")); + map.put("sub_appid", map1.get("appid")); // 请求报文 String reqBody = Message.requestMsg(map); // 响应报文 String rspXml = Message.responseMsg(reqBody,Const.fuiou_23_url); - System.out.println("1+"+reqBody); - System.out.println("2+"+rspXml); //响应报文验签 Map resMap = Utils.xmlStr2Map(rspXml); @@ -352,7 +351,6 @@ public class FyPayServiceImpl implements FyPayService { } System.out.println(resMap); - return resMap; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/mapper/xml/CardValueRecordMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/mapper/xml/CardValueRecordMapper.xml index f43bf0aaf..2c655409d 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/mapper/xml/CardValueRecordMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/mapper/xml/CardValueRecordMapper.xml @@ -4,7 +4,28 @@ diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/OilOrderController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/OilOrderController.java index 247b0385c..0bd45445e 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/OilOrderController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/OilOrderController.java @@ -81,8 +81,7 @@ public class OilOrderController extends BaseController { */ @PostMapping("/appletPay") public ResponseObject appletPay(@Validated @RequestBody Map map){ - orderService.appletPay(map); - return getSuccessResult("success"); + return getSuccessResult(orderService.appletPay(map)); } /** diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/OilOrderService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/OilOrderService.java index b9c19bf5b..7675028ee 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/OilOrderService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/OilOrderService.java @@ -76,7 +76,7 @@ public interface OilOrderService extends IService { * 小程序订单支付 * @param map */ - public void appletPay(Map map); + public boolean appletPay(Map map); /** * 添加油品跟踪信息 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java index ac9636d17..068e09a90 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java @@ -383,8 +383,11 @@ public class OilOrderServiceImpl extends ServiceImpl i return orderNo; } + @Autowired + private OilNumberService oilNumberService; + @Override - public void appletPay(Map map) { + public boolean appletPay(Map map) { String orderNo = map.get("orderNo"); // 支付金额 Integer payAmount = (int) (Double.valueOf(map.get("payAmount"))*100); @@ -392,17 +395,46 @@ public class OilOrderServiceImpl extends ServiceImpl i String discountAmount = map.get("discountAmount"); // 囤油卡消费后的信息 String oilCardAmount = map.get("oilCardAmount"); +// 囤油卡消费升数 + Double oilCardLiters = Double.valueOf(map.get("oilCardLiters")); +// 是否使用囤油卡 + String isOilStorageCard = map.get("isOilStorageCard"); // 储值卡消费金额 String balanceAmount = map.get("balanceAmount"); Integer tankId = Integer.valueOf(map.get("tankId")); // 根据订单号查询订单信息 OilOrder oilOrder = this.selectOilOrderByOrderNo(orderNo); +// 获取油品信息 + OilNumber oilNumber = oilNumberService.selectOilNumberByOilName(oilOrder.getOils(), oilOrder.getStoreId()); -// 校验支付金额和优惠金额数据是否相同(可能会有误差,四舍五入) - Double realAmount = Double.valueOf(map.get("payAmount")) + Double.valueOf(map.get("discountAmount")); - if ((oilOrder.getOrderAmount()-realAmount)>=0.05){ - return; + boolean result = false; + + if (isOilStorageCard.equals("true")) { +// 使用囤油卡 +// 校验囤油卡升数 + if (balanceAmount.equals("0") && map.get("payAmount").equals("0")) { + if (Double.compare(oilCardLiters,oilOrder.getOilNum())!=0){ + result = true; + } + }else { + Double useLiters = oilOrder.getOilNum() - oilCardLiters; + Double residueAmount = useLiters * oilNumber.getOilPrice(); + if ((Double.valueOf(map.get("payAmount"))+Double.valueOf(balanceAmount)-residueAmount)>=0.05){ + result = true; + } + } + }else { +// 未使用囤油卡 +// 校验支付金额和优惠金额数据是否相同 + Double realAmount = Double.valueOf(map.get("payAmount")) + Double.valueOf(balanceAmount) + Double.valueOf(map.get("discountAmount")); + if (Double.compare(realAmount,oilOrder.getOrderAmount())!=0){ + result = true; + } + } + + if (result){ + return false; } oilOrder.setTankId(tankId); @@ -418,18 +450,27 @@ public class OilOrderServiceImpl extends ServiceImpl i LJUserVo userVo = userService.selectUserById(oilOrder.getUserId()); // 处理支付需要的数据 Map map1 = new HashMap<>(); +// 需要支付的总金额 map1.put("allAmount", payAmount.toString()); +// 订单号 map1.put("orderNo", oilOrder.getOrderNo()); +// 机构号 map1.put("insCd", merchantConfig.getInsCd()); +// 商户号 map1.put("mchntCd", merchantConfig.getMchntCd()); -// 油号id+油枪 +// 商品名称:油号id+油枪 map1.put("goodsDes", oilOrder.getOils() + oilOrder.getOilGunNum()); +// 公钥 map1.put("publicKey", merchantConfig.getPublicKey()); +// 私钥 map1.put("privateKey", merchantConfig.getPrivateKey()); map1.put("discountAmount", discountAmount); map1.put("oilCardAmount", oilCardAmount); map1.put("balanceAmount", balanceAmount); +// oppid map1.put("openId", userVo.getOpenId()); +// 小程序appid + map1.put("appid", merchantConfig.getAppid()); // 调用支付接口 try { @@ -447,6 +488,7 @@ public class OilOrderServiceImpl extends ServiceImpl i oilOrder.setOrderStatus("paid"); baseMapper.updateById(oilOrder); } + return true; } @Autowired diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/entity/OilNumber.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/entity/OilNumber.java index d8734e61f..242eff35f 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/entity/OilNumber.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/entity/OilNumber.java @@ -1,6 +1,7 @@ package com.fuint.business.petrolStationManagement.entity; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.extension.activerecord.Model; import com.fuint.repository.model.base.BaseEntity; @@ -34,7 +35,9 @@ public class OilNumber extends BaseEntity { private String ifDelete; // private String unit; // private Integer storeId; // + @TableField(exist = false) private Double oilDensity; //油品密度 + @TableField(exist = false) public Integer id; //id(主键) diff --git a/gasStation-uni/pagesMy/myorder/myorder.vue b/gasStation-uni/pagesMy/myorder/myorder.vue index de62b98f9..3c1bd79d6 100644 --- a/gasStation-uni/pagesMy/myorder/myorder.vue +++ b/gasStation-uni/pagesMy/myorder/myorder.vue @@ -105,7 +105,7 @@ onLoad(option) { this.tapindex = option.id this.getTapIndex(option.id) - // this.getMyOrder() + this.getMyOrder() this.getStores() this.getPayList() }, diff --git a/gasStation-uni/pagesRefuel/orderDetail/index.vue b/gasStation-uni/pagesRefuel/orderDetail/index.vue index b70d08fe1..468cf4d6d 100644 --- a/gasStation-uni/pagesRefuel/orderDetail/index.vue +++ b/gasStation-uni/pagesRefuel/orderDetail/index.vue @@ -41,8 +41,7 @@ 储值卡 - (余额:{{user.cardBalance}}) + (余额:{{user.cardBalance}}) -¥{{balanceRedece}} @@ -52,7 +51,7 @@ - + @@ -182,6 +181,7 @@ + 注:囤油卡不参与任何优惠活动 @@ -219,7 +219,7 @@ return { gradeDis:"", title: '', - value: '', + value: true, orderNo: "", // 油品订单信息 oilOrder: {}, @@ -280,8 +280,8 @@ } }, onLoad(e) { - // this.orderNo = e.orderNo - this.orderNo = "20231201114800ebe24b" + this.orderNo = e.orderNo + // this.orderNo = "20231201114800ebe24b" }, onShow() { this.getOilOrder(); @@ -294,10 +294,12 @@ if(val){ this.balanceRedece = 0 this.isUseBalance = false; - this.balance = true + // this.balance = true }else{ + // this.balance = false this.isUseBalance = true; - this.balance = false + this.isOilStorageCard = false; + this.oilCardRedece = 0; } this.isExclusion() console.log(111,val,this.balance) @@ -306,9 +308,14 @@ if(val == false){ this.oilCardRedece = 0 this.oilCard = true + this.isOilStorageCard = false + this.balance = true }else{ this.oilCardRedece = this.oilOrder.oilNum this.oilCard = false + this.isOilStorageCard = true + this.isUseBalance = false; + this.balance = false } this.isExclusion() console.log(1,val,this.grade,this.oilOrder.oilNum) @@ -360,14 +367,19 @@ }, // 支付接口 payment(){ + let refuel = this.refuelMoney + refuel.refuelMoney = this.refuelMoney.refuelMoney - this.oilCardRedece let map = { - orderNo : "202312071108193bb5a7", - payAmount : "0.01", - discountAmount : '0', - oilCardAmount : "", + orderNo : this.orderNo, + payAmount : this.payAmount, + // payAmount : "0.01", + discountAmount : this.fullRedece+this.gradeRedece+this.couponRedece, + oilCardAmount : JSON.stringify(refuel), + oilCardLiters : this.oilCardRedece, balanceAmount : this.balanceRedece, - // tankId : uni.getStorageSync("tankId"), - tankId : 6, + isOilStorageCard : this.isOilStorageCard, + tankId : uni.getStorageSync("tankId"), + // tankId : 6, }; let _this = this; request({ @@ -395,7 +407,7 @@ }else { conRefMon = item.refuelMoney // 扣除升数后需要消费的金额 - hoardAmount = _this.oilOrder.orderAmount - (item.refuelMoney * _this.oilPrice).toFixed(2) + hoardAmount = _this.oilOrder.orderAmount - +(item.refuelMoney * _this.oilPrice).toFixed(2) } } }) @@ -406,7 +418,6 @@ _this.balanceRedece = 0; } _this.hoardAmount += +hoardAmount - console.log(_this.hoardAmount) _this.isExclusion(); }, // 使用囤油卡 囤油卡不参与任何优惠 @@ -419,17 +430,8 @@ this.payAmount = (this.oilOrder.orderAmount - this.hoardAmount - this.user.cardBalance).toFixed(2) } }else{ - if (this.oilCardRedece!=0) { - if (this.user.cardBalance!=0 && this.user.cardBalance >= (this.oilOrder.orderAmount - this.hoardAmount)) { - this.payAmount = 0 - this.balanceRedece = this.hoardAmount - }else{ - this.payAmount = (this.oilOrder.orderAmount - this.hoardAmount - this.user.cardBalance).toFixed(2) - } - }else{ - this.payAmount = 0 - this.balanceRedece = 0 - } + this.payAmount = 0 + this.balanceRedece = 0 } console.log("oil",this.hoardAmount,this.payAmount) }, diff --git a/gasStation-uni/unpackage/dist/dev/mp-weixin/pagesMy/feedback/feedback.js b/gasStation-uni/unpackage/dist/dev/mp-weixin/pagesMy/feedback/feedback.js index f259ecc23..f63b7c0fe 100644 --- a/gasStation-uni/unpackage/dist/dev/mp-weixin/pagesMy/feedback/feedback.js +++ b/gasStation-uni/unpackage/dist/dev/mp-weixin/pagesMy/feedback/feedback.js @@ -104,10 +104,10 @@ try { return Promise.all(/*! import() | node-modules/@dcloudio/uni-ui/lib/uni-icons/uni-icons */[__webpack_require__.e("common/vendor"), __webpack_require__.e("node-modules/@dcloudio/uni-ui/lib/uni-icons/uni-icons")]).then(__webpack_require__.bind(null, /*! @dcloudio/uni-ui/lib/uni-icons/uni-icons.vue */ 454)) }, "u-Textarea": function () { - return Promise.all(/*! import() | uni_modules/uview-ui/components/u--textarea/u--textarea */[__webpack_require__.e("common/vendor"), __webpack_require__.e("uni_modules/uview-ui/components/u--textarea/u--textarea")]).then(__webpack_require__.bind(null, /*! @/uni_modules/uview-ui/components/u--textarea/u--textarea.vue */ 657)) + return Promise.all(/*! import() | uni_modules/uview-ui/components/u--textarea/u--textarea */[__webpack_require__.e("common/vendor"), __webpack_require__.e("uni_modules/uview-ui/components/u--textarea/u--textarea")]).then(__webpack_require__.bind(null, /*! @/uni_modules/uview-ui/components/u--textarea/u--textarea.vue */ 641)) }, uUpload: function () { - return Promise.all(/*! import() | uni_modules/uview-ui/components/u-upload/u-upload */[__webpack_require__.e("common/vendor"), __webpack_require__.e("uni_modules/uview-ui/components/u-upload/u-upload")]).then(__webpack_require__.bind(null, /*! @/uni_modules/uview-ui/components/u-upload/u-upload.vue */ 663)) + return Promise.all(/*! import() | uni_modules/uview-ui/components/u-upload/u-upload */[__webpack_require__.e("common/vendor"), __webpack_require__.e("uni_modules/uview-ui/components/u-upload/u-upload")]).then(__webpack_require__.bind(null, /*! @/uni_modules/uview-ui/components/u-upload/u-upload.vue */ 647)) }, } } catch (e) {