|
|
|
@ -81,4 +81,42 @@ public class CzOrderController { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/rechargeCallback", method = RequestMethod.POST) |
|
|
|
|
@ApiOperation(value = "话费充值回调") |
|
|
|
|
@ResponseBody |
|
|
|
|
public void rechargeCallback(@RequestBody String reqBodyStr, HttpServletRequest request, HttpServletResponse response) { |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject dataObject = JSONObject.parseObject(reqBodyStr, JSONObject.class); |
|
|
|
|
|
|
|
|
|
HighGasOrderRefund highGasOrderRefund = new HighGasOrderRefund(); |
|
|
|
|
highGasOrderRefund.setCreateTime(new Date()); |
|
|
|
|
highGasOrderRefund.setReturnContent(String.valueOf(dataObject)); |
|
|
|
|
highGasOrderRefundMapper.insert(highGasOrderRefund); |
|
|
|
|
|
|
|
|
|
// 查询订单
|
|
|
|
|
OutRechargeOrder order = outRechargeOrderService.findByOrderNo(dataObject.getString("orderNumber")); |
|
|
|
|
|
|
|
|
|
// 订单状态 : 1.待支付 2.已支付 3.已完成 4.已取消 5.已退款 6.充值失败
|
|
|
|
|
if (order != null && order.getStatus() == 5) { |
|
|
|
|
// 退单结果 true:成功 false:失败
|
|
|
|
|
if (dataObject.getInteger("rechargeState") == 1 && order != null) { |
|
|
|
|
order.setStatus(3); |
|
|
|
|
outRechargeOrderService.updateOrder(order); |
|
|
|
|
} else if (dataObject.getInteger("rechargeState") == 0 && order != null) { |
|
|
|
|
order.setStatus(6); |
|
|
|
|
outRechargeOrderService.updateOrder(order); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
response.setCharacterEncoding("UTF-8"); |
|
|
|
|
response.setContentType("text/html;charset=utf-8"); |
|
|
|
|
PrintWriter writer= response.getWriter(); |
|
|
|
|
writer.write("success"); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("WechatPayController --> wechatNotify() error!", e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|