版本号导入更新支持各种模型
This commit is contained in:
parent
0a91b9ac54
commit
4a522847ed
Binary file not shown.
@ -30,6 +30,59 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class ProcessUtil {
|
||||
|
||||
/**
|
||||
* 获取根目录下文件分类
|
||||
* @param category
|
||||
* @param reverse false:获取结果key:methodId,value:methodName true:获取结果key:methodName,value:methodId
|
||||
* @return
|
||||
*/
|
||||
public static JSONObject getCategoryMethods(String category, boolean reverse) {
|
||||
JSONObject result = new JSONObject();
|
||||
if ("process".equals(category)) {
|
||||
result.put("default", "文件夹");
|
||||
}
|
||||
List<PALMethodModel> methodModels = PALMethodManager.getInstance().getPALMethodModelListByMethod(category);
|
||||
List<AppContext> listApps = AppsAPIManager.getInstance().getInstalledApps();
|
||||
int size = listApps.size();
|
||||
Map<String, String> map1 = new HashMap<String, String>();
|
||||
for (int i = 0; i < size; i++) {
|
||||
map1.put(listApps.get(i).getId(), listApps.get(i).getRuntimeState());
|
||||
}
|
||||
for (int i = 0, methodSize = methodModels.size(); i < methodSize; i++) {
|
||||
PALMethodModel palMethodModel = methodModels.get(i);
|
||||
String appId = palMethodModel.getId();
|
||||
if (map1.containsKey("com.actionsoft.apps.coe.method." + appId)) {
|
||||
String methodId1 = map1.get("com.actionsoft.apps.coe.method." + appId);
|
||||
if (methodId1.equals(AppsConst.RUNTIME_STATE_STOPPED) || methodId1.equals(AppsConst.RUNTIME_STATE_FAILED) || methodId1.equals(AppsConst.RUNTIME_STATE_READY) || methodId1.equals(AppsConst.RUNTIME_STATE_STARTING) || methodId1.equals(AppsConst.RUNTIME_STATE_STOPPING) || methodId1.equals(AppsConst.RUNTIME_STATE_UNINSTALLED) || methodId1.equals(AppsConst.RUNTIME_STATE_UNINSTALLING) || methodId1.equals(AppsConst.RUNTIME_STATE_FAILED))
|
||||
continue;
|
||||
}
|
||||
// 若是制度类型,过滤掉制度图
|
||||
if ("control".equals(category) && "control.policy".equals(palMethodModel.getId())) {
|
||||
continue;
|
||||
}
|
||||
result.put(palMethodModel.getId(), I18nRes.findValue(CoEConstant.APP_ID, palMethodModel.getId()));
|
||||
}
|
||||
if ("process".equals(category)) {// 伊利流程类型下增加表单图和制度图
|
||||
PALMethodModel palMethodModel = PALMethodManager.getInstance().getPALMethodModelById("control.policy");
|
||||
if (palMethodModel != null) {
|
||||
result.put(palMethodModel.getId(), I18nRes.findValue(CoEConstant.APP_ID, palMethodModel.getId()));
|
||||
}
|
||||
palMethodModel = PALMethodManager.getInstance().getPALMethodModelById("data.form");
|
||||
if (palMethodModel != null) {
|
||||
result.put(palMethodModel.getId(), I18nRes.findValue(CoEConstant.APP_ID, palMethodModel.getId()));
|
||||
}
|
||||
|
||||
}
|
||||
if (reverse) {// key value反转
|
||||
JSONObject reverseResult = new JSONObject();
|
||||
for (String key : result.keySet()) {
|
||||
reverseResult.put(result.getString(key), key);
|
||||
}
|
||||
return reverseResult;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流程下文件分类
|
||||
* @return
|
||||
@ -336,7 +389,6 @@ public class ProcessUtil {
|
||||
Iterator<PALRepositoryModel> iterator = PALRepositoryCache.getByWsId(wsId);
|
||||
List<PALRepositoryModel> list = new ArrayList<>();
|
||||
|
||||
// 过滤epc
|
||||
while (iterator.hasNext()) {
|
||||
PALRepositoryModel model = iterator.next();
|
||||
if (model.getMethodId().equals(methodId)) {
|
||||
|
||||
@ -20,10 +20,11 @@ public class VersionNoConstant {
|
||||
|
||||
// Excel标标题
|
||||
public final static String TABLE_PROCESS_NAME = "流程名称";
|
||||
public final static String TABLE_PROCESS_TYPE = "类型";
|
||||
public final static String TABLE_PROCESS_VERSION_NO = "版本号";
|
||||
|
||||
public final static String [] EXCEL_TITLE_ROW_ARR = new String [] {TABLE_PROCESS_NAME, TABLE_PROCESS_VERSION_NO};
|
||||
public final static String EXCEL_TITLE_ROW = TABLE_PROCESS_NAME+ "、" +TABLE_PROCESS_VERSION_NO;
|
||||
public final static String [] EXCEL_TITLE_ROW_ARR = new String [] {TABLE_PROCESS_TYPE, TABLE_PROCESS_NAME, TABLE_PROCESS_VERSION_NO};
|
||||
public final static String EXCEL_TITLE_ROW = TABLE_PROCESS_TYPE + "、" +TABLE_PROCESS_NAME+ "、" + TABLE_PROCESS_VERSION_NO;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ package com.actionsoft.apps.coe.pal.datamigration.versionNo.model;
|
||||
* Excel数据model
|
||||
*/
|
||||
public class VersionNoExcelModel {
|
||||
private String processType;// 模型类型(支持流程、表单、制度等其他类型)
|
||||
private String processName;// 流程名称
|
||||
private String processVersionNo;// 版本号
|
||||
|
||||
@ -22,4 +23,12 @@ public class VersionNoExcelModel {
|
||||
public void setProcessVersionNo(String processVersionNo) {
|
||||
this.processVersionNo = processVersionNo;
|
||||
}
|
||||
|
||||
public String getProcessType() {
|
||||
return processType;
|
||||
}
|
||||
|
||||
public void setProcessType(String processType) {
|
||||
this.processType = processType;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.actionsoft.apps.coe.pal.datamigration.versionNo.web;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.aris.constant.ArisConstant;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.constant.Constant;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.position.model.PalOrgPositionModel;
|
||||
@ -9,7 +10,9 @@ import com.actionsoft.apps.coe.pal.datamigration.util.LogUtil;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.util.StrUtil;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.versionNo.constant.VersionNoConstant;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.versionNo.model.VersionNoExcelModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryAttributeCache;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.dao.CoeProcessLevelDaoFacotory;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepository;
|
||||
@ -18,6 +21,7 @@ import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.cache.Design
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.dao.DesignerShapeRelationDao;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapeRelationModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryAttributeModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryPropertyModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.impl.PALRepositoryModelImpl;
|
||||
@ -29,6 +33,7 @@ import com.actionsoft.bpms.server.UserContext;
|
||||
import com.actionsoft.bpms.util.UUIDGener;
|
||||
import com.actionsoft.bpms.util.UtilDate;
|
||||
import com.actionsoft.bpms.util.UtilString;
|
||||
import com.actionsoft.i18n.I18nRes;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import sun.tools.jconsole.inspector.Utils;
|
||||
|
||||
@ -83,9 +88,9 @@ public class VersionNoExcelImportRun {
|
||||
/**
|
||||
* 执行导入
|
||||
* @param excelModelList
|
||||
* @param arisNameMap
|
||||
* @param palNameMap
|
||||
*/
|
||||
public void execute(List<VersionNoExcelModel> excelModelList, Map<String, String> arisNameMap) {
|
||||
public void execute(List<VersionNoExcelModel> excelModelList, Map<String, Map<String, String>> palNameMap) {
|
||||
DesignerShapeRelationDao relationDao = new DesignerShapeRelationDao();
|
||||
try {
|
||||
PALRepository repository = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
|
||||
@ -101,6 +106,7 @@ public class VersionNoExcelImportRun {
|
||||
|
||||
String processName = row.getProcessName();// Excel流程名称
|
||||
String versionNo = row.getProcessVersionNo();// Excel流程版本
|
||||
String processType = row.getProcessType();// Excel模型类型
|
||||
if (UtilString.isEmpty(processName)) {
|
||||
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第[" + importingCount + "]行" + VersionNoConstant.TABLE_PROCESS_NAME + "内容为空,忽略导入", simpleLogFile, fullLogFile, warnLogFile);
|
||||
LogUtil.appendLog("[Excel数据为空]Excel第[" + importingCount + "]行" + VersionNoConstant.TABLE_PROCESS_NAME + "内容为空,忽略导入", matchErrImportFile);
|
||||
@ -109,31 +115,35 @@ public class VersionNoExcelImportRun {
|
||||
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第[" + importingCount + "]行" + VersionNoConstant.TABLE_PROCESS_VERSION_NO + "内容为空,忽略导入", simpleLogFile, fullLogFile, warnLogFile);
|
||||
LogUtil.appendLog("[Excel数据为空]Excel第[" + importingCount + "]行" + VersionNoConstant.TABLE_PROCESS_VERSION_NO + "内容为空,忽略导入", matchErrImportFile);
|
||||
}
|
||||
if (UtilString.isEmpty(processType)) {
|
||||
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第[" + importingCount + "]行" + VersionNoConstant.TABLE_PROCESS_TYPE + "内容为空,忽略导入", simpleLogFile, fullLogFile, warnLogFile);
|
||||
LogUtil.appendLog("[Excel数据为空]Excel第[" + importingCount + "]行" + VersionNoConstant.TABLE_PROCESS_TYPE + "内容为空,忽略导入", matchErrImportFile);
|
||||
}
|
||||
|
||||
LogUtil.appendLog("\n" + Constant.LOG_START + "************[执行阶段][流程匹配阶段]PAL过程链图与Excel中流程进行匹配************", simpleLogFile, fullLogFile);
|
||||
// 校验pal是否存在该流程
|
||||
if (!arisNameMap.containsKey(processName)) {
|
||||
if (!palNameMap.get(processType).containsKey(processName)) {
|
||||
// Excel中的流程在PAL中不存在,当作警告处理,全部记录
|
||||
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第["+ importingCount + "]行流程" + "[" + processName + "]未在PAL中找到,忽略导入", simpleLogFile, fullLogFile, warnLogFile);
|
||||
LogUtil.appendLog("[流程未找到]Excel第[" + importingCount + "]行流程" + "[" + processName + "]未在PAL中找到,忽略导入", matchErrImportFile);
|
||||
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第["+ importingCount + "]行" + processType + "[" + processName + "]未在PAL中找到,忽略导入", simpleLogFile, fullLogFile, warnLogFile);
|
||||
LogUtil.appendLog("["+ processType +"未找到]Excel第[" + importingCount + "]行" + processType + "[" + processName + "]未在PAL中找到,忽略导入", matchErrImportFile);
|
||||
LogRealTimeCountCache.getCache().get(logId).setArisBlankCount(LogRealTimeCountCache.getCache().get(logId).getArisBlankCount() + 1);// 借用ArisBlankCount
|
||||
continue;
|
||||
}
|
||||
String palId = arisNameMap.get(processName);// pal流程id
|
||||
String palId = palNameMap.get(processType).get(processName);// pal流程id
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(palId);
|
||||
// 判断是否有多只流程
|
||||
// 判断是否有多只模型
|
||||
List<PALRepositoryModel> versionList = PALRepositoryCache.getByVersionId(model.getVersionId());
|
||||
if (versionList.size() > 1) {
|
||||
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第["+ importingCount + "]行流程" + "[" + processName + "]存在多版本,忽略导入", simpleLogFile, fullLogFile, warnLogFile);
|
||||
LogUtil.appendLog("[存在多版本]Excel第[" + importingCount + "]行流程" + "[" + processName + "]存在多版本,忽略导入", matchErrImportFile);
|
||||
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第["+ importingCount + "]行" + processType + "[" + processName + "]存在多版本,忽略导入", simpleLogFile, fullLogFile, warnLogFile);
|
||||
LogUtil.appendLog("[存在多版本]Excel第[" + importingCount + "]行" + processType + "[" + processName + "]存在多版本,忽略导入", matchErrImportFile);
|
||||
LogRealTimeCountCache.getCache().get(logId).setArisBlankCount(LogRealTimeCountCache.getCache().get(logId).getArisBlankCount() + 1);// 借用ArisBlankCount
|
||||
continue;
|
||||
}
|
||||
// 判断单只流程版本号是否为1.0
|
||||
double VerNo = model.getVersion();
|
||||
if (!"V1.0".equals(VersionUtil.getVersionStrV(model.getVersion()))) {
|
||||
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第["+ importingCount + "]行流程" + "[" + processName + "]版本号不是[V1.0],忽略导入", simpleLogFile, fullLogFile, warnLogFile);
|
||||
LogUtil.appendLog("[存在多版本]Excel第[" + importingCount + "]行流程" + "[" + processName + "]版本号不是[V1.0],忽略导入", matchErrImportFile);
|
||||
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第["+ importingCount + "]行" + processType + "[" + processName + "]版本号不是[V1.0],忽略导入", simpleLogFile, fullLogFile, warnLogFile);
|
||||
LogUtil.appendLog("[存在多版本]Excel第[" + importingCount + "]行" + processType + "[" + processName + "]版本号不是[V1.0],忽略导入", matchErrImportFile);
|
||||
LogRealTimeCountCache.getCache().get(logId).setArisBlankCount(LogRealTimeCountCache.getCache().get(logId).getArisBlankCount() + 1);// 借用ArisBlankCount
|
||||
continue;
|
||||
}
|
||||
@ -154,8 +164,8 @@ public class VersionNoExcelImportRun {
|
||||
verNo = Double.parseDouble(tmp);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第["+ importingCount + "]行流程" + "[" + processName + "]版本号不是[" + versionNo + "]转换数字类型失败,忽略导入", simpleLogFile, fullLogFile, warnLogFile);
|
||||
LogUtil.appendLog("[存在多版本]Excel第[" + importingCount + "]行流程" + "[" + processName + "]版本号不是[" + versionNo + "]转换数字类型失败,忽略导入", matchErrImportFile);
|
||||
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第["+ importingCount + "]行" + processType + "[" + processName + "]版本号不是[" + versionNo + "]转换数字类型失败,忽略导入", simpleLogFile, fullLogFile, warnLogFile);
|
||||
LogUtil.appendLog("[存在多版本]Excel第[" + importingCount + "]行" + processType + "[" + processName + "]版本号不是[" + versionNo + "]转换数字类型失败,忽略导入", matchErrImportFile);
|
||||
LogRealTimeCountCache.getCache().get(logId).setArisBlankCount(LogRealTimeCountCache.getCache().get(logId).getArisBlankCount() + 1);// 借用ArisBlankCount
|
||||
continue;
|
||||
}
|
||||
@ -166,54 +176,58 @@ public class VersionNoExcelImportRun {
|
||||
// 修改编号
|
||||
int result = repository.updateVerNo(model.getId(), verNo);
|
||||
if (result > 0) {
|
||||
LogUtil.appendLog(Constant.LOG_SUCCESS + "Excel第[" + importingCount + "]行流程[" + processName + "]版本号更新为["+ verNoStr +"]", simpleLogFile, fullLogFile);
|
||||
LogUtil.appendLog(Constant.LOG_SUCCESS + "Excel第[" + importingCount + "]行" + processType + "[" + processName + "]版本号更新为["+ verNoStr +"]", simpleLogFile, fullLogFile);
|
||||
} else {
|
||||
isSuccess = false;
|
||||
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第[" + importingCount + "]行流程[" + processName + "]版本号更新为["+ verNoStr +"],更新失败", simpleLogFile, fullLogFile, warnLogFile);
|
||||
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第[" + importingCount + "]行" + processType + "[" + processName + "]版本号更新为["+ verNoStr +"],更新失败", simpleLogFile, fullLogFile, warnLogFile);
|
||||
}
|
||||
|
||||
List<PALRepositoryPropertyModel> propertyModelList = propertyDao.getPropertysByPlid(model.getId(), Constant.METHOD_VERSION);
|
||||
if (propertyModelList == null || propertyModelList.size() == 0) {
|
||||
PALRepositoryPropertyModel propertyModel = new PALRepositoryPropertyModel();
|
||||
propertyModel.setId(UUIDGener.getUUID());
|
||||
propertyModel.setPlId(model.getId());
|
||||
propertyModel.setPropertyId(Constant.METHOD_VERSION);
|
||||
propertyModel.setPropertyName("版本");
|
||||
propertyModel.setPropertyValue(verNoStr);
|
||||
propertyModel.setOrderIndex(0);
|
||||
int n = propertyDao.insert(propertyModel);
|
||||
if (n > 0) {
|
||||
LogUtil.appendLog(Constant.LOG_SUCCESS + "Excel第[" + importingCount + "]行流程[" + processName + "]版本文件属性内容更新为["+ verNoStr +"]", simpleLogFile, fullLogFile);
|
||||
} else {
|
||||
isSuccess = false;
|
||||
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第[" + importingCount + "]行流程[" + processName + "]版本文件属性内容更新为["+ verNoStr +"],更新失败", simpleLogFile, fullLogFile, warnLogFile);
|
||||
}
|
||||
} else {
|
||||
for (PALRepositoryPropertyModel propertyModel : propertyModelList) {
|
||||
PALRepositoryAttributeModel attributeModel = PALRepositoryAttributeCache.getAttributeByMethodIdAndAttrId(model.getWsId(), model.getMethodId(), Constant.METHOD_VERSION);
|
||||
if (attributeModel != null) {
|
||||
List<PALRepositoryPropertyModel> propertyModelList = propertyDao.getPropertysByPlid(model.getId(), Constant.METHOD_VERSION);
|
||||
if (propertyModelList == null || propertyModelList.size() == 0) {
|
||||
PALRepositoryPropertyModel propertyModel = new PALRepositoryPropertyModel();
|
||||
propertyModel.setId(UUIDGener.getUUID());
|
||||
propertyModel.setPlId(model.getId());
|
||||
propertyModel.setPropertyId(Constant.METHOD_VERSION);
|
||||
propertyModel.setPropertyName("版本");
|
||||
propertyModel.setPropertyValue(verNoStr);
|
||||
int n = propertyDao.update(propertyModel);
|
||||
propertyModel.setOrderIndex(0);
|
||||
int n = propertyDao.insert(propertyModel);
|
||||
if (n > 0) {
|
||||
LogUtil.appendLog(Constant.LOG_SUCCESS + "Excel第[" + importingCount + "]行流程[" + processName + "]版本文件属性内容更新为["+ verNoStr +"]", simpleLogFile, fullLogFile);
|
||||
LogUtil.appendLog(Constant.LOG_SUCCESS + "Excel第[" + importingCount + "]行" + processType + "[" + processName + "]版本文件属性内容更新为["+ verNoStr +"]", simpleLogFile, fullLogFile);
|
||||
} else {
|
||||
isSuccess = false;
|
||||
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第[" + importingCount + "]行流程[" + processName + "]版本文件属性内容更新为["+ verNoStr +"],更新失败", simpleLogFile, fullLogFile, warnLogFile);
|
||||
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第[" + importingCount + "]行" + processType +"[" + processName + "]版本文件属性内容更新为["+ verNoStr +"],更新失败", simpleLogFile, fullLogFile, warnLogFile);
|
||||
}
|
||||
} else {
|
||||
for (PALRepositoryPropertyModel propertyModel : propertyModelList) {
|
||||
propertyModel.setPropertyValue(verNoStr);
|
||||
int n = propertyDao.update(propertyModel);
|
||||
if (n > 0) {
|
||||
LogUtil.appendLog(Constant.LOG_SUCCESS + "Excel第[" + importingCount + "]行" + processType + "[" + processName + "]版本文件属性内容更新为["+ verNoStr +"]", simpleLogFile, fullLogFile);
|
||||
} else {
|
||||
isSuccess = false;
|
||||
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第[" + importingCount + "]行" + processType +"[" + processName + "]版本文件属性内容更新为["+ verNoStr +"],更新失败", simpleLogFile, fullLogFile, warnLogFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LogUtil.appendLog(Constant.LOG_SUCCESS + "Excel第[" + importingCount + "]行" + processType + "[" + processName + "]没有文件属性[版本],导入忽略", simpleLogFile, fullLogFile);
|
||||
}
|
||||
|
||||
if (isSuccess) {
|
||||
// 记录流程导入结束日志
|
||||
LogRealTimeCountCache.getCache().get(logId).setSuccessCount(LogRealTimeCountCache.getCache().get(logId).getSuccessCount() + 1);
|
||||
LogUtil.appendLog(Constant.LOG_END + "[更新]Excel第[" + importingCount + "]行流程[" + processName + "]版本号[" + verNoStr + "]", simpleLogFile, fullLogFile, successLogFile);
|
||||
LogUtil.appendLog(Constant.LOG_END + "[更新]Excel第[" + importingCount + "]行" + processType + "[" + processName + "]版本号[" + verNoStr + "]", simpleLogFile, fullLogFile, successLogFile);
|
||||
} else {
|
||||
LogUtil.appendLog(Constant.LOG_WARNING + "[更新]Excel第[" + importingCount + "]行流程[" + processName + "]版本号[" + verNoStr + "]失败", simpleLogFile, fullLogFile, warnLogFile);
|
||||
LogUtil.appendLog(Constant.LOG_WARNING + "[更新]Excel第[" + importingCount + "]行" + processType +"[" + processName + "]版本号[" + verNoStr + "]失败", simpleLogFile, fullLogFile, warnLogFile);
|
||||
}
|
||||
}
|
||||
endTime = System.currentTimeMillis();
|
||||
Timestamp endDate = new Timestamp(endTime);
|
||||
LogRealTimeCountModel model = LogRealTimeCountCache.getCache().get(logId);
|
||||
String takeTimeText = takeTime(endTime, startTime);
|
||||
String resultMsg = "导入完成,总耗时" + takeTimeText + ",Excel流程总共[" + model.getTotalCount() + "],导入成功[" + model.getSuccessCount() + "]条,导入失败[" + (model.getTotalCount() - model.getSuccessCount()) + "]条";
|
||||
String resultMsg = "导入完成,总耗时" + takeTimeText + ",Excel模型总共[" + model.getTotalCount() + "],导入成功[" + model.getSuccessCount() + "]条,导入失败[" + (model.getTotalCount() - model.getSuccessCount()) + "]条";
|
||||
LogUtil.updateLog(logId, endDate, Constant.LOG_RESULT_StATUS_SUCCESS, resultMsg);
|
||||
LogUtil.appendLog("\n" + Constant.LOG_END + resultMsg, simpleLogFile, fullLogFile, warnLogFile);
|
||||
LogUtil.appendLog("\n" + "版本号Excel导入 End " + UtilDate.datetimeFormat(endDate), simpleLogFile, fullLogFile, warnLogFile);
|
||||
|
||||
@ -6,6 +6,8 @@ import com.actionsoft.apps.coe.pal.datamigration.log.model.LogModel;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.util.*;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.versionNo.constant.VersionNoConstant;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.versionNo.model.VersionNoExcelModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.method.cache.PALMethodCache;
|
||||
import com.actionsoft.apps.coe.pal.pal.method.extend.MethodAppManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodAttributeModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager;
|
||||
@ -251,20 +253,68 @@ public class VersionNoExcelImportWeb extends ActionWeb {
|
||||
ro.err("上传文件工作表中内容不能为空");
|
||||
return ro.toString();
|
||||
}
|
||||
// 校验aris流程名称是否重复
|
||||
Map<String, String> palNameMap = ProcessUtil.getPalRepositoryNameMap(wsId, Constant.PROCESS_EPC);// 获取流程以及流程的aris名称
|
||||
ResponseObject checkRepeatPalNameRo = checkRepositoryNameRepeat(palNameMap);
|
||||
if (!checkRepeatPalNameRo.isOk()) {
|
||||
msg = Constant.LOG_ERROR + checkRepeatPalNameRo.getMsg() + "," + Constant.IMPORT_STOP_MSG;
|
||||
|
||||
// 类型校验
|
||||
// 获取类型
|
||||
Map<String, String> map = new HashMap<>();
|
||||
List<String> categoryList = PALMethodCache.getPALMethodList();
|
||||
for (String category : categoryList) {
|
||||
JSONObject methodObj = ProcessUtil.getCategoryMethods(category, true);
|
||||
for (Map.Entry<String, Object> entry : methodObj.entrySet()) {
|
||||
map.put(entry.getKey(), String.valueOf(entry.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
List<String> errList = new ArrayList<>();
|
||||
for (VersionNoExcelModel model : excelModelList) {
|
||||
String processType = model.getProcessType();
|
||||
if (UtilString.isNotEmpty(processType)) {
|
||||
if (!errList.contains(processType) && !map.containsKey(processType)) {
|
||||
errList.add(processType);
|
||||
}
|
||||
}
|
||||
}
|
||||
List<String> rightMetodName = new ArrayList<>(map.keySet());
|
||||
Collections.sort(rightMetodName);
|
||||
if (errList.size() > 0) {
|
||||
msg = "上传文件工作表中" + VersionNoConstant.TABLE_PROCESS_TYPE + "内容错误,请填写" + StringUtils.join(rightMetodName, "、") + ",当前存在的错误内容:" + StringUtils.join(errList, "、");
|
||||
updateErrLog(msg, msg);
|
||||
ro.err(checkRepeatPalNameRo.getMsg());
|
||||
ro.err(msg);
|
||||
return ro.toString();
|
||||
}
|
||||
|
||||
// Aris流程名称与PALID反转
|
||||
Map<String, String> arisNameMap2 = new HashMap<>();
|
||||
for (Map.Entry<String, String> entry : palNameMap.entrySet()) {
|
||||
arisNameMap2.put(entry.getValue(), entry.getKey());
|
||||
// 按照Excel中的所有分类校验对应分类下PAL的模型名称是否重复
|
||||
Map<String, Map<String, String>> palNameMap = new HashMap<>();
|
||||
Set<String> methodSet = new HashSet<>();
|
||||
for (VersionNoExcelModel model : excelModelList) {
|
||||
String processType = model.getProcessType();
|
||||
if (UtilString.isNotEmpty(processType)) {
|
||||
if (map.containsKey(processType)) {
|
||||
methodSet.add(map.get(processType));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String methodId : methodSet) {
|
||||
Map<String, String> palNameMap2 = ProcessUtil.getPalRepositoryNameMap(wsId, methodId);// 获取模型以及模型的名称
|
||||
ResponseObject checkRepeatPalNameRo = checkRepositoryNameRepeat(palNameMap2, methodId);
|
||||
if (!checkRepeatPalNameRo.isOk()) {
|
||||
msg = Constant.LOG_ERROR + checkRepeatPalNameRo.getMsg() + "," + Constant.IMPORT_STOP_MSG;
|
||||
updateErrLog(msg, msg);
|
||||
ro.err(checkRepeatPalNameRo.getMsg());
|
||||
return ro.toString();
|
||||
}
|
||||
palNameMap.put(methodId, palNameMap2);
|
||||
}
|
||||
|
||||
// PAL模型名称与PALID反转
|
||||
Map<String, Map<String, String>> palNameMap4 = new HashMap<>();
|
||||
for (Map.Entry<String, Map<String, String>> entry : palNameMap.entrySet()) {
|
||||
Map<String, String> tmpMap = entry.getValue();
|
||||
Map<String, String> palNameMap3 = new HashMap<>();
|
||||
for (Map.Entry<String, String> entry2 : tmpMap.entrySet()) {
|
||||
palNameMap3.put(entry2.getValue(), entry2.getKey());
|
||||
}
|
||||
palNameMap4.put(I18nRes.findValue(CoEConstant.APP_ID, entry.getKey()), palNameMap3);
|
||||
}
|
||||
|
||||
int totalCount = excelModelList.size();
|
||||
@ -282,7 +332,7 @@ public class VersionNoExcelImportWeb extends ActionWeb {
|
||||
|
||||
LogUtil.appendLog("\n" + Constant.LOG_START + "预计导入[" + fileName + "]" + I18nRes.findValue(CoEConstant.APP_ID, Constant.PROCESS_EPC + ",共[" + totalCount + "]条流程"));
|
||||
// 开始执行导入
|
||||
new Thread(()->{new VersionNoExcelImportRun(_uc, wsId, logId, logPath, simpleLogFile, fullLogFile, warnLogFile, this.filePath, this.fileName, startTime).execute(excelModelList, arisNameMap2);}) .start();
|
||||
new Thread(()->{new VersionNoExcelImportRun(_uc, wsId, logId, logPath, simpleLogFile, fullLogFile, warnLogFile, this.filePath, this.fileName, startTime).execute(excelModelList, palNameMap4);}) .start();
|
||||
|
||||
ro.put("totalCount", totalCount);
|
||||
ro.put("importingCount", LogRealTimeCountCache.getCache().get(logId).getImportingCount());
|
||||
@ -294,7 +344,7 @@ public class VersionNoExcelImportWeb extends ActionWeb {
|
||||
* @param palNameMap
|
||||
* @return
|
||||
*/
|
||||
private ResponseObject checkRepositoryNameRepeat(Map<String, String> palNameMap) {
|
||||
private ResponseObject checkRepositoryNameRepeat(Map<String, String> palNameMap, String methodId) {
|
||||
boolean isOk = true;
|
||||
Map<String, List<String>> map = new HashMap<>();
|
||||
for (Map.Entry<String, String> entry : palNameMap.entrySet()) {
|
||||
@ -305,6 +355,7 @@ public class VersionNoExcelImportWeb extends ActionWeb {
|
||||
}
|
||||
map.get(name).add(palId);
|
||||
}
|
||||
String methodName = I18nRes.findValue(CoEConstant.APP_ID, methodId);
|
||||
for (Map.Entry<String, List<String>> entry : map.entrySet()) {
|
||||
List<String> idList = entry.getValue();
|
||||
String name = entry.getKey();
|
||||
@ -315,11 +366,12 @@ public class VersionNoExcelImportWeb extends ActionWeb {
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(palId);
|
||||
nameList.add(model.getName());
|
||||
}
|
||||
LogUtil.appendLog(Constant.LOG_ERROR + "同一PAL流程名称[" + name + "]对应多个PAL流程", simpleLogFile, fullLogFile, simpleLogFile, fullLogFile);
|
||||
|
||||
LogUtil.appendLog(Constant.LOG_ERROR + "同一PAL" + methodName + "名称[" + name + "]对应多个PAL"+ methodName +"", simpleLogFile, fullLogFile, simpleLogFile, fullLogFile);
|
||||
}
|
||||
}
|
||||
if (!isOk) {
|
||||
return ResponseObject.newErrResponse("存在同一PAL流程名称对应多个PAL流程,详情见日志");
|
||||
return ResponseObject.newErrResponse("存在同一PAL" + methodName + "名称对应多个PAL流程,详情见日志");
|
||||
}
|
||||
return ResponseObject.newOkResponse();
|
||||
}
|
||||
@ -334,11 +386,14 @@ public class VersionNoExcelImportWeb extends ActionWeb {
|
||||
for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
|
||||
Row row = sheet.getRow(i);
|
||||
VersionNoExcelModel rowModel = new VersionNoExcelModel();
|
||||
// 类型
|
||||
Cell cell0 = row.getCell(0);
|
||||
rowModel.setProcessType(POIUtil.getCellValueByCell(cell0));
|
||||
// 流程名称
|
||||
Cell cell1 = row.getCell(0);
|
||||
Cell cell1 = row.getCell(1);
|
||||
rowModel.setProcessName(POIUtil.getCellValueByCell(cell1));
|
||||
// 活动名称
|
||||
Cell cell2 = row.getCell(1);
|
||||
Cell cell2 = row.getCell(2);
|
||||
rowModel.setProcessVersionNo(POIUtil.getCellValueByCell(cell2));
|
||||
list.add(rowModel);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user