fix(测试计划): 计划列表展示通过率未保留两位
--bug=1040981 --user=宋昌昌 【测试计划】报告列表-通过率未保留2位小数 https://www.tapd.cn/55049933/s/1519154
This commit is contained in:
parent
8aeba915c3
commit
9fa45fd490
|
@ -1,5 +1,7 @@
|
||||||
package io.metersphere.plan.dto.response;
|
package io.metersphere.plan.dto.response;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import io.metersphere.plan.serializer.CustomRateSerializer;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
@ -23,10 +25,13 @@ public class TestPlanReportDetailResponse {
|
||||||
* 报告分析
|
* 报告分析
|
||||||
*/
|
*/
|
||||||
@Schema(description = "通过阈值")
|
@Schema(description = "通过阈值")
|
||||||
|
@JsonSerialize(using = CustomRateSerializer.class)
|
||||||
private Double passThreshold;
|
private Double passThreshold;
|
||||||
@Schema(description = "通过率")
|
@Schema(description = "通过率")
|
||||||
|
@JsonSerialize(using = CustomRateSerializer.class)
|
||||||
private Double passRate;
|
private Double passRate;
|
||||||
@Schema(description = "执行完成率")
|
@Schema(description = "执行完成率")
|
||||||
|
@JsonSerialize(using = CustomRateSerializer.class)
|
||||||
private Double executeRate;
|
private Double executeRate;
|
||||||
@Schema(description = "缺陷总数")
|
@Schema(description = "缺陷总数")
|
||||||
private Integer bugCount;
|
private Integer bugCount;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package io.metersphere.plan.dto.response;
|
package io.metersphere.plan.dto.response;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import io.metersphere.plan.serializer.CustomRateSerializer;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -23,6 +25,7 @@ public class TestPlanReportPageResponse {
|
||||||
@Schema(description = "执行结果")
|
@Schema(description = "执行结果")
|
||||||
private String resultStatus;
|
private String resultStatus;
|
||||||
@Schema(description = "通过率")
|
@Schema(description = "通过率")
|
||||||
|
@JsonSerialize(using = CustomRateSerializer.class)
|
||||||
private Double passRate;
|
private Double passRate;
|
||||||
@Schema(description = "创建人")
|
@Schema(description = "创建人")
|
||||||
private String createUser;
|
private String createUser;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package io.metersphere.plan.dto.response;
|
package io.metersphere.plan.dto.response;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import io.metersphere.plan.serializer.CustomRateSerializer;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -15,12 +17,15 @@ public class TestPlanStatisticsResponse {
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
@Schema(description = "测试计划通过阈值{0-100}")
|
@Schema(description = "测试计划通过阈值{0-100}")
|
||||||
|
@JsonSerialize(using = CustomRateSerializer.class)
|
||||||
private Double passThreshold;
|
private Double passThreshold;
|
||||||
|
|
||||||
@Schema(description = "测试计划: 通过率 {成功用例/全部用例}")
|
@Schema(description = "测试计划: 通过率 {成功用例/全部用例}")
|
||||||
|
@JsonSerialize(using = CustomRateSerializer.class)
|
||||||
private Double passRate;
|
private Double passRate;
|
||||||
|
|
||||||
@Schema(description = "测试计划: 执行进度||测试进度 {已执行用例/全部用例}")
|
@Schema(description = "测试计划: 执行进度||测试进度 {已执行用例/全部用例}")
|
||||||
|
@JsonSerialize(using = CustomRateSerializer.class)
|
||||||
private Double executeRate;
|
private Double executeRate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package io.metersphere.plan.serializer;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonGenerator;
|
||||||
|
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||||
|
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
|
public class CustomRateSerializer extends JsonSerializer<Double> {
|
||||||
|
|
||||||
|
private final DecimalFormat format = new DecimalFormat("0.00");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serialize(Double value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
|
||||||
|
if (value != null) {
|
||||||
|
jsonGenerator.writeString(format.format(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -101,7 +101,7 @@ public class TestPlanReportShareService {
|
||||||
//检查报告ID是否存在
|
//检查报告ID是否存在
|
||||||
dto.setDeleted(false);
|
dto.setDeleted(false);
|
||||||
TestPlanReport testPlanReport = testPlanReportMapper.selectByPrimaryKey(dto.getReportId());
|
TestPlanReport testPlanReport = testPlanReportMapper.selectByPrimaryKey(dto.getReportId());
|
||||||
if (testPlanReport == null) {
|
if (testPlanReport == null || testPlanReport.getDeleted()) {
|
||||||
dto.setDeleted(true);
|
dto.setDeleted(true);
|
||||||
}
|
}
|
||||||
return dto;
|
return dto;
|
||||||
|
|
Loading…
Reference in New Issue