|
@@ -0,0 +1,108 @@
|
|
|
+package cn.iocoder.yudao.module.bpm.controller.admin.task;
|
|
|
+
|
|
|
+import cn.iocoder.yudao.module.bpm.convert.definition.BpmProcessDefinitionConvert;
|
|
|
+import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionInfoDO;
|
|
|
+import org.flowable.engine.repository.ProcessDefinition;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import javax.annotation.Resource;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+
|
|
|
+import javax.validation.constraints.*;
|
|
|
+import javax.validation.*;
|
|
|
+import javax.servlet.http.*;
|
|
|
+import java.util.*;
|
|
|
+import java.io.IOException;
|
|
|
+
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
+
|
|
|
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
+
|
|
|
+import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
|
|
+import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
|
|
+
|
|
|
+import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.*;
|
|
|
+import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmTaskAssignRuleDO;
|
|
|
+import cn.iocoder.yudao.module.bpm.service.task.BpmTaskAssignRuleService;
|
|
|
+
|
|
|
+@Tag(name = "管理后台 - Bpm 任务规则")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/bpm/task-assign-rule")
|
|
|
+@Validated
|
|
|
+public class BpmTaskAssignRuleController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private BpmTaskAssignRuleService taskAssignRuleService;
|
|
|
+
|
|
|
+ @PostMapping("/create")
|
|
|
+ @Operation(summary = "创建Bpm 任务规则")
|
|
|
+ @PreAuthorize("@ss.hasPermission('bpm:task-assign-rule:create')")
|
|
|
+ public CommonResult<Long> createTaskAssignRule(@Valid @RequestBody BpmTaskAssignRuleSaveReqVO createReqVO) {
|
|
|
+ return success(taskAssignRuleService.createTaskAssignRule(createReqVO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping("/update")
|
|
|
+ @Operation(summary = "更新Bpm 任务规则")
|
|
|
+ @PreAuthorize("@ss.hasPermission('bpm:task-assign-rule:update')")
|
|
|
+ public CommonResult<Boolean> updateTaskAssignRule(@Valid @RequestBody BpmTaskAssignRuleSaveReqVO updateReqVO) {
|
|
|
+ taskAssignRuleService.updateTaskAssignRule(updateReqVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/delete")
|
|
|
+ @Operation(summary = "删除Bpm 任务规则")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true)
|
|
|
+ @PreAuthorize("@ss.hasPermission('bpm:task-assign-rule:delete')")
|
|
|
+ public CommonResult<Boolean> deleteTaskAssignRule(@RequestParam("id") Long id) {
|
|
|
+ taskAssignRuleService.deleteTaskAssignRule(id);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/get")
|
|
|
+ @Operation(summary = "获得Bpm 任务规则")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('bpm:task-assign-rule:query')")
|
|
|
+ public CommonResult<BpmTaskAssignRuleRespVO> getTaskAssignRule(@RequestParam("id") Long id) {
|
|
|
+ BpmTaskAssignRuleDO taskAssignRule = taskAssignRuleService.getTaskAssignRule(id);
|
|
|
+ return success(BeanUtils.toBean(taskAssignRule, BpmTaskAssignRuleRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/list")
|
|
|
+ @Operation(summary = "获得Bpm 任务规则")
|
|
|
+ @Parameter(name = "modelId", description = "流程模型的编号", required = true, example = "1024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('bpm:task-assign-rule:query')")
|
|
|
+ public CommonResult<List<BpmTaskAssignRuleDO>> getTaskAssignRule(@RequestParam("modelId") String modelId) {
|
|
|
+ List<BpmTaskAssignRuleDO> taskAssignRule = taskAssignRuleService.getTaskAssignRuleModelId(modelId);
|
|
|
+ return success(taskAssignRule);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/page")
|
|
|
+ @Operation(summary = "获得Bpm 任务规则分页")
|
|
|
+ @PreAuthorize("@ss.hasPermission('bpm:task-assign-rule:query')")
|
|
|
+ public CommonResult<PageResult<BpmTaskAssignRuleRespVO>> getTaskAssignRulePage(@Valid BpmTaskAssignRulePageReqVO pageReqVO) {
|
|
|
+ PageResult<BpmTaskAssignRuleDO> pageResult = taskAssignRuleService.getTaskAssignRulePage(pageReqVO);
|
|
|
+ return success(BeanUtils.toBean(pageResult, BpmTaskAssignRuleRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/export-excel")
|
|
|
+ @Operation(summary = "导出Bpm 任务规则 Excel")
|
|
|
+ @PreAuthorize("@ss.hasPermission('bpm:task-assign-rule:export')")
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
+ public void exportTaskAssignRuleExcel(@Valid BpmTaskAssignRulePageReqVO pageReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ List<BpmTaskAssignRuleDO> list = taskAssignRuleService.getTaskAssignRulePage(pageReqVO).getList();
|
|
|
+ // 导出 Excel
|
|
|
+ ExcelUtils.write(response, "Bpm 任务规则.xls", "数据", BpmTaskAssignRuleRespVO.class,
|
|
|
+ BeanUtils.toBean(list, BpmTaskAssignRuleRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|