修复了upperBound的边界问题,添加了异常签名
parent
76966938a1
commit
6a37f2387e
|
@ -38,7 +38,7 @@ public interface ITaskService extends IService<Task> {
|
|||
*/
|
||||
Integer getHolderLevel(String token, Long taskId);
|
||||
|
||||
List<TaskDTO> listMyTasks(String token, Integer projectId) throws BadRequestException;
|
||||
List<TaskDTO> listMyTasks(String token, Integer projectId) throws BadRequestException, ForbiddenException;
|
||||
|
||||
Boolean canBeDone(Long taskId);
|
||||
|
||||
|
|
|
@ -210,6 +210,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
|||
|
||||
private int upperBound(List<Task> data, long x) {
|
||||
int l = 0, r = data.size() - 1;
|
||||
if(data.get(r).getTaskFatherId().equals(x))
|
||||
return r;
|
||||
while (l < r) {
|
||||
int mid = (l + r) / 2;
|
||||
if (data.get(mid).getTaskFatherId() <= x) l = mid + 1;
|
||||
|
@ -220,8 +222,11 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
|||
|
||||
|
||||
@Override
|
||||
public List<TaskDTO> listMyTasks(String token, Integer projectId) {
|
||||
public List<TaskDTO> listMyTasks(String token, 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)
|
||||
|
|
Loading…
Reference in New Issue