refactor(工作流流程): 新增读取xml文件接口,替换原流程定义中的接口。
This commit is contained in:
@@ -73,6 +73,15 @@ public class WfProcessController extends BaseController {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取xml文件
|
||||
* @param processDefId 流程定义ID
|
||||
*/
|
||||
@GetMapping("/bpmnXml/{processDefId}")
|
||||
public R<String> getBpmnXml(@PathVariable(value = "processDefId") String processDefId) {
|
||||
return R.ok(null, processService.queryBpmnXmlById(processDefId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询流程详情信息
|
||||
*
|
||||
|
||||
@@ -43,6 +43,12 @@ public interface IWfProcessService {
|
||||
*/
|
||||
void startProcessByDefKey(String procDefKey, Map<String, Object> variables);
|
||||
|
||||
/**
|
||||
* 读取xml文件
|
||||
* @param processDefId 流程定义ID
|
||||
*/
|
||||
String queryBpmnXmlById(String processDefId);
|
||||
|
||||
/**
|
||||
* 查询流程任务详情信息
|
||||
* @param procInsId 流程实例ID
|
||||
|
||||
@@ -189,6 +189,20 @@ public class WfProcessServiceImpl extends FlowServiceFactory implements IWfProce
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取xml文件
|
||||
* @param processDefId 流程定义ID
|
||||
*/
|
||||
@Override
|
||||
public String queryBpmnXmlById(String processDefId) {
|
||||
InputStream inputStream = repositoryService.getProcessModel(processDefId);
|
||||
try {
|
||||
return IoUtil.readUtf8(inputStream);
|
||||
} catch (IORuntimeException exception) {
|
||||
throw new RuntimeException("加载xml文件异常");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程详情信息
|
||||
*
|
||||
|
||||
@@ -27,6 +27,14 @@ export function startProcess(processDefId, data) {
|
||||
})
|
||||
}
|
||||
|
||||
// 获取流程图
|
||||
export function getBpmnXml(processDefId) {
|
||||
return request({
|
||||
url: '/workflow/process/bpmnXml/' + processDefId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function detailProcess(query) {
|
||||
return request({
|
||||
url: '/workflow/process/detail',
|
||||
|
||||
@@ -77,9 +77,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listProcess } from "@/api/workflow/process";
|
||||
import { listProcess, getBpmnXml } from "@/api/workflow/process";
|
||||
import { listCategory } from '@/api/workflow/category'
|
||||
import { readXml } from '@/api/workflow/definition'
|
||||
import ProcessViewer from '@/components/ProcessViewer'
|
||||
|
||||
export default {
|
||||
@@ -149,7 +148,7 @@ export default {
|
||||
this.processView.title = "流程图";
|
||||
this.processView.index = definitionId;
|
||||
// 发送请求,获取xml
|
||||
readXml(definitionId).then(res => {
|
||||
getBpmnXml(definitionId).then(res => {
|
||||
this.processView.xmlData = res.data;
|
||||
})
|
||||
this.processView.open = true;
|
||||
|
||||
Reference in New Issue
Block a user