refactor: 同步缺陷的创建时间

This commit is contained in:
chenjianxing 2021-11-26 15:41:29 +08:00 committed by jianxing
parent f1bad22624
commit 9aef75906c
8 changed files with 23 additions and 8 deletions

View File

@ -58,6 +58,10 @@ public class ServiceUtils {
return orders;
}
public static List<OrderRequest> getDefaultOrderByField(List<OrderRequest> orders, String field) {
return getDefaultOrderByField(null, orders, field);
}
/**
* 获取前端全选的id列表
*

View File

@ -401,10 +401,11 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
}
protected Map<String, IssuesWithBLOBs> getUuIdMap(List<IssuesWithBLOBs> issues) {
HashMap<String, IssuesWithBLOBs> issueMap = new HashMap<>();
if (org.apache.commons.collections.CollectionUtils.isNotEmpty(issues)) {
return issues.stream().collect(Collectors.toMap(Issues::getPlatformId, i -> i));
issues.forEach(item -> issueMap.put(item.getPlatformId(), item));
}
return new HashMap<>();
return issueMap;
}
protected void deleteSyncIssue(List<String> ids) {
@ -456,10 +457,7 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
issue.setProjectId(projectId);
issue.setId(UUID.randomUUID().toString());
issue.setPlatformId(platformId);
issue.setCreateTime(System.currentTimeMillis());
issue.setUpdateTime(System.currentTimeMillis());
issue.setCreator(SessionUtils.getUserId());
issue.setNum(nextNum);
issuesMapper.insert(issue); // 批量新增
}
}

View File

@ -76,6 +76,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
JSONObject assignee = (JSONObject) fields.get("assignee");
issue.setTitle(fields.getString("summary"));
issue.setCreateTime(fields.getLong("created"));
issue.setUpdateTime(fields.getLong("updated"));
issue.setLastmodify(assignee == null ? "" : assignee.getString("displayName"));
issue.setDescription(description);
issue.setPlatformStatus(status);

View File

@ -240,6 +240,8 @@ public class TapdPlatform extends AbstractIssuePlatform {
issue.setDescription(htmlDesc2MsDesc(issue.getDescription()));
issue.setCustomFields(syncIssueCustomField(issue.getCustomFields(), bug));
issue.setPlatform(key);
issue.setCreateTime(bug.getLong("created"));
issue.setUpdateTime(bug.getLong("modified"));
return issue;
}

View File

@ -143,6 +143,15 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
issue.setDescription(steps);
issue.setReporter(bugObj.getOpenedBy());
issue.setPlatform(key);
try {
issue.setCreateTime(bug.getLong("openedDate"));
issue.setUpdateTime(bug.getLong("lastEditedDate"));
} catch (Exception e) {
LogUtil.error("update zentao time" + e.getMessage());
}
if (issue.getUpdateTime() == null) {
issue.setUpdateTime(System.currentTimeMillis());
}
issue.setCustomFields(syncIssueCustomField(issue.getCustomFields(), bug));
return issue;
}

View File

@ -338,7 +338,7 @@ public class IssuesService {
}
public List<IssuesDao> list(IssuesRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
request.setOrders(ServiceUtils.getDefaultOrderByField(request.getOrders(), "create_time"));
List<IssuesDao> issues = extIssuesMapper.getIssues(request);
List<String> ids = issues.stream()

@ -1 +1 @@
Subproject commit 044899d93802a7a30ba7453aaa58bd78af3a84a9
Subproject commit 269d23d5004ee49a9e82a977027ca72757d3056a

View File

@ -142,5 +142,6 @@ export function editTestPlanLoadCaseOrder(request, callback) {
}
export function getPlanStageOption(callback) {
return baseGet('/test/plan/get/stage/option/' + getCurrentWorkspaceId(), callback);
let wId = getCurrentWorkspaceId();
return wId ? baseGet('/test/plan/get/stage/option/' + wId, callback) : {};
}