fix: 关注直接调接口

This commit is contained in:
guoyuqi 2021-11-17 11:56:08 +08:00 committed by 刘瑞斌
parent 8a25512dee
commit cf2e158e96
20 changed files with 119 additions and 24 deletions

View File

@ -368,6 +368,9 @@ public class ApiAutomationController {
public List<String> getFollows(@PathVariable String scenarioId) { public List<String> getFollows(@PathVariable String scenarioId) {
return apiAutomationService.getFollows(scenarioId); return apiAutomationService.getFollows(scenarioId);
} }
@PostMapping("/update/follows/{scenarioId}")
public void saveFollows(@PathVariable String scenarioId,@RequestBody List<String> follows) {
apiAutomationService.saveFollows(scenarioId,follows);
}
} }

View File

@ -342,4 +342,9 @@ public class ApiDefinitionController {
return JSONToDocumentUtils.getDocument(body.getRaw(),body.getType()); return JSONToDocumentUtils.getDocument(body.getRaw(),body.getType());
} }
@PostMapping("/update/follows/{definitionId}")
public void saveFollows(@PathVariable String definitionId,@RequestBody List<String> follows) {
apiDefinitionService.saveFollows(definitionId,follows);
}
} }

View File

@ -209,4 +209,9 @@ public class ApiTestCaseController {
public List<String> getFollows(@PathVariable String testId) { public List<String> getFollows(@PathVariable String testId) {
return apiTestCaseService.getFollows(testId); return apiTestCaseService.getFollows(testId);
} }
@PostMapping("/update/follows/{testId}")
public void saveFollows(@PathVariable String testId,@RequestBody List<String> follows) {
apiTestCaseService.saveFollows(testId,follows);
}
} }

View File

