缺陷管理BUG修复

This commit is contained in:
liangdaliang
2025-04-23 14:52:05 +08:00
parent 56ffeb2f05
commit 5ae19a8847
5 changed files with 114 additions and 4 deletions

View File

@@ -0,0 +1,50 @@
package com.test.common.enums;
/**
* @author liangdaliang
* @Description缺陷状态枚举
* @date 2025-04-23 13:59
*/
public enum EnumDefectStatus {
PENDING_CONFIRMATION("0", "待确认"),
UNDER_REPAIR("1", "修复中"),
COMPLETED("2", "已完成"),
INVALID_DEFECT("3", "无效缺陷"),
SUSPENDED("4", "挂起"),
PENDING_VERIFICATION("5", "待验证");
private final String code;
private final String description;
EnumDefectStatus(String code, String description) {
this.code = code;
this.description = description;
}
public String getCode() {
return code;
}
public String getDescription() {
return description;
}
/**
* 根据状态码获取对应的枚举值
*/
public static EnumDefectStatus fromCode(String code) {
for (EnumDefectStatus status : values()) {
if (status.code.equals(code)) {
return status;
}
}
throw new IllegalArgumentException("无效的状态码: " + code);
}
/**
* 根据状态码获取中文描述(可选)
*/
public static String getDescriptionByCode(String code) {
return fromCode(code).getDescription();
}
}

View File

@@ -0,0 +1,49 @@
package com.test.common.enums;
/**
* @author liangdaliang
* @Description缺陷严重程度枚举
* @date 2025-04-23 14:06
*/
public enum EnumSeverityLevel {
INVALID("0", "无效"),
MINOR("1", "轻微"),
MODERATE("2", "一般"),
SEVERE("3", "严重"),
CRITICAL("4", "致命");
private final String code;
private final String description;
EnumSeverityLevel(String code, String description) {
this.code = code;
this.description = description;
}
public String getCode() {
return code;
}
public String getDescription() {
return description;
}
/**
* 根据严重程度码获取枚举实例
*/
public static EnumSeverityLevel fromCode(String code) {
for (EnumSeverityLevel level : values()) {
if (level.code.equals(code)) {
return level;
}
}
throw new IllegalArgumentException("无效的严重程度码: " + code);
}
/**
* 根据状态码直接获取中文描述
*/
public static String getDescriptionByCode(String code) {
return fromCode(code).getDescription();
}
}

View File

@@ -5,6 +5,8 @@ import com.test.common.core.controller.BaseController;
import com.test.common.core.domain.AjaxResult;
import com.test.common.core.page.TableDataInfo;
import com.test.common.enums.BusinessType;
import com.test.common.enums.EnumDefectStatus;
import com.test.common.enums.EnumSeverityLevel;
import com.test.common.utils.poi.ExcelUtil;
import com.test.test.domain.TestDefect;
import com.test.test.domain.qo.IDQO;
@@ -49,6 +51,10 @@ public class TestDefectController extends BaseController
public void export(HttpServletResponse response,
@RequestBody TestDefectListQO qo) {
List<TestDefect> list = testDefectService.selectTestDefectList(qo);
for (TestDefect testDefect : list) {
testDefect.setStatus(EnumDefectStatus.getDescriptionByCode(testDefect.getStatus()));
testDefect.setLevel(EnumSeverityLevel.getDescriptionByCode(testDefect.getLevel()));
}
ExcelUtil<TestDefect> util = new ExcelUtil<TestDefect>(TestDefect.class);
util.exportExcel(response, list, "缺陷数据");
}
@@ -61,6 +67,10 @@ public class TestDefectController extends BaseController
public void batchExport(HttpServletResponse response,
@RequestBody List<TestDefect> list) {
ExcelUtil<TestDefect> util = new ExcelUtil<TestDefect>(TestDefect.class);
for (TestDefect testDefect : list) {
testDefect.setStatus(EnumDefectStatus.getDescriptionByCode(testDefect.getStatus()));
testDefect.setLevel(EnumSeverityLevel.getDescriptionByCode(testDefect.getLevel()));
}
util.exportExcel(response, list, "缺陷数据");
}

View File

@@ -19,7 +19,7 @@ public class TestDefect extends BaseEntity
private Long id;
/** 测试缺陷编码 */
@Excel(name = "缺陷编码")
@Excel(name = "缺陷ID")
private String serialNumber;
/** 测试缺陷名称 */

View File

@@ -68,13 +68,13 @@
<el-table-column prop="outline" label="概要" align="center"/>
<el-table-column prop="status" label="状态" align="center">
<template #default="{ row }">
<dict-tag :options="dict.type.status" :value="row.status"/>
<dict-tag :options="dict.type.bug_status" :value="row.status"/>
</template>
</el-table-column>
<el-table-column prop="manager" label="经办人" align="center"/>
<el-table-column prop="level" label="严重程度" align="center">
<template slot-scope="scope">
<el-tag :type="severityColor[scope.row.level]">{{ scope.row.level }}</el-tag>
<template #default="{ row }">
<dict-tag :options="dict.type.severity_level" :value="row.level"/>
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" align="center"/>
@@ -390,6 +390,7 @@ export default {
this.activeNames = val ? ['1'] : [];
},
handleAdvancedSearch() {
this.handleQuery();
// 高级筛选条件搜索
this.queryParams.pageNum = 1
this.getList()