From 8ffeb751b3a694e8d1cb6a21bec855f6c49b31b6 Mon Sep 17 00:00:00 2001 From: luodangjia <luodangjia> Date: 星期五, 07 二月 2025 15:38:46 +0800 Subject: [PATCH] 修改物流信息导入模板 --- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java | 75 ++++++++++++++++++++++++++++++++++--- 1 files changed, 68 insertions(+), 7 deletions(-) diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java index 41e70b7..ac4feb3 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java @@ -37,7 +37,7 @@ 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 lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; @@ -65,6 +65,7 @@ @Api(tags = {"登录注册-小程序"}) @RestController @RequestMapping("/app-user") +@Slf4j public class AppUserController extends BaseController { @Resource @@ -529,6 +530,16 @@ .like(AppUser::getName, name)); return R.ok(list); } + /** + * 根据用户名称模糊搜索用户列表,不过滤状态 + */ + @GetMapping("/getAppUserByNameNoFilter") + public R<List<AppUser>> getAppUserByNameNoFilter(@RequestParam("name") String name) { + List<AppUser> list = appUserService.list(new LambdaQueryWrapper<AppUser>() + .like(AppUser::getName, name)); + return R.ok(list); + } + /** * 根据用户电话模糊搜索用户列表 @@ -540,6 +551,15 @@ public R<List<AppUser>> getAppUserByPhone(@RequestParam("phone") String phone) { List<AppUser> list = appUserService.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getDelFlag, 0).eq(AppUser::getStatus, 1) .like(AppUser::getPhone, phone)); + return R.ok(list); + } + + /** + * 更具用户电话模糊查询用户列表,不过滤状态 + */ + @GetMapping("/getAppUserByPhoneNoFilter") + public R<List<AppUser>> getAppUserByPhoneNoFilter(@RequestParam("phone") String phone) { + List<AppUser> list = appUserService.getAppUserByPhoneNoFilter(phone); return R.ok(list); } @@ -676,7 +696,9 @@ AppUser byId = appUserService.getById(id); byId.setStatus(status); appUserService.updateById(byId); - loginout(id); + if (status == 2){ + loginout(id); + } return R.ok(); } @@ -685,6 +707,9 @@ if (!CollectionUtils.isEmpty(keys)) { for (String key : keys) { LoginUser user = redisService.getCacheObject(key); + if (user == null || user.getUserid() == null) { + continue; + } if (user.getUserid().equals(userId)) { redisService.deleteObject(key); break; @@ -796,6 +821,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,21 +856,24 @@ byId.setVipId(vipId); appUserService.updateById(byId); return R.ok(); - } @GetMapping("/bottom") @ApiOperation(value = "用户列表-绑定下级列表", tags = {"管理后台"}) public R<Page<AppUser>> bottom(Long id, Integer pageNum, Integer pageSize) { //绑定下级 - Page<AppUser> page = appUserService.lambdaQuery().eq(AppUser::getInviteUserId, id).page(Page.of(pageNum, pageSize)); + Page<AppUser> page = appUserService.lambdaQuery() + .eq(AppUser::getInviteUserId, id) + .eq(AppUser::getDelFlag, 0) + .eq(AppUser::getStatus, 1) + .page(Page.of(pageNum, pageSize)); return R.ok(page); } @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 +881,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); } -- Gitblit v1.7.1