Commit e6ae0ce3 authored by 盖献康's avatar 盖献康

Merge branch 'dev' of...

Merge branch 'dev' of ssh://gitlab.91isoft.com:10022/wangfei/vehicle-quality-review into gaixiankang
parents 0fdd324f 6658a3e7
......@@ -18,4 +18,7 @@ public interface TestScenarioMapper extends BaseMapper<TestScenario> {
* @return 测试场景库集合
*/
public List<TestScenario> selectTestScenarioList(TestScenarioRequest testScenarioRequest);
// 查询所有场景
List<TestScenario> selectAll();
}
......@@ -13,5 +13,5 @@ public interface StrategyCarReviewTask {
void doConfirmReview(CarReviewTask carReviewTask);
void doSubmitReview(CarReviewTask carReviewTask, List<String> imagesUrl);
void doSubmitReview(CarReviewTask carReviewTask, List<String> imagesUrl, List<Long> testScenarioList);
}
......@@ -133,7 +133,7 @@ public class CarReviewTaskServiceImpl extends ServiceImpl<CarReviewTaskMapper, C
public void submitReviewTask(CarReviewTaskSubmitRequest request) {
CarReviewTask carReviewTask = carReviewTaskService.getById(request.getTaskId());
strategyCarReviewTaskContext.getResource(carReviewTask.getTaskStatus()).doSubmitReview(carReviewTask,request.getImagesUrl());
strategyCarReviewTaskContext.getResource(carReviewTask.getTaskStatus()).doSubmitReview(carReviewTask,request.getImagesUrl(),request.getTestScenarioList());
}
@Override
......
......@@ -81,7 +81,7 @@ public class StrategyCarReviewTaskFinish implements StrategyCarReviewTask, Initi
}
@Override
public void doSubmitReview(CarReviewTask carReviewTask, List<String> imagesUrl) {
public void doSubmitReview(CarReviewTask carReviewTask, List<String> imagesUrl, List<Long> testScenarioList) {
throw new ServiceException("不能提交一个结束的任务", HttpStatus.ERROR);
}
......
......@@ -67,7 +67,7 @@ public class StrategyCarReviewTaskNew implements StrategyCarReviewTask, Initiali
}
@Override
public void doSubmitReview(CarReviewTask carReviewTask,List<String> imagesUrl) {
public void doSubmitReview(CarReviewTask carReviewTask,List<String> imagesUrl, List<Long> testScenarioList) {
throw new ServiceException("不能提交一个未开始的任务", HttpStatus.ERROR);
}
......
......@@ -155,7 +155,7 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
}
@Override
public void doSubmitReview(CarReviewTask carReviewTask,List<String> imagesUrl) {
public void doSubmitReview(CarReviewTask carReviewTask,List<String> imagesUrl, List<Long> testScenarioList) {
throw new ServiceException("不能提交一个未确认的任务", HttpStatus.ERROR);
......
package com.ruoyi.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.ruoyi.common.DataStatisticsUtils;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.entity.SysUser;
......@@ -58,6 +59,12 @@ public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, Initi
@Autowired
private TaskUserRelationMapper taskUserRelationMapper;
@Autowired
private TaskScenarioRelationMapper taskScenarioRelationMapper;
@Autowired
private TestScenarioMapper testScenarioMapper;
// SIGNED状态下
// 1.standard字段使用task中归档的问卷
// 2.不查询场景变更任务
......@@ -78,6 +85,12 @@ public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, Initi
response.setCarReviewTask(carReviewTask);
Task task = taskMapper.getBySubtaskId(carReviewTask.getId());
if (task.getModelTestTaskId() != null) {
response.setTestScenarioList(testScenarioMapper.selectAll());
}
return response;
}
......@@ -92,7 +105,7 @@ public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, Initi
}
@Override
public void doSubmitReview(CarReviewTask carReviewTask, List<String> imagesUrl) {
public void doSubmitReview(CarReviewTask carReviewTask, List<String> imagesUrl, List<Long> testScenarioList) {
// 1. 填充review_submit_time
carReviewTask.setTaskEndTime(new Date());
......@@ -117,6 +130,17 @@ public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, Initi
carReviewTaskMapper.updateById(carReviewTask);
taskMapper.updateById(task);
// 总任务包含车型试验,添加任务-场景关联信息
if (CollUtil.isNotEmpty(testScenarioList)) {
for (Long sceneId : testScenarioList) {
TaskScenarioRelation taskScenario = TaskScenarioRelation.builder()
.taskId(task.getId())
.testScenarioId(sceneId)
.build();
taskScenarioRelationMapper.insert(taskScenario);
}
}
}
private void setCarDataStatistics(List<ReviewStandard> standards, List<ReviewDetailsResult> results, CarReviewTask carReviewTask) {
......
......@@ -19,7 +19,9 @@ import com.ruoyi.web.request.*;
import com.ruoyi.web.response.DataStatisticsResponse;
import com.ruoyi.web.response.TaskFindResponse;
import com.ruoyi.web.response.TaskGetInfoResponse;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -134,8 +136,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
task.setName(standard.getName());
task.setStandardNo(standard.getStandardNo());
task.setFile(standard.getFile());
String joinTaskList = StringUtils.join(request.getTaskList(),",");
task.setTaskList(joinTaskList);
setTaskList(request.getTaskList(),task);
BeanUtils.copyBeanProp(task, request);
if(request.getTaskList().contains(Task.SUB_TASK_GRFIS)) {
......@@ -215,8 +216,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
Task task = taskMapper.selectById(request.getId());
task.setLeaderId(leader.getUserId());
task.setLeader(leader.getName());
String joinTaskList = StringUtils.join(request.getTaskList(),",");
task.setTaskList(joinTaskList);
setTaskList(request.getTaskList(),task);
BeanUtils.copyBeanProp(task, request);
// 子任务发送变化
......@@ -335,7 +335,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
Task task = new Task();
task.setTaskInitiatorId(loginUser.getUserId());
task.setTaskInitiator(initiator.getNickName());
task.setTaskInitiatorDept(initiator.getDept().getDeptName());
if (initiator.getDept() != null) {
task.setTaskInitiatorDept(initiator.getDept().getDeptName());
}
task.setTaskStatus(Task.TASK_STATUS_TEMPORARILY);
String joinTaskList = StringUtils.join(request.getTaskList(),",");
task.setTaskList(joinTaskList);
......@@ -389,9 +391,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
// 构建并保存任务信息
// 总任务
Task task = new Task();
task.setTaskInitiatorId(loginUser.getUserId());
task.setTaskInitiator(initiator.getNickName());
task.setTaskInitiatorDept(initiator.getDept().getDeptName());
String joinTaskList = StringUtils.join(request.getTaskList(),",");
task.setTaskList(joinTaskList);
BeanUtils.copyBeanProp(task, request);
......@@ -530,6 +529,27 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
}
// 按顺序设置taskList
private void setTaskList(List<String> taskList, Task task) {
// 定义一个比较器,按照 "sraif, grfis, trfis" 的顺序排序
Comparator<String> customComparator = Comparator.comparingInt(str -> {
if (str.equals(Task.SUB_TASK_SRAIF)) return 0;
else if (str.equals(Task.SUB_TASK_GRFIS)) return 1;
else if (str.equals(Task.SUB_TASK_TRFIS)) return 2;
else return -1; // 处理其他情况
});
// 使用自定义的比较器进行排序
List<String> sortedTaskList = taskList.stream()
.sorted(customComparator)
.collect(Collectors.toList());
// 将排序后的结果用逗号连接起来存入一个字段中
String concatenatedTasks = String.join(",", sortedTaskList);
task.setTaskList(concatenatedTasks);
}
// 保存任务与小组信息
private void saveUserRelation(List<TaskUserRelation> auditors,Task task) {
// 构建并保存该任务所关联的审核组信息
......
......@@ -16,4 +16,7 @@ public class CarReviewTaskSubmitRequest {
@ApiModelProperty("图片地址")
private List<String> imagesUrl;
@ApiModelProperty("选择的测试场景")
private List<Long> testScenarioList;
}
......@@ -43,4 +43,9 @@ public class CarReviewTaskViewResponse {
return detailsList;
}
@ApiModelProperty("测试场景")
private List<TestScenario> testScenarioList;
}
......@@ -26,5 +26,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="testScenario != null and testScenario != ''"> and test_scenario like concat('%', #{testScenario}, '%')</if>
</where>
</select>
<select id="selectAll" resultType="com.ruoyi.domain.TestScenario">
select id, standard_classification, test_scenario, storage_time, create_by, create_time, update_by, update_time from t_test_scenario
</select>
</mapper>
\ No newline at end of file
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