Commit 3970085c authored by 盖献康's avatar 盖献康

Merge branch 'dev' of...

Merge branch 'dev' of ssh://gitlab.91isoft.com:10022/wangfei/vehicle-quality-review into gaixiankang
parents 6388f8fc 0498bc07
......@@ -50,4 +50,7 @@ public class TestRecords {
@ApiModelProperty("修复建议")
private String remediation;
@ApiModelProperty("测试详情")
private String testDetails;
}
......@@ -7,6 +7,8 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
@Data
@Builder
@NoArgsConstructor
......@@ -43,4 +45,17 @@ public class QuantityStatisticsVO {
@ApiModelProperty("场景数量")
private Long numberScenes;
@ApiModelProperty("已完成任务数量")
private Integer completedTaskNumber;
@ApiModelProperty("执行中任务数量")
private Integer executeTasksNumber;
@ApiModelProperty("已完成任务占比")
private Integer completedTaskProportion;
@ApiModelProperty("执行中任务任务占比")
private Integer executeTaskProportion;
}
......@@ -2,6 +2,9 @@ package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.ModelTestTask;
import com.ruoyi.web.response.ResultCountResponse;
import com.ruoyi.web.response.TaskFindResponse;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
......@@ -15,4 +18,10 @@ public interface ModelTestTaskMapper extends BaseMapper<ModelTestTask> {
// 查询pending状态下的所有任务
List<ModelTestTask> findByStatus();
// 根据总任务列表查询子任务
List<ModelTestTask> findByTaskList(@Param("responses") List<TaskFindResponse> responses);
// 根据子任务列表查询进度
List<ResultCountResponse> testAnswerCount(@Param("responses")List<TaskFindResponse> responses);
}
......@@ -18,11 +18,26 @@ public class StatisticsHomeServiceImpl implements StatisticsHomeService {
@Override
public QuantityStatisticsVO selectQuantityStatistics(QuantityStatisticsVO quantityStatisticsHome){
return statisticsHomeMapper.selectQuantityStatistics(quantityStatisticsHome);
QuantityStatisticsVO quantityStatisticsVO = statisticsHomeMapper.selectQuantityStatistics(quantityStatisticsHome);
quantityStatisticsVO.setExecuteTaskProportion(percentageCalculation(quantityStatisticsVO.getExecuteTasksNumber(),quantityStatisticsVO.getCompletedTaskNumber()));
quantityStatisticsVO.setCompletedTaskProportion(percentageCalculation(quantityStatisticsVO.getCompletedTaskNumber(),quantityStatisticsVO.getExecuteTasksNumber()));
return quantityStatisticsVO;
}
@Override
public List<StandardCategoryStatisticsVO> selectStandardCategoryStatistics(){
return statisticsHomeMapper.selectStandardCategoryStatistics();
}
// 计算百分比
public int percentageCalculation(Integer a, Integer b){
int total = a+b;
if(total == 0){
return 0;
}else {
float c = (float)a/total;
return Math.round(c*100);
}
}
}
......@@ -59,6 +59,12 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
for (TestRecords records : recordsList) {
if (Objects.equals(caseResultVO.getId(), records.getUsecaseId())) {
exists = true;
if (!Objects.equals(caseResultVO.getStatus(), records.getTestResult())) {
records.setTestResult(caseResultVO.getStatus());
records.setRemediation(caseResultVO.getRemediation());
testRecordsService.updateById(records);
}
break;
}
}
......@@ -80,12 +86,24 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
if (stepResultVOS != null && stepResultVOS.size() != 0) {
List<String> stepList = new ArrayList<>();
List<String> testDetailsList = new ArrayList<>();
int index = 1; // 序号从1开始
for (StepResultVO stepResultVO :stepResultVOS) {
// 测试方法
String stepName = stepResultVO.getName();
stepList.add(stepName);
// 给每个元素加上序号
String stepWithIndex = index + "." + stepName;
stepList.add(stepWithIndex);
index++;
// 测试详情
String testDetails = stepResultVO.getDescription();
testDetailsList.add(testDetails);
}
testRecords.setTestMethod(StringUtils.join(stepList,","));
testRecords.setTestMethod(StringUtils.join(stepList,"`"));
testRecords.setTestDetails(StringUtils.join(testDetailsList,"\n"));
}
list.add(testRecords);
......@@ -141,12 +159,24 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
if (stepResultVOS != null && stepResultVOS.size() != 0) {
List<String> stepList = new ArrayList<>();
List<String> testDetailsList = new ArrayList<>();
int index = 1; // 序号从1开始
for (StepResultVO stepResultVO :stepResultVOS) {
// 测试方法
String stepName = stepResultVO.getName();
stepList.add(stepName);
// 给每个元素加上序号
String stepWithIndex = index + "." + stepName;
stepList.add(stepWithIndex);
index++;
// 测试详情
String testDetails = stepResultVO.getDescription();
testDetailsList.add(testDetails);
}
testRecords.setTestMethod(StringUtils.join(stepList,","));
testRecords.setTestMethod(StringUtils.join(stepList,"`"));
testRecords.setTestDetails(StringUtils.join(testDetailsList,"\n"));
}
list.add(testRecords);
......
......@@ -27,10 +27,38 @@
<result property="standards" column="standards" jdbcType="INTEGER"/>
<result property="testSchemeId" column="test_scheme_id" jdbcType="VARCHAR"/>
</resultMap>
<select id="findByStatus" resultType="com.ruoyi.domain.ModelTestTask">
SELECT id,task_no,task_status,task_initiator,task_initiator_dept,task_result,task_begin_time,task_end_time,test_case,create_time,leader_id,leader,standard_id,name,standard_no,submit_id,submit_name,images_url,details,standards,test_scheme_id
FROM t_model_test_task WHERE task_status = 'PENDING'
</select>
<select id="findByStatus" resultType="com.ruoyi.domain.ModelTestTask">
SELECT id,task_no,task_status,task_initiator,task_initiator_dept,task_result,task_begin_time,task_end_time,test_case,create_time,leader_id,leader,standard_id,name,standard_no,submit_id,submit_name,images_url,details,standards,test_scheme_id
FROM t_model_test_task WHERE task_status = 'PENDING'
</select>
<select id="findByTaskList" resultType="com.ruoyi.domain.ModelTestTask">
SELECT id,task_no,task_status,task_initiator,task_initiator_dept,task_result,task_begin_time,task_end_time,test_case,create_time,leader_id,leader,standard_id,name,standard_no,submit_id,submit_name,images_url,details,standards,test_scheme_id
FROM t_model_test_task
WHERE id IN
<foreach collection="responses" item="task" open="(" separator="," close=")">
#{task.modelTestTaskId}
</foreach>
</select>
<select id="testAnswerCount" resultType="com.ruoyi.web.response.ResultCountResponse">
<foreach item="task" collection="responses" separator="UNION ALL">
SELECT
#{task.modelTestTaskId} AS taskId,
(IFNULL(
(SELECT COUNT(*) FROM t_test_records WHERE task_id = #{task.modelTestTaskId}),
0
) /
IFNULL(
(SELECT COUNT(*) FROM t_task_scenario_relation tsr
INNER JOIN t_test_scenario tts ON tts.id = tsr.test_scenario_id
INNER JOIN t_test_usecase ttu ON tts.id = ttu.test_scenario_id
WHERE tsr.task_id = #{task.id}),
1
)) * 90 AS schedule,
tm.task_status AS taskStatus
from t_model_test_task tm where tm.id = #{task.modelTestTaskId}
</foreach>
group by taskId
</select>
</mapper>
......@@ -24,7 +24,9 @@
( SELECT count( id ) FROM t_sample WHERE flag = '1' AND deleted = 0 ) AS numberComponentSamples,
( SELECT count( id ) FROM t_test_scenario ) AS numberScenes,
( SELECT count( id ) FROM t_test_type ) AS numberMethods,
( SELECT count( id ) FROM t_task WHERE vehicle_information_url IS NOT NULL ) AS numberReports
( SELECT count( id ) FROM t_task WHERE vehicle_information_url IS NOT NULL ) AS numberReports,
( SELECT count( id ) FROM t_task WHERE task_status = 'FINISH' ) AS completedTaskNumber,
( SELECT count( id ) FROM t_task WHERE task_status = 'NEW' OR task_status = 'PENDING' ) AS executeTasksNumber
</select>
<select id="selectStandardCategoryStatistics" resultType="com.ruoyi.domain.vo.StandardCategoryStatisticsVO">
......
......@@ -16,12 +16,13 @@
<result property="testMethod" column="test_method" jdbcType="LONGNVARCHAR"/>
<result property="testResult" column="test_result" jdbcType="VARCHAR"/>
<result property="remediation" column="remediation" jdbcType="VARCHAR"/>
<result property="testDetails" column="test_details" jdbcType="LONGNVARCHAR"/>
</resultMap>
<select id="findByTaskId" resultType="com.ruoyi.domain.TestRecords">
SELECT id, project_id, task_id, usecase, usecase_id, test_time, description, risk_level, test_method, test_result, remediation
FROM t_test_records
WHERE project_id = #{id}
</select>
<select id="findByTaskId" resultType="com.ruoyi.domain.TestRecords">
SELECT id, project_id, task_id, usecase, usecase_id, test_time, description, risk_level, test_method, test_result, remediation, test_details
FROM t_test_records
WHERE project_id = #{id}
</select>
</mapper>
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