fix(项目管理): 同步缺陷Cron表达式打印有误

--bug=1039563 --user=宋昌昌 【项目管理】项目与权限-缺陷管理-同步缺陷设置6小时增量同步一次不生效 https://www.tapd.cn/55049933/s/1501982
This commit is contained in:
song-cc-rock 2024-04-19 16:23:42 +08:00 committed by Craftsman
parent 98b4b1d868
commit fa68d41013
5 changed files with 16 additions and 15 deletions

View File

@ -45,26 +45,28 @@ public class BugSyncJob extends BaseScheduleJob {
if (!checkBeforeSync(resourceId)) { if (!checkBeforeSync(resourceId)) {
return; return;
} }
LogUtils.info("bug sync job start......"); LogUtils.info("Start verify license and synchronizing bugs");
try{ try{
if (licenseService == null) { if (licenseService == null) {
LogUtils.info("license is null, sync remain bug"); // 没有License, 同步存量缺陷
LogUtils.info("No license, synchronization stock bug");
bugSyncService.syncPlatformBugBySchedule(resourceId, userId); bugSyncService.syncPlatformBugBySchedule(resourceId, userId);
} else { } else {
LicenseDTO licenseDTO = licenseService.validate(); LicenseDTO licenseDTO = licenseService.validate();
if (licenseDTO != null && licenseDTO.getLicense() != null if (licenseDTO != null && licenseDTO.getLicense() != null
&& StringUtils.equals(licenseDTO.getStatus(), "valid")) { && StringUtils.equals(licenseDTO.getStatus(), "valid")) {
LogUtils.info("license is valid, sync all bug"); // License校验成功, 同步全量缺陷
LogUtils.info("License verification successful, synchronization full bug");
bugSyncService.syncPlatformAllBugBySchedule(resourceId, userId); bugSyncService.syncPlatformAllBugBySchedule(resourceId, userId);
} else { } else {
LogUtils.info("license is invalid, sync remain bug"); // License校验失败, 同步存量缺陷
LogUtils.info("License verification failed, synchronization stock bug");
bugSyncService.syncPlatformBugBySchedule(resourceId, userId); bugSyncService.syncPlatformBugBySchedule(resourceId, userId);
} }
} }
} catch (Exception e) { } catch (Exception e) {
LogUtils.error(e.getMessage()); LogUtils.error(e.getMessage());
} }
LogUtils.info("bug sync job end......");
} }
/** /**

View File

@ -549,12 +549,13 @@ public class BugService {
// 分页同步 // 分页同步
SubListUtils.dealForSubList(remainBugs, 100, (subBugs) -> doSyncPlatformBugs(subBugs, project)); SubListUtils.dealForSubList(remainBugs, 100, (subBugs) -> doSyncPlatformBugs(subBugs, project));
} catch (Exception e) { } catch (Exception e) {
LogUtils.error(e); LogUtils.error("Synchronization bugs exception occurred :" + e.getMessage());
// 异常或正常结束都得删除当前项目执行同步的Key // 异常或正常结束都得删除当前项目执行同步的Key
bugSyncExtraService.deleteSyncKey(project.getId()); bugSyncExtraService.deleteSyncKey(project.getId());
// 同步缺陷异常, 当前同步错误信息 -> Redis(check接口获取) // 同步缺陷异常, 当前同步错误信息 -> Redis(check接口获取)
bugSyncExtraService.setSyncErrorMsg(project.getId(), e.getMessage()); bugSyncExtraService.setSyncErrorMsg(project.getId(), e.getMessage());
} finally { } finally {
LogUtils.info("Synchronization bugs end......");
// 异常或正常结束都得删除当前项目执行同步的Key // 异常或正常结束都得删除当前项目执行同步的Key
bugSyncExtraService.deleteSyncKey(project.getId()); bugSyncExtraService.deleteSyncKey(project.getId());
// 发送同步通知 // 发送同步通知

View File

@ -13,7 +13,6 @@ import io.metersphere.project.service.ProjectTemplateService;
import io.metersphere.sdk.constants.TemplateScene; import io.metersphere.sdk.constants.TemplateScene;
import io.metersphere.sdk.exception.MSException; import io.metersphere.sdk.exception.MSException;
import io.metersphere.sdk.util.CommonBeanFactory; import io.metersphere.sdk.util.CommonBeanFactory;
import io.metersphere.sdk.util.LogUtils;
import io.metersphere.sdk.util.Translator; import io.metersphere.sdk.util.Translator;
import io.metersphere.system.domain.Template; import io.metersphere.system.domain.Template;
import io.metersphere.system.domain.TemplateExample; import io.metersphere.system.domain.TemplateExample;
@ -162,7 +161,6 @@ public class BugSyncService {
} }
} }
} catch (Exception e) { } catch (Exception e) {
LogUtils.error(e);
// 异常或正常结束都得删除当前项目执行同步的唯一Key // 异常或正常结束都得删除当前项目执行同步的唯一Key
bugSyncExtraService.deleteSyncKey(projectId); bugSyncExtraService.deleteSyncKey(projectId);
// 同步缺陷异常, 当前同步错误信息 -> Redis(check接口获取) // 同步缺陷异常, 当前同步错误信息 -> Redis(check接口获取)

View File

@ -20,7 +20,6 @@ public abstract class BaseScheduleJob implements Job {
this.expression = jobDataMap.getString("expression"); this.expression = jobDataMap.getString("expression");
LogUtils.info(jobKey.getGroup() + " Running: " + resourceId); LogUtils.info(jobKey.getGroup() + " Running: " + resourceId);
LogUtils.info("CronExpression: " + expression);
businessExecute(context); businessExecute(context);
} }

View File

@ -824,6 +824,7 @@
console.log(e); console.log(e);
} }
}; };
const fetchData = async () => { const fetchData = async () => {
await loadList(); await loadList();
}; };
@ -857,6 +858,12 @@
} }
}; };
async function initMenuData() {
setLoadListParams({ projectId: currentProjectId.value });
await fetchData();
await initExpendKeys();
}
// //
const handleRowClick = (record: TableData) => { const handleRowClick = (record: TableData) => {
if (record.module) { if (record.module) {
@ -864,12 +871,6 @@
} }
}; };
function initMenuData() {
setLoadListParams({ projectId: currentProjectId.value });
fetchData();
initExpendKeys();
}
onMounted(() => { onMounted(() => {
initMenuData(); initMenuData();
}); });