From 1442f149019ee0590389abd7a88a79c4d9b59034 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期二, 27 五月 2025 18:23:34 +0800
Subject: [PATCH] bug修改

---
 ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/UserManageController.java |  128 ++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 122 insertions(+), 6 deletions(-)

diff --git a/ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/UserManageController.java b/ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/UserManageController.java
index 6c75ca6..11c3281 100644
--- a/ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/UserManageController.java
+++ b/ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/UserManageController.java
@@ -3,11 +3,16 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.admin.entity.Franchisee;
 import com.ruoyi.admin.entity.User;
+import com.ruoyi.admin.service.FranchiseeService;
 import com.ruoyi.admin.service.UserService;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.exception.GlobalException;
 import com.ruoyi.common.core.utils.StringUtils;
+import com.ruoyi.common.security.annotation.Logical;
+import com.ruoyi.common.security.annotation.RequiresPermissions;
+import com.ruoyi.common.security.service.TokenService;
 import com.ruoyi.order.api.entity.EvaluatePageVO;
 import com.ruoyi.order.api.entity.Order;
 import com.ruoyi.order.api.entity.UserWithdrawRecordVO;
@@ -15,6 +20,7 @@
 import com.ruoyi.order.api.feignClient.EvaluateClient;
 import com.ruoyi.order.api.feignClient.OrderClient;
 import com.ruoyi.order.api.feignClient.WithdrawClient;
+import com.ruoyi.system.api.model.LoginUser;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -25,6 +31,7 @@
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -47,6 +54,8 @@
     private EvaluateClient evaluateClient;
     @Resource
     private WithdrawClient withdrawClient;
+    @Resource
+    private TokenService tokenService;
 
     /**
      * 用户信息分页列表
@@ -54,6 +63,7 @@
      * @param pageNum  页码
      * @param pageSize 每页显示条数
      */
