|
|
@@ -1,5 +1,6 @@
|
|
|
package org.dromara.workflow.controller;
|
|
|
|
|
|
+import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.dromara.common.core.domain.R;
|
|
|
@@ -13,6 +14,7 @@ import org.dromara.warm.flow.core.entity.Definition;
|
|
|
import org.dromara.warm.flow.core.service.DefService;
|
|
|
import org.dromara.warm.flow.orm.entity.FlowDefinition;
|
|
|
import org.dromara.workflow.common.ConditionalOnEnable;
|
|
|
+import org.dromara.workflow.common.constant.FlowPermissionConstant;
|
|
|
import org.dromara.workflow.domain.vo.FlowDefinitionVo;
|
|
|
import org.dromara.workflow.service.IFlwDefinitionService;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -44,6 +46,7 @@ public class FlwDefinitionController extends BaseController {
|
|
|
* @param flowDefinition 参数
|
|
|
* @param pageQuery 分页
|
|
|
*/
|
|
|
+ @SaCheckPermission(FlowPermissionConstant.DEFINITION_LIST)
|
|
|
@GetMapping("/list")
|
|
|
public TableDataInfo<FlowDefinitionVo> list(FlowDefinition flowDefinition, PageQuery pageQuery) {
|
|
|
return flwDefinitionService.queryList(flowDefinition, pageQuery);
|
|
|
@@ -55,6 +58,7 @@ public class FlwDefinitionController extends BaseController {
|
|
|
* @param flowDefinition 参数
|
|
|
* @param pageQuery 分页
|
|
|
*/
|
|
|
+ @SaCheckPermission(FlowPermissionConstant.DEFINITION_LIST)
|
|
|
@GetMapping("/unPublishList")
|
|
|
public TableDataInfo<FlowDefinitionVo> unPublishList(FlowDefinition flowDefinition, PageQuery pageQuery) {
|
|
|
return flwDefinitionService.unPublishList(flowDefinition, pageQuery);
|
|
|
@@ -65,6 +69,7 @@ public class FlwDefinitionController extends BaseController {
|
|
|
*
|
|
|
* @param id 流程定义id
|
|
|
*/
|
|
|
+ @SaCheckPermission(FlowPermissionConstant.DEFINITION_LIST)
|
|
|
@GetMapping(value = "/{id}")
|
|
|
public R<Definition> getInfo(@PathVariable("id") Long id) {
|
|
|
return R.ok(defService.getById(id));
|
|
|
@@ -76,6 +81,7 @@ public class FlwDefinitionController extends BaseController {
|
|
|
* @param flowDefinition 参数
|
|
|
*/
|
|
|
@Log(title = "流程定义", businessType = BusinessType.INSERT)
|
|
|
+ @SaCheckPermission(FlowPermissionConstant.DEFINITION_EDIT)
|
|
|
@PostMapping
|
|
|
@RepeatSubmit()
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@@ -89,6 +95,7 @@ public class FlwDefinitionController extends BaseController {
|
|
|
* @param flowDefinition 参数
|
|
|
*/
|
|
|
@Log(title = "流程定义", businessType = BusinessType.UPDATE)
|
|
|
+ @SaCheckPermission(FlowPermissionConstant.DEFINITION_EDIT)
|
|
|
@PutMapping
|
|
|
@RepeatSubmit()
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@@ -102,6 +109,7 @@ public class FlwDefinitionController extends BaseController {
|
|
|
* @param id 流程定义id
|
|
|
*/
|
|
|
@Log(title = "流程定义", businessType = BusinessType.INSERT)
|
|
|
+ @SaCheckPermission(FlowPermissionConstant.DEFINITION_EDIT)
|
|
|
@PutMapping("/publish/{id}")
|
|
|
@RepeatSubmit()
|
|
|
public R<Boolean> publish(@PathVariable("id") Long id) {
|
|
|
@@ -114,6 +122,7 @@ public class FlwDefinitionController extends BaseController {
|
|
|
* @param id 流程定义id
|
|
|
*/
|
|
|
@Log(title = "流程定义", businessType = BusinessType.INSERT)
|
|
|
+ @SaCheckPermission(FlowPermissionConstant.DEFINITION_EDIT)
|
|
|
@PutMapping("/unPublish/{id}")
|
|
|
@RepeatSubmit()
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@@ -125,6 +134,7 @@ public class FlwDefinitionController extends BaseController {
|
|
|
* 删除流程定义
|
|
|
*/
|
|
|
@Log(title = "流程定义", businessType = BusinessType.DELETE)
|
|
|
+ @SaCheckPermission(FlowPermissionConstant.DEFINITION_EDIT)
|
|
|
@DeleteMapping("/{ids}")
|
|
|
public R<Void> remove(@PathVariable("ids") List<Long> ids) {
|
|
|
return toAjax(flwDefinitionService.removeDef(ids));
|
|
|
@@ -136,6 +146,7 @@ public class FlwDefinitionController extends BaseController {
|
|
|
* @param id 流程定义id
|
|
|
*/
|
|
|
@Log(title = "流程定义", businessType = BusinessType.INSERT)
|
|
|
+ @SaCheckPermission(FlowPermissionConstant.DEFINITION_EDIT)
|
|
|
@PostMapping("/copy/{id}")
|
|
|
@RepeatSubmit()
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@@ -150,6 +161,7 @@ public class FlwDefinitionController extends BaseController {
|
|
|
* @param category 分类
|
|
|
*/
|
|
|
@Log(title = "流程定义", businessType = BusinessType.IMPORT)
|
|
|
+ @SaCheckPermission(FlowPermissionConstant.DEFINITION_EDIT)
|
|
|
@PostMapping("/importDef")
|
|
|
public R<Boolean> importDef(MultipartFile file, String category) {
|
|
|
return R.ok(flwDefinitionService.importJson(file, category));
|
|
|
@@ -163,6 +175,7 @@ public class FlwDefinitionController extends BaseController {
|
|
|
* @throws IOException 异常
|
|
|
*/
|
|
|
@Log(title = "流程定义", businessType = BusinessType.EXPORT)
|
|
|
+ @SaCheckPermission(FlowPermissionConstant.DEFINITION_EDIT)
|
|
|
@PostMapping("/exportDef/{id}")
|
|
|
public void exportDef(@PathVariable("id") Long id, HttpServletResponse response) throws IOException {
|
|
|
flwDefinitionService.exportDef(id, response);
|
|
|
@@ -173,6 +186,7 @@ public class FlwDefinitionController extends BaseController {
|
|
|
*
|
|
|
* @param id 流程定义id
|
|
|
*/
|
|
|
+ @SaCheckPermission(FlowPermissionConstant.DEFINITION_LIST)
|
|
|
@GetMapping("/xmlString/{id}")
|
|
|
public R<String> xmlString(@PathVariable("id") Long id) {
|
|
|
return R.ok("操作成功", defService.exportJson(id));
|
|
|
@@ -185,6 +199,7 @@ public class FlwDefinitionController extends BaseController {
|
|
|
* @param active 激活/挂起
|
|
|
*/
|
|
|
@RepeatSubmit()
|
|
|
+ @SaCheckPermission(FlowPermissionConstant.DEFINITION_EDIT)
|
|
|
@PutMapping("/active/{id}")
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public R<Boolean> active(@PathVariable("id") Long id, @RequestParam("active") boolean active) {
|