From e36a8d9e7d662f42c2f78bf787d49ecebf006dc8 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Sat, 20 Nov 2021 18:24:01 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=A1=B9=E7=9B=AE=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=EF=BC=88X-Pack=EF=BC=89):=20#1003678=20=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=8A=A5=E5=91=8A=E5=8A=9F=E8=83=BD=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --story=1003678 --user=宋天阳 项目报告(X-Pack) https://www.tapd.cn/55049933/s/1071047 --- .../api/service/ApiAutomationService.java | 28 +- .../api/service/MockConfigService.java | 2 + .../base/domain/EnterpriseTestReport.java | 31 + .../domain/EnterpriseTestReportExample.java | 940 ++++++++++++++++++ .../EnterpriseTestReportSendRecord.java | 19 + ...EnterpriseTestReportSendRecordExample.java | 540 ++++++++++ ...terpriseTestReportSendRecordWithBLOBs.java | 19 + .../domain/EnterpriseTestReportWithBLOBs.java | 19 + .../mapper/EnterpriseTestReportMapper.java | 37 + .../mapper/EnterpriseTestReportMapper.xml | 407 ++++++++ .../EnterpriseTestReportSendRecordMapper.java | 37 + .../EnterpriseTestReportSendRecordMapper.xml | 300 ++++++ .../base/mapper/ext/ExtUserGroupMapper.java | 3 + .../base/mapper/ext/ExtUserGroupMapper.xml | 6 + .../io/metersphere/dto/UserGroupInfoDTO.java | 14 + .../notice/sender/impl/MailNoticeSender.java | 35 +- .../controller/HistoryReportController.java | 3 +- .../dto/TestCaseCountResponse.java | 3 + .../dto/table/TestCaseCountTableDataDTO.java | 13 + .../table/TestCaseCountTableItemDataDTO.java | 11 + .../dto/table/TestCaseCountTableRowDTO.java | 12 + .../service/ReportStatisticsService.java | 119 ++- .../service/TestCaseCountService.java | 86 ++ backend/src/main/java/io/metersphere/xpack | 2 +- .../db/migration/V99__v1.15_release.sql | 32 + .../src/main/resources/generatorConfig.xml | 3 +- .../mail/enterprise/enterprise-report.html | 10 + backend/src/main/resources/permission.json | 34 + .../api/automation/scenario/MsInputTag.vue | 9 +- .../reportstatistics/ReportStatistics.vue | 31 + .../header/ReportStatisticsHeaderMenus.vue | 76 ++ .../ProjectStatistics.vue} | 9 +- .../{ => projectstatistics}/ReportCard.vue | 12 +- .../casecount/TestCaseCountContainer.vue | 4 +- .../casecount/chart/TestCaseCountChart.vue | 28 +- .../casecount/filter/TestCaseCountFilter.vue | 12 - .../casecount/table/TestCaseCountTable.vue | 9 + .../track/TestAnalysisContainer.vue | 2 +- .../track/chart/TestAnalysisChart.vue | 0 .../track/filter/TestAnalysisFilter.vue | 0 .../track/table/TestAnalysisTable.vue | 0 .../components/reportstatistics/router.js | 16 +- frontend/src/business/components/xpack | 2 +- frontend/src/i18n/en-US.js | 17 + frontend/src/i18n/zh-CN.js | 17 + frontend/src/i18n/zh-TW.js | 17 + 46 files changed, 2971 insertions(+), 55 deletions(-) create mode 100644 backend/src/main/java/io/metersphere/base/domain/EnterpriseTestReport.java create mode 100644 backend/src/main/java/io/metersphere/base/domain/EnterpriseTestReportExample.java create mode 100644 backend/src/main/java/io/metersphere/base/domain/EnterpriseTestReportSendRecord.java create mode 100644 backend/src/main/java/io/metersphere/base/domain/EnterpriseTestReportSendRecordExample.java create mode 100644 backend/src/main/java/io/metersphere/base/domain/EnterpriseTestReportSendRecordWithBLOBs.java create mode 100644 backend/src/main/java/io/metersphere/base/domain/EnterpriseTestReportWithBLOBs.java create mode 100644 backend/src/main/java/io/metersphere/base/mapper/EnterpriseTestReportMapper.java create mode 100644 backend/src/main/java/io/metersphere/base/mapper/EnterpriseTestReportMapper.xml create mode 100644 backend/src/main/java/io/metersphere/base/mapper/EnterpriseTestReportSendRecordMapper.java create mode 100644 backend/src/main/java/io/metersphere/base/mapper/EnterpriseTestReportSendRecordMapper.xml create mode 100644 backend/src/main/java/io/metersphere/dto/UserGroupInfoDTO.java create mode 100644 backend/src/main/java/io/metersphere/reportstatistics/dto/table/TestCaseCountTableDataDTO.java create mode 100644 backend/src/main/java/io/metersphere/reportstatistics/dto/table/TestCaseCountTableItemDataDTO.java create mode 100644 backend/src/main/java/io/metersphere/reportstatistics/dto/table/TestCaseCountTableRowDTO.java create mode 100644 backend/src/main/resources/mail/enterprise/enterprise-report.html create mode 100644 frontend/src/business/components/reportstatistics/ReportStatistics.vue create mode 100644 frontend/src/business/components/reportstatistics/header/ReportStatisticsHeaderMenus.vue rename frontend/src/business/components/reportstatistics/{ReportAnalysis.vue => projectstatistics/ProjectStatistics.vue} (91%) rename frontend/src/business/components/reportstatistics/{ => projectstatistics}/ReportCard.vue (90%) rename frontend/src/business/components/reportstatistics/{ => projectstatistics}/casecount/TestCaseCountContainer.vue (98%) rename frontend/src/business/components/reportstatistics/{ => projectstatistics}/casecount/chart/TestCaseCountChart.vue (90%) rename frontend/src/business/components/reportstatistics/{ => projectstatistics}/casecount/filter/TestCaseCountFilter.vue (97%) rename frontend/src/business/components/reportstatistics/{ => projectstatistics}/casecount/table/TestCaseCountTable.vue (93%) rename frontend/src/business/components/reportstatistics/{ => projectstatistics}/track/TestAnalysisContainer.vue (98%) rename frontend/src/business/components/reportstatistics/{ => projectstatistics}/track/chart/TestAnalysisChart.vue (100%) rename frontend/src/business/components/reportstatistics/{ => projectstatistics}/track/filter/TestAnalysisFilter.vue (100%) rename frontend/src/business/components/reportstatistics/{ => projectstatistics}/track/table/TestAnalysisTable.vue (100%) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index 1922f7b72f..9bdaac920d 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -1073,12 +1073,28 @@ public class ApiAutomationService { for (ApiScenarioWithBLOBs apiScenarioWithBLOBs : apiScenarios) { try { TestPlanApiScenario testPlanApiScenario = null; - if (request.getScenarioTestPlanIdMap() != null && request.getScenarioTestPlanIdMap().containsKey(apiScenarioWithBLOBs.getId())) { - testPlanApiScenario = testPlanApiScenarioMapper.selectByPrimaryKey(request.getScenarioTestPlanIdMap().get(apiScenarioWithBLOBs.getId())); - } - boolean haveEnv = checkScenarioEnv(apiScenarioWithBLOBs, testPlanApiScenario); - if (!haveEnv) { - builder.append(apiScenarioWithBLOBs.getName()).append("; "); + if(MapUtils.isNotEmpty(request.getScenarioTestPlanIdMap())){ + List testPlanScenarioIds = new ArrayList<>(); + for (Map.Entry entry: request.getScenarioTestPlanIdMap().entrySet()){ + String testPlanScenarioId = entry.getKey(); + String scenarioId = entry.getValue(); + if(StringUtils.equalsIgnoreCase(scenarioId,apiScenarioWithBLOBs.getId())){ + testPlanScenarioIds.add(testPlanScenarioId); + } + } + + for (String testPlanScenarioId : testPlanScenarioIds) { + testPlanApiScenario = testPlanApiScenarioMapper.selectByPrimaryKey(request.getScenarioTestPlanIdMap().get(testPlanScenarioId)); + boolean haveEnv = checkScenarioEnv(apiScenarioWithBLOBs, testPlanApiScenario); + if (!haveEnv) { + builder.append(apiScenarioWithBLOBs.getName()).append("; "); + } + } + }else { + boolean haveEnv = checkScenarioEnv(apiScenarioWithBLOBs, testPlanApiScenario); + if (!haveEnv) { + builder.append(apiScenarioWithBLOBs.getName()).append("; "); + } } } catch (Exception e) { MSException.throwException("场景:" + builder.toString() + "运行环境未配置,请检查!"); diff --git a/backend/src/main/java/io/metersphere/api/service/MockConfigService.java b/backend/src/main/java/io/metersphere/api/service/MockConfigService.java index aac3cea52e..10d39a1def 100644 --- a/backend/src/main/java/io/metersphere/api/service/MockConfigService.java +++ b/backend/src/main/java/io/metersphere/api/service/MockConfigService.java @@ -1197,6 +1197,7 @@ public class MockConfigService { if (!isMatch) { response.setStatus(404); + returnStr = "未找到匹配的Mock期望!"; } return returnStr; } @@ -1238,6 +1239,7 @@ public class MockConfigService { if (!isMatch) { response.setStatus(404); + returnStr = "未找到匹配的Mock期望!"; } return returnStr; } diff --git a/backend/src/main/java/io/metersphere/base/domain/EnterpriseTestReport.java b/backend/src/main/java/io/metersphere/base/domain/EnterpriseTestReport.java new file mode 100644 index 0000000000..d92b60b360 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/EnterpriseTestReport.java @@ -0,0 +1,31 @@ +package io.metersphere.base.domain; + +import java.io.Serializable; +import lombok.Data; + +@Data +public class EnterpriseTestReport implements Serializable { + private String id; + + private String projectId; + + private Long createTime; + + private Long updateTime; + + private String createUser; + + private String updateUser; + + private String name; + + private String status; + + private String sendFreq; + + private String sendCron; + + private Long lastSendTime; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/EnterpriseTestReportExample.java b/backend/src/main/java/io/metersphere/base/domain/EnterpriseTestReportExample.java new file mode 100644 index 0000000000..a631ea2d8c --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/EnterpriseTestReportExample.java @@ -0,0 +1,940 @@ +package io.metersphere.base.domain; + +import java.util.ArrayList; +import java.util.List; + +public class EnterpriseTestReportExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public EnterpriseTestReportExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(String value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(String value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(String value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(String value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(String value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(String value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLike(String value) { + addCriterion("id like", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotLike(String value) { + addCriterion("id not like", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(String value1, String value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(String value1, String value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andProjectIdIsNull() { + addCriterion("project_id is null"); + return (Criteria) this; + } + + public Criteria andProjectIdIsNotNull() { + addCriterion("project_id is not null"); + return (Criteria) this; + } + + public Criteria andProjectIdEqualTo(String value) { + addCriterion("project_id =", value, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdNotEqualTo(String value) { + addCriterion("project_id <>", value, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdGreaterThan(String value) { + addCriterion("project_id >", value, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdGreaterThanOrEqualTo(String value) { + addCriterion("project_id >=", value, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdLessThan(String value) { + addCriterion("project_id <", value, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdLessThanOrEqualTo(String value) { + addCriterion("project_id <=", value, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdLike(String value) { + addCriterion("project_id like", value, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdNotLike(String value) { + addCriterion("project_id not like", value, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdIn(List values) { + addCriterion("project_id in", values, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdNotIn(List values) { + addCriterion("project_id not in", values, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdBetween(String value1, String value2) { + addCriterion("project_id between", value1, value2, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdNotBetween(String value1, String value2) { + addCriterion("project_id not between", value1, value2, "projectId"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Long value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Long value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Long value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Long value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Long value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Long value1, Long value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Long value1, Long value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Long value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Long value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Long value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Long value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Long value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Long value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Long value1, Long value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Long value1, Long value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andCreateUserIsNull() { + addCriterion("create_user is null"); + return (Criteria) this; + } + + public Criteria andCreateUserIsNotNull() { + addCriterion("create_user is not null"); + return (Criteria) this; + } + + public Criteria andCreateUserEqualTo(String value) { + addCriterion("create_user =", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserNotEqualTo(String value) { + addCriterion("create_user <>", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserGreaterThan(String value) { + addCriterion("create_user >", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserGreaterThanOrEqualTo(String value) { + addCriterion("create_user >=", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserLessThan(String value) { + addCriterion("create_user <", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserLessThanOrEqualTo(String value) { + addCriterion("create_user <=", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserLike(String value) { + addCriterion("create_user like", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserNotLike(String value) { + addCriterion("create_user not like", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserIn(List values) { + addCriterion("create_user in", values, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserNotIn(List values) { + addCriterion("create_user not in", values, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserBetween(String value1, String value2) { + addCriterion("create_user between", value1, value2, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserNotBetween(String value1, String value2) { + addCriterion("create_user not between", value1, value2, "createUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserIsNull() { + addCriterion("update_user is null"); + return (Criteria) this; + } + + public Criteria andUpdateUserIsNotNull() { + addCriterion("update_user is not null"); + return (Criteria) this; + } + + public Criteria andUpdateUserEqualTo(String value) { + addCriterion("update_user =", value, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserNotEqualTo(String value) { + addCriterion("update_user <>", value, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserGreaterThan(String value) { + addCriterion("update_user >", value, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserGreaterThanOrEqualTo(String value) { + addCriterion("update_user >=", value, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserLessThan(String value) { + addCriterion("update_user <", value, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserLessThanOrEqualTo(String value) { + addCriterion("update_user <=", value, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserLike(String value) { + addCriterion("update_user like", value, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserNotLike(String value) { + addCriterion("update_user not like", value, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserIn(List values) { + addCriterion("update_user in", values, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserNotIn(List values) { + addCriterion("update_user not in", values, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserBetween(String value1, String value2) { + addCriterion("update_user between", value1, value2, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserNotBetween(String value1, String value2) { + addCriterion("update_user not between", value1, value2, "updateUser"); + return (Criteria) this; + } + + public Criteria andNameIsNull() { + addCriterion("`name` is null"); + return (Criteria) this; + } + + public Criteria andNameIsNotNull() { + addCriterion("`name` is not null"); + return (Criteria) this; + } + + public Criteria andNameEqualTo(String value) { + addCriterion("`name` =", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotEqualTo(String value) { + addCriterion("`name` <>", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThan(String value) { + addCriterion("`name` >", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThanOrEqualTo(String value) { + addCriterion("`name` >=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThan(String value) { + addCriterion("`name` <", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThanOrEqualTo(String value) { + addCriterion("`name` <=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLike(String value) { + addCriterion("`name` like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotLike(String value) { + addCriterion("`name` not like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameIn(List values) { + addCriterion("`name` in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameNotIn(List values) { + addCriterion("`name` not in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameBetween(String value1, String value2) { + addCriterion("`name` between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andNameNotBetween(String value1, String value2) { + addCriterion("`name` not between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andStatusIsNull() { + addCriterion("`status` is null"); + return (Criteria) this; + } + + public Criteria andStatusIsNotNull() { + addCriterion("`status` is not null"); + return (Criteria) this; + } + + public Criteria andStatusEqualTo(String value) { + addCriterion("`status` =", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotEqualTo(String value) { + addCriterion("`status` <>", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusGreaterThan(String value) { + addCriterion("`status` >", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusGreaterThanOrEqualTo(String value) { + addCriterion("`status` >=", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLessThan(String value) { + addCriterion("`status` <", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLessThanOrEqualTo(String value) { + addCriterion("`status` <=", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLike(String value) { + addCriterion("`status` like", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotLike(String value) { + addCriterion("`status` not like", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusIn(List values) { + addCriterion("`status` in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotIn(List values) { + addCriterion("`status` not in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusBetween(String value1, String value2) { + addCriterion("`status` between", value1, value2, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotBetween(String value1, String value2) { + addCriterion("`status` not between", value1, value2, "status"); + return (Criteria) this; + } + + public Criteria andSendFreqIsNull() { + addCriterion("send_freq is null"); + return (Criteria) this; + } + + public Criteria andSendFreqIsNotNull() { + addCriterion("send_freq is not null"); + return (Criteria) this; + } + + public Criteria andSendFreqEqualTo(String value) { + addCriterion("send_freq =", value, "sendFreq"); + return (Criteria) this; + } + + public Criteria andSendFreqNotEqualTo(String value) { + addCriterion("send_freq <>", value, "sendFreq"); + return (Criteria) this; + } + + public Criteria andSendFreqGreaterThan(String value) { + addCriterion("send_freq >", value, "sendFreq"); + return (Criteria) this; + } + + public Criteria andSendFreqGreaterThanOrEqualTo(String value) { + addCriterion("send_freq >=", value, "sendFreq"); + return (Criteria) this; + } + + public Criteria andSendFreqLessThan(String value) { + addCriterion("send_freq <", value, "sendFreq"); + return (Criteria) this; + } + + public Criteria andSendFreqLessThanOrEqualTo(String value) { + addCriterion("send_freq <=", value, "sendFreq"); + return (Criteria) this; + } + + public Criteria andSendFreqLike(String value) { + addCriterion("send_freq like", value, "sendFreq"); + return (Criteria) this; + } + + public Criteria andSendFreqNotLike(String value) { + addCriterion("send_freq not like", value, "sendFreq"); + return (Criteria) this; + } + + public Criteria andSendFreqIn(List values) { + addCriterion("send_freq in", values, "sendFreq"); + return (Criteria) this; + } + + public Criteria andSendFreqNotIn(List values) { + addCriterion("send_freq not in", values, "sendFreq"); + return (Criteria) this; + } + + public Criteria andSendFreqBetween(String value1, String value2) { + addCriterion("send_freq between", value1, value2, "sendFreq"); + return (Criteria) this; + } + + public Criteria andSendFreqNotBetween(String value1, String value2) { + addCriterion("send_freq not between", value1, value2, "sendFreq"); + return (Criteria) this; + } + + public Criteria andSendCronIsNull() { + addCriterion("send_cron is null"); + return (Criteria) this; + } + + public Criteria andSendCronIsNotNull() { + addCriterion("send_cron is not null"); + return (Criteria) this; + } + + public Criteria andSendCronEqualTo(String value) { + addCriterion("send_cron =", value, "sendCron"); + return (Criteria) this; + } + + public Criteria andSendCronNotEqualTo(String value) { + addCriterion("send_cron <>", value, "sendCron"); + return (Criteria) this; + } + + public Criteria andSendCronGreaterThan(String value) { + addCriterion("send_cron >", value, "sendCron"); + return (Criteria) this; + } + + public Criteria andSendCronGreaterThanOrEqualTo(String value) { + addCriterion("send_cron >=", value, "sendCron"); + return (Criteria) this; + } + + public Criteria andSendCronLessThan(String value) { + addCriterion("send_cron <", value, "sendCron"); + return (Criteria) this; + } + + public Criteria andSendCronLessThanOrEqualTo(String value) { + addCriterion("send_cron <=", value, "sendCron"); + return (Criteria) this; + } + + public Criteria andSendCronLike(String value) { + addCriterion("send_cron like", value, "sendCron"); + return (Criteria) this; + } + + public Criteria andSendCronNotLike(String value) { + addCriterion("send_cron not like", value, "sendCron"); + return (Criteria) this; + } + + public Criteria andSendCronIn(List values) { + addCriterion("send_cron in", values, "sendCron"); + return (Criteria) this; + } + + public Criteria andSendCronNotIn(List values) { + addCriterion("send_cron not in", values, "sendCron"); + return (Criteria) this; + } + + public Criteria andSendCronBetween(String value1, String value2) { + addCriterion("send_cron between", value1, value2, "sendCron"); + return (Criteria) this; + } + + public Criteria andSendCronNotBetween(String value1, String value2) { + addCriterion("send_cron not between", value1, value2, "sendCron"); + return (Criteria) this; + } + + public Criteria andLastSendTimeIsNull() { + addCriterion("last_send_time is null"); + return (Criteria) this; + } + + public Criteria andLastSendTimeIsNotNull() { + addCriterion("last_send_time is not null"); + return (Criteria) this; + } + + public Criteria andLastSendTimeEqualTo(Long value) { + addCriterion("last_send_time =", value, "lastSendTime"); + return (Criteria) this; + } + + public Criteria andLastSendTimeNotEqualTo(Long value) { + addCriterion("last_send_time <>", value, "lastSendTime"); + return (Criteria) this; + } + + public Criteria andLastSendTimeGreaterThan(Long value) { + addCriterion("last_send_time >", value, "lastSendTime"); + return (Criteria) this; + } + + public Criteria andLastSendTimeGreaterThanOrEqualTo(Long value) { + addCriterion("last_send_time >=", value, "lastSendTime"); + return (Criteria) this; + } + + public Criteria andLastSendTimeLessThan(Long value) { + addCriterion("last_send_time <", value, "lastSendTime"); + return (Criteria) this; + } + + public Criteria andLastSendTimeLessThanOrEqualTo(Long value) { + addCriterion("last_send_time <=", value, "lastSendTime"); + return (Criteria) this; + } + + public Criteria andLastSendTimeIn(List values) { + addCriterion("last_send_time in", values, "lastSendTime"); + return (Criteria) this; + } + + public Criteria andLastSendTimeNotIn(List values) { + addCriterion("last_send_time not in", values, "lastSendTime"); + return (Criteria) this; + } + + public Criteria andLastSendTimeBetween(Long value1, Long value2) { + addCriterion("last_send_time between", value1, value2, "lastSendTime"); + return (Criteria) this; + } + + public Criteria andLastSendTimeNotBetween(Long value1, Long value2) { + addCriterion("last_send_time not between", value1, value2, "lastSendTime"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/EnterpriseTestReportSendRecord.java b/backend/src/main/java/io/metersphere/base/domain/EnterpriseTestReportSendRecord.java new file mode 100644 index 0000000000..a4c80a1964 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/EnterpriseTestReportSendRecord.java @@ -0,0 +1,19 @@ +package io.metersphere.base.domain; + +import java.io.Serializable; +import lombok.Data; + +@Data +public class EnterpriseTestReportSendRecord implements Serializable { + private String id; + + private String enterpriseTestReportId; + + private Long createTime; + + private String createUser; + + private String status; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/EnterpriseTestReportSendRecordExample.java b/backend/src/main/java/io/metersphere/base/domain/EnterpriseTestReportSendRecordExample.java new file mode 100644 index 0000000000..7dc7f69334 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/EnterpriseTestReportSendRecordExample.java @@ -0,0 +1,540 @@ +package io.metersphere.base.domain; + +import java.util.ArrayList; +import java.util.List; + +public class EnterpriseTestReportSendRecordExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public EnterpriseTestReportSendRecordExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(String value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(String value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(String value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(String value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(String value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(String value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLike(String value) { + addCriterion("id like", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotLike(String value) { + addCriterion("id not like", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(String value1, String value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(String value1, String value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andEnterpriseTestReportIdIsNull() { + addCriterion("enterprise_test_report_id is null"); + return (Criteria) this; + } + + public Criteria andEnterpriseTestReportIdIsNotNull() { + addCriterion("enterprise_test_report_id is not null"); + return (Criteria) this; + } + + public Criteria andEnterpriseTestReportIdEqualTo(String value) { + addCriterion("enterprise_test_report_id =", value, "enterpriseTestReportId"); + return (Criteria) this; + } + + public Criteria andEnterpriseTestReportIdNotEqualTo(String value) { + addCriterion("enterprise_test_report_id <>", value, "enterpriseTestReportId"); + return (Criteria) this; + } + + public Criteria andEnterpriseTestReportIdGreaterThan(String value) { + addCriterion("enterprise_test_report_id >", value, "enterpriseTestReportId"); + return (Criteria) this; + } + + public Criteria andEnterpriseTestReportIdGreaterThanOrEqualTo(String value) { + addCriterion("enterprise_test_report_id >=", value, "enterpriseTestReportId"); + return (Criteria) this; + } + + public Criteria andEnterpriseTestReportIdLessThan(String value) { + addCriterion("enterprise_test_report_id <", value, "enterpriseTestReportId"); + return (Criteria) this; + } + + public Criteria andEnterpriseTestReportIdLessThanOrEqualTo(String value) { + addCriterion("enterprise_test_report_id <=", value, "enterpriseTestReportId"); + return (Criteria) this; + } + + public Criteria andEnterpriseTestReportIdLike(String value) { + addCriterion("enterprise_test_report_id like", value, "enterpriseTestReportId"); + return (Criteria) this; + } + + public Criteria andEnterpriseTestReportIdNotLike(String value) { + addCriterion("enterprise_test_report_id not like", value, "enterpriseTestReportId"); + return (Criteria) this; + } + + public Criteria andEnterpriseTestReportIdIn(List values) { + addCriterion("enterprise_test_report_id in", values, "enterpriseTestReportId"); + return (Criteria) this; + } + + public Criteria andEnterpriseTestReportIdNotIn(List values) { + addCriterion("enterprise_test_report_id not in", values, "enterpriseTestReportId"); + return (Criteria) this; + } + + public Criteria andEnterpriseTestReportIdBetween(String value1, String value2) { + addCriterion("enterprise_test_report_id between", value1, value2, "enterpriseTestReportId"); + return (Criteria) this; + } + + public Criteria andEnterpriseTestReportIdNotBetween(String value1, String value2) { + addCriterion("enterprise_test_report_id not between", value1, value2, "enterpriseTestReportId"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Long value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Long value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Long value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Long value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Long value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Long value1, Long value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Long value1, Long value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateUserIsNull() { + addCriterion("create_user is null"); + return (Criteria) this; + } + + public Criteria andCreateUserIsNotNull() { + addCriterion("create_user is not null"); + return (Criteria) this; + } + + public Criteria andCreateUserEqualTo(String value) { + addCriterion("create_user =", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserNotEqualTo(String value) { + addCriterion("create_user <>", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserGreaterThan(String value) { + addCriterion("create_user >", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserGreaterThanOrEqualTo(String value) { + addCriterion("create_user >=", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserLessThan(String value) { + addCriterion("create_user <", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserLessThanOrEqualTo(String value) { + addCriterion("create_user <=", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserLike(String value) { + addCriterion("create_user like", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserNotLike(String value) { + addCriterion("create_user not like", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserIn(List values) { + addCriterion("create_user in", values, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserNotIn(List values) { + addCriterion("create_user not in", values, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserBetween(String value1, String value2) { + addCriterion("create_user between", value1, value2, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserNotBetween(String value1, String value2) { + addCriterion("create_user not between", value1, value2, "createUser"); + return (Criteria) this; + } + + public Criteria andStatusIsNull() { + addCriterion("`status` is null"); + return (Criteria) this; + } + + public Criteria andStatusIsNotNull() { + addCriterion("`status` is not null"); + return (Criteria) this; + } + + public Criteria andStatusEqualTo(String value) { + addCriterion("`status` =", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotEqualTo(String value) { + addCriterion("`status` <>", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusGreaterThan(String value) { + addCriterion("`status` >", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusGreaterThanOrEqualTo(String value) { + addCriterion("`status` >=", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLessThan(String value) { + addCriterion("`status` <", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLessThanOrEqualTo(String value) { + addCriterion("`status` <=", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLike(String value) { + addCriterion("`status` like", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotLike(String value) { + addCriterion("`status` not like", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusIn(List values) { + addCriterion("`status` in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotIn(List values) { + addCriterion("`status` not in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusBetween(String value1, String value2) { + addCriterion("`status` between", value1, value2, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotBetween(String value1, String value2) { + addCriterion("`status` not between", value1, value2, "status"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/EnterpriseTestReportSendRecordWithBLOBs.java b/backend/src/main/java/io/metersphere/base/domain/EnterpriseTestReportSendRecordWithBLOBs.java new file mode 100644 index 0000000000..b178c4c092 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/EnterpriseTestReportSendRecordWithBLOBs.java @@ -0,0 +1,19 @@ +package io.metersphere.base.domain; + +import java.io.Serializable; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class EnterpriseTestReportSendRecordWithBLOBs extends EnterpriseTestReportSendRecord implements Serializable { + private String reportContent; + + private String addressee; + + private String duplicated; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/EnterpriseTestReportWithBLOBs.java b/backend/src/main/java/io/metersphere/base/domain/EnterpriseTestReportWithBLOBs.java new file mode 100644 index 0000000000..6568006b1c --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/EnterpriseTestReportWithBLOBs.java @@ -0,0 +1,19 @@ +package io.metersphere.base.domain; + +import java.io.Serializable; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class EnterpriseTestReportWithBLOBs extends EnterpriseTestReport implements Serializable { + private String reportContent; + + private String addressee; + + private String duplicated; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/EnterpriseTestReportMapper.java b/backend/src/main/java/io/metersphere/base/mapper/EnterpriseTestReportMapper.java new file mode 100644 index 0000000000..0dbaa81f33 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/EnterpriseTestReportMapper.java @@ -0,0 +1,37 @@ +package io.metersphere.base.mapper; + +import io.metersphere.base.domain.EnterpriseTestReport; +import io.metersphere.base.domain.EnterpriseTestReportExample; +import io.metersphere.base.domain.EnterpriseTestReportWithBLOBs; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface EnterpriseTestReportMapper { + long countByExample(EnterpriseTestReportExample example); + + int deleteByExample(EnterpriseTestReportExample example); + + int deleteByPrimaryKey(String id); + + int insert(EnterpriseTestReportWithBLOBs record); + + int insertSelective(EnterpriseTestReportWithBLOBs record); + + List selectByExampleWithBLOBs(EnterpriseTestReportExample example); + + List selectByExample(EnterpriseTestReportExample example); + + EnterpriseTestReportWithBLOBs selectByPrimaryKey(String id); + + int updateByExampleSelective(@Param("record") EnterpriseTestReportWithBLOBs record, @Param("example") EnterpriseTestReportExample example); + + int updateByExampleWithBLOBs(@Param("record") EnterpriseTestReportWithBLOBs record, @Param("example") EnterpriseTestReportExample example); + + int updateByExample(@Param("record") EnterpriseTestReport record, @Param("example") EnterpriseTestReportExample example); + + int updateByPrimaryKeySelective(EnterpriseTestReportWithBLOBs record); + + int updateByPrimaryKeyWithBLOBs(EnterpriseTestReportWithBLOBs record); + + int updateByPrimaryKey(EnterpriseTestReport record); +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/EnterpriseTestReportMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/EnterpriseTestReportMapper.xml new file mode 100644 index 0000000000..5312e03bd6 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/EnterpriseTestReportMapper.xml @@ -0,0 +1,407 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, project_id, create_time, update_time, create_user, update_user, `name`, `status`, + send_freq, send_cron, last_send_time + + + report_content, addressee, duplicated + + + + + + delete from enterprise_test_report + where id = #{id,jdbcType=VARCHAR} + + + delete from enterprise_test_report + + + + + + insert into enterprise_test_report (id, project_id, create_time, + update_time, create_user, update_user, + `name`, `status`, send_freq, + send_cron, last_send_time, report_content, + addressee, duplicated) + values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, + #{updateTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR}, #{updateUser,jdbcType=VARCHAR}, + #{name,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{sendFreq,jdbcType=VARCHAR}, + #{sendCron,jdbcType=VARCHAR}, #{lastSendTime,jdbcType=BIGINT}, #{reportContent,jdbcType=LONGVARCHAR}, + #{addressee,jdbcType=LONGVARCHAR}, #{duplicated,jdbcType=LONGVARCHAR}) + + + insert into enterprise_test_report + + + id, + + + project_id, + + + create_time, + + + update_time, + + + create_user, + + + update_user, + + + `name`, + + + `status`, + + + send_freq, + + + send_cron, + + + last_send_time, + + + report_content, + + + addressee, + + + duplicated, + + + + + #{id,jdbcType=VARCHAR}, + + + #{projectId,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=BIGINT}, + + + #{updateTime,jdbcType=BIGINT}, + + + #{createUser,jdbcType=VARCHAR}, + + + #{updateUser,jdbcType=VARCHAR}, + + + #{name,jdbcType=VARCHAR}, + + + #{status,jdbcType=VARCHAR}, + + + #{sendFreq,jdbcType=VARCHAR}, + + + #{sendCron,jdbcType=VARCHAR}, + + + #{lastSendTime,jdbcType=BIGINT}, + + + #{reportContent,jdbcType=LONGVARCHAR}, + + + #{addressee,jdbcType=LONGVARCHAR}, + + + #{duplicated,jdbcType=LONGVARCHAR}, + + + + + + update enterprise_test_report + + + id = #{record.id,jdbcType=VARCHAR}, + + + project_id = #{record.projectId,jdbcType=VARCHAR}, + + + create_time = #{record.createTime,jdbcType=BIGINT}, + + + update_time = #{record.updateTime,jdbcType=BIGINT}, + + + create_user = #{record.createUser,jdbcType=VARCHAR}, + + + update_user = #{record.updateUser,jdbcType=VARCHAR}, + + + `name` = #{record.name,jdbcType=VARCHAR}, + + + `status` = #{record.status,jdbcType=VARCHAR}, + + + send_freq = #{record.sendFreq,jdbcType=VARCHAR}, + + + send_cron = #{record.sendCron,jdbcType=VARCHAR}, + + + last_send_time = #{record.lastSendTime,jdbcType=BIGINT}, + + + report_content = #{record.reportContent,jdbcType=LONGVARCHAR}, + + + addressee = #{record.addressee,jdbcType=LONGVARCHAR}, + + + duplicated = #{record.duplicated,jdbcType=LONGVARCHAR}, + + + + + + + + update enterprise_test_report + set id = #{record.id,jdbcType=VARCHAR}, + project_id = #{record.projectId,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + update_time = #{record.updateTime,jdbcType=BIGINT}, + create_user = #{record.createUser,jdbcType=VARCHAR}, + update_user = #{record.updateUser,jdbcType=VARCHAR}, + `name` = #{record.name,jdbcType=VARCHAR}, + `status` = #{record.status,jdbcType=VARCHAR}, + send_freq = #{record.sendFreq,jdbcType=VARCHAR}, + send_cron = #{record.sendCron,jdbcType=VARCHAR}, + last_send_time = #{record.lastSendTime,jdbcType=BIGINT}, + report_content = #{record.reportContent,jdbcType=LONGVARCHAR}, + addressee = #{record.addressee,jdbcType=LONGVARCHAR}, + duplicated = #{record.duplicated,jdbcType=LONGVARCHAR} + + + + + + update enterprise_test_report + set id = #{record.id,jdbcType=VARCHAR}, + project_id = #{record.projectId,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + update_time = #{record.updateTime,jdbcType=BIGINT}, + create_user = #{record.createUser,jdbcType=VARCHAR}, + update_user = #{record.updateUser,jdbcType=VARCHAR}, + `name` = #{record.name,jdbcType=VARCHAR}, + `status` = #{record.status,jdbcType=VARCHAR}, + send_freq = #{record.sendFreq,jdbcType=VARCHAR}, + send_cron = #{record.sendCron,jdbcType=VARCHAR}, + last_send_time = #{record.lastSendTime,jdbcType=BIGINT} + + + + + + update enterprise_test_report + + + project_id = #{projectId,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=BIGINT}, + + + update_time = #{updateTime,jdbcType=BIGINT}, + + + create_user = #{createUser,jdbcType=VARCHAR}, + + + update_user = #{updateUser,jdbcType=VARCHAR}, + + + `name` = #{name,jdbcType=VARCHAR}, + + + `status` = #{status,jdbcType=VARCHAR}, + + + send_freq = #{sendFreq,jdbcType=VARCHAR}, + + + send_cron = #{sendCron,jdbcType=VARCHAR}, + + + last_send_time = #{lastSendTime,jdbcType=BIGINT}, + + + report_content = #{reportContent,jdbcType=LONGVARCHAR}, + + + addressee = #{addressee,jdbcType=LONGVARCHAR}, + + + duplicated = #{duplicated,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=VARCHAR} + + + update enterprise_test_report + set project_id = #{projectId,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + update_time = #{updateTime,jdbcType=BIGINT}, + create_user = #{createUser,jdbcType=VARCHAR}, + update_user = #{updateUser,jdbcType=VARCHAR}, + `name` = #{name,jdbcType=VARCHAR}, + `status` = #{status,jdbcType=VARCHAR}, + send_freq = #{sendFreq,jdbcType=VARCHAR}, + send_cron = #{sendCron,jdbcType=VARCHAR}, + last_send_time = #{lastSendTime,jdbcType=BIGINT}, + report_content = #{reportContent,jdbcType=LONGVARCHAR}, + addressee = #{addressee,jdbcType=LONGVARCHAR}, + duplicated = #{duplicated,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=VARCHAR} + + + update enterprise_test_report + set project_id = #{projectId,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + update_time = #{updateTime,jdbcType=BIGINT}, + create_user = #{createUser,jdbcType=VARCHAR}, + update_user = #{updateUser,jdbcType=VARCHAR}, + `name` = #{name,jdbcType=VARCHAR}, + `status` = #{status,jdbcType=VARCHAR}, + send_freq = #{sendFreq,jdbcType=VARCHAR}, + send_cron = #{sendCron,jdbcType=VARCHAR}, + last_send_time = #{lastSendTime,jdbcType=BIGINT} + where id = #{id,jdbcType=VARCHAR} + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/EnterpriseTestReportSendRecordMapper.java b/backend/src/main/java/io/metersphere/base/mapper/EnterpriseTestReportSendRecordMapper.java new file mode 100644 index 0000000000..19ef22bd17 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/EnterpriseTestReportSendRecordMapper.java @@ -0,0 +1,37 @@ +package io.metersphere.base.mapper; + +import io.metersphere.base.domain.EnterpriseTestReportSendRecord; +import io.metersphere.base.domain.EnterpriseTestReportSendRecordExample; +import io.metersphere.base.domain.EnterpriseTestReportSendRecordWithBLOBs; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface EnterpriseTestReportSendRecordMapper { + long countByExample(EnterpriseTestReportSendRecordExample example); + + int deleteByExample(EnterpriseTestReportSendRecordExample example); + + int deleteByPrimaryKey(String id); + + int insert(EnterpriseTestReportSendRecordWithBLOBs record); + + int insertSelective(EnterpriseTestReportSendRecordWithBLOBs record); + + List selectByExampleWithBLOBs(EnterpriseTestReportSendRecordExample example); + + List selectByExample(EnterpriseTestReportSendRecordExample example); + + EnterpriseTestReportSendRecordWithBLOBs selectByPrimaryKey(String id); + + int updateByExampleSelective(@Param("record") EnterpriseTestReportSendRecordWithBLOBs record, @Param("example") EnterpriseTestReportSendRecordExample example); + + int updateByExampleWithBLOBs(@Param("record") EnterpriseTestReportSendRecordWithBLOBs record, @Param("example") EnterpriseTestReportSendRecordExample example); + + int updateByExample(@Param("record") EnterpriseTestReportSendRecord record, @Param("example") EnterpriseTestReportSendRecordExample example); + + int updateByPrimaryKeySelective(EnterpriseTestReportSendRecordWithBLOBs record); + + int updateByPrimaryKeyWithBLOBs(EnterpriseTestReportSendRecordWithBLOBs record); + + int updateByPrimaryKey(EnterpriseTestReportSendRecord record); +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/EnterpriseTestReportSendRecordMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/EnterpriseTestReportSendRecordMapper.xml new file mode 100644 index 0000000000..b270ba6d17 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/EnterpriseTestReportSendRecordMapper.xml @@ -0,0 +1,300 @@ + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, enterprise_test_report_id, create_time, create_user, `status` + + + report_content, addressee, duplicated + + + + + + delete from enterprise_test_report_send_record + where id = #{id,jdbcType=VARCHAR} + + + delete from enterprise_test_report_send_record + + + + + + insert into enterprise_test_report_send_record (id, enterprise_test_report_id, create_time, + create_user, `status`, report_content, + addressee, duplicated) + values (#{id,jdbcType=VARCHAR}, #{enterpriseTestReportId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, + #{createUser,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{reportContent,jdbcType=LONGVARCHAR}, + #{addressee,jdbcType=LONGVARCHAR}, #{duplicated,jdbcType=LONGVARCHAR}) + + + insert into enterprise_test_report_send_record + + + id, + + + enterprise_test_report_id, + + + create_time, + + + create_user, + + + `status`, + + + report_content, + + + addressee, + + + duplicated, + + + + + #{id,jdbcType=VARCHAR}, + + + #{enterpriseTestReportId,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=BIGINT}, + + + #{createUser,jdbcType=VARCHAR}, + + + #{status,jdbcType=VARCHAR}, + + + #{reportContent,jdbcType=LONGVARCHAR}, + + + #{addressee,jdbcType=LONGVARCHAR}, + + + #{duplicated,jdbcType=LONGVARCHAR}, + + + + + + update enterprise_test_report_send_record + + + id = #{record.id,jdbcType=VARCHAR}, + + + enterprise_test_report_id = #{record.enterpriseTestReportId,jdbcType=VARCHAR}, + + + create_time = #{record.createTime,jdbcType=BIGINT}, + + + create_user = #{record.createUser,jdbcType=VARCHAR}, + + + `status` = #{record.status,jdbcType=VARCHAR}, + + + report_content = #{record.reportContent,jdbcType=LONGVARCHAR}, + + + addressee = #{record.addressee,jdbcType=LONGVARCHAR}, + + + duplicated = #{record.duplicated,jdbcType=LONGVARCHAR}, + + + + + + + + update enterprise_test_report_send_record + set id = #{record.id,jdbcType=VARCHAR}, + enterprise_test_report_id = #{record.enterpriseTestReportId,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + create_user = #{record.createUser,jdbcType=VARCHAR}, + `status` = #{record.status,jdbcType=VARCHAR}, + report_content = #{record.reportContent,jdbcType=LONGVARCHAR}, + addressee = #{record.addressee,jdbcType=LONGVARCHAR}, + duplicated = #{record.duplicated,jdbcType=LONGVARCHAR} + + + + + + update enterprise_test_report_send_record + set id = #{record.id,jdbcType=VARCHAR}, + enterprise_test_report_id = #{record.enterpriseTestReportId,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + create_user = #{record.createUser,jdbcType=VARCHAR}, + `status` = #{record.status,jdbcType=VARCHAR} + + + + + + update enterprise_test_report_send_record + + + enterprise_test_report_id = #{enterpriseTestReportId,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=BIGINT}, + + + create_user = #{createUser,jdbcType=VARCHAR}, + + + `status` = #{status,jdbcType=VARCHAR}, + + + report_content = #{reportContent,jdbcType=LONGVARCHAR}, + + + addressee = #{addressee,jdbcType=LONGVARCHAR}, + + + duplicated = #{duplicated,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=VARCHAR} + + + update enterprise_test_report_send_record + set enterprise_test_report_id = #{enterpriseTestReportId,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + create_user = #{createUser,jdbcType=VARCHAR}, + `status` = #{status,jdbcType=VARCHAR}, + report_content = #{reportContent,jdbcType=LONGVARCHAR}, + addressee = #{addressee,jdbcType=LONGVARCHAR}, + duplicated = #{duplicated,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=VARCHAR} + + + update enterprise_test_report_send_record + set enterprise_test_report_id = #{enterpriseTestReportId,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + create_user = #{createUser,jdbcType=VARCHAR}, + `status` = #{status,jdbcType=VARCHAR} + where id = #{id,jdbcType=VARCHAR} + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserGroupMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserGroupMapper.java index d05f5292c1..0accb20a9b 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserGroupMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserGroupMapper.java @@ -6,6 +6,7 @@ import io.metersphere.controller.request.group.EditGroupRequest; import io.metersphere.controller.request.member.QueryMemberRequest; import io.metersphere.dto.RelatedSource; import io.metersphere.dto.UserGroupDTO; +import io.metersphere.dto.UserGroupInfoDTO; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -27,4 +28,6 @@ public interface ExtUserGroupMapper { List getGroupUser(@Param("request")EditGroupRequest request); int checkSourceRole(@Param("sourceId") String sourceId, @Param("userId") String userId, @Param("groupId") String groupId); + + List getUserGroupInfo(); } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserGroupMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserGroupMapper.xml index a90eefad5f..42d52e0183 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserGroupMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserGroupMapper.xml @@ -71,4 +71,10 @@ AND ug.group_id = #{groupId} + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/dto/UserGroupInfoDTO.java b/backend/src/main/java/io/metersphere/dto/UserGroupInfoDTO.java new file mode 100644 index 0000000000..9f9e7d82a4 --- /dev/null +++ b/backend/src/main/java/io/metersphere/dto/UserGroupInfoDTO.java @@ -0,0 +1,14 @@ +package io.metersphere.dto; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class UserGroupInfoDTO { + private String userId; + private String userName; + private String userEmail; + private String groupId; + private String groupName; +} diff --git a/backend/src/main/java/io/metersphere/notice/sender/impl/MailNoticeSender.java b/backend/src/main/java/io/metersphere/notice/sender/impl/MailNoticeSender.java index 43b9bb8f1f..82fa231127 100644 --- a/backend/src/main/java/io/metersphere/notice/sender/impl/MailNoticeSender.java +++ b/backend/src/main/java/io/metersphere/notice/sender/impl/MailNoticeSender.java @@ -23,7 +23,7 @@ public class MailNoticeSender extends AbstractNoticeSender { @Resource private MailService mailService; - private void sendMail(String context, NoticeModel noticeModel) throws MessagingException { + public void sendMail(String context, NoticeModel noticeModel) throws MessagingException { LogUtil.debug("发送邮件开始 "); JavaMailSenderImpl javaMailSender = mailService.getMailSender(); MimeMessage mimeMessage = javaMailSender.createMimeMessage(); @@ -58,6 +58,39 @@ public class MailNoticeSender extends AbstractNoticeSender { javaMailSender.send(mimeMessage); } + public void sendExternalMail(String context, NoticeModel noticeModel) throws MessagingException { + LogUtil.debug("发送邮件开始 "); + JavaMailSenderImpl javaMailSender = mailService.getMailSender(); + MimeMessage mimeMessage = javaMailSender.createMimeMessage(); + MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true); + if (javaMailSender.getUsername().contains("@")) { + helper.setFrom(javaMailSender.getUsername()); + } else { + String mailHost = javaMailSender.getHost(); + String domainName = mailHost.substring(mailHost.indexOf(".") + 1, mailHost.length()); + helper.setFrom(javaMailSender.getUsername() + "@" + domainName); + } + LogUtil.debug("发件人地址" + javaMailSender.getUsername()); + LogUtil.debug("helper" + helper); + helper.setSubject(noticeModel.getSubject()); + List userIds = noticeModel.getReceivers().stream() + .map(Receiver::getUserId) + .distinct() + .collect(Collectors.toList()); + if (CollectionUtils.isEmpty(userIds)) { + return; + } + + String[] users = userIds.stream() + .distinct() + .toArray(String[]::new); + + LogUtil.info("收件人地址: {}", userIds); + helper.setText(context, true); + helper.setTo(users); + javaMailSender.send(mimeMessage); + } + @Override public void send(MessageDetail messageDetail, NoticeModel noticeModel) { String context = super.getHtmlContext(messageDetail, noticeModel); diff --git a/backend/src/main/java/io/metersphere/reportstatistics/controller/HistoryReportController.java b/backend/src/main/java/io/metersphere/reportstatistics/controller/HistoryReportController.java index ce62705bdb..97e93d6ce9 100644 --- a/backend/src/main/java/io/metersphere/reportstatistics/controller/HistoryReportController.java +++ b/backend/src/main/java/io/metersphere/reportstatistics/controller/HistoryReportController.java @@ -27,8 +27,7 @@ public class HistoryReportController { @PostMapping("/selectByParams") public List selectByParams(@RequestBody ReportStatisticsSaveRequest request) { - List returnList = reportStatisticsService.selectByProjectIdAndReportType(request.getProjectId(),request.getReportType()); - LogUtil.info("报表查询结果:"+JSONArray.toJSONString(returnList)); + List returnList = reportStatisticsService.selectByRequest(request); return returnList; } diff --git a/backend/src/main/java/io/metersphere/reportstatistics/dto/TestCaseCountResponse.java b/backend/src/main/java/io/metersphere/reportstatistics/dto/TestCaseCountResponse.java index 70bfeaccab..c78a0dd7b7 100644 --- a/backend/src/main/java/io/metersphere/reportstatistics/dto/TestCaseCountResponse.java +++ b/backend/src/main/java/io/metersphere/reportstatistics/dto/TestCaseCountResponse.java @@ -1,5 +1,6 @@ package io.metersphere.reportstatistics.dto; +import io.metersphere.reportstatistics.dto.table.TestCaseCountTableDataDTO; import lombok.Getter; import lombok.Setter; @@ -8,9 +9,11 @@ import java.util.List; @Getter @Setter public class TestCaseCountResponse { + private String chartType; private TestAnalysisChartDTO barChartDTO; private PieChartDTO pieChartDTO; private List tableDTOs; + private TestCaseCountTableDataDTO showTable; public TestCaseCountResponse() { diff --git a/backend/src/main/java/io/metersphere/reportstatistics/dto/table/TestCaseCountTableDataDTO.java b/backend/src/main/java/io/metersphere/reportstatistics/dto/table/TestCaseCountTableDataDTO.java new file mode 100644 index 0000000000..5e090c5bff --- /dev/null +++ b/backend/src/main/java/io/metersphere/reportstatistics/dto/table/TestCaseCountTableDataDTO.java @@ -0,0 +1,13 @@ +package io.metersphere.reportstatistics.dto.table; + +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +public class TestCaseCountTableDataDTO { + List heads; + List data; +} diff --git a/backend/src/main/java/io/metersphere/reportstatistics/dto/table/TestCaseCountTableItemDataDTO.java b/backend/src/main/java/io/metersphere/reportstatistics/dto/table/TestCaseCountTableItemDataDTO.java new file mode 100644 index 0000000000..b8a2d196df --- /dev/null +++ b/backend/src/main/java/io/metersphere/reportstatistics/dto/table/TestCaseCountTableItemDataDTO.java @@ -0,0 +1,11 @@ +package io.metersphere.reportstatistics.dto.table; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class TestCaseCountTableItemDataDTO { + private String id; + private String value; +} diff --git a/backend/src/main/java/io/metersphere/reportstatistics/dto/table/TestCaseCountTableRowDTO.java b/backend/src/main/java/io/metersphere/reportstatistics/dto/table/TestCaseCountTableRowDTO.java new file mode 100644 index 0000000000..7c4a083a70 --- /dev/null +++ b/backend/src/main/java/io/metersphere/reportstatistics/dto/table/TestCaseCountTableRowDTO.java @@ -0,0 +1,12 @@ +package io.metersphere.reportstatistics.dto.table; + +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +public class TestCaseCountTableRowDTO { + private List tableDatas; +} diff --git a/backend/src/main/java/io/metersphere/reportstatistics/service/ReportStatisticsService.java b/backend/src/main/java/io/metersphere/reportstatistics/service/ReportStatisticsService.java index 5a03e80ae9..174f5134a8 100644 --- a/backend/src/main/java/io/metersphere/reportstatistics/service/ReportStatisticsService.java +++ b/backend/src/main/java/io/metersphere/reportstatistics/service/ReportStatisticsService.java @@ -1,5 +1,7 @@ package io.metersphere.reportstatistics.service; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import io.metersphere.base.domain.ReportStatistics; import io.metersphere.base.domain.ReportStatisticsExample; import io.metersphere.base.domain.ReportStatisticsWithBLOBs; @@ -7,11 +9,16 @@ import io.metersphere.base.mapper.ReportStatisticsMapper; import io.metersphere.commons.utils.SessionUtils; import io.metersphere.reportstatistics.dto.ReportStatisticsSaveRequest; import io.metersphere.reportstatistics.dto.ReportStatisticsType; +import io.metersphere.reportstatistics.dto.TestCaseCountTableDTO; +import io.metersphere.reportstatistics.dto.table.TestCaseCountTableDataDTO; +import io.metersphere.reportstatistics.dto.table.TestCaseCountTableItemDataDTO; +import io.metersphere.reportstatistics.dto.table.TestCaseCountTableRowDTO; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.List; import java.util.UUID; @@ -58,15 +65,95 @@ public class ReportStatisticsService { return reportStatisticsMapper.deleteByPrimaryKey(id); } - public List selectByProjectIdAndReportType(String projectId, String reportType) { - ReportStatisticsExample example = new ReportStatisticsExample(); - example.createCriteria().andProjectIdEqualTo(projectId).andReportTypeEqualTo(reportType); - example.setOrderByClause("create_time DESC"); - return reportStatisticsMapper.selectByExample(example); - } - public ReportStatisticsWithBLOBs selectById(String id) { - return reportStatisticsMapper.selectByPrimaryKey(id); + ReportStatisticsWithBLOBs blob = reportStatisticsMapper.selectByPrimaryKey(id); + JSONObject dataOption = JSONObject.parseObject(blob.getDataOption()); + JSONObject selectOption = JSONObject.parseObject(blob.getSelectOption()); + if(!dataOption.containsKey("showTable")){ + List dtos = JSONArray.parseArray(dataOption.getString("tableData"),TestCaseCountTableDTO.class); + TestCaseCountTableDataDTO showTable = this.countShowTable(selectOption.getString("xaxis"), JSONArray.parseArray(selectOption.getString("yaxis"),String.class),dtos); + dataOption.put("showTable",showTable); + blob.setDataOption(dataOption.toString()); + } + return blob; + } + private TestCaseCountTableDataDTO countShowTable(String groupName, List yaxis, List dtos) { + TestCaseCountTableDataDTO returnDTO = new TestCaseCountTableDataDTO(); + String [] headers = new String[]{groupName,"总计","testCase","apiCase","scenarioCase","loadCaseCount"}; + + List heads = new ArrayList<>(); + boolean showTestCase = true; + boolean showApi = true; + boolean showScenario = true; + boolean showLoad = true; + for (String head : headers) { + if(StringUtils.equalsAnyIgnoreCase(head,groupName,"总计") || yaxis.contains(head)){ + TestCaseCountTableItemDataDTO headData = new TestCaseCountTableItemDataDTO(); + headData.setId(UUID.randomUUID().toString()); + headData.setValue(head); + heads.add(headData); + }else { + if(StringUtils.equalsIgnoreCase(head,"testCase")){ + showTestCase = false; + }else if(StringUtils.equalsIgnoreCase(head,"apiCase")){ + showApi = false; + }else if(StringUtils.equalsIgnoreCase(head,"scenarioCase")){ + showScenario = false; + }else if(StringUtils.equalsIgnoreCase(head,"loadCaseCount")){ + showLoad = false; + } + } + } + List tableRows = new ArrayList<>(); + for (TestCaseCountTableDTO data : dtos) { + TestCaseCountTableRowDTO row = new TestCaseCountTableRowDTO(); + List rowDataList = new ArrayList<>(); + + TestCaseCountTableItemDataDTO nameData = new TestCaseCountTableItemDataDTO(); + nameData.setId(UUID.randomUUID().toString()); + nameData.setValue(data.getName()); + rowDataList.add(nameData); + + TestCaseCountTableItemDataDTO countData = new TestCaseCountTableItemDataDTO(); + countData.setId(UUID.randomUUID().toString()); + countData.setValue(data.getAllCount()); + rowDataList.add(countData); + + if(showTestCase){ + TestCaseCountTableItemDataDTO itemData = new TestCaseCountTableItemDataDTO(); + itemData.setId(UUID.randomUUID().toString()); + itemData.setValue(data.getTestCaseCount()); + rowDataList.add(itemData); + } + + if(showApi){ + TestCaseCountTableItemDataDTO itemData = new TestCaseCountTableItemDataDTO(); + itemData.setId(UUID.randomUUID().toString()); + itemData.setValue(data.getApiCaseCount()); + rowDataList.add(itemData); + } + + if(showScenario){ + TestCaseCountTableItemDataDTO itemData = new TestCaseCountTableItemDataDTO(); + itemData.setId(UUID.randomUUID().toString()); + itemData.setValue(data.getScenarioCaseCount()); + rowDataList.add(itemData); + } + + if(showLoad){ + TestCaseCountTableItemDataDTO itemData = new TestCaseCountTableItemDataDTO(); + itemData.setId(UUID.randomUUID().toString()); + itemData.setValue(data.getLoadCaseCount()); + rowDataList.add(itemData); + } + row.setTableDatas(rowDataList); + tableRows.add(row); + } + returnDTO.setHeads(heads); + returnDTO.setData(tableRows); + + + return returnDTO; } public ReportStatisticsWithBLOBs updateByRequest(ReportStatisticsSaveRequest request) { @@ -78,4 +165,20 @@ public class ReportStatisticsService { reportStatisticsMapper.updateByPrimaryKeySelective(updateModel); return updateModel; } + + public List selectByRequest(ReportStatisticsSaveRequest request) { + ReportStatisticsExample example = new ReportStatisticsExample(); + ReportStatisticsExample.Criteria criteria = example.createCriteria(); + if(StringUtils.isNotEmpty(request.getProjectId())){ + criteria.andProjectIdEqualTo(request.getProjectId()); + } + if(StringUtils.isNotEmpty(request.getReportType())){ + criteria.andReportTypeEqualTo(request.getReportType()); + } + if(StringUtils.isNotEmpty(request.getName())){ + criteria.andNameLike(request.getName()); + } + example.setOrderByClause("create_time DESC"); + return reportStatisticsMapper.selectByExample(example); + } } diff --git a/backend/src/main/java/io/metersphere/reportstatistics/service/TestCaseCountService.java b/backend/src/main/java/io/metersphere/reportstatistics/service/TestCaseCountService.java index b559d62c61..8a15b7fc35 100644 --- a/backend/src/main/java/io/metersphere/reportstatistics/service/TestCaseCountService.java +++ b/backend/src/main/java/io/metersphere/reportstatistics/service/TestCaseCountService.java @@ -12,6 +12,9 @@ import io.metersphere.dto.TestCaseTemplateDao; import io.metersphere.i18n.Translator; import io.metersphere.reportstatistics.dto.*; import io.metersphere.reportstatistics.dto.charts.*; +import io.metersphere.reportstatistics.dto.table.TestCaseCountTableDataDTO; +import io.metersphere.reportstatistics.dto.table.TestCaseCountTableItemDataDTO; +import io.metersphere.reportstatistics.dto.table.TestCaseCountTableRowDTO; import io.metersphere.service.TestCaseTemplateService; import io.metersphere.service.UserService; import org.apache.commons.collections.CollectionUtils; @@ -298,13 +301,96 @@ public class TestCaseCountService { formatPieChart(pieChartDTO, request.getXaxis(), summaryMap,yAxisSelectTestCase,yAxisSelectApi,yAxisSelectScenarioCase,yAxisSelectLoad); + TestCaseCountTableDataDTO showTable = this.countShowTable(request.getXaxis(),request.getYaxis(),dtos); + TestCaseCountResponse testCaseCountResult = new TestCaseCountResponse(); testCaseCountResult.setBarChartDTO(dto); testCaseCountResult.setTableDTOs(dtos); testCaseCountResult.setPieChartDTO(pieChartDTO); + testCaseCountResult.setShowTable(showTable); + return testCaseCountResult; } + private TestCaseCountTableDataDTO countShowTable(String groupName, List yaxis, List dtos) { + TestCaseCountTableDataDTO returnDTO = new TestCaseCountTableDataDTO(); + String [] headers = new String[]{groupName,"总计","testCase","apiCase","scenarioCase","loadCaseCount"}; + + List heads = new ArrayList<>(); + boolean showTestCase = true; + boolean showApi = true; + boolean showScenario = true; + boolean showLoad = true; + for (String head : headers) { + if(StringUtils.equalsAnyIgnoreCase(head,groupName,"总计") || yaxis.contains(head)){ + TestCaseCountTableItemDataDTO headData = new TestCaseCountTableItemDataDTO(); + headData.setId(UUID.randomUUID().toString()); + headData.setValue(head); + heads.add(headData); + }else { + if(StringUtils.equalsIgnoreCase(head,"testCase")){ + showTestCase = false; + }else if(StringUtils.equalsIgnoreCase(head,"apiCase")){ + showApi = false; + }else if(StringUtils.equalsIgnoreCase(head,"scenarioCase")){ + showScenario = false; + }else if(StringUtils.equalsIgnoreCase(head,"loadCaseCount")){ + showLoad = false; + } + } + } + List tableRows = new ArrayList<>(); + for (TestCaseCountTableDTO data : dtos) { + TestCaseCountTableRowDTO row = new TestCaseCountTableRowDTO(); + List rowDataList = new ArrayList<>(); + + TestCaseCountTableItemDataDTO nameData = new TestCaseCountTableItemDataDTO(); + nameData.setId(UUID.randomUUID().toString()); + nameData.setValue(data.getName()); + rowDataList.add(nameData); + + TestCaseCountTableItemDataDTO countData = new TestCaseCountTableItemDataDTO(); + countData.setId(UUID.randomUUID().toString()); + countData.setValue(data.getAllCount()); + rowDataList.add(countData); + + if(showTestCase){ + TestCaseCountTableItemDataDTO itemData = new TestCaseCountTableItemDataDTO(); + itemData.setId(UUID.randomUUID().toString()); + itemData.setValue(data.getTestCaseCount()); + rowDataList.add(itemData); + } + + if(showApi){ + TestCaseCountTableItemDataDTO itemData = new TestCaseCountTableItemDataDTO(); + itemData.setId(UUID.randomUUID().toString()); + itemData.setValue(data.getApiCaseCount()); + rowDataList.add(itemData); + } + + if(showScenario){ + TestCaseCountTableItemDataDTO itemData = new TestCaseCountTableItemDataDTO(); + itemData.setId(UUID.randomUUID().toString()); + itemData.setValue(data.getScenarioCaseCount()); + rowDataList.add(itemData); + } + + if(showLoad){ + TestCaseCountTableItemDataDTO itemData = new TestCaseCountTableItemDataDTO(); + itemData.setId(UUID.randomUUID().toString()); + itemData.setValue(data.getLoadCaseCount()); + rowDataList.add(itemData); + } + row.setTableDatas(rowDataList); + tableRows.add(row); + } + returnDTO.setHeads(heads); + returnDTO.setData(tableRows); + + + return returnDTO; + } + private List checkCountChartResultHasColumn(String xcolumn,List resultList) { boolean hasResult = false; for (TestCaseCountChartResult result: resultList) { diff --git a/backend/src/main/java/io/metersphere/xpack b/backend/src/main/java/io/metersphere/xpack index 8a66abb2ae..b90efefd13 160000 --- a/backend/src/main/java/io/metersphere/xpack +++ b/backend/src/main/java/io/metersphere/xpack @@ -1 +1 @@ -Subproject commit 8a66abb2ae670718f65469ba70fc5e3dabdec6c1 +Subproject commit b90efefd1312b35dea5c2c1fb3a7f78904a7bcd7 diff --git a/backend/src/main/resources/db/migration/V99__v1.15_release.sql b/backend/src/main/resources/db/migration/V99__v1.15_release.sql index c5e3f8b882..68726cc0a5 100644 --- a/backend/src/main/resources/db/migration/V99__v1.15_release.sql +++ b/backend/src/main/resources/db/migration/V99__v1.15_release.sql @@ -31,3 +31,35 @@ VALUES ('e392af07-fdfe-4475-a459-87d59f0b1625', '测试阶段', 'PLAN', 'select' 1, 1, 'global', unix_timestamp() * 1000, unix_timestamp() * 1000); ALTER TABLE api_definition_exec_result MODIFY COLUMN name VARCHAR (100); + +CREATE TABLE IF NOT EXISTS `enterprise_test_report` ( + `id` varchar(50) NOT NULL COMMENT 'Test ID', + `project_id` varchar(50) NOT NULL COMMENT 'Project ID this report belongs to', + `create_time` bigint(13) NOT NULL COMMENT 'Create timestamp', + `update_time` bigint(13) NOT NULL COMMENT 'Update timestamp', + `create_user` varchar(64) DEFAULT NULL COMMENT 'User ID', + `update_user` varchar(64) DEFAULT NULL COMMENT 'User ID', + `name` varchar(255) NOT NULL COMMENT 'report name', + `status` varchar(64) DEFAULT NULL COMMENT 'Status of email', + `send_freq` varchar(64) DEFAULT NULL COMMENT 'send freq', + `send_cron` varchar(64) DEFAULT NULL COMMENT 'send cron', + `last_send_time` bigint(13) DEFAULT NULL COMMENT 'last send time', + `report_content` longtext COMMENT 'report content', + `addressee` longtext COMMENT 'report content', + `duplicated` longtext COMMENT 'report content', + PRIMARY KEY (`id`) + ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE utf8mb4_general_ci; + + +CREATE TABLE IF NOT EXISTS `enterprise_test_report_send_record` ( + `id` varchar(50) NOT NULL COMMENT 'Test ID', + `enterprise_test_report_id` varchar(50) NOT NULL COMMENT 'Enterprise report ID this record belongs to', + `create_time` bigint(13) NOT NULL COMMENT 'Create timestamp', + `create_user` varchar(64) DEFAULT NULL COMMENT 'User ID', + `status` varchar(64) DEFAULT NULL COMMENT 'Status of email', + `report_content` longtext COMMENT 'report content', + `addressee` longtext COMMENT 'report content', + `duplicated` longtext COMMENT 'report content', + PRIMARY KEY (`id`), + INDEX `enterprise_test_report_id` (`enterprise_test_report_id`) USING BTREE + ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE utf8mb4_general_ci; \ No newline at end of file diff --git a/backend/src/main/resources/generatorConfig.xml b/backend/src/main/resources/generatorConfig.xml index 274d499d97..1894b97876 100644 --- a/backend/src/main/resources/generatorConfig.xml +++ b/backend/src/main/resources/generatorConfig.xml @@ -71,7 +71,8 @@ - +
+