whycxzp
2021-11-08 9c4620dd3e6c7fd246f590b4ac6575a0bbc9292d
更新流程动作接口
2个文件已修改
41 ■■■■ 已修改文件
src/main/java/com/whyc/controller/WorkflowActionController.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/WorkflowActionService.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/WorkflowActionController.java
@@ -1,8 +1,10 @@
package com.whyc.controller;
import com.whyc.dto.Response;
import com.whyc.pojo.UserInf;
import com.whyc.pojo.WorkflowAction;
import com.whyc.service.WorkflowActionService;
import com.whyc.util.ActionUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@@ -34,10 +36,21 @@
        return new Response().setII(1,"更新成功");
    }
    @GetMapping("actionTypeList")
    @ApiOperation(value = "查询动作类型列表")
    public Response<List<WorkflowAction>> getActionTypeList(@RequestParam Integer type,@RequestParam Integer linkType){
        List<WorkflowAction> actionTypeList = service.getActionTypeList(type,linkType);
    @GetMapping("actionTypeList4Link")
    @ApiOperation(value = "查询节点的动作类型列表")
    public Response<List<WorkflowAction>> getActionTypeList4Link(@RequestParam Integer type,@RequestParam Integer linkType){
        List<WorkflowAction> actionTypeList = service.getActionTypeList4Link(type,linkType);
        return new Response<List<WorkflowAction>>().set(1,actionTypeList);
    }
    /**
     * @see com.whyc.constant.RoleEnum 用户角色说明
     */
    @GetMapping("actionTypeList4Role")
    @ApiOperation(value = "查询动作列表")
    public Response getActionTypeList(@RequestParam Integer type,@RequestBody Integer status){
        int userRole = ActionUtil.getUser().getURole();
        List<WorkflowAction> actionTypeList = service.getActionTypeList(type,status,userRole);
        return new Response<List<WorkflowAction>>().set(1,actionTypeList);
    }
}
src/main/java/com/whyc/service/WorkflowActionService.java
@@ -61,11 +61,29 @@
        mapper.insertBatchSomeColumn(actionList);
    }
    public List<WorkflowAction> getActionTypeList(Integer type, Integer linkType) {
    public List<WorkflowAction> getActionTypeList4Link(Integer type, Integer linkType) {
        QueryWrapper<WorkflowAction> wrapper = Wrappers.query();
        wrapper.eq("type",type)
                .eq("link_type",linkType);
        //Map<Integer, List<WorkflowAction>> collect = mapper.selectList(wrapper).stream().collect(Collectors.groupingBy(WorkflowAction::getRoleType));
        return mapper.selectList(wrapper);
    }
    public List<WorkflowAction> getActionTypeList(Integer type, Integer status, int userRole) {
        QueryWrapper<WorkflowAction> wrapper = Wrappers.query();
        Integer linkType = null;
        //Map<Integer, List<WorkflowAction>> collect = mapper.selectList(wrapper).stream().collect(Collectors.groupingBy(WorkflowAction::getRoleType));
        //表示处于1级节点
        if(status == 2 ||status ==3){
            linkType = 1;
        }
        else if(status ==4){ //表示处于2级节点
            linkType = 2;
        }
        wrapper.select("action_type")
                .eq("type",type)
                .eq("link_type",linkType)
                .eq("role_id",userRole);
        return mapper.selectList(wrapper);
    }
}