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