fix:定时插入缺陷修改
This commit is contained in:
parent
d07153a182
commit
fe677b0b40
|
@ -1,11 +1,16 @@
|
||||||
package io.metersphere.job.sechedule;
|
package io.metersphere.job.sechedule;
|
||||||
|
|
||||||
import com.fit2cloud.quartz.anno.QuartzScheduled;
|
import com.fit2cloud.quartz.anno.QuartzScheduled;
|
||||||
|
import com.github.pagehelper.Page;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
import io.metersphere.base.domain.IssuesDao;
|
import io.metersphere.base.domain.IssuesDao;
|
||||||
|
import io.metersphere.base.domain.TestPlanTestCase;
|
||||||
import io.metersphere.base.domain.TestPlanTestCaseWithBLOBs;
|
import io.metersphere.base.domain.TestPlanTestCaseWithBLOBs;
|
||||||
|
import io.metersphere.commons.utils.LogUtil;
|
||||||
import io.metersphere.track.service.IssuesService;
|
import io.metersphere.track.service.IssuesService;
|
||||||
import io.metersphere.track.service.TestPlanTestCaseService;
|
import io.metersphere.track.service.TestPlanTestCaseService;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -19,17 +24,22 @@ public class IssuesJob {
|
||||||
@QuartzScheduled(fixedDelay = 3600 * 1000)
|
@QuartzScheduled(fixedDelay = 3600 * 1000)
|
||||||
//@Scheduled(fixedDelay = 120 * 1000)
|
//@Scheduled(fixedDelay = 120 * 1000)
|
||||||
public void IssuesCount() {
|
public void IssuesCount() {
|
||||||
/*int pageSize = 100;
|
int pageSize = 100;
|
||||||
int pages = 0;
|
int pages = 1;
|
||||||
Page<List<TestPlanTestCase>> page = PageHelper.startPage(pages, pageSize, true);
|
for (int i = 0; i < pages; i++) {
|
||||||
pages = page.getPages();
|
Page<List<TestPlanTestCase>> page = PageHelper.startPage(i, pageSize, true);
|
||||||
for (int i = 0; i < pages; i++) {*/
|
|
||||||
List<TestPlanTestCaseWithBLOBs> list = testPlanTestCaseService.listAll();
|
List<TestPlanTestCaseWithBLOBs> list = testPlanTestCaseService.listAll();
|
||||||
|
pages = page.getPages();// 替换成真实的值
|
||||||
list.forEach(l -> {
|
list.forEach(l -> {
|
||||||
|
try {
|
||||||
List<IssuesDao> issues = issuesService.getIssues(l.getCaseId());
|
List<IssuesDao> issues = issuesService.getIssues(l.getCaseId());
|
||||||
int issuesCount = issues.size();
|
int issuesCount = issues.size();
|
||||||
testPlanTestCaseService.updateIssues(issuesCount, l.getPlanId(), l.getCaseId(), issues.toString());
|
testPlanTestCaseService.updateIssues(issuesCount, l.getPlanId(), l.getCaseId(), issues.toString());
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error("定时任务处理bug数量报错planId: " + l.getPlanId(), e);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue