package com.gkhy.assess.admin.controller.web; import com.gkhy.assess.common.annotation.RepeatSubmit; import com.gkhy.assess.common.api.CommonResult; import com.gkhy.assess.system.domain.AssProject; import com.gkhy.assess.system.service.AssProjectService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; /** *

* 项目表 前端控制器 *

* * @author kzy * @since 2023-12-11 14:16:18 */ @Api(tags = "项目前端控制器") @RestController @RequestMapping("/manage/project") public class AssProjectController { @Autowired private AssProjectService projectService; @ApiOperation(value = "项目列表(分页)") @ApiImplicitParams({ @ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = false, value = "当前页,默认1"), @ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = false, value = "每页数目,默认10,最大50"), @ApiImplicitParam(paramType = "query", name = "projectPhase", dataType = "int", required = false, value = "params字段内:1风险分析评价计划,2现场勘验,3项目审核,4出具报告,5项目归档") }) @GetMapping("/list") public CommonResult projectList(AssProject project){ return CommonResult.success(projectService.projectList(project)); } @ApiOperation(value = "根据id获取项目详情") @GetMapping("/detail/{projectId}") public CommonResult projectDetail(@PathVariable(value = "projectId") Long projectId){ return CommonResult.success(projectService.getProjectById(projectId)); } @ApiOperation(value = "根据id获取项目当前状态") @GetMapping("/progress/{projectId}") public CommonResult getProjectProgress(@PathVariable(value = "projectId") Long projectId){ return CommonResult.success(projectService.getProjectReportProgress(projectId)); } // @RepeatSubmit // @ApiOperation(value = "创建项目") // @PostMapping("/add") // public CommonResult addProject(@Validated @RequestBody AssProject project){ // return CommonResult.success(projectService.addProject(project)); // } // @RepeatSubmit // @ApiOperation(value = "编辑项目") // @PutMapping("/edit") // public CommonResult editProject(@RequestBody AssProject project){ // return CommonResult.success(projectService.editProject(project)); // } @RepeatSubmit @RequiresPermissions(value={"system:assess:monitor","system:assess:agency"},logical = Logical.OR) @ApiOperation(value = "删除项目") @DeleteMapping("/remove/{projectId}") public CommonResult deleteProject(@PathVariable(value = "projectId")Long projectId){ return CommonResult.success(projectService.deleteProjectById(projectId)); } @ApiOperation(value = "校验项目名称是否唯一") @PostMapping("/checkProjectNameUnique") public CommonResult checkProjectNameUnique(@RequestBody AssProject project) { return CommonResult.success(projectService.checkNameUnique(project)); } @ApiOperation(value = "项目统计") @GetMapping("/statistics") public CommonResult projectStat(AssProject project){ return CommonResult.success(projectService.projectStat(project)); } @ApiOperation(value = "根据项目成员id获取项目列表") @GetMapping("/memberProjects") @ApiImplicitParams({ @ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = true, value = "当前页,默认1"), @ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = true, value = "每页数量,默认10"), @ApiImplicitParam(paramType = "query", name = "personId", dataType = "long", required = true, value = "项目id") }) public CommonResult memberProjects(@RequestParam(required = true) Long personId){ return CommonResult.success(projectService.memberProjects(personId,null)); } }