feat: tapd 提自定义缺陷
This commit is contained in:
parent
2af69af145
commit
112827ce04
|
@ -0,0 +1,11 @@
|
|||
package io.metersphere.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CustomFieldItemDTO {
|
||||
private String id;
|
||||
private String name;
|
||||
private String value;
|
||||
private String customData;
|
||||
}
|
|
@ -1,6 +1,10 @@
|
|||
package io.metersphere.track.issue;
|
||||
|
||||
import io.metersphere.base.domain.*;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import io.metersphere.base.domain.IssuesWithBLOBs;
|
||||
import io.metersphere.base.domain.ServiceIntegration;
|
||||
import io.metersphere.base.domain.TestCaseIssues;
|
||||
import io.metersphere.base.domain.TestCaseIssuesExample;
|
||||
import io.metersphere.base.mapper.IssuesMapper;
|
||||
import io.metersphere.base.mapper.TestCaseIssuesMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtIssuesMapper;
|
||||
|
@ -11,6 +15,7 @@ import io.metersphere.commons.utils.EncryptUtils;
|
|||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.controller.request.IntegrationRequest;
|
||||
import io.metersphere.dto.CustomFieldItemDTO;
|
||||
import io.metersphere.service.IntegrationService;
|
||||
import io.metersphere.service.ProjectService;
|
||||
import io.metersphere.track.request.testcase.IssuesRequest;
|
||||
|
@ -28,6 +33,7 @@ import org.springframework.web.client.RestTemplate;
|
|||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -166,4 +172,11 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
|
|||
issues.setUpdateTime(System.currentTimeMillis());
|
||||
issuesMapper.insert(issues);
|
||||
}
|
||||
|
||||
protected List<CustomFieldItemDTO> getCustomFields(String customFieldsStr) {
|
||||
if (StringUtils.isNotBlank(customFieldsStr)) {
|
||||
return JSONArray.parseArray(customFieldsStr, CustomFieldItemDTO.class);
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import io.metersphere.commons.exception.MSException;
|
|||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.controller.ResultHolder;
|
||||
import io.metersphere.dto.CustomFieldItemDTO;
|
||||
import io.metersphere.track.dto.DemandDTO;
|
||||
import io.metersphere.track.issue.domain.PlatformUser;
|
||||
import io.metersphere.track.request.testcase.IssuesRequest;
|
||||
|
@ -150,6 +151,8 @@ public class TapdPlatform extends AbstractIssuePlatform {
|
|||
public void addIssue(IssuesUpdateRequest issuesRequest) {
|
||||
issuesRequest.setPlatform(IssuesManagePlatform.Tapd.toString());
|
||||
|
||||
List<CustomFieldItemDTO> customFields = getCustomFields(issuesRequest.getCustomFields());
|
||||
|
||||
String url = "https://api.tapd.cn/bugs";
|
||||
String testCaseId = issuesRequest.getTestCaseId();
|
||||
String tapdId = getProjectId(issuesRequest.getProjectId());
|
||||
|
@ -173,6 +176,12 @@ public class TapdPlatform extends AbstractIssuePlatform {
|
|||
paramMap.add("reporter", username);
|
||||
paramMap.add("current_owner", usersStr);
|
||||
|
||||
customFields.forEach(item -> {
|
||||
if (StringUtils.isNotBlank(item.getCustomData())) {
|
||||
paramMap.add(item.getCustomData(), item.getValue());
|
||||
}
|
||||
});
|
||||
|
||||
ResultHolder result = call(url, HttpMethod.POST, paramMap);
|
||||
|
||||
String listJson = JSON.toJSONString(result.getData());
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
</template>
|
||||
</ms-table-column>
|
||||
|
||||
<!-- <field-custom-data-table-item :scene="scene"/>-->
|
||||
<field-custom-data-table-item :scene="scene"/>
|
||||
|
||||
<ms-table-column
|
||||
:label="$t('api_test.definition.document.table_coloum.is_required')"
|
||||
|
|
|
@ -100,7 +100,8 @@ export function buildCustomFields(data, param, template) {
|
|||
let customField = {
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
value: item.defaultValue
|
||||
value: item.defaultValue,
|
||||
customData: item.customData
|
||||
};
|
||||
customFields.push(customField);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue