fix(项目管理): 修复消息通知各种问题以及功能用例创建不显示更新人和消息中心@的问题

--bug=1039176 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001039176
--bug=1039096 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001039096
--bug=1039104 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001039104
--bug=1039178 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001039178
--bug=1039173 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001039173
This commit is contained in:
guoyuqi 2024-04-11 19:26:03 +08:00 committed by Craftsman
parent bfca50f212
commit c11e0e7bb3
14 changed files with 303 additions and 281 deletions

View File

@ -319,35 +319,55 @@ message.title.schedule_task_open=开启定时任务通知
message.title.schedule_task_close=关闭定时任务通知
#功能用例
message.domain.name=名称
message.domain.test_plan_name=测试计划名称
message.domain.review_name=评审名称
message.domain.review_status=评审状态
message.domain.case_model=编辑模式
message.domain.last_execute_result=最近的执行结果
message.domain.create_user=创建人
message.domain.update_user=更新人
message.domain.delete_user=删除人
message.domain.create_time=创建时间
message.domain.update_time=更新时间
message.domain.delete_time=删除时间
message.domain.testPlanName=测试计划名称
message.domain.reviewName=评审名称
message.domain.reviewStatus=评审状态
message.domain.caseModel=编辑模式
message.domain.lastExecuteResult=最近的执行结果
message.domain.createUser=创建人
message.domain.updateUser=更新人
message.domain.deleteUser=删除人
message.domain.createTime=创建时间
message.domain.updateTime=更新时间
message.domain.deleteTime=删除时间
#接口定义和用例
message.domain.protocol=接口协议
message.domain.method=http协议类型
message.domain.path=http协议路径/其它协议则为空
message.domain.status=接口状态
message.domain.description=描述
message.domain.case_name=接口用例名称
message.domain.caseName=接口用例名称
message.domain.priority=用例等级
message.domain.case_status=用例状态
message.domain.last_report_status=用例最新执行结果状态
message.domain.caseStatus=用例状态
message.domain.lastReportStatus=用例最新执行结果状态
message.domain.principal=用例责任人
message.domain.case_create_time=用例创建时间
message.domain.case_create_user=用例创建人
message.domain.case_update_time=用例更新时间
message.domain.case_update_user=用例更新人
message.domain.case_delete_time=用例删除时间
message.domain.case_delete_user=用例删除人
message.domain.mock_name=期望名称
message.domain.caseCreateTime=用例创建时间
message.domain.caseCreateUser=用例创建人
message.domain.caseUpdateTime=用例更新时间
message.domain.caseUpdateUser=用例更新人
message.domain.caseDeleteTime=用例删除时间
message.domain.caseDeleteUser=用例删除人
message.domain.mockName=期望名称
message.domain.reportUrl=报告地址
message.domain.shareUrl=分享地址
message.domain.reportName=报告名称
message.domain.startTime=开始时间
message.domain.endTime=结束时间
message.domain.requestDuration=请求总耗时
message.domain.reportStatus=报告状态
message.domain.environment=报告环境
message.domain.errorCount=失败数
message.domain.fakeErrorCount=误报数
message.domain.pendingCount=未执行数
message.domain.successCount=成功数
message.domain.assertionCount=总断言数
message.domain.assertionSuccessCount=断言成功数
message.domain.requestErrorRate=请求失败率
message.domain.requestPendingRate=请求未执行率
message.domain.requestFakeErrorRate=请求误报率
message.domain.requestPassRate=通过率
message.domain.assertionPassRate=断言通过率
message.domain.projectId=项目id
#场景字段
message.domain.api_scenario_name=场景名称
message.domain.api_scenario_level=场景级别
@ -355,7 +375,7 @@ message.domain.api_scenario_status=场景状态
message.domain.api_scenario_principal=责任人
message.domain.api_scenario_stepTotal=场景步骤总数
message.domain.api_scenario_num=编号
message.domain.api_scenario_passRate=通过率
message.domain.api_scenario_reportRequestPassRate=通过率
message.domain.api_scenario_lastReportStatus=最后一次执行的结果状态
message.domain.api_scenario_description=描述
message.domain.api_scenario_tags=标签
@ -368,26 +388,24 @@ message.domain.api_scenario_updateTime=更新时间
message.domain.api_scenario_deleteTime=删除时间
message.domain.api_scenario_priority=优先级
message.domain.api_scenario_requestPassRate=请求通过率
message.domain.api_scenario_environmentId=环境ID
message.domain.scenario_report_url=报告地址
message.domain.scenario_report_share_url=分享地址
message.domain.scenario_report_name=报告名称
message.domain.scenario_report_start_time=开始时间
message.domain.scenario_report_end_time=结束时间
message.domain.scenario_report_request_duration=请求总耗时
message.domain.scenario_report_status=报告状态
message.domain.scenario_report_environment=报告环境
message.domain.scenario_report_error_count=失败数
message.domain.scenario_report_fake_error_count=误报数
message.domain.scenario_report_pending_count=未执行数
message.domain.scenario_report_success_count=成功数
message.domain.scenario_report_assertion_count=总断言数
message.domain.scenario_report_assertion_success_count=断言成功数
message.domain.scenario_report_request_error_rate=请求失败率
message.domain.scenario_report_request_pending_rate=请求未执行率
message.domain.scenario_report_request_fake_error_rate=请求误报率
message.domain.scenario_report_request_pass_rate=请求通过率
message.domain.scenario_report_assertion_pass_rate=断言通过率
message.domain.api_scenario_reportUrl=报告地址
message.domain.api_scenario_shareUrl=分享地址
message.domain.api_scenario_reportName=报告名称
message.domain.api_scenario_startTime=开始时间
message.domain.api_scenario_endTime=结束时间
message.domain.api_scenario_requestDuration=请求总耗时
message.domain.api_scenario_reportStatus=报告状态
message.domain.api_scenario_environment=报告环境
message.domain.api_scenario_errorCount=失败数
message.domain.api_scenario_fakeErrorCount=误报数
message.domain.api_scenario_pendingCount=未执行数
message.domain.api_scenario_successCount=成功数
message.domain.api_scenario_assertionCount=总断言数
message.domain.api_scenario_assertionSuccessCount=断言成功数
message.domain.api_scenario_requestErrorRate=请求失败率
message.domain.api_scenario_requestPendingRate=请求未执行率
message.domain.api_scenario_requestFakeErrorRate=请求误报率
message.domain.api_scenario_assertionPassRate=断言通过率
# 测试计划
message.domain.test_plan_stage=测试阶段
message.domain.test_plan_status=测试计划状态