@ -502,7 +502,7 @@ public class ApiAutomationService {
return scenario; return scenario;
} }
private void saveFollows(String scenarioId, List<String> follows) { public void saveFollows(String scenarioId, List<String> follows) {
ApiScenarioFollowExample example = new ApiScenarioFollowExample(); ApiScenarioFollowExample example = new ApiScenarioFollowExample();
example.createCriteria().andScenarioIdEqualTo(scenarioId); example.createCriteria().andScenarioIdEqualTo(scenarioId);
apiScenarioFollowMapper.deleteByExample(example); apiScenarioFollowMapper.deleteByExample(example);

View File

@ -512,11 +512,11 @@ public class ApiDefinitionService {
List<String> ids = new ArrayList<>(); List<String> ids = new ArrayList<>();
ids.add(request.getId()); ids.add(request.getId());
apiTestCaseService.updateByApiDefinitionId(ids, test.getPath(), test.getMethod(), test.getProtocol()); apiTestCaseService.updateByApiDefinitionId(ids, test.getPath(), test.getMethod(), test.getProtocol());
saveFollows(test.getId(), request.getFollows()); //saveFollows(test.getId(), request.getFollows());
return test; return test;
} }
private void saveFollows(String definitionId, List<String> follows) { public void saveFollows(String definitionId, List<String> follows) {
ApiDefinitionFollowExample example = new ApiDefinitionFollowExample(); ApiDefinitionFollowExample example = new ApiDefinitionFollowExample();
example.createCriteria().andDefinitionIdEqualTo(definitionId); example.createCriteria().andDefinitionIdEqualTo(definitionId);
apiDefinitionFollowMapper.deleteByExample(example); apiDefinitionFollowMapper.deleteByExample(example);

View File

@ -378,7 +378,7 @@ public class ApiTestCaseService {
return test; return test;
} }
private void saveFollows(String testId, List<String> follows) { public void saveFollows(String testId, List<String> follows) {
ApiTestCaseFollowExample example = new ApiTestCaseFollowExample(); ApiTestCaseFollowExample example = new ApiTestCaseFollowExample();
example.createCriteria().andCaseIdEqualTo(testId); example.createCriteria().andCaseIdEqualTo(testId);
apiTestCaseFollowMapper.deleteByExample(example); apiTestCaseFollowMapper.deleteByExample(example);

View File

@ -247,4 +247,9 @@ public class PerformanceTestController {
public List<String> getFollows(@PathVariable String testId) { public List<String> getFollows(@PathVariable String testId) {
return performanceTestService.getFollows(testId); return performanceTestService.getFollows(testId);
} }
@PostMapping("test/update/follows/{testId}")
public void saveFollows(@PathVariable String testId,@RequestBody List<String> follows) {
performanceTestService.saveFollows(testId,follows);
}
} }

View File

@ -308,13 +308,13 @@ public class PerformanceTestService {
loadTest.setAdvancedConfiguration(request.getAdvancedConfiguration()); loadTest.setAdvancedConfiguration(request.getAdvancedConfiguration());
loadTest.setTestResourcePoolId(request.getTestResourcePoolId()); loadTest.setTestResourcePoolId(request.getTestResourcePoolId());
loadTest.setStatus(PerformanceTestStatus.Saved.name()); loadTest.setStatus(PerformanceTestStatus.Saved.name());
saveFollows(loadTest.getId(), request.getFollows()); //saveFollows(loadTest.getId(), request.getFollows());
loadTestMapper.updateByPrimaryKeySelective(loadTest); loadTestMapper.updateByPrimaryKeySelective(loadTest);
return loadTest; return loadTest;
} }
private void saveFollows(String testId, List<String> follows) { public void saveFollows(String testId, List<String> follows) {
LoadTestFollowExample example = new LoadTestFollowExample(); LoadTestFollowExample example = new LoadTestFollowExample();
example.createCriteria().andTestIdEqualTo(testId); example.createCriteria().andTestIdEqualTo(testId);
loadTestFollowMapper.deleteByExample(example); loadTestFollowMapper.deleteByExample(example);

View File

@ -133,4 +133,9 @@ public class IssuesController {
public List<String> getFollows(@PathVariable String issueId) { public List<String> getFollows(@PathVariable String issueId) {
return issuesService.getFollows(issueId); return issuesService.getFollows(issueId);
} }
@PostMapping("/up/follows/{issueId}")
public void saveFollows(@PathVariable String issueId,@RequestBody List<String> follows) {
issuesService.saveFollows(issueId,follows);
}
} }

View File

@ -352,4 +352,10 @@ public class TestCaseController {
public List<String> getFollows(@PathVariable String caseId) { public List<String> getFollows(@PathVariable String caseId) {
return testCaseService.getFollows(caseId); return testCaseService.getFollows(caseId);
} }
@PostMapping("/edit/follows/{caseId}")
@RequiresPermissions(PermissionConstants.PROJECT_TRACK_PLAN_READ_EDIT)
public void editTestFollows(@PathVariable String caseId,@RequestBody List<String> follows) {
testCaseService.saveFollows(caseId,follows);
}
} }

View File

@ -105,10 +105,10 @@ public class IssuesService {
platformList.forEach(platform -> { platformList.forEach(platform -> {
platform.updateIssue(issuesRequest); platform.updateIssue(issuesRequest);
}); });
saveFollows(issuesRequest.getId(), issuesRequest.getFollows()); //saveFollows(issuesRequest.getId(), issuesRequest.getFollows());
// todo 缺陷更新事件 // todo 缺陷更新事件
} }
private void saveFollows(String issueId, List<String> follows) { public void saveFollows(String issueId, List<String> follows) {
IssueFollowExample example = new IssueFollowExample(); IssueFollowExample example = new IssueFollowExample();
example.createCriteria().andIssueIdEqualTo(issueId); example.createCriteria().andIssueIdEqualTo(issueId);
issueFollowMapper.deleteByExample(example); issueFollowMapper.deleteByExample(example);

View File

@ -183,7 +183,7 @@ public class TestCaseService {
return request; return request;
} }
private void saveFollows(String caseId, List<String> follows) { public void saveFollows(String caseId, List<String> follows) {
TestCaseFollowExample example = new TestCaseFollowExample(); TestCaseFollowExample example = new TestCaseFollowExample();
example.createCriteria().andCaseIdEqualTo(caseId); example.createCriteria().andCaseIdEqualTo(caseId);
testCaseFollowMapper.deleteByExample(example); testCaseFollowMapper.deleteByExample(example);
@ -1429,7 +1429,7 @@ public class TestCaseService {
} }
this.setNode(request); this.setNode(request);
editTestCase(request); editTestCase(request);
saveFollows(request.getId(), request.getFollows()); //saveFollows(request.getId(), request.getFollows());
return testCaseWithBLOBs; return testCaseWithBLOBs;
} }

View File

@ -1612,19 +1612,28 @@ export default {
showHistory() { showHistory() {
this.$refs.taskCenter.openScenarioHistory(this.currentScenario.id); this.$refs.taskCenter.openScenarioHistory(this.currentScenario.id);
}, },
saveFollow() { saveFollow(){
if (this.showFollow) { if(this.showFollow){
this.showFollow = false; this.showFollow = false;
for (let i = 0; i < this.currentScenario.follows.length; i++) { for (let i = 0; i < this.currentScenario.follows.length; i++) {
if (this.currentScenario.follows[i] === this.currentUser().id) { if(this.currentScenario.follows[i]===this.currentUser().id){
this.currentScenario.follows.splice(i, 1) this.currentScenario.follows.splice(i,1)
break; break;
} }
} }
if(this.currentScenario.id){
} else { this.$post("/api/automation/update/follows/"+this.currentScenario.id, this.currentScenario.follows,() => {
this.$message.success("cancel success")
});
}
}else {
this.showFollow = true; this.showFollow = true;
this.currentScenario.follows.push(this.currentUser().id) this.currentScenario.follows.push(this.currentUser().id)
if(this.currentScenario.id){
this.$post("/api/automation/update/follows/"+this.currentScenario.id, this.currentScenario.follows,() => {
this.$message.success("cancel success")
});
}
} }
} }
} }

