From b2b7dc484be22ca29231cd9ef4eba5a58ec5a7cf Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 17:05:20 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4ShareEmbedded?= =?UTF-8?q?Converter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../share/generate/task/ComponentCreator.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentCreator.java b/designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentCreator.java index ed1c2a91db..75f7def2d9 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentCreator.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentCreator.java @@ -5,13 +5,13 @@ import com.fr.base.iofile.attr.ExtendSharableAttrMark; import com.fr.base.iofile.attr.SharableAttrMark; import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateThemeConfig; +import com.fr.data.TableDataSource; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.share.generate.impl.AbstractComponentCreatorProcessor; import com.fr.form.main.Form; import com.fr.form.main.WidgetGatherAdapter; import com.fr.form.share.DefaultSharableWidget; -import com.fr.form.share.ShareEmbeddedConverter; import com.fr.form.share.bean.ComponentReuBean; import com.fr.form.share.editor.DefaultSharableEditor; import com.fr.form.share.editor.PlainSharableEditor; @@ -21,11 +21,14 @@ import com.fr.form.ui.Widget; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.stable.fun.IOFileAttrMark; -import com.fr.workspace.WorkContext; +import com.fr.workspace.server.entity.tabledata.PreviewSourceBean; +import com.fr.workspace.server.entity.tabledata.TableDataBean; +import com.fr.workspace.server.repository.tabledata.TableDataRepository; import org.jetbrains.annotations.NotNull; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; /** @@ -112,8 +115,7 @@ public class ComponentCreator extends AbstractComponentCreatorProcessor { //内置数据集 if (tpl != null) { - ShareEmbeddedConverter embeddedConverter = WorkContext.getCurrent().get(ShareEmbeddedConverter.class); - Map map = embeddedConverter.convertToEmbeddedTableData(tpl, paraMap); + Map map = convertToEmbeddedTableData(tpl, paraMap); Iterator> iterator = map.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = iterator.next(); @@ -123,6 +125,16 @@ public class ComponentCreator extends AbstractComponentCreatorProcessor { return tpl; } + private Map convertToEmbeddedTableData(TableDataSource tableDataSource, Map parameterMap) throws Exception { + PreviewSourceBean bean = new PreviewSourceBean(tableDataSource, StringUtils.EMPTY, parameterMap , -1, -1 ,new String[0], new int[0]); + List beanList = TableDataRepository.getInstance().convertToEmbeddedTableData(bean); + Map ans = new HashMap<>(); + for (TableDataBean tableDataBean : beanList) { + ans.put(tableDataBean.getName(), tableDataBean.getTableData()); + } + return ans; + } + @NotNull protected DefaultSharableEditor createSharableEditor(Form form, Map paraMap, Widget widget, DefaultSharableWidget info) {