Compare commits
No commits in common. "5bcf064ae9aca5b4e9247461662fb6997b669a36" and "f64a11374f31c195063866e7b3c2e5f11311da17" have entirely different histories.
5bcf064ae9
...
f64a11374f
|
@ -8,6 +8,9 @@ import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseList;
|
||||||
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseMap;
|
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseMap;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.media.SchemaProperty;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
|
@ -2,8 +2,6 @@ package cn.edu.hfut.rmdjzz.projectmanagement.controller;
|
||||||
|
|
||||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Task;
|
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Task;
|
||||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.dto.TaskDto;
|
import cn.edu.hfut.rmdjzz.projectmanagement.entity.dto.TaskDto;
|
||||||
import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException;
|
|
||||||
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectService;
|
|
||||||
import cn.edu.hfut.rmdjzz.projectmanagement.service.ITaskService;
|
import cn.edu.hfut.rmdjzz.projectmanagement.service.ITaskService;
|
||||||
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseList;
|
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseList;
|
||||||
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseMap;
|
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseMap;
|
||||||
|
@ -22,8 +20,7 @@ import java.util.List;
|
||||||
public class TaskController {
|
public class TaskController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ITaskService taskService;
|
private ITaskService taskService;
|
||||||
@Autowired
|
|
||||||
private IProjectService projectService;
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
@GetMapping("/{fatherId}/subtask")
|
@GetMapping("/{fatherId}/subtask")
|
||||||
public ResponseList<TaskDto> getSubTaskList(
|
public ResponseList<TaskDto> getSubTaskList(
|
||||||
|
@ -60,8 +57,6 @@ public class TaskController {
|
||||||
@PathVariable("projectId") Integer projectId,
|
@PathVariable("projectId") Integer projectId,
|
||||||
@RequestBody Task task
|
@RequestBody Task task
|
||||||
) {
|
) {
|
||||||
if(!projectService.checkOpenStatus(projectId))
|
|
||||||
throw new BadRequestException("项目未开放");
|
|
||||||
task.setTaskProjectId(projectId);
|
task.setTaskProjectId(projectId);
|
||||||
taskService.insertTask(token, task);
|
taskService.insertTask(token, task);
|
||||||
return ResponseMap.ofSuccess("操作成功");
|
return ResponseMap.ofSuccess("操作成功");
|
||||||
|
@ -75,8 +70,6 @@ public class TaskController {
|
||||||
@PathVariable("taskId") Long taskId,
|
@PathVariable("taskId") Long taskId,
|
||||||
@RequestBody Task task
|
@RequestBody Task task
|
||||||
) {
|
) {
|
||||||
if(!projectService.checkOpenStatus(projectId))
|
|
||||||
throw new BadRequestException("项目未开放");
|
|
||||||
task.setTaskProjectId(projectId);
|
task.setTaskProjectId(projectId);
|
||||||
task.setTaskId(taskId);
|
task.setTaskId(taskId);
|
||||||
taskService.modifyTask(token, task);
|
taskService.modifyTask(token, task);
|
||||||
|
@ -90,8 +83,6 @@ public class TaskController {
|
||||||
@PathVariable("projectId") Integer projectId,
|
@PathVariable("projectId") Integer projectId,
|
||||||
@PathVariable("taskId") Long taskId
|
@PathVariable("taskId") Long taskId
|
||||||
) {
|
) {
|
||||||
if(!projectService.checkOpenStatus(projectId))
|
|
||||||
throw new BadRequestException("项目未开放");
|
|
||||||
taskService.deleteTaskAndSubTask(token, projectId, taskId);
|
taskService.deleteTaskAndSubTask(token, projectId, taskId);
|
||||||
return ResponseMap.ofSuccess("删除成功");
|
return ResponseMap.ofSuccess("删除成功");
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,4 @@ public interface IProjectService extends IService<Project> {
|
||||||
Boolean setProjectCompleted(String token, Integer projectId) throws BadRequestException;
|
Boolean setProjectCompleted(String token, Integer projectId) throws BadRequestException;
|
||||||
|
|
||||||
Boolean createProject(String token, Project project) throws BadRequestException;
|
Boolean createProject(String token, Project project) throws BadRequestException;
|
||||||
|
|
||||||
Boolean checkOpenStatus(Integer projectId);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,11 +93,4 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean checkOpenStatus(Integer projectId) {
|
|
||||||
if (projectId == null || projectId < 1)
|
|
||||||
return false;
|
|
||||||
Project project = baseMapper.selectOne(Wrappers.<Project>lambdaQuery().eq(Project::getProjectId, projectId));
|
|
||||||
return project != null && !project.getCompleted();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue