微信支付
parent
18909d4c2c
commit
46563efd16
|
@ -28,7 +28,7 @@ public class PhoneRecordDO extends BaseDO {
|
||||||
/**
|
/**
|
||||||
* 主键
|
* 主键
|
||||||
*/
|
*/
|
||||||
@TableId
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
private Long id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
* 用户id
|
* 用户id
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package cn.iocoder.yudao.module.shop.service.order.impl;
|
package cn.iocoder.yudao.module.shop.service.order.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.PhoneUtil;
|
import cn.hutool.core.util.PhoneUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
@ -1281,15 +1282,15 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
||||||
@Override
|
@Override
|
||||||
public Boolean wxPayNotify(WxPayOrderNotifyV3Result.DecryptNotifyResult result) {
|
public Boolean wxPayNotify(WxPayOrderNotifyV3Result.DecryptNotifyResult result) {
|
||||||
log.info("支付通知=" + JSONUtil.toJsonPrettyStr(result));
|
log.info("支付通知=" + JSONUtil.toJsonPrettyStr(result));
|
||||||
if (StringUtils.equals("SUCCESS", result.getTradeType())) {
|
if (StringUtils.equals("SUCCESS", result.getTradeState())) {
|
||||||
log.info("WXPAY====result===>");
|
log.info("WXPAY====result===>");
|
||||||
// 验证相关参数-金额
|
// 验证相关参数-金额
|
||||||
String outTradeNo = result.getOutTradeNo();
|
String outTradeNo = result.getOutTradeNo();
|
||||||
// 用户支付金额
|
// 用户支付金额
|
||||||
Integer payerTotal = result.getAmount().getPayerTotal() / 100;
|
BigDecimal payerTotal = NumberUtil.div(result.getAmount().getPayerTotal()+"","100",2);
|
||||||
// 处理相关逻辑
|
// 处理相关逻辑
|
||||||
RechargeOrderDO orderDO = rechargeOrderMapper.selectOne(Wrappers.<RechargeOrderDO>lambdaQuery().eq(RechargeOrderDO::getOrderId, outTradeNo));
|
RechargeOrderDO orderDO = rechargeOrderMapper.selectOne(Wrappers.<RechargeOrderDO>lambdaQuery().eq(RechargeOrderDO::getOrderId, outTradeNo));
|
||||||
if (new BigDecimal(payerTotal).compareTo(orderDO.getPayPrice()) != 0) {
|
if (payerTotal.compareTo(orderDO.getPayPrice()) != 0) {
|
||||||
log.error("支付金额不匹配,订单实际支付金额:{},微信入参验证金额:{}", orderDO.getPayPrice(), payerTotal);
|
log.error("支付金额不匹配,订单实际支付金额:{},微信入参验证金额:{}", orderDO.getPayPrice(), payerTotal);
|
||||||
return Boolean.FALSE;
|
return Boolean.FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1332,7 +1333,8 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
||||||
orderDO.setUserPhone(StringUtils.isEmpty(request.getUserPhone()) ? user.getMobile() : request.getUserPhone());
|
orderDO.setUserPhone(StringUtils.isEmpty(request.getUserPhone()) ? user.getMobile() : request.getUserPhone());
|
||||||
orderDO.setConfirmPhone(StringUtils.isEmpty(request.getConfirmPhone()) ? user.getMobile() : request.getConfirmPhone());
|
orderDO.setConfirmPhone(StringUtils.isEmpty(request.getConfirmPhone()) ? user.getMobile() : request.getConfirmPhone());
|
||||||
orderDO.setTotalNum(orderInfos.size());
|
orderDO.setTotalNum(orderInfos.size());
|
||||||
BigDecimal sum = new BigDecimal(orderInfos.stream().mapToDouble(OrderContentRequest.OrderInfo::getGearAmount).sum());
|
// BigDecimal sum = new BigDecimal(orderInfos.stream().mapToDouble(OrderContentRequest.OrderInfo::getGearAmount).sum());
|
||||||
|
BigDecimal sum = new BigDecimal("0.01");
|
||||||
orderDO.setTotalPrice(sum);
|
orderDO.setTotalPrice(sum);
|
||||||
orderDO.setPayPrice(sum);
|
orderDO.setPayPrice(sum);
|
||||||
orderDO.setPayTime(LocalDateTime.now());
|
orderDO.setPayTime(LocalDateTime.now());
|
||||||
|
|
Loading…
Reference in New Issue