删除了没用的SneakyThrows

master
ArgonarioD 2023-01-13 22:47:48 +08:00
parent f607650c73
commit c0018c5788
5 changed files with 2 additions and 54 deletions

View File

@ -7,7 +7,6 @@ import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException;
import cn.edu.hfut.rmdjzz.projectmanagement.service.IAnnouncementService; import cn.edu.hfut.rmdjzz.projectmanagement.service.IAnnouncementService;
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseList; import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseList;
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseMap; import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseMap;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -22,7 +21,6 @@ public class AnnouncementController {
@Autowired @Autowired
private IAnnouncementService announcementService; private IAnnouncementService announcementService;
@SneakyThrows
@ProjectAuthorize("a != 0") @ProjectAuthorize("a != 0")
@GetMapping @GetMapping
public ResponseList<AnnouncementDTO> getAnnouncementList( public ResponseList<AnnouncementDTO> getAnnouncementList(
@ -32,7 +30,6 @@ public class AnnouncementController {
return ResponseList.ofSuccess(announcementService.getAnnouncementList(projectId)); return ResponseList.ofSuccess(announcementService.getAnnouncementList(projectId));
} }
@SneakyThrows
@ProjectAuthorize("a != 0") @ProjectAuthorize("a != 0")
@GetMapping("/{announcementId}") @GetMapping("/{announcementId}")
public ResponseMap getAnnouncementById( public ResponseMap getAnnouncementById(
@ -43,7 +40,6 @@ public class AnnouncementController {
return ResponseMap.ofSuccess(announcementService.getAnnouncementById(projectId, announcementId)); return ResponseMap.ofSuccess(announcementService.getAnnouncementById(projectId, announcementId));
} }
@SneakyThrows
@ProjectAuthorize("a>0 && a<=2") @ProjectAuthorize("a>0 && a<=2")
@PostMapping @PostMapping
public ResponseMap createAnnouncement( public ResponseMap createAnnouncement(
@ -66,23 +62,6 @@ public class AnnouncementController {
throw new BadRequestException(BadRequestException.OPERATE_FAILED); throw new BadRequestException(BadRequestException.OPERATE_FAILED);
} }
// 取消功能
/*@SneakyThrows
@PutMapping("/{announcementId}")
public ResponseMap modifyAnnouncement(
@RequestHeader(TokenUtils.HEADER_TOKEN) String token,
@PathVariable Integer projectId,
@PathVariable Long announcementId,
@RequestBody Announcement announcement
) {
announcement.setAnnouncementId(announcementId);
if (announcementService.updateAnnouncement(token, projectId, announcement)) {
return ResponseMap.ofSuccess("更新成功");
}
throw new BadRequestException("更新失败");
}*/
@SneakyThrows
@ProjectAuthorize("a>0 && a<=2") @ProjectAuthorize("a>0 && a<=2")
@DeleteMapping("/{announcementId}") @DeleteMapping("/{announcementId}")
public ResponseMap deleteAnnouncement( public ResponseMap deleteAnnouncement(

View File

@ -12,7 +12,6 @@ import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseMap;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -35,7 +34,6 @@ public class ProjectController {
@Operation(summary = "根据Token获取该员工的ProjectList") @Operation(summary = "根据Token获取该员工的ProjectList")
@RateLimit(key = "ProjectPage", permitsPerSecond = 50, maxBurstSeconds = 15, timeout = 1200) @RateLimit(key = "ProjectPage", permitsPerSecond = 50, maxBurstSeconds = 15, timeout = 1200)
@SneakyThrows
@GetMapping @GetMapping
public ResponseList<ProjectDTO> getProjectListOfStaff( public ResponseList<ProjectDTO> getProjectListOfStaff(
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token, // @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
@ -50,7 +48,6 @@ public class ProjectController {
return ResponseList.ofSuccess(result); return ResponseList.ofSuccess(result);
} }
@SneakyThrows
@ProjectAuthorize("a != 0") @ProjectAuthorize("a != 0")
@GetMapping("/{projectId}") @GetMapping("/{projectId}")
public ResponseMap getOneProjectBasicInfo( public ResponseMap getOneProjectBasicInfo(
@ -61,7 +58,6 @@ public class ProjectController {
} }
@Operation(description = "根据Token获取该员工的Project数") @Operation(description = "根据Token获取该员工的Project数")
@SneakyThrows
@GetMapping("/count") @GetMapping("/count")
public ResponseMap getProjectNumOfStaff( public ResponseMap getProjectNumOfStaff(
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token // @RequestHeader(TokenUtils.HEADER_TOKEN) String token
@ -71,7 +67,6 @@ public class ProjectController {
.put("totalNum", projectService.countMyProjects(staffId)); .put("totalNum", projectService.countMyProjects(staffId));
} }
@SneakyThrows
@ProjectAuthorize("a == 1 || g == 1") @ProjectAuthorize("a == 1 || g == 1")
@PostMapping("/complete/{projectId}") @PostMapping("/complete/{projectId}")
public ResponseMap completeProject( public ResponseMap completeProject(
@ -86,7 +81,6 @@ public class ProjectController {
return ResponseMap.ofSuccess(); return ResponseMap.ofSuccess();
} }
@SneakyThrows
@ProjectAuthorize("g != 0 && g <= 2") @ProjectAuthorize("g != 0 && g <= 2")
@PostMapping @PostMapping
public ResponseMap createProject( public ResponseMap createProject(
@ -98,7 +92,6 @@ public class ProjectController {
return ResponseMap.ofSuccess(); return ResponseMap.ofSuccess();
} }
@SneakyThrows
@ProjectAuthorize("a == 1 || g == 1") @ProjectAuthorize("a == 1 || g == 1")
@PutMapping("/{projectId}") @PutMapping("/{projectId}")
public ResponseMap updateProject( public ResponseMap updateProject(
@ -114,7 +107,6 @@ public class ProjectController {
return ResponseMap.ofSuccess(); return ResponseMap.ofSuccess();
} }
@SneakyThrows
@ProjectAuthorize("a != 0") @ProjectAuthorize("a != 0")
@GetMapping("/{projectId}/stats") @GetMapping("/{projectId}/stats")
public ResponseMap getProjectProcess( public ResponseMap getProjectProcess(

View File

@ -14,7 +14,6 @@ import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseList;
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseMap; import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseMap;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -36,7 +35,6 @@ public class ProjectGroupController {
private ValidateUtils validateUtils; private ValidateUtils validateUtils;
@Operation(description = "传入合法page参数时分页查询否则拉取整个列表") @Operation(description = "传入合法page参数时分页查询否则拉取整个列表")
@SneakyThrows
@ProjectAuthorize("a != 0") @ProjectAuthorize("a != 0")
@GetMapping @GetMapping
public ResponseList<ProjectGroupDTO> getGroupMembers( public ResponseList<ProjectGroupDTO> getGroupMembers(
@ -61,7 +59,6 @@ public class ProjectGroupController {
} }
@SneakyThrows
@ProjectAuthorize("a != 0") @ProjectAuthorize("a != 0")
@GetMapping("/{staffId}") @GetMapping("/{staffId}")
public ResponseMap getDesignatedStaffPosition( public ResponseMap getDesignatedStaffPosition(
@ -83,7 +80,6 @@ public class ProjectGroupController {
} }
@Operation(description = "body中只传staffUsername和projectStaffPosition") @Operation(description = "body中只传staffUsername和projectStaffPosition")
@SneakyThrows
@ProjectAuthorize("a == 1") @ProjectAuthorize("a == 1")
@PostMapping @PostMapping
public ResponseMap addGroupMember( public ResponseMap addGroupMember(
@ -98,7 +94,6 @@ public class ProjectGroupController {
throw new BadRequestException(BadRequestException.OPERATE_FAILED); throw new BadRequestException(BadRequestException.OPERATE_FAILED);
} }
@SneakyThrows
@ProjectAuthorize("a == 1") @ProjectAuthorize("a == 1")
@DeleteMapping("/{staffId}") @DeleteMapping("/{staffId}")
public ResponseMap deleteGroupMember( public ResponseMap deleteGroupMember(
@ -114,7 +109,6 @@ public class ProjectGroupController {
} }
@Operation(description = "body中只传projectStaffPosition") @Operation(description = "body中只传projectStaffPosition")
@SneakyThrows
@ProjectAuthorize("a > 0 && a <= 2") @ProjectAuthorize("a > 0 && a <= 2")
@PutMapping("/{staffId}") @PutMapping("/{staffId}")
public ResponseMap modifyDesignatedStaffPosition( public ResponseMap modifyDesignatedStaffPosition(
@ -130,7 +124,6 @@ public class ProjectGroupController {
throw new BadRequestException(BadRequestException.OPERATE_FAILED); throw new BadRequestException(BadRequestException.OPERATE_FAILED);
} }
@SneakyThrows
@GetMapping("/stats") @GetMapping("/stats")
public ResponseMap getGroupPositionsStatistics( public ResponseMap getGroupPositionsStatistics(
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token, // @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
@ -141,7 +134,6 @@ public class ProjectGroupController {
} }
@Operation(description = "请求体是一个key为taskIdvalue为staffId的map") @Operation(description = "请求体是一个key为taskIdvalue为staffId的map")
@SneakyThrows
@ProjectAuthorize("a > 0 && a <= 2") @ProjectAuthorize("a > 0 && a <= 2")
@PutMapping("/{staffId}/transfer") @PutMapping("/{staffId}/transfer")
public ResponseMap transferStaffTasks( public ResponseMap transferStaffTasks(
@ -157,7 +149,6 @@ public class ProjectGroupController {
} }
@Operation(description = "将staffId的所有工作项转移至targetStaffId") @Operation(description = "将staffId的所有工作项转移至targetStaffId")
@SneakyThrows
@ProjectAuthorize("a > 0 && a <= 2") @ProjectAuthorize("a > 0 && a <= 2")
@PutMapping("/{staffId}/transfer/{targetStaffId}") @PutMapping("/{staffId}/transfer/{targetStaffId}")
public ResponseMap transferTasksToSingleStaff( public ResponseMap transferTasksToSingleStaff(

View File

@ -8,7 +8,6 @@ import cn.edu.hfut.rmdjzz.projectmanagement.utils.TokenUtils;
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.HttpUtils; import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.HttpUtils;
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseMap; import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseMap;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.util.DigestUtils; import org.springframework.util.DigestUtils;
@ -16,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Objects; import java.util.Objects;
/** /**
@ -28,7 +28,6 @@ public class StaffController {
@Autowired @Autowired
private IStaffService staffService; private IStaffService staffService;
@SneakyThrows
@PostMapping("/login") @PostMapping("/login")
public ResponseMap login( public ResponseMap login(
@Parameter(description = "只需要传入staffUsername和staffPassword两个属性即可staffPassword需要md5加密后传输") @Parameter(description = "只需要传入staffUsername和staffPassword两个属性即可staffPassword需要md5加密后传输")
@ -40,7 +39,6 @@ public class StaffController {
staffService.login(requestIpAddress, staff.getStaffUsername(), staff.getStaffPassword())); staffService.login(requestIpAddress, staff.getStaffUsername(), staff.getStaffPassword()));
} }
@SneakyThrows
@PostMapping("/logout") @PostMapping("/logout")
public ResponseMap logout(@RequestHeader(TokenUtils.HEADER_TOKEN) String token) { public ResponseMap logout(@RequestHeader(TokenUtils.HEADER_TOKEN) String token) {
if (staffService.logout(token)) { if (staffService.logout(token)) {
@ -49,14 +47,13 @@ public class StaffController {
throw new TokenException("登出失败"); throw new TokenException("登出失败");
} }
@SneakyThrows
@PostMapping(value = "/import") @PostMapping(value = "/import")
public ResponseMap importStaffs( public ResponseMap importStaffs(
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token, // @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
@RequestAttribute Integer staffGlobalLevel, @RequestAttribute Integer staffGlobalLevel,
@RequestParam("fileDigest") String digest, @RequestParam("fileDigest") String digest,
@RequestParam("uploadFile") MultipartFile uploadFile @RequestParam("uploadFile") MultipartFile uploadFile
) { ) throws IOException {
if (null == uploadFile) { if (null == uploadFile) {
throw new BadRequestException("文件传输错误"); throw new BadRequestException("文件传输错误");
} }
@ -87,7 +84,6 @@ public class StaffController {
throw new BadRequestException(BadRequestException.OPERATE_FAILED); throw new BadRequestException(BadRequestException.OPERATE_FAILED);
}*/ }*/
@SneakyThrows
@GetMapping("/import/template") @GetMapping("/import/template")
@ResponseStatus(HttpStatus.SEE_OTHER) @ResponseStatus(HttpStatus.SEE_OTHER)
public ResponseMap downloadTemplate() { public ResponseMap downloadTemplate() {

View File

@ -12,7 +12,6 @@ import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectService;
import cn.edu.hfut.rmdjzz.projectmanagement.service.ITaskService; import cn.edu.hfut.rmdjzz.projectmanagement.service.ITaskService;
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseList; import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseList;
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseMap; import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseMap;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -30,7 +29,6 @@ public class TaskController {
@Autowired @Autowired
private IProjectService projectService; private IProjectService projectService;
@SneakyThrows
@ProjectAuthorize("a != 0") @ProjectAuthorize("a != 0")
@GetMapping("/{fatherId}/subtask") @GetMapping("/{fatherId}/subtask")
public ResponseList<TaskDTO> getSubTaskList( public ResponseList<TaskDTO> getSubTaskList(
@ -42,7 +40,6 @@ public class TaskController {
return ResponseList.ofSuccess(result); return ResponseList.ofSuccess(result);
} }
@SneakyThrows
@ProjectAuthorize("a != 0") @ProjectAuthorize("a != 0")
@RateLimit(key = "TaskMine", permitsPerSecond = 40, maxBurstSeconds = 15, timeout = 1200) @RateLimit(key = "TaskMine", permitsPerSecond = 40, maxBurstSeconds = 15, timeout = 1200)
@GetMapping("/mine") @GetMapping("/mine")
@ -55,7 +52,6 @@ public class TaskController {
return ResponseList.ofSuccess(result); return ResponseList.ofSuccess(result);
} }
@SneakyThrows
@ProjectAuthorize("a != 0") @ProjectAuthorize("a != 0")
@GetMapping("/subtask/exist") @GetMapping("/subtask/exist")
public ResponseMap existSubTask( public ResponseMap existSubTask(
@ -67,7 +63,6 @@ public class TaskController {
.put("existSubTask", taskService.existSubTask(projectId, taskId)); .put("existSubTask", taskService.existSubTask(projectId, taskId));
} }
@SneakyThrows
@PostMapping @PostMapping
public ResponseMap createTask( public ResponseMap createTask(
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token, // @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
@ -84,7 +79,6 @@ public class TaskController {
return ResponseMap.ofSuccess(); return ResponseMap.ofSuccess();
} }
@SneakyThrows
@ProjectAuthorize("a != 0") @ProjectAuthorize("a != 0")
@RateLimit(key = "TaskModify", permitsPerSecond = 40, maxBurstSeconds = 15, timeout = 1200) @RateLimit(key = "TaskModify", permitsPerSecond = 40, maxBurstSeconds = 15, timeout = 1200)
@PutMapping("/{taskId}") @PutMapping("/{taskId}")
@ -106,7 +100,6 @@ public class TaskController {
return ResponseMap.ofSuccess(); return ResponseMap.ofSuccess();
} }
@SneakyThrows
@RateLimit(key = "TaskModify", permitsPerSecond = 40, maxBurstSeconds = 15, timeout = 1200) @RateLimit(key = "TaskModify", permitsPerSecond = 40, maxBurstSeconds = 15, timeout = 1200)
@DeleteMapping("/{taskId}") @DeleteMapping("/{taskId}")
public ResponseMap deleteTaskAndSubTask( public ResponseMap deleteTaskAndSubTask(
@ -126,7 +119,6 @@ public class TaskController {
return ResponseMap.ofSuccess(); return ResponseMap.ofSuccess();
} }
@SneakyThrows
@ProjectAuthorize("a != 0") @ProjectAuthorize("a != 0")
@RateLimit(key = "TaskTrend", permitsPerSecond = 50, maxBurstSeconds = 15, timeout = 1200) @RateLimit(key = "TaskTrend", permitsPerSecond = 50, maxBurstSeconds = 15, timeout = 1200)
@GetMapping("/stats/trend") @GetMapping("/stats/trend")
@ -140,7 +132,6 @@ public class TaskController {
return ResponseMap.ofSuccess("查询成功", taskService.getProjectTaskTrend(projectId)); return ResponseMap.ofSuccess("查询成功", taskService.getProjectTaskTrend(projectId));
} }
@SneakyThrows
@ProjectAuthorize("a != 0") @ProjectAuthorize("a != 0")
@GetMapping("/stats/group") @GetMapping("/stats/group")
public ResponseMap getTaskNumOfEveryone( public ResponseMap getTaskNumOfEveryone(
@ -150,7 +141,6 @@ public class TaskController {
return ResponseMap.ofSuccess("查询成功", taskService.getProjectProcessOfEveryone(projectId)); return ResponseMap.ofSuccess("查询成功", taskService.getProjectProcessOfEveryone(projectId));
} }
@SneakyThrows
@ProjectAuthorize("a != 0") @ProjectAuthorize("a != 0")
@GetMapping({"/stats", "/stats/{targetStaffId}"}) @GetMapping({"/stats", "/stats/{targetStaffId}"})
public ResponseList<StaffProcessDTO> getProjectStatistics( public ResponseList<StaffProcessDTO> getProjectStatistics(