|
|
|
@ -2,6 +2,7 @@ package com.cweb.controller; |
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.cweb.config.SysConst; |
|
|
|
|
import com.cweb.config.WxMsgConfig; |
|
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
|
import com.hai.common.exception.ErrorCode; |
|
|
|
@ -19,6 +20,8 @@ import com.hai.common.security.UserCenter; |
|
|
|
|
import com.hai.common.utils.*; |
|
|
|
|
import com.hai.dao.SecDictionaryMapper; |
|
|
|
|
import com.hai.entity.*; |
|
|
|
|
import com.hai.enum_type.GoodsType; |
|
|
|
|
import com.hai.enum_type.PayType; |
|
|
|
|
import com.hai.model.HighUserModel; |
|
|
|
|
import com.hai.model.OrderRefundModel; |
|
|
|
|
import com.hai.model.ResponseData; |
|
|
|
@ -350,6 +353,66 @@ public class OutRechargeOrderController { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/orderToGoldPay",method = RequestMethod.POST) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "订单支付发起金币支付") |
|
|
|
|
public ResponseData orderToGoldPay(@RequestBody String reqBodyStr,HttpServletRequest request) { |
|
|
|
|
try { |
|
|
|
|
// 用户
|
|
|
|
|
SessionObject sessionObject = userCenter.getSessionObject(request); |
|
|
|
|
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); |
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(reqBodyStr)) { |
|
|
|
|
log.error("orderToPay error!", "参数错误"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
|
} |
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(reqBodyStr); |
|
|
|
|
Long orderId = jsonObject.getLong("orderId"); |
|
|
|
|
String password = jsonObject.getString("password"); |
|
|
|
|
|
|
|
|
|
if (orderId == null) { |
|
|
|
|
log.error("orderToPay error!", "参数错误"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 查询用户支付密码
|
|
|
|
|
HighUserPayPassword userPayPassword = highUserPayPasswordService.getDetailByUser(userInfoModel.getHighUser().getId()); |
|
|
|
|
if (userPayPassword == null) { |
|
|
|
|
log.error("orderToPay error!", "未设置支付密码"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_SET_USER_PAY_PWD, ""); |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isBlank(password)) { |
|
|
|
|
log.error("orderToPay error!", "未输入支付密码"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_ENTER_USER_PAY_PWD, ""); |
|
|
|
|
} |
|
|
|
|
// 校验支付密码是否一直
|
|
|
|
|
if (!AESEncodeUtil.aesEncrypt(password).equals(userPayPassword.getPassword())) { |
|
|
|
|
log.error("orderToPay error!", ""); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.USER_PAY_PWD_ERROR, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 订单
|
|
|
|
|
OutRechargeOrder order = outRechargeOrderService.findByOrderId(orderId); |
|
|
|
|
if (order == null) { |
|
|
|
|
log.error("hltUnionCardPay error!", "未找到订单信息"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单信息"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 订单状态 : 1.待支付 2.已支付 3.已完成 4.已退款 5.已取消
|
|
|
|
|
if (order.getStatus() != 1) { |
|
|
|
|
log.error("hltUnionCardPay error!", "无法支付,订单不处于待支付状态"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法支付,订单不处于待支付状态"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
outRechargeOrderService.goldPayOrder(userInfoModel.getHighUser().getId(), order.getId()); |
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success("支付成功"); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("orderToPay error!", e); |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/orderToRefund", method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "订单退款") |
|
|
|
|