feat: 同步禅道缺陷
This commit is contained in:
parent
fa309bed19
commit
5cac6b1ea5
|
@ -4,13 +4,12 @@ import com.github.pagehelper.Page;
|
|||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.base.domain.Issues;
|
||||
import io.metersphere.base.domain.IssuesDao;
|
||||
import io.metersphere.base.domain.IssuesWithBLOBs;
|
||||
import io.metersphere.commons.constants.OperLogConstants;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.log.annotation.MsAuditLog;
|
||||
import io.metersphere.track.issue.domain.PlatformUser;
|
||||
import io.metersphere.track.issue.domain.ZentaoBuild;
|
||||
import io.metersphere.track.issue.domain.zentao.ZentaoBuild;
|
||||
import io.metersphere.track.request.testcase.IssuesRequest;
|
||||
import io.metersphere.track.request.testcase.IssuesUpdateRequest;
|
||||
import io.metersphere.track.service.IssuesService;
|
||||
|
@ -92,11 +91,6 @@ public class IssuesController {
|
|||
return issuesService.getZentaoBuilds(request);
|
||||
}
|
||||
|
||||
// @PostMapping("/get/platform/issue")
|
||||
// public IssuesWithBLOBs getPlatformIssue(@RequestBody IssuesWithBLOBs issue) {
|
||||
// return issuesService.getPlatformIssue(issue);
|
||||
// }
|
||||
|
||||
@GetMapping("/sync/{projectId}")
|
||||
public void getPlatformIssue(@PathVariable String projectId) {
|
||||
issuesService.syncThirdPartyIssues(projectId);
|
||||
|
|
|
@ -11,6 +11,7 @@ import io.metersphere.commons.exception.MSException;
|
|||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import io.metersphere.commons.utils.EncryptUtils;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.*;
|
||||
import io.metersphere.controller.request.IntegrationRequest;
|
||||
import io.metersphere.dto.CustomFieldItemDTO;
|
||||
import io.metersphere.dto.UserDTO;
|
||||
|
@ -180,6 +181,16 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
|
|||
issuesMapper.insert(issues);
|
||||
}
|
||||
|
||||
protected void insertIssues(String id, IssuesUpdateRequest issuesRequest) {
|
||||
IssuesWithBLOBs issues = new IssuesWithBLOBs();
|
||||
BeanUtils.copyBean(issues, issuesRequest);
|
||||
issues.setId(id);
|
||||
issues.setCreateTime(System.currentTimeMillis());
|
||||
issues.setUpdateTime(System.currentTimeMillis());
|
||||
issues.setNum(getNextNum(issuesRequest.getProjectId()));
|
||||
issuesMapper.insert(issues);
|
||||
}
|
||||
|
||||
protected int getNextNum(String projectId) {
|
||||
Issues issue = extIssuesMapper.getNextNum(projectId);
|
||||
if (issue == null || issue.getNum() == null) {
|
||||
|
|
|
@ -18,12 +18,6 @@ public interface IssuesPlatform {
|
|||
*/
|
||||
List<IssuesDao> getIssue(IssuesRequest request);
|
||||
|
||||
/**
|
||||
* 过滤分页数据
|
||||
* @param issues
|
||||
*/
|
||||
void filter(List<IssuesDao> issues);
|
||||
|
||||
/*获取平台相关需求*/
|
||||
List<DemandDTO> getDemandList(String projectId);
|
||||
|
||||
|
|
|
@ -3,20 +3,22 @@ package io.metersphere.track.issue;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.domain.IssuesDao;
|
||||
import io.metersphere.base.domain.IssuesWithBLOBs;
|
||||
import io.metersphere.base.domain.Project;
|
||||
import io.metersphere.base.domain.TestCaseWithBLOBs;
|
||||
import io.metersphere.commons.constants.IssuesManagePlatform;
|
||||
import io.metersphere.commons.constants.IssuesStatus;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.EncryptUtils;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.dto.CustomFieldItemDTO;
|
||||
import io.metersphere.dto.UserDTO;
|
||||
import io.metersphere.track.dto.DemandDTO;
|
||||
import io.metersphere.track.issue.client.JiraClientV2;
|
||||
import io.metersphere.track.issue.domain.JiraAddIssueResponse;
|
||||
import io.metersphere.track.issue.domain.JiraConfig;
|
||||
import io.metersphere.track.issue.domain.JiraIssue;
|
||||
import io.metersphere.track.issue.domain.Jira.JiraAddIssueResponse;
|
||||
import io.metersphere.track.issue.domain.Jira.JiraConfig;
|
||||
import io.metersphere.track.issue.domain.Jira.JiraIssue;
|
||||
import io.metersphere.track.issue.domain.PlatformUser;
|
||||
import io.metersphere.track.request.testcase.IssuesRequest;
|
||||
import io.metersphere.track.request.testcase.IssuesUpdateRequest;
|
||||
|
@ -124,23 +126,6 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
|||
item.setPlatform(IssuesManagePlatform.Jira.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void filter(List<IssuesDao> issues) {
|
||||
setConfig(null);
|
||||
issues.forEach((issuesDao) -> {
|
||||
parseIssue(issuesDao, jiraClientV2.getIssues(issuesDao.getId()));
|
||||
if (StringUtils.isBlank(issuesDao.getId())) {
|
||||
// 标记成删除
|
||||
issuesDao.setStatus(IssuesStatus.DELETE.toString());
|
||||
} else {
|
||||
// 缺陷状态为 完成,则不显示
|
||||
if (!StringUtils.equals("done", issuesDao.getStatus())) {
|
||||
issuesDao.setStatus(IssuesStatus.RESOLVED.toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DemandDTO> getDemandList(String projectId) {
|
||||
List<DemandDTO> list = new ArrayList<>();
|
||||
|
@ -217,19 +202,11 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
|||
|
||||
String jiraKey = validateJiraKey(issuesRequest.getProjectId());
|
||||
|
||||
String content = issuesRequest.getDescription();
|
||||
|
||||
Document document = Jsoup.parse(content);
|
||||
document.outputSettings(new Document.OutputSettings().prettyPrint(false));
|
||||
document.select("br").append("\\n");
|
||||
document.select("p").prepend("\\n\\n");
|
||||
String s = document.html().replaceAll("\\\\n", "\n");
|
||||
String desc = Jsoup.clean(s, "", Whitelist.none(), new Document.OutputSettings().prettyPrint(false));
|
||||
desc = desc.replace(" ", "");
|
||||
|
||||
JSONObject fields = new JSONObject();
|
||||
JSONObject project = new JSONObject();
|
||||
|
||||
// String desc = ms2JiraDescription(issuesRequest.getDescription());
|
||||
String desc = issuesRequest.getDescription();
|
||||
|
||||
fields.put("project", project);
|
||||
project.put("key", jiraKey);
|
||||
|
@ -270,7 +247,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
|||
handleTestCaseIssues(issuesRequest);
|
||||
|
||||
// 插入缺陷表
|
||||
insertIssuesWithoutContext(result.getKey(), issuesRequest);
|
||||
insertIssues(result.getKey(), issuesRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -284,6 +261,16 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
|||
public void deleteIssue(String id) {
|
||||
}
|
||||
|
||||
private String jiraDescription2Ms(String jiraDescription) {
|
||||
Document document = Jsoup.parse(jiraDescription);
|
||||
document.outputSettings(new Document.OutputSettings().prettyPrint(false));
|
||||
document.select("br").append("\\n");
|
||||
document.select("p").prepend("\\n\\n");
|
||||
String s = document.html().replaceAll("\\\\n", "\n");
|
||||
String desc = Jsoup.clean(s, "", Whitelist.none(), new Document.OutputSettings().prettyPrint(false));
|
||||
return desc.replace(" ", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testAuth() {
|
||||
setConfig(null);
|
||||
|
@ -301,6 +288,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
|||
setConfig(null);
|
||||
try {
|
||||
parseIssue(item, jiraClientV2.getIssues(item.getId()));
|
||||
item.setDescription(jiraDescription2Ms(item.getDescription()));
|
||||
// 缺陷状态为 完成,则不显示
|
||||
if (StringUtils.equals("done", item.getStatus())) {
|
||||
item.setStatus(IssuesStatus.RESOLVED.toString());
|
||||
|
|
|
@ -34,10 +34,6 @@ public class LocalPlatform extends AbstractIssuePlatform {
|
|||
return extIssuesMapper.getIssuesByCaseId(issuesRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void filter(List<IssuesDao> issues) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DemandDTO> getDemandList(String projectId) {
|
||||
return null;
|
||||
|
|
|
@ -8,7 +8,6 @@ import io.metersphere.base.domain.IssuesDao;
|
|||
import io.metersphere.base.domain.Project;
|
||||
import io.metersphere.base.domain.TestCaseWithBLOBs;
|
||||
import io.metersphere.commons.constants.IssuesManagePlatform;
|
||||
import io.metersphere.commons.constants.IssuesStatus;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.BeanUtils;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
|
@ -19,8 +18,8 @@ import io.metersphere.dto.UserDTO;
|
|||
import io.metersphere.track.dto.DemandDTO;
|
||||
import io.metersphere.track.issue.client.TapdClient;
|
||||
import io.metersphere.track.issue.domain.PlatformUser;
|
||||
import io.metersphere.track.issue.domain.TapdConfig;
|
||||
import io.metersphere.track.issue.domain.TapdGetIssueResponse;
|
||||
import io.metersphere.track.issue.domain.tapd.TapdConfig;
|
||||
import io.metersphere.track.issue.domain.tapd.TapdGetIssueResponse;
|
||||
import io.metersphere.track.request.testcase.IssuesRequest;
|
||||
import io.metersphere.track.request.testcase.IssuesUpdateRequest;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
@ -50,8 +49,6 @@ public class TapdPlatform extends AbstractIssuePlatform {
|
|||
|
||||
@Override
|
||||
public List<IssuesDao> getIssue(IssuesRequest issuesRequest) {
|
||||
// List<IssuesDao> list = new ArrayList<>();
|
||||
// String tapdId = getProjectId(issuesRequest.getProjectId());
|
||||
issuesRequest.setPlatform(IssuesManagePlatform.Tapd.toString());
|
||||
List<IssuesDao> issues;
|
||||
if (StringUtils.isNotBlank(issuesRequest.getProjectId())) {
|
||||
|
@ -84,30 +81,6 @@ public class TapdPlatform extends AbstractIssuePlatform {
|
|||
return issues;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void filter(List<IssuesDao> issues) {
|
||||
String tapdId = "";
|
||||
for (IssuesDao item : issues) {
|
||||
if (StringUtils.isNotBlank(item.getProjectId())) {
|
||||
tapdId = getProjectId(issues.get(0).getProjectId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (IssuesDao item : issues) {
|
||||
IssuesDao dto = getTapdIssues(tapdId, item.getId());
|
||||
if (StringUtils.isBlank(dto.getId())) {
|
||||
// 标记成删除
|
||||
item.setStatus(IssuesStatus.DELETE.toString());
|
||||
} else {
|
||||
// 缺陷状态为 完成,则不显示
|
||||
if (!StringUtils.equals(IssuesStatus.CLOSED.toString(), dto.getStatus())) {
|
||||
item.setStatus(IssuesStatus.CLOSED.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DemandDTO> getDemandList(String projectId) {
|
||||
List<DemandDTO> demandList = new ArrayList<>();
|
||||
|
@ -141,7 +114,7 @@ public class TapdPlatform extends AbstractIssuePlatform {
|
|||
Long created = bug.getLong("created");
|
||||
IssuesDao issues = jsonObject.getObject("Bug", IssuesDao.class);
|
||||
|
||||
// 获取工作流中缺陷状态名称
|
||||
// 获取工作流中缺陷状态名称 todo
|
||||
String workflow = "https://api.tapd.cn/workflows/status_map?workspace_id=" + projectId + "&system=bug";
|
||||
ResultHolder resultHolder = call(workflow);
|
||||
String workflowJson = JSON.toJSONString(resultHolder.getData());
|
||||
|
@ -199,7 +172,7 @@ public class TapdPlatform extends AbstractIssuePlatform {
|
|||
handleTestCaseIssues(issuesRequest);
|
||||
|
||||
// 插入缺陷表
|
||||
insertIssuesWithoutContext(issuesId, issuesRequest);
|
||||
insertIssues(issuesId, issuesRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,14 +4,20 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.domain.IssuesDao;
|
||||
import io.metersphere.base.domain.IssuesExample;
|
||||
import io.metersphere.base.domain.Project;
|
||||
import io.metersphere.base.domain.TestCaseWithBLOBs;
|
||||
import io.metersphere.commons.constants.IssuesManagePlatform;
|
||||
import io.metersphere.commons.constants.IssuesStatus;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.track.dto.DemandDTO;
|
||||
import io.metersphere.track.issue.client.ZentaoClient;
|
||||
import io.metersphere.track.issue.domain.PlatformUser;
|
||||
import io.metersphere.track.issue.domain.ZentaoBuild;
|
||||
import io.metersphere.track.issue.domain.zentao.AddIssueResponse;
|
||||
import io.metersphere.track.issue.domain.zentao.GetIssueResponse;
|
||||
import io.metersphere.track.issue.domain.zentao.ZentaoBuild;
|
||||
import io.metersphere.track.issue.domain.zentao.ZentaoConfig;
|
||||
import io.metersphere.track.request.testcase.IssuesRequest;
|
||||
import io.metersphere.track.request.testcase.IssuesUpdateRequest;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -42,6 +48,9 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
|
|||
* zentao url eg:http://x.x.x.x/zentao
|
||||
*/
|
||||
private final String url;
|
||||
|
||||
private ZentaoClient zentaoClient = new ZentaoClient();
|
||||
|
||||
private static final Pattern PATTERN = Pattern.compile("file-read-(.*?)\"/>");
|
||||
|
||||
protected String key = IssuesManagePlatform.Zentao.toString();
|
||||
|
@ -59,13 +68,6 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
|
|||
this.url = object.getString("url");
|
||||
}
|
||||
|
||||
public ZentaoPlatform(String account, String password, String url) {
|
||||
super(new IssuesRequest());
|
||||
this.account = account;
|
||||
this.password = password;
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
@Override
|
||||
String getProjectId(String projectId) {
|
||||
if (StringUtils.isNotBlank(projectId)) {
|
||||
|
@ -78,58 +80,14 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
|
|||
|
||||
@Override
|
||||
public List<IssuesDao> getIssue(IssuesRequest issuesRequest) {
|
||||
List<IssuesDao> list = new ArrayList<>();
|
||||
|
||||
issuesRequest.setPlatform(IssuesManagePlatform.Zentao.toString());
|
||||
|
||||
|
||||
List<IssuesDao> issues;
|
||||
if (StringUtils.isNotBlank(issuesRequest.getProjectId())) {
|
||||
issues = extIssuesMapper.getIssuesByProjectId(issuesRequest);
|
||||
} else {
|
||||
issues = extIssuesMapper.getIssuesByCaseId(issuesRequest);
|
||||
}
|
||||
|
||||
issues.forEach(item -> {
|
||||
String issuesId = item.getId();
|
||||
IssuesDao dto = getZentaoIssues(issuesId);
|
||||
dto.setNum(item.getNum());
|
||||
if (StringUtils.isBlank(dto.getId())) {
|
||||
// 缺陷不存在,解除用例和缺陷的关联
|
||||
TestCaseIssuesExample issuesExample = new TestCaseIssuesExample();
|
||||
TestCaseIssuesExample.Criteria criteria = issuesExample.createCriteria();
|
||||
if (StringUtils.isNotBlank(testCaseId)) {
|
||||
criteria.andTestCaseIdEqualTo(testCaseId);
|
||||
}
|
||||
criteria.andIssuesIdEqualTo(issuesId);
|
||||
testCaseIssuesMapper.deleteByExample(issuesExample);
|
||||
issuesMapper.deleteByPrimaryKey(issuesId);
|
||||
} else {
|
||||
dto.setPlatform(IssuesManagePlatform.Zentao.toString());
|
||||
// 缺陷状态为 关闭,则不显示
|
||||
if (!StringUtils.equals("closed", dto.getStatus())) {
|
||||
list.add(dto);
|
||||
}
|
||||
}
|
||||
});
|
||||
return list;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void filter(List<IssuesDao> issues) {
|
||||
issues.forEach((issuesDao) -> {
|
||||
IssuesDao dto = getZentaoIssues(issuesDao.getId());
|
||||
if (StringUtils.isBlank(dto.getId())) {
|
||||
// 标记成删除
|
||||
issuesDao.setStatus(IssuesStatus.DELETE.toString());
|
||||
} else {
|
||||
// 缺陷状态为 完成,则不显示
|
||||
if (!StringUtils.equals("done", dto.getStatus())) {
|
||||
issuesDao.setStatus(IssuesStatus.RESOLVED.toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
return issues;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -137,7 +95,8 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
|
|||
//getTestStories
|
||||
List<DemandDTO> list = new ArrayList<>();
|
||||
try {
|
||||
String session = login();
|
||||
setConfig();
|
||||
String session = zentaoClient.login();
|
||||
String key = getProjectId(projectId);
|
||||
HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(new HttpHeaders());
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
|
@ -170,56 +129,32 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
|
|||
}
|
||||
|
||||
public IssuesDao getZentaoIssues(String bugId) {
|
||||
String session = login();
|
||||
HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(new HttpHeaders());
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
GetIssueResponse.Issue bug = zentaoClient.getBugById(bugId);
|
||||
String description = bug.getSteps();
|
||||
String steps = description;
|
||||
try {
|
||||
ResponseEntity<String> responseEntity = restTemplate.exchange(url + "api-getModel-bug-getById-bugID={bugId}?zentaosid=" + session,
|
||||
HttpMethod.POST, requestEntity, String.class, bugId);
|
||||
String body = responseEntity.getBody();
|
||||
JSONObject obj = JSONObject.parseObject(body);
|
||||
|
||||
LogUtil.info("bug id is " + bugId + obj);
|
||||
|
||||
if (obj != null) {
|
||||
JSONObject bug = obj.getJSONObject("data");
|
||||
String id = bug.getString("id");
|
||||
String title = bug.getString("title");
|
||||
String description = bug.getString("steps");
|
||||
String steps = description;
|
||||
try {
|
||||
steps = zentao2MsDescription(description);
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
}
|
||||
Long createTime = bug.getLong("openedDate");
|
||||
String status = bug.getString("status");
|
||||
String reporter = bug.getString("openedBy");
|
||||
int deleted = bug.getInteger("deleted");
|
||||
if (deleted == 1) {
|
||||
return new IssuesDao();
|
||||
}
|
||||
IssuesDao issues = new IssuesDao();
|
||||
issues.setId(id);
|
||||
issues.setTitle(title);
|
||||
issues.setDescription(steps);
|
||||
issues.setCreateTime(createTime);
|
||||
issues.setStatus(status);
|
||||
issues.setReporter(reporter);
|
||||
return issues;
|
||||
}
|
||||
steps = zentao2MsDescription(description);
|
||||
} catch (Exception e) {
|
||||
LogUtil.error("get zentao bug fail " + e.getMessage());
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return new IssuesDao();
|
||||
if (StringUtils.equals(bug.getDeleted(),"1")) {
|
||||
// todo
|
||||
return new IssuesDao();
|
||||
}
|
||||
IssuesDao issues = new IssuesDao();
|
||||
issues.setId(bug.getId());
|
||||
issues.setTitle(bug.getTitle());
|
||||
issues.setDescription(steps);
|
||||
issues.setStatus(bug.getStatus());
|
||||
issues.setReporter(bug.getOpenedBy());
|
||||
return issues;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addIssue(IssuesUpdateRequest issuesRequest) {
|
||||
issuesRequest.setPlatform(IssuesManagePlatform.Zentao.toString());
|
||||
|
||||
String session = login();
|
||||
setConfig();
|
||||
String session = zentaoClient.login();
|
||||
String projectId = getProjectId(issuesRequest.getProjectId());
|
||||
|
||||
if (StringUtils.isBlank(projectId)) {
|
||||
|
@ -229,7 +164,6 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
|
|||
if (StringUtils.isBlank(session)) {
|
||||
MSException.throwException("session is null");
|
||||
}
|
||||
|
||||
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>();
|
||||
paramMap.add("product", projectId);
|
||||
paramMap.add("title", issuesRequest.getTitle());
|
||||
|
@ -255,31 +189,23 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
|
|||
paramMap.add("assignedTo", issuesRequest.getZentaoAssigned());
|
||||
}
|
||||
|
||||
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(paramMap, new HttpHeaders());
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
ResponseEntity<String> responseEntity = restTemplate.exchange(url + "api-getModel-bug-create.json?zentaosid=" + session, HttpMethod.POST, requestEntity, String.class);
|
||||
String body = responseEntity.getBody();
|
||||
JSONObject obj = JSONObject.parseObject(body);
|
||||
AddIssueResponse.Issue issue = zentaoClient.addIssue(paramMap);
|
||||
|
||||
LogUtil.info("add zentao bug " + obj);
|
||||
String id = issue.getId();
|
||||
if (StringUtils.isNotBlank(id)) {
|
||||
issuesRequest.setId(id);
|
||||
// 用例与第三方缺陷平台中的缺陷关联
|
||||
handleTestCaseIssues(issuesRequest);
|
||||
|
||||
if (obj != null) {
|
||||
JSONObject data = obj.getJSONObject("data");
|
||||
String id = data.getString("id");
|
||||
if (StringUtils.isNotBlank(id)) {
|
||||
issuesRequest.setId(id);
|
||||
// 用例与第三方缺陷平台中的缺陷关联
|
||||
handleTestCaseIssues(issuesRequest);
|
||||
|
||||
IssuesExample issuesExample = new IssuesExample();
|
||||
issuesExample.createCriteria().andIdEqualTo(id)
|
||||
.andPlatformEqualTo(IssuesManagePlatform.Zentao.toString());
|
||||
if (issuesMapper.selectByExample(issuesExample).size() <= 0) {
|
||||
// 插入缺陷表
|
||||
insertIssuesWithoutContext(id, issuesRequest);
|
||||
}
|
||||
IssuesExample issuesExample = new IssuesExample();
|
||||
issuesExample.createCriteria().andIdEqualTo(id)
|
||||
.andPlatformEqualTo(IssuesManagePlatform.Zentao.toString());
|
||||
if (issuesMapper.selectByExample(issuesExample).size() <= 0) {
|
||||
// 插入缺陷表
|
||||
insertIssues(id, issuesRequest);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -296,56 +222,28 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
|
|||
|
||||
@Override
|
||||
public void testAuth() {
|
||||
try {
|
||||
login();
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
MSException.throwException("验证失败!");
|
||||
}
|
||||
|
||||
setConfig();
|
||||
zentaoClient.login();
|
||||
}
|
||||
|
||||
|
||||
private String login() {
|
||||
String session = getSession();
|
||||
String loginUrl = url + "user-login.json?zentaosid=" + session;
|
||||
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>();
|
||||
paramMap.add("account", account);
|
||||
paramMap.add("password", password);
|
||||
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(paramMap, new HttpHeaders());
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
ResponseEntity<String> responseEntity = restTemplate.exchange(loginUrl, HttpMethod.POST, requestEntity, String.class);
|
||||
String body = responseEntity.getBody();
|
||||
JSONObject obj = JSONObject.parseObject(body);
|
||||
JSONObject user = obj.getJSONObject("user");
|
||||
if (user == null) {
|
||||
LogUtil.error("login fail");
|
||||
LogUtil.error(obj);
|
||||
// 登录失败,获取的session无效,置空session
|
||||
MSException.throwException("zentao login fail");
|
||||
}
|
||||
String username = user.getString("account");
|
||||
if (!StringUtils.equals(username, account)) {
|
||||
LogUtil.error("login fail,inconsistent users");
|
||||
MSException.throwException("zentao login fail");
|
||||
}
|
||||
return session;
|
||||
public ZentaoConfig setConfig() {
|
||||
ZentaoConfig config = getConfig();
|
||||
zentaoClient.setConfig(config);
|
||||
return config;
|
||||
}
|
||||
|
||||
private String getSession() {
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
HttpEntity<MultiValueMap<String,String>> requestEntity = new HttpEntity<>(new HttpHeaders());
|
||||
ResponseEntity<String> responseEntity = restTemplate.exchange(url + "api-getsessionid.json", HttpMethod.GET, requestEntity, String.class);
|
||||
String body = responseEntity.getBody();
|
||||
JSONObject obj = JSONObject.parseObject(body);
|
||||
JSONObject data = obj.getJSONObject("data");
|
||||
return data.getString("sessionID");
|
||||
public ZentaoConfig getConfig() {
|
||||
ZentaoConfig zentaoConfig = null;
|
||||
String config = getPlatformConfig(IssuesManagePlatform.Zentao.toString());
|
||||
zentaoConfig = JSONObject.parseObject(config, ZentaoConfig.class);
|
||||
// validateConfig(tapdConfig);
|
||||
return zentaoConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PlatformUser> getPlatformUser() {
|
||||
|
||||
String session = login();
|
||||
setConfig();
|
||||
String session = zentaoClient.login();;
|
||||
HttpHeaders httpHeaders = new HttpHeaders();
|
||||
HttpEntity<MultiValueMap<String,String>> requestEntity = new HttpEntity<>(httpHeaders);
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
|
@ -372,12 +270,39 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void syncIssues(Project project, List<IssuesDao> tapdIssues) {
|
||||
public void syncIssues(Project project, List<IssuesDao> issues) {
|
||||
issues.forEach(item -> {
|
||||
setConfig();
|
||||
IssuesDao issuesDao = getZentaoIssues(item.getId());
|
||||
issuesMapper.updateByPrimaryKeySelective(issuesDao);
|
||||
|
||||
// 标记成删除
|
||||
// item.setStatus(IssuesStatus.DELETE.toString());
|
||||
// issuesMapper.deleteByPrimaryKey(item.getId());
|
||||
|
||||
// if (StringUtils.isBlank(dto.getId())) {
|
||||
// // 缺陷不存在,解除用例和缺陷的关联
|
||||
// TestCaseIssuesExample issuesExample = new TestCaseIssuesExample();
|
||||
// TestCaseIssuesExample.Criteria criteria = issuesExample.createCriteria();
|
||||
// if (StringUtils.isNotBlank(testCaseId)) {
|
||||
// criteria.andTestCaseIdEqualTo(testCaseId);
|
||||
// }
|
||||
// criteria.andIssuesIdEqualTo(issuesId);
|
||||
// testCaseIssuesMapper.deleteByExample(issuesExample);
|
||||
// issuesMapper.deleteByPrimaryKey(issuesId);
|
||||
// } else {
|
||||
// dto.setPlatform(IssuesManagePlatform.Zentao.toString());
|
||||
// // 缺陷状态为 关闭,则不显示
|
||||
// if (!StringUtils.equals("closed", dto.getStatus())) {
|
||||
// list.add(dto);
|
||||
// }
|
||||
// }
|
||||
});
|
||||
}
|
||||
|
||||
public List<ZentaoBuild> getBuilds() {
|
||||
String session = login();
|
||||
setConfig();
|
||||
String session = zentaoClient.login();;
|
||||
String projectId1 = getProjectId(projectId);
|
||||
HttpHeaders httpHeaders = new HttpHeaders();
|
||||
HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(httpHeaders);
|
||||
|
@ -407,7 +332,8 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
|
|||
|
||||
private String uploadFile(FileSystemResource resource) {
|
||||
String id = "";
|
||||
String session = login();
|
||||
setConfig();
|
||||
String session = zentaoClient.login();
|
||||
HttpHeaders httpHeaders = new HttpHeaders();
|
||||
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>();
|
||||
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(paramMap, httpHeaders);
|
||||
|
|
|
@ -2,10 +2,10 @@ package io.metersphere.track.issue.client;
|
|||
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.track.issue.domain.JiraAddIssueResponse;
|
||||
import io.metersphere.track.issue.domain.JiraConfig;
|
||||
import io.metersphere.track.issue.domain.JiraField;
|
||||
import io.metersphere.track.issue.domain.JiraIssue;
|
||||
import io.metersphere.track.issue.domain.Jira.JiraAddIssueResponse;
|
||||
import io.metersphere.track.issue.domain.Jira.JiraConfig;
|
||||
import io.metersphere.track.issue.domain.Jira.JiraField;
|
||||
import io.metersphere.track.issue.domain.Jira.JiraIssue;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package io.metersphere.track.issue.client;
|
||||
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.track.issue.domain.TapdConfig;
|
||||
import io.metersphere.track.issue.domain.TapdGetIssueResponse;
|
||||
import io.metersphere.track.issue.domain.TapdStatusMapResponse;
|
||||
import io.metersphere.track.issue.domain.tapd.TapdConfig;
|
||||
import io.metersphere.track.issue.domain.tapd.TapdGetIssueResponse;
|
||||
import io.metersphere.track.issue.domain.tapd.TapdStatusMapResponse;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
|
@ -23,14 +23,6 @@ public class TapdClient extends BaseClient {
|
|||
|
||||
protected String PASSWD;
|
||||
|
||||
// public JiraAddIssueResponse addIssue(String body) {
|
||||
// LogUtil.debug("addIssue: " + body);
|
||||
// HttpHeaders headers = getAuthHeader();
|
||||
// headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
// HttpEntity<String> requestEntity = new HttpEntity<>(body, headers);
|
||||
// ResponseEntity<String> response = restTemplate.exchange(getBaseUrl() + "/issue", HttpMethod.POST, requestEntity, String.class);
|
||||
// return (JiraAddIssueResponse) getResultForObject(JiraAddIssueResponse.class, response);
|
||||
// }
|
||||
|
||||
public TapdGetIssueResponse getIssueForPage(String projectId, int pageNum, int limit) {
|
||||
return getIssueForPageByIds(projectId, pageNum, limit, null);
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
package io.metersphere.track.issue.client;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.track.issue.domain.zentao.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@Component
|
||||
public class ZentaoClient extends BaseClient {
|
||||
|
||||
protected String ENDPOINT;
|
||||
|
||||
protected String USER_NAME;
|
||||
|
||||
protected String PASSWD;
|
||||
|
||||
public String login() {
|
||||
String sessionId = getSessionId();
|
||||
String url = getBaseUrl() + "/user-login.json?zentaosid=" + sessionId;
|
||||
MultiValueMap<String, String> paramMap = new LinkedMultiValueMap<>();
|
||||
paramMap.add("account", USER_NAME);
|
||||
paramMap.add("password", PASSWD);
|
||||
HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(paramMap, new HttpHeaders());
|
||||
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class);
|
||||
GetUserResponse getUserResponse = (GetUserResponse) getResultForObject(GetUserResponse.class, response);
|
||||
GetUserResponse.User user = getUserResponse.getUser();
|
||||
if (user == null) {
|
||||
LogUtil.error("login fail");
|
||||
LogUtil.error(JSONObject.toJSON(getUserResponse));
|
||||
// 登录失败,获取的session无效,置空session
|
||||
MSException.throwException("zentao login fail");
|
||||
}
|
||||
if (!StringUtils.equals(user.getAccount(), USER_NAME)) {
|
||||
LogUtil.error("login fail,inconsistent users");
|
||||
MSException.throwException("zentao login fail");
|
||||
}
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public String getSessionId() {
|
||||
ResponseEntity<String> response = restTemplate.exchange(getBaseUrl() + "/api-getsessionid.json",
|
||||
HttpMethod.GET, null, String.class);
|
||||
GetSessionResponse getSessionResponse = (GetSessionResponse) getResultForObject(GetSessionResponse.class, response);
|
||||
return JSONObject.parseObject(getSessionResponse.getData(), GetSessionResponse.Session.class).getSessionID();
|
||||
}
|
||||
|
||||
public AddIssueResponse.Issue addIssue(MultiValueMap<String, Object> paramMap) {
|
||||
String sessionId = login();
|
||||
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(paramMap, new HttpHeaders());
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
ResponseEntity<String> response = restTemplate.exchange(getBaseUrl() + "/api-getModel-bug-create.json?zentaosid=" + sessionId,
|
||||
HttpMethod.POST, requestEntity, String.class);
|
||||
AddIssueResponse addIssueResponse = (AddIssueResponse) getResultForObject(AddIssueResponse.class, response);
|
||||
return JSONObject.parseObject(addIssueResponse.getData(), AddIssueResponse.Issue.class);
|
||||
}
|
||||
|
||||
public GetIssueResponse.Issue getBugById(String id) {
|
||||
String sessionId = login();
|
||||
String url = getBaseUrl() + "/api-getModel-bug-getById-bugID={1}?zentaosid={2}";
|
||||
ResponseEntity<String> response = restTemplate.exchange(url,
|
||||
HttpMethod.GET, null, String.class, id, sessionId);
|
||||
GetIssueResponse getIssueResponse = (GetIssueResponse) getResultForObject(GetIssueResponse.class, response);
|
||||
return JSONObject.parseObject(getIssueResponse.getData(), GetIssueResponse.Issue.class);
|
||||
}
|
||||
|
||||
protected String getBaseUrl() {
|
||||
if (ENDPOINT.endsWith("/")) {
|
||||
return ENDPOINT.substring(0, ENDPOINT.length() - 1);
|
||||
}
|
||||
return ENDPOINT;
|
||||
}
|
||||
|
||||
public void setConfig(ZentaoConfig config) {
|
||||
if (config == null) {
|
||||
MSException.throwException("config is null");
|
||||
}
|
||||
USER_NAME = config.getAccount();
|
||||
PASSWD = config.getPassword();
|
||||
ENDPOINT = config.getUrl();
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.track.issue.domain;
|
||||
package io.metersphere.track.issue.domain.Jira;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.track.issue.domain;
|
||||
package io.metersphere.track.issue.domain.Jira;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.track.issue.domain;
|
||||
package io.metersphere.track.issue.domain.Jira;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.track.issue.domain;
|
||||
package io.metersphere.track.issue.domain.Jira;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Getter;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.track.issue.domain;
|
||||
package io.metersphere.track.issue.domain.Jira;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.track.issue.domain;
|
||||
package io.metersphere.track.issue.domain.tapd;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.track.issue.domain;
|
||||
package io.metersphere.track.issue.domain.tapd;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.track.issue.domain;
|
||||
package io.metersphere.track.issue.domain.tapd;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import lombok.Getter;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.track.issue.domain;
|
||||
package io.metersphere.track.issue.domain.tapd;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
|
@ -0,0 +1,19 @@
|
|||
package io.metersphere.track.issue.domain.zentao;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AddIssueResponse {
|
||||
private String status;
|
||||
private String md5;
|
||||
private String data;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class Issue {
|
||||
private String status;
|
||||
private String id;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package io.metersphere.track.issue.domain.zentao;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class GetIssueResponse {
|
||||
private String status;
|
||||
private String md5;
|
||||
private String data;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class Issue {
|
||||
private String id;
|
||||
private String title;
|
||||
private String steps;
|
||||
private String status;
|
||||
private String openedBy;
|
||||
// private String openedDate;
|
||||
private String deleted;
|
||||
// private String product;
|
||||
// private String openedBuild;
|
||||
// private String assignedTo;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package io.metersphere.track.issue.domain.zentao;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class GetSessionResponse {
|
||||
private String status;
|
||||
private String data;
|
||||
// private String md5;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class Session {
|
||||
// private String title;
|
||||
// private String sessionName;
|
||||
private String sessionID;
|
||||
// private int rand;
|
||||
// private String pager;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package io.metersphere.track.issue.domain.zentao;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class GetUserResponse {
|
||||
private String status;
|
||||
private User user;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class User {
|
||||
private String id;
|
||||
// private String dept;
|
||||
private String account;
|
||||
// private String type;
|
||||
// private String role;
|
||||
// private String realname;
|
||||
// private String nickname;
|
||||
// private String commiter;
|
||||
// private String avatar;
|
||||
// private String birthday;
|
||||
// private String gender;
|
||||
// private String email;
|
||||
// private String skype;
|
||||
// private String qq;
|
||||
// private String mobile;
|
||||
// private String phone;
|
||||
// private String weixin;
|
||||
// private String dingding;
|
||||
// private String slack;
|
||||
// private String whatsapp;
|
||||
// private String address;
|
||||
// private String zipcode;
|
||||
// private String join;
|
||||
// private String visits;
|
||||
// private String ip;
|
||||
// private String last;
|
||||
// private String fails;
|
||||
// private String ranzhi;
|
||||
// private String score;
|
||||
// private String scoreLevel;
|
||||
// private String clientStatus;
|
||||
// private String clientLang;
|
||||
// private String lastTime;
|
||||
// private boolean admin;
|
||||
// private boolean modifyPassword;
|
||||
// private String company;
|
||||
// private String token;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.track.issue.domain;
|
||||
package io.metersphere.track.issue.domain.zentao;
|
||||
|
||||
import lombok.Data;
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package io.metersphere.track.issue.domain.zentao;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class ZentaoConfig {
|
||||
private String account;
|
||||
private String password;
|
||||
private String url;
|
||||
}
|
|
@ -24,7 +24,7 @@ import io.metersphere.service.IssueTemplateService;
|
|||
import io.metersphere.service.ProjectService;
|
||||
import io.metersphere.track.issue.*;
|
||||
import io.metersphere.track.issue.domain.PlatformUser;
|
||||
import io.metersphere.track.issue.domain.ZentaoBuild;
|
||||
import io.metersphere.track.issue.domain.zentao.ZentaoBuild;
|
||||
import io.metersphere.track.request.testcase.IssuesRequest;
|
||||
import io.metersphere.track.request.testcase.IssuesUpdateRequest;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
@ -415,32 +415,24 @@ public class IssuesService {
|
|||
List<IssuesDao> jiraIssues = issues.stream()
|
||||
.filter(item -> item.getPlatform().equals(IssuesManagePlatform.Jira.name()))
|
||||
.collect(Collectors.toList());
|
||||
// List<IssuesDao> zentaoIssues = issues.stream()
|
||||
// .filter(item -> item.getPlatform().equals(IssuesManagePlatform.Zentao.name()))
|
||||
// .collect(Collectors.toList());
|
||||
List<IssuesDao> zentaoIssues = issues.stream()
|
||||
.filter(item -> item.getPlatform().equals(IssuesManagePlatform.Zentao.name()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
IssuesRequest issuesRequest = new IssuesRequest();
|
||||
issuesRequest.setProjectId(projectId);
|
||||
if (CollectionUtils.isNotEmpty(tapdIssues)) {
|
||||
TapdPlatform tapdPlatform = new TapdPlatform(issuesRequest);
|
||||
syncThirdPartyIssues(tapdPlatform::syncIssues, project, tapdIssues);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(jiraIssues)) {
|
||||
JiraPlatform jiraPlatform = new JiraPlatform(new IssuesRequest());
|
||||
syncThirdPartyIssues(jiraPlatform::syncIssues, project, tapdIssues);
|
||||
}
|
||||
// if (CollectionUtils.isNotEmpty(zentaoIssues)) {
|
||||
// String config = getConfig(orgId, IssuesManagePlatform.Zentao.toString());
|
||||
// JSONObject object = JSON.parseObject(config);
|
||||
// String account = object.getString("account");
|
||||
// String password = object.getString("password");
|
||||
// String url = object.getString("url");
|
||||
// ZentaoPlatform zentaoPlatform = new ZentaoPlatform(account, password, url);
|
||||
// IssuesDao zentaoIssues = zentaoPlatform.getZentaoIssues(issue.getId());
|
||||
// issue.setTitle(zentaoIssues.getTitle());
|
||||
// issue.setDescription(zentaoIssues.getDescription());
|
||||
// issue.setStatus(zentaoIssues.getStatus());
|
||||
// }
|
||||
if (CollectionUtils.isNotEmpty(tapdIssues)) {
|
||||
TapdPlatform tapdPlatform = new TapdPlatform(issuesRequest);
|
||||
syncThirdPartyIssues(tapdPlatform::syncIssues, project, tapdIssues);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(jiraIssues)) {
|
||||
JiraPlatform jiraPlatform = new JiraPlatform(new IssuesRequest());
|
||||
syncThirdPartyIssues(jiraPlatform::syncIssues, project, jiraIssues);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(zentaoIssues)) {
|
||||
ZentaoPlatform zentaoPlatform = new ZentaoPlatform(issuesRequest);
|
||||
syncThirdPartyIssues(zentaoPlatform::syncIssues, project, zentaoIssues);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue