Commit e935c165 authored by wdy's avatar wdy

查看车型测试详情添加数据统计和图片&取消传入固定签字图片&任务数据统计

parent db9f50ca
......@@ -112,7 +112,6 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
// 构建返回结果
CarReviewTaskViewResponse response = new CarReviewTaskViewResponse();
carReviewTask.setImagesUrl("/vehicle-quality-review-oss/2024/03/04/qianzi1_20240304104011A001.jpg,/vehicle-quality-review-oss/2024/03/04/qianzi2_20240304104121A002.jpg");
response.setCarReviewTask(carReviewTask);
response.setReviewSceneChangeTasks(lastChanges);
......
......@@ -72,7 +72,6 @@ public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, Initi
@Override
public CarReviewTaskViewResponse doView(CarReviewTask carReviewTask) {
CarReviewTaskViewResponse response = new CarReviewTaskViewResponse();
carReviewTask.setImagesUrl("/vehicle-quality-review-oss/2024/03/04/qianzi1_20240304104011A001.jpg,/vehicle-quality-review-oss/2024/03/04/qianzi2_20240304104121A002.jpg");
// 获取问卷
List<ReviewStandard> carStandardTree = reviewStandardService.findTree(carReviewTask.getStandardId(), ReviewStandard.TYPE_CAR);
......
......@@ -8,10 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.domain.*;
import com.ruoyi.domain.vo.ModelTestResultVO;
import com.ruoyi.domain.vo.ModelTestViewVO;
import com.ruoyi.domain.vo.TestCaseVO;
import com.ruoyi.domain.vo.TestUsecaseVO;
import com.ruoyi.domain.vo.*;
import com.ruoyi.mapper.ModelTestTaskMapper;
import com.ruoyi.mapper.TaskMapper;
import com.ruoyi.mapper.TestUseCaseMapper;
......@@ -26,6 +23,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
......@@ -173,8 +171,40 @@ public class StrategyModelTestTaskNew implements StrategyModelTestTask, Initiali
List<ModelTestViewVO> list = jsonObject.getList("regulation_item_result_list",ModelTestViewVO.class);
response.setStandardNum((Integer) jsonObject.get("regulation_item_count"));
response.setModelTestTaskViewResponseList(list);
// 用例
String resultUseCase= HttpUtil.post("https://10.12.48.78:8090/DescribeProjectTestResult", JSONObject.toJSONString(map));
JSONObject jsonObjectUseCase = JSONObject.parseObject(resultUseCase);
response.setUseCaseNum((Integer) jsonObjectUseCase.get("case_count"));
List<CaseStatisticsVO> statisticsVOList = jsonObjectUseCase.getList("case_statistics",CaseStatisticsVO.class);
Integer ignoredNum = 0;
for (CaseStatisticsVO vo : statisticsVOList) {
// 忽略
if (Objects.equals(vo.getStatus(), "IGNORED")) {
ignoredNum = vo.getCount();
}
if (Objects.equals(vo.getStatus(), "PASSED")) {
// 测试通过
response.setTestPassNum(vo.getCount());
}
if (Objects.equals(vo.getStatus(), "FAILED")) {
// 测试未通过
response.setTestNoPassNum(vo.getCount());
}
}
// 测试通过率
BigDecimal num = new BigDecimal(((double) response.getTestPassNum() / response.getUseCaseNum()) * 100);
response.setTestPass(num.setScale(1,BigDecimal.ROUND_UP).doubleValue());
}
Task task = taskMapper.selectOne(new QueryWrapper<Task>().lambda().eq(Task::getModelTestTaskId, modelTestTask.getId()));
......@@ -182,6 +212,7 @@ public class StrategyModelTestTaskNew implements StrategyModelTestTask, Initiali
response.setTaskName(task.getTaskName());
response.setEntrustedUnit(task.getEntrustedUnit());
response.setTaskStatus(modelTestTask.getTaskStatus());
response.setImgUrl(modelTestTask.getImagesUrl());
return response;
}
......
......@@ -65,21 +65,26 @@ public class StrategyModelTestTaskSigned implements StrategyModelTestTask, Initi
@Override
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);
if (imagesUrl != null && imagesUrl.size() != 0) {
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);
}
} else {
throw new ServiceException("请提交签字图片", HttpStatus.ERROR);
}
}
@Override
......
......@@ -152,7 +152,6 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
// 构建返回结果
SystemReviewTaskViewResponse response = new SystemReviewTaskViewResponse();
systemReviewTask.setImagesUrl("/vehicle-quality-review-oss/2024/03/04/qianzi1_20240304104011A001.jpg,/vehicle-quality-review-oss/2024/03/04/qianzi2_20240304104121A002.jpg");
response.setSystemReviewTask(systemReviewTask);
response.setReviewSceneChangeTasks(lastChanges);
......
......@@ -105,7 +105,6 @@ public class StrategySystemReviewTaskSigned implements StrategySystemReviewTask,
@Override
public SystemReviewTaskViewResponse doView(SystemReviewTask systemReviewTask) {
SystemReviewTaskViewResponse response = new SystemReviewTaskViewResponse();
systemReviewTask.setImagesUrl("/vehicle-quality-review-oss/2024/03/04/qianzi1_20240304104011A001.jpg,/vehicle-quality-review-oss/2024/03/04/qianzi2_20240304104121A002.jpg");
// 获取问卷
List<ReviewStandard> standardTree = reviewStandardService.findTree(systemReviewTask.getStandardId(), ReviewStandard.TYPE_SYSTEM);
......
......@@ -776,10 +776,144 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
response.setCarExist(false);
}
// 车型测试数据统计
carTestStatistics(response,task);
return response;
}
private void carTestStatistics(DataStatisticsResponse response, Task task) {
if (task.getModelTestTaskId() != null) {
response.setTestExist(true);
ModelTestTask modelTestTask = modelTestTaskMapper.selectById(task.getModelTestTaskId());
if (modelTestTask.getTestSchemeId() != null) {
// 用例维度
String url = "https://10.12.48.78:8090/DescribeProjectTestResult";
Statistics(response,task,url,"useCase");
// 合规维度
String urlCompliance = "https://10.12.48.78:8090/DescribeProjectComplianceResult";
Statistics(response,task,urlCompliance,"compliance");
}
} else {
response.setTestExist(false);
}
}
private void Statistics(DataStatisticsResponse response, Task task, String url, String str) {
if (task.getModelTestTaskId() != null) {
ModelTestTask modelTestTask = modelTestTaskMapper.selectById(task.getModelTestTaskId());
if (modelTestTask.getTestSchemeId() != null) {
Map<String, Object> map = new HashMap<>();
map.put("id", modelTestTask.getTestSchemeId());
map.put("verbose", "BASIC");
//以post形式请求接口
String result= HttpUtil.post(url,JSONObject.toJSONString(map));
JSONObject jsonObject = JSONObject.parseObject(result);
// 用例维度
if (Objects.equals(str, "useCase")) {
// 测试用例合计
response.setTestDetails((Integer) jsonObject.get("case_count"));
List<CaseStatisticsVO> statisticsVOList = jsonObject.getList("case_statistics",CaseStatisticsVO.class);
Integer ignoredNum = 0;
Integer processingNum = 0;
Integer unprocessedNum = 0;
for (CaseStatisticsVO vo : statisticsVOList) {
// 忽略
if (Objects.equals(vo.getStatus(), "IGNORED")) {
ignoredNum = vo.getCount();
}
if (Objects.equals(vo.getStatus(), "PASSED")) {
// 测试通过
response.setTestDetailsPassNum(vo.getCount());
}
if (Objects.equals(vo.getStatus(), "FAILED")) {
// 测试未通过
response.setTestDetailsNoPassNum(vo.getCount());
}
// 处理中
if (Objects.equals(vo.getStatus(), "PROCESSING")) {
processingNum = vo.getCount();
}
// 未处理
if (Objects.equals(vo.getStatus(), "UNPROCESSED")) {
unprocessedNum = vo.getCount();
}
}
// 执行未完成
response.setTestDetailsUnderNum(processingNum + unprocessedNum);
// 测试通过率
BigDecimal num = new BigDecimal(((double) response.getTestDetailsPassNum() / response.getTestDetails()) * 100);
response.setTestDetailsPass(num.setScale(1,BigDecimal.ROUND_UP).doubleValue());
}
// 合规维度
if (Objects.equals(str, "compliance")) {
// 测试用例合计
response.setTestStandards((Integer) jsonObject.get("regulation_item_count"));
List<CaseStatisticsVO> statisticsVOList = jsonObject.getList("regulation_item_statistics",CaseStatisticsVO.class);
Integer ignoredNum = 0;
Integer processingNum = 0;
Integer unprocessedNum = 0;
for (CaseStatisticsVO vo : statisticsVOList) {
// 忽略
if (Objects.equals(vo.getStatus(), "IGNORED")) {
ignoredNum = vo.getCount();
}
if (Objects.equals(vo.getStatus(), "PASSED")) {
// 测试通过
response.setTestStandardsPassNum(vo.getCount());
}
if (Objects.equals(vo.getStatus(), "FAILED")) {
// 测试未通过
response.setTestStandardsNoPassNum(vo.getCount());
}
// 处理中
if (Objects.equals(vo.getStatus(), "PROCESSING")) {
processingNum = vo.getCount();
}
// 未处理
if (Objects.equals(vo.getStatus(), "UNPROCESSED")) {
unprocessedNum = vo.getCount();
}
}
// 执行未完成
response.setTestStandardsUnderNum(processingNum + unprocessedNum);
// 测试通过率
BigDecimal num = new BigDecimal(((double) response.getTestStandardsPassNum() / response.getTestStandards()) * 100);
response.setTestStandardsPass(num.setScale(1,BigDecimal.ROUND_UP).doubleValue());
}
}
}
}
private void changeSubLeader(Task task, TaskUserRelation leader) {
if (!Objects.equals(task.getLeaderId(), leader.getUserId())) {
......
......@@ -23,6 +23,24 @@ public class ModelTestUrlResponse {
@ApiModelProperty("子任务状态")
private String taskStatus;
@ApiModelProperty("测试用例")
private Integer useCaseNum;
@ApiModelProperty("标准条款")
private Integer standardNum;
@ApiModelProperty("测试通过率")
private Double testPass;
@ApiModelProperty("测试通过")
private Integer testPassNum;
@ApiModelProperty("测试未通过")
private Integer testNoPassNum;
@ApiModelProperty("签字图片")
private String imgUrl;
@ApiModelProperty("审查表单概要")
private List<ModelTestViewVO> 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