|
|
|
@ -191,22 +191,25 @@ public class OrderRefundServiceImpl implements OrderRefundService { |
|
|
|
|
startTime.set(Calendar.SECOND, 59); |
|
|
|
|
|
|
|
|
|
// 订单是否处于当日的订单
|
|
|
|
|
if (!DateUtil.isEffectiveDate(order.getPayTime(), startTime.getTime(), endTime.getTime())) { |
|
|
|
|
if (DateUtil.format(order.getPayTime(), "yyyy-MM-dd").equals(DateUtil.format(new Date(), "yyyy-MM-dd"))) { |
|
|
|
|
// 订单撤销
|
|
|
|
|
JSONObject refund = UnionPayConfig.cancel(UnionPayConfig.MER_ID2, UnionPayConfig.TERM_ID2, order.getOrderNo(), order.getPaySerialNo()); |
|
|
|
|
System.out.println(refund.toJSONString()); |
|
|
|
|
if (!refund.getString("resultcode").equals("00") && !refund.getString("resultcode").equals("W6")) { |
|
|
|
|
if (refund.getString("resultcode").equals("00") || refund.getString("resultcode").equals("W6")) { |
|
|
|
|
refundPriceModel.setRefundSuccess(true); |
|
|
|
|
} else { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("returnmsg")); |
|
|
|
|
} |
|
|
|
|
refundPriceModel.setRefundSuccess(true); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
// 订单退款
|
|
|
|
|
JSONObject refund = UnionPayConfig.zwrefund(UnionPayConfig.MER_ID2, UnionPayConfig.TERM_ID2, order.getOrderNo(), order.getPaySerialNo(), order.getPayRealPrice().multiply(new BigDecimal("100")).longValue()); |
|
|
|
|
System.out.println(refund.toJSONString()); |
|
|
|
|
if (!refund.getString("resultcode").equals("00") && !refund.getString("resultcode").equals("W6")) { |
|
|
|
|
if (refund.getString("resultcode").equals("00") || refund.getString("resultcode").equals("W6")) { |
|
|
|
|
refundPriceModel.setRefundSuccess(true); |
|
|
|
|
} else { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("returnmsg")); |
|
|
|
|
} |
|
|
|
|
refundPriceModel.setRefundSuccess(true); |
|
|
|
|
} |
|
|
|
|
} else if (orderPayType.getNumber().equals(OrderPayType.PAY_TYPE7.getNumber())) { |
|
|
|
|
// 油卡退款
|
|
|
|
|