Commit 9f6ba851 authored by 盖献康's avatar 盖献康

Merge branch 'dev' into 'master'

dev - master 6.0

See merge request !300
parents 2a8263fa 2e3b739d
...@@ -46,6 +46,14 @@ public class ModelTestTask { ...@@ -46,6 +46,14 @@ public class ModelTestTask {
@TableField(exist = false) @TableField(exist = false)
public static final String TASK_STATUS_FINISH = "FINISH"; public static final String TASK_STATUS_FINISH = "FINISH";
/**
* 任务结果
*/
@TableField(exist = false)
public static final String TASK_STATUS_PASS = "PASS";
@TableField(exist = false)
public static final String TASK_STATUS_REJECT = "REJECT";
@ApiModelProperty("主键") @ApiModelProperty("主键")
@TableId(type = IdType.ASSIGN_ID) @TableId(type = IdType.ASSIGN_ID)
@JsonFormat(shape = JsonFormat.Shape.STRING) @JsonFormat(shape = JsonFormat.Shape.STRING)
......
...@@ -30,11 +30,14 @@ public class TestRecords { ...@@ -30,11 +30,14 @@ public class TestRecords {
@ApiModelProperty("用例名称") @ApiModelProperty("用例名称")
private String usecase; private String usecase;
@ApiModelProperty("用例编号")
private String usecaseNo;
@ApiModelProperty("用例id") @ApiModelProperty("用例id")
private String usecaseId; private String usecaseId;
@ApiModelProperty("测试时间") @ApiModelProperty("测试时间")
private Date testTime; private String testTime;
@ApiModelProperty("用例简述") @ApiModelProperty("用例简述")
private String description; private String description;
......
...@@ -28,6 +28,12 @@ public class CaseResultVO { ...@@ -28,6 +28,12 @@ public class CaseResultVO {
@ApiModelProperty("用例检测状态枚举 UNPROCESSED: 未处理 PASSED: 通过 FAILED: 失败 PROCESSING: 处理中 IGNORED: 已忽略") @ApiModelProperty("用例检测状态枚举 UNPROCESSED: 未处理 PASSED: 通过 FAILED: 失败 PROCESSING: 处理中 IGNORED: 已忽略")
private String status; private String status;
@ApiModelProperty("用例编号")
private String serial_number;
@ApiModelProperty("用例开始时间")
private Integer start_time;
@ApiModelProperty("用例步骤结果列表") @ApiModelProperty("用例步骤结果列表")
List<StepResultVO> step_result_list; List<StepResultVO> step_result_list;
} }
package com.ruoyi.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 检验项目VO
* @author gxk
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("检验项目VO")
public class InspectionItemVO {
@ApiModelProperty("检验项目名")
private String inspectionItemName;
@ApiModelProperty("检验项目结果")
private String taskResult;
}
package com.ruoyi.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 总任务 - 检验人员VO
* @author gxk
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("检验人员VO")
public class InspectionPersonnelVO {
@ApiModelProperty("负责人")
private String principal;
@ApiModelProperty("检验人员")
private String inspectionPersonnel;
@ApiModelProperty("检验日期")
private String inspectionDate;
}
package com.ruoyi.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 用于检验报告PDF 的 检验结论
* @author gxk
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("检验结论VO")
public class TestConclusionVO {
@ApiModelProperty("体系审查任务结论")
private String systemReviewTaskResult;
@ApiModelProperty("车辆检验任务结论")
private String carReviewTaskResult;
@ApiModelProperty("车型试验任务结论")
private String modelTestTaskResult;
@ApiModelProperty("系统审查任务完成日期")
private String systemReviewTaskDate;
@ApiModelProperty("车辆检验任务完成日期")
private String carReviewTaskDate;
@ApiModelProperty("车型试验任务完成日期")
private String modelTestTaskDate;
}
...@@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.Task; import com.ruoyi.domain.Task;
import com.ruoyi.domain.TaskUserRelation; import com.ruoyi.domain.TaskUserRelation;
import com.ruoyi.domain.vo.EnterpriseFilePdfVO; import com.ruoyi.domain.vo.EnterpriseFilePdfVO;
import com.ruoyi.domain.vo.InspectionPersonnelVO;
import com.ruoyi.domain.vo.InspectionReportPdfVO; import com.ruoyi.domain.vo.InspectionReportPdfVO;
import com.ruoyi.domain.vo.TestConclusionVO;
import com.ruoyi.web.request.TaskFindFinishRequest; import com.ruoyi.web.request.TaskFindFinishRequest;
import com.ruoyi.web.request.TaskFindPendingRequest; import com.ruoyi.web.request.TaskFindPendingRequest;
import com.ruoyi.web.request.TaskFindRequest; import com.ruoyi.web.request.TaskFindRequest;
...@@ -67,4 +69,17 @@ public interface TaskMapper extends BaseMapper<Task> { ...@@ -67,4 +69,17 @@ public interface TaskMapper extends BaseMapper<Task> {
List<UserNameResponse> findByFinishTaskList(@Param("taskList") List<Task> taskList); List<UserNameResponse> findByFinishTaskList(@Param("taskList") List<Task> taskList);
/**
* 通过总任务ID查询当前任务的每个子任务的结果
* @param taskId
* @return
*/
TestConclusionVO selectTestConclusion(Long taskId);
/**
* 通过总任务ID查询当前任务的小组成员
* @param taskId
* @return
*/
InspectionPersonnelVO selectInspectionPersonnelById(Long taskId);
} }
...@@ -63,22 +63,26 @@ public class StrategyModelTestTaskPending implements StrategyModelTestTask, Init ...@@ -63,22 +63,26 @@ public class StrategyModelTestTaskPending implements StrategyModelTestTask, Init
JSONObject jsonObject = testUseCaseService.callThirdPartyInterface(url, map); JSONObject jsonObject = testUseCaseService.callThirdPartyInterface(url, map);
Integer sumCount = (Integer) jsonObject.get("case_count"); Integer sumCount = (Integer) jsonObject.get("case_count");
AtomicReference<Integer> currentCount = new AtomicReference<>(0); AtomicReference<Integer> currentCount = new AtomicReference<>(0);
AtomicReference<Integer> failedCount = new AtomicReference<>(0);
List<CaseStatistics> caseStatisticsList = jsonObject.getList("case_statistics", CaseStatistics.class); List<CaseStatistics> caseStatisticsList = jsonObject.getList("case_statistics", CaseStatistics.class);
if (CollUtil.isNotEmpty(caseStatisticsList)) { if (CollUtil.isNotEmpty(caseStatisticsList)) {
caseStatisticsList.forEach(obj -> { caseStatisticsList.forEach(obj -> {
if (CaseStatistics.CASE_STATUS_FAILED.equals(obj.status) || CaseStatistics.CASE_STATUS_PASSED.equals(obj.status)) { if (CaseStatistics.CASE_STATUS_FAILED.equals(obj.status) || CaseStatistics.CASE_STATUS_PASSED.equals(obj.status)) {
currentCount.updateAndGet(v -> v + obj.getCount()); currentCount.updateAndGet(v -> v + obj.getCount());
} }
if (CaseStatistics.CASE_STATUS_FAILED.equals(obj.status)) {
failedCount.updateAndGet(v -> v + obj.getCount());
}
}); });
} }
Integer integer = currentCount.get();
System.out.println(integer);
// 进行中的任务, 点击返回后, 判断当前用例完成程度, 用例都完成后状态改为待签字 // 进行中的任务, 点击返回后, 判断当前用例完成程度, 用例都完成后状态改为待签字
if (sumCount.equals(currentCount.get())) { if (sumCount.equals(currentCount.get())) {
modelTestTaskMapper.update(new ModelTestTask(), modelTestTaskMapper.update(new ModelTestTask(),
new LambdaUpdateWrapper<ModelTestTask>() new LambdaUpdateWrapper<ModelTestTask>()
.set(ModelTestTask::getTaskEndTime, new Date()) .set(ModelTestTask::getTaskEndTime, new Date())
.set(ModelTestTask::getTaskStatus, ModelTestTask.TASK_STATUS_SIGNED) .set(ModelTestTask::getTaskStatus, ModelTestTask.TASK_STATUS_SIGNED)
.set(failedCount.get() > 0, ModelTestTask::getTaskResult, ModelTestTask.TASK_STATUS_REJECT)
.set(failedCount.get().equals(0), ModelTestTask::getTaskResult, ModelTestTask.TASK_STATUS_PASS)
.eq(ModelTestTask::getId, modelTestTask.getId())); .eq(ModelTestTask::getId, modelTestTask.getId()));
} }
} }
......
...@@ -18,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -18,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -85,6 +86,14 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR ...@@ -85,6 +86,14 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
testRecords.setRiskLevel(caseResultVO.getRisk_level()); testRecords.setRiskLevel(caseResultVO.getRisk_level());
testRecords.setTestResult(caseResultVO.getStatus()); testRecords.setTestResult(caseResultVO.getStatus());
testRecords.setRemediation(caseResultVO.getRemediation()); testRecords.setRemediation(caseResultVO.getRemediation());
testRecords.setUsecaseNo(caseResultVO.getSerial_number());
//测试开始时间
if (caseResultVO.getStart_time() != null) {
Date date = new Date(caseResultVO.getStart_time());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
String testTime = sdf.format(date);
testRecords.setTestTime(testTime);
}
// 用例步骤 // 用例步骤
List<StepResultVO> stepResultVOS = caseResultVO.getStep_result_list(); List<StepResultVO> stepResultVOS = caseResultVO.getStep_result_list();
...@@ -107,12 +116,12 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR ...@@ -107,12 +116,12 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
// 测试详情 // 测试详情
String testDetails = stepResultVO.getDescription(); String testDetails = stepResultVO.getDescription();
if (testDetails != null) { if (testDetails != null) {
convertMarkdownToHtml(testDetails); testDetails = convertMarkdownToHtml(testDetails);
} }
testDetailsVO += testDetails + "`"; testDetailsVO += testDetails + "<br> ";
} }
testDetailsVO = testDetailsVO.substring(0, testDetailsVO.length() - 1); testDetailsVO = testDetailsVO.substring(0, testDetailsVO.length() - 1);
testRecords.setTestMethod(StringUtils.join(stepList,"`")); testRecords.setTestMethod(StringUtils.join(stepList,"\n"));
testRecords.setTestDetails(testDetailsVO); testRecords.setTestDetails(testDetailsVO);
} }
...@@ -163,6 +172,14 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR ...@@ -163,6 +172,14 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
testRecords.setRiskLevel(caseResultVO.getRisk_level()); testRecords.setRiskLevel(caseResultVO.getRisk_level());
testRecords.setTestResult(caseResultVO.getStatus()); testRecords.setTestResult(caseResultVO.getStatus());
testRecords.setRemediation(caseResultVO.getRemediation()); testRecords.setRemediation(caseResultVO.getRemediation());
testRecords.setUsecaseNo(caseResultVO.getSerial_number());
//测试开始时间
if (caseResultVO.getStart_time() != null) {
Date date = new Date(caseResultVO.getStart_time());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
String testTime = sdf.format(date);
testRecords.setTestTime(testTime);
}
// 用例步骤 // 用例步骤
List<StepResultVO> stepResultVOS = caseResultVO.getStep_result_list(); List<StepResultVO> stepResultVOS = caseResultVO.getStep_result_list();
...@@ -185,7 +202,7 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR ...@@ -185,7 +202,7 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
// 测试详情 // 测试详情
String testDetails = stepResultVO.getDescription(); String testDetails = stepResultVO.getDescription();
if (testDetails != null) { if (testDetails != null) {
convertMarkdownToHtml(testDetails); testDetails = convertMarkdownToHtml(testDetails);
} }
testDetailsVO += testDetails + "`"; testDetailsVO += testDetails + "`";
} }
...@@ -220,7 +237,7 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR ...@@ -220,7 +237,7 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
// jsoup标准化标签,生成闭合标签 // jsoup标准化标签,生成闭合标签
doc.outputSettings().syntax(org.jsoup.nodes.Document.OutputSettings.Syntax.xml); doc.outputSettings().syntax(org.jsoup.nodes.Document.OutputSettings.Syntax.xml);
doc.outputSettings().escapeMode(Entities.EscapeMode.xhtml); doc.outputSettings().escapeMode(Entities.EscapeMode.xhtml);
return doc.html(); return doc.body().html();
} }
@Override @Override
......
...@@ -390,5 +390,38 @@ ...@@ -390,5 +390,38 @@
</foreach> </foreach>
</select> </select>
<select id="selectTestConclusion" parameterType="java.lang.Long" resultType="com.ruoyi.domain.vo.TestConclusionVO">
select
srt.task_result AS systemReviewTaskResult,
DATE_FORMAT(srt.task_end_time, '%Y-%m-%d') AS systemReviewTaskDate,
crt.task_result AS carReviewTaskResult,
DATE_FORMAT(crt.task_end_time, '%Y-%m-%d') AS carReviewTaskDate,
mtt.task_result AS modelTestTaskResult,
DATE_FORMAT(mtt.task_end_time, '%Y-%m-%d') AS modelTestTaskDate
from
t_task t
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_model_test_task mtt on t.model_test_task_id = mtt.id
where
t.id = #{taskId}
</select>
<select id="selectInspectionPersonnelById" parameterType="java.lang.Long" resultType="com.ruoyi.domain.vo.InspectionPersonnelVO">
select
su.nick_name AS principal,
GROUP_CONCAT(distinct u.nick_name) AS inspectionPersonnel,
DATE_FORMAT(mtt.task_begin_time, '%Y-%m-%d') AS inspectionDate
from
t_task t
left join t_task_user_relation tur on t.id = tur.task_id
left join sys_user u on tur.user_id = u.user_id
left join sys_user su on t.leader_id = su.user_id
left join t_model_test_task mtt on t.model_test_task_id = mtt.id
where
t.id = #{taskId}
group by t.id
</select>
</mapper> </mapper>
...@@ -9,8 +9,9 @@ ...@@ -9,8 +9,9 @@
<result property="projectId" column="project_id" jdbcType="VARCHAR"/> <result property="projectId" column="project_id" jdbcType="VARCHAR"/>
<result property="taskId" column="task_id" jdbcType="BIGINT"/> <result property="taskId" column="task_id" jdbcType="BIGINT"/>
<result property="usecase" column="usecase" jdbcType="VARCHAR"/> <result property="usecase" column="usecase" jdbcType="VARCHAR"/>
<result property="usecaseNo" column="usecase_no" jdbcType="VARCHAR"/>
<result property="usecaseId" column="usecase_id" jdbcType="VARCHAR"/> <result property="usecaseId" column="usecase_id" jdbcType="VARCHAR"/>
<result property="testTime" column="test_time" jdbcType="TIMESTAMP"/> <result property="testTime" column="test_time" jdbcType="VARCHAR"/>
<result property="description" column="description" jdbcType="LONGNVARCHAR"/> <result property="description" column="description" jdbcType="LONGNVARCHAR"/>
<result property="riskLevel" column="risk_level" jdbcType="VARCHAR"/> <result property="riskLevel" column="risk_level" jdbcType="VARCHAR"/>
<result property="testMethod" column="test_method" jdbcType="LONGNVARCHAR"/> <result property="testMethod" column="test_method" jdbcType="LONGNVARCHAR"/>
...@@ -19,7 +20,7 @@ ...@@ -19,7 +20,7 @@
<result property="testDetails" column="test_details" jdbcType="LONGNVARCHAR"/> <result property="testDetails" column="test_details" jdbcType="LONGNVARCHAR"/>
</resultMap> </resultMap>
<select id="findByTaskId" resultType="com.ruoyi.domain.TestRecords"> <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 SELECT id, project_id, task_id, usecase, usecase_no, usecase_id, test_time, description, risk_level, test_method, test_result, remediation, test_details
FROM t_test_records FROM t_test_records
WHERE project_id = #{id} WHERE project_id = #{id}
</select> </select>
...@@ -39,7 +40,8 @@ ...@@ -39,7 +40,8 @@
tr.test_method, tr.test_method,
tr.test_result, tr.test_result,
tr.remediation, tr.remediation,
tr.test_details tr.test_details,
tr.usecase_no
from from
t_test_records tr t_test_records tr
left join t_task t on tr.task_id = t.model_test_task_id left join t_task t on tr.task_id = t.model_test_task_id
......
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