Browse Source

REPORT-75093 运营产品化二期

pr修改
feature/x
Link.Zhao 2 years ago
parent
commit
c220227d30
  1. 10
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/action/StartUseAction.java
  2. 13
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/model/TemplateResourceDetail.java
  3. 6
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/TemplateResourceDetailPane.java
  4. 30
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/helper/FineMarketClientHelper.java

10
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/action/StartUseAction.java

@ -6,6 +6,12 @@ import com.fr.design.utils.BrowseUtils;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
/**
* alphaFine - 模板资源 - 二级界面 - 开始使用按钮的绑定事件
*
* 点击后跳转至帆软市场下载对应模板资源
* */
public class StartUseAction implements ActionListener { public class StartUseAction implements ActionListener {
TemplateResourceDetail resourceDetail; TemplateResourceDetail resourceDetail;
@ -17,6 +23,10 @@ public class StartUseAction implements ActionListener {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
String url = FineMarketClientHelper.getInstance().getTemplateDownLoadUrl(resourceDetail.getRoot()); String url = FineMarketClientHelper.getInstance().getTemplateDownLoadUrl(resourceDetail.getRoot());
if (url == null) {
// 如果获取失败,跳转到所有模板页面
url = FineMarketClientHelper.getInstance().getFineMarketTemplateUrl();
}
BrowseUtils.browser(url); BrowseUtils.browser(url);
} }
} }

13
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/model/TemplateResourceDetail.java

@ -170,7 +170,7 @@ public class TemplateResourceDetail {
} }
// 3请求标签信息 // 3请求标签信息
detail.setTagsName(helper.getTemplateTagsByTemplateCids(detail.getTagsId())); detail.setTagsName(helper.getTemplateTagsByTemplateTagIds(detail.getTagsId()));
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage()); FineLoggerFactory.getLogger().error(e, e.getMessage());
} }
@ -178,6 +178,17 @@ public class TemplateResourceDetail {
return detail; return detail;
} }
/**
* 这里做下数据转换
* 原始数据是html标签写的如下
* "<ol style="list-style-type: decimal;" class=" list-paddingleft-2"><li><p>该模板需用10.0及以上版本设计器预览<br/></p></li><li><p>该模板为库存场景解决方案的部分内容,全部内容可下载<a href="https://market.fanruan.com/template/20000733" target="_self">库存场景解决方案</a>查看</p></li><li><p>为保障模板预览效果,建议安装<a href="https://help.fanruan.com/finereport10.0/doc-view-3665.html" target="_self">新自适应插件</a>(FR11.0版本插件已内置,无需手动安装),有使用需求或疑问,请联系帆软技术支持咨询<br/></p></li></ol>",
*
* 转换的后的数据 是原始数据中所有<p></p>标签内的包括标签的字符串List<String>,如上字符串会转为如下
* List [<p>该模板需用10.0及以上版本设计器预览<br/></p>,
* <p>该模板为库存场景解决方案的部分内容全部内容可下载<a href="https://market.fanruan.com/template/20000733" target="_self">库存场景解决方案</a>查看</p>,
* <p>为保障模板预览效果建议安装<a href="https://help.fanruan.com/finereport10.0/doc-view-3665.html" target="_self">新自适应插件</a>FR11.0版本插件已内置无需手动安装有使用需求或疑问请联系帆软技术支持咨询<br/></p>
* ]
* */
static final Pattern htmlPattern = Pattern.compile("<p>(.+?)</p>"); static final Pattern htmlPattern = Pattern.compile("<p>(.+?)</p>");
static List<String> parseDetailInfo(String htmlDetailInfo) { static List<String> parseDetailInfo(String htmlDetailInfo) {
List<String> infos = new ArrayList<>(); List<String> infos = new ArrayList<>();

6
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/TemplateResourceDetailPane.java

@ -47,8 +47,10 @@ public class TemplateResourceDetailPane extends JPanel {
private static final String TAGS = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Detail_Tags"); private static final String TAGS = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Detail_Tags");
private static final String PARENT_PACKAGE = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Detail_Parent_Package"); private static final String PARENT_PACKAGE = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Detail_Parent_Package");
private static final String DETAIL_INFO = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Detail_Info"); private static final String DETAIL_INFO = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Detail_Info");
private static final String FREE = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Detail_Price_Free");
private static final String SPACE = " "; private static final String SPACE = " ";
private static final String LF = "<br>"; private static final String LF = "<br>";
private static final String RMB = "¥";
public TemplateResourceDetailPane(TemplateResourceDetail detail) { public TemplateResourceDetailPane(TemplateResourceDetail detail) {
@ -90,9 +92,9 @@ public class TemplateResourceDetailPane extends JPanel {
emptyLabel.setPreferredSize(new Dimension(115, 25)); emptyLabel.setPreferredSize(new Dimension(115, 25));
JLabel priceLabel = new JLabel(); JLabel priceLabel = new JLabel();
if (data.getPrice() == 0) { if (data.getPrice() == 0) {
priceLabel.setText("免费"); priceLabel.setText(FREE);
} else { } else {
priceLabel.setText("$ " + data.getPrice()); priceLabel.setText(RMB + SPACE + data.getPrice());
} }
operatePane.add(createLinkLabel()); operatePane.add(createLinkLabel());

30
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/helper/FineMarketClientHelper.java

@ -37,12 +37,23 @@ public class FineMarketClientHelper {
private Map<String, String> tags; private Map<String, String> tags;
/**
* 获取模板的下载链接
* */
public String getTemplateDownLoadUrl(TemplateResource templateResource) { public String getTemplateDownLoadUrl(TemplateResource templateResource) {
String url = FINE_MARKET_TEMPLATE_INFO + FILE_DOWNLOAD; String url = FINE_MARKET_TEMPLATE_INFO + FILE_DOWNLOAD;
if (templateResource != null) { if (templateResource != null) {
url += templateResource.getId(); return url + templateResource.getId();
} else {
return null;
} }
return url; }
/**
* 获取帆软市场模板资源页面链接
* */
public String getFineMarketTemplateUrl() {
return FINE_MARKET_TEMPLATE_URL;
} }
public JSONObject getTemplateInfoById(String id) throws IOException { public JSONObject getTemplateInfoById(String id) throws IOException {
@ -87,14 +98,18 @@ public class FineMarketClientHelper {
} }
public List<String> getTemplateTagsByTemplateCids(String[] cids) throws IOException {
/**
* 根据模板资源的tagid获取tagName
* */
public List<String> getTemplateTagsByTemplateTagIds(String[] TagIds) throws IOException {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
initTags(); initTags();
if (cids != null) { if (TagIds != null) {
for (String cid : cids) { for (String tagId : TagIds) {
String tagName = tags.get(cid); String tagName = tags.get(tagId);
if (tagName != null) { if (tagName != null) {
list.add(tagName); list.add(tagName);
} }
@ -104,6 +119,9 @@ public class FineMarketClientHelper {
return list; return list;
} }
/**
* 请求帆软市场获取所有tag信息并构建tagid - tagname的map
* */
private void initTags() throws IOException { private void initTags() throws IOException {
tags = new HashMap<>(); tags = new HashMap<>();
String url = FINE_MARKET_TEMPLATE_INFO + TEMPLATES_TAGS; String url = FINE_MARKET_TEMPLATE_INFO + TEMPLATES_TAGS;

Loading…
Cancel
Save