fix: #1007479#1007454 服务集成中的提示图片无法显示 【模块统计】左侧模块树统计数量,只有场景统计了,修复mock期望匹配时参数获取错误导致的匹配失败问题

--bug=1007479 --user=宋天阳 服务集成中的提示图片无法显示
https://www.tapd.cn/55049933/s/1059464;--bug=1007454 --user=宋天阳
【模块统计】左侧模块树统计数量,只有场景统计了 https://www.tapd.cn/55049933/s/1059466,修复mock期望匹配时参数获取错误导致的匹配失败问题
This commit is contained in:
song-tianyang 2021-10-27 13:47:02 +08:00 committed by song-tianyang
parent 231d9c4859
commit 637a640c42
19 changed files with 65 additions and 18 deletions

View File

@ -31,6 +31,13 @@ public class ApiModuleController {
return apiModuleService.getNodeTreeByProjectId(projectId, protocol); return apiModuleService.getNodeTreeByProjectId(projectId, protocol);
} }
@GetMapping("/trashCount/{projectId}/{protocol}")
public long trashCount(@PathVariable String projectId, @PathVariable String protocol) {
String userId = SessionUtils.getUserId();
ApiDefinitionDefaultApiTypeUtil.addUserSelectApiType(userId, protocol);
return apiModuleService.countTrashApiData(projectId, protocol);
}
@GetMapping("/getModuleByName/{projectId}/{protocol}") @GetMapping("/getModuleByName/{projectId}/{protocol}")
public ApiModule getModuleByName(@PathVariable String projectId, @PathVariable String protocol) { public ApiModule getModuleByName(@PathVariable String projectId, @PathVariable String protocol) {
// checkPermissionService.checkProjectOwner(projectId); // checkPermissionService.checkProjectOwner(projectId);

View File

@ -446,12 +446,16 @@ public class MockApiUtils {
RequestMockParams returnParams = getGetParamMap(urlParams,apiPath,queryParamsObject); RequestMockParams returnParams = getGetParamMap(urlParams,apiPath,queryParamsObject);
if(paramJson != null){ if(paramJson != null){
if (paramJson instanceof JSONObject) { if (paramJson instanceof JSONObject) {
JSONArray paramsArray = new JSONArray(); if(!((JSONObject) paramJson).isEmpty()){
paramsArray.add(paramJson); JSONArray paramsArray = new JSONArray();
returnParams.setBodyParams(paramsArray); paramsArray.add(paramJson);
returnParams.setBodyParams(paramsArray);
}
} else if (paramJson instanceof JSONArray) { } else if (paramJson instanceof JSONArray) {
JSONArray paramArray = (JSONArray) paramJson; JSONArray paramArray = (JSONArray) paramJson;
returnParams.setBodyParams(paramArray); if(!paramArray.isEmpty()){
returnParams.setBodyParams(paramArray);
}
} }
} }
return returnParams; return returnParams;
@ -527,13 +531,6 @@ public class MockApiUtils {
if(StringUtils.isNotEmpty(bodyParam)){ if(StringUtils.isNotEmpty(bodyParam)){
object.put("raw",bodyParam); object.put("raw",bodyParam);
} }
Enumeration<String> paramNameItor = request.getParameterNames();
while (paramNameItor.hasMoreElements()) {
String key = paramNameItor.nextElement();
String value = request.getParameter(key);
object.put(key, value);
}
return object; return object;
} }
} }

View File

@ -217,7 +217,6 @@ public class ApiDefinitionService {
return resList; return resList;
} }
/** /**
* 初始化部分参数 * 初始化部分参数
* *

View File

@ -43,6 +43,8 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
@Resource @Resource
private ExtApiDefinitionMapper extApiDefinitionMapper; private ExtApiDefinitionMapper extApiDefinitionMapper;
@Resource @Resource
private ApiDefinitionMapper apiDefinitionMapper;
@Resource
private TestPlanProjectService testPlanProjectService; private TestPlanProjectService testPlanProjectService;
@Resource @Resource
private ProjectService projectService; private ProjectService projectService;
@ -539,4 +541,10 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
return list.get(0); return list.get(0);
} }
} }
public long countTrashApiData(String projectId, String protocol) {
ApiDefinitionExample example = new ApiDefinitionExample();
example.createCriteria().andProjectIdEqualTo(projectId).andProtocolEqualTo(protocol).andStatusEqualTo("Trash");
return apiDefinitionMapper.countByExample(example);
}
} }

View File

@ -29,6 +29,12 @@ public class TestCaseNodeController {
return testCaseNodeService.getNodeTreeByProjectId(projectId); return testCaseNodeService.getNodeTreeByProjectId(projectId);
} }
@GetMapping("/trashCount/{projectId}")
public long trashCount(@PathVariable String projectId) {
checkPermissionService.checkProjectOwner(projectId);
return testCaseNodeService.trashCount(projectId);
}
/*模块列表列表*/ /*模块列表列表*/
@PostMapping("/list/all/plan") @PostMapping("/list/all/plan")
public List<TestCaseNodeDTO> getAllNodeByPlanId(@RequestBody QueryNodeRequest request) { public List<TestCaseNodeDTO> getAllNodeByPlanId(@RequestBody QueryNodeRequest request) {

View File

@ -764,4 +764,10 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
} }
return returnList; return returnList;
} }
public long trashCount(String projectId) {
TestCaseExample testCaseExample = new TestCaseExample();
testCaseExample.createCriteria().andProjectIdEqualTo(projectId).andStatusEqualTo("Trash");
return testCaseMapper.countByExample(testCaseExample);
}
} }

