删除了没用的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.utils.http.ResponseList;
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseMap;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -22,7 +21,6 @@ public class AnnouncementController {
@Autowired
private IAnnouncementService announcementService;
@SneakyThrows
@ProjectAuthorize("a != 0")
@GetMapping
public ResponseList<AnnouncementDTO> getAnnouncementList(
@ -32,7 +30,6 @@ public class AnnouncementController {
return ResponseList.ofSuccess(announcementService.getAnnouncementList(projectId));
}
@SneakyThrows
@ProjectAuthorize("a != 0")
@GetMapping("/{announcementId}")
public ResponseMap getAnnouncementById(
@ -43,7 +40,6 @@ public class AnnouncementController {
return ResponseMap.ofSuccess(announcementService.getAnnouncementById(projectId, announcementId));
}
@SneakyThrows
@ProjectAuthorize("a>0 && a<=2")
@PostMapping
public ResponseMap createAnnouncement(
@ -66,23 +62,6 @@ public class AnnouncementController {
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")
@DeleteMapping("/{announcementId}")
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 io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -35,7 +34,6 @@ public class ProjectController {
@Operation(summary = "根据Token获取该员工的ProjectList")
@RateLimit(key = "ProjectPage", permitsPerSecond = 50, maxBurstSeconds = 15, timeout = 1200)
@SneakyThrows
@GetMapping
public ResponseList<ProjectDTO> getProjectListOfStaff(
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
@ -50,7 +48,6 @@ public class ProjectController {
return ResponseList.ofSuccess(result);
}
@SneakyThrows
@ProjectAuthorize("a != 0")
@GetMapping("/{projectId}")
public ResponseMap getOneProjectBasicInfo(
@ -61,7 +58,6 @@ public class ProjectController {
}
@Operation(description = "根据Token获取该员工的Project数")
@SneakyThrows
@GetMapping("/count")
public ResponseMap getProjectNumOfStaff(
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token
@ -71,7 +67,6 @@ public class ProjectController {
.put("totalNum", projectService.countMyProjects(staffId));
}
@SneakyThrows
@ProjectAuthorize("a == 1 || g == 1")
@PostMapping("/complete/{projectId}")
public ResponseMap completeProject(
@ -86,7 +81,6 @@ public class ProjectController {
return ResponseMap.ofSuccess();
}
@SneakyThrows
@ProjectAuthorize("g != 0 && g <= 2")
@PostMapping
public ResponseMap createProject(
@ -98,7 +92,6 @@ public class ProjectController {
return ResponseMap.ofSuccess();
}
@SneakyThrows
@ProjectAuthorize("a == 1 || g == 1")
@PutMapping("/{projectId}")
public ResponseMap updateProject(
@ -114,7 +107,6 @@ public class ProjectController {
return ResponseMap.ofSuccess();
}
@SneakyThrows
@ProjectAuthorize("a != 0")
@GetMapping("/{projectId}/stats")
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 com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.swagger.v3.oas.annotations.Operation;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -36,7 +35,6 @@ public class ProjectGroupController {
private ValidateUtils validateUtils;
@Operation(description = "传入合法page参数时分页查询否则拉取整个列表")
@SneakyThrows
@ProjectAuthorize("a != 0")
@GetMapping
public ResponseList<ProjectGroupDTO> getGroupMembers(
@ -61,7 +59,6 @@ public class ProjectGroupController {
}
@SneakyThrows
@ProjectAuthorize("a != 0")
@GetMapping("/{staffId}")
public ResponseMap getDesignatedStaffPosition(
@ -83,7 +80,6 @@ public class ProjectGroupController {
}
@Operation(description = "body中只传staffUsername和projectStaffPosition")
@SneakyThrows
@ProjectAuthorize("a == 1")
@PostMapping
public ResponseMap addGroupMember(
@ -98,7 +94,6 @@ public class ProjectGroupController {
throw new BadRequestException(BadRequestException.OPERATE_FAILED);
}
@SneakyThrows
@ProjectAuthorize("a == 1")
@DeleteMapping("/{staffId}")
public ResponseMap deleteGroupMember(
@ -114,7 +109,6 @@ public class ProjectGroupController {
}
@Operation(description = "body中只传projectStaffPosition")
@SneakyThrows
@ProjectAuthorize("a > 0 && a <= 2")
@PutMapping("/{staffId}")
public ResponseMap modifyDesignatedStaffPosition(
@ -130,7 +124,6 @@ public class ProjectGroupController {
throw new BadRequestException(BadRequestException.OPERATE_FAILED);
}
@SneakyThrows
@GetMapping("/stats")
public ResponseMap getGroupPositionsStatistics(
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
@ -141,7 +134,6 @@ public class ProjectGroupController {
}
@Operation(description = "请求体是一个key为taskIdvalue为staffId的map")
@SneakyThrows
@ProjectAuthorize("a > 0 && a <= 2")
@PutMapping("/{staffId}/transfer")
public ResponseMap transferStaffTasks(
@ -157,7 +149,6 @@ public class ProjectGroupController {
}
@Operation(description = "将staffId的所有工作项转移至targetStaffId")
@SneakyThrows
@ProjectAuthorize("a > 0 && a <= 2")
@PutMapping("/{staffId}/transfer/{targetStaffId}")
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.ResponseMap;
import io.swagger.v3.oas.annotations.Parameter;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.util.DigestUtils;
@ -16,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Objects;
/**
@ -28,7 +28,6 @@ public class StaffController {
@Autowired
private IStaffService staffService;
@SneakyThrows
@PostMapping("/login")
public ResponseMap login(
@Parameter(description = "只需要传入staffUsername和staffPassword两个属性即可staffPassword需要md5加密后传输")
@ -40,7 +39,6 @@ public class StaffController {
staffService.login(requestIpAddress, staff.getStaffUsername(), staff.getStaffPassword()));
}
@SneakyThrows
@PostMapping("/logout")
public ResponseMap logout(@RequestHeader(TokenUtils.HEADER_TOKEN) String token) {
if (staffService.logout(token)) {
@ -49,14 +47,13 @@ public class StaffController {
throw new TokenException("登出失败");
}
@SneakyThrows
@PostMapping(value = "/import")
public ResponseMap importStaffs(
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
@RequestAttribute Integer staffGlobalLevel,
@RequestParam("fileDigest") String digest,
@RequestParam("uploadFile") MultipartFile uploadFile
) {
) throws IOException {
if (null == uploadFile) {
throw new BadRequestException("文件传输错误");
}
@ -87,7 +84,6 @@ public class StaffController {
throw new BadRequestException(BadRequestException.OPERATE_FAILED);
}*/
@SneakyThrows
@GetMapping("/import/template")
@ResponseStatus(HttpStatus.SEE_OTHER)
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.utils.http.ResponseList;
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseMap;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -30,7 +29,6 @@ public class TaskController {
@Autowired
private IProjectService projectService;
@SneakyThrows
@ProjectAuthorize("a != 0")
@GetMapping("/{fatherId}/subtask")
public ResponseList<TaskDTO> getSubTaskList(
@ -42,7 +40,6 @@ public class TaskController {
return ResponseList.ofSuccess(result);
}
@SneakyThrows
@ProjectAuthorize("a != 0")
@RateLimit(key = "TaskMine", permitsPerSecond = 40, maxBurstSeconds = 15, timeout = 1200)
@GetMapping("/mine")
@ -55,7 +52,6 @@ public class TaskController {
return ResponseList.ofSuccess(result);
}
@SneakyThrows
@ProjectAuthorize("a != 0")
@GetMapping("/subtask/exist")
public ResponseMap existSubTask(
@ -67,7 +63,6 @@ public class TaskController {
.put("existSubTask", taskService.existSubTask(projectId, taskId));
}
@SneakyThrows
@PostMapping
public ResponseMap createTask(
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
@ -84,7 +79,6 @@ public class TaskController {
return ResponseMap.ofSuccess();
}
@SneakyThrows
@ProjectAuthorize("a != 0")
@RateLimit(key = "TaskModify", permitsPerSecond = 40, maxBurstSeconds = 15, timeout = 1200)
@PutMapping("/{taskId}")
@ -106,7 +100,6 @@ public class TaskController {
return ResponseMap.ofSuccess();
}
@SneakyThrows
@RateLimit(key = "TaskModify", permitsPerSecond = 40, maxBurstSeconds = 15, timeout = 1200)
@DeleteMapping("/{taskId}")
public ResponseMap deleteTaskAndSubTask(
@ -126,7 +119,6 @@ public class TaskController {
return ResponseMap.ofSuccess();
}
@SneakyThrows
@ProjectAuthorize("a != 0")
@RateLimit(key = "TaskTrend", permitsPerSecond = 50, maxBurstSeconds = 15, timeout = 1200)
@GetMapping("/stats/trend")
@ -140,7 +132,6 @@ public class TaskController {
return ResponseMap.ofSuccess("查询成功", taskService.getProjectTaskTrend(projectId));
}
@SneakyThrows
@ProjectAuthorize("a != 0")
@GetMapping("/stats/group")
public ResponseMap getTaskNumOfEveryone(
@ -150,7 +141,6 @@ public class TaskController {
return ResponseMap.ofSuccess("查询成功", taskService.getProjectProcessOfEveryone(projectId));
}
@SneakyThrows
@ProjectAuthorize("a != 0")
@GetMapping({"/stats", "/stats/{targetStaffId}"})
public ResponseList<StaffProcessDTO> getProjectStatistics(