From 9411a5a1eec19f3460eca9a6c82ebb46dc4e2f0d Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期四, 26 六月 2025 20:06:58 +0800
Subject: [PATCH] 大屏接口bug修改

---
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/WithdrawController.java |   84 ++++++++++++++++++++++++++++++++++++++----
 1 files changed, 76 insertions(+), 8 deletions(-)

diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/WithdrawController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/WithdrawController.java
index 12e970a..054aa57 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/WithdrawController.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/WithdrawController.java
@@ -5,13 +5,11 @@
 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;
@@ -23,7 +21,11 @@
 
 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;
 
@@ -41,6 +43,8 @@
 
     @Resource
     private WithdrawService withdrawService;
+    @Resource
+    private WithdrawRecordService withdrawRecordService;
     @Resource
     private OrderService orderService;
     @Resource
@@ -68,10 +72,21 @@
                                                       @RequestParam(value = "applyForTime", required = false) String applyForTime,
                                                       @RequestParam(value = "state", required = false) Integer state,
                                                       @RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
-                                                      @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
-        return R.ok(withdrawService.withdrawPage(nickname, userPhone, applyForTime, state, Page.of(pageNum, pageSize)));
+                                                      @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                      @RequestParam(name = "userIds") List<Integer> userIds) {
+        return R.ok(withdrawService.withdrawPage(userIds,nickname, userPhone, applyForTime, state, Page.of(pageNum, pageSize)));
     }
-
+    @GetMapping(value = "/withdrawPage1")
+    public R<Page<UserWithdrawRecordVO>> withdrawPage1(@RequestParam(value = "cityList", required = false)List<String> cityList,@RequestParam(value = "nickname", required = false) String nickname,
+                                                      @RequestParam(value = "userPhone", required = false) String userPhone,
+                                                      @RequestParam(value = "applyForTime", required = false) String applyForTime,
+                                                      @RequestParam(value = "state", required = false) Integer state,
+                                                      @RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
+                                                      @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                      @RequestParam(name = "userIds") List<Integer> userIds,
+                                                       @RequestParam("siteIds") List<String> siteIds) {
+        return R.ok(withdrawService.withdrawPage1(cityList,userIds,nickname, userPhone, applyForTime, state, Page.of(pageNum, pageSize),siteIds));
+    }
     /**
      * 查看提现记录详情
      *
@@ -85,6 +100,8 @@
     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);
     }
 
@@ -130,6 +147,31 @@
             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();
+            if (null == order) {
+                throw new GlobalException("订单信息异常!");
+            }
+            order.setIsWithdrawal(0);
+            orderService.updateById(order);
         }
         update = update && withdrawService.updateById(withdraw);
         return R.ok(update);
@@ -227,6 +269,14 @@
                                                       @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
         return R.ok(withdrawService.withdrawList(userId, Page.of(pageNum, pageSize)));
     }
+    @GetMapping(value = "/withdrawList1")
+    public R<Page<UserWithdrawRecordVO>> withdrawList1(@RequestParam("cityList") List<String> cityList,@RequestParam("userId") Integer userId,
+                                                      @RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
+                                                      @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                       @RequestParam("siteIds") List<String> siteIds) {
+        return R.ok(withdrawService.withdrawList1(cityList,userId, Page.of(pageNum, pageSize),siteIds));
+    }
+
 
     /************************************* 用户端 **************************************************/
 
@@ -246,7 +296,7 @@
      */
     @ApiOperation(value = "用户提交提现申请", tags = {"用户端"})
     @GetMapping(value = "/confirmWithdrawByUser")
-    public R<Boolean> confirmWithdrawByUser(@RequestParam("orderId") String orderId,
+    public synchronized R<Boolean> confirmWithdrawByUser(@RequestParam("orderId") String orderId,
                                             @RequestParam("userId") Integer userId,
                                             @RequestParam("openId") String openId,
                                             @RequestParam("userPhone") String userPhone) {
@@ -271,7 +321,20 @@
                 .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) {
@@ -312,10 +375,15 @@
             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);
     }
 

--
Gitblit v1.7.1