fix: 创建jira缺陷多选用户类型报错

This commit is contained in:
chenjianxing 2022-01-25 14:53:06 +08:00 committed by 刘瑞斌
parent 1a78b3dc7c
commit 26a15c8ada
1 changed files with 12 additions and 2 deletions

View File

@ -214,14 +214,21 @@ public class JiraPlatform extends AbstractIssuePlatform {
fields.put(key, field.getInteger("id"));
} catch (Exception e) {}
}
if (schema.getType() != null && schema.getType().endsWith("user")) {
if (isUserKey) {
if (schema.getType() != null && schema.getType().endsWith("user")) {
JSONObject field = fields.getJSONObject(key);
if (isUserKey) {
// 如果不是用户ID则是用户的key参数调整为key
JSONObject newField = new JSONObject();
newField.put("name", field.getString("id"));
fields.put(key, newField);
}
if (schema.getCustom() != null && schema.getCustom().endsWith("multiuserpicker")) { // 多选用户列表
try {
JSONArray userItems = fields.getJSONArray(key);
userItems.forEach(i ->
((JSONObject) i).put("name", ((JSONObject) i).getString("id")));
} catch (Exception e) {LogUtil.error(e);}
}
}
}
} catch (Exception e) {
@ -511,6 +518,9 @@ public class JiraPlatform extends AbstractIssuePlatform {
value = CustomFieldType.MULTIPLE_SELECT.getValue();
} else if (customType.contains("cascadingselect")) {
value = "cascadingSelect";
} else if (customType.contains("multiuserpicker")) {
value = CustomFieldType.MULTIPLE_SELECT.getValue();
customFieldDao.setOptions(userOptions);
} else if (customType.contains("userpicker")) {
value = CustomFieldType.SELECT.getValue();
customFieldDao.setOptions(userOptions);