| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.ycl.cmd.RemoveDeploymentCacheCMD; |
| | | import com.ycl.common.constant.ProcessConstants; |
| | | import com.ycl.common.core.domain.AjaxResult; |
| | | import com.ycl.common.core.domain.entity.SysUser; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.flowable.bpmn.model.BpmnModel; |
| | | import org.flowable.engine.ManagementService; |
| | | import org.flowable.engine.repository.Deployment; |
| | | import org.flowable.engine.repository.ProcessDefinition; |
| | | import org.flowable.engine.repository.ProcessDefinitionQuery; |
| | |
| | | import org.flowable.task.api.Task; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.IOException; |
| | |
| | | public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFlowDefinitionService { |
| | | |
| | | private final ISysDeployFormService sysDeployFormService; |
| | | |
| | | private final ISysUserService sysUserService; |
| | | |
| | | private final ISysDeptService sysDeptService; |
| | | |
| | | private final FlowDeployMapper flowDeployMapper; |
| | | private final ManagementService managementService; |
| | | |
| | | private static final String BPMN_FILE_SUFFIX = ".bpmn"; |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void updateProcess(String deploymentId, String name, String category, InputStream in) { |
| | | if (! StringUtils.hasText(deploymentId)) { |
| | | throw new RuntimeException("该流程第一次部署,请直接选择保存按钮"); |
| | | } |
| | | ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(deploymentId).singleResult(); |
| | | if (Objects.isNull(processDefinition)) { |
| | | throw new RuntimeException("流程定义不存在"); |
| | | } |
| | | // 1.更新流程图数据 |
| | | flowDeployMapper.updateProcess(in, deploymentId); |
| | | // 2.清除该流程的缓存,使其重新加载新的流程图 |
| | | managementService.executeCommand(new RemoveDeploymentCacheCMD(processDefinition.getId())); |
| | | } |
| | | |
| | | /** |
| | | * 读取xml |
| | | * |