From 936a76ce290b0b4d52b684e2f1c80a7e777f3704 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 21 May 2018 17:32:41 +0800 Subject: [PATCH] REPORT-6700 update --- .../mainframe/toolbar/ToolBarMenuDock.java | 43 ++++++++++++++--- .../com/fr/design/remote/RemoteMember.java | 42 ++++++++++++++--- .../src/com/fr/design/remote/Utils.java | 47 +++++++------------ .../remote/ui/AuthorityListControlPane.java | 2 +- .../ui/list/AddedMemberListCellRender.java | 2 +- .../ui/list/AddingMemberListCellRender.java | 2 +- designer-base/src/com/fr/env/RemoteEnv.java | 1 - 7 files changed, 92 insertions(+), 47 deletions(-) diff --git a/designer-base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index 5b43eb21ca..21f7c3386a 100644 --- a/designer-base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -8,14 +8,30 @@ import com.fr.base.FRContext; import com.fr.design.DesignState; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; -import com.fr.design.actions.community.*; -import com.fr.design.actions.file.*; +import com.fr.design.actions.community.BBSAction; +import com.fr.design.actions.community.BugAction; +import com.fr.design.actions.community.NeedAction; +import com.fr.design.actions.community.QuestionAction; +import com.fr.design.actions.community.SignAction; +import com.fr.design.actions.community.UpAction; +import com.fr.design.actions.community.VideoAction; +import com.fr.design.actions.file.CloseCurrentTemplateAction; +import com.fr.design.actions.file.ExitDesignerAction; +import com.fr.design.actions.file.OpenRecentReportMenuDef; +import com.fr.design.actions.file.OpenTemplateAction; +import com.fr.design.actions.file.PreferenceAction; +import com.fr.design.actions.file.SwitchExistEnv; import com.fr.design.actions.help.AboutAction; import com.fr.design.actions.help.TutorialAction; import com.fr.design.actions.help.WebDemoAction; import com.fr.design.actions.help.alphafine.AlphaFineAction; import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; -import com.fr.design.actions.server.*; +import com.fr.design.actions.server.ConnectionListAction; +import com.fr.design.actions.server.FunctionManagerAction; +import com.fr.design.actions.server.GlobalParameterAction; +import com.fr.design.actions.server.GlobalTableDataAction; +import com.fr.design.actions.server.PlatformManagerAction; +import com.fr.design.actions.server.PluginManagerAction; import com.fr.design.file.NewTemplatePane; import com.fr.design.fun.MenuHandler; import com.fr.design.fun.TableDataPaneProcessor; @@ -45,10 +61,23 @@ import com.fr.plugin.observer.PluginEventType; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; -import javax.swing.*; -import java.awt.*; -import java.util.*; +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.JMenuBar; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import javax.swing.UIManager; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.Locale; +import java.util.Set; /** * @author richer @@ -415,7 +444,7 @@ public abstract class ToolBarMenuDock { } private boolean shouldShowRemotePermission() { - return FRContext.getCurrentEnv() != null && FRContext.getCurrentEnv().isRoot(); + return FRContext.getCurrentEnv() != null && !FRContext.getCurrentEnv().isLocalEnv() && FRContext.getCurrentEnv().isRoot(); } protected boolean shouldShowPlugin() { diff --git a/designer-base/src/com/fr/design/remote/RemoteMember.java b/designer-base/src/com/fr/design/remote/RemoteMember.java index 019159b30a..c3da597e3e 100644 --- a/designer-base/src/com/fr/design/remote/RemoteMember.java +++ b/designer-base/src/com/fr/design/remote/RemoteMember.java @@ -5,20 +5,48 @@ public class RemoteMember { public static final RemoteMember DEFAULT_MEMBER = new RemoteMember("查询中..."); - private String name; + private String username; + private String realName; + private String userId; private boolean selected; - public RemoteMember(String name) { - this.name = name; + public RemoteMember(String username) { + this.username = username; } - public String getName() { - return name; + public RemoteMember realName(String realName) { + this.realName = realName; + return this; } - public void setName(String name) { - this.name = name; + public RemoteMember userId(String userId) { + this.userId = userId; + return this; + } + + public String getRealName() { + return realName; + } + + public void setRealName(String realName) { + this.realName = realName; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; } diff --git a/designer-base/src/com/fr/design/remote/Utils.java b/designer-base/src/com/fr/design/remote/Utils.java index 1e2e12ebaf..ec0a7ddeed 100644 --- a/designer-base/src/com/fr/design/remote/Utils.java +++ b/designer-base/src/com/fr/design/remote/Utils.java @@ -1,49 +1,38 @@ package com.fr.design.remote; -import com.fr.stable.StringUtils; +import com.fr.base.FRContext; +import com.fr.decision.webservice.bean.user.UserAdditionBean; +import com.fr.decision.webservice.v10.user.UserService; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import java.util.Random; +import java.util.Map; public class Utils { - private static final String SOURCES = - "._-~`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"; private Utils() { - } public static Collection getRemoteMember(String keyword) { - // todo 使用决策平台api获取决策平台用户 - List res = new ArrayList<>(); - for (int i = 0; i < 30; i++) { - RemoteMember remoteMember = new RemoteMember(generate()); - if (StringUtils.isEmpty(keyword)) { - res.add(remoteMember); - continue; - } - if (remoteMember.getName().contains(keyword)) { - res.add(remoteMember); - } + + List userBeans = new ArrayList<>(); + try { + Map result = UserService.getInstance().getAllUsers(FRContext.getCurrentEnv().getUser(), 1, 10, keyword, "", true); + userBeans = (List) result.get("items"); + } catch (Exception e) { + e.printStackTrace(); } - return res; - } + List res = new ArrayList<>(); - /** - * Generate a random string. - * - * @return String string - */ - private static String generate() { - Random random = new Random(); - char[] text = new char[6]; - for (int i = 0; i < 6; i++) { - text[i] = Utils.SOURCES.charAt(random.nextInt(Utils.SOURCES.length())); + for (UserAdditionBean userBean : userBeans) { + res.add(new RemoteMember(userBean.getUsername()) + .realName(userBean.getRealName()) + .userId(userBean.getId()) + ); } - return new String(text); + return res; } } diff --git a/designer-base/src/com/fr/design/remote/ui/AuthorityListControlPane.java b/designer-base/src/com/fr/design/remote/ui/AuthorityListControlPane.java index 3a117ecdef..b6094e427d 100644 --- a/designer-base/src/com/fr/design/remote/ui/AuthorityListControlPane.java +++ b/designer-base/src/com/fr/design/remote/ui/AuthorityListControlPane.java @@ -481,7 +481,7 @@ public class AuthorityListControlPane extends BasicPane { List members = userManagerPane.update(); for (RemoteMember member : members) { RemoteDesignAuthority authority = new RemoteDesignAuthority(); - authority.setName(member.getName()); + authority.setName(member.getUsername()); AuthorityListControlPane.this.addAuthority(authority, getModel().getSize()); } } diff --git a/designer-base/src/com/fr/design/remote/ui/list/AddedMemberListCellRender.java b/designer-base/src/com/fr/design/remote/ui/list/AddedMemberListCellRender.java index ceb761b72b..7c34fad5e7 100644 --- a/designer-base/src/com/fr/design/remote/ui/list/AddedMemberListCellRender.java +++ b/designer-base/src/com/fr/design/remote/ui/list/AddedMemberListCellRender.java @@ -35,7 +35,7 @@ public class AddedMemberListCellRender extends JPanel implements ListCellRendere @Override public Component getListCellRendererComponent(JList list, RemoteMember member, int index, boolean isSelected, boolean cellHasFocus) { - this.setLabelText(member.getName()); + this.setLabelText(member.getUsername()); return this; } diff --git a/designer-base/src/com/fr/design/remote/ui/list/AddingMemberListCellRender.java b/designer-base/src/com/fr/design/remote/ui/list/AddingMemberListCellRender.java index b953a42888..24a0a133b2 100644 --- a/designer-base/src/com/fr/design/remote/ui/list/AddingMemberListCellRender.java +++ b/designer-base/src/com/fr/design/remote/ui/list/AddingMemberListCellRender.java @@ -36,7 +36,7 @@ public class AddingMemberListCellRender extends JPanel implements ListCellRender @Override public Component getListCellRendererComponent(JList list, RemoteMember member, int index, boolean isSelected, boolean cellHasFocus) { - this.setLabelText(member.getName()); + this.setLabelText(member.getUsername()); check.setSelected(member.isSelected()); return this; } diff --git a/designer-base/src/com/fr/env/RemoteEnv.java b/designer-base/src/com/fr/env/RemoteEnv.java index 6163a75b7d..bb0b592ded 100644 --- a/designer-base/src/com/fr/env/RemoteEnv.java +++ b/designer-base/src/com/fr/env/RemoteEnv.java @@ -402,7 +402,6 @@ public class RemoteEnv extends AbstractEnv { } HttpClient client = createHttpMethod(para, true); - client.asGet(); String res = stream2String(execute4InputStream(client)); if (res == null) {