|
|
|
@ -14,8 +14,10 @@ import com.hai.common.security.UserCenter; |
|
|
|
|
import com.hai.common.utils.*; |
|
|
|
|
import com.hai.config.CommonSysConst; |
|
|
|
|
import com.hai.config.UnionPayConfig; |
|
|
|
|
import com.hai.dao.HighGasOrderPushMapper; |
|
|
|
|
import com.hai.dao.HighGasOrderRefundMapper; |
|
|
|
|
import com.hai.entity.*; |
|
|
|
|
import com.hai.enum_type.OrderPushType; |
|
|
|
|
import com.hai.enum_type.RechargePayType; |
|
|
|
|
import com.hai.model.HighUserModel; |
|
|
|
|
import com.hai.model.ResponseData; |
|
|
|
@ -68,9 +70,77 @@ public class CzOrderController { |
|
|
|
|
@Resource |
|
|
|
|
private HighUserCardService highUserCardService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private HighGasOrderPushMapper highGasOrderPushMapper; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private WechatPayUtil wechatPayUtil; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/rechargeCallback", method = RequestMethod.POST) |
|
|
|
|
@ApiOperation(value = "龙阅充值回调") |
|
|
|
|
@ResponseBody |
|
|
|
|
public void rechargeCallback( |
|
|
|
|
@RequestParam(name = "out_trade_num", required = true) String out_trade_num, |
|
|
|
|
@RequestParam(name = "userid", required = true) Long userid, |
|
|
|
|
@RequestParam(name = "state", required = true) Long state, |
|
|
|
|
@RequestBody String reqBodyStr , |
|
|
|
|
HttpServletRequest request, HttpServletResponse response) { |
|
|
|
|
try { |
|
|
|
|
// 推送记录
|
|
|
|
|
HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); |
|
|
|
|
highGasOrderPush.setType(OrderPushType.type2.getType()); |
|
|
|
|
highGasOrderPush.setOrderNo(out_trade_num); |
|
|
|
|
highGasOrderPush.setCreateTime(new Date()); |
|
|
|
|
highGasOrderPush.setCode(state.toString()); |
|
|
|
|
highGasOrderPush.setReturnContent(reqBodyStr); |
|
|
|
|
highGasOrderPushMapper.insert(highGasOrderPush); |
|
|
|
|
|
|
|
|
|
OutRechargeChildOrder childOrder = outRechargeChildOrderService.findByOrderNo(out_trade_num); |
|
|
|
|
|
|
|
|
|
OutRechargeOrder rechargeOrder = outRechargeOrderService.findByOrderId(childOrder.getParentOrderId()); |
|
|
|
|
|
|
|
|
|
BsRequestRecord bsRequestRecord = bsRequestRecordService.findRequestRecordByOrderNo(childOrder.getOrderNo()); |
|
|
|
|
|
|
|
|
|
bsRequestRecord.setReturnContent(reqBodyStr); |
|
|
|
|
bsRequestRecord.setUpdateTime(new Date()); |
|
|
|
|
bsRequestRecordService.updateRequestRecord(bsRequestRecord); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 判断是否充值成功
|
|
|
|
|
if (state == 1) { |
|
|
|
|
new Thread(() -> { |
|
|
|
|
HighUser highUser = highUserService.findByUserId(rechargeOrder.getUserId()); |
|
|
|
|
WxMsgConfig.rechargedSuccess( |
|
|
|
|
rechargeOrder.getRechargeContent() + "充值成功", |
|
|
|
|
String.valueOf(rechargeOrder.getPayRealPrice()), |
|
|
|
|
rechargeOrder.getOrderNo(), |
|
|
|
|
rechargeOrder.getFinishTime(), |
|
|
|
|
RechargePayType.getNameByType(rechargeOrder.getPayType()), |
|
|
|
|
highUser.getOpenId()); |
|
|
|
|
}).start(); |
|
|
|
|
childOrder.setStatus(101); |
|
|
|
|
rechargeOrder.setRechargeStatus(202); |
|
|
|
|
rechargeOrder.setPayStatus(100); |
|
|
|
|
|
|
|
|
|
outRechargeOrderService.updateOrder(rechargeOrder); |
|
|
|
|
outRechargeChildOrderService.updateOrder(childOrder); |
|
|
|
|
} else { |
|
|
|
|
callbackResult(childOrder , rechargeOrder); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/rechargeCallbackByJj", method = RequestMethod.POST) |
|
|
|
|
@ApiOperation(value = "尖椒充值回调") |
|
|
|
|
@ResponseBody |
|
|
|
@ -78,6 +148,18 @@ public class CzOrderController { |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
JSONObject dataObject = JSONObject.parseObject(reqBodyStr, JSONObject.class); |
|
|
|
|
|
|
|
|
|
// 推送记录
|
|
|
|
|
HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); |
|
|
|
|
highGasOrderPush.setType(OrderPushType.type2.getType()); |
|
|
|
|
highGasOrderPush.setOrderNo(dataObject.getString("out_order_id")); |
|
|
|
|
highGasOrderPush.setCreateTime(new Date()); |
|
|
|
|
highGasOrderPush.setCode(dataObject.getString("status")); |
|
|
|
|
highGasOrderPush.setRequestContent(JSONObject.toJSONString(dataObject)); |
|
|
|
|
highGasOrderPush.setReturnContent(dataObject.toJSONString()); |
|
|
|
|
highGasOrderPushMapper.insert(highGasOrderPush); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 1 尖椒 2 龙阅
|
|
|
|
|
dataObject.put("orderNo" , dataObject.getString("out_order_id")); |
|
|
|
|
|
|
|
|
@ -103,6 +185,12 @@ public class CzOrderController { |
|
|
|
|
RechargePayType.getNameByType(rechargeOrder.getPayType()), |
|
|
|
|
highUser.getOpenId()); |
|
|
|
|
}).start(); |
|
|
|
|
childOrder.setStatus(101); |
|
|
|
|
rechargeOrder.setRechargeStatus(202); |
|
|
|
|
rechargeOrder.setPayStatus(100); |
|
|
|
|
|
|
|
|
|
outRechargeOrderService.updateOrder(rechargeOrder); |
|
|
|
|
outRechargeChildOrderService.updateOrder(childOrder); |
|
|
|
|
} else { |
|
|
|
|
callbackResult(childOrder , rechargeOrder); |
|
|
|
|
} |
|
|
|
@ -121,23 +209,35 @@ public class CzOrderController { |
|
|
|
|
@RequestMapping(value = "/rechargeCallbackByLy", method = RequestMethod.POST) |
|
|
|
|
@ApiOperation(value = "龙阅充值回调") |
|
|
|
|
@ResponseBody |
|
|
|
|
public void rechargeCallbackByLy(@RequestBody String reqBodyStr, HttpServletRequest request, HttpServletResponse response) { |
|
|
|
|
public void rechargeCallbackByLy( |
|
|
|
|
@RequestParam(name = "out_trade_num", required = true) String out_trade_num, |
|
|
|
|
@RequestParam(name = "userid", required = true) Long userid, |
|
|
|
|
@RequestParam(name = "state", required = true) Long state, |
|
|
|
|
@RequestBody String reqBodyStr , |
|
|
|
|
HttpServletRequest request, HttpServletResponse response) { |
|
|
|
|
try { |
|
|
|
|
JSONObject dataObject = JSONObject.parseObject(reqBodyStr, JSONObject.class); |
|
|
|
|
// 1 尖椒 2 龙阅
|
|
|
|
|
dataObject.put("orderNo" , dataObject.getString("out_trade_num")); |
|
|
|
|
OutRechargeChildOrder childOrder = outRechargeChildOrderService.findByOrderNo(dataObject.getString("out_order_id")); |
|
|
|
|
// 推送记录
|
|
|
|
|
HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); |
|
|
|
|
highGasOrderPush.setType(OrderPushType.type2.getType()); |
|
|
|
|
highGasOrderPush.setOrderNo(out_trade_num); |
|
|
|
|
highGasOrderPush.setCreateTime(new Date()); |
|
|
|
|
highGasOrderPush.setCode(state.toString()); |
|
|
|
|
highGasOrderPush.setReturnContent(reqBodyStr); |
|
|
|
|
highGasOrderPushMapper.insert(highGasOrderPush); |
|
|
|
|
|
|
|
|
|
OutRechargeChildOrder childOrder = outRechargeChildOrderService.findByOrderNo(out_trade_num); |
|
|
|
|
|
|
|
|
|
OutRechargeOrder rechargeOrder = outRechargeOrderService.findByOrderId(childOrder.getParentOrderId()); |
|
|
|
|
|
|
|
|
|
BsRequestRecord bsRequestRecord = bsRequestRecordService.findRequestRecordByOrderNo(childOrder.getOrderNo()); |
|
|
|
|
|
|
|
|
|
bsRequestRecord.setReturnContent(String.valueOf(dataObject)); |
|
|
|
|
bsRequestRecord.setReturnContent(reqBodyStr); |
|
|
|
|
bsRequestRecord.setUpdateTime(new Date()); |
|
|
|
|
bsRequestRecordService.updateRequestRecord(bsRequestRecord); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 判断是否充值成功
|
|
|
|
|
if (dataObject.getInteger("status") == 3) { |
|
|
|
|
if (state == 1) { |
|
|
|
|
new Thread(() -> { |
|
|
|
|
HighUser highUser = highUserService.findByUserId(rechargeOrder.getUserId()); |
|
|
|
|
WxMsgConfig.rechargedSuccess( |
|
|
|
@ -148,6 +248,12 @@ public class CzOrderController { |
|
|
|
|
RechargePayType.getNameByType(rechargeOrder.getPayType()), |
|
|
|
|
highUser.getOpenId()); |
|
|
|
|
}).start(); |
|
|
|
|
childOrder.setStatus(101); |
|
|
|
|
rechargeOrder.setRechargeStatus(202); |
|
|
|
|
rechargeOrder.setPayStatus(100); |
|
|
|
|
|
|
|
|
|
outRechargeOrderService.updateOrder(rechargeOrder); |
|
|
|
|
outRechargeChildOrderService.updateOrder(childOrder); |
|
|
|
|
} else { |
|
|
|
|
callbackResult(childOrder , rechargeOrder); |
|
|
|
|
} |
|
|
|
|