Compare commits
No commits in common. "12467b677852dc9c1eb3a720c486962849aa3e28" and "152131c4d7cb95485d6bda8f1b3f30863108e05b" have entirely different histories.
12467b6778
...
152131c4d7
|
@ -13,9 +13,6 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface ITaskService extends IService<Task> {
|
public interface ITaskService extends IService<Task> {
|
||||||
List<Task> getTaskList(String token,Integer projectId,Long fatherId) throws BadRequestException;
|
List<Task> getTaskList(String token,Integer projectId,Long fatherId) throws BadRequestException;
|
||||||
List<List<Long>> getTaskAndSubTask(Long taskId);
|
|
||||||
Boolean deleteTaskAndSubTask(String token, Integer projectId, Long taskId) throws BadRequestException;
|
|
||||||
Boolean closeTaskAndSubTask(String token, Integer projectId, Long taskId) throws BadRequestException;
|
|
||||||
Boolean checkHolder(Integer staffId,Long taskId);
|
Boolean checkHolder(Integer staffId,Long taskId);
|
||||||
Boolean checkHolder(String token,Long taskId);
|
Boolean checkHolder(String token,Long taskId);
|
||||||
List<Task> getMyTaskList(String token,Integer projectId) throws BadRequestException;
|
List<Task> getMyTaskList(String token,Integer projectId) throws BadRequestException;
|
||||||
|
|
|
@ -19,7 +19,6 @@ import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 张韬
|
* @author 张韬
|
||||||
|
@ -37,59 +36,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
||||||
return baseMapper.selectList(Wrappers.<Task>lambdaQuery().eq(Task::getTaskProjectId,projectId).eq(Task::getTaskFatherId,fatherId));
|
return baseMapper.selectList(Wrappers.<Task>lambdaQuery().eq(Task::getTaskProjectId,projectId).eq(Task::getTaskFatherId,fatherId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<List<Long>> getTaskAndSubTask(Long taskId) {
|
|
||||||
List<List<Long>> resList = new ArrayList<>();
|
|
||||||
List<Long> res = new ArrayList<>();
|
|
||||||
res.add(taskId);
|
|
||||||
resList.add(res);
|
|
||||||
while(true) {
|
|
||||||
List<Task> list = baseMapper.selectList(Wrappers.<Task>lambdaQuery().in(Task::getTaskFatherId, res));
|
|
||||||
if(list == null || list.isEmpty()) break;
|
|
||||||
res = list.stream().map(Task::getTaskId).collect(Collectors.toList());
|
|
||||||
resList.add(res);
|
|
||||||
}
|
|
||||||
return resList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean deleteTaskAndSubTask(String token, Integer projectId, Long taskId) throws BadRequestException{
|
|
||||||
if(projectGroupService.getUserLevelInGroup(token,projectId)==0) {
|
|
||||||
throw new BadRequestException("错误参数");
|
|
||||||
}
|
|
||||||
if(!checkHolder(token, taskId)) {
|
|
||||||
throw new BadRequestException("错误父级参数");
|
|
||||||
}
|
|
||||||
List<List<Long>> resList = getTaskAndSubTask(taskId);
|
|
||||||
try {
|
|
||||||
for (List<Long> list: resList) {
|
|
||||||
baseMapper.delete(Wrappers.<Task>lambdaQuery().in(Task::getTaskId, list));
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean closeTaskAndSubTask(String token, Integer projectId, Long taskId) throws BadRequestException{
|
|
||||||
if(projectGroupService.getUserLevelInGroup(token,projectId)==0) {
|
|
||||||
throw new BadRequestException("错误参数");
|
|
||||||
}
|
|
||||||
if(!checkHolder(token, taskId)) {
|
|
||||||
throw new BadRequestException("错误父级参数");
|
|
||||||
}
|
|
||||||
List<List<Long>> resList = getTaskAndSubTask(taskId);
|
|
||||||
try {
|
|
||||||
for (List<Long> list: resList) {
|
|
||||||
baseMapper.update(null, Wrappers.<Task>lambdaUpdate().in(Task::getTaskId, list).set(Task::getTaskType, "关闭"));
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean checkHolder(Integer staffId,Long taskId){
|
public Boolean checkHolder(Integer staffId,Long taskId){
|
||||||
try{
|
try{
|
||||||
|
|
Loading…
Reference in New Issue