fix(接口测试): 修复场景开启关闭定时任务不发通知的缺陷
--bug=1039786 --user=王孝刚 【接口测试】场景-场景列表开启/关闭定时任务失败,导致发通知失败 https://www.tapd.cn/55049933/s/1501995
This commit is contained in:
parent
e7a8fd38ab
commit
9dd8567dc6
|
@ -214,7 +214,7 @@ public class ApiScenarioController {
|
||||||
@GetMapping(value = "/schedule-config-delete/{scenarioId}")
|
@GetMapping(value = "/schedule-config-delete/{scenarioId}")
|
||||||
@Operation(summary = "接口测试-接口场景管理-删除定时任务配置")
|
@Operation(summary = "接口测试-接口场景管理-删除定时任务配置")
|
||||||
@RequiresPermissions(PermissionConstants.PROJECT_API_SCENARIO_EXECUTE)
|
@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")
|
@CheckOwner(resourceId = "#scenarioId", resourceType = "api_scenario")
|
||||||
public void deleteScheduleConfig(@PathVariable String scenarioId) {
|
public void deleteScheduleConfig(@PathVariable String scenarioId) {
|
||||||
apiValidateService.validateApiMenuInProject(scenarioId, ApiResource.API_SCENARIO.name());
|
apiValidateService.validateApiMenuInProject(scenarioId, ApiResource.API_SCENARIO.name());
|
||||||
|
|
|
@ -118,7 +118,9 @@ public class ScheduleService {
|
||||||
ScheduleExample example = new ScheduleExample();
|
ScheduleExample example = new ScheduleExample();
|
||||||
example.createCriteria().andResourceIdEqualTo(scheduleConfig.getResourceId()).andJobEqualTo(clazz.getName());
|
example.createCriteria().andResourceIdEqualTo(scheduleConfig.getResourceId()).andJobEqualTo(clazz.getName());
|
||||||
List<Schedule> scheduleList = scheduleMapper.selectByExample(example);
|
List<Schedule> scheduleList = scheduleMapper.selectByExample(example);
|
||||||
|
boolean needSendNotice = false;
|
||||||
if (CollectionUtils.isNotEmpty(scheduleList)) {
|
if (CollectionUtils.isNotEmpty(scheduleList)) {
|
||||||
|
needSendNotice = !scheduleList.getFirst().getEnable().equals(scheduleConfig.getEnable());
|
||||||
schedule = scheduleConfig.genCronSchedule(scheduleList.getFirst());
|
schedule = scheduleConfig.genCronSchedule(scheduleList.getFirst());
|
||||||
schedule.setUpdateTime(System.currentTimeMillis());
|
schedule.setUpdateTime(System.currentTimeMillis());
|
||||||
schedule.setJob(clazz.getName());
|
schedule.setJob(clazz.getName());
|
||||||
|
@ -134,7 +136,7 @@ public class ScheduleService {
|
||||||
}
|
}
|
||||||
//通知
|
//通知
|
||||||
if ((CollectionUtils.isEmpty(scheduleList) && BooleanUtils.isTrue(scheduleConfig.getEnable()))
|
if ((CollectionUtils.isEmpty(scheduleList) && BooleanUtils.isTrue(scheduleConfig.getEnable()))
|
||||||
|| (CollectionUtils.isNotEmpty(scheduleList) && !scheduleList.getFirst().getEnable().equals(scheduleConfig.getEnable()))) {
|
|| needSendNotice) {
|
||||||
apiScheduleNoticeService.sendScheduleNotice(schedule, operator);
|
apiScheduleNoticeService.sendScheduleNotice(schedule, operator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -395,7 +395,7 @@
|
||||||
const defaultForm: ImportApiDefinitionRequest = {
|
const defaultForm: ImportApiDefinitionRequest = {
|
||||||
platform: RequestImportFormat.SWAGGER,
|
platform: RequestImportFormat.SWAGGER,
|
||||||
name: '',
|
name: '',
|
||||||
moduleId: 'root',
|
moduleId: '',
|
||||||
coverData: false,
|
coverData: false,
|
||||||
syncCase: true,
|
syncCase: true,
|
||||||
coverModule: false,
|
coverModule: false,
|
||||||
|
|
Loading…
Reference in New Issue