流程属性Word导入日志改造

This commit is contained in:
anhc 2022-08-09 14:00:27 +08:00
parent c2cda37621
commit ccbebb1df3
2 changed files with 44 additions and 2 deletions

View File

@ -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.model.impl.PALRepositoryModelImpl;
import com.actionsoft.apps.coe.pal.pal.repository.util.CoeProcessLevelUtil; 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.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.apps.resource.plugin.profile.DCPluginProfile;
import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate; import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate;
import com.actionsoft.bpms.commons.mvc.view.ActionWeb; import com.actionsoft.bpms.commons.mvc.view.ActionWeb;
@ -171,10 +173,22 @@ public class DataMigrationWeb extends ActionWeb {
return ResponseObject.newErrResponse("资产库不存在或已停用").toString(); 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(()->{ new Thread(()->{
int success = 0; int success = 0;
int error = 0; int error = 0;
int index = 0;
for (File file : fileArr) { 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("\n[信息]流程属性Word文件" + file.getName());
wordLogUtil.appendAllLog("[信息]流程属性Word文件路径"+ file.getPath()); wordLogUtil.appendAllLog("[信息]流程属性Word文件路径"+ file.getPath());
wordLogUtil.appendAllLog("-----------流程属性Word文件 Begin " + UtilDate.datetimeFormat(startTime)); 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.updateLog(new Timestamp(System.currentTimeMillis()), Constant.LOG_RESULT_StATUS_ERROR, resultMsg);
wordLogUtil.appendAllAndInfoLog(resultMsg); wordLogUtil.appendAllAndInfoLog(resultMsg);
} }
LogRealTimeCountCache.getCache().remove(wordLogUtil.getLogId());
}).start(); }).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(); return ro.toString();
} }
@ -441,9 +461,9 @@ public class DataMigrationWeb extends ActionWeb {
//获取解析后的文件名称同名策略匹配pal寻找对应文件 //获取解析后的文件名称同名策略匹配pal寻找对应文件
String repositoryName = wordUtil.getFileName(); String repositoryName = wordUtil.getFileName();
PALRepositoryModel importModel = this.getRepositoryByName(wsId, repositoryName); PALRepositoryModel importModel = this.getRepositoryByArisName(wsId, repositoryName);
if (null == importModel) { if (null == importModel) {
return ResponseObject.newErrResponse("匹配pal文件异常找不到同名文件"); return ResponseObject.newErrResponse("匹配pal文件异常找不到同名ARIS流程文件");
} }
Map<String, WordField<Object>> fileFieldMap = wordUtil.getFileFieldMap(); Map<String, WordField<Object>> fileFieldMap = wordUtil.getFileFieldMap();
@ -761,6 +781,28 @@ public class DataMigrationWeb extends ActionWeb {
return null; return null;
} }
/**
* 根据aris 属性名称匹配资产库文件
* @param wsId
* @param repositoryName
* @return
*/
private PALRepositoryModel getRepositoryByArisName(String wsId, String repositoryName) {
List<PALRepositoryModel> palRepositoryModels = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getAllCoeProcessLevelByWsId(wsId);
for (PALRepositoryModel palRepositoryModel : palRepositoryModels) {
List<PALRepositoryPropertyModel> 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;
}
/** /**
* 去除文件名称中书名号 * 去除文件名称中书名号
* *