Commit 6375a5cd authored by 盖献康's avatar 盖献康

车型试验 - 查看方案

parent f2b4cb20
...@@ -3,9 +3,7 @@ package com.ruoyi.service; ...@@ -3,9 +3,7 @@ package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.domain.ModelTestTask; import com.ruoyi.domain.ModelTestTask;
import com.ruoyi.web.request.ModelTestTaskSubmitRequest; import com.ruoyi.web.request.ModelTestTaskSubmitRequest;
import com.ruoyi.web.response.ModelTestTaskViewResponse; import com.ruoyi.web.response.ModelTestResponse;
import java.util.List;
/** /**
* 车型试验任务Service接口 * 车型试验任务Service接口
...@@ -19,7 +17,7 @@ public interface ModelTestTaskService extends IService<ModelTestTask> { ...@@ -19,7 +17,7 @@ public interface ModelTestTaskService extends IService<ModelTestTask> {
* @param taskId * @param taskId
* @return * @return
*/ */
List<ModelTestTaskViewResponse> viewModelTestTask(Long taskId); ModelTestResponse viewModelTestTask(Long taskId);
/** /**
* 开始车型试验任务 * 开始车型试验任务
......
package com.ruoyi.service; package com.ruoyi.service;
import com.ruoyi.domain.ModelTestTask; import com.ruoyi.domain.ModelTestTask;
import com.ruoyi.web.response.ModelTestTaskViewResponse; import com.ruoyi.web.response.ModelTestResponse;
import java.util.List; import java.util.List;
...@@ -15,7 +15,7 @@ public interface StrategyModelTestTask { ...@@ -15,7 +15,7 @@ public interface StrategyModelTestTask {
* @param modelTestTask * @param modelTestTask
* @return * @return
*/ */
List<ModelTestTaskViewResponse> doView(ModelTestTask modelTestTask); ModelTestResponse doView(ModelTestTask modelTestTask);
/** /**
* 开始测试 * 开始测试
......
...@@ -5,13 +5,11 @@ import com.ruoyi.domain.ModelTestTask; ...@@ -5,13 +5,11 @@ import com.ruoyi.domain.ModelTestTask;
import com.ruoyi.mapper.ModelTestTaskMapper; import com.ruoyi.mapper.ModelTestTaskMapper;
import com.ruoyi.service.ModelTestTaskService; import com.ruoyi.service.ModelTestTaskService;
import com.ruoyi.web.request.ModelTestTaskSubmitRequest; import com.ruoyi.web.request.ModelTestTaskSubmitRequest;
import com.ruoyi.web.response.ModelTestTaskViewResponse; import com.ruoyi.web.response.ModelTestResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/** /**
* 车型试验Service业务层处理 * 车型试验Service业务层处理
* @author gxk * @author gxk
...@@ -33,7 +31,7 @@ public class ModelTestTaskServiceImpl extends ServiceImpl<ModelTestTaskMapper, M ...@@ -33,7 +31,7 @@ public class ModelTestTaskServiceImpl extends ServiceImpl<ModelTestTaskMapper, M
* @return * @return
*/ */
@Override @Override
public List<ModelTestTaskViewResponse> viewModelTestTask(Long taskId) { public ModelTestResponse viewModelTestTask(Long taskId) {
ModelTestTask modelTestTask = modelTestTaskMapper.selectById(taskId); ModelTestTask modelTestTask = modelTestTaskMapper.selectById(taskId);
return strategyModelTestTaskContext.getResource(modelTestTask.getTaskStatus()).doView(modelTestTask); return strategyModelTestTaskContext.getResource(modelTestTask.getTaskStatus()).doView(modelTestTask);
} }
......
...@@ -4,7 +4,7 @@ import com.ruoyi.common.constant.HttpStatus; ...@@ -4,7 +4,7 @@ import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.domain.ModelTestTask; import com.ruoyi.domain.ModelTestTask;
import com.ruoyi.service.StrategyModelTestTask; import com.ruoyi.service.StrategyModelTestTask;
import com.ruoyi.web.response.ModelTestTaskViewResponse; import com.ruoyi.web.response.ModelTestResponse;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
...@@ -24,7 +24,7 @@ public class StrategyModelTestTaskFinish implements StrategyModelTestTask, Initi ...@@ -24,7 +24,7 @@ public class StrategyModelTestTaskFinish implements StrategyModelTestTask, Initi
private StrategyModelTestTaskContext strategyModelTestTaskContext; private StrategyModelTestTaskContext strategyModelTestTaskContext;
@Override @Override
public List<ModelTestTaskViewResponse> doView(ModelTestTask modelTestTask) { public ModelTestResponse doView(ModelTestTask modelTestTask) {
throw new ServiceException("不能开始一个结束的任务", HttpStatus.ERROR); throw new ServiceException("不能开始一个结束的任务", HttpStatus.ERROR);
} }
......
package com.ruoyi.service.impl; package com.ruoyi.service.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
...@@ -8,8 +9,10 @@ import com.ruoyi.domain.*; ...@@ -8,8 +9,10 @@ import com.ruoyi.domain.*;
import com.ruoyi.domain.vo.TestCaseVO; import com.ruoyi.domain.vo.TestCaseVO;
import com.ruoyi.domain.vo.TestUsecaseVO; import com.ruoyi.domain.vo.TestUsecaseVO;
import com.ruoyi.mapper.ModelTestTaskMapper; import com.ruoyi.mapper.ModelTestTaskMapper;
import com.ruoyi.mapper.TaskMapper;
import com.ruoyi.mapper.TestUseCaseMapper; import com.ruoyi.mapper.TestUseCaseMapper;
import com.ruoyi.service.StrategyModelTestTask; import com.ruoyi.service.StrategyModelTestTask;
import com.ruoyi.web.response.ModelTestResponse;
import com.ruoyi.web.response.ModelTestTaskViewResponse; import com.ruoyi.web.response.ModelTestTaskViewResponse;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
...@@ -41,15 +44,18 @@ public class StrategyModelTestTaskNew implements StrategyModelTestTask, Initiali ...@@ -41,15 +44,18 @@ public class StrategyModelTestTaskNew implements StrategyModelTestTask, Initiali
@Autowired @Autowired
private ModelTestTaskMapper modelTestTaskMapper; private ModelTestTaskMapper modelTestTaskMapper;
@Autowired
private TaskMapper taskMapper;
/** /**
* 状态为NEW时的查看车型试验任务 * 状态为NEW时的查看车型试验任务
* @param modelTestTask * @param modelTestTask
* @return * @return
*/ */
@Override @Override
public List<ModelTestTaskViewResponse> doView(ModelTestTask modelTestTask) { public ModelTestResponse doView(ModelTestTask modelTestTask) {
List<ModelTestTaskViewResponse> list = getTestScheme(modelTestTask.getId()); ModelTestResponse response = getTestScheme(modelTestTask);
return list; return response;
} }
/** /**
...@@ -57,9 +63,9 @@ public class StrategyModelTestTaskNew implements StrategyModelTestTask, Initiali ...@@ -57,9 +63,9 @@ public class StrategyModelTestTaskNew implements StrategyModelTestTask, Initiali
* @param taskId * @param taskId
* @return * @return
*/ */
public List<ModelTestTaskViewResponse> getTestScheme(Long taskId) { public ModelTestResponse getTestScheme(ModelTestTask modelTestTask) {
// 查询出本子任务所包含的测试场景集合 // 查询出本子任务所包含的测试场景集合
List<TestUsecaseVO> testCaseList = testUseCaseMapper.selectListByTaskId(taskId); List<TestUsecaseVO> testCaseList = testUseCaseMapper.selectListByTaskId(modelTestTask.getId());
// 创建一个空List, 用于返回数据 // 创建一个空List, 用于返回数据
List<ModelTestTaskViewResponse> list = new ArrayList<>(); List<ModelTestTaskViewResponse> list = new ArrayList<>();
// 创建一个HashMap, 用于存放数据。用例条款ID作为key // 创建一个HashMap, 用于存放数据。用例条款ID作为key
...@@ -96,7 +102,16 @@ public class StrategyModelTestTaskNew implements StrategyModelTestTask, Initiali ...@@ -96,7 +102,16 @@ public class StrategyModelTestTaskNew implements StrategyModelTestTask, Initiali
} }
// 最后按章节号升序 // 最后按章节号升序
list.sort(Comparator.comparing(ModelTestTaskViewResponse::getChapter)); list.sort(Comparator.comparing(ModelTestTaskViewResponse::getChapter));
return list; // 构造
Task task = taskMapper.selectOne(new QueryWrapper<Task>().lambda().eq(Task::getModelTestTaskId, modelTestTask.getId()));
ModelTestResponse response = ModelTestResponse.builder()
.taskNo(task.getTaskNo())
.taskName(task.getTaskName())
.entrustedUnit(task.getEntrustedUnit())
.taskStatus(modelTestTask.getTaskStatus())
.modelTestTaskViewResponseList(list)
.build();
return response;
} }
/** /**
......
...@@ -6,7 +6,7 @@ import com.ruoyi.common.exception.ServiceException; ...@@ -6,7 +6,7 @@ import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.domain.ModelTestTask; import com.ruoyi.domain.ModelTestTask;
import com.ruoyi.mapper.ModelTestTaskMapper; import com.ruoyi.mapper.ModelTestTaskMapper;
import com.ruoyi.service.StrategyModelTestTask; import com.ruoyi.service.StrategyModelTestTask;
import com.ruoyi.web.response.ModelTestTaskViewResponse; import com.ruoyi.web.response.ModelTestResponse;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
...@@ -33,9 +33,9 @@ public class StrategyModelTestTaskPending implements StrategyModelTestTask, Init ...@@ -33,9 +33,9 @@ public class StrategyModelTestTaskPending implements StrategyModelTestTask, Init
private StrategyModelTestTaskNew strategyModelTestTaskNew; private StrategyModelTestTaskNew strategyModelTestTaskNew;
@Override @Override
public List<ModelTestTaskViewResponse> doView(ModelTestTask modelTestTask) { public ModelTestResponse doView(ModelTestTask modelTestTask) {
List<ModelTestTaskViewResponse> list = strategyModelTestTaskNew.getTestScheme(modelTestTask.getId()); ModelTestResponse response = strategyModelTestTaskNew.getTestScheme(modelTestTask);
return list; return response;
} }
@Override @Override
......
...@@ -13,7 +13,7 @@ import com.ruoyi.domain.Task; ...@@ -13,7 +13,7 @@ import com.ruoyi.domain.Task;
import com.ruoyi.mapper.ModelTestTaskMapper; import com.ruoyi.mapper.ModelTestTaskMapper;
import com.ruoyi.mapper.TaskMapper; import com.ruoyi.mapper.TaskMapper;
import com.ruoyi.service.StrategyModelTestTask; import com.ruoyi.service.StrategyModelTestTask;
import com.ruoyi.web.response.ModelTestTaskViewResponse; import com.ruoyi.web.response.ModelTestResponse;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
...@@ -46,9 +46,9 @@ public class StrategyModelTestTaskSigned implements StrategyModelTestTask, Initi ...@@ -46,9 +46,9 @@ public class StrategyModelTestTaskSigned implements StrategyModelTestTask, Initi
private StrategyModelTestTaskNew strategyModelTestTaskNew; private StrategyModelTestTaskNew strategyModelTestTaskNew;
@Override @Override
public List<ModelTestTaskViewResponse> doView(ModelTestTask modelTestTask) { public ModelTestResponse doView(ModelTestTask modelTestTask) {
List<ModelTestTaskViewResponse> list = strategyModelTestTaskNew.getTestScheme(modelTestTask.getId()); ModelTestResponse response = strategyModelTestTaskNew.getTestScheme(modelTestTask);
return list; return response;
} }
@Override @Override
......
...@@ -6,15 +6,13 @@ import com.ruoyi.service.ModelTestTaskService; ...@@ -6,15 +6,13 @@ import com.ruoyi.service.ModelTestTaskService;
import com.ruoyi.web.request.CarReviewTaskViewRequest; import com.ruoyi.web.request.CarReviewTaskViewRequest;
import com.ruoyi.web.request.ModelTestTaskConfirmRequest; import com.ruoyi.web.request.ModelTestTaskConfirmRequest;
import com.ruoyi.web.request.ModelTestTaskSubmitRequest; import com.ruoyi.web.request.ModelTestTaskSubmitRequest;
import com.ruoyi.web.response.ModelTestTaskViewResponse; import com.ruoyi.web.response.ModelTestResponse;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* 车型试验任务Controller * 车型试验任务Controller
* 总任务包含 (后)-> NEW (可以)-> 查看、开始 * 总任务包含 (后)-> NEW (可以)-> 查看、开始
...@@ -38,8 +36,8 @@ public class ModelTestTaskController extends BaseController { ...@@ -38,8 +36,8 @@ public class ModelTestTaskController extends BaseController {
*/ */
@ApiOperation("查看车型试验任务详情") @ApiOperation("查看车型试验任务详情")
@PostMapping("/getById") @PostMapping("/getById")
public R<List<ModelTestTaskViewResponse>> view(@Validated @RequestBody CarReviewTaskViewRequest request) { public R<ModelTestResponse> view(@Validated @RequestBody CarReviewTaskViewRequest request) {
List<ModelTestTaskViewResponse> modelTestTaskList = modelTestTaskService.viewModelTestTask(request.getTaskId()); ModelTestResponse modelTestTaskList = modelTestTaskService.viewModelTestTask(request.getTaskId());
return R.ok(modelTestTaskList); return R.ok(modelTestTaskList);
} }
......
package com.ruoyi.web.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* 车型试验查看VO类
* @author gxk
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("车型试验查看VO类")
public class ModelTestResponse {
@ApiModelProperty("任务编号")
private String taskNo;
@ApiModelProperty("任务名称")
private String taskName;
@ApiModelProperty("委托单位")
private String entrustedUnit;
@ApiModelProperty("子任务状态")
private String taskStatus;
@ApiModelProperty("审查表单概要")
private List<ModelTestTaskViewResponse> modelTestTaskViewResponseList;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment