关联文件时的处理

This commit is contained in:
446052889@qq.com 2022-09-27 09:55:06 +08:00
parent c274442117
commit 634bbf559b
2 changed files with 15 additions and 1 deletions

View File

@ -72,6 +72,7 @@ import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang.StringUtils;
public class DesignerRelationShapeWeb extends ActionWeb {
private UserContext _uc;
@ -1004,7 +1005,20 @@ public class DesignerRelationShapeWeb extends ActionWeb {
DesignerShapeRelationDao dao = new DesignerShapeRelationDao();
if ("file".equals(type)) {// 关联模型文件
Set<String> ids = new HashSet<>();// 之前代码会造成数据库出现多余数据过滤重复数据
List<DesignerShapeRelationModel> list = dao.getModelListByShapeIdAndRelationShapeId(ruuid, shapeId, null, relationFileIds);
List<String> versionIds = new ArrayList();
String [] arr = relationFileIds.split(",");
for (int i = 0; i < arr.length; i++) {
PALRepositoryModel model = PALRepositoryCache.getCache().get(arr[i]);
if (model != null) {
versionIds.add(model.getVersionId());
} else {
if (PALRepositoryCache.getByVersionId(arr[i]) != null && PALRepositoryCache.getByVersionId(arr[i]).size() > 0) {
versionIds.add(arr[i]);
}
}
}
String tmpStr = StringUtils.join(versionIds, ",");
List<DesignerShapeRelationModel> list = dao.getModelListByShapeIdAndRelationShapeId(ruuid, shapeId, null, tmpStr);
for (DesignerShapeRelationModel model : list) {
if (ids.contains(model.getRelationFileId())) {
continue;