dev-discount
胡锐 3 years ago
parent 0d8ff0755e
commit f7c50a7f57
  1. 20
      hai-cweb/src/main/java/com/cweb/controller/pay/UnionPayController.java

@ -1,5 +1,6 @@
package com.cweb.controller.pay; package com.cweb.controller.pay;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorCode;
@ -80,20 +81,15 @@ public class UnionPayController {
@RequestMapping(value = "/notify", method = RequestMethod.POST) @RequestMapping(value = "/notify", method = RequestMethod.POST)
@ApiOperation(value = "银联支付 -> 异步回调") @ApiOperation(value = "银联支付 -> 异步回调")
public void notify(@RequestParam Map<String, String> params, HttpServletRequest request, HttpServletResponse response) { public void notify(@RequestBody String params,HttpServletRequest request, HttpServletResponse response) {
try { try {
System.out.println(params);
log.info(JSONObject.toJSONString(params));
if (params == null){
return;
}
JSONObject body = JSONObject.parseObject(MapUtils.getObject(params, "params"), JSONObject.class); System.out.println(params);
if (StringUtils.isBlank(body.getString("tradetrace"))) { log.info(params);
return;
}
if (StringUtils.isNotBlank(params)) {
JSONObject body = JSONObject.parseObject(params.substring(0, params.length() - 1));
if (StringUtils.isNotBlank(body.getString("tradetrace"))) {
// 查询订单信息 // 查询订单信息
HighOrder order = highOrderService.getOrderByOrderNo(body.getString("tradetrace")); HighOrder order = highOrderService.getOrderByOrderNo(body.getString("tradetrace"));
if (order == null) { if (order == null) {
@ -257,6 +253,8 @@ public class UnionPayController {
highOrderService.updateOrder(order); highOrderService.updateOrder(order);
} }
}
}
BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream()); BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();

Loading…
Cancel
Save