luodangjia
2025-02-06 4ea15c3e2a3f0434df79a1b49fe4e90f7337b025
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -37,7 +37,6 @@
import com.ruoyi.system.api.feignClient.SysUserClient;
import com.ruoyi.system.api.model.LoginUser;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
@@ -796,6 +795,20 @@
        return R.ok(byId);
    }
    /**
     * 获取指定用户的下级用户
     */
    @GetMapping("/bottom/list")
    @ApiOperation(value = "用户列表-下级用户", tags = {"管理后台"})
    public R<Page<AppUser>> bottom(Integer pageNum, Integer pageSize, Long userId){
        Page<AppUser> page = appUserService.page(Page.of(pageNum, pageSize), new LambdaQueryWrapper<AppUser>()
                .eq(AppUser::getInviteUserId, userId));
        return R.ok(page);
    }
    
    @GetMapping("/change/vip")
@@ -817,7 +830,6 @@
        byId.setVipId(vipId);
        appUserService.updateById(byId);
        return R.ok();
    }
    @GetMapping("/bottom")
@@ -831,7 +843,7 @@
    @GetMapping("/orders")
    @ApiOperation(value = "用户列表-订单列表", tags = {"管理后台"})
    public R<List<Order>> orders(Long id) {
    public R<JSONObject> orders(Long id,Integer pageNum, Integer pageSize) {
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserClient.getSysUser(userid).getData();
        Integer shopId = -1;
@@ -839,8 +851,27 @@
            shopId = sysUser.getObjectId();
        }
        R<List<Order>> listR = remoteOrderGoodsClient.byUserId(id,shopId);
        return R.ok(listR.getData());
        List<Order> data = listR.getData();
        Integer total = data.size();
        // 手动分页
        if (data != null && data.size() > 0) {
            if (pageNum == null || pageNum == 0) {
                pageNum = 1;
            }
            if (pageSize == null || pageSize == 0) {
                pageSize = 10;
            }
            data = data.stream()
                    .skip((pageNum - 1) * pageSize)
                    .limit(pageSize)
                    .collect(Collectors.toList());
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("records", data);
        jsonObject.put("total", total);
        jsonObject.put("size", pageSize);
        jsonObject.put("current", pageNum);
        return R.ok(jsonObject);
    }