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
package com.ruoyi.projectManagement.controller;
 
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
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));
    }
 
    @GetMapping("/lifecycle/{projectId}")
    @Operation(summary = "项目生命周期")
    public AjaxResult lifecycle(@PathVariable Long projectId) {
        return AjaxResult.success(service.getLifecycle(projectId));
    }
 
    @PreAuthorize("@ss.hasPermi('project:module:edit')")
    @PostMapping("/start/{projectId}")
    @Log(title = "项目管理-开始项目", businessType = BusinessType.UPDATE)
    public AjaxResult startProject(@PathVariable Long projectId) {
        service.startProject(projectId);
        return AjaxResult.success();
    }
 
    @PostMapping("/transition")
    @Log(title = "项目管理-阶段推进", businessType = BusinessType.UPDATE)
    public AjaxResult transition(@RequestBody ProjectWorkflowDtos.StageTransitionRequest request) {
        service.transitionStage(request);
        return AjaxResult.success();
    }
 
    @PreAuthorize("@ss.hasPermi('project:module:edit')")
    @PostMapping("/module")
    @Log(title = "项目管理-模块维护", businessType = BusinessType.UPDATE)
    public AjaxResult saveModule(@RequestBody ProjectWorkflowDtos.ModuleSaveRequest request) {
        return AjaxResult.success(service.saveModule(request));
    }
 
    @PreAuthorize("@ss.hasPermi('project:module:edit')")
    @PostMapping("/modules/batch")
    @Log(title = "项目管理-模块批量维护", businessType = BusinessType.UPDATE)
    public AjaxResult saveModulesBatch(@RequestBody ProjectWorkflowDtos.ModulesBatchRequest request) {
        service.saveModulesBatch(request);
        return AjaxResult.success();
    }
 
    @PreAuthorize("@ss.hasPermi('project:module:remove')")
    @DeleteMapping("/module/{id}")
    @Log(title = "项目管理-模块删除", businessType = BusinessType.DELETE)
    public AjaxResult deleteModule(@PathVariable Long id) {
        service.deleteModule(id);
        return AjaxResult.success();
    }
 
    @PreAuthorize("@ss.hasPermi('project:follow:add')")
    @PostMapping("/follow-up")
    @Log(title = "项目管理-项目跟进", businessType = BusinessType.INSERT)
    public AjaxResult saveFollowUp(@RequestBody ProjectWorkflowDtos.FollowUpRequest request) {
        return AjaxResult.success(service.saveFollowUp(request));
    }
 
    @PreAuthorize("@ss.hasPermi('project:follow:remove')")
    @DeleteMapping("/follow-up/{id}")
    @Log(title = "项目管理-跟进删除", businessType = BusinessType.DELETE)
    public AjaxResult deleteFollowUp(@PathVariable Long id) {
        service.softDelete("project_management_follow_up", id);
        return AjaxResult.success();
    }
 
    @PreAuthorize("@ss.hasPermi('project:report:add')")
    @PostMapping("/report")
    @Log(title = "项目管理-进度汇报", businessType = BusinessType.INSERT)
    public AjaxResult saveReport(@RequestBody ProjectWorkflowDtos.ProgressReportRequest request) {
        return AjaxResult.success(service.saveReport(request));
    }
 
    @PreAuthorize("@ss.hasPermi('project:report:remove')")
    @DeleteMapping("/report/{id}")
    @Log(title = "项目管理-汇报删除", businessType = BusinessType.DELETE)
    public AjaxResult deleteReport(@PathVariable Long id) {
        service.deleteReport(id);
        return AjaxResult.success();
    }
 
    @PreAuthorize("@ss.hasPermi('project:material:add')")
    @PostMapping("/material")
    @Log(title = "项目管理-资料维护", businessType = BusinessType.INSERT)
    public AjaxResult saveMaterial(@RequestBody ProjectWorkflowDtos.MaterialRequest request) {
        return AjaxResult.success(service.saveMaterial(request));
    }
 
    @PreAuthorize("@ss.hasPermi('project:phase:edit')")
    @PostMapping("/phase")
    @Log(title = "项目管理-阶段办理", businessType = BusinessType.UPDATE)
    public AjaxResult savePhase(@RequestBody ProjectWorkflowDtos.PhaseRequest request) {
        return AjaxResult.success(service.savePhase(request));
    }
 
    @PreAuthorize("@ss.hasPermi('project:material:remove')")
    @DeleteMapping("/material/{id}")
    @Log(title = "项目管理-资料删除", businessType = BusinessType.DELETE)
    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")
    @Log(title = "项目管理-分类维护", businessType = BusinessType.UPDATE)
    public AjaxResult saveCategory(@RequestBody ProjectWorkflowDtos.CategoryRequest request) {
        return AjaxResult.success(service.saveCategory(request));
    }
 
    @PreAuthorize("@ss.hasPermi('project:category:remove')")
    @DeleteMapping("/category/{id}")
    @Log(title = "项目管理-分类删除", businessType = BusinessType.DELETE)
    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")
    @Log(title = "政府政策文件-维护", businessType = BusinessType.UPDATE)
    public AjaxResult savePolicy(@RequestBody ProjectWorkflowDtos.PolicyRequest request) {
        return AjaxResult.success(service.savePolicy(request));
    }
 
    @PreAuthorize("@ss.hasPermi('policy:file:remove')")
    @DeleteMapping("/policy/{id}")
    @Log(title = "政府政策文件-删除", businessType = BusinessType.DELETE)
    public AjaxResult deletePolicy(@PathVariable Long id) {
        service.softDelete("government_policy_file", id);
        return AjaxResult.success();
    }
}