zhangwencui
5 天以前 f76bf27bf93e523ae4572d9e10e9ca541c324185
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
package com.ruoyi.projectManagement.controller;
 
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.projectManagement.dto.ProjectWorkflowDtos;
import com.ruoyi.projectManagement.service.ProjectWorkflowService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
@RestController
@RequestMapping("/projectManagement/workflow")
@Tag(name = "项目执行工作台")
@RequiredArgsConstructor
public class ProjectWorkflowController {
    private final ProjectWorkflowService service;
 
    @GetMapping("/{projectId}")
    @Operation(summary = "项目模块、跟进、汇报、统计和资料")
    public AjaxResult workbench(@PathVariable Long projectId) {
        return AjaxResult.success(service.getWorkbench(projectId));
    }
 
    @PreAuthorize("@ss.hasPermi('project:module:edit')")
    @PostMapping("/start/{projectId}")
    public AjaxResult startProject(@PathVariable Long projectId) {
        service.startProject(projectId);
        return AjaxResult.success();
    }
 
    @PostMapping("/project-executors")
    public AjaxResult updateProjectExecutors(@RequestBody ProjectWorkflowDtos.ProjectExecutorsRequest request) {
        service.updateProjectExecutors(request);
        return AjaxResult.success();
    }
 
    @PostMapping("/transition")
    public AjaxResult transition(@RequestBody ProjectWorkflowDtos.StageTransitionRequest request) {
        service.transitionStage(request);
        return AjaxResult.success();
    }
 
    @PreAuthorize("@ss.hasPermi('project:module:edit')")
    @PostMapping("/module")
    public AjaxResult saveModule(@RequestBody ProjectWorkflowDtos.ModuleSaveRequest request) {
        return AjaxResult.success(service.saveModule(request));
    }
 
    @PreAuthorize("@ss.hasPermi('project:module:remove')")
    @DeleteMapping("/module/{id}")
    public AjaxResult deleteModule(@PathVariable Long id) {
        service.deleteModule(id);
        return AjaxResult.success();
    }
 
    @PreAuthorize("@ss.hasPermi('project:follow:add')")
    @PostMapping("/follow-up")
    public AjaxResult saveFollowUp(@RequestBody ProjectWorkflowDtos.FollowUpRequest request) {
        return AjaxResult.success(service.saveFollowUp(request));
    }
 
    @PreAuthorize("@ss.hasPermi('project:follow:remove')")
    @DeleteMapping("/follow-up/{id}")
    public AjaxResult deleteFollowUp(@PathVariable Long id) {
        service.softDelete("project_management_follow_up", id);
        return AjaxResult.success();
    }
 
    @PreAuthorize("@ss.hasPermi('project:report:add')")
    @PostMapping("/report")
    public AjaxResult saveReport(@RequestBody ProjectWorkflowDtos.ProgressReportRequest request) {
        return AjaxResult.success(service.saveReport(request));
    }
 
    @PreAuthorize("@ss.hasPermi('project:report:remove')")
    @DeleteMapping("/report/{id}")
    public AjaxResult deleteReport(@PathVariable Long id) {
        service.softDelete("project_management_progress_report", id);
        return AjaxResult.success();
    }
 
    @PreAuthorize("@ss.hasPermi('project:material:add')")
    @PostMapping("/material")
    public AjaxResult saveMaterial(@RequestBody ProjectWorkflowDtos.MaterialRequest request) {
        return AjaxResult.success(service.saveMaterial(request));
    }
 
    @PreAuthorize("@ss.hasPermi('project:phase:edit')")
    @PostMapping("/phase")
    public AjaxResult savePhase(@RequestBody ProjectWorkflowDtos.PhaseRequest request) {
        return AjaxResult.success(service.savePhase(request));
    }
 
    @PreAuthorize("@ss.hasPermi('project:material:remove')")
    @DeleteMapping("/material/{id}")
    public AjaxResult deleteMaterial(@PathVariable Long id) {
        service.softDelete("project_management_material", id);
        return AjaxResult.success();
    }
 
    @GetMapping("/category/list")
    public AjaxResult categoryList() {
        return AjaxResult.success(service.listCategories());
    }
 
    @PreAuthorize("@ss.hasPermi('project:category:edit')")
    @PostMapping("/category")
    public AjaxResult saveCategory(@RequestBody ProjectWorkflowDtos.CategoryRequest request) {
        return AjaxResult.success(service.saveCategory(request));
    }
 
    @PreAuthorize("@ss.hasPermi('project:category:remove')")
    @DeleteMapping("/category/{id}")
    public AjaxResult deleteCategory(@PathVariable Long id) {
        service.deleteCategory(id);
        return AjaxResult.success();
    }
 
    @GetMapping("/policy/list")
    public AjaxResult policyList(@RequestParam(required = false) String keyword) {
        return AjaxResult.success(service.listPolicies(keyword));
    }
 
    @PreAuthorize("@ss.hasPermi('policy:file:edit')")
    @PostMapping("/policy")
    public AjaxResult savePolicy(@RequestBody ProjectWorkflowDtos.PolicyRequest request) {
        return AjaxResult.success(service.savePolicy(request));
    }
 
    @PreAuthorize("@ss.hasPermi('policy:file:remove')")
    @DeleteMapping("/policy/{id}")
    public AjaxResult deletePolicy(@PathVariable Long id) {
        service.softDelete("government_policy_file", id);
        return AjaxResult.success();
    }
}