代码调整

This commit is contained in:
zhal 2022-07-20 13:52:59 +08:00
parent cab618f799
commit ae797ea4ee

View File

@ -3031,25 +3031,38 @@ public class CoeDesignerWeb extends ActionWeb {
JSONObject relationShapeIds = new JSONObject();
JSONObject relationShapeModels = new JSONObject();
List<Map<String, Object>> elements = CoeDesignerUtil.getShapeMessageJson(plModel.getId());
if (elements != null && elements.size() > 0) {
for (Map<String, Object> element : elements) {
String elementId = element.containsKey("id") ? element.get("id").toString() : "";
if (!UtilString.isEmpty(elementId)) {
Iterator<DesignerShapeRelationModel> modelIterator = DesignerShapeRelationCache.getByShapeId(plModel.getId(), elementId);
String define = PALRepositoryQueryAPIManager.getInstance().getProcessDefinition(_uc, plModel.getId());
JSONObject definition = JSONObject.parseObject(define);
JSONObject elements = definition.getJSONObject("elements");
for (String id: elements.keySet()) {
JSONObject shapeObj = elements.getJSONObject(id);
String name = shapeObj.getString("name");
if ("linker".equals(name)) {
continue;
}
Iterator<DesignerShapeRelationModel> modelIterator = DesignerShapeRelationCache.getByShapeId(plModel.getId(), id);
if (modelIterator != null) {
while (modelIterator.hasNext()) {
DesignerShapeRelationModel shapeRelationModel = modelIterator.next();
PALRepositoryModel relationPalModel = PALRepositoryCache.getCache().get(shapeRelationModel.getRelationFileId());
if (relationPalModel != null) {
relationShapeIds.put(shapeRelationModel.getRelationShapeId(), shapeRelationModel);
relationShapeModels.put(shapeRelationModel.getShapeId() + "_" + shapeRelationModel.getAttrId(), shapeRelationModel.getRelationShapeText());
}
}
}
}
Map<String, JSONObject> map = PALRepositoryQueryAPIManager.getInstance().queryRepositoryShapeAttributeById(plModel.getId(), id, shapeObj, "|");
for (Entry<String, JSONObject> entry : map.entrySet()) {
JSONObject object = entry.getValue();
if (object == null || object.isEmpty()) {
continue;
}
relationShapeModels.put(id + "_" + entry.getKey(), Arrays.asList(object.getString("text").split("\\|")));
}
}
macroLibraries.put("relationShapes", relationShapeIds);
macroLibraries.put("relationShapeModels", relationShapeModels);