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) {
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());
}
@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) {
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;
}
private void saveFollows(String scenarioId, List<String> follows) {
public void saveFollows(String scenarioId, List<String> follows) {
ApiScenarioFollowExample example = new ApiScenarioFollowExample();
example.createCriteria().andScenarioIdEqualTo(scenarioId);
apiScenarioFollowMapper.deleteByExample(example);

View File

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

View File

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

View File

@ -247,4 +247,9 @@ public class PerformanceTestController {
public List<String> getFollows(@PathVariable String 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.setTestResourcePoolId(request.getTestResourcePoolId());
loadTest.setStatus(PerformanceTestStatus.Saved.name());
saveFollows(loadTest.getId(), request.getFollows());
//saveFollows(loadTest.getId(), request.getFollows());
loadTestMapper.updateByPrimaryKeySelective(loadTest);
return loadTest;
}
private void saveFollows(String testId, List<String> follows) {
public void saveFollows(String testId, List<String> follows) {
LoadTestFollowExample example = new LoadTestFollowExample();
example.createCriteria().andTestIdEqualTo(testId);
loadTestFollowMapper.deleteByExample(example);

View File

@ -133,4 +133,9 @@ public class IssuesController {
public List<String> getFollows(@PathVariable String 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) {
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 -> {
platform.updateIssue(issuesRequest);
});
saveFollows(issuesRequest.getId(), issuesRequest.getFollows());
//saveFollows(issuesRequest.getId(), issuesRequest.getFollows());
// todo 缺陷更新事件
}
private void saveFollows(String issueId, List<String> follows) {
public void saveFollows(String issueId, List<String> follows) {
IssueFollowExample example = new IssueFollowExample();
example.createCriteria().andIssueIdEqualTo(issueId);
issueFollowMapper.deleteByExample(example);

View File

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

View File

@ -1612,19 +1612,28 @@ export default {
showHistory() {
this.$refs.taskCenter.openScenarioHistory(this.currentScenario.id);
},
saveFollow() {
if (this.showFollow) {
saveFollow(){
if(this.showFollow){
this.showFollow = false;
for (let i = 0; i < this.currentScenario.follows.length; i++) {
if (this.currentScenario.follows[i] === this.currentUser().id) {
this.currentScenario.follows.splice(i, 1)
if(this.currentScenario.follows[i]===this.currentUser().id){
this.currentScenario.follows.splice(i,1)
break;
}
}
} else {
if(this.currentScenario.id){
this.$post("/api/automation/update/follows/"+this.currentScenario.id, this.currentScenario.follows,() => {
this.$message.success("cancel success")
});
}
}else {
this.showFollow = true;
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;
}
}
if( this.apiCase.id){
this.$post("/api/testcase/update/follows/"+this.apiCase.id, this.apiCase.follows,() => {
this.$message.success("cancel success")
});
}
}else {
this.showFollow = true;
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(){
console.log("***********")
console.log(this.basisData.id)
if(this.showFollow){
this.showFollow = false;
for (let i = 0; i < this.httpForm.follows.length; i++) {
@ -435,10 +437,19 @@
break;
}
}
if(this.basisData.id){
this.$post("/api/definition/update/follows/"+this.basisData.id, this.httpForm.follows,() => {
this.$message.success("cancel success")
});
}
}else {
this.showFollow = true;
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;
}
}
if(this.testId){
this.$post("/performance/test/update/follows/"+this.testId, this.test.follows,() => {
this.$message.success("cancel success")
});
}
}else {
this.showFollow = true;
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;
}
}
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 {
this.showFollow = true;
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() {
return {
issueId:'',
result: {},
relateFields: [],
isFormAlive: true,
@ -124,7 +125,7 @@ export default {
form: {
title: '',
description: '',
creator: null
creator: null,
},
tapdUsers: [],
zentaoUsers: [],
@ -173,6 +174,8 @@ export default {
}
}
})
}else {
this.form.follows = [];
}
},
currentUser: () => {
@ -215,6 +218,7 @@ export default {
this.form.options = data.options ? JSON.parse(data.options) : [];
}
if (data.id) {
this.issueId = data.id
this.url = 'issues/update';
} else {
//copy
@ -300,6 +304,9 @@ export default {
}
},
saveFollow(){
if(!this.form.follows){
this.form.follows = [];
}
if(this.showFollow){
this.showFollow = false;
for (let i = 0; i < this.form.follows.length; i++) {
@ -308,10 +315,18 @@ export default {
break;
}
}
if(this.url === "issues/update"){
this.$post("issues/up/follows/"+this.issueId, this.form.follows,() => {
});
}
}else {
this.showFollow = true;
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-row>
<el-row type="flex" justify="left" :gutter="20">
<!-- <el-row type="flex" justify="left" :gutter="20">
<el-col :span="12">
<el-form-item :label="$t('test_track.plan.follow_people')" :label-width="formLabelWidth"
prop="follows">
@ -116,7 +116,7 @@
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-row>-->
<el-row type="flex" justify="left" :gutter="20">
<el-col :span="24">

View File

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