|
@@ -102,13 +102,10 @@ public class WxPayServiceImpl extends PayService implements OrderPayService {
|
|
// 读取参数
|
|
// 读取参数
|
|
InputStream inputStream = request.getInputStream();
|
|
InputStream inputStream = request.getInputStream();
|
|
String requestStr = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
|
|
String requestStr = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
|
|
- log.info("微信支付回调 body:{}", requestStr);
|
|
|
|
// 解析xml成map
|
|
// 解析xml成map
|
|
Map<String, String> packageParams = XmlUtil.xmlToMap(requestStr);
|
|
Map<String, String> packageParams = XmlUtil.xmlToMap(requestStr);
|
|
- log.info("微信支付回调 map:{}", JsonUtil.toString(packageParams));
|
|
|
|
//获取订单信息
|
|
//获取订单信息
|
|
String attachStr = packageParams.get("attach");
|
|
String attachStr = packageParams.get("attach");
|
|
- log.info("微信支付回调 attachStr:{}", attachStr);
|
|
|
|
ProductPayAttachParamBO attachBO = JsonUtil.toObj(attachStr, ProductPayAttachParamBO.class);
|
|
ProductPayAttachParamBO attachBO = JsonUtil.toObj(attachStr, ProductPayAttachParamBO.class);
|
|
if (attachBO == null) {
|
|
if (attachBO == null) {
|
|
log.info("回调参数中attach值为空");
|
|
log.info("回调参数中attach值为空");
|
|
@@ -126,23 +123,23 @@ public class WxPayServiceImpl extends PayService implements OrderPayService {
|
|
log.info("微信支付成功回调");
|
|
log.info("微信支付成功回调");
|
|
// 处理业务开始
|
|
// 处理业务开始
|
|
Map<String, String> xmlMap = new HashMap<>();
|
|
Map<String, String> xmlMap = new HashMap<>();
|
|
- BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
|
|
|
|
- if (!Constants.SUCCESS.equalsIgnoreCase(packageParams.get("result_code"))) {
|
|
|
|
- log.info("支付失败,错误信息:{}", packageParams.get("err_code"));
|
|
|
|
- xmlMap.put("return_code", "FAIL");
|
|
|
|
- xmlMap.put("return_msg", "报文为空");
|
|
|
|
- }
|
|
|
|
if (Constants.SUCCESS.equalsIgnoreCase(packageParams.get("result_code"))) {
|
|
if (Constants.SUCCESS.equalsIgnoreCase(packageParams.get("result_code"))) {
|
|
String orderNo = packageParams.get("out_trade_no");
|
|
String orderNo = packageParams.get("out_trade_no");
|
|
log.info("微信订单号{}付款成功", orderNo);
|
|
log.info("微信订单号{}付款成功", orderNo);
|
|
- if (paySuccess(attachBO.getOrderId(), String.valueOf(Float.parseFloat(packageParams.get("total_fee")) / 100), packageParams.get("transaction_id"), attachBO.getGamePayWayId())) {
|
|
|
|
|
|
+ if (paySuccess(attachBO.getOrderId(), String.valueOf(Float.parseFloat(packageParams.get("total_fee")) / 100),
|
|
|
|
+ packageParams.get("transaction_id"), attachBO.getGamePayWayId())) {
|
|
// 通知微信.异步确认成功.必写.不然会一直通知后台.八次之后就认为交易失败了
|
|
// 通知微信.异步确认成功.必写.不然会一直通知后台.八次之后就认为交易失败了
|
|
xmlMap.put("return_code", "SUCCESS");
|
|
xmlMap.put("return_code", "SUCCESS");
|
|
xmlMap.put("return_msg", "OK");
|
|
xmlMap.put("return_msg", "OK");
|
|
- log.info("微信订单号{}付款成功1111111111111", orderNo);
|
|
|
|
}
|
|
}
|
|
|
|
+ }else {
|
|
|
|
+ log.info("支付失败,错误信息:{}", packageParams.get("err_code"));
|
|
|
|
+ xmlMap.put("return_code", "FAIL");
|
|
|
|
+ xmlMap.put("return_msg", "报文为空");
|
|
}
|
|
}
|
|
// 处理业务完毕
|
|
// 处理业务完毕
|
|
|
|
+ BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
|
|
|
|
+ log.info("返回给腾讯的回调结果, ss : {}", XmlUtil.mapToXml(xmlMap));
|
|
out.write(XmlUtil.mapToXml(xmlMap).getBytes());
|
|
out.write(XmlUtil.mapToXml(xmlMap).getBytes());
|
|
out.flush();
|
|
out.flush();
|
|
out.close();
|
|
out.close();
|