From 720c9faf1c5796f7a306d394f579909bea4cad15 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期四, 17 四月 2025 10:42:06 +0800
Subject: [PATCH] 提现代码

---
 ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/AppFranchiseeController.java |  114 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 107 insertions(+), 7 deletions(-)

diff --git a/ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/AppFranchiseeController.java b/ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/AppFranchiseeController.java
index 025fa45..cb47893 100644
--- a/ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/AppFranchiseeController.java
+++ b/ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/AppFranchiseeController.java
@@ -1,22 +1,39 @@
 package com.ruoyi.admin.controller;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.admin.entity.Franchisee;
 import com.ruoyi.admin.entity.FranchiseeWithdraw;
+import com.ruoyi.admin.entity.RecoveryServe;
 import com.ruoyi.admin.entity.TFranchiseeBalanceChange;
+import com.ruoyi.admin.request.AuditFranchiseeWithdrawDTO;
+import com.ruoyi.admin.request.FranchiseeWithdrawDTO;
 import com.ruoyi.admin.service.FranchiseeService;
 import com.ruoyi.admin.service.TFranchiseeBalanceChangeService;
+import com.ruoyi.admin.service.TFranchiseeWithdrawService;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.security.service.TokenService;
 import com.ruoyi.admin.request.WithdrawDTO;
+import com.ruoyi.order.api.entity.Order;
 import com.ruoyi.system.api.model.LoginUser;
+import com.ruoyi.system.api.model.LoginUserInfo;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -27,8 +44,8 @@
  * @since 2024-06-03
  */
 @RestController
