Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
xiaofang li
MeterSphere
Commits
9a8c21c3
Commit
9a8c21c3
authored
3 years ago
by
chenjianxing
Browse files
Options
Download
Email Patches
Plain Diff
refactor: Jira接口使用v2版本
parent
2541f784
pr@dev@refactor_Jira接口使用v2版本
No related merge requests found
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java
+35
-124
...rc/main/java/io/metersphere/track/issue/JiraPlatform.java
backend/src/main/java/io/metersphere/track/issue/client/BaseClient.java
+8
-8
...in/java/io/metersphere/track/issue/client/BaseClient.java
backend/src/main/java/io/metersphere/track/issue/client/JiraAbstractClient.java
+36
-30
...io/metersphere/track/issue/client/JiraAbstractClient.java
backend/src/main/java/io/metersphere/track/issue/client/JiraClientV2.java
+10
-0
.../java/io/metersphere/track/issue/client/JiraClientV2.java
backend/src/main/java/io/metersphere/track/issue/client/JiraClientV3.java
+7
-0
.../java/io/metersphere/track/issue/client/JiraClientV3.java
backend/src/main/java/io/metersphere/track/issue/domain/JiraIssueDescriptionV3.java
+2
-2
...etersphere/track/issue/domain/JiraIssueDescriptionV3.java
backend/src/main/java/io/metersphere/track/service/IssuesService.java
+1
-9
...main/java/io/metersphere/track/service/IssuesService.java
frontend/src/network/Issue.js
+2
-0
frontend/src/network/Issue.js
with
101 additions
and
173 deletions
+101
-173
backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java
+
35
-
124
View file @
9a8c21c3
...
...
@@ -11,8 +11,11 @@ import io.metersphere.commons.utils.EncryptUtils;
import
io.metersphere.commons.utils.LogUtil
;
import
io.metersphere.dto.CustomFieldItemDTO
;
import
io.metersphere.track.dto.DemandDTO
;
import
io.metersphere.track.issue.client.JiraClient
;
import
io.metersphere.track.issue.domain.*
;
import
io.metersphere.track.issue.client.JiraClientV2
;
import
io.metersphere.track.issue.domain.JiraAddIssueResponse
;
import
io.metersphere.track.issue.domain.JiraConfig
;
import
io.metersphere.track.issue.domain.JiraIssue
;
import
io.metersphere.track.issue.domain.PlatformUser
;
import
io.metersphere.track.request.testcase.IssuesRequest
;
import
io.metersphere.track.request.testcase.IssuesUpdateRequest
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -26,18 +29,17 @@ import org.springframework.http.HttpEntity;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.web.client.HttpClientErrorException
;
import
org.springframework.web.client.RestTemplate
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
public
class
JiraPlatform
extends
AbstractIssuePlatform
{
protected
String
key
=
IssuesManagePlatform
.
Jira
.
toString
();
private
JiraClientV2
jiraClientV2
=
new
JiraClientV2
();
public
JiraPlatform
(
IssuesRequest
issuesRequest
)
{
super
(
issuesRequest
);
}
...
...
@@ -62,11 +64,10 @@ public class JiraPlatform extends AbstractIssuePlatform {
}
else
{
issues
=
extIssuesMapper
.
getIssuesByCaseId
(
issuesRequest
);
}
JiraConfig
config
=
getConfig
();
JiraClient
.
setConfig
(
config
);
setConfig
();
issues
.
forEach
(
item
->
{
String
issuesId
=
item
.
getId
();
parseIssue
(
item
,
J
iraClient
.
getIssues
(
issuesId
));
parseIssue
(
item
,
j
iraClient
V2
.
getIssues
(
issuesId
));
if
(
StringUtils
.
isBlank
(
item
.
getId
()))
{
// 缺陷不存在,解除用例和缺陷的关联
TestCaseIssuesExample
issuesExample
=
new
TestCaseIssuesExample
();
...
...
@@ -85,7 +86,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
return
list
;
}
public
void
parseIssue
(
Issues
Dao
item
,
JiraIssue
jiraIssue
)
{
public
void
parseIssue
(
Issues
WithBLOBs
item
,
JiraIssue
jiraIssue
)
{
String
lastmodify
=
""
;
String
status
=
""
;
JSONObject
fields
=
jiraIssue
.
getFields
();
...
...
@@ -115,31 +116,17 @@ public class JiraPlatform extends AbstractIssuePlatform {
item
.
setPlatform
(
IssuesManagePlatform
.
Jira
.
toString
());
}
public
HttpHeaders
getAuthHeader
(
JSONObject
object
)
{
if
(
object
==
null
)
{
MSException
.
throwException
(
"tapd config is null"
);
}
String
account
=
object
.
getString
(
"account"
);
String
password
=
object
.
getString
(
"password"
);
return
auth
(
account
,
password
);
}
@Override
public
void
filter
(
List
<
IssuesDao
>
issues
)
{
String
config
=
getPlatformConfig
(
IssuesManagePlatform
.
Jira
.
toString
());
JSONObject
object
=
JSON
.
parseObject
(
config
);
HttpHeaders
headers
=
getAuthHeader
(
object
);
String
url
=
object
.
getString
(
"url"
);
setConfig
();
issues
.
forEach
((
issuesDao
)
->
{
IssuesDao
dto
=
getJiraIssues
(
headers
,
url
,
issuesDao
.
getId
());
if
(
StringUtils
.
isBlank
(
dt
o
.
getId
()))
{
parseIssue
(
issuesDao
,
jiraClientV2
.
getIssues
(
issuesDao
.
getId
())
)
;
if
(
StringUtils
.
isBlank
(
issuesDa
o
.
getId
()))
{
// 标记成删除
issuesDao
.
setStatus
(
IssuesStatus
.
DELETE
.
toString
());
}
else
{
// 缺陷状态为 完成,则不显示
if
(!
StringUtils
.
equals
(
"done"
,
dt
o
.
getStatus
()))
{
if
(!
StringUtils
.
equals
(
"done"
,
issuesDa
o
.
getStatus
()))
{
issuesDao
.
setStatus
(
IssuesStatus
.
RESOLVED
.
toString
());
}
}
...
...
@@ -204,6 +191,8 @@ public class JiraPlatform extends AbstractIssuePlatform {
issuesRequest
.
setPlatform
(
IssuesManagePlatform
.
Jira
.
toString
());
JiraConfig
config
=
getConfig
();
jiraClientV2
.
setConfig
(
config
);
if
(
config
==
null
)
{
MSException
.
throwException
(
"jira config is null"
);
}
...
...
@@ -227,7 +216,6 @@ public class JiraPlatform extends AbstractIssuePlatform {
String
desc
=
Jsoup
.
clean
(
s
,
""
,
Whitelist
.
none
(),
new
Document
.
OutputSettings
().
prettyPrint
(
false
));
desc
=
desc
.
replace
(
" "
,
""
);
JSONObject
addJiraIssueParam
=
new
JSONObject
();
JSONObject
fields
=
new
JSONObject
();
JSONObject
project
=
new
JSONObject
();
...
...
@@ -239,13 +227,16 @@ public class JiraPlatform extends AbstractIssuePlatform {
issuetype
.
put
(
"name"
,
config
.
getIssuetype
());
fields
.
put
(
"summary"
,
issuesRequest
.
getTitle
());
fields
.
put
(
"description"
,
new
JiraIssueDescription
(
desc
));
// fields.put("description", new JiraIssueDescription(desc));
fields
.
put
(
"description"
,
desc
);
fields
.
put
(
"issuetype"
,
issuetype
);
JSONObject
addJiraIssueParam
=
new
JSONObject
();
addJiraIssueParam
.
put
(
"fields"
,
fields
);
List
<
CustomFieldItemDTO
>
customFields
=
getCustomFields
(
issuesRequest
.
getCustomFields
());
J
iraClient
.
setConfig
(
config
);
// List<JiraField> jiraFields = JiraClient.getFields();
j
iraClient
V2
.
setConfig
(
config
);
// List<JiraField> jiraFields = JiraClient
V2
.getFields();
// Map<String, Boolean> isCustomMap = jiraFields.stream().
// collect(Collectors.toMap(JiraField::getId, JiraField::isCustom));
...
...
@@ -261,7 +252,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
// }
}
});
JiraAddIssueResponse
result
=
J
iraClient
.
addIssue
(
JSONObject
.
toJSONString
(
addJiraIssueParam
));
JiraAddIssueResponse
result
=
j
iraClient
V2
.
addIssue
(
JSONObject
.
toJSONString
(
addJiraIssueParam
));
issuesRequest
.
setId
(
result
.
getKey
());
// 用例与第三方缺陷平台中的缺陷关联
...
...
@@ -278,46 +269,14 @@ public class JiraPlatform extends AbstractIssuePlatform {
handleIssueUpdate
(
request
);
}
private
String
addJiraIssue
(
String
url
,
String
auth
,
String
json
)
{
HttpHeaders
requestHeaders
=
new
HttpHeaders
();
requestHeaders
.
add
(
"Authorization"
,
"Basic "
+
auth
);
requestHeaders
.
setContentType
(
org
.
springframework
.
http
.
MediaType
.
APPLICATION_JSON
);
//HttpEntity
HttpEntity
<
String
>
requestEntity
=
new
HttpEntity
<>(
json
,
requestHeaders
);
RestTemplate
restTemplate
=
new
RestTemplate
();
//post
ResponseEntity
<
String
>
responseEntity
=
null
;
try
{
responseEntity
=
restTemplate
.
exchange
(
url
+
"/rest/api/2/issue"
,
HttpMethod
.
POST
,
requestEntity
,
String
.
class
);
}
catch
(
Exception
e
)
{
LogUtil
.
error
(
e
.
getMessage
(),
e
);
MSException
.
throwException
(
"调用Jira接口创建缺陷失败"
);
}
return
responseEntity
.
getBody
();
}
@Override
public
void
deleteIssue
(
String
id
)
{
}
@Override
public
void
testAuth
()
{
try
{
String
config
=
getPlatformConfig
(
IssuesManagePlatform
.
Jira
.
toString
());
JSONObject
object
=
JSON
.
parseObject
(
config
);
String
account
=
object
.
getString
(
"account"
);
String
password
=
object
.
getString
(
"password"
);
String
url
=
object
.
getString
(
"url"
);
HttpHeaders
headers
=
auth
(
account
,
password
);
HttpEntity
<
MultiValueMap
>
requestEntity
=
new
HttpEntity
<>(
headers
);
// 忽略ssl
restTemplateIgnoreSSL
.
exchange
(
url
+
"rest/api/2/issue/createmeta"
,
HttpMethod
.
GET
,
requestEntity
,
String
.
class
);
}
catch
(
Exception
e
)
{
LogUtil
.
error
(
e
.
getMessage
(),
e
);
MSException
.
throwException
(
"验证失败!"
);
}
setConfig
();
jiraClientV2
.
getIssueCreateMetadata
();
}
@Override
...
...
@@ -335,66 +294,18 @@ public class JiraPlatform extends AbstractIssuePlatform {
return
project
.
getJiraKey
();
}
public
IssuesDao
getJiraIssues
(
HttpHeaders
headers
,
String
url
,
String
issuesId
)
{
HttpEntity
<
MultiValueMap
>
requestEntity
=
new
HttpEntity
<>(
headers
);
RestTemplate
restTemplate
=
new
RestTemplate
();
//post
ResponseEntity
<
String
>
responseEntity
;
IssuesDao
issues
=
new
IssuesDao
();
try
{
responseEntity
=
restTemplate
.
exchange
(
url
+
"/rest/api/2/issue/"
+
issuesId
,
HttpMethod
.
GET
,
requestEntity
,
String
.
class
);
String
body
=
responseEntity
.
getBody
();
JSONObject
obj
=
JSONObject
.
parseObject
(
body
);
LogUtil
.
info
(
obj
);
String
lastmodify
=
""
;
String
status
=
""
;
JSONObject
fields
=
(
JSONObject
)
obj
.
get
(
"fields"
);
JSONObject
statusObj
=
(
JSONObject
)
fields
.
get
(
"status"
);
JSONObject
assignee
=
(
JSONObject
)
fields
.
get
(
"assignee"
);
if
(
statusObj
!=
null
)
{
JSONObject
statusCategory
=
(
JSONObject
)
statusObj
.
get
(
"statusCategory"
);
status
=
statusCategory
.
getString
(
"key"
);
}
String
id
=
obj
.
getString
(
"key"
);
String
title
=
fields
.
getString
(
"summary"
);
String
description
=
fields
.
getString
(
"description"
);
Parser
parser
=
Parser
.
builder
().
build
();
Node
document
=
parser
.
parse
(
description
);
HtmlRenderer
renderer
=
HtmlRenderer
.
builder
().
build
();
description
=
renderer
.
render
(
document
);
Long
createTime
=
fields
.
getLong
(
"created"
);
if
(
assignee
!=
null
)
{
lastmodify
=
assignee
.
getString
(
"displayName"
);
}
public
void
setConfig
()
{
JiraConfig
config
=
getConfig
();
jiraClientV2
.
setConfig
(
config
);
}
issues
.
setId
(
id
);
issues
.
setTitle
(
title
);
issues
.
setCreateTime
(
createTime
);
issues
.
setLastmodify
(
lastmodify
);
issues
.
setDescription
(
description
);
issues
.
setStatus
(
status
);
issues
.
setPlatform
(
IssuesManagePlatform
.
Jira
.
toString
());
}
catch
(
HttpClientErrorException
.
NotFound
e
)
{
LogUtil
.
error
(
e
.
getStackTrace
(),
e
);
return
new
IssuesDao
();
}
catch
(
HttpClientErrorException
.
Unauthorized
e
)
{
LogUtil
.
error
(
e
.
getStackTrace
(),
e
);
MSException
.
throwException
(
"获取Jira缺陷失败,检查Jira配置信息"
);
}
catch
(
Exception
e
)
{
LogUtil
.
error
(
e
.
getMessage
(),
e
);
MSException
.
throwException
(
"调用Jira接口获取缺陷失败"
);
public
IssuesWithBLOBs
getJiraIssues
(
IssuesWithBLOBs
issuesDao
,
String
issueId
)
{
setConfig
();
if
(
issuesDao
==
null
)
{
issuesDao
=
new
IssuesDao
();
}
return
issues
;
parseIssue
(
issuesDao
,
jiraClientV2
.
getIssues
(
issueId
));
return
issuesDao
;
}
}
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/track/issue/client/BaseClient.java
+
8
-
8
View file @
9a8c21c3
...
...
@@ -20,9 +20,9 @@ import java.util.Arrays;
public
abstract
class
BaseClient
{
protected
static
RestTemplate
restTemplate
;
protected
RestTemplate
restTemplate
;
static
{
{
try
{
TrustStrategy
acceptingTrustStrategy
=
(
X509Certificate
[]
chain
,
String
authType
)
->
true
;
SSLContext
sslContext
=
org
.
apache
.
http
.
ssl
.
SSLContexts
.
custom
()
...
...
@@ -41,28 +41,28 @@ public abstract class BaseClient {
}
}
protected
static
HttpHeaders
getBasicHttpHeaders
(
String
userName
,
String
passWd
)
{
protected
HttpHeaders
getBasicHttpHeaders
(
String
userName
,
String
passWd
)
{
String
authKey
=
EncryptUtils
.
base64Encoding
(
userName
+
":"
+
passWd
);
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
add
(
"Authorization"
,
"Basic "
+
authKey
);
return
headers
;
}
protected
static
String
getResult
(
ResponseEntity
<
String
>
response
)
{
protected
String
getResult
(
ResponseEntity
<
String
>
response
)
{
int
statusCodeValue
=
response
.
getStatusCodeValue
();
LogUtil
.
info
(
"responseCode: "
+
statusCodeValue
);
LogUtil
.
debug
(
"responseCode: "
+
statusCodeValue
);
if
(
statusCodeValue
>=
400
){
MSException
.
throwException
(
response
.
getBody
());
}
LogUtil
.
info
(
"result: "
+
response
.
getBody
());
LogUtil
.
debug
(
"result: "
+
response
.
getBody
());
return
response
.
getBody
();
}
protected
static
Object
getResultForList
(
Class
clazz
,
ResponseEntity
<
String
>
response
)
{
protected
Object
getResultForList
(
Class
clazz
,
ResponseEntity
<
String
>
response
)
{
return
Arrays
.
asList
(
JSONArray
.
parseArray
(
getResult
(
response
),
clazz
).
toArray
());
}
protected
static
Object
getResultForObject
(
Class
clazz
,
ResponseEntity
<
String
>
response
)
{
protected
Object
getResultForObject
(
Class
clazz
,
ResponseEntity
<
String
>
response
)
{
return
JSONObject
.
parseObject
(
getResult
(
response
),
clazz
);
}
}
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/track/issue/client/JiraClient.java
→
backend/src/main/java/io/metersphere/track/issue/client/Jira
Abstract
Client.java
+
36
-
30
View file @
9a8c21c3
package
io.metersphere.track.issue.client
;
import
io.metersphere.commons.exception.MSException
;
import
io.metersphere.commons.utils.LogUtil
;
import
io.metersphere.track.issue.domain.JiraAddIssueResponse
;
import
io.metersphere.track.issue.domain.JiraConfig
;
import
io.metersphere.track.issue.domain.JiraField
;
...
...
@@ -11,38 +12,55 @@ import org.springframework.util.MultiValueMap;
import
java.util.List
;
public
class
JiraClient
extends
BaseClient
{
public
abstract
class
Jira
Abstract
Client
extends
BaseClient
{
pr
ivate
static
String
ENDPOINT
;
pr
otected
String
ENDPOINT
;
pr
ivate
static
String
PREFIX
=
"/rest/api/3"
;
pr
otected
String
PREFIX
;
pr
ivate
static
String
USER_NAME
;
pr
otected
String
USER_NAME
;
pr
ivate
static
String
PASSWD
;
pr
otected
String
PASSWD
;
public
static
List
<
JiraField
>
getFields
()
{
String
url
=
getBaseUrl
()
+
"/field"
;
ResponseEntity
<
String
>
response
=
restTemplate
.
exchange
(
url
,
HttpMethod
.
GET
,
getAuthHttpEntity
(),
String
.
class
);
return
(
List
<
JiraField
>)
getResultForList
(
JiraField
.
class
,
response
);
}
public
static
JiraIssue
getIssues
(
String
issuesId
)
{
HttpEntity
<
MultiValueMap
>
requestEntity
=
getAuthHttpEntity
();
public
JiraIssue
getIssues
(
String
issuesId
)
{
LogUtil
.
debug
(
"getIssues: "
+
issuesId
);
ResponseEntity
<
String
>
responseEntity
;
responseEntity
=
restTemplate
.
exchange
(
ENDPOINT
+
"/rest/api/2
/issue/"
+
issuesId
,
HttpMethod
.
GET
,
request
Entity
,
String
.
class
);
responseEntity
=
restTemplate
.
exchange
(
getBaseUrl
()
+
"
/issue/"
+
issuesId
,
HttpMethod
.
GET
,
getAuthHttp
Entity
()
,
String
.
class
);
return
(
JiraIssue
)
getResultForObject
(
JiraIssue
.
class
,
responseEntity
);
}
public
static
JiraAddIssueResponse
addIssue
(
String
body
)
{
public
List
<
JiraField
>
getFields
()
{
ResponseEntity
<
String
>
response
=
restTemplate
.
exchange
(
getBaseUrl
()
+
"/field"
,
HttpMethod
.
GET
,
getAuthHttpEntity
(),
String
.
class
);
return
(
List
<
JiraField
>)
getResultForList
(
JiraField
.
class
,
response
);
}
public
JiraAddIssueResponse
addIssue
(
String
body
)
{
LogUtil
.
debug
(
"addIssue: "
+
body
);
HttpHeaders
headers
=
getAuthHeader
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
HttpEntity
<
String
>
requestEntity
=
new
HttpEntity
<>(
body
,
headers
);
ResponseEntity
<
String
>
entity
=
restTemplate
.
exchange
(
getBaseUrl
()
+
"/issue"
,
HttpMethod
.
POST
,
requestEntity
,
String
.
class
);
return
(
JiraAddIssueResponse
)
getResultForObject
(
JiraAddIssueResponse
.
class
,
entity
);
ResponseEntity
<
String
>
response
=
restTemplate
.
exchange
(
getBaseUrl
()
+
"/issue"
,
HttpMethod
.
POST
,
requestEntity
,
String
.
class
);
return
(
JiraAddIssueResponse
)
getResultForObject
(
JiraAddIssueResponse
.
class
,
response
);
}
public
String
getIssueCreateMetadata
()
{
ResponseEntity
<
String
>
response
=
restTemplate
.
exchange
(
getBaseUrl
()
+
"/createmeta"
,
HttpMethod
.
GET
,
getAuthHttpEntity
(),
String
.
class
);
return
(
String
)
getResultForObject
(
String
.
class
,
response
);
}
protected
HttpEntity
<
MultiValueMap
>
getAuthHttpEntity
()
{
return
new
HttpEntity
<>(
getAuthHeader
());
}
protected
HttpHeaders
getAuthHeader
()
{
return
getBasicHttpHeaders
(
USER_NAME
,
PASSWD
);
}
protected
String
getBaseUrl
()
{
return
ENDPOINT
+
PREFIX
;
}
public
static
void
setConfig
(
JiraConfig
config
)
{
public
void
setConfig
(
JiraConfig
config
)
{
if
(
config
==
null
)
{
MSException
.
throwException
(
"config is null"
);
}
...
...
@@ -55,16 +73,4 @@ public class JiraClient extends BaseClient {
USER_NAME
=
config
.
getAccount
();
PASSWD
=
config
.
getPassword
();
}
private
static
HttpEntity
<
MultiValueMap
>
getAuthHttpEntity
()
{
return
new
HttpEntity
<>(
getAuthHeader
());
}
private
static
HttpHeaders
getAuthHeader
()
{
return
getBasicHttpHeaders
(
USER_NAME
,
PASSWD
);
}
private
static
String
getBaseUrl
()
{
return
ENDPOINT
+
PREFIX
;
}
}
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/track/issue/client/JiraClientV2.java
0 → 100644
+
10
-
0
View file @
9a8c21c3
package
io.metersphere.track.issue.client
;
import
org.springframework.stereotype.Component
;
@Component
public
class
JiraClientV2
extends
JiraAbstractClient
{
{
PREFIX
=
"/rest/api/2"
;
}
}
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/track/issue/client/JiraClientV3.java
0 → 100644
+
7
-
0
View file @
9a8c21c3
package
io.metersphere.track.issue.client
;
public
class
JiraClientV3
extends
JiraAbstractClient
{
{
PREFIX
=
"/rest/api/3"
;
}
}
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/track/issue/domain/JiraIssueDescription.java
→
backend/src/main/java/io/metersphere/track/issue/domain/JiraIssueDescription
V3
.java
+
2
-
2
View file @
9a8c21c3
...
...
@@ -8,12 +8,12 @@ import java.util.List;
@Data
@NoArgsConstructor
public
class
JiraIssueDescription
{
public
class
JiraIssueDescription
V3
{
private
String
type
;
private
int
version
;
private
List
<
Content
>
content
;
public
JiraIssueDescription
(
String
text
)
{
public
JiraIssueDescription
V3
(
String
text
)
{
List
<
Content
>
list
=
new
ArrayList
<>();
Content
content
=
new
Content
(
text
);
list
.
add
(
content
);
...
...
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/track/service/IssuesService.java
+
1
-
9
View file @
9a8c21c3
...
...
@@ -33,7 +33,6 @@ import io.metersphere.track.request.testcase.IssuesUpdateRequest;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -380,14 +379,7 @@ public class IssuesService {
issue
.
setStatus
(
tapdIssues
.
getStatus
());
}
else
if
(
StringUtils
.
equals
(
platform
,
IssuesManagePlatform
.
Jira
.
name
()))
{
JiraPlatform
jiraPlatform
=
new
JiraPlatform
(
new
IssuesRequest
());
String
config
=
getConfig
(
orgId
,
IssuesManagePlatform
.
Jira
.
toString
());
JSONObject
object
=
JSON
.
parseObject
(
config
);
HttpHeaders
headers
=
jiraPlatform
.
getAuthHeader
(
object
);
String
url
=
object
.
getString
(
"url"
);
IssuesDao
jiraIssues
=
jiraPlatform
.
getJiraIssues
(
headers
,
url
,
issue
.
getId
());
issue
.
setTitle
(
jiraIssues
.
getTitle
());
issue
.
setDescription
(
jiraIssues
.
getDescription
());
issue
.
setStatus
(
jiraIssues
.
getStatus
());
jiraPlatform
.
getJiraIssues
(
issue
,
issue
.
getId
());
}
else
if
(
StringUtils
.
equals
(
platform
,
IssuesManagePlatform
.
Zentao
.
name
()))
{
String
config
=
getConfig
(
orgId
,
IssuesManagePlatform
.
Zentao
.
toString
());
JSONObject
object
=
JSON
.
parseObject
(
config
);
...
...
This diff is collapsed.
Click to expand it.
frontend/src/network/Issue.js
+
2
-
0
View file @
9a8c21c3
...
...
@@ -32,12 +32,14 @@ export function getIssuesByCaseId(caseId, page) {
}
export
function
buildPlatformIssue
(
data
)
{
data
.
customFields
=
JSON
.
stringify
(
data
.
customFields
);
return
post
(
"
issues/get/platform/issue
"
,
data
).
then
(
response
=>
{
let
issues
=
response
.
data
.
data
;
if
(
issues
)
{
data
.
title
=
issues
.
title
?
issues
.
title
:
'
--
'
;
data
.
description
=
issues
.
description
?
issues
.
description
:
'
--
'
;
data
.
status
=
issues
.
status
?
issues
.
status
:
'
delete
'
;
data
.
customFields
=
JSON
.
parse
(
data
.
customFields
);
}
}).
catch
(()
=>
{
data
.
title
=
'
--
'
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help