View File

@ -384,6 +384,26 @@ message.domain.case_update_user=Case update user
message.domain.case_delete_time=Case delete time
message.domain.case_delete_user=Case delete user
message.domain.mock_name=Expect name
message.domain.reportUrl=Report URL
message.domain.shareUrl=Share URL
message.domain.reportName=Report name
message.domain.startTime=Start time
message.domain.endTime=End time
message.domain.requestDuration=Request duration
message.domain.reportStatus=Report status
message.domain.environment=Report environment
message.domain.errorCount=Error count
message.domain.fakeErrorCount=Fake Error Count
message.domain.pendingCount=Pending Count
message.domain.successCount=Success Count
message.domain.assertionCount=Assertion Count
message.domain.assertionSuccessCount=Assertion Success Count
message.domain.requestErrorRate=Request Error Rate
message.domain.requestPendingRate=Request Pending Rate
message.domain.requestFakeErrorRate=Request Fake Error Rate
message.domain.requestPassRate=Request Pass Rate
message.domain.assertionPassRate=Assertion Pass Rate
message.domain.projectId=Project Id
#Scenario字段
message.domain.api_scenario_name=Scenario name
message.domain.api_scenario_level=Scenario level
@ -404,26 +424,24 @@ message.domain.api_scenario_updateTime=Update time
message.domain.api_scenario_deleteTime=Delete time
message.domain.api_scenario_priority=Priority
message.domain.api_scenario_requestPassRate=Request pass rate
message.domain.api_scenario_environmentId=Environment ID
message.domain.scenario_report_url=Report URL
message.domain.scenario_report_share_url=Share URL
message.domain.scenario_report_name=Report name
message.domain.scenario_report_start_time=Start time
message.domain.scenario_report_end_time=End time
message.domain.scenario_report_request_duration=Request duration
message.domain.scenario_report_status=Report status
message.domain.scenario_report_environment=Report environment
message.domain.scenario_report_error_count=Error count
message.domain.scenario_report_fake_error_count=Fake error count
message.domain.scenario_report_pending_count=Pending count
message.domain.scenario_report_success_count=Success count
message.domain.scenario_report_assertion_count=Assertion count
message.domain.scenario_report_assertion_success_count=Assertion success count
message.domain.scenario_report_request_error_rate=Request error rate
message.domain.scenario_report_request_pending_rate=Request pending rate
message.domain.scenario_report_request_fake_error_rate=Request fake error rate
message.domain.scenario_report_request_pass_rate=Request pass rate
message.domain.scenario_report_assertion_pass_rate=Assertion pass rate
message.domain.api_scenario_reportUrl=Report URL
message.domain.api_scenario_shareUrl=Share URL
message.domain.api_scenario_reportName=Report name
message.domain.api_scenario_startTime=Start time
message.domain.api_scenario_endTime=End time
message.domain.api_scenario_requestDuration=Request duration
message.domain.api_scenario_reportStatus=Report status
message.domain.api_scenario_environment=Report environment
message.domain.api_scenario_errorCount=Error count
message.domain.api_scenario_fakeErrorCount=Fake error count
message.domain.api_scenario_pendingCount=Pending count
message.domain.api_scenario_successCount=Success count
message.domain.api_scenario_assertionCount=Assertion count
message.domain.api_scenario_assertionSuccessCount=Assertion success count
message.domain.api_scenario_requestErrorRate=Request error rate
message.domain.api_scenario_requestPendingRate=Request pending rate
message.domain.api_scenario_requestFakeErrorRate=Request fake error rate
message.domain.api_scenario_assertionPassRate=Assertion pass rate
# Test plan
message.domain.test_plan_stage=Testing phase
message.domain.test_plan_status=Test plan status

View File

@ -354,35 +354,55 @@ message.title.schedule_task_close=关闭定时任务通知
#功能用例
message.domain.name=名称
message.domain.test_plan_name=测试计划名称
message.domain.review_name=评审名称
message.domain.review_status=评审状态
message.domain.case_model=编辑模式
message.domain.last_execute_result=最近的执行结果
message.domain.create_user=创建人
message.domain.update_user=更新人
message.domain.delete_user=删除人
message.domain.create_time=创建时间
message.domain.update_time=更新时间
message.domain.delete_time=删除时间
message.domain.testPlanName=测试计划名称
message.domain.reviewName=评审名称
message.domain.reviewStatus=评审状态
message.domain.caseModel=编辑模式
message.domain.lastExecuteResult=最近的执行结果
message.domain.createUser=创建人
message.domain.updateUser=更新人
message.domain.deleteUser=删除人
message.domain.createTime=创建时间
message.domain.updateTime=更新时间
message.domain.deleteTime=删除时间
#接口定义和用例
message.domain.protocol=接口协议
message.domain.method=http协议类型
message.domain.path=http协议路径/其它协议则为空
message.domain.status=接口状态
message.domain.description=描述
message.domain.case_name=接口用例名称
message.domain.caseName=接口用例名称
message.domain.priority=用例等级
message.domain.case_status=用例状态
message.domain.last_report_status=用例最新执行结果状态
message.domain.caseStatus=用例状态
message.domain.lastReportStatus=用例最新执行结果状态
message.domain.principal=用例责任人
message.domain.case_create_time=用例创建时间
message.domain.case_create_user=用例创建人
message.domain.case_update_time=用例更新时间
message.domain.case_update_user=用例更新人
message.domain.case_delete_time=用例删除时间
message.domain.case_delete_user=用例删除人
message.domain.mock_name=期望名称
message.domain.caseCreateTime=用例创建时间
message.domain.caseCreateUser=用例创建人
message.domain.caseUpdateTime=用例更新时间
message.domain.caseUpdateUser=用例更新人
message.domain.caseDeleteTime=用例删除时间
message.domain.caseDeleteUser=用例删除人
message.domain.mockName=期望名称
message.domain.reportUrl=报告地址
message.domain.shareUrl=分享地址
message.domain.reportName=报告名称
message.domain.startTime=开始时间
message.domain.endTime=结束时间
message.domain.requestDuration=请求总耗时
message.domain.reportStatus=报告状态
message.domain.environment=报告环境
message.domain.errorCount=失败数
message.domain.fakeErrorCount=误报数
message.domain.pendingCount=未执行数
message.domain.successCount=成功数
message.domain.assertionCount=总断言数
message.domain.assertionSuccessCount=断言成功数
message.domain.requestErrorRate=请求失败率
message.domain.requestPendingRate=请求未执行率
message.domain.requestFakeErrorRate=请求误报率
message.domain.requestPassRate=通过率
message.domain.assertionPassRate=断言通过率
message.domain.projectId=项目id
#场景字段
message.domain.api_scenario_name=场景名称
message.domain.api_scenario_level=场景级别
@ -390,7 +410,7 @@ message.domain.api_scenario_status=场景状态
message.domain.api_scenario_principal=责任人
message.domain.api_scenario_stepTotal=场景步骤总数
message.domain.api_scenario_num=编号
message.domain.api_scenario_passRate=通过率
message.domain.api_scenario_reportRequestPassRate=通过率
message.domain.api_scenario_lastReportStatus=最后一次执行的结果状态
message.domain.api_scenario_description=描述
message.domain.api_scenario_tags=标签
@ -403,26 +423,24 @@ message.domain.api_scenario_updateTime=更新时间
message.domain.api_scenario_deleteTime=删除时间
message.domain.api_scenario_priority=优先级
message.domain.api_scenario_requestPassRate=请求通过率
message.domain.api_scenario_environmentId=环境ID
message.domain.scenario_report_url=报告地址
message.domain.scenario_report_share_url=分享地址
message.domain.scenario_report_name=报告名称
message.domain.scenario_report_start_time=开始时间
message.domain.scenario_report_end_time=结束时间
message.domain.scenario_report_request_duration=请求总耗时
message.domain.scenario_report_status=报告状态
message.domain.scenario_report_environment=报告环境
message.domain.scenario_report_error_count=失败数
message.domain.scenario_report_fake_error_count=误报数
message.domain.scenario_report_pending_count=未执行数
message.domain.scenario_report_success_count=成功数
message.domain.scenario_report_assertion_count=总断言数
message.domain.scenario_report_assertion_success_count=断言成功数
message.domain.scenario_report_request_error_rate=请求失败率
message.domain.scenario_report_request_pending_rate=请求未执行率
message.domain.scenario_report_request_fake_error_rate=请求误报率
message.domain.scenario_report_request_pass_rate=请求通过率
message.domain.scenario_report_assertion_pass_rate=断言通过率
message.domain.api_scenario_reportUrl=报告地址
message.domain.api_scenario_shareUrl=分享地址
message.domain.api_scenario_reportName=报告名称
message.domain.api_scenario_startTime=开始时间
message.domain.api_scenario_endTime=结束时间
message.domain.api_scenario_requestDuration=请求总耗时
message.domain.api_scenario_reportStatus=报告状态
message.domain.api_scenario_environment=报告环境
message.domain.api_scenario_errorCount=失败数
message.domain.api_scenario_fakeErrorCount=误报数
message.domain.api_scenario_pendingCount=未执行数
message.domain.api_scenario_successCount=成功数
message.domain.api_scenario_assertionCount=总断言数
message.domain.api_scenario_assertionSuccessCount=断言成功数
message.domain.api_scenario_requestErrorRate=请求失败率
message.domain.api_scenario_requestPendingRate=请求未执行率
message.domain.api_scenario_requestFakeErrorRate=请求误报率
message.domain.api_scenario_assertionPassRate=断言通过率
# 测试计划
message.domain.test_plan_stage=测试阶段
message.domain.test_plan_status=测试计划状态

View File

