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);
}
@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}")
public ApiModule getModuleByName(@PathVariable String projectId, @PathVariable String protocol) {
// checkPermissionService.checkProjectOwner(projectId);

View File

@ -446,12 +446,16 @@ public class MockApiUtils {
RequestMockParams returnParams = getGetParamMap(urlParams,apiPath,queryParamsObject);
if(paramJson != null){
if (paramJson instanceof JSONObject) {
JSONArray paramsArray = new JSONArray();
paramsArray.add(paramJson);
returnParams.setBodyParams(paramsArray);
if(!((JSONObject) paramJson).isEmpty()){
JSONArray paramsArray = new JSONArray();
paramsArray.add(paramJson);
returnParams.setBodyParams(paramsArray);
}
} else if (paramJson instanceof JSONArray) {
JSONArray paramArray = (JSONArray) paramJson;
returnParams.setBodyParams(paramArray);
if(!paramArray.isEmpty()){
returnParams.setBodyParams(paramArray);
}
}
}
return returnParams;
@ -527,13 +531,6 @@ public class MockApiUtils {
if(StringUtils.isNotEmpty(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;
}
}

View File

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

View File

@ -43,6 +43,8 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
@Resource
private ExtApiDefinitionMapper extApiDefinitionMapper;
@Resource
private ApiDefinitionMapper apiDefinitionMapper;
@Resource
private TestPlanProjectService testPlanProjectService;
@Resource
private ProjectService projectService;
@ -539,4 +541,10 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
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);
}
@GetMapping("/trashCount/{projectId}")
public long trashCount(@PathVariable String projectId) {
checkPermissionService.checkProjectOwner(projectId);
return testCaseNodeService.trashCount(projectId);
}
/*模块列表列表*/
@PostMapping("/list/all/plan")
public List<TestCaseNodeDTO> getAllNodeByPlanId(@RequestBody QueryNodeRequest request) {

View File

@ -764,4 +764,10 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
}
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')"
:type="'edit'"
page-source="definition"
:total='total'
ref="nodeTree"/>
</ms-aside-container>
@ -46,6 +47,7 @@
v-if="trashActiveDom==='left'"
@runTest="runTest"
@refreshTree="refreshTree"
@getTrashApi="getTrashApi"
:module-tree="nodeTree"
:module-options="moduleOptions"
:current-protocol="currentProtocol"
@ -101,6 +103,7 @@
<!-- 列表集合 -->
<ms-api-list
v-if="activeDom==='left'"
@getTrashApi="getTrashApi"
:module-tree="nodeTree"
:module-options="moduleOptions"
:current-protocol="currentProtocol"
@ -305,6 +308,7 @@ export default {
data() {
return {
redirectID: '',
total: 0,
renderComponent: true,
selectDataRange: 'all',
showCasePage: true,
@ -418,6 +422,11 @@ export default {
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() {
this.$get("/api/definition/env/get/" + getCurrentUserId(), response => {
let env = response.data;

View File

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

View File

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

View File

@ -20,7 +20,7 @@
</el-col>
</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
:current-protocol="condition.protocol"
@ -110,6 +110,7 @@ export default {
},
showOperator: Boolean,
moduleOptions: Array,
total: Number,
currentModule: {
type: Object,
default() {

View File

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

View File

@ -25,7 +25,7 @@
<script>
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 {exportPdf,getCurrentProjectID} from "@/common/js/utils";
import html2canvas from 'html2canvas';

View File

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

View File

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

View File

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

View File

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