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