kongzy
2024-07-12 28aaf2ffa1dbb860a292ba330a7e9362e60e7832
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
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.*;
 
/**
 * <p>
 * 项目表 前端控制器
 * </p>
 *
 * @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));
    }
 
}