This commit is contained in:
邱贞招 2024-11-12 23:45:41 +08:00
parent c90ffe21e2
commit 8c7a19377b
2 changed files with 14 additions and 2 deletions

View File

@ -310,7 +310,7 @@ public class AppVerifyController extends BaseController
if(StrUtil.isNotBlank(outTradeNo)){
// 如果有outtradeno则关闭订单
tmPayService.closeOrder(channelVO,outTradeNo);
logger.info("【订单改价】订单【{}】,有outTradeNo = 【{}】,查询订单未支付,关闭订单{}", etOrder1.getOrderNo(),outTradeNo);
logger.info("【订单改价】订单【{}】,有outTradeNo = 【{}】,查询订单未支付,关闭订单", etOrder1.getOrderNo(),outTradeNo);
}
BigDecimal payFee = BigDecimal.ZERO;
if(ObjectUtil.isNotNull(etOrder.getDispatchFee())){

View File

@ -9,6 +9,8 @@ import com.ruoyi.common.pay.wx.Payable;
import com.ruoyi.common.pay.wx.RefundAble;
import com.ruoyi.common.utils.http.HttpUtils;
import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
@ -20,6 +22,7 @@ import java.util.Map;
public class TmPayService {
private final static String SIGNKEY = "b4ixpiogfj5vu3tbkv23gj0dvo2j2ksz";
private static final Logger log = LoggerFactory.getLogger(TmPayService.class);
/**
* 订单查询
@ -74,7 +77,15 @@ public class TmPayService {
body.put("outTradeId", outTradeNo);
body.put("terminalType", "1");
body.put("shopId", channel.getShopId());
doPost(channel.getHttpUrl() + "/open/Pay/orderClose", body,channel);
String response = doPost(channel.getHttpUrl() + "/open/Pay/orderClose", body, channel);
if (com.ruoyi.common.utils.StringUtils.hasText(response)) {
JSONObject jsonResponse = JSON.parseObject(response);
if (jsonResponse.getInteger("errCode") != 0) {
throw new ServiceException("关闭订单失败: " + jsonResponse.getString("errMsg"));
}
}else{
throw new ServiceException("关闭订单数据为空");
}
}
/**
@ -124,6 +135,7 @@ public class TmPayService {
headerData.put("Content-Type", "application/json");
String response = HttpUtils.sendPostWithHeaders(url, headerData, JSON.toJSONString(body));
log.info("doPost请求API响应: " + response);
return response;
}