解决团油退款响应问题

dev-discount
胡锐 3 years ago
parent 37fc74869d
commit 67e7182b27
  1. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  2. 28
      hai-cweb/src/main/java/com/cweb/controller/pay/TuanYouController.java

File diff suppressed because one or more lines are too long

@ -1,7 +1,6 @@
package com.cweb.controller.pay;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
@ -136,8 +135,9 @@ public class TuanYouController {
if (DateUtil.isEffectiveDate(order.getPayTime(), startTime.getTime(), endTime.getTime())) {
// 订单撤销
JSONObject refund = UnionPayConfig.cancel(UnionPayConfig.MER_ID3, UnionPayConfig.TERM_ID3, order.getOrderNo(), order.getPaySerialNo());
if (!refund.getString("resultcode").equals("00")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("respMessage"));
System.out.println(refund.toJSONString());
if (!refund.getString("resultcode").equals("00") || !refund.getString("resultcode").equals("W6")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("returnmsg"));
}
order.setOrderStatus(4);
@ -148,8 +148,12 @@ public class TuanYouController {
} else {
// 订单退款
JSONObject refund = UnionPayConfig.zwrefund(UnionPayConfig.MER_ID3, UnionPayConfig.TERM_ID3, order.getOrderNo(), order.getPaySerialNo(), order.getPayRealPrice().multiply(new BigDecimal("100")).longValue());
if (!refund.getString("resultcode").equals("00")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("respMessage"));
System.out.println(refund.toJSONString());
if (!refund.getString("resultcode").equals("00") || !refund.getString("resultcode").equals("W6")) {
JSONObject refund2 = UnionPayConfig.zwrefund(UnionPayConfig.MER_ID1, UnionPayConfig.TERM_ID1, order.getOrderNo(), order.getPaySerialNo(), order.getPayRealPrice().multiply(new BigDecimal("100")).longValue());
if (!refund2.getString("resultcode").equals("00") || !refund.getString("resultcode").equals("W6")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund2.getString("returnmsg"));
}
}
order.setOrderStatus(4);
@ -167,13 +171,19 @@ public class TuanYouController {
}
}
}
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);
} finally {
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=utf-8");
PrintWriter writer= null;
try {
writer = response.getWriter();
} catch (IOException e) {
e.printStackTrace();
}
writer.write("success");
}
}

Loading…
Cancel
Save