diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/controller/BugController.java b/backend/services/bug-management/src/main/java/io/metersphere/bug/controller/BugController.java index 0382be7436..15160d5391 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/controller/BugController.java +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/controller/BugController.java @@ -147,7 +147,7 @@ public class BugController { @GetMapping("/sync/check/{projectId}") @Operation(summary = "缺陷管理-列表-校验缺陷同步状态") - @RequiresPermissions(PermissionConstants.PROJECT_BUG_READ) + @RequiresPermissions(PermissionConstants.PROJECT_BUG_UPDATE) @CheckOwner(resourceId = "#projectId", resourceType = "project") public BugSyncResult checkStatus(@PathVariable String projectId) { return bugSyncService.checkSyncStatus(projectId); diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/controller/BugHistoryController.java b/backend/services/bug-management/src/main/java/io/metersphere/bug/controller/BugHistoryController.java index 3e74120b0c..892c9f98db 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/controller/BugHistoryController.java +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/controller/BugHistoryController.java @@ -2,10 +2,10 @@ package io.metersphere.bug.controller; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; -import io.metersphere.bug.dto.request.BugHistoryPageRequest; import io.metersphere.bug.service.BugHistoryService; import io.metersphere.sdk.constants.PermissionConstants; import io.metersphere.system.dto.OperationHistoryDTO; +import io.metersphere.system.dto.request.OperationHistoryRequest; import io.metersphere.system.security.CheckOwner; import io.metersphere.system.utils.PageUtils; import io.metersphere.system.utils.Pager; @@ -34,7 +34,7 @@ public class BugHistoryController { @Operation(summary = "缺陷管理-变更历史-列表") @RequiresPermissions(PermissionConstants.PROJECT_BUG_READ) @CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project") - public Pager> page(@Validated @RequestBody BugHistoryPageRequest request) { + public Pager> page(@Validated @RequestBody OperationHistoryRequest request) { Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "id desc"); return PageUtils.setPageInfo(page, bugHistoryService.list(request)); diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugHistoryService.java b/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugHistoryService.java index 0f38df599d..c111c51974 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugHistoryService.java +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugHistoryService.java @@ -1,8 +1,8 @@ package io.metersphere.bug.service; -import io.metersphere.bug.dto.request.BugHistoryPageRequest; import io.metersphere.sdk.util.CommonBeanFactory; import io.metersphere.system.dto.OperationHistoryDTO; +import io.metersphere.system.dto.request.OperationHistoryRequest; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -12,7 +12,7 @@ import java.util.List; @Transactional(rollbackFor = Exception.class) public class BugHistoryService { - public List list(BugHistoryPageRequest request) { + public List list(OperationHistoryRequest request) { XpackBugService bugService = CommonBeanFactory.getBean(XpackBugService.class); if (bugService != null) { return bugService.listHis(request); diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/service/XpackBugService.java b/backend/services/bug-management/src/main/java/io/metersphere/bug/service/XpackBugService.java index 7b27f3bc76..b2cdeee30a 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/service/XpackBugService.java +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/service/XpackBugService.java @@ -1,9 +1,9 @@ package io.metersphere.bug.service; -import io.metersphere.bug.dto.request.BugHistoryPageRequest; import io.metersphere.bug.dto.request.BugSyncRequest; import io.metersphere.project.domain.Project; import io.metersphere.system.dto.OperationHistoryDTO; +import io.metersphere.system.dto.request.OperationHistoryRequest; import java.util.List; @@ -30,5 +30,5 @@ public interface XpackBugService { * @param request 请求参数 * @return 变更历史集合 */ - List listHis(BugHistoryPageRequest request); + List listHis(OperationHistoryRequest request); } diff --git a/backend/services/bug-management/src/test/java/io/metersphere/bug/controller/BugHistoryControllerTests.java b/backend/services/bug-management/src/test/java/io/metersphere/bug/controller/BugHistoryControllerTests.java index e673a8fa89..3b78e37950 100644 --- a/backend/services/bug-management/src/test/java/io/metersphere/bug/controller/BugHistoryControllerTests.java +++ b/backend/services/bug-management/src/test/java/io/metersphere/bug/controller/BugHistoryControllerTests.java @@ -1,7 +1,7 @@ package io.metersphere.bug.controller; -import io.metersphere.bug.dto.request.BugHistoryPageRequest; import io.metersphere.system.base.BaseTest; +import io.metersphere.system.dto.request.OperationHistoryRequest; import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -26,8 +26,8 @@ public class BugHistoryControllerTests extends BaseTest { @Order(1) @Sql(scripts = {"/dml/init_bug_history.sql"}, config = @SqlConfig(encoding = "utf-8", transactionMode = SqlConfig.TransactionMode.ISOLATED)) void testBugHistoryPageSuccess() throws Exception { - BugHistoryPageRequest request = new BugHistoryPageRequest(); - request.setBugId("bug-history-id"); + OperationHistoryRequest request = new OperationHistoryRequest(); + request.setSourceId("bug-history-id"); request.setProjectId("100001100001"); request.setCurrent(1); request.setPageSize(10); diff --git a/backend/services/bug-management/src/test/java/io/metersphere/bug/mock/XpackBugMockServiceImpl.java b/backend/services/bug-management/src/test/java/io/metersphere/bug/mock/XpackBugMockServiceImpl.java index 8898a14024..de6be110f8 100644 --- a/backend/services/bug-management/src/test/java/io/metersphere/bug/mock/XpackBugMockServiceImpl.java +++ b/backend/services/bug-management/src/test/java/io/metersphere/bug/mock/XpackBugMockServiceImpl.java @@ -1,10 +1,10 @@ package io.metersphere.bug.mock; -import io.metersphere.bug.dto.request.BugHistoryPageRequest; import io.metersphere.bug.dto.request.BugSyncRequest; import io.metersphere.bug.service.XpackBugService; import io.metersphere.project.domain.Project; import io.metersphere.system.dto.OperationHistoryDTO; +import io.metersphere.system.dto.request.OperationHistoryRequest; import org.springframework.stereotype.Service; import java.util.List; @@ -23,7 +23,7 @@ public class XpackBugMockServiceImpl implements XpackBugService { } @Override - public List listHis(BugHistoryPageRequest request) { + public List listHis(OperationHistoryRequest request) { return List.of(); } } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/job/CleanOrganizationJob.java b/backend/services/system-setting/src/main/java/io/metersphere/system/job/CleanOrganizationJob.java index cced2ae236..d050a09cbd 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/job/CleanOrganizationJob.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/job/CleanOrganizationJob.java @@ -31,8 +31,7 @@ public class CleanOrganizationJob { public void cleanOrganization() { LogUtils.info("clean up organization start."); try { - //TODO 为了测试改成一天 正是后改成一个月 - LocalDate date = LocalDate.now().minusDays(1); + LocalDate date = LocalDate.now().minusMonths(1); long timestamp = date.atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli(); this.doCleanupOrganization(timestamp); } catch (Exception e) { diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/job/CleanProjectJob.java b/backend/services/system-setting/src/main/java/io/metersphere/system/job/CleanProjectJob.java index 1fafc7f3c1..a8fb5833b4 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/job/CleanProjectJob.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/job/CleanProjectJob.java @@ -28,8 +28,7 @@ public class CleanProjectJob { @QuartzScheduled(cron = "0 0 3 * * ?") public void cleanupProject() { LogUtils.info("clean up project start."); - //TODO 为了测试改成一天 正是后改成一个月 - LocalDate date = LocalDate.now().minusDays(1); + LocalDate date = LocalDate.now().minusMonths(1); long timestamp = date.atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli(); this.doCleanupProject(timestamp); LogUtils.info("clean up project end.");