|
|
@ -15,9 +15,7 @@ import org.json.JSONObject; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.*; |
|
|
|
import java.io.*; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.*; |
|
|
|
import java.util.Calendar; |
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 做模板的过程和耗时收集,辅助类 |
|
|
|
* 做模板的过程和耗时收集,辅助类 |
|
|
@ -27,6 +25,7 @@ public class TemplateInfoCollector<T extends IOFile> implements Serializable { |
|
|
|
private static final String FILE_NAME = "tplInfo.ser"; |
|
|
|
private static final String FILE_NAME = "tplInfo.ser"; |
|
|
|
private static TemplateInfoCollector instance; |
|
|
|
private static TemplateInfoCollector instance; |
|
|
|
private HashMap<String, HashMap<String, Object>> templateInfoList; |
|
|
|
private HashMap<String, HashMap<String, Object>> templateInfoList; |
|
|
|
|
|
|
|
private Set<String> removedTemplates; // 已经从 templateInfoList 中删除过的 id 列表,防止重复收集数据
|
|
|
|
private String designerOpenDate; //设计器最近一次打开日期
|
|
|
|
private String designerOpenDate; //设计器最近一次打开日期
|
|
|
|
private static final int VALID_CELL_COUNT = 5; // 有效报表模板的格子数
|
|
|
|
private static final int VALID_CELL_COUNT = 5; // 有效报表模板的格子数
|
|
|
|
private static final int VALID_WIDGET_COUNT = 5; // 有效报表模板的控件数
|
|
|
|
private static final int VALID_WIDGET_COUNT = 5; // 有效报表模板的控件数
|
|
|
@ -36,6 +35,7 @@ public class TemplateInfoCollector<T extends IOFile> implements Serializable { |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
private TemplateInfoCollector() { |
|
|
|
private TemplateInfoCollector() { |
|
|
|
templateInfoList = new HashMap<>(); |
|
|
|
templateInfoList = new HashMap<>(); |
|
|
|
|
|
|
|
removedTemplates = new ListSet<>(); |
|
|
|
setDesignerOpenDate(); |
|
|
|
setDesignerOpenDate(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -77,12 +77,15 @@ public class TemplateInfoCollector<T extends IOFile> implements Serializable { |
|
|
|
return instance; |
|
|
|
return instance; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static boolean shouldCollectInfo() { |
|
|
|
private boolean shouldCollectInfo(T t) { |
|
|
|
|
|
|
|
if (t.getTemplateID() == null || instance.removedTemplates.contains(t.getTemplateID())) { // 旧模板
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
return DesignerEnvManager.getEnvManager().isJoinProductImprove() && FRContext.isChineseEnv(); |
|
|
|
return DesignerEnvManager.getEnvManager().isJoinProductImprove() && FRContext.isChineseEnv(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void appendProcess(String log) { |
|
|
|
public void appendProcess(T t, String log) { |
|
|
|
if (!shouldCollectInfo()) { |
|
|
|
if (!shouldCollectInfo(t)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
// 获取当前编辑的模板
|
|
|
|
// 获取当前编辑的模板
|
|
|
@ -148,7 +151,7 @@ public class TemplateInfoCollector<T extends IOFile> implements Serializable { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
public void collectInfo(T t, JTemplate jt, long openTime, long saveTime) { |
|
|
|
public void collectInfo(T t, JTemplate jt, long openTime, long saveTime) { |
|
|
|
if (!shouldCollectInfo()) { |
|
|
|
if (!shouldCollectInfo(t)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -232,7 +235,7 @@ public class TemplateInfoCollector<T extends IOFile> implements Serializable { |
|
|
|
if (sendSingleTemplateInfo(consumingUrl, jsonConsumingMap) && sendSingleTemplateInfo(processUrl, jsonProcessMap)) { |
|
|
|
if (sendSingleTemplateInfo(consumingUrl, jsonConsumingMap) && sendSingleTemplateInfo(processUrl, jsonProcessMap)) { |
|
|
|
// 清空记录
|
|
|
|
// 清空记录
|
|
|
|
FRLogger.getLogger().info("successfully send " + templateInfo.get("templateID")); |
|
|
|
FRLogger.getLogger().info("successfully send " + templateInfo.get("templateID")); |
|
|
|
templateInfoList.remove(templateInfo.get("templateID")); |
|
|
|
removeFromTemplateInfoList(templateInfo.get("templateID")); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
saveInfo(); |
|
|
|
saveInfo(); |
|
|
@ -284,12 +287,18 @@ public class TemplateInfoCollector<T extends IOFile> implements Serializable { |
|
|
|
} |
|
|
|
} |
|
|
|
// 删除测试模板
|
|
|
|
// 删除测试模板
|
|
|
|
for (String key : testTemplateKeys) { |
|
|
|
for (String key : testTemplateKeys) { |
|
|
|
templateInfoList.remove(key); |
|
|
|
removeFromTemplateInfoList(key); |
|
|
|
// System.out.println(key + " is removed...");
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return completeTemplatesInfo; |
|
|
|
return completeTemplatesInfo; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void removeFromTemplateInfoList(String key) { |
|
|
|
|
|
|
|
templateInfoList.remove(key); |
|
|
|
|
|
|
|
removedTemplates.add(key); |
|
|
|
|
|
|
|
FRLogger.getLogger().info(key + " is removed..."); |
|
|
|
|
|
|
|
FRLogger.getLogger().info("removedTemplates: " + removedTemplates); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
private boolean isTestTemplate(HashMap<String, Object> templateInfo) { |
|
|
|
private boolean isTestTemplate(HashMap<String, Object> templateInfo) { |
|
|
|
HashMap<String, Object> processMap = (HashMap<String, Object>) templateInfo.get("processMap"); |
|
|
|
HashMap<String, Object> processMap = (HashMap<String, Object>) templateInfo.get("processMap"); |
|
|
|