合单支付fix bug
This commit is contained in:
parent
6c29c0d6cc
commit
de0b4c664a
@ -39,6 +39,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.data.util.Pair;
|
import org.springframework.data.util.Pair;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
@ -298,20 +299,30 @@ public class LakalaPayServiceImpl implements LakalaPayService {
|
|||||||
JSONObject header = new JSONObject();
|
JSONObject header = new JSONObject();
|
||||||
header.put("Authorization", authorization);
|
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);
|
log.debug("拉卡拉合单交易响应参数:{}", lakalaRespJSON);
|
||||||
|
|
||||||
// 7. 处理响应结果
|
// 7. 处理响应结果
|
||||||
if (ObjectUtil.isNotEmpty(lakalaRespJSON) && lklPaySuccessCode.equals(lakalaRespJSON.getStr("retCode"))) {
|
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 表
|
// 新增一个拉卡拉订单记录 shop_order_lkl 表
|
||||||
JSONObject lklPayReqAndRespJson = new JSONObject();
|
JSONObject lklPayReqAndRespJson = new JSONObject();
|
||||||
lklPayReqAndRespJson.put("req", reqData);
|
lklPayReqAndRespJson.put("req", reqData);
|
||||||
lklPayReqAndRespJson.put("resp", lakalaRespJSON);
|
lklPayReqAndRespJson.put("resp", respBody); // 返回原始响应数据
|
||||||
shopService.lklPayAddShopOrderLkl(lklPayReqAndRespJson);
|
shopService.lklPayAddShopOrderLkl(lklPayReqAndRespJson);
|
||||||
}
|
|
||||||
|
|
||||||
// 8. 返回响应结果
|
// 8. 返回响应结果
|
||||||
return lakalaRespJSON;
|
return respBody;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("拉卡拉合单交易出错,订单号:{},错误信息:", orderId, e);
|
log.error("拉卡拉合单交易出错,订单号:{},错误信息:", orderId, e);
|
||||||
|
|||||||
@ -688,7 +688,7 @@ public class PayUserPayServiceImpl extends BaseServiceImpl<PayUserPayMapper, Pay
|
|||||||
requestIP, trade_remark);
|
requestIP, trade_remark);
|
||||||
}
|
}
|
||||||
|
|
||||||
// logger.debug("拉卡拉预支付返回参数:{}", JSONUtil.toJsonStr(field));
|
logger.debug("拉卡拉合单预支付返回参数:{}", lakalaRespJSON);
|
||||||
|
|
||||||
if (lakalaRespJSON == null || !lakalaRespJSON.getStr("code").equals("BBS00000")) {
|
if (lakalaRespJSON == null || !lakalaRespJSON.getStr("code").equals("BBS00000")) {
|
||||||
data.put("message", lakalaRespJSON.getStr("msg"));
|
data.put("message", lakalaRespJSON.getStr("msg"));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user