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) {
if (StringUtils.equals(fieldName, "assignee")) {
item.setValue(((JSONObject) value).get("displayName"));
} else {
item.setValue(getSyncJsonParamValue(value)); 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,10 +419,14 @@ 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")) {
if (StringUtils.equalsAnyIgnoreCase(name, "PML", "PMLinkTest", "PMLink")) {
fields.put(fieldName, item.getValue());
} else {
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
if (fieldName.equals("assignee") || fieldName.equals("reporter")) { if (fieldName.equals("assignee") || fieldName.equals("reporter")) {
if (issuesRequest.isThirdPartPlatform()) { if (issuesRequest.isThirdPartPlatform()) {
@ -434,6 +438,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
param.put("id", item.getValue()); 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) {