diff --git a/com.actionsoft.apps.coe.pal.datamigration/lib/com.actionsoft.apps.coe.pal.datamigration.jar b/com.actionsoft.apps.coe.pal.datamigration/lib/com.actionsoft.apps.coe.pal.datamigration.jar index 9d5d2954..9bda8699 100644 Binary files a/com.actionsoft.apps.coe.pal.datamigration/lib/com.actionsoft.apps.coe.pal.datamigration.jar and b/com.actionsoft.apps.coe.pal.datamigration/lib/com.actionsoft.apps.coe.pal.datamigration.jar differ diff --git a/com.actionsoft.apps.coe.pal.datamigration/src/com/actionsoft/apps/coe/pal/datamigration/web/DataMigrationWeb.java b/com.actionsoft.apps.coe.pal.datamigration/src/com/actionsoft/apps/coe/pal/datamigration/web/DataMigrationWeb.java index 9acf709b..7e4b8f0a 100644 --- a/com.actionsoft.apps.coe.pal.datamigration/src/com/actionsoft/apps/coe/pal/datamigration/web/DataMigrationWeb.java +++ b/com.actionsoft.apps.coe.pal.datamigration/src/com/actionsoft/apps/coe/pal/datamigration/web/DataMigrationWeb.java @@ -37,6 +37,8 @@ import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryPropertyMod import com.actionsoft.apps.coe.pal.pal.repository.model.impl.PALRepositoryModelImpl; import com.actionsoft.apps.coe.pal.pal.repository.util.CoeProcessLevelUtil; import com.actionsoft.apps.coe.pal.pal.repository.util.CoeRepositoryImportUtil; +import com.actionsoft.apps.coe.pal.yili.log.datamigration.log.Cache.LogRealTimeCountCache; +import com.actionsoft.apps.coe.pal.yili.log.datamigration.log.Model.LogRealTimeCountModel; import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile; import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate; import com.actionsoft.bpms.commons.mvc.view.ActionWeb; @@ -171,10 +173,22 @@ public class DataMigrationWeb extends ActionWeb { return ResponseObject.newErrResponse("资产库不存在或已停用").toString(); } + //导入进度计算 + LogRealTimeCountModel countModel = new LogRealTimeCountModel(); + countModel.setTotalCount(fileArr.length); + countModel.setSuccessCount(0); + countModel.setImportingCount(0); + + LogRealTimeCountCache.getCache().put(wordLogUtil.getLogId(), countModel, true); + new Thread(()->{ int success = 0; int error = 0; + int index = 0; for (File file : fileArr) { + + LogRealTimeCountCache.getCache().get(wordLogUtil.getLogId()).setImportingCount(index++);// 当前记录缓存 + wordLogUtil.appendAllLog("\n************[执行进度]当前执行第[" + index + "]条,共["+ fileArr.length +"]条************"); wordLogUtil.appendAllLog("\n[信息]流程属性Word文件:" + file.getName()); wordLogUtil.appendAllLog("[信息]流程属性Word文件路径:"+ file.getPath()); wordLogUtil.appendAllLog("-----------流程属性Word文件 Begin " + UtilDate.datetimeFormat(startTime)); @@ -198,8 +212,14 @@ public class DataMigrationWeb extends ActionWeb { wordLogUtil.updateLog(new Timestamp(System.currentTimeMillis()), Constant.LOG_RESULT_StATUS_ERROR, resultMsg); wordLogUtil.appendAllAndInfoLog(resultMsg); } + LogRealTimeCountCache.getCache().remove(wordLogUtil.getLogId()); }).start(); + ro.put("logId", wordLogUtil.getLogId()); + ro.put("path", wordLogUtil.getLogPath()); + ro.put("resultStatus", wordLogUtil.getLogResultStatus()); + ro.put("totalCount", fileArr.length); + ro.put("importingCount", LogRealTimeCountCache.getCache().get(wordLogUtil.getLogId()).getImportingCount()); return ro.toString(); } @@ -441,9 +461,9 @@ public class DataMigrationWeb extends ActionWeb { //获取解析后的文件名称,同名策略匹配pal寻找对应文件 String repositoryName = wordUtil.getFileName(); - PALRepositoryModel importModel = this.getRepositoryByName(wsId, repositoryName); + PALRepositoryModel importModel = this.getRepositoryByArisName(wsId, repositoryName); if (null == importModel) { - return ResponseObject.newErrResponse("匹配pal文件异常,找不到同名文件"); + return ResponseObject.newErrResponse("匹配pal文件异常,找不到同名ARIS流程文件"); } Map> fileFieldMap = wordUtil.getFileFieldMap(); @@ -761,6 +781,28 @@ public class DataMigrationWeb extends ActionWeb { return null; } + /** + * 根据aris 属性名称匹配资产库文件 + * @param wsId + * @param repositoryName + * @return + */ + private PALRepositoryModel getRepositoryByArisName(String wsId, String repositoryName) { + List palRepositoryModels = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getAllCoeProcessLevelByWsId(wsId); + for (PALRepositoryModel palRepositoryModel : palRepositoryModels) { + List propertys = new PALRepositoryPropertyDao().getPropertysByPlid(palRepositoryModel.getId(), "ARIS_process_name"); + if (propertys.isEmpty()){ + return null; + } + for (PALRepositoryPropertyModel property : propertys) { + if (palRepositoryModel.isUse() && property.getPropertyValue().equals(repositoryName)) { + return palRepositoryModel; + } + } + } + return null; + } + /** * 去除文件名称中书名号 *