适配了数据库字段名的更改

master
ArgonarioD 2022-07-06 10:50:07 +08:00
parent d7d2579aef
commit dc315eeca7
11 changed files with 73 additions and 32 deletions

View File

@ -1,7 +1,7 @@
package cn.edu.hfut.rmdjzz.projectmanagement.controller; package cn.edu.hfut.rmdjzz.projectmanagement.controller;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project; import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ResultProject; import cn.edu.hfut.rmdjzz.projectmanagement.entity.query.ResultProject;
import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException; import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException;
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectGroupService; import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectGroupService;
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectService; import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectService;
@ -17,7 +17,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
/** /**

View File

@ -1,7 +1,6 @@
package cn.edu.hfut.rmdjzz.projectmanagement.controller; 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.exception.BadRequestException;
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectGroupService; import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectGroupService;
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;
@ -32,7 +31,7 @@ public class TaskController {
@PathVariable("projectId") Integer projectId, @PathVariable("projectId") Integer projectId,
@PathVariable("fatherId") Long fatherId @PathVariable("fatherId") Long fatherId
) { ) {
List<Task> result = taskService.getTaskList(token, projectId, fatherId); List<Task> result = taskService.getSubTaskList(token, projectId, fatherId);
return ResponseList.ofSuccess("查询成功", result); return ResponseList.ofSuccess("查询成功", result);
} }

View File

@ -20,12 +20,11 @@ public class Project {
private Integer projectId; private Integer projectId;
private String projectName; private String projectName;
//TODO: 时间线顺序判断 //TODO: 时间线顺序判断
private LocalDate projectStartTime; private LocalDate projectStartDate;
private LocalDate projectOnlineTime; private LocalDate projectOnlineDate;
private LocalDate projectFirstTestTime; private LocalDate projectFirstTestDate;
private LocalDate projectFinalTestTime; private LocalDate projectFinalTestDate;
private LocalDate projectEndTime; private LocalDate projectEndDate;
private LocalDate projectCloseTime;
private String projectAbbreviation; private String projectAbbreviation;
private Integer projectClassId; private Integer projectClassId;
private Integer projectSubclassId; private Integer projectSubclassId;
@ -44,5 +43,6 @@ public class Project {
@TableLogic @TableLogic
private Boolean deleted; private Boolean deleted;
private Integer projectCreator; private Integer projectCreator;
private LocalDateTime projectCreateTime; private LocalDateTime projectCreatedTime;
private LocalDate projectClosedDate;
} }

View File

@ -1,4 +1,4 @@
package cn.edu.hfut.rmdjzz.projectmanagement.entity; package cn.edu.hfut.rmdjzz.projectmanagement.entity.query;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
@ -21,7 +21,7 @@ public class ResultProject {
String projectSubclassName; String projectSubclassName;
Boolean deleted; Boolean deleted;
Boolean completed; Boolean completed;
LocalDate projectCloseTime; LocalDate projectClosedDate;
Integer completeNum; Integer completeNum;
Integer totalNum; Integer totalNum;

View File

@ -0,0 +1,34 @@
package cn.edu.hfut.rmdjzz.projectmanagement.entity.query;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.Map;
/**
* @author
* @since 2022/7/6 10:25
*/
@Data
public class ResultTask {
private Long taskId;
private String taskName;
private Integer taskProjectId;
private Integer taskHolderId;
private String taskHolderName;
private String taskStatus;
private String taskType;
private Long taskFatherId;
private LocalDateTime taskCreatedTime;
private LocalDateTime taskStartTime;
private LocalDateTime taskEndTime;
private LocalDateTime taskClosedTime;
private Integer taskPriority;
private String taskDescription;
@TableField(typeHandler = JacksonTypeHandler.class)
private Map<String, Object> attachedInfo;
private Boolean hasChildren;
private Boolean deleted;
}

View File

