|
|
|
@ -587,6 +587,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { |
|
|
|
|
public void rechargeOrderToRefund(Long orderId) throws Exception { |
|
|
|
|
OutRechargeOrder order = outRechargeOrderService.findByOrderId(orderId); |
|
|
|
|
|
|
|
|
|
System.out.println("发起退款------------------------------------------------------------------------------" + orderId); |
|
|
|
|
// 101.待支付 102.已支付 100.已完成 104.已取消 105.已退款
|
|
|
|
|
if (order.getPayStatus() != 102) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法退款,订单不处于已支付状态"); |
|
|
|
@ -597,10 +598,8 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法退款,订单处于充值中状态"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 1:支付宝 2:微信 3:汇联通工会卡 4:银联 5:银联分期
|
|
|
|
|
if (order.getPayType() == null) { |
|
|
|
|
// 退还积分
|
|
|
|
|
if (order.getIntegralNum() != null) { |
|
|
|
|
if (order.getIntegralNum().compareTo(new BigDecimal(0)) > 0) { |
|
|
|
|
highUserService.goldHandle(order.getUserId(), order.getIntegralNum().intValue(), 1, 3, order.getId()); |
|
|
|
|
if (order.getPayRealPrice().compareTo(new BigDecimal(0)) == 0) { |
|
|
|
|
order.setPayStatus(105); |
|
|
|
@ -609,7 +608,6 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { |
|
|
|
|
outRechargeOrderService.updateOrder(order); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// 微信退款
|
|
|
|
|
if (order.getPayType() == 2) { |
|
|
|
|
Map<String, String> param = new HashMap<>(); |
|
|
|
@ -679,7 +677,6 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { |
|
|
|
|
order.setRefundFee(order.getPayRealPrice()); |
|
|
|
|
outRechargeOrderService.updateOrder(order); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (order.getMemDiscountId() != null) { |
|
|
|
@ -755,21 +752,46 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { |
|
|
|
|
outRechargeChildOrderService.updateOrder(childOrder); |
|
|
|
|
type = childOrder.getRechargePlatform(); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
// 查询充值子订单
|
|
|
|
|
Map<String, Object> childOrderMap103 = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
childOrderMap.put("parent_order_id", outRechargeOrder.getId()); |
|
|
|
|
childOrderMap.put("status", 103); |
|
|
|
|
|
|
|
|
|
List<OutRechargeChildOrder> childOrderList103 = outRechargeChildOrderService.getListRechargeChildOrder(childOrderMap103); |
|
|
|
|
if (childOrderList103.size() > 0) { |
|
|
|
|
type = childOrderList103.get(0).getRechargePlatform(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (type == 2) { |
|
|
|
|
type = 1; |
|
|
|
|
} else { |
|
|
|
|
type++; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
JSONObject object = new JSONObject(); |
|
|
|
|
|
|
|
|
|
String orderNo = "CZ" + DateUtil.date2String(new Date(), "yyyyMMddHHmmss") + IDGenerator.nextId(5); |
|
|
|
|
|
|
|
|
|
String[] rechargePlatform = outRechargePrice.getRechargePlatform().split("-"); |
|
|
|
|
String string = outRechargePrice.getRechargePlatform().substring(1,outRechargePrice.getRechargePlatform().length()-1); |
|
|
|
|
|
|
|
|
|
String[] rechargePlatform = string.split("-"); |
|
|
|
|
|
|
|
|
|
if (string.length() == 1) { |
|
|
|
|
type = Integer.parseInt(string); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (String s : rechargePlatform) { |
|
|
|
|
// 尖椒充值
|
|
|
|
|
if (s.equals("1") && (type == 2 || type == 0)) { |
|
|
|
|
if (s.equals("1") && type == 1) { |
|
|
|
|
object.put("out_order_id", orderNo); |
|
|
|
|
object.put("amount", outRechargePrice.getRechargePrice()); |
|
|
|
|
object.put("mobile", outRechargeOrder.getRechargeContent()); |
|
|
|
|
if (outRechargePrice.getRechargeType() == 1) { |
|
|
|
|
object.put("notifyUrl", CommonSysConst.getSysConfig().getJjNotifyUrl()); |
|
|
|
|
System.out.println("outRechargeOrder-----------------------------------------------------------------------------------------------------------------------------------------------------" + outRechargePrice.getRechargeType()); |
|
|
|
|
if (outRechargeOrder.getRechargeType() == 1) { |
|
|
|
|
object.put("is_fast", 1); |
|
|
|
|
} |
|
|
|
|
JSONObject returnObject = RechargeConfig.rechargeOrderByJj(object); |
|
|
|
@ -782,11 +804,14 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { |
|
|
|
|
rechargePlatformType = 1; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
if (s.equals("2") && (type == 1 || type == 0)) { |
|
|
|
|
// 龙阅充值
|
|
|
|
|
if (s.equals("2") && type == 2) { |
|
|
|
|
object.put("out_trade_num", orderNo); |
|
|
|
|
object.put("product_id", outRechargePrice.getGoodsId()); |
|
|
|
|
object.put("mobile", outRechargeOrder.getRechargeContent()); |
|
|
|
|
object.put("notifyUrl", CommonSysConst.getSysConfig().getLyNotifyUrl()); |
|
|
|
|
JSONObject returnObject = RechargeConfig.rechargeOrderByLy(object); |
|
|
|
|
System.out.println("龙阅请求回调地址---------------------" + CommonSysConst.getSysConfig().getLyNotifyUrl()); |
|
|
|
|
object.put("return_content", returnObject); |
|
|
|
|
if (returnObject != null && returnObject.getLong("errno") == 0) { |
|
|
|
|
childOrder.setStatus(102); |
|
|
|
|