View File

@ -522,9 +522,19 @@ export default {
break; break;
} }
} }
if( this.apiCase.id){
this.$post("/api/testcase/update/follows/"+this.apiCase.id, this.apiCase.follows,() => {
this.$message.success("cancel success")
});
}
}else { }else {
this.showFollow = true; this.showFollow = true;
this.apiCase.follows.push(this.currentUser().id) this.apiCase.follows.push(this.currentUser().id)
if( this.apiCase.id){
this.$post("/api/testcase/update/follows/"+this.apiCase.id, this.apiCase.follows,() => {
this.$message.success("cancel success")
});
}
} }
} }
} }

View File

@ -427,6 +427,8 @@
}); });
}, },
saveFollow(){ saveFollow(){
console.log("***********")
console.log(this.basisData.id)
if(this.showFollow){ if(this.showFollow){
this.showFollow = false; this.showFollow = false;
for (let i = 0; i < this.httpForm.follows.length; i++) { for (let i = 0; i < this.httpForm.follows.length; i++) {
@ -435,10 +437,19 @@
break; break;
} }
} }
if(this.basisData.id){
this.$post("/api/definition/update/follows/"+this.basisData.id, this.httpForm.follows,() => {
this.$message.success("cancel success")
});
}
}else { }else {
this.showFollow = true; this.showFollow = true;
this.httpForm.follows.push(this.currentUser().id) this.httpForm.follows.push(this.currentUser().id)
if(this.basisData.id){
this.$post("/api/definition/update/follows/"+this.basisData.id, this.httpForm.follows,() => {
this.$message.success("save success")
});
}
} }
} }
}, },

View File

@ -492,10 +492,19 @@ export default {
break; break;
} }
} }
if(this.testId){
this.$post("/performance/test/update/follows/"+this.testId, this.test.follows,() => {
this.$message.success("cancel success")
});
}
}else { }else {
this.showFollow = true; this.showFollow = true;
this.test.follows.push(this.currentUser().id) this.test.follows.push(this.currentUser().id)
if(this.testId){
this.$post("/performance/test/update/follows/"+this.testId, this.test.follows,() => {
this.$message.success("cancel success")
});
}
} }
} }
} }

