研发需求问题记录表,006,流程清单中关于pllevel内容,重新计算真实level,避免直接取pllevel导致数据错误引起的结果出错

This commit is contained in:
446052889@qq.com 2025-01-03 17:08:05 +08:00
parent 48398c335a
commit a111afae43
4 changed files with 53 additions and 2 deletions

View File

@ -50,6 +50,7 @@ public class ExportAPIManager {
try { try {
exportDao.insert(exportModel); exportDao.insert(exportModel);
} catch (AWSDataAccessException e) { } catch (AWSDataAccessException e) {
e.printStackTrace();
return null; return null;
} }
// 加入缓存 // 加入缓存

View File

@ -11,6 +11,7 @@ import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.cache.Design
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapeRelationModel; import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapeRelationModel;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel; 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.PALRepositoryPropertyModel;
import com.actionsoft.apps.coe.pal.pal.repository.model.impl.PALRepositoryModelImpl;
import com.actionsoft.bpms.commons.login.constant.LoginConst; import com.actionsoft.bpms.commons.login.constant.LoginConst;
import com.actionsoft.bpms.org.model.DepartmentModel; import com.actionsoft.bpms.org.model.DepartmentModel;
import com.actionsoft.bpms.org.model.RoleModel; import com.actionsoft.bpms.org.model.RoleModel;
@ -177,4 +178,46 @@ public class ProcessListUtil {
} }
return result; return result;
} }
/**
* 获取模型数据的真实层级level RepositoryModel
* @param model
* @return
*/
public static PALRepositoryModel getRealLevelRepository(PALRepositoryModel model) {
PALRepositoryModelImpl newModel = null;
try {
newModel = ((PALRepositoryModelImpl) model).clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
if (newModel != null) {
Set<String> pids = new HashSet<>();
int level = 1;
StringBuilder sBuilder = new StringBuilder();
String pid = newModel.getParentId();
while (pid.length() >= 36 && !pids.contains(pid)) {
pids.add(pid);
PALRepositoryModel parentModel = PALRepositoryCache.getCache().get(pid);
if (parentModel == null) {
List<PALRepositoryModel> versionList = PALRepositoryCache.getByVersionId(model.getWsId(), pid);
if (versionList != null && versionList.size() > 0) {
for (PALRepositoryModel m : versionList) {
if (m.isUse()) {
parentModel = m;
break;
}
}
}
}
if (parentModel != null) {
level++;
pid = parentModel.getParentId();
}
}
newModel.setLevel(level);
}
return newModel;
}
} }

View File

@ -137,6 +137,7 @@ public class PALRepositoryListWeb extends ActionWeb {
int maxLevel = 0; int maxLevel = 0;
while (iterator.hasNext()) { while (iterator.hasNext()) {
PALRepositoryModel next = iterator.next(); PALRepositoryModel next = iterator.next();
PALRepositoryModel model = ProcessListUtil.getRealLevelRepository(next);
if (!UtilString.isEmpty(category)) { if (!UtilString.isEmpty(category)) {
if (!category.equals(next.getMethodCategory())) { if (!category.equals(next.getMethodCategory())) {
continue; continue;
@ -147,8 +148,8 @@ public class PALRepositoryListWeb extends ActionWeb {
continue; continue;
} }
} }
if (next.getLevel() > maxLevel) { if (model.getLevel() > maxLevel) {
maxLevel = next.getLevel(); maxLevel = model.getLevel();
} }
} }
JSONArray result = new JSONArray(); JSONArray result = new JSONArray();
@ -641,6 +642,12 @@ public class PALRepositoryListWeb extends ActionWeb {
List<PALRepositoryModel> palList = new ArrayList<>(); List<PALRepositoryModel> palList = new ArrayList<>();
Set<String> ids = new HashSet<>(); Set<String> ids = new HashSet<>();
PALRepositoryCache.getAllChildrenModelsByPid(wsId, category, palList, ids); PALRepositoryCache.getAllChildrenModelsByPid(wsId, category, palList, ids);
// 重新设置pllevel
for (int i = 0; i < palList.size(); i++) {
palList.set(i, ProcessListUtil.getRealLevelRepository(palList.get(i)));
}
// 获取所有正在设计中的 // 获取所有正在设计中的
List<PALRepositoryModel> tmpPalList = new ArrayList<>(); List<PALRepositoryModel> tmpPalList = new ArrayList<>();
Set<String> levelSet = new HashSet<>(); Set<String> levelSet = new HashSet<>();