合单支付fix bug

This commit is contained in:
Jack 2025-08-29 10:49:34 +08:00
parent 6c29c0d6cc
commit de0b4c664a
2 changed files with 20 additions and 9 deletions

View File

@ -39,6 +39,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.util.Pair;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
@ -298,20 +299,30 @@ public class LakalaPayServiceImpl implements LakalaPayService {
JSONObject header = new JSONObject();
header.put("Authorization", authorization);
JSONObject lakalaRespJSON = RestTemplateHttpUtil.sendLklPost(reqUrl, header, reqBody, JSONObject.class);
// 这里的请求方法对返回的字段进行了处理需要注意
ResponseEntity<JSONObject> lakalaRespJSON = RestTemplateHttpUtil.sendPostBodyBackEntity(reqUrl, header, reqBody, JSONObject.class);
log.debug("拉卡拉合单交易响应参数:{}", lakalaRespJSON);
// 7. 处理响应结果
if (ObjectUtil.isNotEmpty(lakalaRespJSON) && lklPaySuccessCode.equals(lakalaRespJSON.getStr("retCode"))) {
// 新增一个拉卡拉订单记录 shop_order_lkl
JSONObject lklPayReqAndRespJson = new JSONObject();
lklPayReqAndRespJson.put("req", reqData);
lklPayReqAndRespJson.put("resp", lakalaRespJSON);
shopService.lklPayAddShopOrderLkl(lklPayReqAndRespJson);
if (lakalaRespJSON == null) {
return new JSONObject().set("code", "BBS00001").set("msg", "拉卡拉合单交易无响应值").set("resp_data", null);
}
JSONObject respBody = lakalaRespJSON.getBody();
// 7. 处理响应结果
if (!lklPaySuccessCode.equals(respBody.getStr("code")) || respBody == null) {
return new JSONObject().set("code", "BBS00001").set("msg", "拉卡拉合单交易无响应值").set("resp_data", null);
}
// 新增一个拉卡拉订单记录 shop_order_lkl
JSONObject lklPayReqAndRespJson = new JSONObject();
lklPayReqAndRespJson.put("req", reqData);
lklPayReqAndRespJson.put("resp", respBody); // 返回原始响应数据
shopService.lklPayAddShopOrderLkl(lklPayReqAndRespJson);
// 8. 返回响应结果
return lakalaRespJSON;
return respBody;
} catch (Exception e) {
log.error("拉卡拉合单交易出错,订单号:{},错误信息:", orderId, e);

View File

@ -688,7 +688,7 @@ public class PayUserPayServiceImpl extends BaseServiceImpl<PayUserPayMapper, Pay
requestIP, trade_remark);
}
// logger.debug("拉卡拉预支付返回参数:{}", JSONUtil.toJsonStr(field));
logger.debug("拉卡拉合单预支付返回参数:{}", lakalaRespJSON);
if (lakalaRespJSON == null || !lakalaRespJSON.getStr("code").equals("BBS00000")) {
data.put("message", lakalaRespJSON.getStr("msg"));