@ -355,35 +355,55 @@ message.title.schedule_task_close=關閉定時任務通知
#功能用例
message.domain.name=名稱
message.domain.test_plan_name=測試計劃名稱
message.domain.review_name=評審名稱
message.domain.review_status=評審狀態
message.domain.case_model=編輯模式
message.domain.last_execute_result=最近的執行結果
message.domain.create_user=創建人
message.domain.update_user=更新人
message.domain.delete_user=刪除人
message.domain.create_time=創建時間
message.domain.update_time=更新時間
message.domain.delete_time=刪除時間
message.domain.testPlanName=測試計劃名稱
message.domain.reviewName=評審名稱
message.domain.reviewStatus=評審狀態
message.domain.caseModel=編輯模式
message.domain.lastExecuteResult=最近的執行結果
message.domain.createUser=創建人
message.domain.updateUser=更新人
message.domain.deleteUser=刪除人
message.domain.createTime=創建時間
message.domain.updateTime=更新時間
message.domain.deleteTime=刪除時間
#接口定義和用例
message.domain.protocol=介面協定
message.domain.method=http協定類型
message.domain.path=http協定路徑/其它協定則為空
message.domain.status=介面狀態
message.domain.description=描述
message.domain.case_name=介面用例名稱
message.domain.caseName=介面用例名稱
message.domain.priority=用例等級
message.domain.case_status=用例狀態
message.domain.last_report_status=使用案例最新執行結果狀態
message.domain.caseStatus=用例狀態
message.domain.lastReportStatus=使用案例最新執行結果狀態
message.domain.principal=用例責任人
message.domain.case_create_time=用例創建時間
message.domain.case_create_user=用例創建人
message.domain.case_update_time=用例更新時間
message.domain.case_update_user=用例更新人
message.domain.case_delete_time=用例刪除時間
message.domain.case_delete_user=用例刪除人
message.domain.mock_name=期望名稱
message.domain.caseCreateTime=用例創建時間
message.domain.caseCreateUser=用例創建人
message.domain.caseUpdateTime=用例更新時間
message.domain.caseUpdateUser=用例更新人
message.domain.caseDeleteTime=用例刪除時間
message.domain.caseDeleteUser=用例刪除人
message.domain.mockName=期望名稱
message.domain.reportUrl=報告地址
message.domain.shareUrl=分享地址
message.domain.reportName=報告名稱
message.domain.startTime=開始時間
message.domain.endTime=結束時間
message.domain.requestDuration=請求持續時間
message.domain.reportStatus=報告狀態
message.domain.environment=報告環境
message.domain.errorCount=報告錯誤數
message.domain.fakeErrorCount=報告誤報數
message.domain.pendingCount=報告待定數
message.domain.successCount=報告成功數
message.domain.assertionCount=報告斷言數
message.domain.assertionSuccessCount=報告斷言成功數
message.domain.requestErrorRate=報告請求錯誤率
message.domain.requestPendingRate=報告請求待定率
message.domain.requestFakeErrorRate=報告請求誤報率
message.domain.requestPassRate=報告請求通過率
message.domain.assertionPassRate=報告斷言通過率
message.domain.projectId=項目id
#場景字段
message.domain.api_scenario_name=場景名稱
message.domain.api_scenario_level=場景等級
@ -404,26 +424,24 @@ message.domain.api_scenario_updateTime=更新時間
message.domain.api_scenario_deleteTime=刪除時間
message.domain.api_scenario_priority=優先級
message.domain.api_scenario_requestPassRate=請求通過率
message.domain.api_scenario_environmentId=環境ID
message.domain.scenario_report_url=報告地址
message.domain.scenario_report_share_url=分享地址
message.domain.scenario_report_name=報告名稱
message.domain.scenario_report_start_time=報告開始時間
message.domain.scenario_report_end_time=報告結束時間
message.domain.scenario_report_request_duration=請求持續時間
message.domain.scenario_report_status=報告狀態
message.domain.scenario_report_environment=報告環境
message.domain.scenario_report_error_count=報告錯誤數
message.domain.scenario_report_fake_error_count=報告誤報數
message.domain.scenario_report_pending_count=報告待定數
message.domain.scenario_report_success_count=報告成功數
message.domain.scenario_report_assertion_count=報告斷言數
message.domain.scenario_report_assertion_success_count=報告斷言成功數
message.domain.scenario_report_request_error_rate=報告請求錯誤率
message.domain.scenario_report_request_pending_rate=報告請求待定率
message.domain.scenario_report_request_fake_error_rate=報告請求誤報率
message.domain.scenario_report_request_pass_rate=報告請求通過率
message.domain.scenario_report_assertion_pass_rate=報告斷言通過率
message.domain.api_scenario_reportUrl=報告地址
message.domain.api_scenario_shareUrl=分享地址
message.domain.api_scenario_reportName=報告名稱
message.domain.api_scenario_startTime=報告開始時間
message.domain.api_scenario_endTime=報告結束時間
message.domain.api_scenario_requestDuration=請求持續時間
message.domain.api_scenario_reportStatus=報告狀態
message.domain.api_scenario_environment=報告環境
message.domain.api_scenario_errorCount=報告錯誤數
message.domain.api_scenario_fakeErrorCount=報告誤報數
message.domain.api_scenario_pendingCount=報告待定數
message.domain.api_scenario_successCount=報告成功數
message.domain.api_scenario_assertionCount=報告斷言數
message.domain.api_scenario_assertionSuccessCount=報告斷言成功數
message.domain.api_scenario_requestErrorRate=報告請求錯誤率
message.domain.api_scenario_requestPendingRate=報告請求待定率
message.domain.api_scenario_requestFakeErrorRate=報告請求誤報率
message.domain.api_scenario_assertionPassRate=報告斷言通過率
# 測試計劃
message.domain.test_plan_stage=測試階段
message.domain.test_plan_status=測試計劃狀態

