Browse Source

Pull request #6491: REPORT-60153 复用组件接触点优化二期

Merge in DESIGN/design from ~KERRY/design_10.0:feature/x to feature/x

* commit '3084eef79d91008e5455ff8f1e9927ed48fad5dc':
  REPORT-60153 复用组件接触点优化二期
feature/x
kerry 3 years ago
parent
commit
c44b8328cf
  1. 16
      designer-base/src/main/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfo.java
  2. 6
      designer-base/src/main/java/com/fr/design/mainframe/share/ComponentShareUtil.java
  3. 6
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  4. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java
  5. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/Jump2DetailAction.java
  6. 17
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java
  7. 13
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java
  8. 12
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java
  9. 4
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java
  10. 23
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/CarouselStateManger.java
  11. 12
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java
  12. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java
  13. 30
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterConfigPane.java
  14. 6
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java
  15. 5
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java
  16. 15
      designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java

16
designer-base/src/main/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfo.java

@ -28,6 +28,8 @@ public class ComponentReuseNotificationInfo implements XMLable {
private boolean widgetLibHasRefreshed = false;
private boolean completeFirstShowComponentLib = false;
public boolean isClickedWidgetLib() {
return clickedWidgetLib;
}
@ -68,6 +70,14 @@ public class ComponentReuseNotificationInfo implements XMLable {
this.widgetLibHasRefreshed = widgetLibHasRefreshed;
}
public boolean isCompleteFirstShowComponentLib() {
return completeFirstShowComponentLib;
}
public void setCompleteFirstShowComponentLib(boolean completeFirstShowComponentLib) {
this.completeFirstShowComponentLib = completeFirstShowComponentLib;
}
public String getHistoryCreatedReuses() {
return historyCreatedReuses;
}
@ -79,7 +89,8 @@ public class ComponentReuseNotificationInfo implements XMLable {
@Override
public void readXML(XMLableReader reader) {
this.setClickedWidgetLib(reader.getAttrAsBoolean("clickedWidgetLib", false));
this.setCompleteEmbedFilter(reader.getAttrAsBoolean("hasCompleteEmbedFilter", false));
this.setCompleteEmbedFilter(reader.getAttrAsBoolean("completeEmbedFilter", false));
this.setCompleteFirstShowComponentLib(reader.getAttrAsBoolean("completeFirstShowComponentLib", false));
this.setWidgetLibHasRefreshed(reader.getAttrAsBoolean("widgetLibHasRefreshed", false));
this.setFirstDrag(reader.getAttrAsBoolean("firstDrag", true));
this.setHistoryCreatedReuses(reader.getAttrAsString("historyCreatedReuses", "[]"));
@ -90,7 +101,8 @@ public class ComponentReuseNotificationInfo implements XMLable {
public void writeXML(XMLPrintWriter writer) {
writer.startTAG("ComponentReuseNotificationInfo");
writer.attr("clickedWidgetLib", this.clickedWidgetLib)
.attr("hasCompleteEmbedFilter", this.completeEmbedFilter)
.attr("completeEmbedFilter", this.completeEmbedFilter)
.attr("completeFirstShowComponentLib", this.completeFirstShowComponentLib)
.attr("firstDrag", this.firstDrag)
.attr("widgetLibHasRefreshed", this.widgetLibHasRefreshed)
.attr("firstDragEndTime", this.firstDragEndTime)

6
designer-base/src/main/java/com/fr/design/mainframe/share/ComponentShareUtil.java

@ -48,7 +48,7 @@ public class ComponentShareUtil {
}
/**
* 判断是否需要展示嵌入式筛选面板
* 判断是否在需要展示组件库界面
*
* @return boolean
*/
@ -56,6 +56,10 @@ public class ComponentShareUtil {
return !ComponentReuseNotificationInfo.getInstance().isCompleteEmbedFilter() && !hasTouched() && isCurrentTplNewCreate();
}
public static boolean needShowComponentLib() {
return !ComponentReuseNotificationInfo.getInstance().isCompleteFirstShowComponentLib() && !hasTouched() && isCurrentTplNewCreate();
}
/**
* 判断是否需要展示首次拖拽动效
*

6
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -13,6 +13,7 @@ import com.fr.base.theme.TemplateThemeConfig;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.FormMobileAttrAction;
import com.fr.design.actions.TemplateParameterAction;
@ -49,6 +50,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.form.FormECCompositeProvider;
import com.fr.design.mainframe.form.FormECDesignerProvider;
import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo;
import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.mainframe.share.ComponentShareUtil;
import com.fr.design.mainframe.template.info.JFormProcessInfo;
@ -894,8 +896,10 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
pane.setLayout(new BorderLayout());
pane.add(FormWidgetDetailPane.getInstance(formDesign), BorderLayout.CENTER);
EastRegionContainerPane.getInstance().replaceWidgetLibPane(pane);
if (!ComponentShareUtil.hasTouched() && this.isNewCreateTpl()) {
if (ComponentShareUtil.needShowComponentLib()) {
ComponentCollector.getInstance().collectFirstShowReact(1);
ComponentReuseNotificationInfo.getInstance().setCompleteFirstShowComponentLib(true);
DesignerEnvManager.getEnvManager().saveXMLFile();
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_LIB);
}
}

2
designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java

@ -17,6 +17,7 @@ import com.fr.design.login.DesignerLoginSource;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.share.ui.constants.ColorConstants;
import com.fr.design.mainframe.share.ui.online.CarouselStateManger;
import com.fr.design.mainframe.share.util.DownloadUtils;
import com.fr.design.mainframe.theme.dialog.TemplateThemeUsingDialog;
import com.fr.stable.StringUtils;
@ -75,6 +76,7 @@ public class DownloadSuitableThemeAction extends SharedComponentPopupAction {
public void actionPerformed(ActionEvent e) {
currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
fetchTheme();
CarouselStateManger.getInstance().start(CarouselStateManger.RIGHT_CLICK);
}
private boolean checkAuthority() {

2
designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/Jump2DetailAction.java

@ -5,6 +5,7 @@ import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIMenuItemUI;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.share.ui.constants.ColorConstants;
import com.fr.design.mainframe.share.ui.online.CarouselStateManger;
import com.fr.stable.StringUtils;
import javax.swing.Action;
@ -41,6 +42,7 @@ public class Jump2DetailAction extends SharedComponentPopupAction {
} catch (IOException | URISyntaxException ioException) {
ioException.printStackTrace();
}
CarouselStateManger.getInstance().start(CarouselStateManger.RIGHT_CLICK);
}
}
}

17
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java

@ -5,6 +5,7 @@ import com.fr.design.mainframe.share.ui.actions.DownloadSuitableThemeAction;
import com.fr.design.mainframe.share.ui.actions.Jump2DetailAction;
import com.fr.design.mainframe.share.ui.actions.SharedComponentPopupMenu;
import com.fr.design.mainframe.share.ui.online.AbstractOnlineWidgetSelectPane;
import com.fr.design.mainframe.share.ui.online.CarouselStateManger;
import com.fr.design.mainframe.share.ui.online.resource.OnlineResourceManager;
import com.fr.design.mainframe.share.ui.online.resource.ResourceLoader;
import com.fr.design.utils.gui.GUICoreUtils;
@ -30,8 +31,9 @@ import java.net.URL;
*/
public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock<OnlineShareWidget> implements ResourceLoader {
private final AbstractOnlineWidgetSelectPane parentPane;
protected final AbstractOnlineWidgetSelectPane parentPane;
private UILabel coverLabel;
private Image coverImage;
public AbstractOnlineWidgetBlock(OnlineShareWidget widget, AbstractOnlineWidgetSelectPane parentPane) {
super(widget);
@ -61,8 +63,12 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock<Onlin
@Override
@NotNull
protected Image getCoverImage() {
if (coverImage != null) {
return coverImage;
}
OnlineResourceManager.getInstance().addLoader(this);
return getDefaultDisplayImage();
coverImage = getDefaultDisplayImage();
return coverImage;
}
@Override
@ -95,15 +101,16 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock<Onlin
public void resetCover(Image image) {
coverLabel.setIcon(new ImageIcon(image));
this.parentPane.validate();
this.parentPane.repaint();
coverImage = image;
coverLabel.setIcon(new ImageIcon(coverImage));
this.repaint();
}
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
if (e.getButton() == MouseEvent.BUTTON3) {
CarouselStateManger.getInstance().suspend(CarouselStateManger.MOUSE_HOVER);
this.parentPane.hidePreviewPane();
JPopupMenu rightClickPopupMenu = getRightClickPopupMenu();
GUICoreUtils.showPopupMenu(rightClickPopupMenu, this, e.getX(), e.getY());

13
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java

@ -13,6 +13,7 @@ import com.fr.design.login.DesignerLoginSource;
import com.fr.design.mainframe.WidgetToolBarPane;
import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.mainframe.share.ui.online.AbstractOnlineWidgetSelectPane;
import com.fr.design.mainframe.share.ui.online.CarouselStateManger;
import com.fr.form.share.DefaultSharableWidget;
import com.fr.form.share.group.DefaultShareGroup;
import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane;
@ -185,6 +186,7 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
}
private void downLoadWidget() {
CarouselStateManger.getInstance().suspend(CarouselStateManger.DOWNLOAD_COMPONENT);
if (OnlineWidgetRepoPane.getInstance().isShowPackagePanel()) {
ComponentCollector.getInstance().collectDownloadPktNum();
}
@ -234,6 +236,7 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
try {
if (get()) {
LocalWidgetRepoPane.getInstance().refreshShowPanel();
CarouselStateManger.getInstance().start(CarouselStateManger.DOWNLOAD_COMPONENT);
} else {
ShareUIUtils.showErrorMessageDialog(Toolkit.i18nText("Fine-Design_Share_Download_Failed"));
}
@ -245,8 +248,6 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
}
}
}.execute();
}
@ -330,6 +331,14 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
}
}
@Override
public void repaint() {
super.repaint();
if (this.parentPane != null) {
this.parentPane.refreshUI();
}
}
class WidgetDownloadProcess implements com.fr.design.extra.Process<Double> {
@Override

12
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java

@ -48,7 +48,6 @@ public abstract class PreviewWidgetBlock<T> extends JPanel implements MouseListe
private static final int ANIMATE_START_TIME = 1000;
private static final int ANIMATE_TIME = 2000;
private AnimatePopupDialog animatePopupDialog;
private AWTEventListener awtEventListener;
private static final double[] ANIMATE_CONTROL_VALUE = {0.23, 1, 0.32, 1};
@ -104,7 +103,7 @@ public abstract class PreviewWidgetBlock<T> extends JPanel implements MouseListe
private void showPreviewPane() {
synchronized (this) {
CarouselStateManger.getInstance().suspend();
CarouselStateManger.getInstance().suspend(CarouselStateManger.MOUSE_HOVER);
if (!showing) {
showPreview(widget);
showing = true;
@ -119,7 +118,6 @@ public abstract class PreviewWidgetBlock<T> extends JPanel implements MouseListe
protected abstract void hidePreview();
private void hidePreviewPane() {
CarouselStateManger.getInstance().start();
if (showing) {
hidePreview();
showing = false;
@ -176,7 +174,7 @@ public abstract class PreviewWidgetBlock<T> extends JPanel implements MouseListe
private void animate(ScheduledExecutorService service) {
CarouselStateManger.getInstance().suspend();
CarouselStateManger.getInstance().suspend(CarouselStateManger.FIRST_DRAG_ANIMATE);
AtomicInteger atomicInteger = new AtomicInteger(0);
BezierCubic cubic = new BezierCubic(ANIMATE_CONTROL_VALUE[0], ANIMATE_CONTROL_VALUE[1], ANIMATE_CONTROL_VALUE[2], ANIMATE_CONTROL_VALUE[3]);
Point startPoint = new Point(this.getLocationOnScreen().x - 5, this.getLocationOnScreen().y - 5);
@ -193,7 +191,7 @@ public abstract class PreviewWidgetBlock<T> extends JPanel implements MouseListe
ComponentReuseNotificationInfo.getInstance().setFirstDragEndTime(System.currentTimeMillis());
DesignerEnvManager.getEnvManager().saveXMLFile();
java.awt.Toolkit.getDefaultToolkit().removeAWTEventListener(awtEventListener);
CarouselStateManger.getInstance().start();
CarouselStateManger.getInstance().start(CarouselStateManger.FIRST_DRAG_ANIMATE);
return;
}
double progress = calXProgress(atomicInteger.getAndIncrement() * 20, cubic);
@ -220,7 +218,9 @@ public abstract class PreviewWidgetBlock<T> extends JPanel implements MouseListe
public void mouseExited(MouseEvent e) {
hover = false;
this.hidePreviewPane();
if(!FirstDragAnimateStateManager.getInstance().animating()){
CarouselStateManger.getInstance().start(CarouselStateManger.MOUSE_HOVER);
}
}
@Override

4
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java

@ -241,4 +241,8 @@ public abstract class AbstractOnlineWidgetSelectPane extends AbstractWidgetSele
protected Container getParentContainer() {
return this.getParent();
}
public void refreshUI() {
OnlineWidgetRepoPane.getInstance().repaint();
}
}

23
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/CarouselStateManger.java

@ -1,6 +1,9 @@
package com.fr.design.mainframe.share.ui.online;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils;
import java.util.concurrent.CountDownLatch;
/**
@ -8,10 +11,18 @@ import java.util.concurrent.CountDownLatch;
*/
public class CarouselStateManger {
private static final String START_CAROUSEL ="START_CAROUSEL";
public static final String RIGHT_CLICK ="RIGHT_CLICK";
public static final String DOWNLOAD_COMPONENT ="DOWNLOAD_COMPONENT";
public static final String FIRST_DRAG_ANIMATE ="FIRST_DRAG_ANIMATE";
public static final String MOUSE_HOVER ="MOUSE_HOVER";
private CarouseState state;
private final CountDownLatch countDownLatch = new CountDownLatch(1);
private String suspendEvent;
public static CarouselStateManger getInstance() {
return CarouselStateManger.HOLDER.singleton;
@ -37,12 +48,22 @@ public class CarouselStateManger {
this.state = CarouseState.RUNNING;
}
public void start(String startEvent) {
if (!this.stopped() && ComparatorUtils.equals(this.suspendEvent, startEvent)){
this.state = CarouseState.RUNNING;
this.suspendEvent = StringUtils.EMPTY;
}
}
public boolean running() {
return this.state == CarouseState.RUNNING;
}
public void suspend() {
public void suspend(String externalSuspendEvent) {
if (!this.stopped()) {
this.state = CarouseState.SUSPEND;
this.suspendEvent = externalSuspendEvent;
}
}
public boolean isSuspend() {

12
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java

@ -82,11 +82,10 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane
public void animate() throws InterruptedException {
CarouselStateManger.getInstance().countDownLatchAwait();
AtomicInteger integer = new AtomicInteger(0);
AtomicInteger integer = new AtomicInteger(showWidgets.length-1);
showCurrentLoadBlock(integer, widgetPane);
this.repaint();
previewDialog.setVisible(true);
CarouselStateManger.getInstance().start();
}
private void showCurrentLoadBlock(AtomicInteger integer, JPanel widgetPane) {
@ -105,12 +104,13 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane
stopCarouse(integer);
return;
}
if (integer.get() == showWidgets.length - 1) {
if (integer.get() == 0) {
CarouselStateManger.getInstance().stop();
stopCarouse(integer);
previewDialog.setVisible(false);
return;
}
integer.incrementAndGet();
integer.decrementAndGet();
if (!CarouselStateManger.getInstance().isSuspend()) {
showCurrentLoadBlock(integer, widgetPane);
} else {
@ -139,12 +139,12 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane
private void stopCarouse(AtomicInteger integer) {
previewDialog.setVisible(false);
loadRestShowWidgets(integer.get() + 1);
loadRestShowWidgets(integer.get() - 1);
java.awt.Toolkit.getDefaultToolkit().removeAWTEventListener(awtEventListener);
}
private void loadRestShowWidgets(int startIndex) {
for (int i = startIndex; i < showWidgets.length; i++) {
for (int i = startIndex; i >= 0; i--) {
OnlineShareWidget shareWidget = showWidgets[i];
widgetPane.add(createWidgetBlock(shareWidget));
}

2
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java

@ -49,7 +49,7 @@ public class OnlineResourceManager {
try {
loader = loaderBlockingQueue.take();
} catch (InterruptedException e) {
e.printStackTrace();
}
loader.load();
}

30
designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterConfigPane.java

@ -9,6 +9,7 @@ import com.fr.design.mainframe.share.Bean.WidgetFilterInfo;
import com.fr.design.mainframe.share.Bean.WidgetFilterTypeInfo;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils;
import com.fr.third.javax.annotation.Nullable;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
@ -152,7 +153,7 @@ public abstract class FilterConfigPane extends JPanel {
checkBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (checkBox.isSelected() && !checkBox.getFilterInfo().hasChildFilter()) {
if (checkBox.isSelected() && (!checkBox.getFilterInfo().hasChildFilter() || !showChildNode)) {
filterList.add(filterInfo);
} else if (filterList.contains(filterInfo)) {
filterList.remove(filterInfo);
@ -222,16 +223,35 @@ public abstract class FilterConfigPane extends JPanel {
public abstract String assembleFilter();
public void setFilters(List<String> selectedFilterNames) {
public void setFilters(List<WidgetFilterInfo> selectedFilters) {
reset = true;
filterList.clear();
setFilterList(selectedFilters);
reset = false;
}
private void setFilterList(List<WidgetFilterInfo> selectedFilters){
for (FilterCheckBox checkBox : checkBoxList) {
if (selectedFilterNames.contains(checkBox.getFilterInfo().getName())) {
String filterName = checkBox.getFilterInfo().getName();
WidgetFilterInfo selectFilterInfo = getSelectFilterInfoByName(selectedFilters, filterName);
if (selectFilterInfo == null) {
continue;
}
checkBox.setSelected(true);
filterList.add(checkBox.getFilterInfo());
if (selectFilterInfo.hasChildFilter()) {
setFilterList(selectFilterInfo.getInnerFilterInfo());
}
}
reset = false;
}
@Nullable
private WidgetFilterInfo getSelectFilterInfoByName(List<WidgetFilterInfo> selectedFilters, String name) {
for (WidgetFilterInfo filterInfo : selectedFilters) {
if (ComparatorUtils.equals(filterInfo.getName(), name)) {
return filterInfo;
}
}
return null;
}
public void reset() {

6
designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java

@ -206,11 +206,7 @@ public class FilterPane extends JPanel {
}
public void setFilter(List<WidgetFilterInfo> selectedFilters){
List<String> selectedFilterNames = new ArrayList<>();
for(WidgetFilterInfo filterInfo : selectedFilters){
selectedFilterNames.add(filterInfo.getName());
}
filterPopupPane.setFilters(selectedFilterNames);
filterPopupPane.setFilters(selectedFilters);
}
private void switchToNoFilter() {

5
designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.share.ui.widgetfilter;
import com.fr.design.mainframe.share.Bean.FilterTypeInfo;
import com.fr.design.mainframe.share.Bean.WidgetFilterInfo;
import javax.swing.event.ChangeEvent;
import java.util.List;
@ -19,8 +20,8 @@ public abstract class FilterPopupPane extends FilterConfigPane {
this.filterPane = filterPane;
}
public void setFilters(List<String> selectedFilterNames) {
super.setFilters(selectedFilterNames);
public void setFilters(List<WidgetFilterInfo> selectedFilters) {
super.setFilters(selectedFilters);
filterPane.changeFilterButtonStatus(hasFilter());
}

15
designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java

@ -172,9 +172,10 @@ public class OnlineShopUtils {
}
public static String assembleFilter(List<WidgetFilterInfo> filterInfos) {
List<WidgetFilterInfo> allFilterInfos = getAllFilterInfoList(filterInfos);
List<String> cidList = new ArrayList<>();
Map<String, String> queryParaMap = new HashMap<>();
for (WidgetFilterInfo filterInfo : filterInfos) {
for (WidgetFilterInfo filterInfo : allFilterInfos) {
if (ComparatorUtils.equals(CHART, filterInfo.getType())
|| ComparatorUtils.equals(REPORT, filterInfo.getType())) {
cidList.add(filterInfo.getType() + "-" + filterInfo.getId());
@ -206,6 +207,18 @@ public class OnlineShopUtils {
return StringUtils.join("&", queryCondition.toArray(new String[queryCondition.size()]));
}
private static List<WidgetFilterInfo> getAllFilterInfoList(List<WidgetFilterInfo> filterInfos) {
List<WidgetFilterInfo> allFilterList = new ArrayList<>();
for (WidgetFilterInfo filterInfo : filterInfos) {
if (filterInfo.hasChildFilter()) {
allFilterList.addAll(filterInfo.getInnerFilterInfo());
} else {
allFilterList.add(filterInfo);
}
}
return allFilterList;
}
public static boolean testConnection() {
HttpClient httpClient = new HttpClient(getTestConnectionUrl());
httpClient.asGet();

Loading…
Cancel
Save