feat(流程部署): 添加删除流程部署方法
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
package com.ruoyi.web.controller.workflow;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.JsonUtils;
|
||||
import com.ruoyi.workflow.domain.bo.WfProcessBo;
|
||||
import com.ruoyi.workflow.domain.vo.WfDeployVo;
|
||||
@@ -18,6 +20,8 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -76,6 +80,18 @@ public class WfDeployController extends BaseController {
|
||||
return R.ok(null, deployService.queryBpmnXmlById(definitionId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除流程模型
|
||||
*/
|
||||
@ApiOperation("删除流程部署")
|
||||
@SaCheckPermission("workflow:deploy:remove")
|
||||
@Log(title = "删除流程部署", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{deployIds}")
|
||||
public R<String> remove(@ApiParam(value = "流程部署ids") @NotEmpty(message = "主键不能为空") @PathVariable String[] deployIds) {
|
||||
deployService.deleteByIds(Arrays.asList(deployIds));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param deployId
|
||||
|
||||
@@ -5,6 +5,8 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.workflow.domain.bo.WfProcessBo;
|
||||
import com.ruoyi.workflow.domain.vo.WfDeployVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author KonBAI
|
||||
* @createTime 2022/6/30 9:03
|
||||
@@ -18,4 +20,6 @@ public interface IWfDeployService {
|
||||
void updateState(String definitionId, String stateCode);
|
||||
|
||||
String queryBpmnXmlById(String definitionId);
|
||||
|
||||
void deleteByIds(List<String> deployIds);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,15 @@ package com.ruoyi.workflow.service.impl;
|
||||
|
||||
import cn.hutool.core.io.IORuntimeException;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.workflow.domain.WfDeployForm;
|
||||
import com.ruoyi.workflow.domain.bo.WfProcessBo;
|
||||
import com.ruoyi.workflow.domain.vo.WfDeployVo;
|
||||
import com.ruoyi.workflow.mapper.WfDeployFormMapper;
|
||||
import com.ruoyi.workflow.service.IWfDeployService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.flowable.common.engine.impl.db.SuspensionState;
|
||||
@@ -16,6 +19,7 @@ import org.flowable.engine.repository.Deployment;
|
||||
import org.flowable.engine.repository.ProcessDefinition;
|
||||
import org.flowable.engine.repository.ProcessDefinitionQuery;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
@@ -31,6 +35,7 @@ import java.util.stream.Collectors;
|
||||
public class WfDeployServiceImpl implements IWfDeployService {
|
||||
|
||||
private final RepositoryService repositoryService;
|
||||
private final WfDeployFormMapper deployFormMapper;
|
||||
|
||||
@Override
|
||||
public TableDataInfo<WfDeployVo> queryPageList(WfProcessBo processBo, PageQuery pageQuery) {
|
||||
@@ -144,4 +149,13 @@ public class WfDeployServiceImpl implements IWfDeployService {
|
||||
throw new RuntimeException("加载xml文件异常");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteByIds(List<String> deployIds) {
|
||||
for (String deployId : deployIds) {
|
||||
repositoryService.deleteDeployment(deployId);
|
||||
deployFormMapper.delete(new LambdaQueryWrapper<WfDeployForm>().eq(WfDeployForm::getDeployId, deployId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,13 @@ export function changeState(params) {
|
||||
})
|
||||
}
|
||||
|
||||
// 删除流程部署
|
||||
export function delDeploy(deployIds) {
|
||||
return request({
|
||||
url: '/workflow/deploy/' + deployIds,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 查询流程部署关联表单信息
|
||||
export function getFormByDeployId(deployId) {
|
||||
|
||||
@@ -42,7 +42,22 @@
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-table v-loading="loading" fit :data="deployList">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['workflow:deploy:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-table v-loading="loading" fit :data="deployList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="流程标识" align="center" prop="processKey" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="流程名称" align="center" :show-overflow-tooltip="true">
|
||||
@@ -101,8 +116,7 @@
|
||||
|
||||
<!-- 版本管理 -->
|
||||
<el-dialog title="版本管理" :visible.sync="publish.open" width="50%" append-to-body>
|
||||
<el-table v-loading="publish.loading" :data="publish.dataList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table v-loading="publish.loading" :data="publish.dataList">
|
||||
<el-table-column label="流程标识" align="center" prop="processKey" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="流程名称" align="center" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
@@ -164,7 +178,7 @@
|
||||
|
||||
<script>
|
||||
import { listAllCategory } from '@/api/workflow/category'
|
||||
import { listDeploy, listPublish, getBpmnXml, changeState } from '@/api/workflow/deploy'
|
||||
import { listDeploy, listPublish, getBpmnXml, changeState, delDeploy } from '@/api/workflow/deploy'
|
||||
import ProcessViewer from '@/components/ProcessViewer'
|
||||
|
||||
export default {
|
||||
@@ -255,6 +269,12 @@ export default {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.deploymentId)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 查看流程图 */
|
||||
handleProcessView(row) {
|
||||
let definitionId = row.definitionId;
|
||||
@@ -290,6 +310,19 @@ export default {
|
||||
this.getPublishList();
|
||||
});
|
||||
},
|
||||
handleDelete(row) {
|
||||
const deploymentIds = row.deploymentId || this.ids;
|
||||
this.$modal.confirm('是否确认删除选中的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delDeploy(deploymentIds);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
categoryFormat(row, column) {
|
||||
return this.categoryOptions.find(k => k.code === row.category)?.categoryName ?? '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user