Browse Source

REPORT-55241:添加报表引擎属性埋点

feature/x
fly.li 3 years ago
parent
commit
49784e833d
  1. 42
      designer-realize/src/main/java/com/fr/design/actions/report/ReportEngineAttrAction.java

42
designer-realize/src/main/java/com/fr/design/actions/report/ReportEngineAttrAction.java

@ -5,9 +5,15 @@ import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.WorkSheetDesigner; import com.fr.design.mainframe.WorkSheetDesigner;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.report.ReportEnginePane; import com.fr.design.report.ReportEnginePane;
import com.fr.intelli.record.FocusPoint;
import com.fr.intelli.record.MetricRegistry;
import com.fr.intelli.record.Original;
import com.fr.json.JSONObject;
import com.fr.report.stable.LayerReportAttr;
import com.fr.report.worksheet.WorkSheet; import com.fr.report.worksheet.WorkSheet;
public class ReportEngineAttrAction extends ReportComponentAction<WorkSheetDesigner> { public class ReportEngineAttrAction extends ReportComponentAction<WorkSheetDesigner> {
@ -19,7 +25,6 @@ public class ReportEngineAttrAction extends ReportComponentAction<WorkSheetDesig
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon("/com/fr/design/images/m_report/reportEngineAttr"); this.setSmallIcon("/com/fr/design/images/m_report/reportEngineAttr");
this.generateAndSetSearchText(ReportEnginePane.class.getName()); this.generateAndSetSearchText(ReportEnginePane.class.getName());
} }
private boolean isChange; private boolean isChange;
@ -43,7 +48,15 @@ public class ReportEngineAttrAction extends ReportComponentAction<WorkSheetDesig
@Override @Override
public void doOk() { public void doOk() {
isChange = true; isChange = true;
tplEC.setLayerReportAttr(layerReportEnginePane.updateBean()); LayerReportAttr originLayerReportAttr = tplEC.getLayerReportAttr();
LayerReportAttr layerReportAttr = layerReportEnginePane.updateBean();
//只有当前设置为新引擎时,才会提交埋点。
if (layerReportAttr.isClientPaging() && layerReportAttr.getEngineState() == LayerReportAttr.ENGINE_X){
if (layerReportAttr.isChanged(originLayerReportAttr)){
new ReportEngineMetricRecord().submit(layerReportAttr);
}
}
tplEC.setLayerReportAttr(layerReportAttr);
//设置新引擎后,需要刷新一下,计算属性设置入口是否显示,取决于是否设置了新引擎模式。 //设置新引擎后,需要刷新一下,计算属性设置入口是否显示,取决于是否设置了新引擎模式。
DesignerContext.getDesignerFrame().resetToolkitByPlus(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate()); DesignerContext.getDesignerFrame().resetToolkitByPlus(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate());
@ -53,4 +66,29 @@ public class ReportEngineAttrAction extends ReportComponentAction<WorkSheetDesig
return isChange; return isChange;
} }
/**
* 内部类
* */
class ReportEngineMetricRecord{
private final static String FOCUS_ID = "FR-F6011";
private void submit(LayerReportAttr layerReportAttr){
JSONObject body = new JSONObject();
body.put("totalPage", layerReportAttr.isPageQuery() ? 1 : 0);
body.put("pagesize", layerReportAttr.isPageQuery() ? layerReportAttr.getCountPerPage() : 0);
body.put("totalNum", layerReportAttr.isEnableRowCount() ? 1 : 0);
FocusPoint focusPoint = FocusPoint.newBuilder()
.id(FOCUS_ID)
.source(Original.EMBED)
.text(getPath())
.body(body.toString())
.build();
MetricRegistry.getMetric().submit(focusPoint);
}
private String getPath(){
JTemplate<?, ?> currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
return currentEditingTemplate.getPath();
}
}
} }

Loading…
Cancel
Save