From 06b5fc35da9f55db3e523ebb3e594a8524934926 Mon Sep 17 00:00:00 2001 From: wanggeng888 <450292408@qq.com> Date: Tue, 19 Jan 2021 23:15:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=AD=BE=E5=90=8D=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8Cindex=E8=AE=BE=E7=BD=AEurl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/routes/RouteController.java | 1 + .../service/user/impl/UserImServiceImpl.java | 26 ++++++++++++++----- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/controller/routes/RouteController.java b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/controller/routes/RouteController.java index 56f1657..3b10730 100644 --- a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/controller/routes/RouteController.java +++ b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/controller/routes/RouteController.java @@ -44,6 +44,7 @@ public class RouteController { } else { mv.addObject("oauthServer", systemProperties.getPortalUrl()); } + mv.addObject("url", systemProperties.getUrl()); mv.addObject("ws", systemProperties.getWs()); mv.addObject("title", systemProperties.getTitle()); return mv; diff --git a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/user/impl/UserImServiceImpl.java b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/user/impl/UserImServiceImpl.java index 54ea983..6e90ce5 100644 --- a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/user/impl/UserImServiceImpl.java +++ b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/user/impl/UserImServiceImpl.java @@ -50,34 +50,48 @@ public class UserImServiceImpl extends AbstractService implements IUserImService mine.setUsername(currentUser.getUserName()); mine.setAvatar("assets/images/random-avatar1.jpg"); mine.setStatus("online"); - mine.setSign("暂无简介"); + mine.setSign("暂无签名"); Map params = getHashMap(2); List friends = listDepartmentUser(params); // 非管理员添加系统管理员 - if(!StringUtils.equals(ISystemConstant.ADMIN, currentUser.getUserUsername())) { + if (!StringUtils.equals(ISystemConstant.ADMIN, currentUser.getUserUsername())) { // 加载管理员 SuccessResultLayImData.Friend adminFriend = new SuccessResultLayImData.Friend(); adminFriend.setId("admin"); adminFriend.setGroupname("管理员"); SuccessResultLayImData.User user = new SuccessResultLayImData.User(); user.setId("1"); + mine.setStatus("offline"); user.setUsername("系统管理员"); List users = new ArrayList<>(); users.add(user); adminFriend.setList(users); friends.add(adminFriend); } - for (SuccessResultLayImData.Friend friend : friends) { - for (SuccessResultLayImData.User user : friend.getList()) { + for (int i = 0; i < friends.size(); i++) { + SuccessResultLayImData.Friend friend = friends.get(i); + for (int j = 0; j < friend.getList().size(); j++) { + SuccessResultLayImData.User user = friend.getList().get(j); + // 删除自己 + if (StringUtils.equals(user.getId(), mine.getId())) { + friend.getList().remove(j); + j--; + continue; + } if (StringUtils.isBlank(user.getAvatar())) { user.setAvatar("assets/images/random-avatar1.jpg"); } else { user.setAvatar(apiPathProperties.getUserCenter() + "/route/file/downloadfile/true/" + user.getAvatar()); } - user.setStatus("online"); - user.setSign("暂无简介"); + user.setStatus("offline"); + user.setSign("暂无签名"); + } + // 删除用户为空的朋友组 + if (friend.getList().isEmpty()) { + friends.remove(i); + i--; } }