Merge remote-tracking branch 'origin/master' into master

This commit is contained in:
Captain.B 2020-11-19 16:21:41 +08:00
commit 937963f872
2 changed files with 54 additions and 28 deletions

View File

@ -87,10 +87,14 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
String session = login();
HttpEntity<MultiValueMap> requestEntity = new HttpEntity<>(new HttpHeaders());
RestTemplate restTemplate = new RestTemplate();
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");
@ -112,6 +116,10 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
issues.setReporter(reporter);
return issues;
}
} catch (Exception e) {
LogUtil.error("get zentao bug fail " + e.getMessage());
}
return new Issues();
}
@ -150,6 +158,9 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
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);
LogUtil.info("add zentao bug " + obj);
if (obj != null) {
JSONObject data = obj.getJSONObject("data");
String id = data.getString("id");
@ -161,6 +172,10 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
testCaseIssues.setTestCaseId(testCaseId);
testCaseIssuesMapper.insert(testCaseIssues);
IssuesExample issuesExample = new IssuesExample();
issuesExample.createCriteria().andIdEqualTo(id)
.andPlatformEqualTo(IssuesManagePlatform.Zentao.toString());
if (issuesMapper.selectByExample(issuesExample).size() <= 0) {
// 插入缺陷表
Issues issues = new Issues();
issues.setId(id);
@ -169,6 +184,7 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
}
}
}
}
@Override
public void deleteIssue(String id) {
@ -235,6 +251,9 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
HttpMethod.GET, requestEntity, String.class);
String body = responseEntity.getBody();
JSONObject obj = JSONObject.parseObject(body);
LogUtil.info("zentao user " + obj);
JSONArray data = obj.getJSONArray("data");
List<PlatformUser> users = new ArrayList<>();
@ -260,6 +279,9 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
HttpMethod.GET, requestEntity, String.class, projectId);
String body = responseEntity.getBody();
JSONObject obj = JSONObject.parseObject(body);
LogUtil.info("zentao builds" + obj);
JSONObject data = obj.getJSONObject("data");
Map<String,Object> maps = data.getInnerMap();

View File

@ -0,0 +1,4 @@
alter table issues drop primary key;
alter table issues
add constraint issues_pk
primary key (id, platform);