fix(接口测试): 修复场景开启关闭定时任务不发通知的缺陷

--bug=1039786 --user=王孝刚 【接口测试】场景-场景列表开启/关闭定时任务失败,导致发通知失败
https://www.tapd.cn/55049933/s/1501995
This commit is contained in:
wxg0103 2024-04-19 14:11:08 +08:00 committed by Craftsman
parent e7a8fd38ab
commit 9dd8567dc6
3 changed files with 5 additions and 3 deletions

View File

@ -214,7 +214,7 @@ public class ApiScenarioController {
@GetMapping(value = "/schedule-config-delete/{scenarioId}")
@Operation(summary = "接口测试-接口场景管理-删除定时任务配置")
@RequiresPermissions(PermissionConstants.PROJECT_API_SCENARIO_EXECUTE)
@Log(type = OperationLogType.UPDATE, expression = "#msClass.scheduleLog(#request.getScenarioId())", msClass = ApiScenarioLogService.class)
@Log(type = OperationLogType.UPDATE, expression = "#msClass.scheduleLog(#scenarioId)", msClass = ApiScenarioLogService.class)
@CheckOwner(resourceId = "#scenarioId", resourceType = "api_scenario")
public void deleteScheduleConfig(@PathVariable String scenarioId) {
apiValidateService.validateApiMenuInProject(scenarioId, ApiResource.API_SCENARIO.name());

View File

@ -118,7 +118,9 @@ public class ScheduleService {
ScheduleExample example = new ScheduleExample();
example.createCriteria().andResourceIdEqualTo(scheduleConfig.getResourceId()).andJobEqualTo(clazz.getName());
List<Schedule> scheduleList = scheduleMapper.selectByExample(example);
boolean needSendNotice = false;
if (CollectionUtils.isNotEmpty(scheduleList)) {
needSendNotice = !scheduleList.getFirst().getEnable().equals(scheduleConfig.getEnable());
schedule = scheduleConfig.genCronSchedule(scheduleList.getFirst());
schedule.setUpdateTime(System.currentTimeMillis());
schedule.setJob(clazz.getName());
@ -134,7 +136,7 @@ public class ScheduleService {
}
//通知
if ((CollectionUtils.isEmpty(scheduleList) && BooleanUtils.isTrue(scheduleConfig.getEnable()))
|| (CollectionUtils.isNotEmpty(scheduleList) && !scheduleList.getFirst().getEnable().equals(scheduleConfig.getEnable()))) {
|| needSendNotice) {
apiScheduleNoticeService.sendScheduleNotice(schedule, operator);
}

View File

@ -395,7 +395,7 @@
const defaultForm: ImportApiDefinitionRequest = {
platform: RequestImportFormat.SWAGGER,
name: '',
moduleId: 'root',
moduleId: '',
coverData: false,
syncCase: true,
coverModule: false,