View File

@ -23,6 +23,7 @@ import io.metersphere.system.dto.sdk.BaseSystemConfigDTO;
import io.metersphere.system.mapper.UserMapper;
import io.metersphere.system.notice.NoticeModel;
import io.metersphere.system.notice.constants.NoticeConstants;
import io.metersphere.system.notice.utils.MessageTemplateUtils;
import io.metersphere.system.service.NoticeSendService;
import io.metersphere.system.service.SystemParameterService;
import jakarta.annotation.Resource;
@ -62,7 +63,6 @@ public class ApiReportSendNoticeService {
BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo();
BeanMap beanMap;
String event;
String status;
ApiReportShareService shareService = CommonBeanFactory.getBean(ApiReportShareService.class);
ApiReportShareRequest shareRequest = new ApiReportShareRequest();
shareRequest.setReportId(noticeDTO.getReportId());
@ -81,16 +81,14 @@ public class ApiReportSendNoticeService {
reportUrl = String.format(reportUrl, project.getOrganizationId(), project.getId(), API_SCENARIO, report.getId());
if (StringUtils.endsWithIgnoreCase(noticeDTO.getReportStatus(), ApiReportStatus.SUCCESS.name())) {
event = NoticeConstants.Event.SCENARIO_EXECUTE_SUCCESSFUL;
status = "成功";
} else if (StringUtils.endsWithIgnoreCase(noticeDTO.getReportStatus(), ApiReportStatus.FAKE_ERROR.name())) {
event = NoticeConstants.Event.SCENARIO_EXECUTE_FAKE_ERROR;
status = "误报";
} else {
event = NoticeConstants.Event.SCENARIO_EXECUTE_FAILED;
status = "失败";
}
shareUrl = String.format(shareUrl, "shareReportScenario");
} else {
}
else {
ApiTestCase testCase = apiTestCaseMapper.selectByPrimaryKey(noticeDTO.getResourceId());
beanMap = new BeanMap(testCase);
@ -101,13 +99,10 @@ public class ApiReportSendNoticeService {
BeanUtils.copyBean(report, apiReport);
if (StringUtils.endsWithIgnoreCase(noticeDTO.getReportStatus(), ApiReportStatus.SUCCESS.name())) {
event = NoticeConstants.Event.CASE_EXECUTE_SUCCESSFUL;
status = "成功";
} else if (StringUtils.endsWithIgnoreCase(noticeDTO.getReportStatus(), ApiReportStatus.FAKE_ERROR.name())) {
event = NoticeConstants.Event.CASE_EXECUTE_FAKE_ERROR;
status = "误报";
} else {
event = NoticeConstants.Event.CASE_EXECUTE_FAILED;
status = "失败";
}
shareUrl = String.format(shareUrl, "shareReportCase");
}
@ -115,8 +110,8 @@ public class ApiReportSendNoticeService {
String userId = noticeDTO.getUserId();
User user = userMapper.selectByPrimaryKey(userId);
Map<String, Object> paramMap = new HashMap(beanMap);
paramMap.put("operator", user != null ? user.getName() : "");
Map paramMap = new HashMap<>(beanMap);
paramMap.put(NoticeConstants.RelatedUser.OPERATOR, user != null ? user.getName() : "");
paramMap.put("status", noticeDTO.getReportStatus());
paramMap.put("reportName", report.getName());
@ -150,9 +145,13 @@ public class ApiReportSendNoticeService {
paramMap.put("reportUrl", reportUrl);
paramMap.put("scenarioShareUrl", shareUrl);
String context = "${operator}执行接口测试" + status + ": ${name}";
Map<String, String> defaultTemplateMap = MessageTemplateUtils.getDefaultTemplateMap();
String template = defaultTemplateMap.get(noticeType + "_" + event);
Map<String, String> defaultSubjectMap = MessageTemplateUtils.getDefaultTemplateSubjectMap();
String subject = defaultSubjectMap.get(noticeType + "_" + event);
NoticeModel noticeModel = NoticeModel.builder().operator(userId)
.context(context).subject("执行通知").paramMap(paramMap).event(event).build();
.context(template).subject(subject).paramMap(paramMap).event(event).build();
noticeSendService.send(project, noticeType, noticeModel);
}

View File

@ -1,7 +1,6 @@
package io.metersphere.api.service.definition;
import io.metersphere.api.domain.ApiDefinition;
import io.metersphere.api.domain.ApiDefinitionCustomField;
import io.metersphere.api.domain.ApiDefinitionExample;
import io.metersphere.api.dto.definition.ApiDefinitionAddRequest;
import io.metersphere.api.dto.definition.ApiDefinitionBatchRequest;
@ -10,12 +9,8 @@ import io.metersphere.api.mapper.ApiDefinitionMapper;
import io.metersphere.api.mapper.ExtApiDefinitionMapper;
import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.sdk.util.SubListUtils;
import io.metersphere.system.domain.CustomField;
import io.metersphere.system.dto.sdk.ApiDefinitionCaseDTO;
import io.metersphere.system.dto.sdk.OptionDTO;
import io.metersphere.system.dto.table.TableBatchProcessDTO;
import io.metersphere.system.mapper.CustomFieldMapper;
import io.metersphere.system.mapper.ExtOrganizationCustomFieldMapper;
import jakarta.annotation.Resource;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;
@ -23,59 +18,25 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@Service
public class ApiDefinitionNoticeService {
@Resource
private CustomFieldMapper customFieldMapper;
@Resource
private ExtApiDefinitionMapper extApiDefinitionMapper;
@Resource
private ApiDefinitionMapper apiDefinitionMapper;
@Resource
private ExtOrganizationCustomFieldMapper extOrganizationCustomFieldMapper;
public ApiDefinitionCaseDTO getApiDTO(ApiDefinitionAddRequest request) {
ApiDefinitionCaseDTO caseDTO = new ApiDefinitionCaseDTO();
BeanUtils.copyBean(caseDTO, request);
List<OptionDTO> fields = new ArrayList<>();
if (CollectionUtils.isNotEmpty(request.getCustomFields())) {
for (ApiDefinitionCustomField customFieldDTO : request.getCustomFields()) {
OptionDTO optionDTO = new OptionDTO();
CustomField customField = customFieldMapper.selectByPrimaryKey(customFieldDTO.getFieldId());
if (customField == null) {
continue;
}
optionDTO.setId(customField.getId());
optionDTO.setName(customField.getName());
fields.add(optionDTO);
}
}
caseDTO.setFields(fields);
return caseDTO;
}
public ApiDefinitionCaseDTO getUpdateApiDTO(ApiDefinitionUpdateRequest request) {
ApiDefinitionCaseDTO caseDTO = new ApiDefinitionCaseDTO();
BeanUtils.copyBean(caseDTO, request);
List<OptionDTO> fields = new ArrayList<>();
if (CollectionUtils.isNotEmpty(request.getCustomFields())) {
for (ApiDefinitionCustomField customFieldDTO : request.getCustomFields()) {
OptionDTO optionDTO = new OptionDTO();
CustomField customField = customFieldMapper.selectByPrimaryKey(customFieldDTO.getFieldId());
if (customField == null) {
continue;
}
optionDTO.setId(customField.getId());
optionDTO.setName(customField.getName());
fields.add(optionDTO);
}
}
caseDTO.setFields(fields);
return caseDTO;
}
@ -105,19 +66,10 @@ public class ApiDefinitionNoticeService {
example.createCriteria().andIdIn(ids);
List<ApiDefinition> apiDefinitions = apiDefinitionMapper.selectByExample(example);
Map<String, ApiDefinition> apiDefinitionMap = apiDefinitions.stream().collect(Collectors.toMap(ApiDefinition::getId, a -> a));
List<ApiDefinitionCustomField> customFieldList = extApiDefinitionMapper.getCustomFieldByCaseIds(ids);
Map<String, List<ApiDefinitionCustomField>> apiCustomFieldMap = customFieldList.stream().collect(Collectors.groupingBy(ApiDefinitionCustomField::getApiId));
AtomicReference<List<OptionDTO>> optionDTOS = new AtomicReference<>(new ArrayList<>());
ids.forEach(id -> {
ApiDefinition api = apiDefinitionMap.get(id);
List<ApiDefinitionCustomField> customFields = apiCustomFieldMap.get(id);
if (CollectionUtils.isNotEmpty(customFields)) {
List<String> fields = customFields.stream().map(apiDefinitionCustomField -> apiDefinitionCustomField.getFieldId()).toList();
optionDTOS.set(extOrganizationCustomFieldMapper.getCustomFieldOptions(fields));
}
ApiDefinitionCaseDTO apiDefinitionCaseDTO = new ApiDefinitionCaseDTO();
BeanUtils.copyBean(apiDefinitionCaseDTO, api);
apiDefinitionCaseDTO.setFields(optionDTOS.get());
dtoList.add(apiDefinitionCaseDTO);
});
}

View File

@ -19,9 +19,11 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.i18n.LocaleContextHolder;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ -46,6 +48,7 @@ public class ApiReportSendNoticeTests extends BaseTest {
@Test
@Order(0)
public void sendNoticeTest() throws Exception {
LocaleContextHolder.setLocale(new Locale("zh", "CN"));
Environment environment = new Environment();
environment.setId("api-environment-id");
environment.setName("api-environment-name");

View File

@ -281,6 +281,7 @@ public class FunctionalCaseService {
functionalCase.setLastExecuteResult(FunctionalCaseExecuteResult.UN_EXECUTED.name());
functionalCase.setLatest(true);
functionalCase.setCreateUser(userId);
functionalCase.setUpdateUser(userId);
functionalCase.setCreateTime(System.currentTimeMillis());
functionalCase.setUpdateTime(System.currentTimeMillis());
functionalCase.setVersionId(StringUtils.defaultIfBlank(request.getVersionId(), extBaseProjectVersionMapper.getDefaultVersion(request.getProjectId())));

View File

@ -4,8 +4,6 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@NoArgsConstructor
public class ApiDefinitionCaseDTO {
@ -28,121 +26,118 @@ public class ApiDefinitionCaseDTO {
@Schema(description = "message.domain.description")
private String description;
@Schema(description = "message.domain.create_time")
@Schema(description = "message.domain.createTime")
private Long createTime;
@Schema(description = "message.domain.create_user")
@Schema(description = "message.domain.createUser")
private String createUser;
@Schema(description = "message.domain.update_time")
@Schema(description = "message.domain.updateTime")
private Long updateTime;
@Schema(description = "message.domain.update_user")
@Schema(description = "message.domain.updateUser")
private String updateUser;
@Schema(description = "message.domain.delete_user")
@Schema(description = "message.domain.deleteUser")
private String deleteUser;
@Schema(description = "message.domain.delete_time")
@Schema(description = "message.domain.deleteTime")
private Long deleteTime;
@Schema(description = "message.domain.case_name")
@Schema(description = "message.domain.caseName")
private String caseName;
@Schema(description = "message.domain.priority")
private String priority;
@Schema(description = "message.domain.case_status")
@Schema(description = "message.domain.caseStatus")
private String caseStatus;
@Schema(description = "message.domain.last_report_status")
@Schema(description = "message.domain.lastReportStatus")
private String lastReportStatus;
@Schema(description = "message.domain.principal")
private String principal;
@Schema(description = "message.domain.case_create_time")
@Schema(description = "message.domain.caseCreateTime")
private Long caseCreateTime;
@Schema(description = "message.domain.case_create_user")
@Schema(description = "message.domain.caseCreateUser")
private String caseCreateUser;
@Schema(description = "message.domain.case_update_time")
@Schema(description = "message.domain.caseUpdateTime")
private Long caseUpdateTime;
@Schema(description = "message.domain.case_update_user")
@Schema(description = "message.domain.caseUpdateUser")
private String caseUpdateUser;
@Schema(description = "message.domain.case_delete_time")
@Schema(description = "message.domain.caseDeleteTime")
private Long caseDeleteTime;
@Schema(description = "message.domain.case_delete_user")
@Schema(description = "message.domain.caseDeleteUser")
private String caseDeleteUser;
@Schema(description = "项目ID")
@Schema(description = "message.domain.projectId")
private String projectId;
@Schema(description = "自定义字段的值")
private List<OptionDTO> fields;
@Schema(description = "message.domain.mock_name")
@Schema(description = "message.domain.mockName")
private String mockName;
@Schema(description = "message.domain.scenario_report_url")
@Schema(description = "message.domain.reportUrl")
private String reportUrl;
@Schema(description = "message.domain.scenario_report_share_url")
@Schema(description = "message.domain.shareUrl")
private String shareUrl;
@Schema(description = "message.domain.scenario_report_name")
@Schema(description = "message.domain.reportName")
private String reportName;
@Schema(description = "message.domain.scenario_report_start_time")
@Schema(description = "message.domain.startTime")
private Long startTime;
@Schema(description = "message.domain.scenario_report_end_time")
@Schema(description = "message.domain.endTime")
private Long endTime;
@Schema(description = "message.domain.scenario_report_request_duration")
@Schema(description = "message.domain.requestDuration")
private Long requestDuration;
@Schema(description = "message.domain.scenario_report_status")
@Schema(description = "message.domain.reportStatus")
private String reportStatus;
@Schema(description = "message.domain.scenario_report_environment")
@Schema(description = "message.domain.environment")
private String environment;
@Schema(description = "message.domain.scenario_report_error_count")
@Schema(description = "message.domain.errorCount")
private Long errorCount;
@Schema(description = "message.domain.scenario_report_fake_error_count")
@Schema(description = "message.domain.fakeErrorCount")
private Long fakeErrorCount;
@Schema(description = "message.domain.scenario_report_pending_count")
@Schema(description = "message.domain.pendingCount")
private Long pendingCount;
@Schema(description = "message.domain.scenario_report_success_count")
@Schema(description = "message.domain.successCount")
private Long successCount;
@Schema(description = "message.domain.scenario_report_assertion_count")
@Schema(description = "message.domain.assertionCount")
private Long assertionCount;
@Schema(description = "message.domain.scenario_report_assertion_success_count")
@Schema(description = "message.domain.assertionSuccessCount")
private Long assertionSuccessCount;
@Schema(description = "message.domain.scenario_report_request_error_rate")
@Schema(description = "message.domain.requestErrorRate")
private String requestErrorRate;
@Schema(description = "message.domain.scenario_report_request_pending_rate")
@Schema(description = "message.domain.requestPendingRate")
private String requestPendingRate;
@Schema(description = "message.domain.scenario_report_request_fake_error_rate")
@Schema(description = "message.domain.requestFakeErrorRate")
private String requestFakeErrorRate;
@Schema(description = "message.domain.scenario_report_request_pass_rate")
@Schema(description = "message.domain.requestPassRate")
private String requestPassRate;
@Schema(description = "message.domain.scenario_report_assertion_pass_rate")
@Schema(description = "message.domain.assertionPassRate")
private String assertionPassRate;
}

View File

@ -20,7 +20,7 @@ public class ApiScenarioMessageDTO {
@Schema(description = "message.domain.api_scenario_stepTotal")
private Integer stepTotal;
@Schema(description = "message.domain.api_scenario_passRate")
@Schema(description = "message.domain.api_scenario_requestPassRate")
private String requestPassRate;
@Schema(description = "message.domain.api_scenario_lastReportStatus")
@ -53,61 +53,61 @@ public class ApiScenarioMessageDTO {
@Schema(description = "message.domain.api_scenario_updateTime")
private Long updateTime;
@Schema(description = "message.domain.scenario_report_url")
@Schema(description = "message.domain.api_scenario_reportUrl")
private String reportUrl;
@Schema(description = "message.domain.scenario_report_share_url")
@Schema(description = "message.domain.api_scenario_shareUrl")
private String shareUrl;
@Schema(description = "message.domain.scenario_report_name")
@Schema(description = "message.domain.api_scenario_reportName")
private String reportName;
@Schema(description = "message.domain.scenario_report_start_time")
@Schema(description = "message.domain.api_scenario_startTime")
private Long startTime;
@Schema(description = "message.domain.scenario_report_end_time")
@Schema(description = "message.domain.api_scenario_endTime")
private Long endTime;
@Schema(description = "message.domain.scenario_report_request_duration")
private Long requestDuration;
@Schema(description = "message.domain.api_scenario_requestDuration")
private Long requestDuration; //请求总耗时
@Schema(description = "message.domain.scenario_report_status")
@Schema(description = "message.domain.api_scenario_reportStatus")
private String reportStatus;
@Schema(description = "message.domain.scenario_report_environment")
@Schema(description = "message.domain.api_scenario_environment")
private String environment;
@Schema(description = "message.domain.scenario_report_error_count")
@Schema(description = "message.domain.api_scenario_errorCount")
private Long errorCount;
@Schema(description = "message.domain.scenario_report_fake_error_count")
@Schema(description = "message.domain.api_scenario_fakeErrorCount")
private Long fakeErrorCount;
@Schema(description = "message.domain.scenario_report_pending_count")
@Schema(description = "message.domain.api_scenario_pendingCount")
private Long pendingCount;
@Schema(description = "message.domain.scenario_report_success_count")
@Schema(description = "message.domain.api_scenario_successCount")
private Long successCount;
@Schema(description = "message.domain.scenario_report_assertion_count")
@Schema(description = "message.domain.api_scenario_assertionCount")
private Long assertionCount;
@Schema(description = "message.domain.scenario_report_assertion_success_count")
@Schema(description = "message.domain.api_scenario_assertionSuccessCount")
private Long assertionSuccessCount;
@Schema(description = "message.domain.scenario_report_request_error_rate")
@Schema(description = "message.domain.api_scenario_requestErrorRate")
private String requestErrorRate;
@Schema(description = "message.domain.scenario_report_request_pending_rate")
@Schema(description = "message.domain.api_scenario_requestPendingRate")
private String requestPendingRate;
@Schema(description = "message.domain.scenario_report_request_fake_error_rate")
@Schema(description = "message.domain.api_scenario_requestFakeErrorRate")
private String requestFakeErrorRate;
@Schema(description = "message.domain.scenario_report_request_pass_rate")
@Schema(description = "message.domain.api_scenario_reportRequestPassRate")
private String reportRequestPassRate;
@Schema(description = "message.domain.scenario_report_assertion_pass_rate")
@Schema(description = "message.domain.api_scenario_assertionPassRate")
private String assertionPassRate;

View File

@ -11,37 +11,37 @@ public class FunctionalCaseMessageDTO {
@Schema(description ="message.domain.name")
private String name;
@Schema(description = "message.domain.test_plan_name")
@Schema(description = "message.domain.testPlanName")
private String testPlanName;
@Schema(description = "message.domain.review_name")
@Schema(description = "message.domain.reviewName")
private String reviewName;
@Schema(description = "message.domain.review_status")
@Schema(description = "message.domain.reviewStatus")
private String reviewStatus;
@Schema(description = "message.domain.case_model")
@Schema(description = "message.domain.caseModel")
private String caseEditType;
@Schema(description = "message.domain.last_execute_result")
@Schema(description = "message.domain.lastExecuteResult")
private String lastExecuteResult;
@Schema(description = "message.domain.create_user")
@Schema(description = "message.domain.createUser")
private String createUser;
@Schema(description = "message.domain.update_user")
@Schema(description = "message.domain.updateUser")
private String updateUser;
@Schema(description = "message.domain.delete_user")
@Schema(description = "message.domain.deleteUser")
private String deleteUser;
@Schema(description = "message.domain.create_time")
@Schema(description = "message.domain.createTime")
private Long createTime;
@Schema(description = "message.domain.update_time")
@Schema(description = "message.domain.updateTime")
private Long updateTime;
@Schema(description = "message.domain.delete_time")
@Schema(description = "message.domain.deleteTime")
private Long deleteTime;
}

View File

@ -133,7 +133,7 @@ public abstract class AbstractNoticeSender implements NoticeSender {
LogUtils.error("查询关注人失败:{}", e);
}
}
default -> toUsers.add(new Receiver(userId, NotificationConstants.Type.MENTIONED_ME.name()));
default -> toUsers.add(new Receiver(userId, NotificationConstants.Type.SYSTEM_NOTICE.name()));
}
//TODO接口同步时通知的接收人特殊处理v2接口同步的通知v3这里待讨论

View File

@ -82,7 +82,7 @@ public class BaseCustomFieldService {
// 成员选项添加默认的选项
CustomFieldOption createUserOption = new CustomFieldOption();
createUserOption.setFieldId(item.getId());
createUserOption.setText(Translator.get("message.domain.create_user"));
createUserOption.setText(Translator.get("message.domain.createUser"));
createUserOption.setValue(CREATE_USER);
createUserOption.setInternal(false);
customFieldDTO.setOptions(List.of(createUserOption));

View File

@ -331,7 +331,7 @@
}
function getReceiverOptions(options, event: string) {
if (event === 'CREATE') {
if (event === 'CREATE' || event === 'CASE_CREATE' || event === 'MOCK_CREATE') {
//
options = options.filter((e) => !['OPERATOR', 'CREATE_USER', 'FOLLOW_PEOPLE'].includes(e.id));
}