@ -1,7 +1,7 @@
package cn.edu.hfut.rmdjzz.projectmanagement.mapper; package cn.edu.hfut.rmdjzz.projectmanagement.mapper;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project; import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ResultProject; import cn.edu.hfut.rmdjzz.projectmanagement.entity.query.ResultProject;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@ -34,7 +34,7 @@ public interface ProjectMapper extends BaseMapper<Project> {
pt2.project_class_name as project_subclass_name, pt2.project_class_name as project_subclass_name,
is_completed, is_completed,
is_deleted, is_deleted,
project_close_time project_closed_date
FROM project join project_type pt1 on project.project_class_id = pt1.project_class_id FROM project join project_type pt1 on project.project_class_id = pt1.project_class_id
join project_type pt2 on project.project_subclass_id = pt2.project_class_id join project_type pt2 on project.project_subclass_id = pt2.project_class_id
WHERE project_id IN (SELECT DISTINCT project_id FROM project_group WHERE staff_id = #{id})) AS T WHERE project_id IN (SELECT DISTINCT project_id FROM project_group WHERE staff_id = #{id})) AS T
@ -50,7 +50,7 @@ public interface ProjectMapper extends BaseMapper<Project> {
@Result(column = "project_class_name", property = "projectClassName"), @Result(column = "project_class_name", property = "projectClassName"),
@Result(column = "is_completed", property = "completed"), @Result(column = "is_completed", property = "completed"),
@Result(column = "is_deleted", property = "deleted"), @Result(column = "is_deleted", property = "deleted"),
@Result(column = "project_close_time", property = "projectCloseTime"), @Result(column = "project_closed_date", property = "projectClosedDate"),
@Result(column = "project_creator", property = "projectCreator") @Result(column = "project_creator", property = "projectCreator")
}) })
IPage<ResultProject> findMyProject(IPage<ResultProject> pg, @Param("id") Integer staff_id, @Param(Constants.WRAPPER) Wrapper<Project> wrapper); IPage<ResultProject> findMyProject(IPage<ResultProject> pg, @Param("id") Integer staff_id, @Param(Constants.WRAPPER) Wrapper<Project> wrapper);

View File

@ -8,4 +8,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* created at 2022/7/4 14:52 * created at 2022/7/4 14:52
*/ */
public interface TaskMapper extends BaseMapper<Task> { public interface TaskMapper extends BaseMapper<Task> {
} }

View File

@ -1,7 +1,7 @@
package cn.edu.hfut.rmdjzz.projectmanagement.service; package cn.edu.hfut.rmdjzz.projectmanagement.service;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project; import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ResultProject; import cn.edu.hfut.rmdjzz.projectmanagement.entity.query.ResultProject;
import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException; import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException;
import cn.edu.hfut.rmdjzz.projectmanagement.exception.TokenException; import cn.edu.hfut.rmdjzz.projectmanagement.exception.TokenException;
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.RequestPage; import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.RequestPage;

View File

@ -1,6 +1,5 @@
package cn.edu.hfut.rmdjzz.projectmanagement.service; package cn.edu.hfut.rmdjzz.projectmanagement.service;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Staff;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Task; import cn.edu.hfut.rmdjzz.projectmanagement.entity.Task;
import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException; import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
@ -12,14 +11,23 @@ import java.util.List;
* created at 2022/7/4 14:49 * created at 2022/7/4 14:49
*/ */
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> getSubTaskList(String token, Integer projectId, Long fatherId) throws BadRequestException;
Boolean existSubTask(String token, Integer projectId, Long taskId) throws BadRequestException; Boolean existSubTask(String token, Integer projectId, Long taskId) throws BadRequestException;
Boolean deleteTaskAndSubTask(String token, Integer projectId, Long taskId) throws BadRequestException; Boolean deleteTaskAndSubTask(String token, Integer projectId, Long taskId) throws BadRequestException;
Boolean closeTaskAndSubTask(String token, Integer projectId, Long taskId) throws BadRequestException;
Integer checkHolder(Integer staffId,Long taskId); Boolean closeTaskAndSubTask(String token, Integer projectId, Long taskId) throws BadRequestException;
Integer checkHolder(String token,Long taskId);
List<Task> getMyTaskList(String token,Integer projectId) throws BadRequestException; Integer checkHolder(Integer staffId, Long taskId);
Integer checkHolder(String token, Long taskId);
List<Task> getMyTaskList(String token, Integer projectId) throws BadRequestException;
Boolean canBeDone(Long taskId); Boolean canBeDone(Long taskId);
Task insertTask(String token,Task task) throws BadRequestException;
Task modifyTask(String token,Task task) throws BadRequestException; Task insertTask(String token, Task task) throws BadRequestException;
Task modifyTask(String token, Task task) throws BadRequestException;
} }

