修复了Task的查询问题

master
ArgonarioD 2022-07-09 11:56:48 +08:00
parent 5da87af6e3
commit fc481bdd17
3 changed files with 5 additions and 10 deletions

View File

@ -11,6 +11,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
* @author * @author
* created at 2022/6/28 19:44 * created at 2022/6/28 19:44
*/ */
//TODO: 整机限流
@Configuration @Configuration
public class WebConfig implements WebMvcConfigurer { public class WebConfig implements WebMvcConfigurer {
@Bean @Bean

View File

@ -1,6 +1,5 @@
package cn.edu.hfut.rmdjzz.projectmanagement.entity; package cn.edu.hfut.rmdjzz.projectmanagement.entity;
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectGroupService;
import cn.edu.hfut.rmdjzz.projectmanagement.utils.BeanUtils; import cn.edu.hfut.rmdjzz.projectmanagement.utils.BeanUtils;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
@ -9,7 +8,6 @@ import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Map; import java.util.Map;
@ -21,17 +19,14 @@ import java.util.Objects;
*/ */
@Data @Data
public class Task { public class Task {
@Autowired
private IProjectGroupService projectGroupService;
public static final String ATTACH_DEMAND_SOURCE = "demandSource"; public static final String ATTACH_DEMAND_SOURCE = "demandSource";
public static final String ATTACH_ESTIMATED_MAN_HOURS = "estimatedManHours"; public static final String ATTACH_ESTIMATED_MAN_HOURS = "estimatedManHours";
public static final String ATTACH_SEVERITY = "severity"; public static final String ATTACH_SEVERITY = "severity";
public static final String ATTACH_RECURRENCE_PROBABILITY = "recurrenceProbability"; public static final String ATTACH_RECURRENCE_PROBABILITY = "recurrenceProbability";
public static final String TYPE_DEFECT = "缺陷"; public static final String TYPE_DEFECT = "缺陷";
public static final String TYPE_DEMAND = "需求"; public static final String TYPE_DEMAND = "需求";
public static final String TYPE_ASSIGNMENT = "任务"; public static final String TYPE_ASSIGNMENT = "任务";
public static final String STATUS_WAITING = "待进行"; public static final String STATUS_WAITING = "待进行";
public static final String STATUS_PROCESSING = "进行中"; public static final String STATUS_PROCESSING = "进行中";
public static final String STATUS_COMPLETED = "已完成"; public static final String STATUS_COMPLETED = "已完成";
@ -116,8 +111,6 @@ public class Task {
} }
public Boolean checkModification(Task rawTask) { public Boolean checkModification(Task rawTask) {
if (projectGroupService.getProjectAccessLevel(this.getTaskHolderId(), 3, this.getTaskProjectId()) == 0)
return false;
if (rawTask.getTaskStatus().equals(STATUS_COMPLETED) || rawTask.getTaskStatus().equals(STATUS_CLOSED)) if (rawTask.getTaskStatus().equals(STATUS_COMPLETED) || rawTask.getTaskStatus().equals(STATUS_CLOSED))
return false; return false;
if (!rawTask.getTaskStatus().equals(STATUS_WAITING) && this.getTaskStatus().equals(STATUS_WAITING)) if (!rawTask.getTaskStatus().equals(STATUS_WAITING) && this.getTaskStatus().equals(STATUS_WAITING))

View File

@ -233,10 +233,11 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
typeChangeValue = 2; typeChangeValue = 2;
} }
System.out.println(!task.checkModification(rawTask)); System.out.println(!task.checkModification(rawTask));
if (!task.checkModification(rawTask) || !task.checkInsert() ) { if (projectGroupService.getProjectAccessLevel(task.getTaskHolderId(), 3, task.getTaskProjectId()) == 0
|| !task.checkModification(rawTask) || !task.checkInsert()) {
throw new BadRequestException(BadRequestException.WRONG_PARAMETERS); throw new BadRequestException(BadRequestException.WRONG_PARAMETERS);
} }
if(typeChangeValue == 1 && !canBeDone(task.getTaskId())){ if (typeChangeValue == 1 && !canBeDone(task.getTaskId())) {
throw new BadRequestException("还有子工作尚未完成"); throw new BadRequestException("还有子工作尚未完成");
} }
try { try {