diff --git a/backend/src/main/java/io/metersphere/track/issue/AbstractIssuePlatform.java b/backend/src/main/java/io/metersphere/track/issue/AbstractIssuePlatform.java index 8213c1812b..b01baa7137 100644 --- a/backend/src/main/java/io/metersphere/track/issue/AbstractIssuePlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/AbstractIssuePlatform.java @@ -419,7 +419,11 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform { Object value = issue.get(fieldName); if (value != null) { 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) { List values = new ArrayList<>(); ((JSONArray)value).forEach(attr -> { diff --git a/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java b/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java index 09c306dc98..8ff1c3fc88 100644 --- a/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java @@ -27,6 +27,7 @@ import io.metersphere.track.request.testcase.IssuesUpdateRequest; import io.metersphere.track.service.IssuesService; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringEscapeUtils; +import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.http.ResponseEntity; import org.springframework.web.client.HttpClientErrorException; @@ -411,21 +412,26 @@ public class JiraPlatform extends AbstractIssuePlatform { private void parseCustomFiled(IssuesUpdateRequest issuesRequest, List customFields, JSONObject fields) { customFields.forEach(item -> { String fieldName = item.getCustomData(); + String name = item.getName(); if (StringUtils.isNotBlank(fieldName)) { - if (item.getValue() != null) { + if (ObjectUtils.isNotEmpty(item.getValue())) { if (StringUtils.isNotBlank(item.getType())) { if (StringUtils.equalsAny(item.getType(), "select", "radio", "member")) { - 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()); - } + if (StringUtils.equalsAnyIgnoreCase(name, "PML", "PMLinkTest", "PMLink")) { + fields.put(fieldName, item.getValue()); } 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("accountId", 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")) { JSONArray attrs = new JSONArray(); if (item.getValue() != null) {