From 7858ae894c398f2f9248ac898b2ff200fa36225d Mon Sep 17 00:00:00 2001
From: longz <longzhaoz@qq.com>
Date: 星期三, 29 七月 2026 18:42:15 +0800
Subject: [PATCH] 各类修复

---
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
index 2373bea..53b0243 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
@@ -157,6 +157,8 @@
     private TAppUserWhitelistService appUserWhitelistService;
     @Resource
     private PartnerClient partnerClient;
+    @Resource
+    private PartnerAppUserAccessService partnerAppUserAccessService;
 
     @Autowired
     private RedissonClient redissonClient;
@@ -400,6 +402,10 @@
                 .eq(userListQueryDto.getVipTypeId() != null, TAppUser::getVipId, userListQueryDto.getVipTypeId())
                 .in(!userIds.isEmpty(),TAppUser::getId,userIds)
                 .orderByDesc(BasePojo::getCreateTime);
+        List<Long> partnerVisibleUserIds = partnerAppUserAccessService.getVisibleUserIdsForCurrentPartner();
+        if (partnerVisibleUserIds != null) {
+            query.in(TAppUser::getId, partnerVisibleUserIds);
+        }
         if (Integer.valueOf(1).equals(userListQueryDto.getWhitelistFlag())) {
             if (whitelistUserIds.isEmpty() && whitelistPhones.isEmpty()) {
                 query.eq(TAppUser::getId, -1L);
@@ -690,6 +696,7 @@
     @PostMapping(value = "/user/addOrUpdate")
     @Log(title = "【用户列表】添加编辑用户", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE)
     public R addOrUpdate(@RequestBody TAppUser  tAppUser) {
+        partnerAppUserAccessService.assertWritable();
         if (tAppUser.getId() != null){
             //为编辑操作,要进行vip的逻辑处理
             TAppUser nowUser = appUserService.getById(tAppUser.getId());
@@ -734,10 +741,11 @@
     }
     
     
-    @RequiresPermissions(value = {"/appUser/select", "/vipList/select"}, logical = Logical.OR)
+    @RequiresPermissions(value = {"/appUser/list", "/appUser/select", "/vipList/select"}, logical = Logical.OR)
     @ApiOperation(value = "用户详情", tags = {"用户管理-用户列表"})
     @GetMapping(value = "/user/detail/{id}")
     public R<UserDetailDto> userDetail(@PathVariable Long id) {
+        partnerAppUserAccessService.assertUserVisible(id);
         TAppUser user = appUserService.getById(id);
         R<Map<Integer, String>> vipMap = otherClient.getVipMap(Collections.singletonList(user.getVipId()));
         if (user.getVipEndTime()!=null&&user.getVipEndTime().isAfter(LocalDateTime.now())) {
@@ -772,13 +780,14 @@
         return R.ok(userDetailDto);
     }
     
-    @RequiresPermissions(value = {"/appUser/select", "/vipList/select"}, logical = Logical.OR)
+    @RequiresPermissions(value = {"/appUser/list", "/appUser/select", "/vipList/select"}, logical = Logical.OR)
     @ApiOperation(value = "用户详情积分明细", tags = {"后台-用户管理-用户列表"})
     @PostMapping(value = "/user/points/page")
     public R<Page<TAppUserIntegralChange>> pointsDetail(@RequestBody PointsQueryDto pointsQueryDto) {
         if (pointsQueryDto.getUserId()==null){
             pointsQueryDto.setUserId(tokenService.getLoginUserApplet().getUserId());
         }
+        partnerAppUserAccessService.assertUserVisible(pointsQueryDto.getUserId());
         List<Integer> types = new ArrayList<>();
         if (pointsQueryDto.getType()==null){
             types.add(1);
@@ -874,10 +883,11 @@
 
     }
 
-    @RequiresPermissions(value = {"/appUser/select", "/vipList/select"}, logical = Logical.OR)
+    @RequiresPermissions(value = {"/appUser/list", "/appUser/select", "/vipList/select"}, logical = Logical.OR)
     @ApiOperation(value = "用户详情余额明细", tags = {"后台-用户管理-用户列表"})
     @PostMapping(value = "/user/balance/page")
     public R<Page<TExchangeCodeUseRecord>> adminBalanceDetail(@RequestBody ExchangeCodeUseRecordQuery queryDto) {
+        partnerAppUserAccessService.assertUserVisible(queryDto.getUserId());
         return otherClient.exchangeCodeUseRecordPage(queryDto);
     }
 
@@ -945,6 +955,7 @@
     @PostMapping(value = "/user/status/change")
     @Log(title = "【用户列表】冻结解冻用户", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE)
     public R pointsDetail(@RequestBody UserChangeDto userChangeDto) {
+        partnerAppUserAccessService.assertWritable();
         TAppUser appUser = appUserService.getById(userChangeDto.getUserId());
         appUser.setStatus(userChangeDto.getStatus());
         appUser.setRemark(userChangeDto.getRemark());
@@ -958,6 +969,7 @@
     @PostMapping(value = "/user/unit/change")
     @Log(title = "【用户列表】修改用户单位", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE)
     public R unitChange(@RequestBody UnitChangeDto unitChangeDto) {
+        partnerAppUserAccessService.assertWritable();
         for (String s : unitChangeDto.getIds().split(",")) {
             TAppUser byId = appUserService.getById(s);
             byId.setCompanyId(unitChangeDto.getUnitId());
@@ -972,6 +984,7 @@
     @DeleteMapping(value = "/user/delete")
     @Log(title = "【用户列表】删除用户", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE)
     public R userDelete(String ids) {
+        partnerAppUserAccessService.assertWritable();
         String[] split = ids.split(",");
         for (String s : split) {
             appUserService.removeById(s);
@@ -1151,6 +1164,7 @@
     @PostMapping(value = "/user/give/vip")
     @Log(title = "【用户列表】赠送会员", businessType = BusinessType.OTHER,operatorType = OperatorType.MANAGE)
     public R giveVip(@RequestBody GiveVipDto  giveVipDto) {
+        partnerAppUserAccessService.assertWritable();
         String[] split = giveVipDto.getUserIds().split(",");
         for (String s : split) {
             TAppUser nowUser = appUserService.getById(s);

--
Gitblit v1.7.1