diff --git a/src/main/java/cn/edu/hfut/rmdjzz/projectmanagement/mapper/TaskMapper.java b/src/main/java/cn/edu/hfut/rmdjzz/projectmanagement/mapper/TaskMapper.java index d4ee807..08a2ae8 100644 --- a/src/main/java/cn/edu/hfut/rmdjzz/projectmanagement/mapper/TaskMapper.java +++ b/src/main/java/cn/edu/hfut/rmdjzz/projectmanagement/mapper/TaskMapper.java @@ -20,8 +20,6 @@ import java.util.List; public interface TaskMapper extends BaseMapper { List selectTaskList(@Param(Constants.WRAPPER) Wrapper wrapper); - List selectSubTaskList(@Param("projectId") Integer projectId, @Param("fatherId") Long fatherId); - List selectProjectProcess(@Param("projectId") Integer projectId, @Param("staffId") Integer staffId); List selectClosedTaskTrendBeforeDate(@Param("projectId") Integer projectId, @Param("startDate") LocalDate startDate); diff --git a/src/main/java/cn/edu/hfut/rmdjzz/projectmanagement/service/impl/ProjectGroupServiceImpl.java b/src/main/java/cn/edu/hfut/rmdjzz/projectmanagement/service/impl/ProjectGroupServiceImpl.java index b474e82..0f8e546 100644 --- a/src/main/java/cn/edu/hfut/rmdjzz/projectmanagement/service/impl/ProjectGroupServiceImpl.java +++ b/src/main/java/cn/edu/hfut/rmdjzz/projectmanagement/service/impl/ProjectGroupServiceImpl.java @@ -93,12 +93,13 @@ public class ProjectGroupServiceImpl extends ServiceImpl 2 || accessLevel >= targetLevel) { + if (accessLevel > 2 || accessLevel >= originTargetLevel) { throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE); } String[] positionArray = positions.split(","); diff --git a/src/main/java/cn/edu/hfut/rmdjzz/projectmanagement/service/impl/TaskServiceImpl.java b/src/main/java/cn/edu/hfut/rmdjzz/projectmanagement/service/impl/TaskServiceImpl.java index 35f3b41..48f65b1 100644 --- a/src/main/java/cn/edu/hfut/rmdjzz/projectmanagement/service/impl/TaskServiceImpl.java +++ b/src/main/java/cn/edu/hfut/rmdjzz/projectmanagement/service/impl/TaskServiceImpl.java @@ -45,7 +45,10 @@ public class TaskServiceImpl extends ServiceImpl implements IT if (fatherId == null) { throw new BadRequestException(BadRequestException.WRONG_PARAMETERS); } - return baseMapper.selectSubTaskList(projectId, fatherId); + return baseMapper.selectTaskList(Wrappers.lambdaQuery() + .eq(Task::getTaskProjectId, projectId) + .eq(Task::getTaskFatherId, fatherId) + .eq(Task::getDeleted, false)); } @Override @@ -132,7 +135,7 @@ public class TaskServiceImpl extends ServiceImpl implements IT @Override public List getProjectStatistics(String token, Integer projectId, Integer staffId) throws ForbiddenException { - if(staffId != null && !TokenUtils.getStaffId(token).equals(staffId)) { + if (staffId != null && !TokenUtils.getStaffId(token).equals(staffId)) { throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT); } if (projectGroupService.getProjectAccessLevel(token, projectId) == 0) { @@ -519,13 +522,13 @@ public class TaskServiceImpl extends ServiceImpl implements IT } @Override - public Map getProjectProcessOfEveryone(String token, Integer projectId) throws ForbiddenException{ - if(projectGroupService.getProjectAccessLevel(token, projectId) == 0) { + public Map getProjectProcessOfEveryone(String token, Integer projectId) throws ForbiddenException { + if (projectGroupService.getProjectAccessLevel(token, projectId) == 0) { throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT); } Map resMap = new HashMap<>(); List resList = baseMapper.selectProjectProcessOfEveryone(projectId); - for(TaskNumOfEveryoneDTO taskNumOfEveryoneDTO: resList) { + for (TaskNumOfEveryoneDTO taskNumOfEveryoneDTO : resList) { resMap.put(taskNumOfEveryoneDTO.getStaffFullname(), taskNumOfEveryoneDTO.getCompletedNum()); } return resMap; diff --git a/src/main/resources/mapper/TaskMapper.xml b/src/main/resources/mapper/TaskMapper.xml index 9686caa..4920d12 100644 --- a/src/main/resources/mapper/TaskMapper.xml +++ b/src/main/resources/mapper/TaskMapper.xml @@ -27,29 +27,6 @@ JOIN (SELECT staff_id, staff_fullname FROM staff) AS s ON t.task_holder_id = s.staff_id ${ew.customSqlSegment} -