From 34981c30a78e8bbd7791131059a9210f9928b62c Mon Sep 17 00:00:00 2001
From: 刘光辉 <347230014@qq.com>
Date: 星期四, 17 九月 2026 09:24:09 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master' into master

---
 jnpf-flowable/jnpf-flowable-controller/src/main/java/jnpf/flowable/controller/WorkflowMonitorController.java |  213 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 213 insertions(+), 0 deletions(-)

diff --git a/jnpf-flowable/jnpf-flowable-controller/src/main/java/jnpf/flowable/controller/WorkflowMonitorController.java b/jnpf-flowable/jnpf-flowable-controller/src/main/java/jnpf/flowable/controller/WorkflowMonitorController.java
new file mode 100644
index 0000000..bbaf0e8
--- /dev/null
+++ b/jnpf-flowable/jnpf-flowable-controller/src/main/java/jnpf/flowable/controller/WorkflowMonitorController.java
@@ -0,0 +1,213 @@
+package jnpf.flowable.controller;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import cn.hutool.core.util.ObjectUtil;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jnpf.base.ActionResult;
+import jnpf.base.entity.SystemEntity;
+import jnpf.base.vo.PageListVO;
+import jnpf.base.vo.PaginationVO;
+import jnpf.constant.MsgCode;
+import jnpf.exception.WorkFlowException;
+import jnpf.flowable.model.monitor.MonitorModel;
+import jnpf.flowable.model.monitor.MonitorVo;
+import jnpf.flowable.model.task.FlowModel;
+import jnpf.flowable.model.task.FlowTodoVO;
+import jnpf.flowable.model.task.TaskPagination;
+import jnpf.flowable.model.task.TaskTo;
+import jnpf.flowable.service.TaskService;
+import jnpf.flowable.util.OperatorUtil;
+import jnpf.flowable.util.ServiceUtil;
+import jnpf.permission.entity.UserEntity;
+import jnpf.permission.model.authorize.AuthorizeVO;
+import jnpf.util.JsonUtil;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 娴佺▼鐩戞帶
+ *
+ * @author JNPF@YinMai Info. Co., Ltd
+ * @version 5.0.x
+ * @since 2024/5/15 10:15
+ */
+@Tag(name = "娴佺▼鐩戞帶", description = "Monitor")
+@RestController
+@RequestMapping("/monitor")
+@RequiredArgsConstructor
+public class WorkflowMonitorController {
+
+
+    private final  ServiceUtil serviceUtil;
+
+    private final  OperatorUtil operatorUtil;
+
+
+    private final  TaskService taskService;
+
+    /**
+     * 鐩戞帶鍒楄〃
+     *
+     * @param pagination 鍒嗛〉鍙傛暟
+     */
+    @Operation(summary = "娴佺▼鐩戞帶鍒楄〃")
+    @GetMapping
+    public ActionResult<PageListVO<MonitorVo>> list(TaskPagination pagination) {
+        List<MonitorVo> list = taskService.getMonitorList(pagination);
+        List<UserEntity> userList = serviceUtil.getUserName(list.stream().map(MonitorVo::getCreatorUser).collect(Collectors.toList()));
+        List<SystemEntity> systemList = serviceUtil.getSystemList(list.stream().map(MonitorVo::getSystemName).collect(Collectors.toList()));
+        List<MonitorVo> voList = new LinkedList<>();
+        for (MonitorVo vo : list) {
+            UserEntity user = userList.stream().filter(t -> t.getId().equals(vo.getCreatorUser())).findFirst().orElse(null);
+            vo.setCreatorUser(user != null ? user.getRealName() + "/" + user.getAccount() : "");
+            SystemEntity system = systemList.stream().filter(t -> t.getId().equals(vo.getSystemName())).findFirst().orElse(null);
+            vo.setSystemName(system != null ? system.getFullName() : "");
+            if (ObjectUtil.equals(vo.getIsFile(), "0")) {
+                vo.setIsFile("鍚�");
+            } else if (ObjectUtil.equals(vo.getIsFile(), "1")) {
+                vo.setIsFile("鏄�");
+            } else {
+                vo.setIsFile("");
+            }
+            voList.add(vo);
+        }
+        PaginationVO paginationVO = JsonUtil.getJsonToBean(pagination, PaginationVO.class);
+        return ActionResult.page(voList, paginationVO);
+    }
+
+    /**
+     * 鎵归噺鍒犻櫎娴佺▼鐩戞帶
+     *
+     * @param model 鍙傛暟
+     */
+    @Operation(summary = "鎵归噺鍒犻櫎娴佺▼鐩戞帶")
+    @DeleteMapping
+    @SaCheckPermission(value = {"workFlow.flowMonitor"})
+    public ActionResult<Object> delete(@RequestBody MonitorModel model) throws WorkFlowException {
+        taskService.deleteBatch(model.getIds());
+        return ActionResult.success(MsgCode.SU003.get());
+    }
+
+    /**
+     * 鍒ゆ柇鏄惁瀛樺湪寮傛瀛愭祦绋�
+     *
+     * @param id 浠诲姟涓婚敭
+     */
+    @Operation(summary = "鍒ゆ柇鏄惁瀛樺湪寮傛瀛愭祦绋�")
+    @GetMapping("/AnySubFlow/{id}")
+    public ActionResult<Object> checkAsync(@PathVariable("id") String id) {
+        return ActionResult.success(taskService.checkAsync(id));
+    }
+
+    /**
+     * 鏆傚仠
+     *
+     * @param id        涓婚敭
+     * @param flowModel 鍙傛暟
+     */
+    @Operation(summary = "鏆傚仠")
+    @PostMapping("/Pause/{id}")
+    @SaCheckPermission(value = {"workFlow.flowMonitor"})
+    public ActionResult<String> pause(@PathVariable("id") String id, @RequestBody FlowModel flowModel) throws WorkFlowException {
+        taskService.pause(id, flowModel, true);
+        operatorUtil.handleTaskStatus();
+        return ActionResult.success(MsgCode.WF074.get());
+    }
+
+    /**
+     * 鎭㈠
+     *
+     * @param id        涓婚敭
+     * @param flowModel 鍙傛暟
+     */
+    @Operation(summary = "鎭㈠")
+    @PostMapping("/Reboot/{id}")
+    @SaCheckPermission(value = {"workFlow.flowMonitor"})
+    public ActionResult<String> reboot(@PathVariable("id") String id, @RequestBody FlowModel flowModel) throws WorkFlowException {
+        taskService.pause(id, flowModel, false);
+        operatorUtil.handleTaskStatus();
+        return ActionResult.success(MsgCode.WF016.get());
+    }
+
+    /**
+     * 缁堟
+     *
+     * @param id        浠诲姟涓婚敭
+     * @param flowModel 鍙傛暟
+     */
+    @Operation(summary = "缁堟")
+    @PostMapping("/Cancel/{id}")
+    @SaCheckPermission(value = {"workFlow.flowMonitor"})
+    public ActionResult<String> cancel(@PathVariable("id") String id, @RequestBody FlowModel flowModel) throws WorkFlowException {
+        taskService.cancel(id, flowModel, true);
+        operatorUtil.handleTaskStatus();
+        return ActionResult.success(MsgCode.SU009.get());
+    }
+
+    /**
+     * 澶嶆椿
+     *
+     * @param id        浠诲姟涓婚敭
+     * @param flowModel 鍙傛暟
+     */
+    @Operation(summary = "澶嶆椿")
+    @PostMapping("/Activate/{id}")
+    @SaCheckPermission(value = {"workFlow.flowMonitor"})
+    public ActionResult<String> activate(@PathVariable("id") String id, @RequestBody FlowModel flowModel) throws WorkFlowException {
+        taskService.cancel(id, flowModel, false);
+        operatorUtil.handleTaskStatus();
+        return ActionResult.success(MsgCode.WF013.get());
+    }
+
+    /**
+     * 鎸囨淳
+     *
+     * @param id        涓婚敭
+     * @param flowModel 鍙傛暟
+     */
+    @Operation(summary = "鎸囨淳")
+    @PostMapping("/Assign/{id}")
+    @SaCheckPermission(value = {"workFlow.flowMonitor"})
+    public ActionResult<String> assign(@PathVariable("id") String id, @RequestBody FlowModel flowModel) throws WorkFlowException {
+        taskService.assign(id, flowModel);
+        operatorUtil.handleOperator();
+        return ActionResult.success(MsgCode.WF010.get());
+    }
+
+    /**
+     * 鑾峰彇鎴戠殑寰呭姙
+     *
+     * @return
+     */
+    @Operation(summary = "鑾峰彇鎴戠殑寰呭姙")
+    @PostMapping("/FlowTodoCount")
+    public ActionResult<Object> getFlowTodoCount(@RequestBody TaskTo taskTo) {
+        AuthorizeVO authorize = serviceUtil.getAuthorizeByUser();
+        taskTo.setModuleList(authorize.getModuleList());
+        TaskTo vo = taskService.getFlowTodoCount(taskTo);
+        return ActionResult.success(vo);
+    }
+
+    /**
+     * 鑾峰彇寰呭姙浜嬮」
+     *
+     * @return
+     */
+    @Operation(summary = "鑾峰彇寰呭姙浜嬮」")
+    @GetMapping("/FlowTodo")
+    public ActionResult<Object> getFlowTodo(@RequestParam("type") String type) {
+        TaskPagination pagination = new TaskPagination();
+        pagination.setDelegateType(true);
+        pagination.setPageSize(10L);
+        pagination.setCurrentPage(1L);
+        pagination.setCategory(type);
+        FlowTodoVO flowTodo = taskService.getFlowTodo(pagination);
+        return ActionResult.success(flowTodo);
+    }
+
+}

--
Gitblit v1.8.0