From f7a420ca73581f226af38b0f4eb40e6d9ee9bfb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B0=81=E7=BE=BD?= <2360164671@qq.com> Date: Mon, 4 Jul 2022 19:06:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BA=86Task=E7=9A=84?= =?UTF-8?q?=E9=97=B4=E6=8E=A5=E6=8B=A5=E6=9C=89=E6=9D=83=E9=99=90=E6=A3=80?= =?UTF-8?q?=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/ITaskService.java | 1 + .../service/impl/TaskServiceImpl.java | 20 ++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/main/java/cn/edu/hfut/rmdjzz/projectmanagement/service/ITaskService.java b/src/main/java/cn/edu/hfut/rmdjzz/projectmanagement/service/ITaskService.java index 55372e2..bb36d34 100644 --- a/src/main/java/cn/edu/hfut/rmdjzz/projectmanagement/service/ITaskService.java +++ b/src/main/java/cn/edu/hfut/rmdjzz/projectmanagement/service/ITaskService.java @@ -13,4 +13,5 @@ import java.util.List; */ public interface ITaskService extends IService { List getTaskList(String token,Integer projectId,Integer fatherId) throws BadRequestException; + Boolean checkHolder(Integer staffId,Integer taskId); } 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 e20deca..739c49e 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 @@ -15,6 +15,7 @@ import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; +import java.util.Objects; /** * @author 张韬 @@ -29,6 +30,23 @@ public class TaskServiceImpl extends ServiceImpl implements IT if(projectGroupServiceImpl.getUserLevelInGroup(token,projectId)==0||fatherId==null){ throw new BadRequestException("错误的访问参数"); } - return baseMapper.selectList(Wrappers.lambdaQuery().eq(Task::getTaskProjectId,projectId).eq(Task::getTaskFatherId,fatherId)); + return baseMapper.selectList(Wrappers.lambdaQuery().eq(Task::getTaskProjectId,projectId).eq(Task::getTaskFatherId,fatherId).eq(Task::getDeleted,false)); + } + + @Override + public Boolean checkHolder(Integer staffId,Integer taskId){ + try{ + Task task=baseMapper.selectOne(Wrappers.lambdaQuery().eq(Task::getTaskId,taskId)); + if(task==null||staffId<=0) + return false; + while(task.getTaskFatherId()!=0){ + if(Objects.equals(task.getTaskHolderId(), staffId)) + return true; + task=baseMapper.selectOne(Wrappers.lambdaQuery().eq(Task::getTaskId,task.getTaskFatherId())); + } + return false; + }catch(Exception e){ + return false; + } } }