订单信息
This commit is contained in:
parent
2b1888b719
commit
4599d08df9
@ -62,6 +62,10 @@ public class MerchantConfig extends BaseEntity implements Serializable {
|
||||
* 账户金额
|
||||
*/
|
||||
private Double amount;
|
||||
/**
|
||||
* 小程序appid
|
||||
*/
|
||||
private String appid;
|
||||
|
||||
}
|
||||
|
||||
|
@ -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<String, String> resMap = Utils.xmlStr2Map(rspXml);
|
||||
|
||||
@ -352,7 +351,6 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
|
||||
}
|
||||
System.out.println(resMap);
|
||||
|
||||
return resMap;
|
||||
}
|
||||
|
||||
|
@ -81,8 +81,7 @@ public class OilOrderController extends BaseController {
|
||||
*/
|
||||
@PostMapping("/appletPay")
|
||||
public ResponseObject appletPay(@Validated @RequestBody Map<String,String> map){
|
||||
orderService.appletPay(map);
|
||||
return getSuccessResult("success");
|
||||
return getSuccessResult(orderService.appletPay(map));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,7 +76,7 @@ public interface OilOrderService extends IService<OilOrder> {
|
||||
* 小程序订单支付
|
||||
* @param map
|
||||
*/
|
||||
public void appletPay(Map<String,String> map);
|
||||
public boolean appletPay(Map<String,String> map);
|
||||
|
||||
/**
|
||||
* 添加油品跟踪信息
|
||||
|
@ -383,8 +383,11 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
|
||||
return orderNo;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private OilNumberService oilNumberService;
|
||||
|
||||
@Override
|
||||
public void appletPay(Map<String, String> map) {
|
||||
public boolean appletPay(Map<String, String> map) {
|
||||
String orderNo = map.get("orderNo");
|
||||
// 支付金额
|
||||
Integer payAmount = (int) (Double.valueOf(map.get("payAmount"))*100);
|
||||
@ -392,17 +395,46 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> 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<OilOrderMapper, OilOrder> i
|
||||
LJUserVo userVo = userService.selectUserById(oilOrder.getUserId());
|
||||
// 处理支付需要的数据
|
||||
Map<String, String> 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<OilOrderMapper, OilOrder> i
|
||||
oilOrder.setOrderStatus("paid");
|
||||
baseMapper.updateById(oilOrder);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
|
@ -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(主键)
|
||||
|
||||
|
||||
|
@ -105,7 +105,7 @@
|
||||
onLoad(option) {
|
||||
this.tapindex = option.id
|
||||
this.getTapIndex(option.id)
|
||||
// this.getMyOrder()
|
||||
this.getMyOrder()
|
||||
this.getStores()
|
||||
this.getPayList()
|
||||
},
|
||||
|
@ -41,8 +41,7 @@
|
||||
<view class="desc">
|
||||
<view style="display: flex;">
|
||||
储值卡
|
||||
<span style="color: red;display: flex;">(余额:{{user.cardBalance}})<u-icon name="question-circle"
|
||||
color="red"></u-icon></span>
|
||||
<span style="display: flex;">(余额:{{user.cardBalance}})</span>
|
||||
</view>
|
||||
<view style="display: flex;">
|
||||
<span style="margin-right: 10px;">-¥{{balanceRedece}}</span>
|
||||
@ -52,7 +51,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="desc" v-if="isOilStorageCard == true && refuelMoney.length > 0">
|
||||
<view class="desc" v-if="refuelMoney.length > 0">
|
||||
<view style="display: flex;">
|
||||
<u-collapse>
|
||||
<u-collapse-item title="囤油卡" :open="true">
|
||||
@ -182,6 +181,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view style="margin: 10px 20px 0;color: red;font-size: 12px;">注:囤油卡不参与任何优惠活动</view>
|
||||
</view>
|
||||
|
||||
<view style="background-color: white;width: 94%;margin: 15px auto;">
|
||||
@ -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)
|
||||
},
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user