fix(接口测试): 修复首页跳转本周新增,模块树与列表数据不一致的缺陷

--bug=1028002 --user=王孝刚
【接口测试】首页-接口数量统计-点击本周新增-跳转页面-模块树显示所有api数量-和右侧新增数量不一致
https://www.tapd.cn/55049933/s/1395120
This commit is contained in:
wxg0103 2023-07-19 15:53:36 +08:00 committed by fit2-zhao
parent bb8166f79d
commit a785a3fbdc
4 changed files with 18 additions and 1 deletions

View File

@ -13,6 +13,7 @@ import io.metersphere.base.mapper.ext.ExtApiTestCaseMapper;
import io.metersphere.commons.constants.*;
import io.metersphere.commons.enums.ApiTestDataStatus;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.DateUtils;
import io.metersphere.commons.utils.JSON;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.SessionUtils;
@ -167,6 +168,13 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
if (isCaseRelevance) {
countMNodes = extApiDefinitionMapper.moduleCaseCountByCollection(request);
} else {
if (request.isSelectThisWeedData()) {
Map<String, Date> weekFirstTimeAndLastTime = DateUtils.getWeedFirstTimeAndLastTime(new Date());
Date weekFirstTime = weekFirstTimeAndLastTime.get("firstTime");
if (weekFirstTime != null) {
request.setCreateTime(weekFirstTime.getTime());
}
}
countMNodes = extApiDefinitionMapper.moduleCountByCollection(request);
}
return getNodeTrees(apiModules, getCountMap(countMNodes));

View File

@ -15,6 +15,7 @@ import io.metersphere.commons.constants.PropertyConstant;
import io.metersphere.commons.constants.TestCaseConstants;
import io.metersphere.commons.enums.ApiTestDataStatus;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.DateUtils;
import io.metersphere.commons.utils.JSON;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.i18n.Translator;
@ -73,6 +74,13 @@ public class ApiScenarioModuleService extends NodeTreeService<ApiScenarioModuleD
filters.put(ApiTestConstants.STATUS, ApiTestConstants.STATUS_ALL);
request.setFilters(filters);
request.setModuleIds(new ArrayList<>());
if (request.isSelectThisWeedData()) {
Map<String, Date> weekFirstTimeAndLastTime = DateUtils.getWeedFirstTimeAndLastTime(new Date());
Date weekFirstTime = weekFirstTimeAndLastTime.get("firstTime");
if (weekFirstTime != null) {
request.setCreateTime(weekFirstTime.getTime());
}
}
List<ApiScenarioModuleDTO> moduleCountList = extApiScenarioMapper.listModuleByCollection(request);
return getNodeTrees(nodes, getCountMap(moduleCountList));

View File

@ -859,7 +859,6 @@ export default {
}
},
search(projectId) {
this.$EventBus.$emit('scenarioConditionBus', this.condition);
this.nodeChange(projectId);
},
nodeChange(projectId) {
@ -934,6 +933,7 @@ export default {
}
}
}
this.$EventBus.$emit('scenarioConditionBus', this.condition);
if (this.condition.projectId) {
this.result = getScenarioList(this.currentPage, this.pageSize, this.condition).then((response) => {
let data = response.data;

View File

@ -163,6 +163,7 @@ export default {
created() {
this.$EventBus.$on('scenarioConditionBus', (param) => {
this.param = param;
this.list()
});
},
beforeDestroy() {