+    @RequiresPermissions("user_list")
     @ApiOperation(value = "用户管理-用户分页列表", tags = {"后台-用户管理-用户列表"})
     @GetMapping(value = "/page")
     @ApiImplicitParams({
@@ -81,6 +91,7 @@
      *
      * @param id 前台用户id
      */
+    @RequiresPermissions("user_detail")
     @ApiOperation(value = "用户管理-用户详情", tags = {"后台-用户管理-用户列表"})
     @GetMapping(value = "/detail")
     @ApiImplicitParams({
@@ -95,6 +106,7 @@
      *
      * @param ids 前台用户多条id拼接
      */
+    @RequiresPermissions("user_delete")
     @ApiOperation(value = "用户管理-批量删除用户", tags = {"后台-用户管理-用户列表"})
     @GetMapping(value = "/batchDelete")
     @ApiImplicitParams({
@@ -107,6 +119,8 @@
         return userService.updateBatchById(list) ? R.ok() : R.fail();
     }
 
+    @Resource
+    private FranchiseeService franchiseeService;
     /**
      * 用户所关联订单记录分页列表
      *
@@ -115,6 +129,7 @@
      * @param pageSize 每页显示条数
      * @return 分页列表
      */
+    @RequiresPermissions("user_detail")
     @ApiOperation(value = "用户详情-订单记录分页列表", tags = {"后台-用户管理-用户列表"})
     @GetMapping(value = "/orderList")
     @ApiImplicitParams({
@@ -125,7 +140,76 @@
     public R<IPage<Order>> orderList(@RequestParam("userId") Integer userId,
                                      @RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
                                      @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
-        return R.ok(orderClient.orderList(userId, pageNum, pageSize).getData());
+        LoginUser loginUser = tokenService.getLoginUser();
+        if (null == loginUser) {
+            return R.loginExpire("登录失效!");
+        }
+
+        List<String> cityList= new ArrayList<>();
+        if (loginUser.getCityList()!=null) {
+            cityList = loginUser.getCityList();
+        }
+        Integer franchiseeId = loginUser.getSysUser().getFranchiseeId();
+        String[] siteIds = new String[0];
+        if (franchiseeId!=null){
+        Franchisee byId = franchiseeService.getById(franchiseeId);
+        siteIds = byId.getSiteIds().split(",");
+        if (loginUser.getIsFranchisee()&&siteIds.length==0){
+            return R.ok();
+        }
+        }
+
+
+        R<Page<Order>> iPageR = orderClient.orderList1(userId,cityList, pageNum, pageSize, Arrays.asList(siteIds));
+        Page<Order> data = iPageR.getData();
+
+            List<Order> records = data.getRecords();
+            if (!records.isEmpty()) {
+                for (Order record : records) {
+                    if (record.getAddress() != null) {
+                        record.setReservationAddress(record.getReservationAddress() + record.getAddress());
+                    }
+
+                }
+            }
+
+        return R.ok(data);
+    }
+
+
+    @ApiOperation(value = "师傅订单详情", tags = {"后台-师傅管理-师傅列表管理"})
+    @GetMapping(value = "/workOrderList")
+    @ApiImplicitParams({
+            @ApiImplicitParam(value = "用户id", name = "workId", dataType = "Integer", required = true),
+            @ApiImplicitParam(value = "页码", name = "pageNum", dataType = "Integer", required = true),
+            @ApiImplicitParam(value = "每页条数", name = "pageSize", dataType = "Integer", required = true)
+    })
+    public R<IPage<Order>> workOrderList(@RequestParam("workId") Integer workId,
+                                     @RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
+                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+        LoginUser loginUser = tokenService.getLoginUser();
+        if (null == loginUser) {
+            return R.loginExpire("登录失效!");
+        }
+
+        Integer franchiseeId = loginUser.getSysUser().getFranchiseeId();
+        String [] siteIds = new String[0];
+        if (franchiseeId!=null) {
+            Franchisee byId = franchiseeService.getById(franchiseeId);
+            siteIds = byId.getSiteIds().split(",");
+            if (loginUser.getIsFranchisee() && siteIds.length == 0) {
+                return R.ok(new Page<Order>());
+            }
+        }
+        R<Page<Order>> iPageR = orderClient.workOrderList(workId, pageNum, pageSize,siteIds);
+        Page<Order> data = iPageR.getData();
+        List<Order> records = data.getRecords();
+        for (Order record : records) {
+            if (record.getAddress()!=null) {
+                record.setReservationAddress(record.getReservationAddress() + record.getAddress());
+            }
+        }
+        return R.ok(data);
     }
 
     /**
@@ -136,6 +220,7 @@
      * @param pageSize 每页显示条数
      * @return 分页列表
      */
+    @RequiresPermissions("user_detail")
     @ApiOperation(value = "用户详情-评价记录分页列表", tags = {"后台-用户管理-用户列表"})
     @GetMapping(value = "/evaluateList")
     @ApiImplicitParams({
@@ -146,7 +231,18 @@
     public R<Page<EvaluatePageVO>> evaluateList(Integer userId,
                                                 @RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
                                                 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
-        return evaluateClient.evaluateList(userId, pageNum, pageSize);
+        LoginUser loginUser = tokenService.getLoginUser();
+        List<String> cityList = loginUser.getCityList();
+        Integer franchiseeId = loginUser.getSysUser().getFranchiseeId();
+        String[] siteIds = new String[0];
+        if (franchiseeId!=null) {
+            Franchisee byId = franchiseeService.getById(franchiseeId);
+            siteIds  = byId.getSiteIds().split(",");
+            if (loginUser.getIsFranchisee() && siteIds.length == 0) {
+                return R.ok(new Page<>());
+            }
+        }
+        return evaluateClient.evaluateList1(cityList,userId, pageNum, pageSize,Arrays.asList(siteIds));
     }
 
     /**
@@ -154,12 +250,13 @@
      *
      * @param id 评价记录id
      */
+    @RequiresPermissions("user_detail")
     @ApiOperation(value = "用户详情-删除评价记录", tags = {"后台-用户管理-用户列表"})
     @GetMapping(value = "/deleteEvaluateRecord")
     @ApiImplicitParams({
             @ApiImplicitParam(value = "评价记录id", name = "id", dataType = "Integer", required = true)
     })
-    public R<String> deleteEvaluateRecord(@RequestParam Integer id) {
+    public R<String> deleteEvaluateRecord(@RequestParam Long id) {
         return evaluateClient.batchDelete(String.valueOf(id));
     }
 
@@ -168,6 +265,7 @@
      *
      * @return 操作结果
      */
+    @RequiresPermissions("user_withdrawal_setting")
     @ApiOperation(value = "关闭/开启审核", tags = {"后台-用户管理-用户列表"})
     @GetMapping(value = "/enableProcess")
     @ApiImplicitParams({
@@ -205,6 +303,7 @@
      * @param pageSize 每页显示条数
      * @return 分页列表
      */
+    @RequiresPermissions("user_detail")
     @ApiOperation(value = "用户详情-提现记录分页列表", tags = {"后台-用户管理-用户列表"})
     @GetMapping(value = "/withdrawList")
     @ApiImplicitParams({
@@ -215,7 +314,22 @@
     public R<Page<UserWithdrawRecordVO>> withdrawList(@RequestParam Integer userId,
                                                       @RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
                                                       @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
-        return withdrawClient.withdrawList(userId, pageNum, pageSize);
+        LoginUser loginUser = tokenService.getLoginUser();
+        List<String> cityList = new ArrayList<>();
+        if (loginUser.getCityList()!=null) {
+          cityList = loginUser.getCityList();
+        }
+        Integer franchiseeId = loginUser.getSysUser().getFranchiseeId();
+        String[] siteIds = new String[0];
+        if (franchiseeId!=null){
+            Franchisee byId = franchiseeService.getById(franchiseeId);
+            siteIds = byId.getSiteIds().split(",");
+            if (loginUser.getIsFranchisee()&&siteIds.length==0){
+                return R.ok();
+            }
+        }
+
+        return withdrawClient.withdrawList1(cityList,userId, pageNum, pageSize,Arrays.asList(siteIds));
     }
 
     /**
@@ -223,12 +337,13 @@
      *
      * @param id 提现记录id
      */
+    @RequiresPermissions(value = {"user_detail", "user_withdrawal_delete"}, logical = Logical.OR)
     @ApiOperation(value = "用户详情/用户提现管理-删除提现记录", tags = {"后台-用户管理-用户列表"})
     @GetMapping(value = "/deleteWithdrawRecord")
     @ApiImplicitParams({
             @ApiImplicitParam(value = "提现记录id", name = "id", dataType = "Integer", required = true)
     })
-    public R<String> deleteWithdrawRecord(@RequestParam Integer id) {
+    public R<String> deleteWithdrawRecord(@RequestParam Long id) {
         return withdrawClient.batchDelete(String.valueOf(id));
     }
 
@@ -239,6 +354,7 @@
      * @param state   审批结果
      * @param opinion 审批意见
      */
+    @RequiresPermissions(value = {"user_detail", "user_withdrawal_audit"}, logical = Logical.OR)
     @ApiOperation(value = "用户详情/用户提现管理-提现审批", tags = {"后台-用户管理-用户列表"})
     @GetMapping(value = "/withdrawExamine")
     @ApiImplicitParams({
@@ -246,7 +362,7 @@
             @ApiImplicitParam(value = "审批意见", name = "opinion", dataType = "String"),
             @ApiImplicitParam(value = "审批同意/不同意(1同意;2驳回)", name = "state", dataType = "Integer", required = true)
     })
-    public R<String> withdrawExamine(@RequestParam Integer id, @RequestParam Integer state, String opinion) {
+    public R<String> withdrawExamine(@RequestParam Long id, @RequestParam Integer state, String opinion) {
         com.ruoyi.order.api.entity.Withdraw withdraw = withdrawClient.withdrawRecordDetail(id).getData();
         if (null == withdraw) {
             throw new GlobalException("提现记录不存在或已删除!");

--
Gitblit v1.7.1