Commit 96f1f75e authored by wdy's avatar wdy

Merge branch 'dev' of http://gitlab.91isoft.com:90/wangfei/vehicle-quality-review into wangdingyi

parents d89c4856 7d791f85
...@@ -115,4 +115,7 @@ public class ModelTestTask { ...@@ -115,4 +115,7 @@ public class ModelTestTask {
@ApiModelProperty("车型试验标准条款数") @ApiModelProperty("车型试验标准条款数")
private Integer standards; private Integer standards;
@ApiModelProperty("试验方案ID")
private String testSchemeId;
} }
...@@ -21,6 +21,9 @@ public class TestUsecaseVO { ...@@ -21,6 +21,9 @@ public class TestUsecaseVO {
@ApiModelProperty("测试用例ID") @ApiModelProperty("测试用例ID")
private Long id; private Long id;
@ApiModelProperty("用例ID")
private String caseId;
@ApiModelProperty("测试场景") @ApiModelProperty("测试场景")
private String testScenario; private String testScenario;
......
package com.ruoyi.service; package com.ruoyi.service;
import com.ruoyi.domain.Task; import com.ruoyi.domain.Task;
import com.ruoyi.web.request.TaskStartRequest;
import java.util.List; import java.util.List;
public interface TaskState { public interface TaskState {
void doCreate(Task task, List<String> taskList); void doCreate(Task task, List<String> taskList);
void doStart(Task task); void doStart(Task task, TaskStartRequest request);
void doSubmit(Task task); void doSubmit(Task task);
......
...@@ -26,5 +26,5 @@ public interface TestUseCaseService extends IService<TestUseCase> { ...@@ -26,5 +26,5 @@ public interface TestUseCaseService extends IService<TestUseCase> {
* @param request * @param request
* @return * @return
*/ */
List<Long> selectCaseIdList(TestUseCaseIdListRequest request); List<String> selectCaseIdList(TestUseCaseIdListRequest request);
} }
...@@ -276,7 +276,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -276,7 +276,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
@Override @Override
public void startTask(TaskStartRequest request) { public void startTask(TaskStartRequest request) {
Task task = taskMapper.selectById(request.getId()); Task task = taskMapper.selectById(request.getId());
taskStateFacade.doStart(task); taskStateFacade.doStart(task, request);
} }
@Override @Override
......
package com.ruoyi.service.impl; package com.ruoyi.service.impl;
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;
import com.ruoyi.domain.ModelTestTask;
import com.ruoyi.domain.Task; import com.ruoyi.domain.Task;
import com.ruoyi.service.CarReviewTaskService; import com.ruoyi.service.*;
import com.ruoyi.service.SystemReviewTaskService; import com.ruoyi.web.request.TaskStartRequest;
import com.ruoyi.service.TaskService;
import com.ruoyi.service.TaskState;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -24,8 +24,12 @@ public abstract class TaskStateAdapter implements TaskState { ...@@ -24,8 +24,12 @@ public abstract class TaskStateAdapter implements TaskState {
@Autowired @Autowired
private TaskService taskService; private TaskService taskService;
@Autowired
private ModelTestTaskService modelTestTaskService;
@Override @Override
public void doStart(Task task) { public void doStart(Task task, TaskStartRequest request) {
task.setTaskStatus(Task.TASK_STATUS_PENDING); task.setTaskStatus(Task.TASK_STATUS_PENDING);
task.setRunStatus(Task.RUN_STATUS_STATUS_RUNNING); task.setRunStatus(Task.RUN_STATUS_STATUS_RUNNING);
...@@ -36,6 +40,14 @@ public abstract class TaskStateAdapter implements TaskState { ...@@ -36,6 +40,14 @@ public abstract class TaskStateAdapter implements TaskState {
} else if (Objects.equals(task.getNextNode(), Task.SUB_TASK_GRFIS)) { } else if (Objects.equals(task.getNextNode(), Task.SUB_TASK_GRFIS)) {
carReviewTaskService.startReviewTask(task.getCarReviewTaskId()); carReviewTaskService.startReviewTask(task.getCarReviewTaskId());
taskService.updateById(task); taskService.updateById(task);
} else if (Objects.equals(task.getNextNode(), Task.SUB_TASK_TRFIS)) {
modelTestTaskService.startModelTestTask(task.getModelTestTaskId());
// 更新车型试验的试验方案ID
modelTestTaskService.update(new ModelTestTask(),
new LambdaUpdateWrapper<ModelTestTask>()
.set(ModelTestTask::getTestSchemeId, request.getTestSchemeId())
.eq(ModelTestTask::getId, task.getModelTestTaskId()));
taskService.updateById(task);
} else { } else {
throw new ServiceException("已没有可执行的子任务节点", HttpStatus.ERROR); throw new ServiceException("已没有可执行的子任务节点", HttpStatus.ERROR);
} }
......
...@@ -2,6 +2,7 @@ package com.ruoyi.service.impl; ...@@ -2,6 +2,7 @@ package com.ruoyi.service.impl;
import com.ruoyi.domain.Task; import com.ruoyi.domain.Task;
import com.ruoyi.service.TaskState; import com.ruoyi.service.TaskState;
import com.ruoyi.web.request.TaskStartRequest;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -21,8 +22,8 @@ public class TaskStateFacade implements TaskState { ...@@ -21,8 +22,8 @@ public class TaskStateFacade implements TaskState {
} }
@Override @Override
public void doStart(Task task) { public void doStart(Task task, TaskStartRequest request) {
taskStateContext.getResource(task.getTaskStatus()).doStart(task); taskStateContext.getResource(task.getTaskStatus()).doStart(task, request);
} }
@Override @Override
......
...@@ -4,6 +4,7 @@ import com.ruoyi.common.constant.HttpStatus; ...@@ -4,6 +4,7 @@ import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.domain.Task; import com.ruoyi.domain.Task;
import com.ruoyi.service.TaskState; import com.ruoyi.service.TaskState;
import com.ruoyi.web.request.TaskStartRequest;
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;
...@@ -28,7 +29,7 @@ public class TaskStateFinish extends TaskStateAdapter implements TaskState, Init ...@@ -28,7 +29,7 @@ public class TaskStateFinish extends TaskStateAdapter implements TaskState, Init
} }
@Override @Override
public void doStart(Task task) { public void doStart(Task task, TaskStartRequest request) {
throw new ServiceException("不能开始一个已经结束的任务", HttpStatus.ERROR); throw new ServiceException("不能开始一个已经结束的任务", HttpStatus.ERROR);
} }
......
...@@ -41,9 +41,9 @@ public class TestUseCaseServiceImpl extends ServiceImpl<TestUseCaseMapper, TestU ...@@ -41,9 +41,9 @@ public class TestUseCaseServiceImpl extends ServiceImpl<TestUseCaseMapper, TestU
} }
@Override @Override
public List<Long> selectCaseIdList(TestUseCaseIdListRequest request) { public List<String> selectCaseIdList(TestUseCaseIdListRequest request) {
List<TestUsecaseVO> list = testUseCaseMapper.selectListByTaskId(request.getModelTestId()); List<TestUsecaseVO> list = testUseCaseMapper.selectListByTaskId(request.getModelTestId());
return list.stream().map(TestUsecaseVO::getId).collect(Collectors.toList()); return list.stream().map(TestUsecaseVO::getCaseId).collect(Collectors.toList());
} }
} }
......
...@@ -44,7 +44,7 @@ public class TestUserCaseController extends BaseController{ ...@@ -44,7 +44,7 @@ public class TestUserCaseController extends BaseController{
@Anonymous @Anonymous
@ApiOperation("根据场景查询用例ID集合") @ApiOperation("根据场景查询用例ID集合")
@PostMapping("/getCaseIdList") @PostMapping("/getCaseIdList")
public R<List<Long>> getCaseIdList(@Validated @RequestBody TestUseCaseIdListRequest request) { public R<List<String>> getCaseIdList(@Validated @RequestBody TestUseCaseIdListRequest request) {
return R.ok(testUseCaseService.selectCaseIdList(request)); return R.ok(testUseCaseService.selectCaseIdList(request));
} }
} }
...@@ -10,4 +10,8 @@ public class TaskStartRequest { ...@@ -10,4 +10,8 @@ public class TaskStartRequest {
@ApiModelProperty("ID") @ApiModelProperty("ID")
private Long id; private Long id;
@ApiModelProperty("试验方案ID")
private String testSchemeId;
} }
...@@ -118,4 +118,7 @@ public class TaskFindResponse { ...@@ -118,4 +118,7 @@ public class TaskFindResponse {
@ApiModelProperty("指向待执行节点的指针[0、1、2]") @ApiModelProperty("指向待执行节点的指针[0、1、2]")
private int pointer; private int pointer;
@ApiModelProperty("试验方案ID")
private String testSchemeId;
} }
...@@ -106,7 +106,8 @@ ...@@ -106,7 +106,8 @@
crt.task_status car_review_status, crt.task_status car_review_status,
mtt.task_begin_time test_begin_time, mtt.task_begin_time test_begin_time,
mtt.task_end_time test_end_time, mtt.task_end_time test_end_time,
mtt.task_status test_status mtt.task_status test_status,
mtt.test_scheme_id testSchemeId
FROM t_task t FROM t_task t
left join t_system_review_task srt on t.system_review_task_id = srt.id left join t_system_review_task srt on t.system_review_task_id = srt.id
left join t_car_review_task crt on t.car_review_task_id = crt.id left join t_car_review_task crt on t.car_review_task_id = crt.id
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
<select id="selectListByTaskId" resultType="com.ruoyi.domain.vo.TestUsecaseVO"> <select id="selectListByTaskId" resultType="com.ruoyi.domain.vo.TestUsecaseVO">
select select
tu.id, tu.id,
tu.case_id caseId,
ts.test_scenario testScenario, ts.test_scenario testScenario,
tt.test_type testType, tt.test_type testType,
tu.usecase_no usecaseNo, tu.usecase_no usecaseNo,
......
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