端到端 关联模型中文件属性与形状属性带到总图中

This commit is contained in:
qinoy 2023-07-31 17:56:20 +08:00
parent 39d2f3158f
commit 184ee74f10
4 changed files with 132 additions and 40 deletions

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<attributes type="customer">
<attribute key="auditor" title="审核人" type="string" value="" desc="审核人" isRequired="false" ref="" readonly="false" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="reviewer" title="复核人" type="string" value="" desc="复核人" isRequired="false" ref="" readonly="false" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="approver" title="审批人" type="string" value="" desc="审批人" isRequired="false" ref="" readonly="false" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="application" title="适用范围" type="textarea" value="" desc="适用范围" isRequired="true" ref="" readonly="false" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="file_number" title="文件编码" type="string" value="" desc="文件编码" isRequired="false" ref="" readonly="false" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="Process_Architecture_L1" title="流程架构L1" type="string" value="" desc="流程架构L1" isRequired="true" ref="" readonly="false" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="Process_Architecture_L2" title="流程架构L2" type="string" value="" desc="流程架构l2" isRequired="true" ref="" readonly="false" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="Process_Architecture_L3" title="流程架构L3" type="string" value="" desc="流程架构L3" isRequired="true" ref="" readonly="false" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="ARIS" title="ARIS地址" type="textarea" value="" desc="ARIS地址" isRequired="false" ref="" readonly="false" groupPath="organization" scope="%,*" isValid="true"/>
<attribute key="P_versions" title="版本" type="string" value="" desc="版本" isRequired="true" ref="" readonly="false" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="Drafted_and_revised_by" title="拟制/修订人" type="string" value="" desc="拟制/修订人" isRequired="true" ref="" readonly="false" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="T_supplementary_articles" title="附则" type="textarea" value="" desc="附则" isRequired="false" ref="" readonly="false" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="goal" title="目的" type="textarea" value="" desc="目的" isRequired="true" ref="" readonly="false" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="activity_number" title="活动序号" type="string" value="" desc="活动序号" isRequired="false" ref="" readonly="false" groupPath="baseAttribute" scope="%,*" isValid="true"/>
<attribute key="Process_performance_metrics" title="流程绩效" type="relation" value="" desc="流程绩效" isRequired="false" ref="{&quot;method&quot;:&quot;control.kpi&quot;,&quot;type&quot;:&quot;shape&quot;,&quot;multiple&quot;:true}" readonly="true" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="activity_description" title="活动描述" type="textarea" value="" desc="活动描述" isRequired="true" ref="" readonly="false" groupPath="baseAttribute" scope="%,*" isValid="true"/>
<attribute key="output" title="输出" type="textarea" value="" desc="输出" isRequired="true" ref="" readonly="false" groupPath="baseAttribute" scope="%,*" isValid="true"/>
<attribute key="R_relevant_flies" title="相关文件" type="relation" value="" desc="相关文件" isRequired="false" ref="{&quot;method&quot;:&quot;process&quot;,&quot;type&quot;:&quot;file&quot;,&quot;multiple&quot;:true}" readonly="true" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="relevant_flies" title="相关知识" type="link" value="" desc="相关知识" isRequired="false" ref="" readonly="false" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="input" title="输入" type="textarea" value="" desc="输入" isRequired="false" ref="" readonly="false" groupPath="baseAttribute" scope="%,*" isValid="true"/>
<attribute key="relevant_demand" title="相关要求" type="relation" value="" desc="相关要求" isRequired="false" ref="{&quot;method&quot;:&quot;itsystem&quot;,&quot;type&quot;:&quot;shape&quot;,&quot;multiple&quot;:false}" readonly="true" groupPath="baseAttribute" scope="%,*" isValid="false"/>
<attribute key="post" title="岗位" type="relation" value="" desc="岗位" isRequired="false" ref="{&quot;method&quot;:&quot;org.normal&quot;,&quot;type&quot;:&quot;shapeAndFile&quot;,&quot;multiple&quot;:true}" readonly="true" groupPath="baseAttribute" scope="%,*" isValid="true"/>
<attribute key="role" title="角色" type="relation" value="" desc="角色" isRequired="false" ref="{&quot;method&quot;:&quot;org.role&quot;,&quot;type&quot;:&quot;shape&quot;,&quot;multiple&quot;:false}" readonly="true" groupPath="baseAttribute" scope="%,*" isValid="true"/>
<attribute key="term" title="术语" type="table" value="" desc="术语" isRequired="false" ref="{&quot;firstColumn&quot;:&quot;术语&quot;,&quot;secondColumn&quot;:&quot;定义&quot;}" readonly="false" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="information_systems" title="信息系统" type="relation" value="" desc="信息系统" isRequired="false" ref="{&quot;method&quot;:&quot;itsystem.normal&quot;,&quot;type&quot;:&quot;shape&quot;,&quot;multiple&quot;:true}" readonly="true" groupPath="baseAttribute" scope="%,*" isValid="true"/>
<attribute key="Organizational_role" title="组织/角色与职责" type="table" value="" desc="组织/角色与职责" isRequired="true" ref="{&quot;firstColumn&quot;:&quot;名称&quot;,&quot;secondColumn&quot;:&quot;职责&quot;}" readonly="false" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="Drafted_and_revised_date" title="拟制/修订日期" type="DateTimePicker" value="" desc="拟制/修订日期" isRequired="true" ref="" readonly="false" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="effective_date" title="生效日期" type="DateTimePicker" value="" desc="生效日期" isRequired="true" ref="" readonly="false" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="Issuing_department" title="发布部门" type="awsorg" value="" desc="发布部门" isRequired="true" ref="{&quot;scope&quot;:[&quot;department&quot;],&quot;multiple&quot;:false}" readonly="true" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="Process_owner" title="流程责任人" type="awsorg" value="" desc="流程责任人" isRequired="true" ref="{&quot;scope&quot;:[&quot;user&quot;],&quot;multiple&quot;:false}" readonly="true" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="isPublish" title="是否发布" type="string" value="" desc="是否发布" isRequired="false" ref="" readonly="false" groupPath="baseAttribute" scope="%,*" isValid="true"/>
<attribute key="ARIS_process_name" title="ARIS流程名称" type="string" value="" desc="ARIS流程名称" isRequired="false" ref="" readonly="false" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="lead_process" title="上游流程" type="relation" value="" desc="前置流程" isRequired="false" ref="{&quot;method&quot;:&quot;process&quot;,&quot;type&quot;:&quot;file&quot;,&quot;multiple&quot;:true}" readonly="true" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="rear_process" title="下游流程" type="relation" value="" desc="后置流程" isRequired="false" ref="{&quot;method&quot;:&quot;process&quot;,&quot;type&quot;:&quot;file&quot;,&quot;multiple&quot;:true}" readonly="true" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="support_files" title="支持文件" type="relation" value="" desc="支持文件" isRequired="false" ref="{&quot;method&quot;:&quot;process&quot;,&quot;type&quot;:&quot;file&quot;,&quot;multiple&quot;:true}" readonly="true" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="Contents_and_reasons_for_revision" title="修订内容及理由" type="textarea" value="" desc="修订内容及理由" isRequired="false" ref="" readonly="false" groupPath="process_model" scope="%,*" isValid="true"/>
<attribute key="child_process" title="子流程模型" type="relation" value="" desc="标识代表的是哪个子流程模型" isRequired="false" ref="{&quot;method&quot;:&quot;process&quot;,&quot;type&quot;:&quot;file&quot;,&quot;multiple&quot;:false}" readonly="true" groupPath="baseAttribute" scope="%,*" isValid="true"/>
<attribute key="relation_framework" title="关联架构" type="relation" value="" desc="子流程节点代表的模型文件的直接父级架构" isRequired="false" ref="{&quot;method&quot;:&quot;process&quot;,&quot;type&quot;:&quot;file&quot;,&quot;multiple&quot;:false}" readonly="true" groupPath="baseAttribute" scope="%,*" isValid="true"/>
</attributes>