View File

@ -837,10 +837,22 @@
break; break;
} }
} }
if(this.path === "/test/case/edit"){
this.result.loading = true
this.$post('/test/case/edit/follows/'+this.currentTestCaseInfo.id, this.form.follows,() => {
this.result.loading = false
});
}
}else { }else {
this.showFollow = true; this.showFollow = true;
this.form.follows.push(this.currentUser().id) this.form.follows.push(this.currentUser().id)
if(this.path === "/test/case/edit"){
this.result.loading = true
this.$post('/test/case/edit/follows/'+this.currentTestCaseInfo.id, this.form.follows,() => {
this.result.loading = false
});
}
} }
} }
} }

View File

@ -102,6 +102,7 @@ export default {
}, },
data() { data() {
return { return {
issueId:'',
result: {}, result: {},
relateFields: [], relateFields: [],
isFormAlive: true, isFormAlive: true,
@ -124,7 +125,7 @@ export default {
form: { form: {
title: '', title: '',
description: '', description: '',
creator: null creator: null,
}, },
tapdUsers: [], tapdUsers: [],
zentaoUsers: [], zentaoUsers: [],
@ -173,6 +174,8 @@ export default {
} }
} }
}) })
}else {
this.form.follows = [];
} }
}, },
currentUser: () => { currentUser: () => {
@ -215,6 +218,7 @@ export default {
this.form.options = data.options ? JSON.parse(data.options) : []; this.form.options = data.options ? JSON.parse(data.options) : [];
} }
if (data.id) { if (data.id) {
this.issueId = data.id
this.url = 'issues/update'; this.url = 'issues/update';
} else { } else {
//copy //copy
@ -300,6 +304,9 @@ export default {
} }
}, },
saveFollow(){ saveFollow(){
if(!this.form.follows){
this.form.follows = [];
}
if(this.showFollow){ if(this.showFollow){
this.showFollow = false; this.showFollow = false;
for (let i = 0; i < this.form.follows.length; i++) { for (let i = 0; i < this.form.follows.length; i++) {
@ -308,10 +315,18 @@ export default {
break; break;
} }
} }
if(this.url === "issues/update"){
this.$post("issues/up/follows/"+this.issueId, this.form.follows,() => {
});
}
}else { }else {
this.showFollow = true; this.showFollow = true;
this.form.follows.push(this.currentUser().id) this.form.follows.push(this.currentUser().id)
if(this.url === "issues/update"){
this.$post("issues/up/follows/"+this.issueId, this.form.follows,() => {
});
}
} }
} }
} }

View File

@ -100,7 +100,7 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row type="flex" justify="left" :gutter="20"> <!-- <el-row type="flex" justify="left" :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item :label="$t('test_track.plan.follow_people')" :label-width="formLabelWidth" <el-form-item :label="$t('test_track.plan.follow_people')" :label-width="formLabelWidth"
prop="follows"> prop="follows">
@ -116,7 +116,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>-->
<el-row type="flex" justify="left" :gutter="20"> <el-row type="flex" justify="left" :gutter="20">
<el-col :span="24"> <el-col :span="24">

View File

@ -47,7 +47,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12" :offset="1"> <el-col :span="12" :offset="1">
<el-form-item :label="$t('test_track.review.review_follow_people')" :label-width="formLabelWidth" <!-- <el-form-item :label="$t('test_track.review.review_follow_people')" :label-width="formLabelWidth"
prop="followIds"> prop="followIds">
<el-select v-model="form.followIds" <el-select v-model="form.followIds"
clearable multiple clearable multiple
@ -59,7 +59,7 @@
:value="item.id"> :value="item.id">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>-->
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item :label="$t('test_track.review.end_time')" :label-width="formLabelWidth" prop="endTime"> <el-form-item :label="$t('test_track.review.end_time')" :label-width="formLabelWidth" prop="endTime">