-@RequestMapping("/franchisee")
-@Api(value = "加盟商迭代新增", tags = "加盟商迭代新增")
+@RequestMapping("/franchiseeWithdraw")
+@Api(value = "加盟商提现迭代新增", tags = "加盟商提现迭代新增")
 public class AppFranchiseeController {
 
 
@@ -38,11 +55,13 @@
     private FranchiseeService franchiseeService;
     @Resource
     private TFranchiseeBalanceChangeService franchiseeBalanceChangeService;
+    @Resource
+    private TFranchiseeWithdrawService franchiseeWithdrawService;
 
 
 
     @PostMapping("/applyWithdraw")
-    @ApiOperation(value = "加盟商申请提现", tags = {"提现"})
+    @ApiOperation(value = "APP-加盟商申请提现", tags = {"提现"})
     public R check(@RequestBody WithdrawDTO dto) {
         LoginUser loginUser = tokenService.getLoginUser();
         if (loginUser==null){
@@ -72,12 +91,93 @@
         franchiseeWithdraw.setStatus(1);
         franchiseeWithdraw.setContent(dto.getContent());
         franchiseeWithdraw.setMoney(dto.getMoney());
-        franchiseeWithdraw.setCreateTime(LocalDateTime.now());
-        franchiseeWithdraw.setUpdateTime(LocalDateTime.now());
+        franchiseeWithdraw.setCreateTime(new Date());
+        franchiseeWithdraw.setUpdateTime(new Date());
         franchiseeWithdraw.setIsDelete(0);
-
-
+        franchiseeWithdrawService.save(franchiseeWithdraw);
         return R.ok();
     }
 
+    @ApiOperation(value = "APP-加盟商提现记录", tags = {"提现"})
+    @GetMapping(value = "/franchiseeWithdrawListApp")
+
+    public R<IPage<FranchiseeWithdraw>> franchiseeWithdrawListApp(
+                                    @RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
+                                    @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+        LoginUser loginWorker = tokenService.getLoginUser();
+        if (null == loginWorker) {
+            return R.loginExpire("登录失效!");
+        }
+        IPage<FranchiseeWithdraw> franchiseeWithdrawList = franchiseeWithdrawService
+                .lambdaQuery().eq(FranchiseeWithdraw::getFranchiseeId, loginWorker.getUserid())
+                .orderByDesc(FranchiseeWithdraw::getCreateTime)
+                .page(Page.of(pageNum, pageSize));
+        return R.ok(franchiseeWithdrawList);
+    }
+    @ApiOperation(value = "管理后台-加盟商提现记录", tags = {"提现"})
+    @PostMapping(value = "/franchiseeWithdrawList")
+    public R<IPage<FranchiseeWithdraw>> franchiseeWithdrawList(@RequestBody FranchiseeWithdrawDTO franchiseeWithdrawDTO) {
+        LoginUser loginWorker = tokenService.getLoginUser();
+        if (null == loginWorker) {
+            return R.loginExpire("登录失效!");
+        }
+        LambdaQueryWrapper<FranchiseeWithdraw> franchiseeWithdrawLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        franchiseeWithdrawLambdaQueryWrapper.eq(FranchiseeWithdraw::getFranchiseeId, loginWorker.getUserid())
+                .orderByDesc(FranchiseeWithdraw::getCreateTime);
+        if (StringUtils.hasLength(franchiseeWithdrawDTO.getFranchiseeName())){
+            List<Integer> ids = franchiseeService.lambdaQuery().like(Franchisee::getName, franchiseeWithdrawDTO.getFranchiseeName()).list()
+                    .stream().map(Franchisee::getId).collect(Collectors.toList());
+            if (!ids.isEmpty()){
+                franchiseeWithdrawLambdaQueryWrapper.in(FranchiseeWithdraw::getFranchiseeId, ids);
+            }else{
+                franchiseeWithdrawLambdaQueryWrapper.eq(FranchiseeWithdraw::getFranchiseeId, -1);
+            }
+        }
+        if (StringUtils.hasLength(franchiseeWithdrawDTO.getStartTime())){
+            franchiseeWithdrawLambdaQueryWrapper
+                    .between(FranchiseeWithdraw::getCreateTime
+                            ,franchiseeWithdrawDTO.getStartTime()
+                            , franchiseeWithdrawDTO.getEndTime());
+        }
+        IPage<FranchiseeWithdraw> franchiseeWithdrawList = franchiseeWithdrawService
+                .page(Page.of(franchiseeWithdrawDTO.getPageNum(), franchiseeWithdrawDTO.getPageSize()), franchiseeWithdrawLambdaQueryWrapper);
+        List<Franchisee> list = franchiseeService.list();
+        for (FranchiseeWithdraw record : franchiseeWithdrawList.getRecords()) {
+            Franchisee franchisee = list.stream().filter(e -> e.getId().equals(record.getFranchiseeId())).findFirst().orElse(null);
+            if (franchisee!=null){
+                record.setFranchiseeName(franchisee.getName());
+                record.setFranchiseePhone(franchisee.getHeadPhone());
+            }
+        }
+        return R.ok(franchiseeWithdrawList);
+    }
+    @ApiOperation(value = "管理后台-加盟商提现详情", tags = {"提现"})
+    @GetMapping(value = "/franchiseeWithdrawInfo")
+    public R<FranchiseeWithdraw> franchiseeWithdrawInfo(@RequestParam(name = "id")Integer id) {
+        LoginUser loginWorker = tokenService.getLoginUser();
+        if (null == loginWorker) {
+            return R.loginExpire("登录失效!");
+        }
+        FranchiseeWithdraw franchiseeWithdraw = franchiseeWithdrawService.getById(id);
+        Franchisee franchisee = franchiseeService.getById(franchiseeWithdraw.getFranchiseeId());
+        if (franchisee!=null){
+            franchiseeWithdraw.setFranchiseePhone(franchisee.getHeadPhone());
+            franchiseeWithdraw.setFranchiseeName(franchisee.getName());
+        }
+        return R.ok(franchiseeWithdraw);
+    }
+    @ApiOperation(value = "管理后台-加盟商提现详情", tags = {"提现"})
+    @PostMapping(value = "/auditFranchiseeWithdraw")
+    public R auditFranchiseeWithdraw(@RequestBody AuditFranchiseeWithdrawDTO auditFranchiseeWithdrawDTO) {
+        LoginUser loginWorker = tokenService.getLoginUser();
+        if (null == loginWorker) {
+            return R.loginExpire("登录失效!");
+        }
+        FranchiseeWithdraw franchiseeWithdraw = franchiseeWithdrawService.getById(auditFranchiseeWithdrawDTO.getId());
+        franchiseeWithdraw.setStatus(auditFranchiseeWithdrawDTO.getStatus());
+        franchiseeWithdraw.setResult(auditFranchiseeWithdrawDTO.getResult());
+        franchiseeWithdraw.setImg(auditFranchiseeWithdrawDTO.getImg());
+        franchiseeWithdrawService.updateById(franchiseeWithdraw);
+        return R.ok();
+    }
 }

--
Gitblit v1.7.1