|
|
|
@ -26,9 +26,11 @@ import com.hai.config.UnionPayConfig; |
|
|
|
|
import com.hai.entity.HighCoupon; |
|
|
|
|
import com.hai.entity.HighRefundAudit; |
|
|
|
|
import com.hai.entity.OutRechargeOrder; |
|
|
|
|
import com.hai.entity.OutRechargeOrderRecord; |
|
|
|
|
import com.hai.model.*; |
|
|
|
|
import com.hai.service.HighRefundAuditService; |
|
|
|
|
import com.hai.service.HighUserService; |
|
|
|
|
import com.hai.service.OutRechargeOrderRecordService; |
|
|
|
|
import com.hai.service.OutRechargeOrderService; |
|
|
|
|
import com.hai.service.pay.impl.GoodsOrderServiceImpl; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
@ -70,6 +72,9 @@ public class OutRechargeOrderController { |
|
|
|
|
@Resource |
|
|
|
|
private HighUserService highUserService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private OutRechargeOrderRecordService rechargeOrderRecordService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getOrderById", method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
@ -314,7 +319,7 @@ public class OutRechargeOrderController { |
|
|
|
|
param.put("refund_fee", String.valueOf(order.getPayRealPrice().multiply(new BigDecimal("100")).intValue())); |
|
|
|
|
param.put("sign_type", "HMAC-SHA256"); |
|
|
|
|
|
|
|
|
|
String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5" , WXPayConstants.SignType.HMACSHA256); |
|
|
|
|
String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5" , WXPayConstants.SignType.HMACSHA256); |
|
|
|
|
param.put("sign", signStr); |
|
|
|
|
|
|
|
|
|
String resultXmL = doRefundRequest(param.get("mch_id"), WxUtils.mapToXml(param)); |
|
|
|
@ -575,24 +580,36 @@ public class OutRechargeOrderController { |
|
|
|
|
@RequestParam(name = "orderId", required = true) Long orderId) { |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderId(orderId); |
|
|
|
|
|
|
|
|
|
String orderNo = "CZ" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5); |
|
|
|
|
|
|
|
|
|
JSONObject object = outRechargeOrderService.getMobile(outRechargeOrder.getRechargeContent(),outRechargeOrder.getOrderPrice().intValue(),orderNo , outRechargeOrder.getRechargeType()); |
|
|
|
|
|
|
|
|
|
if (object.getInteger("code") != 200) { |
|
|
|
|
log.error("getMobileRechargeByOrderId error!", "充值失败"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, object.getString("message")); |
|
|
|
|
OutRechargeOrderRecord rechargeOrderRecord = rechargeOrderRecordService.findByOrderId(orderId); |
|
|
|
|
if (rechargeOrderRecord == null) { |
|
|
|
|
rechargeOrderRecord = new OutRechargeOrderRecord(); |
|
|
|
|
// 查询订单
|
|
|
|
|
OutRechargeOrder order = outRechargeOrderService.findByOrderId(orderId); |
|
|
|
|
if (order.getRechargeType() != null) { |
|
|
|
|
String orderNo = "CZ" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5); |
|
|
|
|
JSONObject object = outRechargeOrderService.getMobile(order.getRechargeContent() , order.getOrderPrice().intValue() , orderNo , order.getRechargeType()); |
|
|
|
|
if (object.getInteger("code") != 200) { |
|
|
|
|
order.setRechargeStatus(1); |
|
|
|
|
order.setAbnormalMsg(object.getString("message")); |
|
|
|
|
} |
|
|
|
|
outRechargeOrderService.updateOrder(order); |
|
|
|
|
rechargeOrderRecord.setRechargeOrderId(order.getId()); |
|
|
|
|
rechargeOrderRecord.setRechargeOrderNo(orderNo); |
|
|
|
|
rechargeOrderRecord.setCreateTime(new Date()); |
|
|
|
|
rechargeOrderRecord.setStatus(1); |
|
|
|
|
rechargeOrderRecordService.insertOrder(rechargeOrderRecord); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// 查询订单
|
|
|
|
|
OutRechargeOrder order = outRechargeOrderService.findByOrderId(rechargeOrderRecord.getRechargeOrderId()); |
|
|
|
|
if (order.getStatus() == 2) { |
|
|
|
|
outRechargeOrderService.rechargeOrderToRefund(order.getId()); |
|
|
|
|
order.setStatus(5); |
|
|
|
|
outRechargeOrderService.updateOrder(order); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
outRechargeOrder.setRechargeStatus(2); |
|
|
|
|
|
|
|
|
|
outRechargeOrder.setOrderNo(orderNo); |
|
|
|
|
|
|
|
|
|
outRechargeOrderService.updateOrder(outRechargeOrder); |
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success("请求成功"); |
|
|
|
|
return ResponseMsgUtil.success("操作成功"); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("HighUserCardController --> getHuiLianTongCardInfo() error!", e); |
|
|
|
|