Browse Source

Merge pull request #13972 in DESIGN/design from bugfix/11.0 to feature/x

* commit '21cb9bae0143cac92bdb98863d0ab6cdabfc11d4':
  REPORT-120151 feat: 添加 forkId 和相关埋点
feature/x
superman 6 months ago
parent
commit
e615e1df10
  1. 16
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

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

@ -6,6 +6,7 @@ import com.fr.base.extension.FileExtension;
import com.fr.base.info.TemplateSaveInfoContext;
import com.fr.base.io.BaseBook;
import com.fr.base.iofile.attr.DesignBanCopyAttrMark;
import com.fr.base.iofile.attr.ForkIdAttrMark;
import com.fr.base.iofile.attr.TemplateIdAttrMark;
import com.fr.base.iofile.attr.TemplateThemeAttrMark;
import com.fr.base.svg.IconUtils;
@ -343,6 +344,18 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
generateTemplateId();
}
/**
* 如果没有 forkId, 则计算 forkId
* 要求在 templateId, 创建后执行
*/
protected void computeForkIdIfAbsent() {
ForkIdAttrMark forkIdAttrMark = this.template.getAttrMark(ForkIdAttrMark.XML_TAG);
if (forkIdAttrMark == null || StringUtils.isEmpty(forkIdAttrMark.getForkId())) {
this.template.addAttrMark(new ForkIdAttrMark(this.template.getTemplateID()));
}
}
/**
* 收集图表信息
*/
@ -971,6 +984,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
}
// 在保存之前,初始化 templateID
generateNewTemplateIdForSaveAs();
computeForkIdIfAbsent();
this.editingFILE = editingFILE;
TemplateSaveInfoContext.getInstance().startCollect(template);
@ -1855,6 +1869,8 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
}
// 在保存之前,初始化 templateID
generateNewTemplateIdForSaveAs();
computeForkIdIfAbsent();
this.editingFILE = editingFILE;
boolean result = this.saveToNewRealFile(oldName);
if (result) {

Loading…
Cancel
Save