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 dee9e31498..02a9e62c8f 100644 --- a/backend/src/main/java/io/metersphere/track/issue/AbstractIssuePlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/AbstractIssuePlatform.java @@ -396,6 +396,27 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform { }); } + protected Object getSyncJsonParamValue(Object value) { + JSONObject valObj = ((JSONObject) value); + String accountId = valObj.getString("accountId"); + JSONObject child = valObj.getJSONObject("child"); + if (child != null) {// 级联框 + List values = new ArrayList<>(); + if (StringUtils.isNotBlank(valObj.getString("id"))) { + values.add(valObj.getString("id")); + } + if (StringUtils.isNotBlank(child.getString("id"))) { + values.add(child.getString("id")); + } + return values; + } else if (StringUtils.isNotBlank(accountId) && isThirdPartTemplate) { + // 用户选择框 + return accountId; + } else { + return valObj.getString("id"); + } + } + protected String syncIssueCustomField(String customFieldsStr, JSONObject issue) { List customFields = CustomFieldService.getCustomFields(customFieldsStr); Set names = issue.keySet(); @@ -404,31 +425,12 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform { Object value = issue.get(fieldName); if (value != null) { if (value instanceof JSONObject) { - JSONObject valObj = ((JSONObject) value); - String accountId = valObj.getString("accountId"); - JSONObject child = valObj.getJSONObject("child"); - if (child != null) {// 级联框 - List values = new ArrayList<>(); - if (StringUtils.isNotBlank(valObj.getString("id"))) { - values.add(valObj.getString("id")); - } - if (StringUtils.isNotBlank(child.getString("id"))) { - values.add(child.getString("id")); - } - item.setValue(values); - } else if (StringUtils.isNotBlank(accountId)) { - // 用户选择框 - if (isThirdPartTemplate) { - item.setValue(accountId); - } - } else { - item.setValue(valObj.getString("id")); - } + item.setValue(getSyncJsonParamValue(value)); } else if (value instanceof JSONArray) { List values = new ArrayList<>(); ((JSONArray)value).forEach(attr -> { if (attr instanceof JSONObject) { - values.add(((JSONObject)attr).getString("id")); + values.add(getSyncJsonParamValue(attr)); } else { values.add(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 13a8051440..0212c5fb36 100644 --- a/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java @@ -524,6 +524,13 @@ public class JiraPlatform extends AbstractIssuePlatform { } else if (customType.contains("userpicker")) { value = CustomFieldType.SELECT.getValue(); customFieldDao.setOptions(userOptions); + } else if (customType.contains("people")) { + if (StringUtils.isNotBlank(schema.getType()) && StringUtils.equals(schema.getType(), "array")) { + value = CustomFieldType.MULTIPLE_SELECT.getValue(); + } else { + value = CustomFieldType.SELECT.getValue(); + } + customFieldDao.setOptions(userOptions); } else if (customType.contains("multicheckboxes")) { value = CustomFieldType.CHECKBOX.getValue(); customFieldDao.setDefaultValue(JSONObject.toJSONString(new ArrayList<>()));