package com.bruce.sams.controller.ams; import com.bruce.sams.common.utils.AjaxResult; import com.bruce.sams.service.ApprovalService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; /** * 活动审批控制器 */ @RestController @RequestMapping("/api/admin/approval") public class ApprovalController { @Autowired private ApprovalService approvalService; /** * 审批通过 */ @PreAuthorize("hasRole('CLUB_ADMIN') or hasRole('DEPARTMENT_ADMIN') or hasRole('COLLEGE_ADMIN')") @PostMapping("/approve") public AjaxResult approveActivity(@RequestParam Long apprId, @RequestParam Long approverId) { approvalService.approveActivity(apprId, approverId); return AjaxResult.success("审批已通过"); } /** * 审批拒绝 */ @PreAuthorize("hasRole('CLUB_ADMIN') or hasRole('DEPARTMENT_ADMIN') or hasRole('COLLEGE_ADMIN')") @PostMapping("/reject") public AjaxResult rejectActivity(@RequestParam Long apprId, @RequestParam String reason, @RequestParam Long approverId) { approvalService.rejectActivity(apprId, reason, approverId); return AjaxResult.success("审批已拒绝"); } }