View File

@ -12,6 +12,8 @@ import com.actionsoft.apps.coe.method.process.subprocess.observers.node.NodeSubj
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
import com.actionsoft.apps.coe.pal.pal.repository.designer.manage.CoeDesignerAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.designer.model.BaseModel;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.dao.DesignerShapeRelationDao;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapeRelationModel;
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.ShapeUtil;
import com.actionsoft.bpms.util.ConsolePrinter;
import com.actionsoft.bpms.util.UUIDGener;
@ -41,6 +43,8 @@ public class GraphNodeExpandHandle {
private double[] scopeLimitationShapeBeforePoi; // 范围选择框在子流程文件中的坐标
private final DesignerShapeRelationDao shapeRelationDao = new DesignerShapeRelationDao();
public GraphNodeExpandHandle(String repositoryId, String shapeId, String endToEndProcessDefineStr) throws AWSException{
this.repositoryId = repositoryId;
this.shapeId = shapeId;
@ -240,6 +244,25 @@ public class GraphNodeExpandHandle {
props.put("y", distanceY + props.getDoubleValue("y"));
ele.put("elementType", ElementType.INNER_NODE.name());
// 将关联模型中当前图形节点的形状属性 迁移到总图中作为当前节点的形状属性
List<DesignerShapeRelationModel> shapeRelationModels = shapeRelationDao.getModelListByFileId(relationFileId);
List<DesignerShapeRelationModel> relationModels = shapeRelationModels.stream()
.filter(model -> model.getShapeId().equals(key))
.map(model -> {
DesignerShapeRelationModel relationModel = new DesignerShapeRelationModel();
relationModel.setId(UUIDGener.getUUID());
relationModel.setFileId(repositoryId);
relationModel.setShapeId(key);
relationModel.setShapeText(ele.getString("text"));
relationModel.setAttrId(model.getAttrId());
relationModel.setRelationFileId(model.getRelationFileId());
relationModel.setRelationShapeId(model.getRelationShapeId());
relationModel.setRelationShapeText(model.getRelationShapeText());
return relationModel;
})
.collect(Collectors.toList());
shapeRelationDao.barchInsert(relationModels);
}
// 指向范围框

View File

@ -7,6 +7,7 @@ import com.actionsoft.apps.coe.pal.pal.method.PALMethodManager;
import com.actionsoft.apps.coe.pal.pal.method.cache.PALMethodCache;
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodAttributeModel;
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepositoryPropertyDao;
import com.actionsoft.apps.coe.pal.pal.repository.designer.CoeDesignerShapeAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.designer.manage.CoeDesignerAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.designer.model.BaseModel;
@ -15,6 +16,7 @@ import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.Design
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil;
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.ShapeUtil;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryPropertyModel;
import com.actionsoft.bpms.util.UUIDGener;
import com.actionsoft.exception.AWSException;
import com.alibaba.fastjson.JSONArray;
@ -31,6 +33,8 @@ public class GraphRender {
private Map<String, String> idMap;
private long zIndex;
private final DesignerShapeRelationDao shapeRelationDao = new DesignerShapeRelationDao();
private final PALRepositoryPropertyDao propertyDao = new PALRepositoryPropertyDao();
public GraphRender(PALRepositoryModel repositoryModel, List<Node> nodeList, double width, double height) {
this.repositoryModel = repositoryModel;
@ -64,7 +68,7 @@ public class GraphRender {
JSONObject defineJsonObj = JSONObject.parseObject(this.baseModel.getDefinition());
JSONObject elements = defineJsonObj.getJSONObject("elements");
for (int i = 0; i < nodeList.size(); i++) {
PALRepositoryModel repositoryModel = PALRepositoryCache.getCache().get(nodeList.get(i).getId());
PALRepositoryModel relationRepositoryModel = PALRepositoryCache.getCache().get(nodeList.get(i).getId());
JSONObject subProcessNode = ShapeUtil.getProcessShapeDefinition(SubProcessConst.SUB_PROCESS_METHOD_ID, "子流程");
String nodeId = UUIDGener.getObjectId();
subProcessNode.put("id", nodeId);
@ -74,65 +78,89 @@ public class GraphRender {
subProcessNodeProps.put("x", position[i][0]);
subProcessNodeProps.put("y", position[i][1]);
subProcessNodeProps.put("zindex", zIndex++);
subProcessNode.put("text", repositoryModel.getName());
subProcessNode.put("text", relationRepositoryModel.getName());
// 增加元素类型属性
subProcessNode.put("elementType", ElementType.OUTER_NODE.name());
// 增加关联文件的标识
JSONObject extendAttr = new JSONObject();
extendAttr.put("id", nodeList.get(i).getId());
extendAttr.put("name", repositoryModel.getName());
extendAttr.put("name", relationRepositoryModel.getName());
subProcessNode.put(SubProcessConst.EXTEND_ATTR, extendAttr);
// 处理子流程模型节点形状属性
JSONArray tempAttributesJsonArr = new JSONArray();
JSONArray dataAttributes = subProcessNode.getJSONArray("dataAttributes");
for (Object o : dataAttributes) {
JSONObject dataAttr = (JSONObject) o;
if (dataAttr.containsKey("attributesJsonArray")){
JSONArray attributesJsonArr = dataAttr.getJSONArray("attributesJsonArray");
List<PALMethodAttributeModel> attributes = PALMethodCache.getPALMethodModelById(SubProcessConst.SUB_PROCESS_METHOD_ID).getAttributes();
Optional<PALMethodAttributeModel> optional = attributes.stream().filter(attr -> attr.getKey().equals(SubProcessConst.CHILD_PROCESS)).findFirst();
if (!optional.isPresent())
throw new AWSException("端到端总图中子流程节点上需配置【子流程模型】形状属性");
PALMethodAttributeModel attributeModel = optional.get();
JSONObject data = new JSONObject();
data.put("isRequired", attributeModel.getIsRequired());
data.put("ref", attributeModel.getRef());
data.put("readonly", attributeModel.getReadonly());
data.put("scope", attributeModel.getScope());
data.put("name", attributeModel.getNewTitle());
data.put("id", attributeModel.getKey());
data.put("type", attributeModel.getType());
data.put("value", "");
data.put("groupPath", attributeModel.getGroupPath());
data.put("key", attributeModel.getKey());
data.put("desc", attributeModel.getDesc());
attributesJsonArr.add(data);
for (PALMethodAttributeModel attribute : attributes) {
JSONObject data = new JSONObject();
data.put("isRequired", attribute.getIsRequired());
data.put("ref", attribute.getRef());
data.put("readonly", attribute.getReadonly());
data.put("scope", attribute.getScope());
data.put("name", attribute.getNewTitle());
data.put("id", attribute.getKey());
data.put("type", attribute.getType());
data.put("value", "");
data.put("groupPath", attribute.getGroupPath());
data.put("key", attribute.getKey());
data.put("desc", attribute.getDesc());
PALMethodAttributeModel relaionFrameAttributeModel = attributes.stream().filter(attr -> attr.getKey().equals(SubProcessConst.RELATION_FRAMEWORK)).findFirst().orElse(null);
if (relaionFrameAttributeModel == null)
throw new AWSException("端到端总图中子流程节点上需配置【关联架构】形状属性");
JSONObject dataFrame = new JSONObject();
dataFrame.put("isRequired", relaionFrameAttributeModel.getIsRequired());
dataFrame.put("ref", relaionFrameAttributeModel.getRef());
dataFrame.put("readonly", relaionFrameAttributeModel.getReadonly());
dataFrame.put("scope", relaionFrameAttributeModel.getScope());
dataFrame.put("name", relaionFrameAttributeModel.getNewTitle());
dataFrame.put("id", relaionFrameAttributeModel.getKey());
dataFrame.put("type", relaionFrameAttributeModel.getType());
dataFrame.put("value", "");
dataFrame.put("groupPath", relaionFrameAttributeModel.getGroupPath());
dataFrame.put("key", relaionFrameAttributeModel.getKey());
dataFrame.put("desc", relaionFrameAttributeModel.getDesc());
attributesJsonArr.add(dataFrame);
// 当前子流程节点所关联的模型的文件属性 迁移过来作为当前子流程节点的形状属性
if ("relation".equals(attribute.getType()) || "awsorg".equals(attribute.getType())){
List<DesignerShapeRelationModel> shapeRelationModels = shapeRelationDao.getModelListByFileId(relationRepositoryModel.getId());
shapeRelationModels = shapeRelationModels.stream()
.filter(model -> model.getAttrId().equals(attribute.getKey()))
.map(model -> {
DesignerShapeRelationModel relationModel = new DesignerShapeRelationModel();
relationModel.setId(UUIDGener.getUUID());
relationModel.setFileId(repositoryModel.getId());
relationModel.setShapeId(nodeId);
relationModel.setShapeText(relationRepositoryModel.getName());
relationModel.setAttrId(attribute.getKey());
relationModel.setRelationFileId(model.getRelationFileId());
relationModel.setRelationShapeId(model.getRelationShapeId());
relationModel.setRelationShapeText(model.getRelationShapeText());
return relationModel;
}).collect(Collectors.toList());
shapeRelationDao.barchInsert(shapeRelationModels);
}else { // 非关联类型
List<PALRepositoryPropertyModel> propertys = propertyDao.getPropertysByPlid(relationRepositoryModel.getId(), attribute.getKey());
if (propertys.size() > 0){
PALRepositoryPropertyModel propertyModel = propertys.get(0);
if ("table".equals(attribute.getType())){
data.put("value", JSONObject.parseObject(propertyModel.getPropertyValue()));
}else {
data.put("value", propertyModel.getPropertyValue());
}
PALRepositoryPropertyModel tempModel = new PALRepositoryPropertyModel();
tempModel.setId(UUIDGener.getUUID());
tempModel.setPlId(repositoryModel.getId());
tempModel.setPropertyId(propertyModel.getPropertyId());
tempModel.setPropertyName(propertyModel.getPropertyName());
tempModel.setPropertyValue(propertyModel.getPropertyValue());
tempModel.setOrderIndex(propertyModel.getOrderIndex());
propertyDao.insert(tempModel);
}
}
attributesJsonArr.add(data);
tempAttributesJsonArr.add(data);
}
}
}
subProcessNode.put("attributesJsonArray", tempAttributesJsonArr);
// 处理总图中子流程节点的形状属性子流程模型
handleShapeAttrChildSubProcess(nodeId, repositoryModel.getName(), nodeList.get(i).getId(), SubProcessConst.CHILD_PROCESS);
handleShapeAttrChildSubProcess(nodeId, relationRepositoryModel.getName(), nodeList.get(i).getId(), SubProcessConst.CHILD_PROCESS);
// 处理总图中子流程节点的形状属性关联架构
if (repositoryModel.getParentId().length() == 36){
handleShapeAttrChildSubProcess(nodeId, repositoryModel.getName(), repositoryModel.getParentId(), SubProcessConst.RELATION_FRAMEWORK);
if (relationRepositoryModel.getParentId().length() == 36){
handleShapeAttrChildSubProcess(nodeId, relationRepositoryModel.getName(), relationRepositoryModel.getParentId(), SubProcessConst.RELATION_FRAMEWORK);
}
elements.put(nodeId, subProcessNode);
@ -143,7 +171,6 @@ public class GraphRender {
}
private void handleShapeAttrChildSubProcess(String shapeId, String shapeText, String relationFileId, String arrtId){
DesignerShapeRelationDao shapeRelationDao = new DesignerShapeRelationDao();
DesignerShapeRelationModel relationModel = new DesignerShapeRelationModel();
relationModel.setId(UUIDGener.getUUID());
relationModel.setFileId(repositoryModel.getId());