fix(测试跟踪): 缺陷定时同步失效
--bug=1025486 --user=陈建星 【测试跟踪】测试计划-关联功能用例-列表数据仍显示上传一次切换项目的数据 https://www.tapd.cn/55049933/s/1363688
This commit is contained in:
parent
7d2e99adaf
commit
8712e319be
|
@ -1,6 +1,7 @@
|
|||
package io.metersphere.job.schedule;
|
||||
|
||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.sechedule.MsScheduleJob;
|
||||
import io.metersphere.service.IssuesService;
|
||||
import io.metersphere.xpack.license.dto.LicenseDTO;
|
||||
|
@ -27,9 +28,12 @@ public class IssueSyncJob extends MsScheduleJob {
|
|||
public void businessExecute(JobExecutionContext context) {
|
||||
LicenseDTO licenseDTO = licenseService.validate();
|
||||
if (licenseDTO != null && licenseDTO.getLicense() != null) {
|
||||
LogUtil.info("sync all issue start");
|
||||
xpackIssueService.syncThirdPartyIssues();
|
||||
} else {
|
||||
LogUtil.info("sync issue start");
|
||||
issuesService.syncThirdPartyIssues();
|
||||
}
|
||||
LogUtil.info("sync issue end");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.listener;
|
||||
|
||||
import io.metersphere.commons.constants.ScheduleGroup;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.RunInterface;
|
||||
import io.metersphere.service.*;
|
||||
|
@ -25,11 +26,15 @@ public class InitListener implements ApplicationRunner {
|
|||
private CustomFieldResourceCompatibleService customFieldResourceCompatibleService;
|
||||
@Resource
|
||||
private PlatformPluginService platformPluginService;
|
||||
@Resource
|
||||
private BaseScheduleService scheduleService;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments applicationArguments) throws Exception {
|
||||
this.initOnceOperate();
|
||||
platformPluginService.loadPlatFormPlugins();
|
||||
|
||||
scheduleService.startEnableSchedules(ScheduleGroup.ISSUE_SYNC);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -73,6 +73,7 @@ import org.mybatis.spring.SqlSessionUtils;
|
|||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
@ -145,6 +146,9 @@ public class IssuesService {
|
|||
private UserService userService;
|
||||
@Resource
|
||||
private BasePluginService basePluginService;
|
||||
@Resource
|
||||
@Lazy
|
||||
private IssuesService issuesService;
|
||||
|
||||
private static final String SYNC_THIRD_PARTY_ISSUES_KEY = "ISSUE:SYNC";
|
||||
|
||||
|
@ -872,7 +876,8 @@ public class IssuesService {
|
|||
List<String> projectIds = trackProjectService.getThirdPartProjectIds();
|
||||
projectIds.forEach(id -> {
|
||||
try {
|
||||
syncThirdPartyIssues(id);
|
||||
// 使用代理对象调用,防止事务注解失效
|
||||
issuesService.syncThirdPartyIssues(id);
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
}
|
||||
|
@ -915,6 +920,7 @@ public class IssuesService {
|
|||
stringRedisTemplate.delete(SYNC_THIRD_PARTY_ISSUES_KEY + ":" + projectId);
|
||||
}
|
||||
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||
public boolean syncThirdPartyIssues(String projectId) {
|
||||
if (StringUtils.isNotBlank(projectId)) {
|
||||
String syncValue = getSyncKey(projectId);
|
||||
|
|
Loading…
Reference in New Issue