确认并删除了无用的代码
parent
c0018c5788
commit
1cfed731e7
|
@ -24,7 +24,6 @@ public class AnnouncementController {
|
|||
@ProjectAuthorize("a != 0")
|
||||
@GetMapping
|
||||
public ResponseList<AnnouncementDTO> getAnnouncementList(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@PathVariable Integer projectId
|
||||
) {
|
||||
return ResponseList.ofSuccess(announcementService.getAnnouncementList(projectId));
|
||||
|
@ -33,7 +32,6 @@ public class AnnouncementController {
|
|||
@ProjectAuthorize("a != 0")
|
||||
@GetMapping("/{announcementId}")
|
||||
public ResponseMap getAnnouncementById(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@PathVariable Integer projectId,
|
||||
@PathVariable Long announcementId
|
||||
) {
|
||||
|
@ -43,17 +41,11 @@ public class AnnouncementController {
|
|||
@ProjectAuthorize("a>0 && a<=2")
|
||||
@PostMapping
|
||||
public ResponseMap createAnnouncement(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@RequestAttribute Integer staffId,
|
||||
@PathVariable Integer projectId,
|
||||
@RequestBody Announcement announcement
|
||||
) {
|
||||
/*Integer accessLevel = projectGroupService.getProjectAccessLevel(token, projectId);
|
||||
if (accessLevel == 0 || accessLevel > 2) {
|
||||
throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
|
||||
}*/
|
||||
announcement.setProjectId(projectId);
|
||||
// announcement.setAnnouncementPublisherId(TokenUtils.getStaffId(token));
|
||||
announcement.setAnnouncementPublisherId(staffId);
|
||||
announcement.setAnnouncementPublishTime(null);
|
||||
if (announcementService.save(announcement)) {
|
||||
|
@ -65,7 +57,6 @@ public class AnnouncementController {
|
|||
@ProjectAuthorize("a>0 && a<=2")
|
||||
@DeleteMapping("/{announcementId}")
|
||||
public ResponseMap deleteAnnouncement(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@RequestAttribute Integer staffId,
|
||||
@RequestAttribute Integer globalAccessLevel,
|
||||
@PathVariable Integer projectId,
|
||||
|
|
|
@ -36,12 +36,11 @@ public class ProjectController {
|
|||
@RateLimit(key = "ProjectPage", permitsPerSecond = 50, maxBurstSeconds = 15, timeout = 1200)
|
||||
@GetMapping
|
||||
public ResponseList<ProjectDTO> getProjectListOfStaff(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@RequestAttribute Integer globalAccessLevel,
|
||||
@RequestAttribute Integer staffId,
|
||||
@Valid RequestPage page,
|
||||
@Parameter(description = "参数列表见Project实体类,时间可以用xxxxStart与xxxxEnd来确定区间"
|
||||
, required = true) @RequestParam("paramMap") Map<String, Object> paramMap
|
||||
@Parameter(description = "参数列表见Project实体类,时间可以用xxxxStart与xxxxEnd来确定区间", required = true)
|
||||
@RequestParam("paramMap") Map<String, Object> paramMap
|
||||
) {
|
||||
if (globalAccessLevel == 1) staffId = null;
|
||||
Page<ProjectDTO> result = projectService.pageMyProjects(staffId, page, paramMap);
|
||||
|
@ -51,7 +50,6 @@ public class ProjectController {
|
|||
@ProjectAuthorize("a != 0")
|
||||
@GetMapping("/{projectId}")
|
||||
public ResponseMap getOneProjectBasicInfo(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@PathVariable("projectId") Integer projectId
|
||||
) {
|
||||
return ResponseMap.ofSuccess(projectService.getById(projectId));
|
||||
|
@ -60,7 +58,6 @@ public class ProjectController {
|
|||
@Operation(description = "根据Token获取该员工的Project数")
|
||||
@GetMapping("/count")
|
||||
public ResponseMap getProjectNumOfStaff(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token
|
||||
@RequestAttribute Integer staffId
|
||||
) {
|
||||
return ResponseMap.ofSuccess()
|
||||
|
@ -69,12 +66,7 @@ public class ProjectController {
|
|||
|
||||
@ProjectAuthorize("a == 1 || g == 1")
|
||||
@PostMapping("/complete/{projectId}")
|
||||
public ResponseMap completeProject(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@RequestAttribute Project targetProject/*,
|
||||
@Parameter(description = "只需要传projectId即可,例:{\"projectId\": 1}")
|
||||
@PathVariable Integer projectId*/
|
||||
) {
|
||||
public ResponseMap completeProject(@RequestAttribute Project targetProject) {
|
||||
if (targetProject.getCompleted())
|
||||
throw new BadRequestException(PROJECT_COMPLETED);
|
||||
projectService.setProjectCompleted(targetProject);
|
||||
|
@ -84,7 +76,6 @@ public class ProjectController {
|
|||
@ProjectAuthorize("g != 0 && g <= 2")
|
||||
@PostMapping
|
||||
public ResponseMap createProject(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@RequestAttribute Integer staffId,
|
||||
@RequestBody Project project
|
||||
) {
|
||||
|
@ -95,7 +86,6 @@ public class ProjectController {
|
|||
@ProjectAuthorize("a == 1 || g == 1")
|
||||
@PutMapping("/{projectId}")
|
||||
public ResponseMap updateProject(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@RequestAttribute Integer staffId,
|
||||
@PathVariable Integer projectId,
|
||||
@RequestBody Project project
|
||||
|
@ -110,7 +100,6 @@ public class ProjectController {
|
|||
@ProjectAuthorize("a != 0")
|
||||
@GetMapping("/{projectId}/stats")
|
||||
public ResponseMap getProjectProcess(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@RequestAttribute Integer staffId,
|
||||
@RequestAttribute Integer globalAccessLevel,
|
||||
@PathVariable Integer projectId
|
||||
|
|
|
@ -39,16 +39,8 @@ public class ProjectGroupController {
|
|||
@GetMapping
|
||||
public ResponseList<ProjectGroupDTO> getGroupMembers(
|
||||
@PathVariable Integer projectId,
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
RequestPage page
|
||||
) {
|
||||
// if (projectGroupService.getProjectAccessLevel(token, projectId) == 0) {
|
||||
// throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT);
|
||||
// }
|
||||
// if (validateUtils.validate(page).isEmpty()) {
|
||||
// return ResponseList.ofSuccess(projectGroupService.pageProjectMembers(page, projectId));
|
||||
// }
|
||||
//return ResponseList.ofSuccess(projectGroupService.listProjectMembers(projectId));
|
||||
ResponseList<ProjectGroupDTO> groupMembers;
|
||||
if (validateUtils.validate(page).isEmpty()) {
|
||||
groupMembers = ResponseList.ofSuccess(projectGroupService.pageProjectMembers(page, projectId));
|
||||
|
@ -62,13 +54,9 @@ public class ProjectGroupController {
|
|||
@ProjectAuthorize("a != 0")
|
||||
@GetMapping("/{staffId}")
|
||||
public ResponseMap getDesignatedStaffPosition(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@PathVariable Integer projectId,
|
||||
@PathVariable Integer staffId
|
||||
) {
|
||||
// if (projectGroupService.getProjectAccessLevel(token, projectId) == 0) {
|
||||
// throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT);
|
||||
// }
|
||||
ProjectGroup designatedStaff = projectGroupService.getOne(
|
||||
Wrappers.<ProjectGroup>lambdaQuery()
|
||||
.eq(ProjectGroup::getStaffId, staffId)
|
||||
|
@ -83,7 +71,6 @@ public class ProjectGroupController {
|
|||
@ProjectAuthorize("a == 1")
|
||||
@PostMapping
|
||||
public ResponseMap addGroupMember(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@RequestAttribute Integer accessLevel,
|
||||
@PathVariable Integer projectId,
|
||||
@RequestBody GroupPositionVO groupPosition
|
||||
|
@ -97,7 +84,6 @@ public class ProjectGroupController {
|
|||
@ProjectAuthorize("a == 1")
|
||||
@DeleteMapping("/{staffId}")
|
||||
public ResponseMap deleteGroupMember(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@RequestAttribute Integer accessLevel,
|
||||
@PathVariable Integer projectId,
|
||||
@PathVariable Integer staffId
|
||||
|
@ -112,7 +98,6 @@ public class ProjectGroupController {
|
|||
@ProjectAuthorize("a > 0 && a <= 2")
|
||||
@PutMapping("/{staffId}")
|
||||
public ResponseMap modifyDesignatedStaffPosition(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@RequestAttribute Integer accessLevel,
|
||||
@PathVariable Integer projectId,
|
||||
@PathVariable Integer staffId,
|
||||
|
@ -126,7 +111,6 @@ public class ProjectGroupController {
|
|||
|
||||
@GetMapping("/stats")
|
||||
public ResponseMap getGroupPositionsStatistics(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@RequestAttribute Integer accessLevel,
|
||||
@PathVariable Integer projectId
|
||||
) {
|
||||
|
@ -137,7 +121,6 @@ public class ProjectGroupController {
|
|||
@ProjectAuthorize("a > 0 && a <= 2")
|
||||
@PutMapping("/{staffId}/transfer")
|
||||
public ResponseMap transferStaffTasks(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@PathVariable Integer projectId,
|
||||
@PathVariable Integer staffId,
|
||||
@RequestBody Map<Long, Integer> transferMap
|
||||
|
@ -152,7 +135,6 @@ public class ProjectGroupController {
|
|||
@ProjectAuthorize("a > 0 && a <= 2")
|
||||
@PutMapping("/{staffId}/transfer/{targetStaffId}")
|
||||
public ResponseMap transferTasksToSingleStaff(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@PathVariable Integer projectId,
|
||||
@PathVariable Integer staffId,
|
||||
@PathVariable Integer targetStaffId
|
||||
|
|
|
@ -49,10 +49,9 @@ public class StaffController {
|
|||
|
||||
@PostMapping(value = "/import")
|
||||
public ResponseMap importStaffs(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@RequestAttribute Integer staffGlobalLevel,
|
||||
@RequestParam("fileDigest") String digest,
|
||||
@RequestParam("uploadFile") MultipartFile uploadFile
|
||||
@RequestParam MultipartFile uploadFile
|
||||
) throws IOException {
|
||||
if (null == uploadFile) {
|
||||
throw new BadRequestException("文件传输错误");
|
||||
|
@ -68,22 +67,6 @@ public class StaffController {
|
|||
return ResponseMap.ofSuccess("成功导入" + successCount + "条数据");
|
||||
}
|
||||
|
||||
//取消功能
|
||||
/*@SneakyThrows
|
||||
@GetMapping("/import/template")
|
||||
public void downloadTemplate(
|
||||
@RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
HttpServletResponse response
|
||||
) {
|
||||
if (TokenUtils.getStaffGlobalLevel(token) > 2) {
|
||||
throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
|
||||
}
|
||||
if (FileUtils.downloadResource("static/public/账户导入模板.xlsx", response)) {
|
||||
return;
|
||||
}
|
||||
throw new BadRequestException(BadRequestException.OPERATE_FAILED);
|
||||
}*/
|
||||
|
||||
@GetMapping("/import/template")
|
||||
@ResponseStatus(HttpStatus.SEE_OTHER)
|
||||
public ResponseMap downloadTemplate() {
|
||||
|
|
|
@ -32,9 +32,8 @@ public class TaskController {
|
|||
@ProjectAuthorize("a != 0")
|
||||
@GetMapping("/{fatherId}/subtask")
|
||||
public ResponseList<TaskDTO> getSubTaskList(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@PathVariable("projectId") Integer projectId,
|
||||
@PathVariable("fatherId") Long fatherId
|
||||
@PathVariable Integer projectId,
|
||||
@PathVariable Long fatherId
|
||||
) {
|
||||
List<TaskDTO> result = taskService.listSubtasks(projectId, fatherId);
|
||||
return ResponseList.ofSuccess(result);
|
||||
|
@ -44,9 +43,8 @@ public class TaskController {
|
|||
@RateLimit(key = "TaskMine", permitsPerSecond = 40, maxBurstSeconds = 15, timeout = 1200)
|
||||
@GetMapping("/mine")
|
||||
public ResponseList<TaskDTO> getMyTasks(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@RequestAttribute Integer staffId,
|
||||
@PathVariable("projectId") Integer projectId
|
||||
@PathVariable Integer projectId
|
||||
) {
|
||||
List<TaskDTO> result = taskService.listMyTasks(staffId, projectId);
|
||||
return ResponseList.ofSuccess(result);
|
||||
|
@ -55,9 +53,8 @@ public class TaskController {
|
|||
@ProjectAuthorize("a != 0")
|
||||
@GetMapping("/subtask/exist")
|
||||
public ResponseMap existSubTask(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@PathVariable("projectId") Integer projectId,
|
||||
@RequestParam("taskId") Long taskId
|
||||
@PathVariable Integer projectId,
|
||||
@RequestParam Long taskId
|
||||
) {
|
||||
return ResponseMap.ofSuccess()
|
||||
.put("existSubTask", taskService.existSubTask(projectId, taskId));
|
||||
|
@ -65,11 +62,10 @@ public class TaskController {
|
|||
|
||||
@PostMapping
|
||||
public ResponseMap createTask(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@RequestAttribute Integer staffId,
|
||||
@RequestAttribute Integer globalAccessLevel,
|
||||
@RequestAttribute Integer accessLevel,
|
||||
@PathVariable("projectId") Integer projectId,
|
||||
@PathVariable Integer projectId,
|
||||
@RequestBody Task task
|
||||
) {
|
||||
if (!projectService.checkOpenStatus(projectId))
|
||||
|
@ -83,12 +79,11 @@ public class TaskController {
|
|||
@RateLimit(key = "TaskModify", permitsPerSecond = 40, maxBurstSeconds = 15, timeout = 1200)
|
||||
@PutMapping("/{taskId}")
|
||||
public ResponseMap modifyTask(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@RequestAttribute Integer staffId,
|
||||
@RequestAttribute Integer globalAccessLevel,
|
||||
@RequestAttribute Integer accessLevel,
|
||||
@PathVariable("projectId") Integer projectId,
|
||||
@PathVariable("taskId") Long taskId,
|
||||
@PathVariable Integer projectId,
|
||||
@PathVariable Long taskId,
|
||||
@RequestBody Task task
|
||||
) {
|
||||
if (!projectService.checkOpenStatus(projectId))
|
||||
|
@ -103,11 +98,10 @@ public class TaskController {
|
|||
@RateLimit(key = "TaskModify", permitsPerSecond = 40, maxBurstSeconds = 15, timeout = 1200)
|
||||
@DeleteMapping("/{taskId}")
|
||||
public ResponseMap deleteTaskAndSubTask(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@RequestAttribute Integer staffId,
|
||||
@RequestAttribute Integer globalAccessLevel,
|
||||
@PathVariable("projectId") Integer projectId,
|
||||
@PathVariable("taskId") Long taskId
|
||||
@PathVariable Integer projectId,
|
||||
@PathVariable Long taskId
|
||||
) {
|
||||
if (!projectService.checkOpenStatus(projectId))
|
||||
throw new BadRequestException(IProjectService.PROJECT_UNOPENED);
|
||||
|
@ -123,7 +117,6 @@ public class TaskController {
|
|||
@RateLimit(key = "TaskTrend", permitsPerSecond = 50, maxBurstSeconds = 15, timeout = 1200)
|
||||
@GetMapping("/stats/trend")
|
||||
public ResponseMap getTaskTrend(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@PathVariable Integer projectId
|
||||
) {
|
||||
if (!projectService.checkOpenStatus(projectId)) {
|
||||
|
@ -135,7 +128,6 @@ public class TaskController {
|
|||
@ProjectAuthorize("a != 0")
|
||||
@GetMapping("/stats/group")
|
||||
public ResponseMap getTaskNumOfEveryone(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@PathVariable Integer projectId
|
||||
) {
|
||||
return ResponseMap.ofSuccess("查询成功", taskService.getProjectProcessOfEveryone(projectId));
|
||||
|
@ -144,7 +136,6 @@ public class TaskController {
|
|||
@ProjectAuthorize("a != 0")
|
||||
@GetMapping({"/stats", "/stats/{targetStaffId}"})
|
||||
public ResponseList<StaffProcessDTO> getProjectStatistics(
|
||||
// @RequestHeader(TokenUtils.HEADER_TOKEN) String token,
|
||||
@RequestAttribute Integer staffId,
|
||||
@PathVariable Integer projectId,
|
||||
@PathVariable(required = false) Integer targetStaffId
|
||||
|
|
|
@ -18,8 +18,6 @@ public interface IAnnouncementService extends IService<Announcement> {
|
|||
|
||||
AnnouncementDTO getAnnouncementById(Integer projectId, Long announcementId);
|
||||
|
||||
// Boolean updateAnnouncement(Integer projectId, Announcement announcement) throws ForbiddenException, BadRequestException;
|
||||
|
||||
Boolean deleteAnnouncement(Integer projectId, Integer staffId, Integer globalAccessLevel, Long announcementId) throws ForbiddenException, BadRequestException;
|
||||
|
||||
}
|
||||
|
|
|
@ -37,8 +37,6 @@ public interface IProjectGroupService extends IService<ProjectGroup> {
|
|||
Integer getProjectAccessLevel(Integer staffId, Integer staffGlobalLevel, Integer projectId);
|
||||
|
||||
|
||||
Integer getProjectAccessLevelIgnoreGlobalLevel(String token, Integer projectId);
|
||||
|
||||
Integer getProjectAccessLevelIgnoreGlobalLevel(Integer staffId, Integer projectId);
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,8 +23,6 @@ public interface ITaskService extends IService<Task> {
|
|||
|
||||
Boolean deleteTaskAndSubTask(Integer staffId, Integer globalAccessLevel, Long taskId) throws BadRequestException, ForbiddenException;
|
||||
|
||||
// Boolean closeTaskAndSubTask(String token, Integer projectId, Long taskId) throws BadRequestException;
|
||||
|
||||
List<StaffProcessDTO> getProjectStatistics(Integer projectId, Integer staffId) throws BadRequestException, ForbiddenException;
|
||||
|
||||
/**
|
||||
|
@ -32,13 +30,6 @@ public interface ITaskService extends IService<Task> {
|
|||
*/
|
||||
Integer getHolderLevel(Integer staffId, Integer staffGlobalLevel, Long taskId);
|
||||
|
||||
/**
|
||||
* 对拥有项目一级/二级访问权限的员工,直接返回1
|
||||
*
|
||||
* @return 1:all rights 2:father holder 3:current holder 0:no right
|
||||
*/
|
||||
// Integer getHolderLevel(String token, Long taskId);
|
||||
|
||||
List<TaskDTO> listMyTasks(Integer staffId, Integer projectId) throws BadRequestException, ForbiddenException;
|
||||
|
||||
Boolean canBeDone(Long taskId);
|
||||
|
|
|
@ -35,25 +35,6 @@ public class AnnouncementServiceImpl extends ServiceImpl<AnnouncementMapper, Ann
|
|||
return baseMapper.selectAnnouncementById(projectId, announcementId);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public Boolean updateAnnouncement(Integer projectId, Announcement announcement) throws ForbiddenException, BadRequestException {
|
||||
// Integer accessLevel = projectGroupService.getProjectAccessLevel(token, projectId);
|
||||
// if (accessLevel == 0) {
|
||||
// throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT);
|
||||
// }
|
||||
// if (accessLevel > 2) {
|
||||
// throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
|
||||
// }
|
||||
// Announcement rawAnnouncement = baseMapper.selectById(announcement.getAnnouncementId());
|
||||
// if (projectGroupService.compareProjectAccessLevel(projectId, token, rawAnnouncement.getAnnouncementPublisherId()) <= 0) {
|
||||
// if (!announcement.checkModification(rawAnnouncement)) {
|
||||
// throw new BadRequestException(BadRequestException.WRONG_PARAMETERS);
|
||||
// }
|
||||
// return updateById(announcement);
|
||||
// }
|
||||
// throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public Boolean deleteAnnouncement(
|
||||
Integer staffId,
|
||||
|
@ -61,13 +42,6 @@ public class AnnouncementServiceImpl extends ServiceImpl<AnnouncementMapper, Ann
|
|||
Integer projectId,
|
||||
Long announcementId
|
||||
) throws ForbiddenException, BadRequestException {
|
||||
// Integer accessLevel = projectGroupService.getProjectAccessLevel(token, projectId);
|
||||
// if (accessLevel == 0) {
|
||||
// throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT);
|
||||
// }
|
||||
// if (accessLevel > 2) {
|
||||
// throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
|
||||
// }
|
||||
Announcement rawAnnouncement = baseMapper.selectOne(Wrappers.<Announcement>lambdaQuery()
|
||||
.select(Announcement::getProjectId, Announcement::getAnnouncementPublisherId)
|
||||
.eq(Announcement::getAnnouncementId, announcementId)
|
||||
|
|
|
@ -8,7 +8,6 @@ import cn.edu.hfut.rmdjzz.projectmanagement.exception.ForbiddenException;
|
|||
import cn.edu.hfut.rmdjzz.projectmanagement.mapper.ProjectGroupMapper;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectGroupService;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.service.IStaffService;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.utils.TokenUtils;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.RequestPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
@ -43,29 +42,8 @@ public class ProjectGroupServiceImpl extends ServiceImpl<ProjectGroupMapper, Pro
|
|||
return baseMapper.insert(projectGroup) == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean insertNewMember(int accessLevel, Integer projectId, String targetUsername, String positions) throws ForbiddenException, BadRequestException {
|
||||
if (targetUsername.equals("root")) {
|
||||
throw new BadRequestException(IStaffService.STAFF_DOES_NOT_EXIST);
|
||||
}
|
||||
//int accessLevel = getProjectAccessLevel(token, projectId);
|
||||
int targetLevel = 3;
|
||||
|
||||
Staff targetStaff = staffService.getOne(Wrappers.<Staff>lambdaQuery().eq(Staff::getStaffUsername, targetUsername));
|
||||
if (targetStaff == null) {
|
||||
throw new BadRequestException(IStaffService.STAFF_DOES_NOT_EXIST);
|
||||
}
|
||||
if (getProjectAccessLevelIgnoreGlobalLevel(targetStaff.getStaffId(), projectId) != 0) {
|
||||
throw new BadRequestException("该成员已经在本项目中");
|
||||
}
|
||||
|
||||
if (accessLevel == 0) {
|
||||
throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT);
|
||||
}
|
||||
if (accessLevel > 2) {
|
||||
throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
|
||||
}
|
||||
String[] positionArray = positions.split(",");
|
||||
private void buildPositions(ProjectGroup projectGroup, int accessLevel) {
|
||||
String[] positionArray = projectGroup.getProjectStaffPosition().split(",");
|
||||
for (String position : positionArray) {
|
||||
position = position.strip();
|
||||
if (position.equals(POSITION_1)) {
|
||||
|
@ -75,12 +53,30 @@ public class ProjectGroupServiceImpl extends ServiceImpl<ProjectGroupMapper, Pro
|
|||
if (accessLevel != 1) {
|
||||
throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
|
||||
}
|
||||
targetLevel = 2;
|
||||
projectGroup.setProjectAccessLevel(2);
|
||||
}
|
||||
}
|
||||
positions = String.join(",", positionArray);
|
||||
projectGroup.setProjectStaffPosition(String.join(",", positionArray));
|
||||
}
|
||||
|
||||
return baseMapper.insert(new ProjectGroup(targetStaff.getStaffId(), projectId, positions, targetLevel)) == 1;
|
||||
@Override
|
||||
public Boolean insertNewMember(int accessLevel, Integer projectId, String targetUsername, String positions) throws ForbiddenException, BadRequestException {
|
||||
if (targetUsername.equals("root")) {
|
||||
throw new BadRequestException(IStaffService.STAFF_DOES_NOT_EXIST);
|
||||
}
|
||||
int targetLevel = 3;
|
||||
|
||||
Staff targetStaff = staffService.getOne(Wrappers.<Staff>lambdaQuery().eq(Staff::getStaffUsername, targetUsername));
|
||||
if (targetStaff == null) {
|
||||
throw new BadRequestException(IStaffService.STAFF_DOES_NOT_EXIST);
|
||||
}
|
||||
if (getProjectAccessLevelIgnoreGlobalLevel(targetStaff.getStaffId(), projectId) != 0) {
|
||||
throw new BadRequestException("该成员已经在本项目中");
|
||||
}
|
||||
ProjectGroup newProjectGroupRelation = new ProjectGroup(targetStaff.getStaffId(), projectId, positions, targetLevel);
|
||||
buildPositions(newProjectGroupRelation, accessLevel);
|
||||
|
||||
return baseMapper.insert(newProjectGroupRelation) == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -99,8 +95,6 @@ public class ProjectGroupServiceImpl extends ServiceImpl<ProjectGroupMapper, Pro
|
|||
|
||||
@Override
|
||||
public Boolean updateStaffPositions(Integer accessLevel, Integer projectId, Integer targetId, String positions) throws ForbiddenException, BadRequestException {
|
||||
//int accessLevel = getProjectAccessLevel(token, projectId);
|
||||
//int originTargetLevel = getProjectAccessLevelIgnoreGlobalLevel(targetId, projectId);
|
||||
ProjectGroup originProjectGroup = baseMapper.selectOne(Wrappers.<ProjectGroup>lambdaQuery()
|
||||
.select(ProjectGroup::getProjectStaffPosition, ProjectGroup::getProjectAccessLevel)
|
||||
.eq(ProjectGroup::getStaffId, targetId)
|
||||
|
@ -114,34 +108,16 @@ public class ProjectGroupServiceImpl extends ServiceImpl<ProjectGroupMapper, Pro
|
|||
}
|
||||
int targetLevel = 3;
|
||||
|
||||
/*if (accessLevel == 0) {
|
||||
throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT);
|
||||
}
|
||||
if (accessLevel > 2 || accessLevel >= originProjectGroup.getProjectAccessLevel()) {
|
||||
throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
|
||||
}*/
|
||||
String[] positionArray = positions.split(",");
|
||||
for (String position : positionArray) {
|
||||
position = position.strip();
|
||||
if (position.equals(POSITION_1)) {
|
||||
throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
|
||||
}
|
||||
if (position.equals(POSITION_2)) {
|
||||
if (accessLevel != 1) {
|
||||
throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
|
||||
}
|
||||
targetLevel = 2;
|
||||
}
|
||||
}
|
||||
positions = String.join(",", positionArray);
|
||||
ProjectGroup newProjectGroupRelation = new ProjectGroup(targetId, projectId, positions, targetLevel);
|
||||
buildPositions(newProjectGroupRelation, accessLevel);
|
||||
|
||||
return baseMapper.update(
|
||||
null,
|
||||
Wrappers.<ProjectGroup>lambdaUpdate()
|
||||
.eq(ProjectGroup::getProjectId, projectId)
|
||||
.eq(ProjectGroup::getStaffId, targetId)
|
||||
.set(ProjectGroup::getProjectStaffPosition, positions)
|
||||
.set(ProjectGroup::getProjectAccessLevel, targetLevel)
|
||||
.eq(ProjectGroup::getProjectId, newProjectGroupRelation.getProjectId())
|
||||
.eq(ProjectGroup::getStaffId, newProjectGroupRelation.getStaffId())
|
||||
.set(ProjectGroup::getProjectStaffPosition, newProjectGroupRelation.getProjectStaffPosition())
|
||||
.set(ProjectGroup::getProjectAccessLevel, newProjectGroupRelation.getProjectAccessLevel())
|
||||
) == 1;
|
||||
}
|
||||
|
||||
|
@ -154,12 +130,6 @@ public class ProjectGroupServiceImpl extends ServiceImpl<ProjectGroupMapper, Pro
|
|||
return getProjectAccessLevelIgnoreGlobalLevel(staffId, projectId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getProjectAccessLevelIgnoreGlobalLevel(String token, Integer projectId) {
|
||||
Integer staffId = TokenUtils.getStaffId(token);
|
||||
return getProjectAccessLevelIgnoreGlobalLevel(staffId, projectId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getProjectAccessLevelIgnoreGlobalLevel(Integer staffId, Integer projectId) {
|
||||
try {
|
||||
|
|
|
@ -38,23 +38,15 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|||
|
||||
@Override
|
||||
public ProjectProcessDTO getProjectProcess(Integer staffId, Integer globalAccessLevel, Integer projectId) throws ForbiddenException, BadRequestException {
|
||||
// if (projectGroupService.getProjectAccessLevel(staffId, globalAccessLevel, projectId) == 0) {
|
||||
// throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT);
|
||||
// }
|
||||
// if (Objects.equals(projectId, 0)) {
|
||||
// throw new BadRequestException(BadRequestException.WRONG_PARAMETERS);
|
||||
// }
|
||||
return baseMapper.selectProjectProcess(projectId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ProjectDTO> pageMyProjects(
|
||||
// String token,
|
||||
Integer staffId,
|
||||
RequestPage page,
|
||||
Map<String, Object> params
|
||||
) {
|
||||
// Integer staffId = TokenUtils.getStaffGlobalLevel(token) == 1 ? null : TokenUtils.getStaffId(token);
|
||||
IPage<ProjectDTO> userPage = baseMapper.selectMyProject(page.getPage(), staffId, WrapperUtils.allEqAndTimeIntervalQueryWrapper(params));
|
||||
return (Page<ProjectDTO>) userPage;
|
||||
}
|
||||
|
@ -63,12 +55,6 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|||
public Boolean setProjectCompleted(
|
||||
Project targetProject
|
||||
) throws BadRequestException, ForbiddenException {
|
||||
// Project targetProject = baseMapper.selectById(project.getProjectId());
|
||||
// if (targetProject == null)
|
||||
// throw new BadRequestException(BadRequestException.WRONG_PARAMETERS);
|
||||
/*if (!Objects.equals(staffId, targetProject.getProjectCreator())
|
||||
&& !Objects.equals(globalAccessLevel, 1))
|
||||
throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);*/
|
||||
targetProject.setCompleted(true);
|
||||
targetProject.setProjectClosedDate(LocalDate.now());
|
||||
if (baseMapper.updateById(targetProject) == 1)
|
||||
|
@ -78,15 +64,12 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|||
|
||||
@Override
|
||||
public Boolean createProject(Integer staffId, Project project) throws BadRequestException, ForbiddenException {
|
||||
// Integer staffGlobalLevel = TokenUtils.getStaffGlobalLevel(token);
|
||||
// if (staffGlobalLevel == 0 || staffGlobalLevel > 2) {
|
||||
// throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
|
||||
// }
|
||||
project.setProjectId(null);
|
||||
project.setCompleted(false);
|
||||
project.setProjectCreatedTime(null);
|
||||
project.setProjectCreator(staffId);
|
||||
project.setProjectClosedDate(null);
|
||||
|
||||
if (project.getExpectedCompletion() == null) {
|
||||
project.setExpectedCompletion((short) 100);
|
||||
} else if (project.getExpectedCompletion() < 0 || project.getExpectedCompletion() > 100 ||
|
||||
|
@ -100,7 +83,6 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|||
return projectGroupService.addCreator(project.getProjectId(), staffId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// log.error(e.getMessage(), e);
|
||||
throw new BadRequestException(BadRequestException.OPERATE_FAILED);
|
||||
}
|
||||
return false;
|
||||
|
@ -114,10 +96,6 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|||
}
|
||||
|
||||
public Boolean updateProject(Integer staffId, Project project) throws BadRequestException, ForbiddenException {
|
||||
// Integer staffId = TokenUtils.getStaffId(token);
|
||||
// if (!staffId.equals(project.getProjectCreator()) && TokenUtils.getStaffGlobalLevel(token) != 1) {
|
||||
// throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
|
||||
// }
|
||||
Project rawProject = baseMapper.selectById(project.getProjectId());
|
||||
if (Objects.equals(project, rawProject)) {
|
||||
return true;
|
||||
|
@ -130,7 +108,6 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|||
return true;
|
||||
throw new BadRequestException(BadRequestException.OPERATE_FAILED);
|
||||
} catch (Exception e) {
|
||||
// log.error(e.getMessage(), e);
|
||||
throw new BadRequestException(BadRequestException.OPERATE_FAILED);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,28 +146,22 @@ public class StaffServiceImpl extends ServiceImpl<StaffMapper, Staff> implements
|
|||
if (totalCount < 1) {
|
||||
throw new BadRequestException("读取不到条目");
|
||||
}
|
||||
// log.debug(totalCount);
|
||||
// log.debug(staffUsernameC);
|
||||
if (!xlsxColumnGetter("staffPassword", 1, staffPasswordC, sheet) ||
|
||||
staffPasswordC.size() != totalCount) {
|
||||
throw new BadRequestException("读取列staffPassword失败");
|
||||
}
|
||||
// log.debug(staffPasswordC);
|
||||
if (!xlsxColumnGetter("staffFullname", 2, staffFullnameC, sheet) ||
|
||||
staffFullnameC.size() != totalCount) {
|
||||
throw new BadRequestException("读取列staffFullname失败");
|
||||
}
|
||||
// log.debug(staffFullnameC);
|
||||
if (!xlsxColumnGetter("staffGender", 3, staffGenderC, sheet) ||
|
||||
staffGenderC.size() != totalCount) {
|
||||
throw new BadRequestException("读取列staffGender失败");
|
||||
}
|
||||
// log.debug(staffGenderC);
|
||||
if (!xlsxColumnGetter("staffGlobalLevel", 4, staffGlobalLevelC, sheet) ||
|
||||
staffGlobalLevelC.size() != totalCount) {
|
||||
throw new BadRequestException("读取列staffGlobalLevel失败");
|
||||
}
|
||||
// log.debug(staffGlobalLevelC);
|
||||
if (staffGlobalLevelC.stream().anyMatch(level -> Integer.parseInt(level) < 2)) {
|
||||
throw new BadRequestException("列staffGlobalLevel无效");
|
||||
}
|
||||
|
@ -184,7 +178,6 @@ public class StaffServiceImpl extends ServiceImpl<StaffMapper, Staff> implements
|
|||
staff.setStaffFullname(staffFullnameC.get(i));
|
||||
staff.setStaffGender(staffGenderC.get(i));
|
||||
staff.setStaffGlobalLevel(Integer.parseInt(staffGlobalLevelC.get(i)));
|
||||
// log.debug(staff);
|
||||
if (baseMapper.insert(staff) != 1) {
|
||||
throw new BadRequestException("第" + (i + 1) + "行数据错误");
|
||||
}
|
||||
|
|
|
@ -38,9 +38,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
|||
|
||||
@Override
|
||||
public List<TaskDTO> listSubtasks(Integer projectId, Long fatherId) throws ForbiddenException, BadRequestException {
|
||||
// if (projectGroupService.getProjectAccessLevel(token, projectId) == 0) {
|
||||
// throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT);
|
||||
// }
|
||||
if (fatherId == null) {
|
||||
throw new BadRequestException(BadRequestException.WRONG_PARAMETERS);
|
||||
}
|
||||
|
@ -52,9 +49,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
|||
|
||||
@Override
|
||||
public Boolean existSubTask(Integer projectId, Long taskId) throws ForbiddenException {
|
||||
// if (projectGroupService.getProjectAccessLevel(token, projectId) == 0) {
|
||||
// throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT);
|
||||
// }
|
||||
return baseMapper.exists(Wrappers.<Task>lambdaQuery().eq(Task::getTaskFatherId, taskId));
|
||||
}
|
||||
|
||||
|
@ -65,13 +59,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
|||
Integer globalAccessLevel,
|
||||
Long taskId
|
||||
) throws BadRequestException, ForbiddenException {
|
||||
// Integer level = getHolderLevel(staffId, globalAccessLevel, taskId);
|
||||
// if (projectGroupService.getProjectAccessLevel(token, projectId) == 0) {
|
||||
// throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT);
|
||||
// }
|
||||
// if (level == 0 || level == 3) {
|
||||
// throw new BadRequestException(BadRequestException.WRONG_PARAMETERS);
|
||||
// }
|
||||
try {
|
||||
List<Long> res = new ArrayList<>();
|
||||
// 添加根任务点Id,获得子节点数目
|
||||
|
@ -99,7 +86,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
|||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
// log.error(e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -107,9 +93,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
|||
@Transactional(isolation = Isolation.SERIALIZABLE, rollbackFor = Exception.class)
|
||||
public Boolean closeTaskAndSubTask(Integer staffId, Integer globalAccessLevel, Long taskId) throws BadRequestException {
|
||||
Integer level = getHolderLevel(staffId, globalAccessLevel, taskId);
|
||||
// if (projectGroupService.getProjectAccessLevel(token, projectId) == 0) {
|
||||
// throw new BadRequestException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT);
|
||||
// }
|
||||
if (level == 0) {
|
||||
throw new BadRequestException(BadRequestException.WRONG_PARAMETERS);
|
||||
}
|
||||
|
@ -139,19 +122,12 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
|||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
// log.error(e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StaffProcessDTO> getProjectStatistics(Integer projectId, Integer staffId) throws ForbiddenException {
|
||||
// if (staffId != null && !TokenUtils.getStaffId(token).equals(staffId)) {
|
||||
// throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT);
|
||||
// }
|
||||
// if (projectGroupService.getProjectAccessLevel(token, projectId) == 0) {
|
||||
// throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT);
|
||||
// }
|
||||
List<StaffProcessDTO> resList = baseMapper.selectProjectProcess(projectId, staffId);
|
||||
addResultProjectProcess(resList, Task.TYPE_ASSIGNMENT);
|
||||
addResultProjectProcess(resList, Task.TYPE_DEFECT);
|
||||
|
@ -201,18 +177,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
|||
}
|
||||
return count;
|
||||
} catch (Exception e) {
|
||||
// log.error(e.getMessage(), e);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public Integer getHolderLevel(String token, Long taskId) {
|
||||
// Integer staffId = TokenUtils.getStaffId(token);
|
||||
// Integer staffGlobalLevel = TokenUtils.getStaffGlobalLevel(token);
|
||||
// return getHolderLevel(staffId, staffGlobalLevel, taskId);
|
||||
// }
|
||||
|
||||
private int lowerBound(List<Task> data, long x) {
|
||||
int l = 0, r = data.size() - 1;
|
||||
while (l < r) {
|
||||
|
@ -238,10 +206,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
|||
|
||||
@Override
|
||||
public List<TaskDTO> listMyTasks(Integer staffId, Integer projectId) throws ForbiddenException {
|
||||
// Integer staffId = TokenUtils.getStaffId(token);
|
||||
// if (projectGroupService.getProjectAccessLevel(token, projectId) == 0) {
|
||||
// throw new ForbiddenException("不可操作的项目");
|
||||
// }
|
||||
List<Task> resList = baseMapper.selectList(Wrappers.<Task>lambdaQuery()
|
||||
.select(Task::getTaskId, Task::getTaskFatherId, Task::getTaskHolderId)
|
||||
.eq(Task::getTaskProjectId, projectId)
|
||||
|
@ -289,7 +253,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
|||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
// log.error(e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -302,10 +265,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
|||
Task task
|
||||
) throws BadRequestException, ForbiddenException {
|
||||
task.setTaskId(null);
|
||||
// Integer userLevel = projectGroupService.getProjectAccessLevel(token, task.getTaskProjectId());
|
||||
// if (userLevel == 0) {
|
||||
// throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT);
|
||||
// }
|
||||
if (!task.checkInsert()) {
|
||||
throw new BadRequestException(BadRequestException.WRONG_PARAMETERS);
|
||||
}
|
||||
|
@ -341,7 +300,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
|||
Integer accessLevel,
|
||||
Task task
|
||||
) throws BadRequestException, ForbiddenException {
|
||||
// Integer userLevel = projectGroupService.getProjectAccessLevel(token, task.getTaskProjectId());
|
||||
Task rawTask = baseMapper.selectOne(Wrappers.<Task>lambdaQuery().eq(Task::getTaskId, task.getTaskId()));
|
||||
if (accessLevel == 0 || (accessLevel == 3 && getHolderLevel(staffId, globalAccessLevel, task.getTaskId()) == 0)) {
|
||||
throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
|
||||
|
@ -353,7 +311,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
|||
if (task.getTaskStatus().equals(Task.STATUS_CLOSED))
|
||||
typeChangeValue = 2;
|
||||
}
|
||||
// log.debug(!task.checkModification(rawTask));
|
||||
if (!task.checkModification(rawTask) || !task.checkInsert()) {
|
||||
throw new BadRequestException(BadRequestException.WRONG_PARAMETERS);
|
||||
}
|
||||
|
@ -375,7 +332,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
|||
throw new BadRequestException(BadRequestException.OPERATE_FAILED);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// log.error(e.getMessage(), e);
|
||||
throw new BadRequestException(BadRequestException.OPERATE_FAILED);
|
||||
}
|
||||
return task;
|
||||
|
@ -384,9 +340,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
|||
// 完成任务数目概况统计
|
||||
@Override
|
||||
public Map<String, List<TaskTrendDTO>> getProjectTaskTrend(Integer projectId) throws ForbiddenException {
|
||||
// if (projectGroupService.getProjectAccessLevel(token, projectId) == 0) {
|
||||
// throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
|
||||
// }
|
||||
// 起止日期
|
||||
LocalDate endDate = LocalDate.now();
|
||||
LocalDate startDate = endDate.plusDays(-14);
|
||||
|
@ -482,19 +435,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
|||
return taskTrendDTO;
|
||||
}
|
||||
|
||||
// FIXME
|
||||
@Transactional(isolation = Isolation.SERIALIZABLE, rollbackFor = Exception.class)
|
||||
@Override
|
||||
public Boolean transferStaffTasks(Integer projectId, Integer transferredStaffId, Map<Long, Integer> transferMap) throws ForbiddenException, BadRequestException {
|
||||
// if (
|
||||
//// projectGroupService.getProjectAccessLevel(token, projectId) == 0 ||
|
||||
// projectGroupService.getProjectAccessLevelIgnoreGlobalLevel(transferredStaffId, projectId) == 0) {
|
||||
// throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT);
|
||||
// }
|
||||
// if (projectGroupService.compareProjectAccessLevel(projectId, token, transferredStaffId) > 0) {
|
||||
// throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
|
||||
// }
|
||||
|
||||
Map<Long, Task> originTransferTaskMap = SimpleQuery.keyMap(
|
||||
Wrappers.<Task>lambdaQuery()
|
||||
.eq(Task::getTaskProjectId, projectId)
|
||||
|
@ -538,19 +481,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
|||
}
|
||||
|
||||
|
||||
// FIXME
|
||||
@Transactional(isolation = Isolation.SERIALIZABLE, rollbackFor = Exception.class)
|
||||
@Override
|
||||
public Boolean transferTasksToSingleStaff(Integer projectId, Integer transferredStaffId, Integer targetStaffId) throws ForbiddenException, BadRequestException {
|
||||
// if (
|
||||
//// projectGroupService.getProjectAccessLevel(token, projectId) == 0 ||
|
||||
// projectGroupService.getProjectAccessLevelIgnoreGlobalLevel(transferredStaffId, projectId) == 0
|
||||
// || projectGroupService.getProjectAccessLevelIgnoreGlobalLevel(targetStaffId, projectId) == 0) {
|
||||
// throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT);
|
||||
// }
|
||||
// if (projectGroupService.compareProjectAccessLevel(projectId, token, transferredStaffId) > 0) {
|
||||
// throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
|
||||
// }
|
||||
Long transferredTaskCount = baseMapper.selectCount(Wrappers.<Task>lambdaQuery()
|
||||
.eq(Task::getTaskHolderId, transferredStaffId)
|
||||
.and(wrapper -> wrapper
|
||||
|
@ -574,9 +507,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
|||
|
||||
@Override
|
||||
public Map<String, Long> getProjectProcessOfEveryone(Integer projectId) throws ForbiddenException {
|
||||
// if (projectGroupService.getProjectAccessLevel(token, projectId) == 0) {
|
||||
// throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT);
|
||||
// }
|
||||
Map<String, Long> resMap = new HashMap<>();
|
||||
List<TaskNumOfEveryoneDTO> resList = baseMapper.selectProjectProcessOfEveryone(projectId);
|
||||
for (TaskNumOfEveryoneDTO taskNumOfEveryoneDTO : resList) {
|
||||
|
|
Loading…
Reference in New Issue