View File

@ -1,7 +1,7 @@
package cn.edu.hfut.rmdjzz.projectmanagement.service.impl; package cn.edu.hfut.rmdjzz.projectmanagement.service.impl;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project; import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ResultProject; import cn.edu.hfut.rmdjzz.projectmanagement.entity.query.ResultProject;
import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException; import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException;
import cn.edu.hfut.rmdjzz.projectmanagement.exception.TokenException; import cn.edu.hfut.rmdjzz.projectmanagement.exception.TokenException;
import cn.edu.hfut.rmdjzz.projectmanagement.mapper.ProjectMapper; import cn.edu.hfut.rmdjzz.projectmanagement.mapper.ProjectMapper;
@ -60,7 +60,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
if (targetProject.getCompleted()) if (targetProject.getCompleted())
throw new BadRequestException("该项目已结项"); throw new BadRequestException("该项目已结项");
targetProject.setCompleted(true); targetProject.setCompleted(true);
targetProject.setProjectCloseTime(LocalDate.now()); targetProject.setProjectClosedDate(LocalDate.now());
if (baseMapper.updateById(targetProject) == 1) if (baseMapper.updateById(targetProject) == 1)
return true; return true;
throw new BadRequestException("操作失败"); throw new BadRequestException("操作失败");
@ -70,14 +70,14 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
public Boolean createProject(String token, Project project) throws TokenException, BadRequestException { public Boolean createProject(String token, Project project) throws TokenException, BadRequestException {
project.setProjectId(null); project.setProjectId(null);
project.setCompleted(false); project.setCompleted(false);
project.setProjectCreateTime(null); project.setProjectCreatedTime(null);
project.setProjectCreator(TokenUtils.getStaffId(token)); project.setProjectCreator(TokenUtils.getStaffId(token));
project.setProjectCloseTime(null); project.setProjectClosedDate(null);
if (project.getExpectedCompletion() == null) { if (project.getExpectedCompletion() == null) {
project.setExpectedCompletion((short) 100); project.setExpectedCompletion((short) 100);
} else if (project.getExpectedCompletion() < 0 || project.getExpectedCompletion() > 100 || } else if (project.getExpectedCompletion() < 0 || project.getExpectedCompletion() > 100 ||
project.getProjectStartTime() == null || project.getProjectEndTime() == null || project.getProjectStartDate() == null || project.getProjectEndDate() == null ||
project.getProjectStartTime().isAfter(project.getProjectEndTime()) project.getProjectStartDate().isAfter(project.getProjectEndDate())
) { ) {
throw new BadRequestException("参数错误"); throw new BadRequestException("参数错误");
} }

View File

@ -30,7 +30,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
//FIXME: 抛出未授权异常 //FIXME: 抛出未授权异常
@Override @Override
public List<Task> getTaskList(String token, Integer projectId, Long fatherId) throws BadRequestException { public List<Task> getSubTaskList(String token, Integer projectId, Long fatherId) throws BadRequestException {
if (projectGroupService.getUserLevelInGroup(token, projectId) == 0 || fatherId == null) { if (projectGroupService.getUserLevelInGroup(token, projectId) == 0 || fatherId == null) {
throw new BadRequestException("错误的访问参数"); throw new BadRequestException("错误的访问参数");
} }