| | |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.GlobalException; |
| | | import com.ruoyi.order.entity.Order; |
| | | import com.ruoyi.order.entity.ServeRecord; |
| | | import com.ruoyi.order.entity.Withdraw; |
| | | import com.ruoyi.order.entity.WithdrawalSetting; |
| | | import com.ruoyi.order.entity.*; |
| | | import com.ruoyi.order.request.WithdrawExportRequest; |
| | | import com.ruoyi.order.service.OrderService; |
| | | import com.ruoyi.order.service.ServeRecordService; |
| | | import com.ruoyi.order.service.WithdrawRecordService; |
| | | import com.ruoyi.order.service.WithdrawService; |
| | | import com.ruoyi.order.vo.MoneyQueryRequest; |
| | | import com.ruoyi.order.vo.UserWithdrawRecordVO; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private WithdrawService withdrawService; |
| | | @Resource |
| | | private WithdrawRecordService withdrawRecordService; |
| | | @Resource |
| | | private OrderService orderService; |
| | | @Resource |
| | |
| | | public R<Withdraw> withdrawRecordDetail(@RequestParam("id") Long id) { |
| | | Withdraw withdraw = withdrawService.lambdaQuery().eq(Withdraw::getId, id) |
| | | .eq(Withdraw::getIsDelete, 0).one(); |
| | | List<WithdrawRecord> one = withdrawRecordService.lambdaQuery().eq(WithdrawRecord::getWithdrawId, id).list(); |
| | | withdraw.setWithdrawRecords(one); |
| | | return R.ok(withdraw); |
| | | } |
| | | |
| | |
| | | throw new GlobalException("订单信息异常!"); |
| | | } |
| | | Boolean b = withdrawService.confirmWithdraw(openId, userId, order); |
| | | // if (!b) { |
| | | // throw new GlobalException("提现失败!"); |
| | | // } |
| | | if (!b) { |
| | | throw new GlobalException("提现失败!"); |
| | | } |
| | | WithdrawRecord withdrawRecord = new WithdrawRecord(); |
| | | withdrawRecord.setWithdrawId(withdraw.getId()); |
| | | withdrawRecord.setOrderId(withdraw.getOrderId()); |
| | | withdrawRecord.setUserId(withdraw.getUserId()); |
| | | withdrawRecord.setWithdrawType(2); |
| | | withdrawRecord.setCreateTime(new Date()); |
| | | withdrawRecord.setAuditStatus(1); |
| | | withdrawRecordService.save(withdrawRecord); |
| | | }else { |
| | | WithdrawRecord withdrawRecord = new WithdrawRecord(); |
| | | withdrawRecord.setWithdrawId(withdraw.getId()); |
| | | withdrawRecord.setOrderId(withdraw.getOrderId()); |
| | | withdrawRecord.setUserId(withdraw.getUserId()); |
| | | withdrawRecord.setWithdrawType(2); |
| | | withdrawRecord.setCreateTime(new Date()); |
| | | withdrawRecord.setAuditStatus(0); |
| | | withdrawRecordService.save(withdrawRecord); |
| | | Order order = orderService.lambdaQuery() |
| | | .eq(Order::getId, withdraw.getOrderId()) |
| | | .eq(Order::getIsDelete, 0).one(); |
| | |
| | | .eq(Withdraw::getIsDelete, 0).orderByDesc(Withdraw::getCreateTime) |
| | | .page(Page.of(pageNum, pageSize))); |
| | | } |
| | | @GetMapping("/confirmMoney") |
| | | |
| | | R<String> confirmWithdraw(@RequestParam("id")String id){ |
| | | Withdraw withdraw = withdrawService.getById(id); |
| | | WithdrawRecord withdrawRecord = new WithdrawRecord(); |
| | | withdrawRecord.setWithdrawId(withdraw.getId()); |
| | | withdrawRecord.setOrderId(withdraw.getOrderId()); |
| | | withdrawRecord.setUserId(withdraw.getUserId()); |
| | | withdrawRecord.setWithdrawType(3); |
| | | withdrawRecord.setCreateTime(new Date()); |
| | | withdrawRecord.setAuditStatus(1); |
| | | withdrawRecordService.save(withdrawRecord); |
| | | return R.ok(); |
| | | } |
| | | @GetMapping("/withdrawDetailByUser") |
| | | @ApiOperation(value = "提现订单详情", tags = {"用户端"}) |
| | | public R<WithdrawDetailVO> withdrawDetailByUser(@RequestParam("orderId") String orderId) { |
| | |
| | | withdrawDetailVO.setWithdrawalState(withdraw.getState()); |
| | | withdrawDetailVO.setWithdrawalTime(withdraw.getCreateTime()); |
| | | } |
| | | withdrawDetailVO.setPackageInfo(order.getPackageInfo()); |
| | | withdrawDetailVO.setAddress(order.getAddress()); |
| | | if (null != serveRecord) { |
| | | withdrawDetailVO.setPhoto(serveRecord.getPhoto()); |
| | | } |
| | | List<WithdrawRecord> list = withdrawRecordService.lambdaQuery().eq(WithdrawRecord::getOrderId, orderId) |
| | | .eq(WithdrawRecord::getWithdrawId, withdraw.getId()) |
| | | .eq(WithdrawRecord::getUserId, withdraw.getUserId()).list(); |
| | | withdrawDetailVO.setWithdrawRecords(list); |
| | | return R.ok(withdrawDetailVO); |
| | | } |
| | | |