jinlin
2023-11-03 35435e8b1995e6775c82b86652381e07e3faff54
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
package com.zt.modules.workflowconfig.controller;
 
 
import com.zt.common.annotation.LogOperation;
import com.zt.common.annotation.QueryParam;
import com.zt.common.constant.Constant;
import com.zt.common.db.query.QueryFilter;
import com.zt.common.servlet.PageResult;
import com.zt.common.servlet.Result;
import com.zt.common.validator.AssertUtils;
import com.zt.common.validator.ValidatorUtils;
import com.zt.common.validator.group.AddGroup;
import com.zt.common.validator.group.DefaultGroup;
import com.zt.common.validator.group.UpdateGroup;
import com.zt.modules.workflowconfig.model.WfDef;
import com.zt.modules.workflowconfig.model.WfDefStep;
import com.zt.modules.workflowconfig.service.WorkflowConfigService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
 
import java.util.List;
 
/**
 * @author 杨凯
 */
@RestController
@RequestMapping("/workflowConfig")
public class WorkflowConfigController {
 
    @Autowired
    private WorkflowConfigService workflowConfigService;
 
    /**
     * 根据id查询流程配置列表
     * @param queryFilter
     * @return
     */
    @GetMapping("queryStepsList")
    @ApiOperation("流程配置列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = Constant.Q.PAGE, value = Constant.QV.PAGE, required = true, dataType = Constant.QT.INT),
            @ApiImplicitParam(name = Constant.Q.LIMIT, value = Constant.QV.LIMIT, required = true, dataType = Constant.QT.INT),
            @ApiImplicitParam(name = "id", value = "id", dataType = Constant.QT.LONG, format = "a.id^EQ"),
    })
    public PageResult<WfDefStep> queryStepsList(@ApiIgnore @QueryParam QueryFilter queryFilter){
        List<WfDefStep> wfDefStepsList = workflowConfigService.queryStepsList(queryFilter);
        return PageResult.ok(wfDefStepsList);
    }
 
    @RequestMapping(value = "workflowSelect", method = {RequestMethod.GET,RequestMethod.POST})
    @ApiOperation("工作流名称下拉")
    public Result<List<WfDef>> selectList(){
        List<WfDef> wfDefList = workflowConfigService.workflowSelect();
        return Result.ok(wfDefList);
    }
 
 
    @RequestMapping(value = "getWorkflowStepsListById", method = {RequestMethod.GET,RequestMethod.POST})
    @ApiOperation("按 ID 获取工作流程步骤列表")
    public Result<WfDefStep> getWorkflowStepsListById(Long id){
        WfDefStep workflowStepsListById = workflowConfigService.getWorkflowStepsListById(id);
        return Result.ok(workflowStepsListById);
    }
 
 
 
    @PostMapping
    @ApiOperation("新增")
    @LogOperation("流程步骤新增")
    public Result insert(@RequestBody WfDefStep wfDefStep) {
        // 效验数据
        ValidatorUtils.validateEntity(wfDefStep, AddGroup.class, DefaultGroup.class);
        workflowConfigService.insert(wfDefStep);
        return Result.ok();
    }
 
    @PutMapping
    @ApiOperation("修改")
    @LogOperation("流程步骤修改")
    public Result update(@RequestBody WfDefStep wfDefStep) {
        // 效验数据
        ValidatorUtils.validateEntity(wfDefStep, UpdateGroup.class, DefaultGroup.class);
 
        workflowConfigService.update(wfDefStep);
        return Result.ok();
    }
 
    @DeleteMapping("{id}")
    @ApiOperation("删除")
    @LogOperation("流程步骤--->删除")
    public Result delete(@PathVariable("id") Long id) {
 
        workflowConfigService.deleteLogic(id);
        return Result.ok();
    }
 
 
    @RequestMapping(value = "getUserByWorkflowSteps", method = {RequestMethod.GET,RequestMethod.POST})
    @ApiOperation("根据工作流步骤获取用户")
    public PageResult<WfDefStep> getUserByWorkflowSteps(Long id){
        List<WfDefStep> userLists = workflowConfigService.getUserByWorkflowSteps(id);
        return PageResult.ok(userLists);
    }
 
 
    @RequestMapping(value = "getUserList", method = {RequestMethod.GET,RequestMethod.POST})
    @ApiOperation("获取用户列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = Constant.Q.PAGE, value = Constant.QV.PAGE, required = true, dataType = Constant.QT.INT),
            @ApiImplicitParam(name = Constant.Q.LIMIT, value = Constant.QV.LIMIT, required = true, dataType = Constant.QT.INT),
            @ApiImplicitParam(name = "userName", value = "用户名", dataType = Constant.QT.STRING, format = "a.user_name^Lk"),
            @ApiImplicitParam(name = "stepId", value = "流程步骤Id", dataType = Constant.QT.LONG, format = "b.id^EQ")
    })
    public PageResult<WfDefStep> getUserList(@ApiIgnore @QueryParam QueryFilter queryFilter){
        List<WfDefStep> userList = workflowConfigService.getUserList(queryFilter);
        return PageResult.ok(userList);
    }
 
 
    @RequestMapping(value = "addWorkflowStepsUser", method = {RequestMethod.GET,RequestMethod.POST})
    @ApiOperation("添加流程步骤用户")
    public Result<List<WfDefStep>> addWorkflowStepsUser(String userId ,Long stepId){
        workflowConfigService.addWorkflowStepsUser(userId,stepId);
        return Result.ok();
    }
 
    @RequestMapping(value = "deleteWorkflowStepsUser", method = {RequestMethod.GET,RequestMethod.POST})
    @ApiOperation("删除流程步骤用户")
    public Result<List<WfDefStep>> deleteWorkflowStepsUser(String userId, String stepId){
        workflowConfigService.deleteWorkflowStepsUser(userId,stepId);
        return Result.ok();
    }
 
 
    @RequestMapping(value = "getRoleByWorkflowSteps", method = {RequestMethod.GET,RequestMethod.POST})
    @ApiOperation("根据工作流步骤获取用户")
    public PageResult<WfDefStep> getRoleByWorkflowSteps(Long id){
        List<WfDefStep> roleLists = workflowConfigService.getRoleByWorkflowSteps(id);
        return PageResult.ok(roleLists);
    }
 
 
    @RequestMapping(value = "getRoleList", method = {RequestMethod.GET,RequestMethod.POST})
    @ApiOperation("获取用户列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = Constant.Q.PAGE, value = Constant.QV.PAGE, required = true, dataType = Constant.QT.INT),
            @ApiImplicitParam(name = Constant.Q.LIMIT, value = Constant.QV.LIMIT, required = true, dataType = Constant.QT.INT),
            @ApiImplicitParam(name = "roleName", value = "用户名", dataType = Constant.QT.STRING, format = "a.role_name^Lk"),
            @ApiImplicitParam(name = "stepId", value = "流程步骤Id", dataType = Constant.QT.LONG, format = "b.id^EQ")
    })
    public PageResult<WfDefStep> getRoleList(@ApiIgnore @QueryParam QueryFilter queryFilter){
        List<WfDefStep> roleList = workflowConfigService.getRoleList(queryFilter);
        return PageResult.ok(roleList);
    }
 
 
    @RequestMapping(value = "addWorkflowStepsRole", method = {RequestMethod.GET,RequestMethod.POST})
    @ApiOperation("添加流程步骤用户")
    public Result<List<WfDefStep>> addWorkflowStepsRole(String roleId ,Long stepId){
        workflowConfigService.addWorkflowStepsRole(roleId,stepId);
        return Result.ok();
    }
 
    @RequestMapping(value = "deleteWorkflowStepsRole", method = {RequestMethod.GET,RequestMethod.POST})
    @ApiOperation("删除流程步骤用户")
    public Result<List<WfDefStep>> deleteWorkflowStepsRole(String roleId, String stepId){
        workflowConfigService.deleteWorkflowStepsRole(roleId,stepId);
        return Result.ok();
    }
 
    @RequestMapping(value = "refreshFlowMenu")
    @ApiOperation("删除流程步骤用户")
    public Result refreshFlowMenu(){
        workflowConfigService.refreshFlowMenu();
        return Result.ok();
    }
 
 
}