|
@@ -14,6 +14,7 @@ import com.qs.mp.admin.service.IGoodsService;
|
|
|
import com.qs.mp.admin.service.IGoodsSkuService;
|
|
|
import com.qs.mp.channel.domain.ChannelOrder;
|
|
|
import com.qs.mp.channel.domain.param.OrderPayParam;
|
|
|
+import com.qs.mp.common.constant.Constants;
|
|
|
import com.qs.mp.common.constant.PayConstants;
|
|
|
import com.qs.mp.common.core.domain.AjaxResult;
|
|
|
import com.qs.mp.common.core.page.TableDataInfo;
|
|
@@ -441,6 +442,67 @@ public class UserDeliverOrderController extends BaseApiController {
|
|
|
return AjaxResult.success(jsonObject);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @PostMapping("/dg/order/pay")
|
|
|
+ @ApiOperation(value = "订单支付", notes = "订单支付")
|
|
|
+ public AjaxResult dgpay(@Valid @RequestBody OrderPayParam param) {
|
|
|
+
|
|
|
+ Long userId = SecurityUtils.getLoginUser().getUserId();
|
|
|
+ SysUser sysUser = sysUserService.selectUserById(userId);
|
|
|
+ String openId = "";
|
|
|
+ //支付方式:1支付宝,2微信
|
|
|
+ Integer payType = param.getPayType();
|
|
|
+ if (payType == 1) {
|
|
|
+ if (StringUtils.isBlank(sysUser.getAliuserId())) {
|
|
|
+ return AjaxResult.error(ErrorCodeEnum.ERROR_CODE_1026);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ AppSourceEnum appSourceEnum = AppSourceEnum.getByValue(param.getAppSource());
|
|
|
+ if (AppSourceEnum.MSDQ.equals(appSourceEnum)) {
|
|
|
+ if (StringUtils.isBlank(sysUser.getMsdqOpenId())) {
|
|
|
+ return AjaxResult.error(ErrorCodeEnum.ERROR_CODE_1005);
|
|
|
+ }
|
|
|
+ openId = sysUser.getMsdqOpenId();
|
|
|
+ } else {
|
|
|
+ if (StringUtils.isBlank(sysUser.getOpenId())) {
|
|
|
+ return AjaxResult.error(ErrorCodeEnum.ERROR_CODE_1005);
|
|
|
+ }
|
|
|
+ openId = sysUser.getOpenId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取订单
|
|
|
+ UserDeliverOrder deliverOrder = userDeliverOrderService.getById(param.getOrderId());
|
|
|
+ //获取支付参数
|
|
|
+ //openid-->code
|
|
|
+ //支付方式:1支付宝,2微信
|
|
|
+
|
|
|
+ JSONObject jsonObject;
|
|
|
+ try {
|
|
|
+
|
|
|
+ if (param.getPayType() == 1) {
|
|
|
+ // 支付宝支付
|
|
|
+ jsonObject = walletService.dgAliPay(BizTypeEnum.DELIVER_ORDER, param.getOrderId(), sysUser.getAliuserId(),
|
|
|
+ deliverOrder.getPayAmt(), "盲票--提货订单", Constants.PAY_STYLE_ALI, param.getAppSource());
|
|
|
+
|
|
|
+ } else {
|
|
|
+ // 微信支付
|
|
|
+ jsonObject = walletService.dgWxPay(BizTypeEnum.DELIVER_ORDER, param.getOrderId(), openId,
|
|
|
+ deliverOrder.getPayAmt(), "盲票--提货订单", param.getAppSource(), Constants.PAY_STYLE_WX);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ LogUtil.error(logger, e, "根据提货单创建支付单失败。userId:{0},orderId:{1}",
|
|
|
+ new Object[]{userId, param.getOrderId()});
|
|
|
+ return AjaxResult.error(e.getMessage());
|
|
|
+ }
|
|
|
+ return AjaxResult.success(jsonObject);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@PostMapping("/order/confirm")
|
|
|
@ApiOperation("订单确认收货")
|
|
|
public AjaxResult confirm(@RequestBody UserDeliverOrder order) {
|