Aris流程数据迁移日志记录处理

This commit is contained in:
446052889@qq.com 2022-07-02 03:02:07 +08:00
parent d4935a629a
commit 7d9d5ed35d
9 changed files with 1680 additions and 1326 deletions

View File

@ -0,0 +1,16 @@
package com.actionsoft.apps.coe.pal.datamigration.aris.constant;
public class ArisConstant {
public final static String REPOSITORY_NAME = "arisXML";// aris xml文件导入dc根目录
public final static String UPFILE = "upfile";// aris xml文件上传根目录在REPOSITORY_NAME之下
public final static String LOG_GROUP_VALUE = "log";// aris xml文件导入日志根目录在REPOSITORY_NAME之下
public final static String IMPORT_LOG_FILE_SIMPLE = "simpleImport.log";// 简要日志展示给前端体现大致的导入内容和进度
public final static String IMPORT_LOG_FILE_FULL = "fullImport.log";// 详细日志包括全量信息内容
public final static String IMPORT_LOG_FILE_WARN = "warnErrImport.log";// 错误&警告日志单独记录错误&警告日志同时详细日志中也有记录
}

View File

@ -24,12 +24,12 @@ public class XMLUtil {
* @param fromFilePath
* @param toFilePath
*/
public static void unicode2String(String fromFilePath, String toFilePath) {
public static void unicode2String(String fromFilePath, String toFilePath) throws DocumentException, FileNotFoundException{
Document d = XMLUtil.readXML(fromFilePath, true);
XMLUtil.writeXml(d, toFilePath);
}
public static Document readXML(String filePath, boolean ignoreDtd) {
public static Document readXML(String filePath, boolean ignoreDtd) throws DocumentException, FileNotFoundException {
if (filePath == null) {
return null;
}
@ -60,16 +60,12 @@ public class XMLUtil {
return document;
} catch (DocumentException e) {
File fil = new File(filePath);
try {
document = reader.read(fil);
} catch (Exception e1) {
}
e.printStackTrace();
throw e;
} catch (Exception e) {
e.printStackTrace();
throw e;
}
return null;
}
public static Document readXMLFromInputStream(InputStream in) {

View File

@ -2,12 +2,15 @@ package com.actionsoft.apps.coe.pal.datamigration.aris.web;
import com.actionsoft.apps.coe.pal.datamigration.aris.mapping.ModelMappingAPIManager;
import com.actionsoft.apps.coe.pal.datamigration.aris.model.*;
import com.actionsoft.apps.coe.pal.datamigration.constant.Constant;
import com.actionsoft.apps.coe.pal.datamigration.util.LogUtil;
import com.actionsoft.bpms.util.UtilString;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.dom4j.Document;
import org.dom4j.Element;
import java.io.File;
import java.util.*;
/**
@ -29,22 +32,22 @@ public class ArisXmlHandleWeb {
public Map<String, Set<String>> objDefLinkerMap = new HashMap<>();// 记录所有定义形状的连线map记录
// 连线 todo
// 属性 todo
// 处理文档
public void handleXmlDoc(Document doc) {
// 获取根元素节点
Element root = doc.getRootElement();
String groupPath = "/";
getNodes(root, groupPath);
// 整合Model路径
calculateModelPath();
// 计算定义形状之间的连线
calculateObjDefLinker();
test();
public void handleXmlDoc(Document doc) throws Exception{
try {
// 获取根元素节点
Element root = doc.getRootElement();
String groupPath = "/";
getNodes(root, groupPath);
// 整合Model路径
calculateModelPath();
// 计算定义形状之间的连线
calculateObjDefLinker();
// test();
} catch (Exception e) {
e.printStackTrace();
}
}
/**

View File

@ -0,0 +1,26 @@
package com.actionsoft.apps.coe.pal.datamigration.cache;
import com.actionsoft.apps.resource.plugin.profile.CachePluginProfile;
import com.actionsoft.bpms.commons.cache.Cache;
import com.actionsoft.bpms.commons.cache.CacheManager;
/**
* 存储导入数据
* @author sunlh
*
*/
public class DataMigrationCache extends Cache<String, Integer>{
public DataMigrationCache(CachePluginProfile configuration) {
super(configuration);
}
@Override
protected void load() {
}
public static DataMigrationCache getCache() {
return CacheManager.getCache(DataMigrationCache.class);
}
}

View File

@ -61,9 +61,31 @@ public class Constant {
// 日志常量记录
public static final String LOG_SUCCESS = "成功";
public static final String LOG_WARNING = "警告";
public static final String LOG_ERROR = "错误";
public static final String LOG_SUCCESS = "【成功】";
public static final String LOG_WARNING = "【警告】";
public static final String LOG_ERROR = "【错误】";
// 日志表resultType字段常量codeß
public static final int LOG_RESULT_TYPE_RUN = 0;// 进行中
public static final int LOG_RESULT_TYPE_SUCCESS = 1;// 完成
public static final int LOG_RESULT_TYPE_ERROR = 2;// 失败
public static final String IMPORT_STOP_MSG = "导入停止";
public static final String PROCESS_EPC = "process.epc";
public static final String ORG_ROLE = "org.role";
public static final String ITSYSTEM_NORMAIL = "itsystem.normal";
public static final String METHOD_APPROVAL_NODE = "method_approval_node";// 线上审批
public static final String METHOD_SERVICE_NODE = "method_service_node";// 线下审批
public static final String METHOD_APPROVAL_NODE3 = "method_approval_node3";// 系统任务
public static final String METHOD_SERVICE_NODE4 = "method_service_node4";// 人工任务

View File

@ -1,5 +1,7 @@
package com.actionsoft.apps.coe.pal.datamigration.plugin;
import com.actionsoft.apps.coe.pal.datamigration.aris.constant.ArisConstant;
import com.actionsoft.apps.coe.pal.datamigration.cache.DataMigrationCache;
import com.actionsoft.apps.coe.pal.datamigration.web.DataMigrationWeb;
import com.actionsoft.apps.coe.pal.pal.repository.upfile.CoeFileProcessor;
import com.actionsoft.apps.listener.PluginListener;
@ -21,8 +23,11 @@ public class Plugins implements PluginListener {
public List<AWSPluginProfile> register(AppContext context) {
List<AWSPluginProfile> list = new ArrayList<AWSPluginProfile>();
// 注册缓存
list.add(new CachePluginProfile(DataMigrationCache.class));
list.add(new DCPluginProfile("migration", CoeFileProcessor.class.getName(), "存放数据迁移文件", false, false));
list.add(new DCPluginProfile(ArisConstant.REPOSITORY_NAME, CoeFileProcessor.class.getName(), "存在arisXML数据迁移日志", false, false));
// PAL应用扩展点
Map<String, Object> params0 = new HashMap<String, Object>();