View File

@ -16,6 +16,7 @@
@schedule="handleTabsEdit($t('api_test.api_import.timing_synchronization'), 'SCHEDULE')" @schedule="handleTabsEdit($t('api_test.api_import.timing_synchronization'), 'SCHEDULE')"
:type="'edit'" :type="'edit'"
page-source="definition" page-source="definition"
:total='total'
ref="nodeTree"/> ref="nodeTree"/>
</ms-aside-container> </ms-aside-container>
@ -46,6 +47,7 @@
v-if="trashActiveDom==='left'" v-if="trashActiveDom==='left'"
@runTest="runTest" @runTest="runTest"
@refreshTree="refreshTree" @refreshTree="refreshTree"
@getTrashApi="getTrashApi"
:module-tree="nodeTree" :module-tree="nodeTree"
:module-options="moduleOptions" :module-options="moduleOptions"
:current-protocol="currentProtocol" :current-protocol="currentProtocol"
@ -101,6 +103,7 @@
<!-- 列表集合 --> <!-- 列表集合 -->
<ms-api-list <ms-api-list
v-if="activeDom==='left'" v-if="activeDom==='left'"
@getTrashApi="getTrashApi"
:module-tree="nodeTree" :module-tree="nodeTree"
:module-options="moduleOptions" :module-options="moduleOptions"
:current-protocol="currentProtocol" :current-protocol="currentProtocol"
@ -305,6 +308,7 @@ export default {
data() { data() {
return { return {
redirectID: '', redirectID: '',
total: 0,
renderComponent: true, renderComponent: true,
selectDataRange: 'all', selectDataRange: 'all',
showCasePage: true, showCasePage: true,
@ -418,6 +422,11 @@ export default {
this.$post('/api/definition/env/create', {userId: getCurrentUserId(), envId: envId}, response => { this.$post('/api/definition/env/create', {userId: getCurrentUserId(), envId: envId}, response => {
}); });
}, },
getTrashApi(){
this.$get("/api/module/trashCount/"+this.projectId +"/"+this.currentProtocol, response => {
this.total = response.data;
});
},
getEnv() { getEnv() {
this.$get("/api/definition/env/get/" + getCurrentUserId(), response => { this.$get("/api/definition/env/get/" + getCurrentUserId(), response => {
let env = response.data; let env = response.data;

View File

@ -574,6 +574,7 @@ export default {
item.tags = JSON.parse(item.tags); item.tags = JSON.parse(item.tags);
} }
}); });
this.$emit('getTrashApi');
}); });
} }
if (this.needRefreshModule()) { if (this.needRefreshModule()) {

View File

@ -30,6 +30,7 @@
:is-read-only="isReadOnly" :is-read-only="isReadOnly"
:moduleOptions="data" :moduleOptions="data"
:options="options" :options="options"
:total="total"
@exportAPI="exportAPI" @exportAPI="exportAPI"
@saveAsEdit="saveAsEdit" @saveAsEdit="saveAsEdit"
@refreshTable="$emit('refreshTable')" @refreshTable="$emit('refreshTable')"
@ -88,6 +89,7 @@
relevanceProjectId: String, relevanceProjectId: String,
reviewId: String, reviewId: String,
pageSource:String, pageSource:String,
total: Number,
options: { options: {
type: Array, type: Array,
default() { default() {

View File

@ -20,7 +20,7 @@
</el-col> </el-col>
</el-row> </el-row>
<module-trash-button v-if="!isReadOnly" :condition="condition" :exe="enableTrash"/> <module-trash-button v-if="!isReadOnly" :condition="condition" :total="total" :exe="enableTrash"/>
<ms-add-basis-api <ms-add-basis-api
:current-protocol="condition.protocol" :current-protocol="condition.protocol"
@ -110,6 +110,7 @@ export default {
}, },
showOperator: Boolean, showOperator: Boolean,
moduleOptions: Array, moduleOptions: Array,
total: Number,
currentModule: { currentModule: {
type: Object, type: Object,
default() { default() {

View File

@ -55,7 +55,7 @@
import TestAnalysisContainer from "./track/TestAnalysisContainer"; import TestAnalysisContainer from "./track/TestAnalysisContainer";
import MsDrawer from "@/business/components/common/components/MsDrawer"; import MsDrawer from "@/business/components/common/components/MsDrawer";
import ReportHeader from './base/ReportHeader'; import ReportHeader from './base/ReportHeader';
import TestCaseCountContainer from "./testCaseCount/TestCaseCountContainer"; import TestCaseCountContainer from "./casecount/TestCaseCountContainer";
export default { export default {
name: "ReportAnalysis", name: "ReportAnalysis",

View File

@ -25,7 +25,7 @@
<script> <script>
import TestCaseCountChart from "./chart/TestCaseCountChart"; import TestCaseCountChart from "./chart/TestCaseCountChart";
import TestCaseCountTable from "@/business/components/reportstatistics/testCaseCount/table/TestCaseCountTable"; import TestCaseCountTable from "@/business/components/reportstatistics/casecount/table/TestCaseCountTable";
import TestCaseCountFilter from "./filter/TestCaseCountFilter"; import TestCaseCountFilter from "./filter/TestCaseCountFilter";
import {exportPdf,getCurrentProjectID} from "@/common/js/utils"; import {exportPdf,getCurrentProjectID} from "@/common/js/utils";
import html2canvas from 'html2canvas'; import html2canvas from 'html2canvas';

View File

@ -17,7 +17,7 @@
<el-input v-model="form.issuetype" :placeholder="$t('organization.integration.input_jira_issuetype')"/> <el-input v-model="form.issuetype" :placeholder="$t('organization.integration.input_jira_issuetype')"/>
<ms-instructions-icon effect="light"> <ms-instructions-icon effect="light">
<template> <template>
<img class="jira-image" src="src/assets/jira-type.png"/> <img class="jira-image" src="@/assets/jira-type.png"/>
</template> </template>
</ms-instructions-icon> </ms-instructions-icon>
</el-form-item> </el-form-item>
@ -25,7 +25,7 @@
<el-input v-model="form.storytype" :placeholder="$t('organization.integration.input_jira_storytype')"/> <el-input v-model="form.storytype" :placeholder="$t('organization.integration.input_jira_storytype')"/>
<ms-instructions-icon effect="light"> <ms-instructions-icon effect="light">
<template> <template>
<img class="jira-image" src="src/assets/jira-type.png"/> <img class="jira-image" src="@/assets/jira-type.png"/>
</template> </template>
</ms-instructions-icon> </ms-instructions-icon>
</el-form-item> </el-form-item>

View File

@ -13,6 +13,7 @@
@refreshAll="refreshAll" @refreshAll="refreshAll"
@enableTrash="enableTrash" @enableTrash="enableTrash"
:type="'edit'" :type="'edit'"
:total='total'
ref="nodeTree" ref="nodeTree"
/> />
</ms-aside-container> </ms-aside-container>
@ -29,6 +30,7 @@
@testCaseEdit="editTestCase" @testCaseEdit="editTestCase"
@testCaseCopy="copyTestCase" @testCaseCopy="copyTestCase"
@testCaseDetail="showTestCaseDetail" @testCaseDetail="showTestCaseDetail"
@getTrashList="getTrashList"
@refresh="refresh" @refresh="refresh"
@refreshAll="refreshAll" @refreshAll="refreshAll"
@setCondition="setCondition" @setCondition="setCondition"
@ -55,6 +57,7 @@
@testCaseEdit="editTestCase" @testCaseEdit="editTestCase"
@testCaseCopy="copyTestCase" @testCaseCopy="copyTestCase"
@testCaseDetail="showTestCaseDetail" @testCaseDetail="showTestCaseDetail"
@getTrashList="getTrashList"
@refresh="refresh" @refresh="refresh"
@refreshAll="refreshAll" @refreshAll="refreshAll"
@setCondition="setCondition" @setCondition="setCondition"
@ -163,6 +166,7 @@ export default {
type: '', type: '',
activeDom: 'left', activeDom: 'left',
tmpActiveDom: null, tmpActiveDom: null,
total: 0
}; };
}, },
mounted() { mounted() {
@ -246,6 +250,11 @@ export default {
break; break;
} }
}, },
getTrashList(){
this.$get("/case/node/trashCount/"+this.projectId , response => {
this.total = response.data;
});
},
updateActiveDom(activeDom) { updateActiveDom(activeDom) {
let isTestCaseMinderChanged = this.$store.state.isTestCaseMinderChanged; let isTestCaseMinderChanged = this.$store.state.isTestCaseMinderChanged;
if (this.activeDom !== 'left' && activeDom === 'left' && isTestCaseMinderChanged) { if (this.activeDom !== 'left' && activeDom === 'left' && isTestCaseMinderChanged) {

View File

@ -622,6 +622,7 @@ export default {
}); });
}); });
this.$emit("getTrashList");
} }
}, },
search() { search() {

View File

@ -23,7 +23,7 @@
:show-operator="showOperator" :show-operator="showOperator"
:condition="condition" :condition="condition"
:commands="operators"/> :commands="operators"/>
<module-trash-button :condition="condition" :exe="enableTrash"/> <module-trash-button :condition="condition" :total="total" :exe="enableTrash"/>
</template> </template>
</ms-node-tree> </ms-node-tree>
<test-case-import @refreshAll="refreshAll" ref="testCaseImport"/> <test-case-import @refreshAll="refreshAll" ref="testCaseImport"/>
@ -91,6 +91,7 @@ export default {
default: "view" default: "view"
}, },
showOperator: Boolean, showOperator: Boolean,
total: Number,
}, },
watch: { watch: {
treeNodes() { treeNodes() {