Merge remote-tracking branch 'origin/master'

master
ArgonarioD 2022-07-12 16:31:54 +08:00
commit 056a5ee8f7
2 changed files with 7 additions and 2 deletions

View File

@ -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);

View File

@ -213,6 +213,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;
@ -223,8 +225,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)