refactor(项目设置): 已关联三方需求在列表上禁用
This commit is contained in:
parent
af918239d2
commit
760d620a71
|
@ -36,6 +36,10 @@ public class PlatformDemandDTO {
|
||||||
* 需求地址
|
* 需求地址
|
||||||
*/
|
*/
|
||||||
private String demandUrl;
|
private String demandUrl;
|
||||||
|
/**
|
||||||
|
* 已关联的需求要禁用
|
||||||
|
*/
|
||||||
|
private boolean disabled;
|
||||||
/**
|
/**
|
||||||
* 子需求集合
|
* 子需求集合
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -15,4 +15,7 @@ public interface ExtFunctionalCaseDemandMapper {
|
||||||
|
|
||||||
List<FunctionalCaseDemand> selectDemandByProjectId(@Param("projectId") String projectId, @Param("platform") String platform);
|
List<FunctionalCaseDemand> selectDemandByProjectId(@Param("projectId") String projectId, @Param("platform") String platform);
|
||||||
|
|
||||||
|
List<String> selectDemandIdsByCaseId(@Param("caseId") String caseId, @Param("platform") String platform);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,4 +24,10 @@
|
||||||
where functional_case.project_id = #{projectId} and functional_case_demand.demand_platform=#{platform}
|
where functional_case.project_id = #{projectId} and functional_case_demand.demand_platform=#{platform}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDemandIdsByCaseId" resultType="java.lang.String">
|
||||||
|
select demand_id
|
||||||
|
from functional_case_demand
|
||||||
|
where case_id = #{caseId} and demand_platform=#{platform}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -13,4 +13,8 @@ public class FunctionalThirdDemandPageRequest extends BasePageRequest {
|
||||||
@NotBlank(message = "{case_review.project_id.not_blank}")
|
@NotBlank(message = "{case_review.project_id.not_blank}")
|
||||||
private String projectId;
|
private String projectId;
|
||||||
|
|
||||||
|
@Schema(description = "当前选择的用例Id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotBlank(message = "{case_review.case_id.not_blank}")
|
||||||
|
private String caseId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -349,6 +349,8 @@ public class FunctionalCaseDemandService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public PluginPager<PlatformDemandDTO> pageDemand(FunctionalThirdDemandPageRequest request) {
|
public PluginPager<PlatformDemandDTO> pageDemand(FunctionalThirdDemandPageRequest request) {
|
||||||
|
String platformId = projectApplicationService.getDemandPlatformId(request.getProjectId());
|
||||||
|
List<String> demandIds = extFunctionalCaseDemandMapper.selectDemandIdsByCaseId(request.getCaseId(), platformId);
|
||||||
DemandPageRequest demandPageRequest = new DemandPageRequest();
|
DemandPageRequest demandPageRequest = new DemandPageRequest();
|
||||||
demandPageRequest.setQuery(StringUtils.replace(request.getKeyword(), "\\", ""));
|
demandPageRequest.setQuery(StringUtils.replace(request.getKeyword(), "\\", ""));
|
||||||
demandPageRequest.setFilter(request.getFilter());
|
demandPageRequest.setFilter(request.getFilter());
|
||||||
|
@ -356,6 +358,16 @@ public class FunctionalCaseDemandService {
|
||||||
demandPageRequest.setPageSize(request.getPageSize());
|
demandPageRequest.setPageSize(request.getPageSize());
|
||||||
demandPageRequest.setProjectConfig(projectApplicationService.getProjectDemandThirdPartConfig(request.getProjectId()));
|
demandPageRequest.setProjectConfig(projectApplicationService.getProjectDemandThirdPartConfig(request.getProjectId()));
|
||||||
Platform platform = projectApplicationService.getPlatform(request.getProjectId(), false);
|
Platform platform = projectApplicationService.getPlatform(request.getProjectId(), false);
|
||||||
return platform.pageDemand(demandPageRequest);
|
PluginPager<PlatformDemandDTO> platformDemandDTOPluginPager = platform.pageDemand(demandPageRequest);
|
||||||
|
PlatformDemandDTO data = platformDemandDTOPluginPager.getData();
|
||||||
|
List<PlatformDemandDTO.Demand> list = data.getList();
|
||||||
|
for (PlatformDemandDTO.Demand demand : list) {
|
||||||
|
if (demandIds.contains(demand.getDemandId())) {
|
||||||
|
demand.setDisabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data.setList(list);
|
||||||
|
platformDemandDTOPluginPager.setData(data);
|
||||||
|
return platformDemandDTOPluginPager;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -666,12 +666,30 @@ public class FunctionalCaseDemandControllerTests extends BaseTest {
|
||||||
functionalThirdDemandPageRequest.setProjectId("gyq_project-case-demand-test");
|
functionalThirdDemandPageRequest.setProjectId("gyq_project-case-demand-test");
|
||||||
functionalThirdDemandPageRequest.setPageSize(10);
|
functionalThirdDemandPageRequest.setPageSize(10);
|
||||||
functionalThirdDemandPageRequest.setCurrent(1);
|
functionalThirdDemandPageRequest.setCurrent(1);
|
||||||
|
functionalThirdDemandPageRequest.setCaseId("DEMAND_TEST_FUNCTIONAL_CASE_ID");
|
||||||
MvcResult mvcResultDemand= this.requestPostWithOkAndReturn(URL_DEMAND_PAGE_DEMAND, functionalThirdDemandPageRequest);
|
MvcResult mvcResultDemand= this.requestPostWithOkAndReturn(URL_DEMAND_PAGE_DEMAND, functionalThirdDemandPageRequest);
|
||||||
PluginPager<PlatformDemandDTO> tableData = JSON.parseObject(JSON.toJSONString(
|
PluginPager<PlatformDemandDTO> tableData = JSON.parseObject(JSON.toJSONString(
|
||||||
JSON.parseObject(mvcResultDemand.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData()),
|
JSON.parseObject(mvcResultDemand.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData()),
|
||||||
PluginPager.class);
|
PluginPager.class);
|
||||||
|
FunctionalCaseDemand functionalCaseDemand = new FunctionalCaseDemand();
|
||||||
|
functionalCaseDemand.setId("测试过滤ID");
|
||||||
|
functionalCaseDemand.setDemandName("Test");
|
||||||
|
functionalCaseDemand.setCaseId("DEMAND_TEST_FUNCTIONAL_CASE_ID");
|
||||||
|
functionalCaseDemand.setDemandId("TES-1");
|
||||||
|
functionalCaseDemand.setDemandUrl("http://localhost:57767/jira/software/projects/TES/issues/TES-1");
|
||||||
|
functionalCaseDemand.setDemandPlatform("Metersphere");
|
||||||
|
functionalCaseDemand.setUpdateUser("admin");
|
||||||
|
functionalCaseDemand.setUpdateTime(System.currentTimeMillis());
|
||||||
|
functionalCaseDemand.setWithParent(false);
|
||||||
|
functionalCaseDemand.setCreateUser("admin");
|
||||||
|
functionalCaseDemand.setCreateTime(System.currentTimeMillis());
|
||||||
|
functionalCaseDemand.setParent("NONE");
|
||||||
|
functionalCaseDemandMapper.insert(functionalCaseDemand);
|
||||||
|
mvcResultDemand= this.requestPostWithOkAndReturn(URL_DEMAND_PAGE_DEMAND, functionalThirdDemandPageRequest);
|
||||||
|
tableData = JSON.parseObject(JSON.toJSONString(
|
||||||
|
JSON.parseObject(mvcResultDemand.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData()),
|
||||||
|
PluginPager.class);
|
||||||
|
|
||||||
System.out.println(JSON.toJSONString(tableData));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue