| | |
| | | import com.ruoyi.common.security.utils.CodeFactoryUtil; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.domain.dto.*; |
| | | import com.ruoyi.order.domain.pojo.account.OrderPayment; |
| | | import com.ruoyi.order.domain.pojo.account.OrderRefund; |
| | | import com.ruoyi.order.domain.pojo.account.PaymentMessage; |
| | | import com.ruoyi.order.domain.pojo.order.ConsumerGoods; |
| | |
| | | import com.ruoyi.order.service.order.OrderGoodsService; |
| | | import com.ruoyi.order.service.order.OrderService; |
| | | import com.ruoyi.order.service.order.UserServiceRecordService; |
| | | import com.ruoyi.order.tools.request.ecommerce.profitsharing.ProfitSharingApplyRequest; |
| | | import com.ruoyi.order.tools.request.pay.combine.CombineTransactionsJsRequest; |
| | | import com.ruoyi.order.tools.service.ProfitsSharingService; |
| | | import com.ruoyi.system.api.constant.AppErrorConstant; |
| | |
| | | import com.ruoyi.system.api.domain.poji.sys.SysUser; |
| | | import com.ruoyi.system.api.domain.vo.*; |
| | | import com.ruoyi.system.api.service.*; |
| | | import com.wechat.pay.java.service.partnerpayments.jsapi.model.Transaction; |
| | | import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension; |
| | | import com.wechat.pay.java.service.payments.jsapi.model.*; |
| | | import org.redisson.api.RLock; |
| | |
| | | |
| | | request.setPayer(payer); |
| | | |
| | | //设置订单允许分账 秒杀活动才允许分账 |
| | | /* if(order.getOrderFrom()==2){ |
| | | SettleInfo settleInfo=new SettleInfo(); |
| | | settleInfo.setProfitSharing(true); |
| | | request.setSettleInfo(settleInfo); |
| | | }*/ |
| | | |
| | | |
| | | //返回前端唤醒支付结果信息 |
| | | PrepayWithRequestPaymentResponse res = this.getJsApIResponse(request); |
| | |
| | | agStockChangeDto.setUserId(order.getUserId()); |
| | | remoteActivityService.changeActivityStock(agStockChangeDto); |
| | | // 调用支付 |
| | | PrepayRequest request = new PrepayRequest(); |
| | | Amount amount = new Amount(); |
| | | amount.setTotal(Integer.parseInt(order.getPayMoney().multiply(new BigDecimal(100)).toString())); |
| | | request.setAmount(amount); |
| | | request.setAppid(this.appId); |
| | | request.setMchid(this.mchId); |
| | | request.setDescription(order.getGoodsInfo()); |
| | | request.setNotifyUrl(this.notifyUrl); |
| | | request.setOutTradeNo(order.getOrderId()); |
| | | Payer payer = new Payer(); |
| | | // TODO 获取openID |
| | | payer.setOpenid("oLTPCuN5a-nBD4rAL_fa********"); |
| | | |
| | | request.setPayer(payer); |
| | | |
| | | //设置订单允许分账 秒杀活动才允许分账 |
| | | if(order.getOrderFrom()==2){ |
| | | SettleInfo settleInfo=new SettleInfo(); |
| | | settleInfo.setProfitSharing(true); |
| | | request.setSettleInfo(settleInfo); |
| | | } |
| | | |
| | | |
| | | //返回前端唤醒支付结果信息 |
| | | PrepayWithRequestPaymentResponse res = this.getJsApIResponse(request); |
| | | |
| | | appPlaceOrderVo.setAppId(this.appId); |
| | | appPlaceOrderVo.setTimeStamp(res.getTimeStamp()); |
| | | appPlaceOrderVo.setNonceStr(res.getNonceStr()); |
| | | appPlaceOrderVo.setPackageStr(res.getPackageVal()); |
| | | appPlaceOrderVo.setTradeType(res.getSignType()); |
| | | appPlaceOrderVo.setPaySign(res.getPaySign()); |
| | | |
| | | |
| | | //生成自动取消订单延时任务 |
| | | Integer delayTime = 30; |
| | | if(redisService.hasKey(SecurityConstant.AUTO_CANCEL_ORDER_TIME)){ |
| | |
| | | SysUser sysUser = remoteUserService.getSysUser(order.getUserId()).getData(); |
| | | merVerifyOrderVo.setUserName(sysUser.getNickName()); |
| | | merVerifyOrderVo.setUserMobile(sysUser.getPhonenumber()); |
| | | // |
| | | if(order.getOrderFrom()==2){ |
| | | |
| | | //profitsSharingService.applyProfitSharing(); |
| | | } |
| | | return merVerifyOrderVo; |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | * @description 订单支付回调 |
| | | * @author jqs |
| | | * @date 2023/7/13 17:57 |
| | | * @param orderId |
| | | * @param Transaction |
| | | * @return void |
| | | */ |
| | | @Override |
| | | public void payBack(String orderId) { |
| | | public void payBack(Transaction transaction) { |
| | | // 更新订单状态 |
| | | String orderId=transaction.getOutTradeNo(); |
| | | Order order = this.getById(orderId); |
| | | order.setOrderStatus(2); |
| | | order.setPayTime(new Date()); |
| | |
| | | } |
| | | activityTotalChangeDto.setUserId(order.getUserId()); |
| | | remoteActivityService.changeActivityTotal(activityTotalChangeDto); |
| | | |
| | | |
| | | //活动订单进行分账 |
| | | ProfitSharingApplyRequest request=new ProfitSharingApplyRequest(); |
| | | request.setAppid(this.appId); |
| | | request.setSubMchid(""); |
| | | request.setTransactionId(transaction.getTransactionId()); |
| | | profitsSharingService.applyProfitSharing(request); |
| | | } |
| | | //生成支付记录 |
| | | OrderPayment orderPayment = new OrderPayment(); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | /** |