| | |
| | | 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.*; |
| | |
| | | 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") |
| | |
| | | byId.setVipId(vipId); |
| | | appUserService.updateById(byId); |
| | | return R.ok(); |
| | | |
| | | } |
| | | |
| | | @GetMapping("/bottom") |
| | |
| | | |
| | | @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; |
| | |
| | | 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); |
| | | } |
| | | |
| | | |