fix(测试跟踪): TAPD缺陷同步缺少了其他项目存在的用例

--bug=1016130 --user=陈建星 新建项目集成tapd缺陷管理平台,同步缺陷没有同步过来,发现是空间内其他项目有同步过来了,缺陷是工作空间内项目共享了。 https://www.tapd.cn/55049933/s/1231377
This commit is contained in:
AnAngle 2022-08-23 17:17:25 +08:00 committed by jianxing
parent 0b71d25246
commit f75d74e6b6
3 changed files with 13 additions and 24 deletions

View File

@ -42,5 +42,5 @@ public interface ExtIssuesMapper {
List<IssuesDao> getIssueCustomFields(List<String> ids);
List<IssuesDao> getPlatformIssueByIds(@Param("ids") List<String> ids);
List<IssuesDao> getPlatformIssueByIds(@Param("ids") List<String> ids, @Param("projectId") String projectId);
}

View File

@ -140,7 +140,7 @@
where cfi.resource_id = #{issueId}
</select>
<select id="getPlatformIssueByIds" resultType="io.metersphere.base.domain.IssuesDao">
select * from issues where platform_id in
select * from issues where project_id = #{projectId} and platform_id in
<foreach collection="ids" item="value" separator="," open="(" close=")">
#{value}
</foreach>

View File

@ -407,8 +407,8 @@ public class CustomFieldResourceService {
}
}
public List<IssuesDao> getPlatformIssueByIds(List<String> platformIds) {
List<IssuesDao> issues = extIssuesMapper.getPlatformIssueByIds(platformIds);
public List<IssuesDao> getPlatformIssueByIds(List<String> platformIds, String projectId) {
List<IssuesDao> issues = extIssuesMapper.getPlatformIssueByIds(platformIds, projectId);
if (CollectionUtils.isEmpty(issues)) {
return issues;
}
@ -416,26 +416,15 @@ public class CustomFieldResourceService {
List<IssuesDao> issuesList = extIssuesMapper.getIssueCustomFields(issueIds);
Map<String, List<CustomFieldItemDTO>> map = new HashMap<>();
issuesList.forEach(f -> {
List<CustomFieldItemDTO> list = map.get(f.getId());
if (list == null) {
list = new ArrayList<>();
CustomFieldItemDTO dto = new CustomFieldItemDTO();
dto.setId(f.getFieldId());
dto.setName(f.getFieldName());
dto.setType(f.getFieldType());
dto.setValue(f.getFieldValue());
dto.setCustomData(f.getCustomData());
list.add(dto);
map.put(f.getId(), list);
} else {
CustomFieldItemDTO dto = new CustomFieldItemDTO();
dto.setId(f.getFieldId());
dto.setName(f.getFieldName());
dto.setType(f.getFieldType());
dto.setValue(f.getFieldValue());
dto.setCustomData(f.getCustomData());
list.add(dto);
}
CustomFieldItemDTO dto = new CustomFieldItemDTO();
dto.setId(f.getFieldId());
dto.setName(f.getFieldName());
dto.setType(f.getFieldType());
dto.setValue(f.getFieldValue());
dto.setCustomData(f.getCustomData());
List<CustomFieldItemDTO> list = Optional.ofNullable(map.get(f.getId())).orElse(new ArrayList<>());
map.put(f.getId(), list);
list.add(dto);
});
issues.forEach(i -> i.setCustomFieldList(map.getOrDefault(i.getId(), new ArrayList<>())));
return issues;