| | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.vo.UserDto; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.order.entity.Order; |
| | | import com.ruoyi.order.entity.Withdraw; |
| | | import com.ruoyi.order.entity.WithdrawDetail; |
| | | import com.ruoyi.order.entity.WithdrawalSetting; |
| | | import com.ruoyi.order.entity.*; |
| | | import com.ruoyi.order.mapper.WithdrawMapper; |
| | | import com.ruoyi.order.request.WithdrawExportRequest; |
| | | import com.ruoyi.order.service.OrderService; |
| | | import com.ruoyi.order.service.WithdrawDetailService; |
| | | import com.ruoyi.order.service.WithdrawService; |
| | | import com.ruoyi.order.service.WithdrawalSettingService; |
| | | import com.ruoyi.order.service.*; |
| | | import com.ruoyi.order.vo.MoneyQueryRequest; |
| | | import com.ruoyi.order.vo.UserWithdrawRecordVO; |
| | | import com.ruoyi.order.vx.HttpUtil; |
| | |
| | | |
| | | @Resource |
| | | private WithdrawalSettingService withdrawalSettingService; |
| | | @Resource |
| | | private WithdrawRecordService withdrawRecordService; |
| | | @Resource |
| | | private OrderService orderService; |
| | | @Resource |
| | |
| | | withdraw.setUserId(userId); |
| | | withdraw.setUserPhone(userPhone); |
| | | withdraw.setApplyForTime(new Date()); |
| | | withdraw.setApplyForMoney(order.getSubsidy()!=null?order.getSubsidy().add(order.getOrderMoney()):order.getOrderMoney()); |
| | | withdraw.setApplyForMoney(order.getOrderMoney()); |
| | | withdraw.setOrderId(orderId); |
| | | withdraw.setCityCode(order.getCityCode()); |
| | | |
| | | this.save(withdraw); |
| | | WithdrawRecord withdrawRecord = new WithdrawRecord(); |
| | | withdrawRecord.setWithdrawId(withdraw.getId()); |
| | | withdrawRecord.setOrderId(withdraw.getOrderId()); |
| | | withdrawRecord.setUserId(withdraw.getUserId()); |
| | | withdrawRecord.setWithdrawType(1); |
| | | withdrawRecord.setCreateTime(new Date()); |
| | | withdrawRecord.setAuditStatus(1); |
| | | withdrawRecordService.save(withdrawRecord); |
| | | |
| | | // 未开启全局 提现审核,则用户提现不需要后台审核 |
| | | if (Constants.ZERO.equals(withdrawalSetting.getEnableProcess())) { |
| | | // 已通过 |
| | | withdraw.setState(Constants.ONE); |
| | | // 商家微信打款至微信零钱 |
| | | boolean update = weChatPay(order.getSubsidy()!=null?order.getSubsidy().add(order.getOrderMoney()):order.getOrderMoney(), openId,withdraw.getId(),order.getServerName()); |
| | | // if (!update) { |
| | | // throw new GlobalException("交易提现失败,请检查是否绑定微信!"); |
| | | // } |
| | | boolean update = weChatPay(order.getOrderMoney(), openId,withdraw.getId(),order.getServerName()); |
| | | if (!update) { |
| | | throw new GlobalException("交易提现失败,请检查是否绑定微信!"); |
| | | } |
| | | } else { |
| | | // 待审核 |
| | | withdraw.setState(Constants.ZERO); |
| | |
| | | withdrawDetail.setMoney(transferAmount); |
| | | withdrawDetail.setOutBatchNo(postMap.get("out_bill_no")+""); |
| | | withdrawDetailService.save(withdrawDetail); |
| | | |
| | | |
| | | } else { |
| | | allTransfersSuccessful = false; |
| | | break; |
| | | throw new GlobalException("提现失败,失败原因:"+jsonObject.getString("message")); |
| | | // allTransfersSuccessful = false; |
| | | // break; |
| | | } |
| | | |
| | | } |
| | | |
| | | return allTransfersSuccessful; |
| | | } |
| | | |