工作流 Flowable 发布流程, 删除模型 的实现
parent
d6a6a01252
commit
b1d6baaad8
@ -0,0 +1,47 @@
|
|||||||
|
package cn.iocoder.yudao.module.bpm.controller.admin.definition;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.BpmProcessDefinitionPageItemRespVO;
|
||||||
|
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.BpmProcessDefinitionPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessDefinitionService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Api(tags = "管理后台 - 流程定义")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/bpm/process-definition")
|
||||||
|
@Validated
|
||||||
|
public class BpmProcessDefinitionController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BpmProcessDefinitionService bpmDefinitionService;
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@ApiOperation(value = "获得流程定义分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('bpm:process-definition:query')")
|
||||||
|
public CommonResult<PageResult<BpmProcessDefinitionPageItemRespVO>> getProcessDefinitionPage(
|
||||||
|
BpmProcessDefinitionPageReqVO pageReqVO) {
|
||||||
|
return success(bpmDefinitionService.getProcessDefinitionPage(pageReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping ("/get-bpmn-xml")
|
||||||
|
@ApiOperation(value = "获得流程定义的 BPMN XML")
|
||||||
|
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = String.class)
|
||||||
|
@PreAuthorize("@ss.hasPermission('bpm:process-definition:query')")
|
||||||
|
public CommonResult<String> getProcessDefinitionBpmnXML(@RequestParam("id") String id) {
|
||||||
|
String bpmnXML = bpmDefinitionService.getProcessDefinitionBpmnXML(id);
|
||||||
|
return success(bpmnXML);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
package cn.iocoder.yudao.module.bpm.convert.definition;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||||
|
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.rule.BpmTaskAssignRuleRespVO;
|
||||||
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmTaskAssignRuleDO;
|
||||||
|
import org.flowable.bpmn.model.UserTask;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface BpmTaskAssignRuleConvert {
|
||||||
|
BpmTaskAssignRuleConvert INSTANCE = Mappers.getMapper(BpmTaskAssignRuleConvert.class);
|
||||||
|
|
||||||
|
default List<BpmTaskAssignRuleRespVO> convertList(List<UserTask> tasks, List<BpmTaskAssignRuleDO> rules) {
|
||||||
|
Map<String, BpmTaskAssignRuleDO> ruleMap = CollectionUtils.convertMap(rules, BpmTaskAssignRuleDO::getTaskDefinitionKey);
|
||||||
|
// 以 UserTask 为主维度,原因是:流程图编辑后,一些规则实际就没用了。
|
||||||
|
return CollectionUtils.convertList(tasks, task -> {
|
||||||
|
BpmTaskAssignRuleRespVO respVO = convert(ruleMap.get(task.getId()));
|
||||||
|
if (respVO == null) {
|
||||||
|
respVO = new BpmTaskAssignRuleRespVO();
|
||||||
|
respVO.setTaskDefinitionKey(task.getId());
|
||||||
|
}
|
||||||
|
respVO.setTaskDefinitionName(task.getName());
|
||||||
|
return respVO;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
BpmTaskAssignRuleRespVO convert(BpmTaskAssignRuleDO bean);
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
package cn.iocoder.yudao.module.bpm.service.definition;
|
||||||
|
|
||||||
|
import org.flowable.bpmn.model.BpmnModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flowable流程模型接口
|
||||||
|
*
|
||||||
|
* @author yunlongn
|
||||||
|
*/
|
||||||
|
public interface BpmModelService extends BpmModelCommonService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得流程模型编号对应的 BPMN Model
|
||||||
|
*
|
||||||
|
* @param id 流程模型编号
|
||||||
|
* @return BPMN Model
|
||||||
|
*/
|
||||||
|
BpmnModel getBpmnModel(String id);
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,10 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.service.definition;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Flowable流程模型接口
|
|
||||||
*
|
|
||||||
* @author yunlongn
|
|
||||||
*/
|
|
||||||
public interface FlowableModelService extends BpmModelCommonService {
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue