瀏覽代碼

流程修改

wangliang 3 年之前
父節點
當前提交
054c55e37b

+ 45 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/FlowApproveParam.java

@@ -0,0 +1,45 @@
+package com.qmth.distributed.print.business.bean.params;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.teachcloud.common.base.BasePage;
+import io.swagger.annotations.ApiModelProperty;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+/**
+ * @Description: 流程审批参数
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2021/8/6
+ */
+public class FlowApproveParam implements Serializable {
+
+    @ApiModelProperty(value = "流程id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    @NotNull(message = "流程id不能为空")
+    private Long flowId;
+
+    @ApiModelProperty(value = "是否启用,0:停用,1:启用")
+    @NotNull(message = "启用/禁用不能为空")
+    private Boolean enable;
+
+    public Long getFlowId() {
+        return flowId;
+    }
+
+    public void setFlowId(Long flowId) {
+        this.flowId = flowId;
+    }
+
+    public Boolean getEnable() {
+        return enable;
+    }
+
+    public void setEnable(Boolean enable) {
+        this.enable = enable;
+    }
+}

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/TaskApproveResult.java → distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/FlowApproveResult.java

@@ -18,7 +18,7 @@ import java.util.Objects;
  * @Date: 2021/8/5
  */
 @JsonInclude(JsonInclude.Include.NON_NULL)
-public class TaskApproveResult extends TFFlowApproveLog implements Serializable {
+public class FlowApproveResult extends TFFlowApproveLog implements Serializable {
 
     @ApiModelProperty(value = "发起人名称")
     private String startName;

+ 73 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/FlowTaskResult.java

@@ -0,0 +1,73 @@
+package com.qmth.distributed.print.business.bean.result;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 流程节点result
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2021/8/6
+ */
+public class FlowTaskResult implements Serializable {
+
+    @ApiModelProperty(value = "流程id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long flowId;
+
+    @ApiModelProperty(value = "流程节点名称")
+    private String taskName;
+
+    @ApiModelProperty(value = "流程节点key")
+    private String taskKey;
+
+    @ApiModelProperty(value = "流程节点步骤")
+    private Integer setup;
+
+    public FlowTaskResult() {
+
+    }
+
+    public FlowTaskResult(Long flowId, String taskName, String taskKey, Integer setup) {
+        this.flowId = flowId;
+        this.taskName = taskName;
+        this.taskKey = taskKey;
+        this.setup = setup;
+    }
+
+    public Long getFlowId() {
+        return flowId;
+    }
+
+    public void setFlowId(Long flowId) {
+        this.flowId = flowId;
+    }
+
+    public String getTaskName() {
+        return taskName;
+    }
+
+    public void setTaskName(String taskName) {
+        this.taskName = taskName;
+    }
+
+    public String getTaskKey() {
+        return taskKey;
+    }
+
+    public void setTaskKey(String taskKey) {
+        this.taskKey = taskKey;
+    }
+
+    public Integer getSetup() {
+        return setup;
+    }
+
+    public void setSetup(Integer setup) {
+        this.setup = setup;
+    }
+}

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TFFlowApprove.java

@@ -43,7 +43,7 @@ public class TFFlowApprove extends BaseEntity implements Serializable {
     @JsonSerialize(using = ToStringSerializer.class)
     private Long approveId;
 
-    @ApiModelProperty(value = "状态,DRAFT:草稿,TO_BE_SUBMIT:待提交,SUBMIT:已提交,AUDITING:审核中,REJECT:已驳回,END:已终止,FINISH:已结束")
+    @ApiModelProperty(value = "状态,START:已开始,AUDITING:审核中,REJECT:已驳回,END:已终止,FINISH:已结束")
     private FlowStatusEnum status;
 
     @ApiModelProperty(value = "计划步骤")

+ 3 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TFFlowMapper.java

@@ -2,7 +2,7 @@ package com.qmth.distributed.print.business.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.qmth.distributed.print.business.bean.result.TaskApproveResult;
+import com.qmth.distributed.print.business.bean.result.FlowApproveResult;
 import com.qmth.distributed.print.business.entity.TFFlow;
 import org.apache.ibatis.annotations.Param;
 
@@ -33,10 +33,10 @@ public interface TFFlowMapper extends BaseMapper<TFFlow> {
      * 流程审批记录列表
      *
      * @param iPage
-     * @param teacherName
+     * @param startName
      * @param schoolId
      * @param orgId
      * @return
      */
-    IPage<TaskApproveResult> taskApproveList(IPage<Map> iPage, @Param("teacherName") String teacherName, @Param("schoolId") Long schoolId, @Param("orgId") Long orgId);
+    IPage<FlowApproveResult> flowApproveList(IPage<Map> iPage, @Param("startName") String startName, @Param("schoolId") Long schoolId, @Param("orgId") Long orgId);
 }

+ 12 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ActivitiService.java

@@ -1,9 +1,11 @@
 package com.qmth.distributed.print.business.service;
 
+import com.qmth.distributed.print.business.bean.result.FlowTaskResult;
 import org.activiti.engine.runtime.ProcessInstance;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -50,11 +52,11 @@ public interface ActivitiService {
     void complete(String taskId);
 
     /**
-     * 删除流程
+     * 流程终止
      *
      * @param flowId
      */
-    void deleteProcessInstance(String flowId);
+    public void flowEnd(String flowId);
 
     /**
      * 流程启动
@@ -69,4 +71,12 @@ public interface ActivitiService {
      * @param map
      */
     public void taskApprove(Map<String, Object> map);
+
+    /**
+     * 获取所有流程节点
+     *
+     * @param flowId
+     * @return
+     */
+    public List<FlowTaskResult> getTaskAll(String flowId);
 }

+ 3 - 4
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TFFlowService.java

@@ -2,9 +2,8 @@ package com.qmth.distributed.print.business.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.qmth.distributed.print.business.bean.result.TaskApproveResult;
+import com.qmth.distributed.print.business.bean.result.FlowApproveResult;
 import com.qmth.distributed.print.business.entity.TFFlow;
-import com.qmth.teachcloud.common.entity.SysRole;
 
 import java.util.Map;
 
@@ -33,10 +32,10 @@ public interface TFFlowService extends IService<TFFlow> {
      * 流程审批记录列表
      *
      * @param iPage
-     * @param teacherName
+     * @param startName
      * @param schoolId
      * @param orgId
      * @return
      */
-    public IPage<TaskApproveResult> taskApproveList(IPage<Map> iPage, String teacherName, Long schoolId, Long orgId);
+    public IPage<FlowApproveResult> flowApproveList(IPage<Map> iPage, String startName, Long schoolId, Long orgId);
 }

+ 63 - 15
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ActivitiServiceImpl.java

@@ -2,6 +2,7 @@ package com.qmth.distributed.print.business.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.qmth.boot.api.exception.ApiException;
+import com.qmth.distributed.print.business.bean.result.FlowTaskResult;
 import com.qmth.distributed.print.business.entity.ExamTask;
 import com.qmth.distributed.print.business.entity.TFFlowApprove;
 import com.qmth.distributed.print.business.entity.TFFlowApproveLog;
@@ -14,9 +15,8 @@ import com.qmth.teachcloud.common.enums.*;
 import com.qmth.teachcloud.common.util.RedisUtil;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
-import org.activiti.bpmn.model.BpmnModel;
-import org.activiti.bpmn.model.FlowNode;
-import org.activiti.bpmn.model.UserTask;
+import org.activiti.bpmn.model.*;
+import org.activiti.bpmn.model.Process;
 import org.activiti.engine.HistoryService;
 import org.activiti.engine.RepositoryService;
 import org.activiti.engine.RuntimeService;
@@ -35,10 +35,7 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.annotation.Resource;
 import java.io.File;
 import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
 
 /**
  * @Description: activiti service impl
@@ -52,13 +49,13 @@ public class ActivitiServiceImpl implements ActivitiService {
     private final static Logger log = LoggerFactory.getLogger(ActivitiServiceImpl.class);
 
     @Resource
-    private RuntimeService runtimeService;
+    RuntimeService runtimeService;
 
     @Resource
-    private TaskService taskService;
+    TaskService taskService;
 
     @Resource
-    private RepositoryService repositoryService;
+    RepositoryService repositoryService;
 
     @Resource
     TFFlowApproveService tfFlowApproveService;
@@ -176,8 +173,28 @@ public class ActivitiServiceImpl implements ActivitiService {
      * @param flowId
      */
     @Override
-    public void deleteProcessInstance(String flowId) {
-        runtimeService.deleteProcessInstance(flowId, "结束");
+    @Transactional
+    public void flowEnd(String flowId) {
+        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+        runtimeService.deleteProcessInstance(flowId, FlowGdykdxApproveSetupEnum.END.getTitle());
+        //流程审批
+        QueryWrapper<TFFlowApprove> tfFlowApproveQueryWrapper = new QueryWrapper<>();
+        tfFlowApproveQueryWrapper.lambda().eq(TFFlowApprove::getFlowId, Long.parseLong(flowId));
+        TFFlowApprove tfFlowApprove = tfFlowApproveService.getOne(tfFlowApproveQueryWrapper);
+        if (Objects.isNull(tfFlowApprove)) {
+            tfFlowApprove = new TFFlowApprove(sysUser.getSchoolId(), sysUser.getOrgId(), Long.parseLong(flowId), sysUser.getId(), FlowStatusEnum.END, sysUser.getId());
+        } else {
+            tfFlowApprove.setStatus(FlowStatusEnum.END);
+            tfFlowApprove.setSetup(FlowGdykdxApproveSetupEnum.END.getSetup());
+        }
+        tfFlowApproveService.saveOrUpdate(tfFlowApprove);
+
+        //流程流水日志
+        QueryWrapper<ExamTask> examTaskQueryWrapper = new QueryWrapper<>();
+        examTaskQueryWrapper.lambda().eq(ExamTask::getFlowId, Long.parseLong(flowId));
+        ExamTask examTask = examTaskService.getOne(examTaskQueryWrapper);
+        TFFlowLog tfFlowLog = new TFFlowLog(sysUser.getSchoolId(), sysUser.getOrgId(), Long.parseLong(flowId), examTask.getId(), sysUser.getId(), sysUser.getId(), FlowGdykdxApproveSetupEnum.END.getTitle());
+        tfFlowLogService.save(tfFlowLog);
     }
 
     /**
@@ -238,12 +255,12 @@ public class ActivitiServiceImpl implements ActivitiService {
 
                 //流程审批
                 QueryWrapper<TFFlowApprove> tfFlowApproveQueryWrapper = new QueryWrapper<>();
-                tfFlowApproveQueryWrapper.lambda().eq(TFFlowApprove::getFlowId, processInstanceId);
+                tfFlowApproveQueryWrapper.lambda().eq(TFFlowApprove::getFlowId, Long.parseLong(processInstanceId));
                 TFFlowApprove tfFlowApprove = tfFlowApproveService.getOne(tfFlowApproveQueryWrapper);
 
                 //流程审批记录
                 QueryWrapper<TFFlowApproveLog> tfFlowApproveLogQueryWrapper = new QueryWrapper<>();
-                tfFlowApproveLogQueryWrapper.lambda().eq(TFFlowApproveLog::getFlowId, processInstanceId)
+                tfFlowApproveLogQueryWrapper.lambda().eq(TFFlowApproveLog::getFlowId, Long.parseLong(processInstanceId))
                         .eq(TFFlowApproveLog::getTaskId, examTask.getId());
                 TFFlowApproveLog tfFlowApproveLog = tfFlowApproveLogService.getOne(tfFlowApproveLogQueryWrapper);
 
@@ -253,6 +270,7 @@ public class ActivitiServiceImpl implements ActivitiService {
                     //广东医科大学流程
                     if (Objects.nonNull(processDefinitionEntity) && processDefinitionEntity.getKey().contains(SystemConstant.GDYKDX_FLOW_KEY)) {
                         String remark = Objects.nonNull(map.get(SystemConstant.APPROVE_REMARK)) ? map.get(SystemConstant.APPROVE_REMARK).toString() : null;
+                        //流程流水日志
                         tfFlowLog = new TFFlowLog(sysUser.getSchoolId(), sysUser.getOrgId(), Long.parseLong(processInstanceId), examTask.getId(), sysUser.getId(), sysUser.getId(), remark);
                         FlowGdykdxApproveSetupEnum setupEnum = FlowGdykdxApproveSetupEnum.convertToInstance(userTask.getId());
                         if (setupEnum == FlowGdykdxApproveSetupEnum.SUBMIT) {//命题提交
@@ -333,7 +351,7 @@ public class ActivitiServiceImpl implements ActivitiService {
                                 tfFlowLog.setApproveOperation(FlowApproveOperationEnum.APPROVE);
                                 tfFlowApproveLog.setSecondApproveOperation(FlowApproveOperationEnum.APPROVE);
                                 tfFlowApprove.setStatus(FlowStatusEnum.FINISH);
-                                tfFlowApprove.setSetup(FlowGdykdxApproveSetupEnum.END.getSetup());
+                                tfFlowApprove.setSetup(FlowGdykdxApproveSetupEnum.FINISH.getSetup());
                             } else {
                                 throw ExceptionResultEnum.ERROR.exception("流程变量值错误");
                             }
@@ -371,4 +389,34 @@ public class ActivitiServiceImpl implements ActivitiService {
             }
         }
     }
+
+    /**
+     * 获取所有流程节点
+     *
+     * @param flowId
+     * @return
+     */
+    @Override
+    public List<FlowTaskResult> getTaskAll(String flowId) {
+        String processDefinitionId = historyService.createHistoricProcessInstanceQuery().processInstanceId(flowId).singleResult().getProcessDefinitionId();
+        ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(processDefinitionId);
+        BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
+        Process process = bpmnModel.getProcessById(processDefinitionEntity.getKey());
+        Collection<FlowElement> flowElements = process.getFlowElements();
+        List<FlowTaskResult> flowTaskResultList = new ArrayList<>();
+        for (FlowElement flowElement : flowElements) {
+            //假设是任务节点
+            if (flowElement instanceof UserTask) {
+                UserTask userTask = (UserTask) flowElement;
+                if (Objects.nonNull(userTask)) {
+                    //广东医科大学流程
+                    if (Objects.nonNull(processDefinitionEntity) && processDefinitionEntity.getKey().contains(SystemConstant.GDYKDX_FLOW_KEY)) {
+                        FlowGdykdxApproveSetupEnum flowGdykdxApproveSetupEnum = FlowGdykdxApproveSetupEnum.convertToInstance(userTask.getId());
+                        flowTaskResultList.add(new FlowTaskResult(Long.parseLong(flowId), userTask.getName(), flowGdykdxApproveSetupEnum.getId(), flowGdykdxApproveSetupEnum.getSetup()));
+                    }
+                }
+            }
+        }
+        return flowTaskResultList;
+    }
 }

+ 4 - 4
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TFFlowServiceImpl.java

@@ -2,7 +2,7 @@ package com.qmth.distributed.print.business.service.impl;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.qmth.distributed.print.business.bean.result.TaskApproveResult;
+import com.qmth.distributed.print.business.bean.result.FlowApproveResult;
 import com.qmth.distributed.print.business.entity.TFFlow;
 import com.qmth.distributed.print.business.mapper.TFFlowMapper;
 import com.qmth.distributed.print.business.service.TFFlowService;
@@ -43,13 +43,13 @@ public class TFFlowServiceImpl extends ServiceImpl<TFFlowMapper, TFFlow> impleme
      * 流程审批记录列表
      *
      * @param iPage
-     * @param teacherName
+     * @param startName
      * @param schoolId
      * @param orgId
      * @return
      */
     @Override
-    public IPage<TaskApproveResult> taskApproveList(IPage<Map> iPage, String teacherName, Long schoolId, Long orgId) {
-        return tfFlowMapper.taskApproveList(iPage, teacherName, schoolId, orgId);
+    public IPage<FlowApproveResult> flowApproveList(IPage<Map> iPage, String startName, Long schoolId, Long orgId) {
+        return tfFlowMapper.flowApproveList(iPage, startName, schoolId, orgId);
     }
 }

+ 44 - 2
distributed-print-business/src/main/resources/mapper/TFFlowMapper.xml

@@ -17,7 +17,49 @@
         </where>
     </select>
 
-    <select id="taskApproveList" resultType="com.qmth.distributed.print.business.bean.result.TaskApproveResult">
-
+    <select id="flowApproveList" resultType="com.qmth.distributed.print.business.bean.result.FlowApproveResult">
+        select
+            tffal.flow_id as flowId,
+            tffal.task_id as taskId,
+            tffal.start_id as startId,
+            su.real_name as startName,
+            tffal.create_time as createTime,
+            tffal.primary_approve_id as primaryApproveId,
+            (
+            select
+                t.real_name
+            from
+                sys_user t
+            where
+                t.id = tffal.primary_approve_id) as primaryApproveName,
+            tffal.primary_approve_remark as primaryApproveRemark,
+            tffal.second_approve_id as secondApproveId,
+            (
+            select
+                t.real_name
+            from
+                sys_user t
+            where
+                t.id = tffal.second_approve_id) as secondApproveName,
+            tffal.second_approve_remark as secondApproveRemark,
+            tffa.status
+        from
+            t_f_flow_approve_log tffal
+        left join t_f_flow_approve tffa on tffa.flow_id = tffal.flow_id
+        left join sys_user su on su.id = tffal.start_id
+        <where>
+            <if test="startName != null and startName != ''">
+                and su.real_name like concat('%',#{startName},'%')
+            </if>
+            <if test="schoolId != null and schoolId != ''">
+                and tffal.school_id = #{schoolId}
+            </if>
+            <if test="orgId != null and orgId != ''">
+                and tffal.org_id = #{orgId}
+            </if>
+            and tffal.enable = 1
+        </where>
+        order by
+            tffal.create_time desc
     </select>
 </mapper>

+ 56 - 17
distributed-print/src/main/java/com/qmth/distributed/print/api/TFFlowController.java

@@ -6,11 +6,14 @@ import com.qmth.boot.api.annotation.Aac;
 import com.qmth.boot.api.annotation.BOOL;
 import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.boot.api.exception.ApiException;
+import com.qmth.distributed.print.business.bean.params.FlowApproveParam;
 import com.qmth.distributed.print.business.bean.result.EditResult;
-import com.qmth.distributed.print.business.bean.result.TaskApproveResult;
+import com.qmth.distributed.print.business.bean.result.FlowApproveResult;
 import com.qmth.distributed.print.business.entity.TFFlow;
+import com.qmth.distributed.print.business.entity.TFFlowApproveLog;
 import com.qmth.distributed.print.business.service.ActivitiService;
 import com.qmth.distributed.print.business.service.PrintCommonService;
+import com.qmth.distributed.print.business.service.TFFlowApproveLogService;
 import com.qmth.distributed.print.business.service.TFFlowService;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.BasicAttachment;
@@ -28,13 +31,12 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.dao.DuplicateKeyException;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
+import javax.validation.Valid;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Objects;
@@ -66,9 +68,12 @@ public class TFFlowController {
     @Resource
     TFFlowService tfFlowService;
 
+    @Resource
+    TFFlowApproveLogService tfFlowApproveLogService;
+
     @ApiOperation(value = "注册流程")
     @Transactional
-    @ApiResponses({@ApiResponse(code = 200, message = "用户信息", response = ResultUtil.class)})
+    @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
     @RequestMapping(value = "/register", method = RequestMethod.POST)
     public Result register(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file,
                            @ApiParam(value = "上传文件类型", required = true) @RequestParam UploadFileEnum type,
@@ -109,7 +114,7 @@ public class TFFlowController {
     }
 
     @ApiOperation(value = "发布流程")
-    @ApiResponses({@ApiResponse(code = 200, message = "用户信息", response = ResultUtil.class)})
+    @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
     @RequestMapping(value = "/publish", method = RequestMethod.POST)
     public Result publish(@ApiParam(value = "流程文件id", required = true) @RequestParam String id) {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
@@ -122,7 +127,7 @@ public class TFFlowController {
     }
 
     @ApiOperation(value = "流程列表")
-    @ApiResponses({@ApiResponse(code = 200, message = "用户信息", response = TFFlow.class)})
+    @ApiResponses({@ApiResponse(code = 200, message = "流程信息", response = TFFlow.class)})
     @RequestMapping(value = "/list", method = RequestMethod.POST)
     public Result list(@ApiParam(value = "流程名称", required = false) @RequestParam(required = false) String name,
                        @ApiParam(value = "页码", required = true) @RequestParam Integer pageNumber,
@@ -132,12 +137,12 @@ public class TFFlowController {
     }
 
     @ApiOperation(value = "审批流程")
-    @ApiResponses({@ApiResponse(code = 200, message = "用户信息", response = ResultUtil.class)})
+    @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
     @RequestMapping(value = "/task/approve", method = RequestMethod.POST)
-    public Result teachTaskList(@ApiParam(value = "流程任务id", required = true) @RequestParam String taskId,
-                                @ApiParam(value = "流程审批操作", required = false) @RequestParam(required = false) FlowApprovePassEnum approvePass,
-                                @ApiParam(value = "流程审核意见", required = false) @RequestParam(required = false) String remark,
-                                @ApiParam(value = "流程驳回节点", required = false) @RequestParam(required = false) Integer setup) {
+    public Result taskApprove(@ApiParam(value = "流程任务id", required = true) @RequestParam String taskId,
+                              @ApiParam(value = "流程审批操作", required = false) @RequestParam(required = false) FlowApprovePassEnum approvePass,
+                              @ApiParam(value = "流程审核意见", required = false) @RequestParam(required = false) String remark,
+                              @ApiParam(value = "流程驳回节点", required = false) @RequestParam(required = false) Integer setup) {
         Map<String, Object> map = new HashMap<>();
         map.computeIfAbsent(SystemConstant.FLOW_TASK_ID, v -> taskId);
         map.computeIfAbsent(SystemConstant.APPROVE_OPERATION, v -> approvePass);
@@ -148,12 +153,46 @@ public class TFFlowController {
     }
 
     @ApiOperation(value = "流程审批记录列表")
-    @ApiResponses({@ApiResponse(code = 200, message = "用户信息", response = TaskApproveResult.class)})
-    @RequestMapping(value = "/task/approve/list", method = RequestMethod.POST)
-    public Result taskApproveList(@ApiParam(value = "发起人名称", required = false) @RequestParam(required = false) String teacherName,
+    @ApiResponses({@ApiResponse(code = 200, message = "流程审批记录信息", response = FlowApproveResult.class)})
+    @RequestMapping(value = "/approve/list", method = RequestMethod.POST)
+    public Result taskApproveList(@ApiParam(value = "发起人名称", required = false) @RequestParam(required = false) String startName,
                                   @ApiParam(value = "页码", required = true) @RequestParam Integer pageNumber,
                                   @ApiParam(value = "数量", required = true) @RequestParam Integer pageSize) {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        return ResultUtil.ok(tfFlowService.taskApproveList(new Page<>(pageNumber, pageSize), teacherName, SystemConstant.getHeadOrUserSchoolId(), sysUser.getOrgId()));
+        return ResultUtil.ok(tfFlowService.flowApproveList(new Page<>(pageNumber, pageSize), startName, SystemConstant.getHeadOrUserSchoolId(), sysUser.getOrgId()));
+    }
+
+    /**
+     * 流程审批记录启用/禁用
+     *
+     * @param flowApproveParam
+     * @return
+     */
+    @ApiOperation(value = "流程审批记录启用/禁用")
+    @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
+    @RequestMapping(value = "/approve/enable", method = RequestMethod.POST)
+    public Result enable(@Valid @RequestBody FlowApproveParam flowApproveParam, BindingResult bindingResult) {
+        if (bindingResult.hasErrors()) {
+            return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
+        }
+        UpdateWrapper<TFFlowApproveLog> tfFlowApproveLogUpdateWrapper = new UpdateWrapper<>();
+        tfFlowApproveLogUpdateWrapper.lambda().eq(TFFlowApproveLog::getFlowId, flowApproveParam.getFlowId())
+                .set(TFFlowApproveLog::getEnable, flowApproveParam.getEnable());
+        return ResultUtil.ok(tfFlowApproveLogService.update(tfFlowApproveLogUpdateWrapper));
+    }
+
+    @ApiOperation(value = "流程终止")
+    @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
+    @RequestMapping(value = "/end", method = RequestMethod.POST)
+    public Result end(@ApiParam(value = "流程id", required = true) @RequestParam String flowId) {
+        activitiService.flowEnd(flowId);
+        return ResultUtil.ok();
+    }
+
+    @ApiOperation(value = "获取所有流程节点")
+    @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
+    @RequestMapping(value = "/task/all", method = RequestMethod.POST)
+    public Result taskAll(@ApiParam(value = "流程id", required = true) @RequestParam String flowId) {
+        return ResultUtil.ok(activitiService.getTaskAll(flowId));
     }
 }

+ 3 - 1
teachcloud-common/src/main/java/com/qmth/teachcloud/common/enums/FlowGdykdxApproveSetupEnum.java

@@ -17,7 +17,9 @@ public enum FlowGdykdxApproveSetupEnum {
 
     SECOND_APPROVE("二级审核", "usertask3", 3),
 
-    END("已结束或已终止", null, -1);
+    END("已终止", null, -1),
+
+    FINISH("已结束", null, 0);
 
     private String title;