代码开发
This commit is contained in:
parent
bedb5065d4
commit
cadd5ca3d9
@ -0,0 +1,155 @@
|
||||
package cn.axzo.server.repository.dataobject;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class BpmBaseDO implements Serializable {
|
||||
@TableField(
|
||||
fill = FieldFill.INSERT
|
||||
)
|
||||
private Date createTime;
|
||||
@TableField(
|
||||
fill = FieldFill.INSERT_UPDATE
|
||||
)
|
||||
private Date updateTime;
|
||||
@TableField(
|
||||
fill = FieldFill.INSERT
|
||||
)
|
||||
private String creator;
|
||||
@TableField(
|
||||
fill = FieldFill.INSERT_UPDATE
|
||||
)
|
||||
private String updater;
|
||||
@TableLogic
|
||||
private Boolean deleted;
|
||||
|
||||
public BpmBaseDO() {
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return this.createTime;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return this.updateTime;
|
||||
}
|
||||
|
||||
public String getCreator() {
|
||||
return this.creator;
|
||||
}
|
||||
|
||||
public String getUpdater() {
|
||||
return this.updater;
|
||||
}
|
||||
|
||||
public Boolean getDeleted() {
|
||||
return this.deleted;
|
||||
}
|
||||
|
||||
public BpmBaseDO setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BpmBaseDO setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BpmBaseDO setCreator(String creator) {
|
||||
this.creator = creator;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BpmBaseDO setUpdater(String updater) {
|
||||
this.updater = updater;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BpmBaseDO setDeleted(Boolean deleted) {
|
||||
this.deleted = deleted;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
} else if (!(o instanceof BpmBaseDO)) {
|
||||
return false;
|
||||
} else {
|
||||
BpmBaseDO other = (BpmBaseDO)o;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
} else {
|
||||
label71: {
|
||||
Object this$deleted = this.getDeleted();
|
||||
Object other$deleted = other.getDeleted();
|
||||
if (this$deleted == null) {
|
||||
if (other$deleted == null) {
|
||||
break label71;
|
||||
}
|
||||
} else if (this$deleted.equals(other$deleted)) {
|
||||
break label71;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Object this$createTime = this.getCreateTime();
|
||||
Object other$createTime = other.getCreateTime();
|
||||
if (this$createTime == null) {
|
||||
if (other$createTime != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this$createTime.equals(other$createTime)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
label57: {
|
||||
Object this$updateTime = this.getUpdateTime();
|
||||
Object other$updateTime = other.getUpdateTime();
|
||||
if (this$updateTime == null) {
|
||||
if (other$updateTime == null) {
|
||||
break label57;
|
||||
}
|
||||
} else if (this$updateTime.equals(other$updateTime)) {
|
||||
break label57;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Object this$creator = this.getCreator();
|
||||
Object other$creator = other.getCreator();
|
||||
if (this$creator == null) {
|
||||
if (other$creator != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this$creator.equals(other$creator)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object this$updater = this.getUpdater();
|
||||
Object other$updater = other.getUpdater();
|
||||
if (this$updater == null) {
|
||||
if (other$updater == null) {
|
||||
return true;
|
||||
}
|
||||
} else if (this$updater.equals(other$updater)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean canEqual(Object other) {
|
||||
return other instanceof BpmBaseDO;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,89 @@
|
||||
package cn.axzo.server.repository.dataobject;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Bpm 流程定义的拓展表
|
||||
* 主要解决 Activiti {@link ProcessDefinition} 不支持拓展字段,所以新建拓展表
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName(value = "bpm_process_definition_ext", autoResultMap = true)
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
// TODO 该表是否有用有待确定
|
||||
public class BpmProcessDefinitionExtDO extends BpmBaseDO{
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 流程定义的编号
|
||||
*
|
||||
* 关联 ProcessDefinition 的 id 属性
|
||||
*/
|
||||
private String processDefinitionId;
|
||||
/**
|
||||
* 流程模型的编号
|
||||
*
|
||||
* 关联 Model 的 id 属性
|
||||
*/
|
||||
private String modelId;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 表单类型
|
||||
*
|
||||
* 关联 {@link BpmModelFormTypeEnum}
|
||||
*/
|
||||
private Integer formType;
|
||||
/**
|
||||
* 动态表单编号
|
||||
* 在表单类型为 {@link BpmModelFormTypeEnum#NORMAL} 时
|
||||
*
|
||||
* 关联 {@link BpmFormDO#getId()}
|
||||
*/
|
||||
private Long formId;
|
||||
/**
|
||||
* 表单的配置
|
||||
* 在表单类型为 {@link BpmModelFormTypeEnum#NORMAL} 时
|
||||
*
|
||||
* 冗余 {@link BpmFormDO#getConf()}
|
||||
*/
|
||||
private String formConf;
|
||||
/**
|
||||
* 表单项的数组
|
||||
* 在表单类型为 {@link BpmModelFormTypeEnum#NORMAL} 时
|
||||
*
|
||||
* 冗余 {@link BpmFormDO#getFields()} ()}
|
||||
*/
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private List<String> formFields;
|
||||
/**
|
||||
* 自定义表单的提交路径,使用 Vue 的路由地址
|
||||
* 在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时
|
||||
*/
|
||||
private String formCustomCreatePath;
|
||||
/**
|
||||
* 自定义表单的查看路径,使用 Vue 的路由地址
|
||||
* 在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时
|
||||
*/
|
||||
private String formCustomViewPath;
|
||||
|
||||
private String tenantId;
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package cn.axzo.server.repository.mapper;
|
||||
|
||||
import cn.axzo.server.repository.dataobject.BpmProcessDefinitionExtDO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface BpmProcessDefinitionExtMapper extends BaseMapper<BpmProcessDefinitionExtDO> {
|
||||
}
|
||||
@ -50,5 +50,8 @@ public class BpmModelCreateDTO {
|
||||
* */
|
||||
private BpmJsonNode node;
|
||||
|
||||
/**
|
||||
* 租户Id
|
||||
* */
|
||||
private String tenantId;
|
||||
}
|
||||
|
||||
@ -49,6 +49,9 @@ public class BpmModelBaseVO {
|
||||
* */
|
||||
private Map metaInfo;
|
||||
|
||||
/**
|
||||
* 租户Id
|
||||
* */
|
||||
private String tenantId;
|
||||
|
||||
|
||||
|
||||
@ -39,11 +39,15 @@ public interface BpmModelService {
|
||||
|
||||
/**
|
||||
* 部署模型
|
||||
* return 部署完成的流程定义Id
|
||||
* */
|
||||
void deployBpmModelById(String modelId);
|
||||
String deployBpmModelById(String modelId);
|
||||
|
||||
|
||||
void deployBpmModelByKey(String modelKey);
|
||||
/**
|
||||
* 部署模型
|
||||
* return 部署完成的流程定义Id
|
||||
* */
|
||||
String deployBpmModelByKey(String modelKey);
|
||||
|
||||
/**
|
||||
* 删除模型
|
||||
|
||||
@ -4,17 +4,24 @@ import cn.axzo.server.request.process.BpmProcessDefinitionPageDTO;
|
||||
import cn.axzo.server.response.process.BpmProcessDefinitionPageItemRespVO;
|
||||
import cn.axzo.server.response.BpmPageResult;
|
||||
import org.flowable.common.engine.impl.db.SuspensionState;
|
||||
import org.flowable.engine.repository.Model;
|
||||
import org.flowable.engine.repository.ProcessDefinition;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BpmProcessDefinitionService {
|
||||
|
||||
|
||||
/*部署流程定义*/
|
||||
String createProcessDeinition(Model model, byte[] bpmnBytes);
|
||||
|
||||
/**
|
||||
* 挂起/激活流程,
|
||||
* 激活:SuspensionState.ACTIVE.getStateCode()
|
||||
* 挂起:SuspensionState.SUSPENDED.getStateCode()
|
||||
* {@link SuspensionState}
|
||||
* */
|
||||
|
||||
void updateProcessDefinitionSuspendedState(String processDefinitionId, Integer state);
|
||||
|
||||
BpmPageResult<BpmProcessDefinitionPageItemRespVO> getProcessDefinitionPage(BpmProcessDefinitionPageDTO request);
|
||||
@ -26,4 +33,12 @@ public interface BpmProcessDefinitionService {
|
||||
* @return 流程定义
|
||||
*/
|
||||
ProcessDefinition getProcessDefinition(String id);
|
||||
|
||||
/**
|
||||
* 获得 deploymentId 对应的 ProcessDefinition
|
||||
*
|
||||
* @param deploymentId 部署编号
|
||||
* @return 流程定义
|
||||
*/
|
||||
ProcessDefinition getProcessDefinitionByDeploymentId(String deploymentId);
|
||||
}
|
||||
|
||||
@ -8,6 +8,11 @@ import org.flowable.engine.runtime.ProcessInstance;
|
||||
|
||||
public interface BpmProcessInstanceService {
|
||||
|
||||
/**
|
||||
* 发起审核
|
||||
* */
|
||||
String createProcessInstance(BpmProcessInstanceCreateDTO processInstanceCreateDTO);
|
||||
|
||||
/**
|
||||
* 获得流程实例
|
||||
*
|
||||
@ -18,7 +23,7 @@ public interface BpmProcessInstanceService {
|
||||
|
||||
Boolean updateProcessStatus(String processInstanceId, String status);
|
||||
|
||||
String createProcessInstance(BpmProcessInstanceCreateDTO processInstanceCreateDTO);
|
||||
|
||||
|
||||
/**
|
||||
* 获取活跃的流程定义
|
||||
|
||||
@ -3,6 +3,7 @@ package cn.axzo.server.service.impl;
|
||||
import cn.axzo.framework.domain.ServiceException;
|
||||
import cn.axzo.server.common.enums.BpmErrorCode;
|
||||
import cn.axzo.server.service.BpmModelService;
|
||||
import cn.axzo.server.service.BpmProcessDefinitionService;
|
||||
import cn.axzo.server.service.converter.BpmModelConverter;
|
||||
import cn.axzo.server.request.model.BpmModelCreateDTO;
|
||||
import cn.axzo.server.request.model.BpmModelBpmPageDTO;
|
||||
@ -10,15 +11,22 @@ import cn.axzo.server.request.model.BpmModelUpdateDTO;
|
||||
import cn.axzo.server.response.BpmPageResult;
|
||||
import cn.axzo.server.response.model.BpmModelDetailVO;
|
||||
import cn.axzo.server.response.model.BpmModelPageItemVO;
|
||||
import cn.axzo.server.utils.BpmTransformUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.github.xiaoymin.knife4j.core.util.StrUtil;
|
||||
import feign.form.util.CharsetUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.flowable.common.engine.impl.db.SuspensionState;
|
||||
import org.flowable.engine.RepositoryService;
|
||||
import org.flowable.engine.repository.Model;
|
||||
import org.flowable.engine.repository.ProcessDefinition;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
@Service
|
||||
public class BpmModelServiceImpl implements BpmModelService {
|
||||
@ -27,6 +35,8 @@ public class BpmModelServiceImpl implements BpmModelService {
|
||||
@Lazy
|
||||
private RepositoryService repositoryService;
|
||||
@Resource
|
||||
private BpmProcessDefinitionService processDefinitionService;
|
||||
@Resource
|
||||
private BpmProcessDefinitionServiceImpl processDefinitionServiceImpl;
|
||||
|
||||
@Override
|
||||
@ -35,7 +45,7 @@ public class BpmModelServiceImpl implements BpmModelService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createBpmModel(BpmModelCreateDTO createDTO) {
|
||||
public String createBpmModel(@Valid BpmModelCreateDTO createDTO) {
|
||||
|
||||
Model existModel = repositoryService.createModelQuery().modelKey(createDTO.getKey()).singleResult();
|
||||
if (!ObjectUtils.isEmpty(existModel)) {
|
||||
@ -48,9 +58,13 @@ public class BpmModelServiceImpl implements BpmModelService {
|
||||
model.setCategory(createDTO.getCategory());
|
||||
model.setKey(createDTO.getKey());
|
||||
model.setTenantId(createDTO.getTenantId());
|
||||
|
||||
repositoryService.createDeploymentQuery().singleResult();
|
||||
repositoryService.saveModel(model);
|
||||
//存储Bpmn协议
|
||||
if (createDTO.getNode() != null) {
|
||||
byte[] bpmn = BpmTransformUtil.transformBpmnJsonToXml(createDTO.getNode(), model);
|
||||
saveModelBpmnXml(model, bpmn);
|
||||
this.repositoryService.addModelEditorSource(model.getId(), bpmn);
|
||||
}
|
||||
return model.getId();
|
||||
}
|
||||
|
||||
@ -87,7 +101,7 @@ public class BpmModelServiceImpl implements BpmModelService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deployBpmModelById(String modelId) {
|
||||
public String deployBpmModelById(String modelId) {
|
||||
Model model = this.repositoryService.getModel(modelId);
|
||||
if (org.springframework.util.ObjectUtils.isEmpty(model)) {
|
||||
throw new ServiceException(BpmErrorCode.MODEL_NOT_EXISTS);
|
||||
@ -101,21 +115,44 @@ public class BpmModelServiceImpl implements BpmModelService {
|
||||
processDefinitionServiceImpl.createProcessDeinition(model, bpmnBytes);
|
||||
|
||||
// TODO 没跑通
|
||||
// String definitionId = this.processDefinitionService.createProcessDefinition(definitionCreateReqDTO);
|
||||
// this.updateProcessDefinitionSuspended(model.getDeploymentId());
|
||||
// ProcessDefinition definition = this.processDefinitionService.getProcessDefinition(definitionId);
|
||||
// model.setDeploymentId(definition.getDeploymentId());
|
||||
// this.repositoryService.saveModel(model);
|
||||
// }
|
||||
|
||||
String definitionId = this.processDefinitionService.createProcessDeinition(model, bpmnBytes);
|
||||
// 挂起原来的流程定义
|
||||
this.updateProcessDefinitionSuspended(model.getDeploymentId());
|
||||
ProcessDefinition definition = this.processDefinitionService.getProcessDefinition(definitionId);
|
||||
model.setDeploymentId(definition.getDeploymentId());
|
||||
this.repositoryService.saveModel(model);
|
||||
return definition.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deployBpmModelByKey(String modelKey) {
|
||||
public String deployBpmModelByKey(String modelKey) {
|
||||
Model model = repositoryService.createModelQuery().modelKey(modelKey).singleResult();
|
||||
return deployBpmModelById(model.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteBpmModel(String id) {
|
||||
repositoryService.deleteModel(id);
|
||||
}
|
||||
|
||||
private void saveModelBpmnXml(Model model, String bpmnXml) {
|
||||
if (!StringUtils.isBlank(bpmnXml)) {
|
||||
this.repositoryService.addModelEditorSource(model.getId(), bpmnXml.getBytes());
|
||||
}
|
||||
}
|
||||
|
||||
private void saveModelBpmnXml(Model model, byte[] bpmnXml) {
|
||||
if(bpmnXml != null && bpmnXml.length != 0){
|
||||
this.repositoryService.addModelEditorSource(model.getId(), bpmnXml);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateProcessDefinitionSuspended(String deploymentId) {
|
||||
if (!StringUtils.isBlank(deploymentId)) {
|
||||
ProcessDefinition oldDefinition = this.processDefinitionService.getProcessDefinitionByDeploymentId(deploymentId);
|
||||
if (oldDefinition != null) {
|
||||
this.processDefinitionService.updateProcessDefinitionSuspendedState(oldDefinition.getId(), SuspensionState.SUSPENDED.getStateCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,14 +1,19 @@
|
||||
package cn.axzo.server.service.impl;
|
||||
|
||||
import cn.axzo.framework.domain.ServiceException;
|
||||
import cn.axzo.server.repository.dataobject.BpmProcessDefinitionExtDO;
|
||||
import cn.axzo.server.repository.mapper.BpmProcessDefinitionExtMapper;
|
||||
import cn.axzo.server.request.process.BpmProcessDefinitionPageDTO;
|
||||
import cn.axzo.server.response.BpmPageResult;
|
||||
import cn.axzo.server.response.process.BpmProcessDefinitionPageItemRespVO;
|
||||
import cn.axzo.server.service.BpmProcessDefinitionService;
|
||||
import cn.axzo.server.response.process.BpmProcessInstanceVO;
|
||||
import com.github.xiaoymin.knife4j.core.util.StrUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.flowable.common.engine.impl.db.SuspensionState;
|
||||
import org.flowable.engine.RepositoryService;
|
||||
import org.flowable.engine.RuntimeService;
|
||||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
import org.flowable.engine.repository.Deployment;
|
||||
import org.flowable.engine.repository.Model;
|
||||
@ -27,7 +32,10 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
|
||||
private static final String BPMN_FILE_SUFFIX = ".bpmn";
|
||||
@Resource
|
||||
private RepositoryService repositoryService;
|
||||
@Resource
|
||||
private BpmProcessDefinitionExtMapper processDefinitionExtMapper;
|
||||
|
||||
@Override
|
||||
public String createProcessDeinition(Model model, byte[] bpmnBytes) {
|
||||
if (model == null || bpmnBytes == null) {
|
||||
return null;
|
||||
@ -58,6 +66,11 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
|
||||
if (!Objects.equals(model.getName(), definition.getName())) {
|
||||
throw new ServiceException(PROCESS_DEFINITION_NAME_NOT_MATCH);
|
||||
}
|
||||
|
||||
// 插入拓展表
|
||||
BpmProcessDefinitionExtDO definitionDO = new BpmProcessDefinitionExtDO();
|
||||
definitionDO.setModelId(model.getId());
|
||||
processDefinitionExtMapper.insert(definitionDO);
|
||||
return definition.getId();
|
||||
}
|
||||
|
||||
@ -87,4 +100,13 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
|
||||
public ProcessDefinition getProcessDefinition(String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcessDefinition getProcessDefinitionByDeploymentId(String deploymentId) {
|
||||
if (StringUtils.isBlank(deploymentId)) {
|
||||
return null;
|
||||
}
|
||||
return repositoryService.createProcessDefinitionQuery().deploymentId(deploymentId)
|
||||
.singleResult();
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ import cn.axzo.server.repository.dto.BpmJsonNode;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
import org.flowable.bpmn.BpmnAutoLayout;
|
||||
import org.flowable.bpmn.converter.BpmnXMLConverter;
|
||||
@ -22,9 +23,10 @@ import java.util.*;
|
||||
import static cn.axzo.server.common.enums.BpmErrorCode.BPM_META_DATA_FORMAT_ERROR;
|
||||
import static org.flowable.bpmn.model.ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION;
|
||||
|
||||
@Slf4j
|
||||
public class BpmTransformUtil {
|
||||
|
||||
public String transformBpmnJsonToXml(BpmJsonNode bpmnJson, Model model) {
|
||||
public static byte[] transformBpmnJsonToXml(BpmJsonNode bpmnJson, Model model) {
|
||||
|
||||
// JSONObject bpmnJson = (JSONObject) updateReqVO.getBpmnJson();
|
||||
|
||||
@ -56,41 +58,12 @@ public class BpmTransformUtil {
|
||||
|
||||
|
||||
new BpmnAutoLayout(bpmnModel).execute();
|
||||
String xmlResult = new String(new BpmnXMLConverter().convertToXML(bpmnModel));
|
||||
System.err.println(xmlResult);
|
||||
return xmlResult;
|
||||
byte[] xmlMeta = new BpmnXMLConverter().convertToXML(bpmnModel);
|
||||
String xmlResult = new String(xmlMeta);
|
||||
log.debug("xmlMeta: " + xmlResult);
|
||||
return xmlMeta;
|
||||
}
|
||||
|
||||
// @PostMapping("/jsonToBpmn")
|
||||
// public Object saveForm(@RequestBody com.alibaba.fastjson.JSONObject jsonObject) throws InvocationTargetException, IllegalAccessException {
|
||||
// System.err.println(jsonObject.toJSONString());
|
||||
// BpmnModel bpmnModel =new BpmnModel();
|
||||
// Process process=new Process();
|
||||
// bpmnModel.addProcess(process);
|
||||
// List<SequenceFlow> sequenceFlows = Lists.newArrayList();
|
||||
// process.setId("flowableV2_"+idWorker.nextId());
|
||||
// StartEvent startEvent = BpmnModelUtils.createStartEvent();
|
||||
// process.addFlowElement(startEvent);
|
||||
// com.alibaba.fastjson.JSONObject workFlowObj = jsonObject.getJSONObject("_value");
|
||||
// String name = workFlowObj.getJSONObject("workFlowDef").getString("name");
|
||||
// process.setName(name);
|
||||
//
|
||||
// ExtensionAttribute extensionAttribute=new ExtensionAttribute();
|
||||
// extensionAttribute.setName("DingDing");
|
||||
// extensionAttribute.setNamespace("http://flowable.org/bpmn");
|
||||
// extensionAttribute.setValue(jsonObject.toJSONString());
|
||||
// process.addAttribute(extensionAttribute);
|
||||
// com.alibaba.fastjson.JSONObject processNodes = workFlowObj.getJSONObject("nodeConfig");
|
||||
// String lastNode = create(startEvent.getId(), processNodes,bpmnModel,process,sequenceFlows);
|
||||
// EndEvent endEvent = createEndEvent();
|
||||
// process.addFlowElement(endEvent);
|
||||
// process.addFlowElement(connect(lastNode, endEvent.getId(),sequenceFlows));
|
||||
//
|
||||
// new BpmnAutoLayout(bpmnModel).execute();
|
||||
// System.err.println(new String(new BpmnXMLConverter().convertToXML(bpmnModel)));
|
||||
// return R.ok("保存成功");
|
||||
// }
|
||||
|
||||
private static String create(String fromId, JSONObject flowNode, BpmnModel model, Process process, List<SequenceFlow> sequenceFlows) throws InvocationTargetException, IllegalAccessException {
|
||||
String nodeType = flowNode.getString("type");
|
||||
if (BpmFlowNodeType.NODE_STARTER.name().equals(nodeType)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user