Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
7ffb6812
M
metersphere
项目概览
MeterSphere
/
metersphere
上一次同步 大约 3 年
通知
25
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
metersphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7ffb6812
编写于
8月 18, 2020
作者:
S
shiziyuan9527
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 取消集成后,解除项目关联
上级
ab07bc3d
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
46 addition
and
26 deletion
+46
-26
backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.java
...java/io/metersphere/base/mapper/ext/ExtProjectMapper.java
+2
-0
backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml
.../java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml
+21
-3
backend/src/main/java/io/metersphere/service/IntegrationService.java
.../main/java/io/metersphere/service/IntegrationService.java
+5
-0
backend/src/main/java/io/metersphere/track/controller/TestCaseIssuesController.java
...etersphere/track/controller/TestCaseIssuesController.java
+1
-1
backend/src/main/java/io/metersphere/track/service/IssuesService.java
...main/java/io/metersphere/track/service/IssuesService.java
+7
-12
frontend/src/business/components/settings/organization/IssuesManagement.vue
...ess/components/settings/organization/IssuesManagement.vue
+9
-9
frontend/src/business/components/settings/organization/ServiceIntegration.vue
...s/components/settings/organization/ServiceIntegration.vue
+1
-1
未找到文件。
backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.java
浏览文件 @
7ffb6812
...
...
@@ -11,4 +11,6 @@ public interface ExtProjectMapper {
List
<
ProjectDTO
>
getProjectWithWorkspace
(
@Param
(
"proRequest"
)
ProjectRequest
request
);
List
<
String
>
getProjectIdByWorkspaceId
(
String
workspaceId
);
int
removeIssuePlatform
(
@Param
(
"platform"
)
String
platform
,
@Param
(
"orgId"
)
String
orgId
);
}
backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml
浏览文件 @
7ffb6812
...
...
@@ -4,9 +4,9 @@
<select
id=
"getProjectWithWorkspace"
resultType=
"io.metersphere.dto.ProjectDTO"
>
select p.id, p.workspace_id, p.name, p.description, p.update_time,
p.create_time, w.id as workspaceId, w.name as workspaceName, p.tapd_id, p.jira_key
from project p
join workspace w on p.workspace_id = w.id
p.create_time, w.id as workspaceId, w.name as workspaceName, p.tapd_id, p.jira_key
from project p
join workspace w on p.workspace_id = w.id
<where>
<if
test=
"proRequest.name != null and proRequest.name != ''"
>
and p.name like #{proRequest.name, jdbcType=VARCHAR}
...
...
@@ -28,4 +28,22 @@
where workspace_id = #{workspaceId}
</select>
<update
id=
"removeIssuePlatform"
>
update project
<set>
<if
test=
"platform == 'Jira'"
>
jira_key = null
</if>
<if
test=
"platform == 'Tapd'"
>
tapd_id = null
</if>
</set>
where project.id in (select id from (select id
from project
where workspace_id in
(select workspace.id
from workspace
where organization_id = #{orgId})) as a)
</update>
</mapper>
\ No newline at end of file
backend/src/main/java/io/metersphere/service/IntegrationService.java
浏览文件 @
7ffb6812
...
...
@@ -3,6 +3,7 @@ package io.metersphere.service;
import
io.metersphere.base.domain.ServiceIntegration
;
import
io.metersphere.base.domain.ServiceIntegrationExample
;
import
io.metersphere.base.mapper.ServiceIntegrationMapper
;
import
io.metersphere.base.mapper.ext.ExtProjectMapper
;
import
io.metersphere.controller.request.IntegrationRequest
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
...
...
@@ -20,6 +21,8 @@ public class IntegrationService {
@Resource
private
ServiceIntegrationMapper
serviceIntegrationMapper
;
@Resource
private
ExtProjectMapper
extProjectMapper
;
public
ServiceIntegration
save
(
ServiceIntegration
service
)
{
ServiceIntegrationExample
example
=
new
ServiceIntegrationExample
();
...
...
@@ -63,6 +66,8 @@ public class IntegrationService {
.
andOrganizationIdEqualTo
(
orgId
)
.
andPlatformEqualTo
(
platform
);
serviceIntegrationMapper
.
deleteByExample
(
example
);
// 删除项目关联的id/key
extProjectMapper
.
removeIssuePlatform
(
platform
,
orgId
);
}
public
List
<
ServiceIntegration
>
getAll
(
String
orgId
)
{
...
...
backend/src/main/java/io/metersphere/track/controller/TestCaseIssuesController.java
浏览文件 @
7ffb6812
package
io.metersphere.track.controller
;
import
io.metersphere.base.domain.Issues
;
import
io.metersphere.service.IssuesService
;
import
io.metersphere.
track.
service.IssuesService
;
import
io.metersphere.track.request.testcase.IssuesRequest
;
import
org.springframework.web.bind.annotation.*
;
...
...
backend/src/main/java/io/metersphere/service/IssuesService.java
→
backend/src/main/java/io/metersphere/
track/
service/IssuesService.java
浏览文件 @
7ffb6812
package
io.metersphere.service
;
package
io.metersphere.
track.
service
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
...
...
@@ -15,8 +15,9 @@ import io.metersphere.commons.utils.RestTemplateUtils;
import
io.metersphere.commons.utils.SessionUtils
;
import
io.metersphere.controller.ResultHolder
;
import
io.metersphere.controller.request.IntegrationRequest
;
import
io.metersphere.service.IntegrationService
;
import
io.metersphere.service.ProjectService
;
import
io.metersphere.track.request.testcase.IssuesRequest
;
import
io.metersphere.track.service.TestCaseService
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpMethod
;
...
...
@@ -154,12 +155,6 @@ public class IssuesService {
String
tapdId
=
getTapdProjectId
(
issuesRequest
.
getTestCaseId
());
String
jiraKey
=
getJiraProjectKey
(
issuesRequest
.
getTestCaseId
());
if
(
tapd
||
jira
)
{
if
(
StringUtils
.
isBlank
(
tapdId
)
&&
StringUtils
.
isBlank
(
jiraKey
))
{
MSException
.
throwException
(
"集成了缺陷管理平台,但未进行项目关联!"
);
}
}
if
(
tapd
)
{
// 是否关联了项目
if
(
StringUtils
.
isNotBlank
(
tapdId
))
{
...
...
@@ -173,7 +168,7 @@ public class IssuesService {
}
}
if
(
!
tapd
&&
!
jira
)
{
if
(
StringUtils
.
isBlank
(
tapdId
)
&&
StringUtils
.
isBlank
(
jiraKey
)
)
{
addLocalIssues
(
issuesRequest
);
}
...
...
@@ -322,7 +317,7 @@ public class IssuesService {
HttpEntity
<
MultiValueMap
>
requestEntity
=
new
HttpEntity
<>(
headers
);
RestTemplate
restTemplate
=
new
RestTemplate
();
//post
ResponseEntity
<
String
>
responseEntity
=
null
;
ResponseEntity
<
String
>
responseEntity
;
Issues
issues
=
new
Issues
();
try
{
responseEntity
=
restTemplate
.
exchange
(
url
+
"/rest/api/2/issue/"
+
issuesId
,
HttpMethod
.
GET
,
requestEntity
,
String
.
class
);
...
...
@@ -395,7 +390,7 @@ public class IssuesService {
List
<
Issues
>
issues
=
extIssuesMapper
.
getIssues
(
caseId
,
IssuesManagePlatform
.
Tapd
.
toString
());
List
<
String
>
issuesIds
=
issues
.
stream
().
map
(
issue
->
issue
.
getId
()
).
collect
(
Collectors
.
toList
());
List
<
String
>
issuesIds
=
issues
.
stream
().
map
(
Issues:
:
getId
).
collect
(
Collectors
.
toList
());
issuesIds
.
forEach
(
issuesId
->
{
Issues
dto
=
getTapdIssues
(
tapdId
,
issuesId
);
if
(
StringUtils
.
isBlank
(
dto
.
getId
()))
{
...
...
@@ -437,7 +432,7 @@ public class IssuesService {
List
<
Issues
>
issues
=
extIssuesMapper
.
getIssues
(
caseId
,
IssuesManagePlatform
.
Jira
.
toString
());
List
<
String
>
issuesIds
=
issues
.
stream
().
map
(
issue
->
issue
.
getId
()
).
collect
(
Collectors
.
toList
());
List
<
String
>
issuesIds
=
issues
.
stream
().
map
(
Issues:
:
getId
).
collect
(
Collectors
.
toList
());
issuesIds
.
forEach
(
issuesId
->
{
Issues
dto
=
getJiraIssues
(
headers
,
url
,
issuesId
);
if
(
StringUtils
.
isBlank
(
dto
.
getId
()))
{
...
...
frontend/src/business/components/settings/organization/
Defect
Management.vue
→
frontend/src/business/components/settings/organization/
Issues
Management.vue
浏览文件 @
7ffb6812
<
template
>
<el-card
class=
"header-title"
>
<div
v-loading=
"result.loading"
>
<el-card
class=
"header-title"
v-loading=
"result.loading"
>
<div>
<div>
{{
$t
(
'
organization.select_defect_platform
'
)
}}
</div>
<el-radio-group
v-model=
"platform"
style=
"margin-top: 10px"
@
change=
"change"
>
<el-radio
v-for=
"(item, index) in platforms"
:key=
"index"
:label=
"item.value"
size=
"small"
>
...
...
@@ -26,12 +26,12 @@
</div>
<div
style=
"margin-left: 100px"
>
<el-button
type=
"primary"
size=
"
small
"
:disabled=
"!show"
@
click=
"testConnection"
>
{{
$t
(
'
ldap.test_connect
'
)
}}
<el-button
type=
"primary"
size=
"
mini
"
:disabled=
"!show"
@
click=
"testConnection"
>
{{
$t
(
'
ldap.test_connect
'
)
}}
</el-button>
<el-button
v-if=
"showEdit"
size=
"
small
"
@
click=
"edit"
>
{{
$t
(
'
commons.edit
'
)
}}
</el-button>
<el-button
type=
"primary"
v-if=
"showSave"
size=
"
small
"
@
click=
"save('form')"
>
{{
$t
(
'
commons.save
'
)
}}
</el-button>
<el-button
v-if=
"showCancel"
size=
"
small
"
@
click=
"cancelEdit"
>
取消编辑
</el-button>
<el-button
type=
"info"
size=
"
small
"
@
click=
"cancelIntegration('form')"
:disabled=
"!show"
>
<el-button
v-if=
"showEdit"
size=
"
mini
"
@
click=
"edit"
>
{{
$t
(
'
commons.edit
'
)
}}
</el-button>
<el-button
type=
"primary"
v-if=
"showSave"
size=
"
mini
"
@
click=
"save('form')"
>
{{
$t
(
'
commons.save
'
)
}}
</el-button>
<el-button
v-if=
"showCancel"
size=
"
mini
"
@
click=
"cancelEdit"
>
取消编辑
</el-button>
<el-button
type=
"info"
size=
"
mini
"
@
click=
"cancelIntegration('form')"
:disabled=
"!show"
>
取消集成
</el-button>
</div>
...
...
@@ -54,7 +54,7 @@
import
{
getCurrentUser
}
from
"
../../../../common/js/utils
"
;
export
default
{
name
:
"
Defect
Management
"
,
name
:
"
Issues
Management
"
,
data
()
{
return
{
form
:
{},
...
...
@@ -195,7 +195,7 @@
});
},
testConnection
()
{
this
.
$get
(
"
issues/auth/
"
+
this
.
platform
,
()
=>
{
this
.
result
=
this
.
$get
(
"
issues/auth/
"
+
this
.
platform
,
()
=>
{
this
.
$success
(
"
验证通过!
"
);
});
}
...
...
frontend/src/business/components/settings/organization/ServiceIntegration.vue
浏览文件 @
7ffb6812
...
...
@@ -10,7 +10,7 @@
<
script
>
import
DefectManagement
from
"
./
Defect
Management
"
;
import
DefectManagement
from
"
./
Issues
Management
"
;
export
default
{
name
:
"
ServiceIntegration
"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录