| 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(); | 
|     } | 
|   | 
|   | 
| } |