Commit db1d1f2f authored by wdy's avatar wdy

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

parents 359c659d 4e45ca1d
......@@ -39,4 +39,7 @@ public class TestCaseVO {
@ApiModelProperty("用例描述")
private String description;
@ApiModelProperty("测试结果")
private String testResult;
}
......@@ -57,4 +57,7 @@ public class TestUsecaseVO {
@ApiModelProperty("标准测试方法")
private String testMethod;
@ApiModelProperty("测试结果")
private String testResult;
}
......@@ -2,6 +2,7 @@ package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.domain.ModelTestTask;
import com.ruoyi.web.request.ModelTestTaskSubmitRequest;
import com.ruoyi.web.response.ModelTestTaskViewResponse;
import java.util.List;
......@@ -25,4 +26,17 @@ public interface ModelTestTaskService extends IService<ModelTestTask> {
* @param taskId
*/
void startModelTestTask(Long taskId);
/**
* 确认车型试验任务
* @param taskId
*/
void confirmModelTestTask(Long taskId);
/**
* 车型试验任务
* @param request
*/
void submitModelTestTask(ModelTestTaskSubmitRequest request);
}
......@@ -33,8 +33,7 @@ public interface StrategyModelTestTask {
* 提交测试
* @param modelTestTask
* @param imagesUrl
* @param testScenarioList
*/
void doSubmitTest(ModelTestTask modelTestTask, List<String> imagesUrl, List<Long> testScenarioList);
void doSubmitTest(ModelTestTask modelTestTask, List<String> imagesUrl);
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.domain.ModelTestTask;
import com.ruoyi.mapper.ModelTestTaskMapper;
import com.ruoyi.service.ModelTestTaskService;
import com.ruoyi.web.request.ModelTestTaskSubmitRequest;
import com.ruoyi.web.response.ModelTestTaskViewResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -46,4 +47,20 @@ public class ModelTestTaskServiceImpl extends ServiceImpl<ModelTestTaskMapper, M
ModelTestTask modelTestTask = modelTestTaskMapper.selectById(taskId);
strategyModelTestTaskContext.getResource(modelTestTask.getTaskStatus()).doStartTest(modelTestTask);
}
/**
* 确认车型试验任务
* @param taskId
*/
@Override
public void confirmModelTestTask(Long taskId) {
ModelTestTask modelTestTask = modelTestTaskMapper.selectById(taskId);
strategyModelTestTaskContext.getResource(modelTestTask.getTaskStatus()).doConfirmTest(modelTestTask);
}
@Override
public void submitModelTestTask(ModelTestTaskSubmitRequest request) {
ModelTestTask modelTestTask = modelTestTaskMapper.selectById(request.getTaskId());
strategyModelTestTaskContext.getResource(modelTestTask.getTaskStatus()).doSubmitTest(modelTestTask, request.getImagesUrl());
}
}
......@@ -39,7 +39,7 @@ public class StrategyModelTestTaskFinish implements StrategyModelTestTask, Initi
}
@Override
public void doSubmitTest(ModelTestTask modelTestTask, List<String> imagesUrl, List<Long> testScenarioList) {
public void doSubmitTest(ModelTestTask modelTestTask, List<String> imagesUrl) {
throw new ServiceException("不能提交一个结束的任务", HttpStatus.ERROR);
}
......
......@@ -47,8 +47,18 @@ public class StrategyModelTestTaskNew implements StrategyModelTestTask, Initiali
*/
@Override
public List<ModelTestTaskViewResponse> doView(ModelTestTask modelTestTask) {
List<ModelTestTaskViewResponse> list = getTestScheme(modelTestTask.getId());
return list;
}
/**
* 获取试验方案
* @param taskId
* @return
*/
public List<ModelTestTaskViewResponse> getTestScheme(Long taskId) {
// 查询出本子任务所包含的测试场景集合
List<TestUsecaseVO> testCaseList = testUseCaseMapper.selectListByTaskId(modelTestTask.getId());
List<TestUsecaseVO> testCaseList = testUseCaseMapper.selectListByTaskId(taskId);
// 创建一个空List, 用于返回数据
List<ModelTestTaskViewResponse> list = new ArrayList<>();
// 创建一个HashMap, 用于存放数据。用例条款ID作为key
......@@ -111,10 +121,9 @@ public class StrategyModelTestTaskNew implements StrategyModelTestTask, Initiali
* 状态为NEW时的提交车型试验任务
* @param modelTestTask
* @param imagesUrl
* @param testScenarioList
*/
@Override
public void doSubmitTest(ModelTestTask modelTestTask, List<String> imagesUrl, List<Long> testScenarioList) {
public void doSubmitTest(ModelTestTask modelTestTask, List<String> imagesUrl) {
throw new ServiceException("不能提交一个尚未开始的任务", HttpStatus.ERROR);
}
......
package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.domain.ModelTestTask;
import com.ruoyi.mapper.ModelTestTaskMapper;
import com.ruoyi.service.StrategyModelTestTask;
import com.ruoyi.web.response.ModelTestTaskViewResponse;
import org.springframework.beans.factory.InitializingBean;
......@@ -23,6 +25,9 @@ public class StrategyModelTestTaskPending implements StrategyModelTestTask, Init
@Autowired
private StrategyModelTestTaskContext strategyModelTestTaskContext;
@Autowired
private ModelTestTaskMapper modelTestTaskMapper;
@Override
public List<ModelTestTaskViewResponse> doView(ModelTestTask modelTestTask) {
throw new ServiceException("能查看一个进行中的任务", HttpStatus.ERROR);
......@@ -35,11 +40,15 @@ public class StrategyModelTestTaskPending implements StrategyModelTestTask, Init
@Override
public void doConfirmTest(ModelTestTask modelTestTask) {
throw new ServiceException("能确认一个进行中的任务", HttpStatus.ERROR);
// 进行中的任务, 点击确认后, 状态改为待签字
modelTestTaskMapper.update(new ModelTestTask(),
new LambdaUpdateWrapper<ModelTestTask>()
.set(ModelTestTask::getTaskStatus, ModelTestTask.TASK_STATUS_SIGNED)
.eq(ModelTestTask::getId, modelTestTask.getId()));
}
@Override
public void doSubmitTest(ModelTestTask modelTestTask, List<String> imagesUrl, List<Long> testScenarioList) {
public void doSubmitTest(ModelTestTask modelTestTask, List<String> imagesUrl) {
throw new ServiceException("不能提交一个进行中的任务", HttpStatus.ERROR);
}
......
package com.ruoyi.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.domain.ModelTestTask;
import com.ruoyi.domain.Task;
import com.ruoyi.mapper.ModelTestTaskMapper;
import com.ruoyi.mapper.TaskMapper;
import com.ruoyi.service.StrategyModelTestTask;
import com.ruoyi.web.response.ModelTestTaskViewResponse;
import org.springframework.beans.factory.InitializingBean;
......@@ -11,6 +20,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
@Service
......@@ -23,9 +33,22 @@ public class StrategyModelTestTaskSigned implements StrategyModelTestTask, Initi
@Autowired
private StrategyModelTestTaskContext strategyModelTestTaskContext;
@Autowired
private ModelTestTaskMapper modelTestTaskMapper;
@Autowired
private TaskMapper taskMapper;
@Autowired
private TaskStateFacade taskStateFacade;
@Autowired
private StrategyModelTestTaskNew strategyModelTestTaskNew;
@Override
public List<ModelTestTaskViewResponse> doView(ModelTestTask modelTestTask) {
throw new ServiceException("能查看一个已确认的任务", HttpStatus.ERROR);
List<ModelTestTaskViewResponse> list = strategyModelTestTaskNew.getTestScheme(modelTestTask.getId());
return list;
}
@Override
......@@ -39,8 +62,23 @@ public class StrategyModelTestTaskSigned implements StrategyModelTestTask, Initi
}
@Override
public void doSubmitTest(ModelTestTask modelTestTask, List<String> imagesUrl, List<Long> testScenarioList) {
throw new ServiceException("能提交一个已确认的任务", HttpStatus.ERROR);
public void doSubmitTest(ModelTestTask modelTestTask, List<String> imagesUrl) {
SysUser user = SecurityUtils.getLoginUser().getUser();
modelTestTaskMapper.update(new ModelTestTask(),
new LambdaUpdateWrapper<ModelTestTask>()
.set(ModelTestTask::getTaskStatus, ModelTestTask.TASK_STATUS_FINISH)
.set(ModelTestTask::getTaskEndTime, new Date())
.set(ModelTestTask::getSubmitId, user.getUserId())
.set(ModelTestTask::getSubmitName, user.getNickName())
.set(ModelTestTask::getImagesUrl, StringUtils.join(imagesUrl, ","))
.eq(ModelTestTask::getId, modelTestTask.getId()));
// 改总任务状态
// 通过modelId查询总任务ID
List<Task> taskList = taskMapper.selectList(new QueryWrapper<Task>().eq("model_test_task_id", modelTestTask.getId()));
if (CollUtil.isNotEmpty(taskList)) {
Task task = taskList.get(0);
taskStateFacade.doSubmit(task);
}
}
@Override
......
package com.ruoyi.web;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.service.ModelTestTaskService;
import com.ruoyi.web.request.CarReviewTaskViewRequest;
import com.ruoyi.web.request.ModelTestTaskConfirmRequest;
import com.ruoyi.web.request.ModelTestTaskSubmitRequest;
import com.ruoyi.web.response.ModelTestTaskViewResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -16,6 +17,10 @@ import java.util.List;
/**
* 车型试验任务Controller
* 总任务包含 (后)-> NEW (可以)-> 查看、开始
* 开始任务 -> PENDING -> 确认
* 确认任务 -> SIGNED -> 查看、提交
* 提交任务 -> FINISH -> 查看
* @author gxk
*/
@Api(tags = "车型试验子任务")
......@@ -31,7 +36,6 @@ public class ModelTestTaskController extends BaseController {
* @param request
* @return
*/
@Anonymous
@ApiOperation("查看车型试验任务详情")
@PostMapping("/getById")
public R<List<ModelTestTaskViewResponse>> view(@Validated @RequestBody CarReviewTaskViewRequest request) {
......@@ -44,12 +48,35 @@ public class ModelTestTaskController extends BaseController {
* @param request
* @return
*/
@Anonymous
@ApiOperation("开始车型试验任务")
@PostMapping("/start")
public R<String> startReview(@Validated @RequestBody CarReviewTaskViewRequest request) {
public R<String> startModel(@Validated @RequestBody CarReviewTaskViewRequest request) {
modelTestTaskService.startModelTestTask(request.getTaskId());
return R.ok();
}
/**
* 确认车型试验任务
* @param request
* @return
*/
@ApiOperation("确认车型试验任务")
@PostMapping("/confirm")
public R<String> confirmModel(@Validated @RequestBody ModelTestTaskConfirmRequest request) {
modelTestTaskService.confirmModelTestTask(request.getTaskId());
return R.ok();
}
/**
* 提交车型试验任务 - 在待签字页面进行
* @param request
* @return
*/
@ApiOperation("提交车型试验任务")
@PostMapping("/submit")
public R<String> submitModel(@Validated @RequestBody ModelTestTaskSubmitRequest request) {
modelTestTaskService.submitModelTestTask(request);
return R.ok();
}
}
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 车型试验确认请求DTO
* @author gxk
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("车型试验确认请求DTO")
public class ModelTestTaskConfirmRequest {
@ApiModelProperty("任务id")
private Long taskId;
}
package com.ruoyi.web.request;
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;
/**
* 车型试验提交DTO
* @author gxk
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("车型试验提交DTO")
public class ModelTestTaskSubmitRequest {
@ApiModelProperty("任务id")
private Long taskId;
@ApiModelProperty("图片地址")
private List<String> imagesUrl;
}
......@@ -62,7 +62,8 @@
tu.review_standard_id,
rs.chapter,
rs.text,
rs.test_method testMethod
rs.test_method testMethod,
tr.test_result testResult
from
t_test_usecase tu
left join t_test_scenario ts on tu.test_scenario_id = ts.id
......@@ -71,6 +72,7 @@
left join t_task_scenario_relation tsr on tsr.test_scenario_id = ts.id
left join t_task t on tsr.task_id = t.id
left join t_model_test_task mtt on mtt.id = t.model_test_task_id
left join t_test_records tr on tu.case_id = tr.usecase_id
where
mtt.id = #{id}
</select>
......
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