feat(接口管理): 接口定义单独删除接口新增消息通知

--bug=1038171 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001038171
This commit is contained in:
guoyuqi 2024-04-08 11:36:37 +08:00 committed by 刘瑞斌
parent b262b60c2c
commit c2c1dfa852
4 changed files with 11 additions and 1 deletions

View File

@ -141,6 +141,7 @@ public class ApiDefinitionController {
@RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_DELETE) @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_DELETE)
@Log(type = OperationLogType.DELETE, expression = "#msClass.moveToGcLog(#id)", msClass = ApiDefinitionLogService.class) @Log(type = OperationLogType.DELETE, expression = "#msClass.moveToGcLog(#id)", msClass = ApiDefinitionLogService.class)
@CheckOwner(resourceId = "#id", resourceType = "api_definition") @CheckOwner(resourceId = "#id", resourceType = "api_definition")
@SendNotice(taskType = NoticeConstants.TaskType.API_DEFINITION_TASK, event = NoticeConstants.Event.DELETE, target = "#targetClass.getEditApiDTO(#id)", targetClass = ApiDefinitionNoticeService.class)
public void deleteToGc(@PathVariable String id, @RequestParam(required = false) boolean deleteAllVersion) { public void deleteToGc(@PathVariable String id, @RequestParam(required = false) boolean deleteAllVersion) {
apiDefinitionService.deleteToGc(id, deleteAllVersion, SessionUtils.getUserId()); apiDefinitionService.deleteToGc(id, deleteAllVersion, SessionUtils.getUserId());
} }

View File

@ -84,6 +84,12 @@ public class ApiDefinitionNoticeService {
return handleBatchNotice(ids); return handleBatchNotice(ids);
} }
public List<ApiDefinitionCaseDTO> getEditApiDTO(String id) {
List<String> ids = new ArrayList<>();
ids.add(id);
return handleBatchNotice(ids);
}
private List<ApiDefinitionCaseDTO> handleBatchNotice(List<String> ids) { private List<ApiDefinitionCaseDTO> handleBatchNotice(List<String> ids) {
List<ApiDefinitionCaseDTO> dtoList = new ArrayList<>(); List<ApiDefinitionCaseDTO> dtoList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(ids)) { if (CollectionUtils.isNotEmpty(ids)) {

View File

@ -87,6 +87,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
private final static String UPDATE = "update"; private final static String UPDATE = "update";
private final static String BATCH_UPDATE = "batch-update"; private final static String BATCH_UPDATE = "batch-update";
private final static String DELETE_TO_GC = "delete-to-gc/{0}?deleteAllVersion={1}"; private final static String DELETE_TO_GC = "delete-to-gc/{0}?deleteAllVersion={1}";
private final static String SINGLE_DELETE_TO_GC = "delete-to-gc/";
private final static String BATCH_DELETE_TO_GC = "batch/delete-to-gc"; private final static String BATCH_DELETE_TO_GC = "batch/delete-to-gc";
private final static String COPY = "copy"; private final static String COPY = "copy";
private final static String BATCH_MOVE = "batch-move"; private final static String BATCH_MOVE = "batch-move";
@ -1231,6 +1232,8 @@ public class ApiDefinitionControllerTests extends BaseTest {
Assertions.assertEquals("admin", apiDefinitionInfo.getDeleteUser()); Assertions.assertEquals("admin", apiDefinitionInfo.getDeleteUser());
Assertions.assertNotNull(apiDefinitionInfo.getDeleteTime()); Assertions.assertNotNull(apiDefinitionInfo.getDeleteTime());
this.requestGetWithOk(SINGLE_DELETE_TO_GC+"/"+apiDefinition.getId());
// @存在多个版本 // @存在多个版本
String id = "1004"; String id = "1004";
// 列表删除 // 列表删除

View File

@ -17,7 +17,7 @@ public class CleanNotificationJob {
private BaseNotificationMapper baseNotificationMapper; private BaseNotificationMapper baseNotificationMapper;
/** /**
* 清理状态为删除的项目 每天凌晨三点执行 * 清理90天前的站内通知 每天凌晨三点执行
*/ */
@QuartzScheduled(cron = "0 0 3 * * ?") @QuartzScheduled(cron = "0 0 3 * * ?")
public void cleanupNotification() { public void cleanupNotification() {