fix(测试跟踪): Jira同步经办人及项目集字段有误 (#18281)

--bug=1017197 --user=宋昌昌 【测试跟踪】github #17764,MS和Jira集成已经成功,在MS中创建缺陷,拉取的Jira缺陷模板,少一个自定义字段【项目集】,其他的自定义字段都可以拉取到。 https://www.tapd.cn/55049933/s/1252392

Co-authored-by: song-cc-rock <changchang.song@fit2cloud.com>
This commit is contained in:
MeterSphere Bot 2022-09-27 10:27:21 +08:00 committed by GitHub
parent 5db5da7229
commit 5f3faf63a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 10 deletions

View File

@ -433,7 +433,11 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
Object value = issue.get(fieldName); Object value = issue.get(fieldName);
if (value != null) { if (value != null) {
if (value instanceof JSONObject) { if (value instanceof JSONObject) {
item.setValue(getSyncJsonParamValue(value)); if (StringUtils.equals(fieldName, "assignee")) {
item.setValue(((JSONObject) value).get("displayName"));
} else {
item.setValue(getSyncJsonParamValue(value));
}
} else if (value instanceof JSONArray) { } else if (value instanceof JSONArray) {
// Sprint 是单选 同步回来是 JSONArray // Sprint 是单选 同步回来是 JSONArray
if (StringUtils.equals(item.getType(), "select")) { if (StringUtils.equals(item.getType(), "select")) {

View File

@ -419,21 +419,26 @@ public class JiraPlatform extends AbstractIssuePlatform {
customFields.forEach(item -> { customFields.forEach(item -> {
String fieldName = item.getCustomData(); String fieldName = item.getCustomData();
String name = item.getName();
if (StringUtils.isNotBlank(fieldName)) { if (StringUtils.isNotBlank(fieldName)) {
if (ObjectUtils.isNotEmpty(item.getValue())) { if (ObjectUtils.isNotEmpty(item.getValue())) {
if (StringUtils.isNotBlank(item.getType())) { if (StringUtils.isNotBlank(item.getType())) {
if (StringUtils.equalsAny(item.getType(), "select", "radio", "member")) { if (StringUtils.equalsAny(item.getType(), "select", "radio", "member")) {
JSONObject param = new JSONObject(); if (StringUtils.equalsAnyIgnoreCase(name, "PML", "PMLinkTest", "PMLink")) {
if (fieldName.equals("assignee") || fieldName.equals("reporter")) { fields.put(fieldName, item.getValue());
if (issuesRequest.isThirdPartPlatform()) {
param.put("id", item.getValue());
} else {
param.put("name", item.getValue());
}
} else { } else {
param.put("id", item.getValue()); JSONObject param = new JSONObject();
if (fieldName.equals("assignee") || fieldName.equals("reporter")) {
if (issuesRequest.isThirdPartPlatform()) {
param.put("id", item.getValue());
} else {
param.put("name", item.getValue());
}
} else {
param.put("id", item.getValue());
}
fields.put(fieldName, param);
} }
fields.put(fieldName, param);
} else if (StringUtils.equalsAny(item.getType(), "multipleSelect", "checkbox", "multipleMember")) { } else if (StringUtils.equalsAny(item.getType(), "multipleSelect", "checkbox", "multipleMember")) {
JSONArray attrs = new JSONArray(); JSONArray attrs = new JSONArray();
if (item.getValue() != null) { if (item.getValue() != null) {