feat(工作台): 接口统计完成
This commit is contained in:
parent
b5bd331f67
commit
61c05433fa
|
@ -8,6 +8,21 @@ functional_case.unPass=未通过
|
||||||
functional_case.coverRate=覆盖率
|
functional_case.coverRate=覆盖率
|
||||||
functional_case.hasCover=已覆盖
|
functional_case.hasCover=已覆盖
|
||||||
functional_case.unCover=未覆盖
|
functional_case.unCover=未覆盖
|
||||||
|
api_definition.completionRate=完成率
|
||||||
|
api_management.execTime=执行次数
|
||||||
|
api_management.execCount=已执行
|
||||||
|
api_management.unExecCount=未执行
|
||||||
|
api_management.apiCaseCount=接口用例数
|
||||||
|
api_management.apiScenarioCount=场景用例数
|
||||||
|
api_management.fakeErrorCount=误报数
|
||||||
|
api_management.apiCaseExecRate=用例执行率
|
||||||
|
api_management.apiCasePassRate=用例通过率
|
||||||
|
api_management.scenarioExecRate=场景执行率
|
||||||
|
api_management.scenarioPassRate=场景通过率
|
||||||
|
api_management.passCount=已通过
|
||||||
|
api_management.unPassCount=未通过
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,20 @@ functional_case.hasReview=Reviewed
|
||||||
functional_case.unReview=Not reviewed
|
functional_case.unReview=Not reviewed
|
||||||
functional_case.passRate=Pass rate
|
functional_case.passRate=Pass rate
|
||||||
functional_case.hasPass=Passed
|
functional_case.hasPass=Passed
|
||||||
functional_case.unPass=Un Pass
|
functional_case.unPass=Un pass
|
||||||
functional_case.coverRate=Coverage
|
functional_case.coverRate=Coverage
|
||||||
functional_case.hasCover=Covered
|
functional_case.hasCover=Covered
|
||||||
functional_case.unCover=Not covered
|
functional_case.unCover=Not covered
|
||||||
|
api_definition.completionRate=Completion rate
|
||||||
|
api_management.execTime=Execution times
|
||||||
|
api_management.execCount=Executed
|
||||||
|
api_management.unExecCount=Not executed
|
||||||
|
api_management.apiCaseCount=ApiCase count
|
||||||
|
api_management.apiScenarioCount=ApiScenario count
|
||||||
|
api_management.fakeErrorCount=FakeError count
|
||||||
|
api_management.apiCaseExecRate=Case execution rate
|
||||||
|
api_management.apiCasePassRate=Case pass rate
|
||||||
|
api_management.scenarioExecRate=Scenario execution rate
|
||||||
|
api_management.scenarioPassRate=Scenario pass rate
|
||||||
|
api_management.passCount=Passed
|
||||||
|
api_management.unPassCount=Un pass
|
||||||
|
|
|
@ -8,3 +8,16 @@ functional_case.unPass=未通过
|
||||||
functional_case.coverRate=覆盖率
|
functional_case.coverRate=覆盖率
|
||||||
functional_case.hasCover=已覆盖
|
functional_case.hasCover=已覆盖
|
||||||
functional_case.unCover=未覆盖
|
functional_case.unCover=未覆盖
|
||||||
|
api_definition.completionRate=完成率
|
||||||
|
api_management.execTime=执行次数
|
||||||
|
api_management.execCount=已执行
|
||||||
|
api_management.unExecCount=未执行
|
||||||
|
api_management.apiCaseCount=接口用例数
|
||||||
|
api_management.apiScenarioCount=场景用例数
|
||||||
|
api_management.fakeErrorCount=误报数
|
||||||
|
api_management.apiCaseExecRate=用例执行率
|
||||||
|
api_management.apiCasePassRate=用例通过率
|
||||||
|
api_management.scenarioExecRate=场景执行率
|
||||||
|
api_management.scenarioPassRate=场景通过率
|
||||||
|
api_management.passCount=已通过
|
||||||
|
api_management.unPassCount=未通过
|
||||||
|
|
|
@ -111,9 +111,9 @@ public interface ExtApiDefinitionMapper {
|
||||||
|
|
||||||
Long selectNumById(String id);
|
Long selectNumById(String id);
|
||||||
|
|
||||||
List<ProjectCountDTO> projectApiCount(@Param("projectIds") Set<String> projectIds, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userId") String userId);
|
List<ProjectCountDTO> projectApiCount(@Param("projectIds") Set<String> projectIds, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("userId") String userId);
|
||||||
|
|
||||||
List<ProjectUserCreateCount> userCreateApiCount(@Param("projectId") String projectId, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userIds") Set<String> userIds);
|
List<ProjectUserCreateCount> userCreateApiCount(@Param("projectId") String projectId, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("userIds") Set<String> userIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取根据时间过滤有更新的api
|
* 获取根据时间过滤有更新的api
|
||||||
|
@ -123,7 +123,10 @@ public interface ExtApiDefinitionMapper {
|
||||||
* @param endTime 时间过滤条件
|
* @param endTime 时间过滤条件
|
||||||
* @return List<ApiDefinitionUpdateDTO>
|
* @return List<ApiDefinitionUpdateDTO>
|
||||||
*/
|
*/
|
||||||
List<ApiDefinitionUpdateDTO> getUpdateApiList(@Param("projectId") String projectId, @Param("startTime") long startTime, @Param("endTime") long endTime);
|
List<ApiDefinitionUpdateDTO> getUpdateApiList(@Param("projectId") String projectId, @Param("startTime") Long startTime, @Param("endTime") Long endTime);
|
||||||
|
|
||||||
List<ApiRefSourceCountDTO> scenarioRefApiCount(@Param("projectId") String projectId, @Param("resourceIds") List<String> resourceIds);
|
List<ApiRefSourceCountDTO> scenarioRefApiCount(@Param("projectId") String projectId, @Param("resourceIds") List<String> resourceIds);
|
||||||
|
|
||||||
|
List<ApiDefinition> getCreateApiList(@Param("projectId") String projectId, @Param("startTime") Long startTime, @Param("endTime") Long endTime);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -781,7 +781,9 @@
|
||||||
#{projectId}
|
#{projectId}
|
||||||
</foreach>
|
</foreach>
|
||||||
AND api_definition.deleted = false
|
AND api_definition.deleted = false
|
||||||
AND api_definition.create_time BETWEEN #{startTime} AND #{endTime}
|
<if test="startTime != null and endTime != null">
|
||||||
|
AND api_definition.create_time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
<if test="userId != null and userId != ''">
|
<if test="userId != null and userId != ''">
|
||||||
AND api_definition.create_user = #{userId}
|
AND api_definition.create_user = #{userId}
|
||||||
</if>
|
</if>
|
||||||
|
@ -794,7 +796,9 @@
|
||||||
FROM api_definition
|
FROM api_definition
|
||||||
WHERE api_definition.deleted = false
|
WHERE api_definition.deleted = false
|
||||||
AND api_definition.project_id = #{projectId}
|
AND api_definition.project_id = #{projectId}
|
||||||
AND api_definition.create_time BETWEEN #{startTime} AND #{endTime}
|
<if test="startTime != null and endTime != null">
|
||||||
|
AND api_definition.create_time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
<if test="userIds != null and userIds.size() > 0">
|
<if test="userIds != null and userIds.size() > 0">
|
||||||
and api_definition.create_user in
|
and api_definition.create_user in
|
||||||
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
|
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
|
||||||
|
@ -805,11 +809,11 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getUpdateApiList" resultType="io.metersphere.api.dto.definition.ApiDefinitionUpdateDTO">
|
<select id="getUpdateApiList" resultType="io.metersphere.api.dto.definition.ApiDefinitionUpdateDTO">
|
||||||
SELECT api_definition.id, api_definition.name, api_definition.update_time
|
SELECT api_definition.id, api_definition.name, api_definition.num, api_definition.path, api_definition.update_time
|
||||||
FROM api_definition
|
FROM api_definition
|
||||||
WHERE api_definition.deleted = false
|
WHERE api_definition.deleted = false
|
||||||
AND api_definition.project_id = #{projectId}
|
AND api_definition.project_id = #{projectId}
|
||||||
AND api_definition.update_time BETWEEN #{startTime} AND #{endTime} order by api_definition.update_time desc;
|
AND api_definition.update_time BETWEEN #{startTime} AND #{endTime} order by api_definition.update_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="scenarioRefApiCount" resultType="io.metersphere.api.dto.definition.ApiRefSourceCountDTO">
|
<select id="scenarioRefApiCount" resultType="io.metersphere.api.dto.definition.ApiRefSourceCountDTO">
|
||||||
|
@ -825,4 +829,13 @@
|
||||||
</foreach>
|
</foreach>
|
||||||
group by ass.resource_id;
|
group by ass.resource_id;
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getCreateApiList" resultType="io.metersphere.api.domain.ApiDefinition">
|
||||||
|
SELECT api_definition.id, api_definition.protocol, api_definition.status
|
||||||
|
FROM api_definition
|
||||||
|
WHERE api_definition.deleted = false
|
||||||
|
AND api_definition.project_id = #{projectId}
|
||||||
|
<if test="startTime != null and endTime != null">
|
||||||
|
AND api_definition.create_time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -102,9 +102,10 @@ public interface ExtApiScenarioMapper {
|
||||||
|
|
||||||
List<ApiScenario> getNameInfo(@Param("ids") List<String> ids);
|
List<ApiScenario> getNameInfo(@Param("ids") List<String> ids);
|
||||||
|
|
||||||
List<ProjectCountDTO> projectApiScenarioCount(@Param("projectIds") Set<String> projectIds, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userId") String userId);
|
List<ProjectCountDTO> projectApiScenarioCount(@Param("projectIds") Set<String> projectIds, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("userId") String userId);
|
||||||
|
|
||||||
List<ProjectUserCreateCount> userCreateApiScenarioCount(@Param("projectId") String projectId, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userIds") Set<String> userIds);
|
List<ProjectUserCreateCount> userCreateApiScenarioCount(@Param("projectId") String projectId, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("userIds") Set<String> userIds);
|
||||||
|
|
||||||
|
List<ApiScenario> getSimpleApiScenarioList(@Param("projectId") String projectId, @Param("startTime") Long startTime, @Param("endTime") Long endTime);
|
||||||
List<ExecHistoryDTO> selectExecHistory(@Param("request") ExecutePageRequest request);
|
List<ExecHistoryDTO> selectExecHistory(@Param("request") ExecutePageRequest request);
|
||||||
}
|
}
|
||||||
|
|
|
@ -775,7 +775,9 @@
|
||||||
<foreach collection="projectIds" item="projectId" separator="," open="(" close=")">
|
<foreach collection="projectIds" item="projectId" separator="," open="(" close=")">
|
||||||
#{projectId}
|
#{projectId}
|
||||||
</foreach>
|
</foreach>
|
||||||
AND api_scenario.create_time BETWEEN #{startTime} AND #{endTime}
|
<if test="startTime != null and endTime != null">
|
||||||
|
AND api_scenario.create_time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
<if test="userId != null and userId != ''">
|
<if test="userId != null and userId != ''">
|
||||||
AND api_scenario.create_user = #{userId}
|
AND api_scenario.create_user = #{userId}
|
||||||
</if>
|
</if>
|
||||||
|
@ -788,7 +790,9 @@
|
||||||
FROM api_scenario
|
FROM api_scenario
|
||||||
WHERE api_scenario.deleted = false
|
WHERE api_scenario.deleted = false
|
||||||
AND api_scenario.project_id = #{projectId}
|
AND api_scenario.project_id = #{projectId}
|
||||||
AND api_scenario.create_time BETWEEN #{startTime} AND #{endTime}
|
<if test="startTime != null and endTime != null">
|
||||||
|
AND api_scenario.create_time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
<if test="userIds != null and userIds.size() > 0">
|
<if test="userIds != null and userIds.size() > 0">
|
||||||
and api_scenario.create_user in
|
and api_scenario.create_user in
|
||||||
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
|
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
|
||||||
|
@ -797,6 +801,16 @@
|
||||||
</if>
|
</if>
|
||||||
group by api_scenario.create_user;
|
group by api_scenario.create_user;
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getSimpleApiScenarioList" resultType="io.metersphere.api.domain.ApiScenario">
|
||||||
|
SELECT api_scenario.id, api_scenario.last_report_status
|
||||||
|
FROM api_scenario
|
||||||
|
WHERE api_scenario.deleted = false
|
||||||
|
AND api_scenario.project_id = #{projectId}
|
||||||
|
<if test="startTime != null and endTime != null">
|
||||||
|
AND api_scenario.create_time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<select id="selectExecHistory" resultType="io.metersphere.api.dto.definition.ExecHistoryDTO">
|
<select id="selectExecHistory" resultType="io.metersphere.api.dto.definition.ExecHistoryDTO">
|
||||||
|
|
|
@ -133,8 +133,10 @@ public interface ExtApiTestCaseMapper {
|
||||||
|
|
||||||
List<ApiTestCaseDTO> selectBaseInfoByProjectIdAndApiId(@Param("projectId") String projectId, @Param("apiId") String apiId);
|
List<ApiTestCaseDTO> selectBaseInfoByProjectIdAndApiId(@Param("projectId") String projectId, @Param("apiId") String apiId);
|
||||||
|
|
||||||
List<ProjectCountDTO> projectApiCaseCount(@Param("projectIds") Set<String> projectIds, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userId") String userId);
|
List<ProjectCountDTO> projectApiCaseCount(@Param("projectIds") Set<String> projectIds, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("userId") String userId);
|
||||||
|
|
||||||
List<ProjectUserCreateCount> userCreateApiCaseCount(@Param("projectId") String projectId, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userIds") Set<String> userIds);
|
List<ProjectUserCreateCount> userCreateApiCaseCount(@Param("projectId") String projectId, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("userIds") Set<String> userIds);
|
||||||
|
|
||||||
|
List<ApiTestCase> getSimpleApiCaseList(@Param("projectId") String projectId, @Param("startTime") Long startTime, @Param("endTime") Long endTime);
|
||||||
|
|
||||||
}
|
}
|
|
@ -995,7 +995,9 @@
|
||||||
<foreach collection="projectIds" item="projectId" separator="," open="(" close=")">
|
<foreach collection="projectIds" item="projectId" separator="," open="(" close=")">
|
||||||
#{projectId}
|
#{projectId}
|
||||||
</foreach>
|
</foreach>
|
||||||
AND api_test_case.create_time BETWEEN #{startTime} AND #{endTime}
|
<if test="startTime != null and endTime != null">
|
||||||
|
AND api_test_case.create_time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
<if test="userId != null and userId != ''">
|
<if test="userId != null and userId != ''">
|
||||||
AND api_test_case.create_user = #{userId}
|
AND api_test_case.create_user = #{userId}
|
||||||
</if>
|
</if>
|
||||||
|
@ -1007,8 +1009,10 @@
|
||||||
SELECT api_test_case.create_user as userId, count(api_test_case.id) as count
|
SELECT api_test_case.create_user as userId, count(api_test_case.id) as count
|
||||||
FROM api_test_case
|
FROM api_test_case
|
||||||
WHERE api_test_case.deleted = false
|
WHERE api_test_case.deleted = false
|
||||||
AND api_test_case.project_id = #{projectId}
|
AND api_test_case.project_id = #{projectId}
|
||||||
AND api_test_case.create_time BETWEEN #{startTime} AND #{endTime}
|
<if test="startTime != null and endTime != null">
|
||||||
|
AND api_test_case.create_time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
<if test="userIds != null and userIds.size() > 0">
|
<if test="userIds != null and userIds.size() > 0">
|
||||||
and api_test_case.create_user in
|
and api_test_case.create_user in
|
||||||
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
|
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
|
||||||
|
@ -1017,5 +1021,14 @@
|
||||||
</if>
|
</if>
|
||||||
group by api_test_case.create_user;
|
group by api_test_case.create_user;
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getSimpleApiCaseList" resultType="io.metersphere.api.domain.ApiTestCase">
|
||||||
|
SELECT api_test_case.id, api_test_case.last_report_status
|
||||||
|
FROM api_test_case
|
||||||
|
WHERE api_test_case.deleted = false
|
||||||
|
AND api_test_case.project_id = #{projectId}
|
||||||
|
<if test="startTime != null and endTime != null">
|
||||||
|
AND api_test_case.create_time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -121,8 +121,8 @@ public interface ExtBugMapper {
|
||||||
@BaseConditionFilter
|
@BaseConditionFilter
|
||||||
List<String> getIdsByProvider(@Param("request") AssociateBugRequest request, @Param("deleted") boolean deleted);
|
List<String> getIdsByProvider(@Param("request") AssociateBugRequest request, @Param("deleted") boolean deleted);
|
||||||
|
|
||||||
List<ProjectCountDTO> projectBugCount(@Param("projectIds") Set<String> projectIds, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userId") String userId);
|
List<ProjectCountDTO> projectBugCount(@Param("projectIds") Set<String> projectIds, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("userId") String userId);
|
||||||
List<ProjectUserCreateCount> userCreateBugCount(@Param("projectId") String projectId, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userIds") Set<String> userIds);
|
List<ProjectUserCreateCount> userCreateBugCount(@Param("projectId") String projectId, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("userIds") Set<String> userIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据处理人排序的处理人状态统计
|
* 根据处理人排序的处理人状态统计
|
||||||
|
@ -133,6 +133,6 @@ public interface ExtBugMapper {
|
||||||
* @param platforms 平台筛选
|
* @param platforms 平台筛选
|
||||||
* @return 项目用户状态数量DTO
|
* @return 项目用户状态数量DTO
|
||||||
*/
|
*/
|
||||||
List<ProjectUserStatusCountDTO> projectUserBugStatusCount(@Param("projectId") String projectId, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userIds") List<String> userIds, @Param("platforms") Set<String> platforms);
|
List<ProjectUserStatusCountDTO> projectUserBugStatusCount(@Param("projectId") String projectId, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("userIds") List<String> userIds, @Param("platforms") Set<String> platforms);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -399,7 +399,9 @@
|
||||||
<foreach collection="projectIds" item="projectId" separator="," open="(" close=")">
|
<foreach collection="projectIds" item="projectId" separator="," open="(" close=")">
|
||||||
#{projectId}
|
#{projectId}
|
||||||
</foreach>
|
</foreach>
|
||||||
AND bug.create_time BETWEEN #{startTime} AND #{endTime}
|
<if test="startTime != null and endTime != null">
|
||||||
|
AND bug.create_time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
<if test="userId != null and userId != ''">
|
<if test="userId != null and userId != ''">
|
||||||
AND bug.create_user = #{userId}
|
AND bug.create_user = #{userId}
|
||||||
</if>
|
</if>
|
||||||
|
@ -412,7 +414,9 @@
|
||||||
FROM bug
|
FROM bug
|
||||||
WHERE bug.deleted = false
|
WHERE bug.deleted = false
|
||||||
AND bug.project_id = #{projectId}
|
AND bug.project_id = #{projectId}
|
||||||
AND bug.create_time BETWEEN #{startTime} AND #{endTime}
|
<if test="startTime != null and endTime != null">
|
||||||
|
AND bug.create_time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
<if test="userIds != null and userIds.size() > 0">
|
<if test="userIds != null and userIds.size() > 0">
|
||||||
and bug.create_user in
|
and bug.create_user in
|
||||||
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
|
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
|
||||||
|
@ -428,7 +432,9 @@
|
||||||
FROM bug
|
FROM bug
|
||||||
WHERE bug.deleted = false
|
WHERE bug.deleted = false
|
||||||
AND bug.project_id = #{projectId}
|
AND bug.project_id = #{projectId}
|
||||||
AND bug.create_time BETWEEN #{startTime} AND #{endTime}
|
<if test="startTime != null and endTime != null">
|
||||||
|
AND bug.create_time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
AND bug.handle_user != ''
|
AND bug.handle_user != ''
|
||||||
<if test="userIds != null and userIds.size() > 0">
|
<if test="userIds != null and userIds.size() > 0">
|
||||||
AND bug.handle_user IN
|
AND bug.handle_user IN
|
||||||
|
|
|
@ -44,9 +44,9 @@ public interface ExtCaseReviewMapper {
|
||||||
|
|
||||||
String getReviewPassRule(@Param("id") String id);
|
String getReviewPassRule(@Param("id") String id);
|
||||||
|
|
||||||
List<ProjectCountDTO> projectReviewCount(@Param("projectIds") Set<String> projectIds, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userId") String userId);
|
List<ProjectCountDTO> projectReviewCount(@Param("projectIds") Set<String> projectIds, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("userId") String userId);
|
||||||
|
|
||||||
List<ProjectUserCreateCount> userCreateReviewCount(@Param("projectId") String projectId, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userIds") Set<String> userIds);
|
List<ProjectUserCreateCount> userCreateReviewCount(@Param("projectId") String projectId, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("userIds") Set<String> userIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取各种状态总数量的评审
|
* 获取各种状态总数量的评审
|
||||||
|
@ -55,6 +55,6 @@ public interface ExtCaseReviewMapper {
|
||||||
* @param endTime 时间过滤条件
|
* @param endTime 时间过滤条件
|
||||||
* @return ProjectUserStatusCountDTO userId 在这里不返回
|
* @return ProjectUserStatusCountDTO userId 在这里不返回
|
||||||
*/
|
*/
|
||||||
List<ProjectUserStatusCountDTO> statusReviewCount(@Param("projectId") String projectId, @Param("startTime") long startTime, @Param("endTime") long endTime);
|
List<ProjectUserStatusCountDTO> statusReviewCount(@Param("projectId") String projectId, @Param("startTime") Long startTime, @Param("endTime") Long endTime);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -358,7 +358,9 @@
|
||||||
<foreach collection="projectIds" item="projectId" separator="," open="(" close=")">
|
<foreach collection="projectIds" item="projectId" separator="," open="(" close=")">
|
||||||
#{projectId}
|
#{projectId}
|
||||||
</foreach>
|
</foreach>
|
||||||
AND case_review.create_time BETWEEN #{startTime} AND #{endTime}
|
<if test="startTime != null and endTime != null">
|
||||||
|
AND case_review.create_time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
<if test="userId != null and userId != ''">
|
<if test="userId != null and userId != ''">
|
||||||
AND case_review.create_user = #{userId}
|
AND case_review.create_user = #{userId}
|
||||||
</if>
|
</if>
|
||||||
|
@ -370,7 +372,9 @@
|
||||||
SELECT case_review.create_user as userId, count(case_review.id) as count
|
SELECT case_review.create_user as userId, count(case_review.id) as count
|
||||||
FROM case_review
|
FROM case_review
|
||||||
WHERE case_review.project_id = #{projectId}
|
WHERE case_review.project_id = #{projectId}
|
||||||
AND case_review.create_time BETWEEN #{startTime} AND #{endTime}
|
<if test="startTime != null and endTime != null">
|
||||||
|
AND case_review.create_time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
<if test="userIds != null and userIds.size() > 0">
|
<if test="userIds != null and userIds.size() > 0">
|
||||||
and case_review.create_user in
|
and case_review.create_user in
|
||||||
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
|
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
|
||||||
|
@ -383,7 +387,9 @@
|
||||||
SELECT case_review.status as status, count(case_review.id) as count
|
SELECT case_review.status as status, count(case_review.id) as count
|
||||||
FROM case_review
|
FROM case_review
|
||||||
WHERE case_review.project_id = #{projectId}
|
WHERE case_review.project_id = #{projectId}
|
||||||
AND case_review.create_time BETWEEN #{startTime} AND #{endTime}
|
<if test="startTime != null and endTime != null">
|
||||||
|
AND case_review.create_time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
group by case_review.status;
|
group by case_review.status;
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -117,14 +117,14 @@ public interface ExtFunctionalCaseMapper {
|
||||||
|
|
||||||
List<FunctionalCase> getProjectIdByIds(@Param("ids") List<String> ids);
|
List<FunctionalCase> getProjectIdByIds(@Param("ids") List<String> ids);
|
||||||
|
|
||||||
List<ProjectCountDTO> projectCaseCount(@Param("projectIds") Set<String> projectIds, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userId") String userId);
|
List<ProjectCountDTO> projectCaseCount(@Param("projectIds") Set<String> projectIds, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("userId") String userId);
|
||||||
|
|
||||||
List<ProjectUserCreateCount> userCreateCaseCount(@Param("projectId") String projectId, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userIds") Set<String> userIds);
|
List<ProjectUserCreateCount> userCreateCaseCount(@Param("projectId") String projectId, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("userIds") Set<String> userIds);
|
||||||
|
|
||||||
List<FunctionalCaseStatisticDTO> getStatisticListByProjectId(@Param("projectId") String projectId, @Param("startTime") long startTime, @Param("endTime") long endTime);
|
List<FunctionalCaseStatisticDTO> getStatisticListByProjectId(@Param("projectId") String projectId, @Param("startTime") Long startTime, @Param("endTime") Long endTime);
|
||||||
|
|
||||||
long caseTestCount(@Param("projectId") String projectId, @Param("startTime") long startTime, @Param("endTime") long endTime);
|
long caseTestCount(@Param("projectId") String projectId, @Param("startTime") Long startTime, @Param("endTime") Long endTime);
|
||||||
|
|
||||||
long simpleCaseCount(@Param("projectId") String projectId, @Param("startTime") long startTime, @Param("endTime") long endTime);
|
long simpleCaseCount(@Param("projectId") String projectId, @Param("startTime") Long startTime, @Param("endTime") Long endTime);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -903,7 +903,9 @@
|
||||||
LEFT JOIN functional_case_custom_field fccf ON fccf.case_id = fc.id
|
LEFT JOIN functional_case_custom_field fccf ON fccf.case_id = fc.id
|
||||||
LEFT JOIN custom_field cf ON cf.id = fccf.field_id
|
LEFT JOIN custom_field cf ON cf.id = fccf.field_id
|
||||||
WHERE fc.deleted = false
|
WHERE fc.deleted = false
|
||||||
AND fc.create_time BETWEEN #{startTime} AND #{endTime}
|
<if test="startTime != null and endTime != null">
|
||||||
|
AND fc.create_time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
AND fc.project_id = #{projectId}
|
AND fc.project_id = #{projectId}
|
||||||
AND cf.name = 'functional_priority'
|
AND cf.name = 'functional_priority'
|
||||||
AND cf.scene = 'FUNCTIONAL'
|
AND cf.scene = 'FUNCTIONAL'
|
||||||
|
@ -919,7 +921,9 @@
|
||||||
where fct.project_id = #{projectId}
|
where fct.project_id = #{projectId}
|
||||||
and fc.project_id = #{projectId}
|
and fc.project_id = #{projectId}
|
||||||
and fc.deleted = false
|
and fc.deleted = false
|
||||||
and fc.create_time between #{startTime} and #{endTime}
|
<if test="startTime != null and endTime != null">
|
||||||
|
AND fc.create_time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="simpleCaseCount"
|
<select id="simpleCaseCount"
|
||||||
|
@ -929,7 +933,9 @@
|
||||||
from functional_case
|
from functional_case
|
||||||
where functional_case.deleted = false
|
where functional_case.deleted = false
|
||||||
and functional_case.project_id = #{projectId}
|
and functional_case.project_id = #{projectId}
|
||||||
and functional_case.create_time between #{startTime} and #{endTime}
|
<if test="startTime != null and endTime != null">
|
||||||
|
AND functional_case.create_time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getProjectIdByIds" resultType="io.metersphere.functional.domain.FunctionalCase">
|
<select id="getProjectIdByIds" resultType="io.metersphere.functional.domain.FunctionalCase">
|
||||||
|
@ -948,8 +954,9 @@
|
||||||
<foreach collection="projectIds" item="projectId" separator="," open="(" close=")">
|
<foreach collection="projectIds" item="projectId" separator="," open="(" close=")">
|
||||||
#{projectId}
|
#{projectId}
|
||||||
</foreach>
|
</foreach>
|
||||||
AND functional_case.create_time BETWEEN #{startTime} AND #{endTime}
|
<if test="startTime != null and endTime != null">
|
||||||
|
AND functional_case.create_time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
<if test="userId != null and userId != ''">
|
<if test="userId != null and userId != ''">
|
||||||
AND functional_case.create_user = #{userId}
|
AND functional_case.create_user = #{userId}
|
||||||
</if>
|
</if>
|
||||||
|
@ -962,7 +969,9 @@
|
||||||
FROM functional_case
|
FROM functional_case
|
||||||
WHERE functional_case.deleted = false
|
WHERE functional_case.deleted = false
|
||||||
AND functional_case.project_id = #{projectId}
|
AND functional_case.project_id = #{projectId}
|
||||||
AND functional_case.create_time BETWEEN #{startTime} AND #{endTime}
|
<if test="startTime != null and endTime != null">
|
||||||
|
AND functional_case.create_time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
<if test="userIds != null and userIds.size() > 0">
|
<if test="userIds != null and userIds.size() > 0">
|
||||||
and functional_case.create_user in
|
and functional_case.create_user in
|
||||||
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
|
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
|
||||||
|
|
|
@ -9,6 +9,10 @@ import io.metersphere.dashboard.response.OverViewCountDTO;
|
||||||
import io.metersphere.dashboard.response.StatisticsDTO;
|
import io.metersphere.dashboard.response.StatisticsDTO;
|
||||||
import io.metersphere.dashboard.service.DashboardService;
|
import io.metersphere.dashboard.service.DashboardService;
|
||||||
import io.metersphere.functional.dto.CaseReviewDTO;
|
import io.metersphere.functional.dto.CaseReviewDTO;
|
||||||
|
import io.metersphere.plugin.platform.dto.SelectOption;
|
||||||
|
import io.metersphere.project.service.PermissionCheckService;
|
||||||
|
import io.metersphere.sdk.constants.PermissionConstants;
|
||||||
|
import io.metersphere.sdk.exception.MSException;
|
||||||
import io.metersphere.system.security.CheckOwner;
|
import io.metersphere.system.security.CheckOwner;
|
||||||
import io.metersphere.system.utils.PageUtils;
|
import io.metersphere.system.utils.PageUtils;
|
||||||
import io.metersphere.system.utils.Pager;
|
import io.metersphere.system.utils.Pager;
|
||||||
|
@ -21,6 +25,8 @@ import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static io.metersphere.dashboard.result.DashboardResultCode.NO_PROJECT_PERMISSION;
|
||||||
|
|
||||||
@Tag(name = "工作台-首页")
|
@Tag(name = "工作台-首页")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/dashboard")
|
@RequestMapping("/dashboard")
|
||||||
|
@ -28,6 +34,8 @@ public class DashboardController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private DashboardService dashboardService;
|
private DashboardService dashboardService;
|
||||||
|
@Resource
|
||||||
|
private PermissionCheckService permissionCheckService;
|
||||||
|
|
||||||
@PostMapping("/layout/edit/{organizationId}")
|
@PostMapping("/layout/edit/{organizationId}")
|
||||||
@Operation(summary = "编辑用户布局")
|
@Operation(summary = "编辑用户布局")
|
||||||
|
@ -68,34 +76,68 @@ public class DashboardController {
|
||||||
@Operation(summary = "缺陷处理人统计")
|
@Operation(summary = "缺陷处理人统计")
|
||||||
@CheckOwner(resourceId = "#request.getOrganizationId()", resourceType = "organization")
|
@CheckOwner(resourceId = "#request.getOrganizationId()", resourceType = "organization")
|
||||||
public OverViewCountDTO projectBugHandleUser(@Validated @RequestBody DashboardFrontPageRequest request) {
|
public OverViewCountDTO projectBugHandleUser(@Validated @RequestBody DashboardFrontPageRequest request) {
|
||||||
return dashboardService.projectBugHandleUser(request);
|
return dashboardService.projectBugHandleUser(request, SessionUtils.getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/bug_handle_user/list/{projectId}")
|
||||||
|
@Operation(summary = "获取缺陷处理人列表")
|
||||||
|
@CheckOwner(resourceId = "#projectId", resourceType = "project")
|
||||||
|
public List<SelectOption> getBugHandleUserList(@PathVariable String projectId) {
|
||||||
|
return dashboardService.getBugHandleUserList(projectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/case_count")
|
@PostMapping("/case_count")
|
||||||
@Operation(summary = "用例数")
|
@Operation(summary = "用例数")
|
||||||
@CheckOwner(resourceId = "#request.getOrganizationId()", resourceType = "organization")
|
@CheckOwner(resourceId = "#request.getOrganizationId()", resourceType = "organization")
|
||||||
public StatisticsDTO projectCaseCount(@Validated @RequestBody DashboardFrontPageRequest request) {
|
public StatisticsDTO projectCaseCount(@Validated @RequestBody DashboardFrontPageRequest request) {
|
||||||
return dashboardService.projectCaseCount(request);
|
return dashboardService.projectCaseCount(request, SessionUtils.getUserId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/associate_case_count")
|
@PostMapping("/associate_case_count")
|
||||||
@Operation(summary = "关联用例统计")
|
@Operation(summary = "关联用例统计")
|
||||||
@CheckOwner(resourceId = "#request.getOrganizationId()", resourceType = "organization")
|
@CheckOwner(resourceId = "#request.getOrganizationId()", resourceType = "organization")
|
||||||
public StatisticsDTO projectAssociateCaseCount(@Validated @RequestBody DashboardFrontPageRequest request) {
|
public StatisticsDTO projectAssociateCaseCount(@Validated @RequestBody DashboardFrontPageRequest request) {
|
||||||
return dashboardService.projectAssociateCaseCount(request);
|
return dashboardService.projectAssociateCaseCount(request, SessionUtils.getUserId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/review_case_count")
|
@PostMapping("/review_case_count")
|
||||||
@Operation(summary = "用例评审数")
|
@Operation(summary = "用例评审数")
|
||||||
@CheckOwner(resourceId = "#request.getOrganizationId()", resourceType = "organization")
|
@CheckOwner(resourceId = "#request.getOrganizationId()", resourceType = "organization")
|
||||||
public StatisticsDTO projectReviewCaseCount(@Validated @RequestBody DashboardFrontPageRequest request) {
|
public StatisticsDTO projectReviewCaseCount(@Validated @RequestBody DashboardFrontPageRequest request) {
|
||||||
return dashboardService.projectReviewCaseCount(request);
|
return dashboardService.projectReviewCaseCount(request, SessionUtils.getUserId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/api_count")
|
||||||
|
@Operation(summary = "接口数量统计")
|
||||||
|
@CheckOwner(resourceId = "#request.getOrganizationId()", resourceType = "organization")
|
||||||
|
public StatisticsDTO projectApiCount(@Validated @RequestBody DashboardFrontPageRequest request) {
|
||||||
|
return dashboardService.projectApiCount(request, SessionUtils.getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/api_case_count")
|
||||||
|
@Operation(summary = "接口用例数量统计")
|
||||||
|
@CheckOwner(resourceId = "#request.getOrganizationId()", resourceType = "organization")
|
||||||
|
public StatisticsDTO projectApiCaseCount(@Validated @RequestBody DashboardFrontPageRequest request) {
|
||||||
|
return dashboardService.projectApiCaseCount(request, SessionUtils.getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/scenario_count")
|
||||||
|
@Operation(summary = "场景数量统计")
|
||||||
|
@CheckOwner(resourceId = "#request.getOrganizationId()", resourceType = "organization")
|
||||||
|
public StatisticsDTO projectApiScenarioCount(@Validated @RequestBody DashboardFrontPageRequest request) {
|
||||||
|
return dashboardService.projectApiScenarioCount(request, SessionUtils.getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/reviewing_by_me")
|
@PostMapping("/reviewing_by_me")
|
||||||
@Operation(summary = "待我评审")
|
@Operation(summary = "待我评审")
|
||||||
@CheckOwner(resourceId = "#request.getOrganizationId()", resourceType = "organization")
|
@CheckOwner(resourceId = "#request.getOrganizationId()", resourceType = "organization")
|
||||||
public Pager<List<CaseReviewDTO>> getFunctionalCasePage(@Validated @RequestBody DashboardFrontPageRequest request) {
|
public Pager<List<CaseReviewDTO>> getFunctionalCasePage(@Validated @RequestBody DashboardFrontPageRequest request) {
|
||||||
|
String projectId = request.getProjectIds().getFirst();
|
||||||
|
if (Boolean.FALSE.equals(permissionCheckService.checkModule(projectId, "caseManagement", SessionUtils.getUserId(), PermissionConstants.FUNCTIONAL_CASE_READ))) {
|
||||||
|
throw new MSException(NO_PROJECT_PERMISSION);
|
||||||
|
}
|
||||||
return dashboardService.getFunctionalCasePage(request);
|
return dashboardService.getFunctionalCasePage(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,6 +145,10 @@ public class DashboardController {
|
||||||
@Operation(summary = "接口变更")
|
@Operation(summary = "接口变更")
|
||||||
@CheckOwner(resourceId = "#request.getOrganizationId()", resourceType = "organization")
|
@CheckOwner(resourceId = "#request.getOrganizationId()", resourceType = "organization")
|
||||||
public Pager<List<ApiDefinitionUpdateDTO>> getApiUpdatePage(@Validated @RequestBody DashboardFrontPageRequest request) {
|
public Pager<List<ApiDefinitionUpdateDTO>> getApiUpdatePage(@Validated @RequestBody DashboardFrontPageRequest request) {
|
||||||
|
String projectId = request.getProjectIds().getFirst();
|
||||||
|
if (Boolean.FALSE.equals(permissionCheckService.checkModule(projectId, "apiTest", SessionUtils.getUserId(), PermissionConstants.PROJECT_API_DEFINITION_READ))) {
|
||||||
|
throw new MSException(NO_PROJECT_PERMISSION);
|
||||||
|
}
|
||||||
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize());
|
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize());
|
||||||
return PageUtils.setPageInfo(page, dashboardService.getApiUpdatePage(request));
|
return PageUtils.setPageInfo(page, dashboardService.getApiUpdatePage(request));
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,16 @@ package io.metersphere.dashboard.service;
|
||||||
|
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import io.metersphere.api.constants.ApiDefinitionStatus;
|
||||||
|
import io.metersphere.api.domain.ApiDefinition;
|
||||||
|
import io.metersphere.api.domain.ApiScenario;
|
||||||
import io.metersphere.api.domain.ApiTestCase;
|
import io.metersphere.api.domain.ApiTestCase;
|
||||||
import io.metersphere.api.dto.definition.ApiDefinitionUpdateDTO;
|
import io.metersphere.api.dto.definition.ApiDefinitionUpdateDTO;
|
||||||
import io.metersphere.api.dto.definition.ApiRefSourceCountDTO;
|
import io.metersphere.api.dto.definition.ApiRefSourceCountDTO;
|
||||||
import io.metersphere.api.mapper.ExtApiDefinitionMapper;
|
import io.metersphere.api.mapper.ExtApiDefinitionMapper;
|
||||||
import io.metersphere.api.mapper.ExtApiScenarioMapper;
|
import io.metersphere.api.mapper.ExtApiScenarioMapper;
|
||||||
import io.metersphere.api.mapper.ExtApiTestCaseMapper;
|
import io.metersphere.api.mapper.ExtApiTestCaseMapper;
|
||||||
|
import io.metersphere.api.service.ApiTestService;
|
||||||
import io.metersphere.bug.enums.BugPlatform;
|
import io.metersphere.bug.enums.BugPlatform;
|
||||||
import io.metersphere.bug.mapper.ExtBugMapper;
|
import io.metersphere.bug.mapper.ExtBugMapper;
|
||||||
import io.metersphere.bug.service.BugCommonService;
|
import io.metersphere.bug.service.BugCommonService;
|
||||||
|
@ -37,17 +41,21 @@ import io.metersphere.project.dto.ProjectUserStatusCountDTO;
|
||||||
import io.metersphere.project.mapper.ExtProjectMapper;
|
import io.metersphere.project.mapper.ExtProjectMapper;
|
||||||
import io.metersphere.project.mapper.ExtProjectMemberMapper;
|
import io.metersphere.project.mapper.ExtProjectMemberMapper;
|
||||||
import io.metersphere.project.mapper.ProjectMapper;
|
import io.metersphere.project.mapper.ProjectMapper;
|
||||||
|
import io.metersphere.project.service.PermissionCheckService;
|
||||||
import io.metersphere.project.service.ProjectApplicationService;
|
import io.metersphere.project.service.ProjectApplicationService;
|
||||||
import io.metersphere.project.service.ProjectService;
|
import io.metersphere.project.service.ProjectService;
|
||||||
|
import io.metersphere.sdk.constants.ExecStatus;
|
||||||
import io.metersphere.sdk.constants.PermissionConstants;
|
import io.metersphere.sdk.constants.PermissionConstants;
|
||||||
|
import io.metersphere.sdk.constants.ResultStatus;
|
||||||
import io.metersphere.sdk.dto.CombineCondition;
|
import io.metersphere.sdk.dto.CombineCondition;
|
||||||
import io.metersphere.sdk.dto.CombineSearch;
|
import io.metersphere.sdk.dto.CombineSearch;
|
||||||
import io.metersphere.sdk.exception.MSException;
|
|
||||||
import io.metersphere.sdk.util.JSON;
|
import io.metersphere.sdk.util.JSON;
|
||||||
import io.metersphere.sdk.util.Translator;
|
import io.metersphere.sdk.util.Translator;
|
||||||
import io.metersphere.system.domain.UserLayout;
|
import io.metersphere.system.domain.UserLayout;
|
||||||
import io.metersphere.system.domain.UserLayoutExample;
|
import io.metersphere.system.domain.UserLayoutExample;
|
||||||
|
import io.metersphere.system.dto.ProtocolDTO;
|
||||||
import io.metersphere.system.dto.user.ProjectUserMemberDTO;
|
import io.metersphere.system.dto.user.ProjectUserMemberDTO;
|
||||||
|
import io.metersphere.system.mapper.ExtExecTaskItemMapper;
|
||||||
import io.metersphere.system.mapper.UserLayoutMapper;
|
import io.metersphere.system.mapper.UserLayoutMapper;
|
||||||
import io.metersphere.system.uid.IDGenerator;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import io.metersphere.system.utils.PageUtils;
|
import io.metersphere.system.utils.PageUtils;
|
||||||
|
@ -95,8 +103,12 @@ public class DashboardService {
|
||||||
@Resource
|
@Resource
|
||||||
private ExtProjectMemberMapper extProjectMemberMapper;
|
private ExtProjectMemberMapper extProjectMemberMapper;
|
||||||
@Resource
|
@Resource
|
||||||
|
private ExtExecTaskItemMapper extExecTaskItemMapper;
|
||||||
|
@Resource
|
||||||
private ProjectService projectService;
|
private ProjectService projectService;
|
||||||
@Resource
|
@Resource
|
||||||
|
private PermissionCheckService permissionCheckService;
|
||||||
|
@Resource
|
||||||
private ProjectMapper projectMapper;
|
private ProjectMapper projectMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private UserLayoutMapper userLayoutMapper;
|
private UserLayoutMapper userLayoutMapper;
|
||||||
|
@ -108,6 +120,8 @@ public class DashboardService {
|
||||||
private ProjectApplicationService projectApplicationService;
|
private ProjectApplicationService projectApplicationService;
|
||||||
@Resource
|
@Resource
|
||||||
private CaseReviewService caseReviewService;
|
private CaseReviewService caseReviewService;
|
||||||
|
@Resource
|
||||||
|
private ApiTestService apiTestService;
|
||||||
|
|
||||||
|
|
||||||
public static final String FUNCTIONAL = "FUNCTIONAL"; // 功能用例
|
public static final String FUNCTIONAL = "FUNCTIONAL"; // 功能用例
|
||||||
|
@ -330,27 +344,27 @@ public class DashboardService {
|
||||||
List<LayoutDTO> layoutDTOS = JSON.parseArray(layoutDTOStr, LayoutDTO.class);
|
List<LayoutDTO> layoutDTOS = JSON.parseArray(layoutDTOStr, LayoutDTO.class);
|
||||||
|
|
||||||
//重新查询排除项目禁用的或者用户已经移除某个项目的项目或者成员
|
//重新查询排除项目禁用的或者用户已经移除某个项目的项目或者成员
|
||||||
List<String> allProjectIds = new ArrayList<>();
|
List<String> oldAllProjectIds = new ArrayList<>();
|
||||||
List<String> allHandleUsers = new ArrayList<>();
|
List<String> oldHallHandleUsers = new ArrayList<>();
|
||||||
for (LayoutDTO layoutDTO : layoutDTOS) {
|
for (LayoutDTO layoutDTO : layoutDTOS) {
|
||||||
allProjectIds.addAll(layoutDTO.getProjectIds());
|
oldAllProjectIds.addAll(layoutDTO.getProjectIds());
|
||||||
allHandleUsers.addAll(layoutDTO.getHandleUsers());
|
oldHallHandleUsers.addAll(layoutDTO.getHandleUsers());
|
||||||
}
|
}
|
||||||
List<Project> getUserProjectIdName;
|
List<Project> hasPermissionProjectList;
|
||||||
if (CollectionUtils.isEmpty(allProjectIds)) {
|
if (CollectionUtils.isEmpty(oldAllProjectIds)) {
|
||||||
getUserProjectIdName = extProjectMapper.getUserProjectIdName(organizationId, null, userId);
|
hasPermissionProjectList = extProjectMapper.getUserProjectIdName(organizationId, null, userId);
|
||||||
} else {
|
} else {
|
||||||
List<String> projectIds = allProjectIds.stream().distinct().toList();
|
List<String> projectIds = oldAllProjectIds.stream().distinct().toList();
|
||||||
getUserProjectIdName = extProjectMapper.getUserProjectIdName(null, projectIds, userId);
|
hasPermissionProjectList = extProjectMapper.getUserProjectIdName(null, projectIds, userId);
|
||||||
if (CollectionUtils.isEmpty(getUserProjectIdName)) {
|
if (CollectionUtils.isEmpty(hasPermissionProjectList)) {
|
||||||
getUserProjectIdName = extProjectMapper.getUserProjectIdName(organizationId, null, userId);
|
hasPermissionProjectList = extProjectMapper.getUserProjectIdName(organizationId, null, userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Map<String, Project> projectMap = getUserProjectIdName.stream().collect(Collectors.toMap(Project::getId, t -> t));
|
Map<String, Project> projectMap = hasPermissionProjectList.stream().collect(Collectors.toMap(Project::getId, t -> t));
|
||||||
List<String> handleUsers = allHandleUsers.stream().distinct().toList();
|
List<String> handleUsers = oldHallHandleUsers.stream().distinct().toList();
|
||||||
List<ProjectUserMemberDTO> orgProjectMemberList = extProjectMemberMapper.getOrgProjectMemberList(organizationId, handleUsers);
|
List<ProjectUserMemberDTO> orgProjectMemberList = extProjectMemberMapper.getOrgProjectMemberList(organizationId, handleUsers);
|
||||||
//重新填充填充返回的项目id 和 用户id
|
//重新填充填充返回的项目id 和 用户id
|
||||||
rebuildProjectOrUser(layoutDTOS, getUserProjectIdName, projectMap, orgProjectMemberList);
|
rebuildProjectOrUser(layoutDTOS, hasPermissionProjectList, projectMap, orgProjectMemberList);
|
||||||
return layoutDTOS;
|
return layoutDTOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,22 +409,22 @@ public class DashboardService {
|
||||||
/**
|
/**
|
||||||
* 过滤用户在当前项目是否有移除或者项目是否被禁用以及用户是否被删除禁用
|
* 过滤用户在当前项目是否有移除或者项目是否被禁用以及用户是否被删除禁用
|
||||||
*
|
*
|
||||||
* @param layoutDTOS 获取的所有布局卡片
|
* @param layoutDTOS 获取的所有布局卡片
|
||||||
* @param getUserProjectIdName 用户有任意权限的项目
|
* @param hasPermissionProjectList 用户有任意权限的项目
|
||||||
* @param projectMap 用户有任意权限的项目Map
|
* @param projectMap 用户有任意权限的项目Map
|
||||||
* @param orgProjectMemberList 组织下所有的项目人员
|
* @param orgProjectMemberList 组织下所有的项目人员
|
||||||
*/
|
*/
|
||||||
private static void rebuildProjectOrUser(List<LayoutDTO> layoutDTOS, List<Project> getUserProjectIdName, Map<String, Project> projectMap, List<ProjectUserMemberDTO> orgProjectMemberList) {
|
private static void rebuildProjectOrUser(List<LayoutDTO> layoutDTOS, List<Project> hasPermissionProjectList, Map<String, Project> projectMap, List<ProjectUserMemberDTO> orgProjectMemberList) {
|
||||||
for (LayoutDTO layoutDTO : layoutDTOS) {
|
for (LayoutDTO layoutDTO : layoutDTOS) {
|
||||||
if (StringUtils.equalsIgnoreCase(layoutDTO.getKey(), DashboardUserLayoutKeys.PROJECT_VIEW.toString()) || StringUtils.equalsIgnoreCase(layoutDTO.getKey(), DashboardUserLayoutKeys.CREATE_BY_ME.toString())) {
|
if (StringUtils.equalsIgnoreCase(layoutDTO.getKey(), DashboardUserLayoutKeys.PROJECT_VIEW.toString()) || StringUtils.equalsIgnoreCase(layoutDTO.getKey(), DashboardUserLayoutKeys.CREATE_BY_ME.toString())) {
|
||||||
List<Project> list = getUserProjectIdName.stream().filter(t -> layoutDTO.getProjectIds().contains(t.getId())).toList();
|
List<Project> list = hasPermissionProjectList.stream().filter(t -> layoutDTO.getProjectIds().contains(t.getId())).toList();
|
||||||
layoutDTO.setProjectIds(list.stream().map(Project::getId).toList());
|
layoutDTO.setProjectIds(list.stream().map(Project::getId).toList());
|
||||||
} else if (StringUtils.equalsIgnoreCase(layoutDTO.getKey(), DashboardUserLayoutKeys.PROJECT_MEMBER_VIEW.toString())) {
|
} else if (StringUtils.equalsIgnoreCase(layoutDTO.getKey(), DashboardUserLayoutKeys.PROJECT_MEMBER_VIEW.toString())) {
|
||||||
List<ProjectUserMemberDTO> list = orgProjectMemberList.stream().filter(t -> layoutDTO.getHandleUsers().contains(t.getId())).toList();
|
List<ProjectUserMemberDTO> list = orgProjectMemberList.stream().filter(t -> layoutDTO.getHandleUsers().contains(t.getId())).toList();
|
||||||
layoutDTO.setHandleUsers(list.stream().map(ProjectUserMemberDTO::getId).toList());
|
layoutDTO.setHandleUsers(list.stream().map(ProjectUserMemberDTO::getId).toList());
|
||||||
} else {
|
} else {
|
||||||
if (CollectionUtils.isNotEmpty(layoutDTO.getProjectIds()) && projectMap.get(layoutDTO.getProjectIds().getFirst()) == null) {
|
if (CollectionUtils.isNotEmpty(layoutDTO.getProjectIds()) && projectMap.get(layoutDTO.getProjectIds().getFirst()) == null) {
|
||||||
layoutDTO.setProjectIds(List.of(getUserProjectIdName.get(0).getId()));
|
layoutDTO.setProjectIds(List.of(hasPermissionProjectList.get(0).getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -555,24 +569,25 @@ public class DashboardService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public StatisticsDTO projectCaseCount(DashboardFrontPageRequest request) {
|
public StatisticsDTO projectCaseCount(DashboardFrontPageRequest request, String userId) {
|
||||||
String projectId = request.getProjectIds().getFirst();
|
String projectId = request.getProjectIds().getFirst();
|
||||||
StatisticsDTO statisticsDTO = new StatisticsDTO();
|
StatisticsDTO statisticsDTO = new StatisticsDTO();
|
||||||
if (Boolean.FALSE.equals(projectService.checkModule(projectId, FUNCTIONAL_CASE_MODULE))) {
|
if (Boolean.FALSE.equals(permissionCheckService.checkModule(projectId, FUNCTIONAL_CASE_MODULE, userId, PermissionConstants.FUNCTIONAL_CASE_READ))) {
|
||||||
statisticsDTO.setErrorCode(NO_PROJECT_PERMISSION.getCode());
|
statisticsDTO.setErrorCode(NO_PROJECT_PERMISSION.getCode());
|
||||||
return statisticsDTO;
|
return statisticsDTO;
|
||||||
}
|
}
|
||||||
List<StatusPercentDTO> statusPercentList = new ArrayList<>();
|
|
||||||
Long toStartTime = request.getToStartTime();
|
Long toStartTime = request.getToStartTime();
|
||||||
Long toEndTime = request.getToEndTime();
|
Long toEndTime = request.getToEndTime();
|
||||||
List<FunctionalCaseStatisticDTO> statisticListByProjectId = extFunctionalCaseMapper.getStatisticListByProjectId(projectId, toStartTime, toEndTime);
|
List<FunctionalCaseStatisticDTO> statisticListByProjectId = extFunctionalCaseMapper.getStatisticListByProjectId(projectId, toStartTime, toEndTime);
|
||||||
|
List<StatusPercentDTO> statusPercentList = new ArrayList<>();
|
||||||
buildStatusPercentList(statisticListByProjectId, statusPercentList);
|
buildStatusPercentList(statisticListByProjectId, statusPercentList);
|
||||||
statisticsDTO.setStatusPercentList(statusPercentList);
|
statisticsDTO.setStatusPercentList(statusPercentList);
|
||||||
Map<String, List<FunctionalCaseStatisticDTO>> reviewStatusMap = statisticListByProjectId.stream().collect(Collectors.groupingBy(FunctionalCaseStatisticDTO::getReviewStatus));
|
List<FunctionalCaseStatisticDTO> allStatisticListByProjectId = extFunctionalCaseMapper.getStatisticListByProjectId(projectId, null, null);
|
||||||
|
Map<String, List<FunctionalCaseStatisticDTO>> reviewStatusMap = allStatisticListByProjectId.stream().collect(Collectors.groupingBy(FunctionalCaseStatisticDTO::getReviewStatus));
|
||||||
Map<String, List<NameCountDTO>> statusStatisticsMap = new HashMap<>();
|
Map<String, List<NameCountDTO>> statusStatisticsMap = new HashMap<>();
|
||||||
List<NameCountDTO> reviewList = getReviewList(reviewStatusMap, statisticListByProjectId);
|
List<NameCountDTO> reviewList = getReviewList(reviewStatusMap, allStatisticListByProjectId);
|
||||||
statusStatisticsMap.put("review", reviewList);
|
statusStatisticsMap.put("review", reviewList);
|
||||||
List<NameCountDTO> passList = getPassList(reviewStatusMap, statisticListByProjectId);
|
List<NameCountDTO> passList = getPassList(reviewStatusMap, allStatisticListByProjectId);
|
||||||
statusStatisticsMap.put("pass", passList);
|
statusStatisticsMap.put("pass", passList);
|
||||||
statisticsDTO.setStatusStatisticsMap(statusStatisticsMap);
|
statisticsDTO.setStatusStatisticsMap(statusStatisticsMap);
|
||||||
return statisticsDTO;
|
return statisticsDTO;
|
||||||
|
@ -588,8 +603,8 @@ public class DashboardService {
|
||||||
NameCountDTO passRate = new NameCountDTO();
|
NameCountDTO passRate = new NameCountDTO();
|
||||||
passRate.setName(Translator.get("functional_case.passRate"));
|
passRate.setName(Translator.get("functional_case.passRate"));
|
||||||
if (CollectionUtils.isNotEmpty(statisticListByProjectId)) {
|
if (CollectionUtils.isNotEmpty(statisticListByProjectId)) {
|
||||||
BigDecimal divide = BigDecimal.valueOf(hasPassList.size()).divide(BigDecimal.valueOf(statisticListByProjectId.size()), 0, RoundingMode.HALF_UP);
|
BigDecimal divide = BigDecimal.valueOf(hasPassList.size()).divide(BigDecimal.valueOf(statisticListByProjectId.size()), 2, RoundingMode.HALF_UP);
|
||||||
passRate.setCount(Integer.valueOf(String.valueOf(divide.multiply(BigDecimal.valueOf(100)))));
|
passRate.setCount(getTurnCount(divide));
|
||||||
} else {
|
} else {
|
||||||
passRate.setCount(0);
|
passRate.setCount(0);
|
||||||
}
|
}
|
||||||
|
@ -617,8 +632,8 @@ public class DashboardService {
|
||||||
if (CollectionUtils.isEmpty(statisticListByProjectId)) {
|
if (CollectionUtils.isEmpty(statisticListByProjectId)) {
|
||||||
reviewRate.setCount(0);
|
reviewRate.setCount(0);
|
||||||
} else {
|
} else {
|
||||||
BigDecimal divide = BigDecimal.valueOf(statisticListByProjectId.size() - unReviewList.size()).divide(BigDecimal.valueOf(statisticListByProjectId.size()), 0, RoundingMode.HALF_UP);
|
BigDecimal divide = BigDecimal.valueOf(statisticListByProjectId.size() - unReviewList.size()).divide(BigDecimal.valueOf(statisticListByProjectId.size()), 2, RoundingMode.HALF_UP);
|
||||||
reviewRate.setCount(Integer.valueOf(String.valueOf(divide.multiply(BigDecimal.valueOf(100)))));
|
reviewRate.setCount(getTurnCount(divide));
|
||||||
}
|
}
|
||||||
reviewList.add(reviewRate);
|
reviewList.add(reviewRate);
|
||||||
NameCountDTO hasReview = new NameCountDTO();
|
NameCountDTO hasReview = new NameCountDTO();
|
||||||
|
@ -632,6 +647,16 @@ public class DashboardService {
|
||||||
return reviewList;
|
return reviewList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private static Integer getTurnCount(BigDecimal divide) {
|
||||||
|
String value = String.valueOf(divide.multiply(BigDecimal.valueOf(100)));
|
||||||
|
int i = value.indexOf(".");
|
||||||
|
if (i > 0) {
|
||||||
|
value = value.substring(0, i);
|
||||||
|
}
|
||||||
|
return Integer.valueOf(value);
|
||||||
|
}
|
||||||
|
|
||||||
private static void buildStatusPercentList(List<FunctionalCaseStatisticDTO> statisticListByProjectId, List<StatusPercentDTO> statusPercentList) {
|
private static void buildStatusPercentList(List<FunctionalCaseStatisticDTO> statisticListByProjectId, List<StatusPercentDTO> statusPercentList) {
|
||||||
Map<String, List<FunctionalCaseStatisticDTO>> priorityMap = statisticListByProjectId.stream().collect(Collectors.groupingBy(FunctionalCaseStatisticDTO::getPriority));
|
Map<String, List<FunctionalCaseStatisticDTO>> priorityMap = statisticListByProjectId.stream().collect(Collectors.groupingBy(FunctionalCaseStatisticDTO::getPriority));
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
|
@ -652,17 +677,15 @@ public class DashboardService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public StatisticsDTO projectAssociateCaseCount(DashboardFrontPageRequest request) {
|
public StatisticsDTO projectAssociateCaseCount(DashboardFrontPageRequest request, String userId) {
|
||||||
String projectId = request.getProjectIds().getFirst();
|
String projectId = request.getProjectIds().getFirst();
|
||||||
StatisticsDTO statisticsDTO = new StatisticsDTO();
|
StatisticsDTO statisticsDTO = new StatisticsDTO();
|
||||||
if (Boolean.FALSE.equals(projectService.checkModule(projectId, FUNCTIONAL_CASE_MODULE))) {
|
if (Boolean.FALSE.equals(permissionCheckService.checkModule(projectId, FUNCTIONAL_CASE_MODULE, userId, PermissionConstants.FUNCTIONAL_CASE_READ))) {
|
||||||
statisticsDTO.setErrorCode(NO_PROJECT_PERMISSION.getCode());
|
statisticsDTO.setErrorCode(NO_PROJECT_PERMISSION.getCode());
|
||||||
return statisticsDTO;
|
return statisticsDTO;
|
||||||
}
|
}
|
||||||
Long toStartTime = request.getToStartTime();
|
long caseTestCount = extFunctionalCaseMapper.caseTestCount(projectId, null, null);
|
||||||
Long toEndTime = request.getToEndTime();
|
long simpleCaseCount = extFunctionalCaseMapper.simpleCaseCount(projectId, null, null);
|
||||||
long caseTestCount = extFunctionalCaseMapper.caseTestCount(projectId, toStartTime, toEndTime);
|
|
||||||
long simpleCaseCount = extFunctionalCaseMapper.simpleCaseCount(projectId, toStartTime, toEndTime);
|
|
||||||
List<NameCountDTO> coverList = getCoverList((int) simpleCaseCount, (int) caseTestCount, (int) (simpleCaseCount - caseTestCount));
|
List<NameCountDTO> coverList = getCoverList((int) simpleCaseCount, (int) caseTestCount, (int) (simpleCaseCount - caseTestCount));
|
||||||
Map<String, List<NameCountDTO>> statusStatisticsMap = new HashMap<>();
|
Map<String, List<NameCountDTO>> statusStatisticsMap = new HashMap<>();
|
||||||
statusStatisticsMap.put("cover", coverList);
|
statusStatisticsMap.put("cover", coverList);
|
||||||
|
@ -670,9 +693,9 @@ public class DashboardService {
|
||||||
return statisticsDTO;
|
return statisticsDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OverViewCountDTO projectBugHandleUser(DashboardFrontPageRequest request) {
|
public OverViewCountDTO projectBugHandleUser(DashboardFrontPageRequest request, String userId) {
|
||||||
String projectId = request.getProjectIds().getFirst();
|
String projectId = request.getProjectIds().getFirst();
|
||||||
if (Boolean.FALSE.equals(projectService.checkModule(projectId, BUG_MODULE)))
|
if (Boolean.FALSE.equals(permissionCheckService.checkModule(projectId, BUG_MODULE, userId, PermissionConstants.PROJECT_BUG_READ)))
|
||||||
return new OverViewCountDTO(null, new ArrayList<>(), new ArrayList<>());
|
return new OverViewCountDTO(null, new ArrayList<>(), new ArrayList<>());
|
||||||
Long toStartTime = request.getToStartTime();
|
Long toStartTime = request.getToStartTime();
|
||||||
Long toEndTime = request.getToEndTime();
|
Long toEndTime = request.getToEndTime();
|
||||||
|
@ -683,7 +706,10 @@ public class DashboardService {
|
||||||
List<String> handleUserIds = headerHandlerOption.stream().sorted(Comparator.comparing(SelectOption::getValue)).map(SelectOption::getValue).collect(Collectors.toList());
|
List<String> handleUserIds = headerHandlerOption.stream().sorted(Comparator.comparing(SelectOption::getValue)).map(SelectOption::getValue).collect(Collectors.toList());
|
||||||
List<ProjectUserStatusCountDTO> projectUserStatusCountDTOS = extBugMapper.projectUserBugStatusCount(projectId, toStartTime, toEndTime, handleUserIds, platforms);
|
List<ProjectUserStatusCountDTO> projectUserStatusCountDTOS = extBugMapper.projectUserBugStatusCount(projectId, toStartTime, toEndTime, handleUserIds, platforms);
|
||||||
Map<String, SelectOption> statusMap = headerStatusOption.stream().collect(Collectors.toMap(SelectOption::getValue, t -> t));
|
Map<String, SelectOption> statusMap = headerStatusOption.stream().collect(Collectors.toMap(SelectOption::getValue, t -> t));
|
||||||
List<String> xaxis = headerHandlerOption.stream().sorted(Comparator.comparing(SelectOption::getValue)).map(SelectOption::getText).toList();
|
List<String> xaxis = new ArrayList<>(headerHandlerOption.stream().sorted(Comparator.comparing(SelectOption::getValue)).map(SelectOption::getText).toList());
|
||||||
|
if (CollectionUtils.isEmpty(xaxis)) {
|
||||||
|
xaxis.add(userId);
|
||||||
|
}
|
||||||
Map<String, List<Integer>> statusCountArrayMap = getStatusCountArrayMap(projectUserStatusCountDTOS, statusMap, handleUserIds);
|
Map<String, List<Integer>> statusCountArrayMap = getStatusCountArrayMap(projectUserStatusCountDTOS, statusMap, handleUserIds);
|
||||||
return getHandleUserCount(xaxis, statusMap, statusCountArrayMap);
|
return getHandleUserCount(xaxis, statusMap, statusCountArrayMap);
|
||||||
}
|
}
|
||||||
|
@ -802,16 +828,16 @@ public class DashboardService {
|
||||||
return platforms;
|
return platforms;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StatisticsDTO projectReviewCaseCount(DashboardFrontPageRequest request) {
|
public StatisticsDTO projectReviewCaseCount(DashboardFrontPageRequest request, String userId) {
|
||||||
String projectId = request.getProjectIds().getFirst();
|
String projectId = request.getProjectIds().getFirst();
|
||||||
StatisticsDTO statisticsDTO = new StatisticsDTO();
|
StatisticsDTO statisticsDTO = new StatisticsDTO();
|
||||||
if (Boolean.FALSE.equals(projectService.checkModule(projectId, FUNCTIONAL_CASE_MODULE))) {
|
if (Boolean.FALSE.equals(permissionCheckService.checkModule(projectId, FUNCTIONAL_CASE_MODULE, userId, PermissionConstants.FUNCTIONAL_CASE_READ))) {
|
||||||
statisticsDTO.setErrorCode(NO_PROJECT_PERMISSION.getCode());
|
statisticsDTO.setErrorCode(NO_PROJECT_PERMISSION.getCode());
|
||||||
return statisticsDTO;
|
return statisticsDTO;
|
||||||
}
|
}
|
||||||
Long toStartTime = request.getToStartTime();
|
Long toStartTime = request.getToStartTime();
|
||||||
Long toEndTime = request.getToEndTime();
|
Long toEndTime = request.getToEndTime();
|
||||||
List<FunctionalCaseStatisticDTO> statisticListByProjectId = extFunctionalCaseMapper.getStatisticListByProjectId(projectId, toStartTime, toEndTime);
|
List<FunctionalCaseStatisticDTO> statisticListByProjectId = extFunctionalCaseMapper.getStatisticListByProjectId(projectId, null, null);
|
||||||
List<FunctionalCaseStatisticDTO> unReviewCaseList = statisticListByProjectId.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getReviewStatus(), FunctionalCaseReviewStatus.UN_REVIEWED.toString())).toList();
|
List<FunctionalCaseStatisticDTO> unReviewCaseList = statisticListByProjectId.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getReviewStatus(), FunctionalCaseReviewStatus.UN_REVIEWED.toString())).toList();
|
||||||
int reviewCount = statisticListByProjectId.size() - unReviewCaseList.size();
|
int reviewCount = statisticListByProjectId.size() - unReviewCaseList.size();
|
||||||
List<NameCountDTO> coverList = getCoverList(statisticListByProjectId.size(), reviewCount, unReviewCaseList.size());
|
List<NameCountDTO> coverList = getCoverList(statisticListByProjectId.size(), reviewCount, unReviewCaseList.size());
|
||||||
|
@ -823,6 +849,77 @@ public class DashboardService {
|
||||||
return statisticsDTO;
|
return statisticsDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public StatisticsDTO projectApiCount(DashboardFrontPageRequest request, String userId) {
|
||||||
|
String projectId = request.getProjectIds().getFirst();
|
||||||
|
StatisticsDTO statisticsDTO = new StatisticsDTO();
|
||||||
|
if (Boolean.FALSE.equals(permissionCheckService.checkModule(projectId, API_TEST_MODULE, userId, PermissionConstants.PROJECT_API_DEFINITION_READ))) {
|
||||||
|
statisticsDTO.setErrorCode(NO_PROJECT_PERMISSION.getCode());
|
||||||
|
return statisticsDTO;
|
||||||
|
}
|
||||||
|
Long toStartTime = request.getToStartTime();
|
||||||
|
Long toEndTime = request.getToEndTime();
|
||||||
|
List<ApiDefinition> createApiList = extApiDefinitionMapper.getCreateApiList(projectId, toStartTime, toEndTime);
|
||||||
|
Map<String, List<ApiDefinition>> protocolMap = createApiList.stream().collect(Collectors.groupingBy(ApiDefinition::getProtocol));
|
||||||
|
List<StatusPercentDTO> statusPercentList = new ArrayList<>();
|
||||||
|
List<ProtocolDTO> protocols = apiTestService.getProtocols(request.getOrganizationId());
|
||||||
|
for (ProtocolDTO protocol : protocols) {
|
||||||
|
String protocolName = protocol.getProtocol();
|
||||||
|
StatusPercentDTO statusPercentDTO = new StatusPercentDTO();
|
||||||
|
statusPercentDTO.setStatus(protocolName);
|
||||||
|
List<ApiDefinition> apiDefinitionList = protocolMap.get(protocolName);
|
||||||
|
if (CollectionUtils.isEmpty(apiDefinitionList)) {
|
||||||
|
statusPercentDTO.setCount(0);
|
||||||
|
statusPercentDTO.setPercentValue("0%");
|
||||||
|
} else {
|
||||||
|
int size = apiDefinitionList.size();
|
||||||
|
statusPercentDTO.setCount(size);
|
||||||
|
BigDecimal divide = BigDecimal.valueOf(size).divide(BigDecimal.valueOf(createApiList.size()), 2, RoundingMode.HALF_UP);
|
||||||
|
statusPercentDTO.setPercentValue(divide.multiply(BigDecimal.valueOf(100)) + "%");
|
||||||
|
}
|
||||||
|
statusPercentList.add(statusPercentDTO);
|
||||||
|
}
|
||||||
|
List<ApiDefinition> createAllApiList = extApiDefinitionMapper.getCreateApiList(projectId, null, null);
|
||||||
|
Map<String, List<ApiDefinition>> statusMap = createAllApiList.stream().collect(Collectors.groupingBy(ApiDefinition::getStatus));
|
||||||
|
List<ApiDefinition> doneList = statusMap.get(ApiDefinitionStatus.DONE.toString());
|
||||||
|
List<ApiDefinition> processList = statusMap.get(ApiDefinitionStatus.PROCESSING.toString());
|
||||||
|
List<ApiDefinition> deprecatedList = statusMap.get(ApiDefinitionStatus.DEPRECATED.toString());
|
||||||
|
List<ApiDefinition> debugList = statusMap.get(ApiDefinitionStatus.DEBUGGING.toString());
|
||||||
|
List<NameCountDTO> nameCountDTOS = new ArrayList<>();
|
||||||
|
NameCountDTO doneDTO = new NameCountDTO();
|
||||||
|
doneDTO.setName(Translator.get("api_definition.status.completed"));
|
||||||
|
NameCountDTO completionRate = new NameCountDTO();
|
||||||
|
completionRate.setName(Translator.get("api_definition.completionRate"));
|
||||||
|
if (CollectionUtils.isEmpty(doneList)) {
|
||||||
|
completionRate.setCount(0);
|
||||||
|
doneDTO.setCount(0);
|
||||||
|
} else {
|
||||||
|
doneDTO.setCount(doneList.size());
|
||||||
|
BigDecimal divide = BigDecimal.valueOf(doneList.size()).divide(BigDecimal.valueOf(createAllApiList.size()), 2, RoundingMode.HALF_UP);
|
||||||
|
completionRate.setCount(getTurnCount(divide));
|
||||||
|
}
|
||||||
|
NameCountDTO processDTO = getNameCountDTO(CollectionUtils.isEmpty(processList) ? 0 : processList.size(), Translator.get("api_definition.status.ongoing"));
|
||||||
|
NameCountDTO deprecateDTO = getNameCountDTO(CollectionUtils.isEmpty(deprecatedList) ? 0 : deprecatedList.size(), Translator.get("api_definition.status.abandoned"));
|
||||||
|
NameCountDTO debugDTO = getNameCountDTO(CollectionUtils.isEmpty(debugList) ? 0 : debugList.size(), Translator.get("api_definition.status.continuous"));
|
||||||
|
nameCountDTOS.add(debugDTO);
|
||||||
|
nameCountDTOS.add(deprecateDTO);
|
||||||
|
nameCountDTOS.add(processDTO);
|
||||||
|
nameCountDTOS.add(doneDTO);
|
||||||
|
nameCountDTOS.add(completionRate);
|
||||||
|
Map<String, List<NameCountDTO>> statusStatisticsMap = new HashMap<>();
|
||||||
|
statusStatisticsMap.put("completionRate", nameCountDTOS);
|
||||||
|
statisticsDTO.setStatusPercentList(statusPercentList);
|
||||||
|
statisticsDTO.setStatusStatisticsMap(statusStatisticsMap);
|
||||||
|
return statisticsDTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private static NameCountDTO getNameCountDTO(int size, String name) {
|
||||||
|
NameCountDTO processDTO = new NameCountDTO();
|
||||||
|
processDTO.setName(name);
|
||||||
|
processDTO.setCount(size);
|
||||||
|
return processDTO;
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private List<StatusPercentDTO> getStatusPercentList(String projectId, Long toStartTime, Long toEndTime) {
|
private List<StatusPercentDTO> getStatusPercentList(String projectId, Long toStartTime, Long toEndTime) {
|
||||||
List<StatusPercentDTO> statusPercentList = new ArrayList<>();
|
List<StatusPercentDTO> statusPercentList = new ArrayList<>();
|
||||||
|
@ -855,8 +952,8 @@ public class DashboardService {
|
||||||
List<NameCountDTO> coverList = new ArrayList<>();
|
List<NameCountDTO> coverList = new ArrayList<>();
|
||||||
NameCountDTO coverRate = new NameCountDTO();
|
NameCountDTO coverRate = new NameCountDTO();
|
||||||
if (totalCount > 0) {
|
if (totalCount > 0) {
|
||||||
BigDecimal divide = BigDecimal.valueOf(coverCount).divide(BigDecimal.valueOf(totalCount), 0, RoundingMode.HALF_UP);
|
BigDecimal divide = BigDecimal.valueOf(coverCount).divide(BigDecimal.valueOf(totalCount), 2, RoundingMode.HALF_UP);
|
||||||
coverRate.setCount(Integer.valueOf(String.valueOf(divide.multiply(BigDecimal.valueOf(100)))));
|
coverRate.setCount(getTurnCount(divide));
|
||||||
}
|
}
|
||||||
coverRate.setName(Translator.get("functional_case.coverRate"));
|
coverRate.setName(Translator.get("functional_case.coverRate"));
|
||||||
coverList.add(coverRate);
|
coverList.add(coverRate);
|
||||||
|
@ -880,10 +977,6 @@ public class DashboardService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pager<List<CaseReviewDTO>> getFunctionalCasePage(DashboardFrontPageRequest request) {
|
public Pager<List<CaseReviewDTO>> getFunctionalCasePage(DashboardFrontPageRequest request) {
|
||||||
String projectId = request.getProjectIds().getFirst();
|
|
||||||
if (Boolean.FALSE.equals(projectService.checkModule(projectId, FUNCTIONAL_CASE_MODULE))) {
|
|
||||||
throw new MSException(NO_PROJECT_PERMISSION);
|
|
||||||
}
|
|
||||||
CaseReviewPageRequest reviewRequest = getCaseReviewPageRequest(request);
|
CaseReviewPageRequest reviewRequest = getCaseReviewPageRequest(request);
|
||||||
Page<Object> page = PageHelper.startPage(reviewRequest.getCurrent(), reviewRequest.getPageSize(),
|
Page<Object> page = PageHelper.startPage(reviewRequest.getCurrent(), reviewRequest.getPageSize(),
|
||||||
com.alibaba.excel.util.StringUtils.isNotBlank(reviewRequest.getSortString()) ? reviewRequest.getSortString() : "pos desc");
|
com.alibaba.excel.util.StringUtils.isNotBlank(reviewRequest.getSortString()) ? reviewRequest.getSortString() : "pos desc");
|
||||||
|
@ -891,7 +984,6 @@ public class DashboardService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static CaseReviewPageRequest getCaseReviewPageRequest(DashboardFrontPageRequest request) {
|
private static CaseReviewPageRequest getCaseReviewPageRequest(DashboardFrontPageRequest request) {
|
||||||
String projectId = request.getProjectIds().getFirst();
|
String projectId = request.getProjectIds().getFirst();
|
||||||
|
@ -933,9 +1025,6 @@ public class DashboardService {
|
||||||
|
|
||||||
public List<ApiDefinitionUpdateDTO> getApiUpdatePage(DashboardFrontPageRequest request) {
|
public List<ApiDefinitionUpdateDTO> getApiUpdatePage(DashboardFrontPageRequest request) {
|
||||||
String projectId = request.getProjectIds().getFirst();
|
String projectId = request.getProjectIds().getFirst();
|
||||||
if (Boolean.FALSE.equals(projectService.checkModule(projectId, API_TEST_MODULE))) {
|
|
||||||
throw new MSException(NO_PROJECT_PERMISSION);
|
|
||||||
}
|
|
||||||
Long toStartTime = request.getToStartTime();
|
Long toStartTime = request.getToStartTime();
|
||||||
Long toEndTime = request.getToEndTime();
|
Long toEndTime = request.getToEndTime();
|
||||||
List<ApiDefinitionUpdateDTO> list = extApiDefinitionMapper.getUpdateApiList(projectId, toStartTime, toEndTime);
|
List<ApiDefinitionUpdateDTO> list = extApiDefinitionMapper.getUpdateApiList(projectId, toStartTime, toEndTime);
|
||||||
|
@ -966,6 +1055,154 @@ public class DashboardService {
|
||||||
item.setScenarioTotal(Objects.requireNonNullElse(count, 0));
|
item.setScenarioTotal(Objects.requireNonNullElse(count, 0));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<SelectOption> getBugHandleUserList(String projectId) {
|
||||||
|
return getHandlerOption(null, projectId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StatisticsDTO projectApiCaseCount(DashboardFrontPageRequest request, String userId) {
|
||||||
|
String projectId = request.getProjectIds().getFirst();
|
||||||
|
StatisticsDTO statisticsDTO = new StatisticsDTO();
|
||||||
|
if (Boolean.FALSE.equals(permissionCheckService.checkModule(projectId, API_TEST_MODULE, userId, PermissionConstants.PROJECT_API_DEFINITION_CASE_READ))) {
|
||||||
|
statisticsDTO.setErrorCode(NO_PROJECT_PERMISSION.getCode());
|
||||||
|
return statisticsDTO;
|
||||||
|
}
|
||||||
|
Long toStartTime = request.getToStartTime();
|
||||||
|
Long toEndTime = request.getToEndTime();
|
||||||
|
Map<String, List<NameCountDTO>> statusStatisticsMap = new HashMap<>();
|
||||||
|
long unDeleteCaseExecCount = extExecTaskItemMapper.getUnDeleteCaseExecCount(projectId, toStartTime, toEndTime, List.of("PLAN_RUN_API_CASE", "API_CASE"));
|
||||||
|
List<ApiTestCase> simpleAllApiCaseList = extApiTestCaseMapper.getSimpleApiCaseList(projectId, null, null);
|
||||||
|
|
||||||
|
int simpleAllApiCaseSize = 0;
|
||||||
|
if (CollectionUtils.isNotEmpty(simpleAllApiCaseList)) {
|
||||||
|
simpleAllApiCaseSize = simpleAllApiCaseList.size();
|
||||||
|
}
|
||||||
|
List<ApiTestCase> unExecList = simpleAllApiCaseList.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getLastReportStatus(), ExecStatus.PENDING.toString())).toList();
|
||||||
|
int unExecSize = CollectionUtils.isNotEmpty(unExecList) ? unExecList.size() : 0;
|
||||||
|
|
||||||
|
List<ApiTestCase> successList = simpleAllApiCaseList.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getLastReportStatus(), ResultStatus.SUCCESS.name())).toList();
|
||||||
|
int successSize = CollectionUtils.isNotEmpty(successList) ? successList.size() : 0;
|
||||||
|
List<ApiTestCase> errorList = simpleAllApiCaseList.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getLastReportStatus(), ResultStatus.ERROR.name())).toList();
|
||||||
|
int errorSize = CollectionUtils.isNotEmpty(errorList) ? errorList.size() : 0;
|
||||||
|
|
||||||
|
List<ApiTestCase> simpleApiCaseList = extApiTestCaseMapper.getSimpleApiCaseList(projectId, toStartTime, toEndTime);
|
||||||
|
List<ApiTestCase> fakeList = simpleApiCaseList.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getLastReportStatus(), ResultStatus.FAKE_ERROR.name())).toList();
|
||||||
|
int simpleApiCaseSize = CollectionUtils.isNotEmpty(simpleApiCaseList) ? simpleApiCaseList.size() : 0;
|
||||||
|
int fakeSize = CollectionUtils.isNotEmpty(fakeList) ? fakeList.size() : 0;
|
||||||
|
|
||||||
|
List<NameCountDTO> execDTOS = getExecDTOS((int) unDeleteCaseExecCount);
|
||||||
|
statusStatisticsMap.put("execCount", execDTOS);
|
||||||
|
List<NameCountDTO> execRateDTOS = getExecRateDTOS(unExecSize, simpleAllApiCaseSize, Translator.get("api_management.apiCaseExecRate"));
|
||||||
|
statusStatisticsMap.put("execRate", execRateDTOS);
|
||||||
|
List<NameCountDTO> passRateDTOS = getPassRateDTOS(successSize, errorSize, simpleAllApiCaseSize, Translator.get("api_management.apiCasePassRate"));
|
||||||
|
statusStatisticsMap.put("passRate", passRateDTOS);
|
||||||
|
List<NameCountDTO> apiCaseDTOS = getApiCaseDTOS(fakeSize, simpleApiCaseSize, Translator.get("api_management.apiCaseCount"));
|
||||||
|
statusStatisticsMap.put("apiCaseCount", apiCaseDTOS);
|
||||||
|
statisticsDTO.setStatusStatisticsMap(statusStatisticsMap);
|
||||||
|
return statisticsDTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private List<NameCountDTO> getApiCaseDTOS(int fakeSize, int simpleApiCaseSize, String name) {
|
||||||
|
List<NameCountDTO> apiCaseDTOS = new ArrayList<>();
|
||||||
|
NameCountDTO apiCaseCountDTO = getNameCountDTO(simpleApiCaseSize, name);
|
||||||
|
apiCaseDTOS.add(apiCaseCountDTO);
|
||||||
|
NameCountDTO fakeCountDTO = getNameCountDTO(fakeSize, Translator.get("api_management.fakeErrorCount"));
|
||||||
|
apiCaseDTOS.add(fakeCountDTO);
|
||||||
|
return apiCaseDTOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private static List<NameCountDTO> getPassRateDTOS(int successSize, int errorSize, int simpleAllApiCaseSize, String name) {
|
||||||
|
List<NameCountDTO> passRateDTOS = new ArrayList<>();
|
||||||
|
NameCountDTO passRateDTO = new NameCountDTO();
|
||||||
|
passRateDTO.setName(name);
|
||||||
|
if (simpleAllApiCaseSize == 0) {
|
||||||
|
passRateDTO.setCount(0);
|
||||||
|
} else {
|
||||||
|
BigDecimal divide = BigDecimal.valueOf(successSize).divide(BigDecimal.valueOf(simpleAllApiCaseSize), 2, RoundingMode.HALF_UP);
|
||||||
|
passRateDTO.setCount(getTurnCount(divide));
|
||||||
|
}
|
||||||
|
passRateDTOS.add(passRateDTO);
|
||||||
|
NameCountDTO passDTO = getNameCountDTO(successSize, Translator.get("api_management.passCount"));
|
||||||
|
passRateDTOS.add(passDTO);
|
||||||
|
|
||||||
|
NameCountDTO unPassDTO = getNameCountDTO(errorSize, Translator.get("api_management.unPassCount"));
|
||||||
|
passRateDTOS.add(unPassDTO);
|
||||||
|
return passRateDTOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private static List<NameCountDTO> getExecRateDTOS(int unExecSize, int simpleAllApiCaseSize, String name) {
|
||||||
|
List<NameCountDTO> execRateDTOS = new ArrayList<>();
|
||||||
|
|
||||||
|
NameCountDTO execRateDTO = new NameCountDTO();
|
||||||
|
execRateDTO.setName(name);
|
||||||
|
if (simpleAllApiCaseSize == 0) {
|
||||||
|
execRateDTO.setCount(0);
|
||||||
|
} else {
|
||||||
|
BigDecimal divide = BigDecimal.valueOf(simpleAllApiCaseSize - unExecSize).divide(BigDecimal.valueOf(simpleAllApiCaseSize), 2, RoundingMode.HALF_UP);
|
||||||
|
execRateDTO.setCount(getTurnCount(divide));
|
||||||
|
}
|
||||||
|
execRateDTOS.add(execRateDTO);
|
||||||
|
NameCountDTO execDTO = getNameCountDTO(simpleAllApiCaseSize - unExecSize, Translator.get("api_management.execCount"));
|
||||||
|
execRateDTOS.add(execDTO);
|
||||||
|
NameCountDTO unExecDTO = getNameCountDTO(unExecSize, Translator.get("api_management.unExecCount"));
|
||||||
|
execRateDTOS.add(unExecDTO);
|
||||||
|
return execRateDTOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private static List<NameCountDTO> getExecDTOS(int unDeleteCaseExecCount) {
|
||||||
|
List<NameCountDTO> execDTOS = new ArrayList<>();
|
||||||
|
NameCountDTO execCountDTO = new NameCountDTO();
|
||||||
|
execCountDTO.setName(Translator.get("api_management.execTime"));
|
||||||
|
execCountDTO.setCount(unDeleteCaseExecCount);
|
||||||
|
execDTOS.add(execCountDTO);
|
||||||
|
return execDTOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StatisticsDTO projectApiScenarioCount(DashboardFrontPageRequest request, String userId) {
|
||||||
|
String projectId = request.getProjectIds().getFirst();
|
||||||
|
StatisticsDTO statisticsDTO = new StatisticsDTO();
|
||||||
|
if (Boolean.FALSE.equals(permissionCheckService.checkModule(projectId, API_TEST_MODULE, userId, PermissionConstants.PROJECT_API_SCENARIO_READ))) {
|
||||||
|
statisticsDTO.setErrorCode(NO_PROJECT_PERMISSION.getCode());
|
||||||
|
return statisticsDTO;
|
||||||
|
}
|
||||||
|
Long toStartTime = request.getToStartTime();
|
||||||
|
Long toEndTime = request.getToEndTime();
|
||||||
|
Map<String, List<NameCountDTO>> statusStatisticsMap = new HashMap<>();
|
||||||
|
long unDeleteCaseExecCount = extExecTaskItemMapper.getUnDeleteScenarioExecCount(projectId, toStartTime, toEndTime, List.of("PLAN_RUN_API_SCENARIO", "API_SCENARIO"));
|
||||||
|
List<ApiScenario> simpleAllApiScenarioList = extApiScenarioMapper.getSimpleApiScenarioList(projectId, null, null);
|
||||||
|
|
||||||
|
int simpleAllApiScenarioSize = 0;
|
||||||
|
if (CollectionUtils.isNotEmpty(simpleAllApiScenarioList)) {
|
||||||
|
simpleAllApiScenarioSize = simpleAllApiScenarioList.size();
|
||||||
|
}
|
||||||
|
List<ApiScenario> unExecList = simpleAllApiScenarioList.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getLastReportStatus(), ExecStatus.PENDING.toString())).toList();
|
||||||
|
int unExecSize = CollectionUtils.isNotEmpty(unExecList) ? unExecList.size() : 0;
|
||||||
|
|
||||||
|
List<ApiScenario> successList = simpleAllApiScenarioList.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getLastReportStatus(), ResultStatus.SUCCESS.name())).toList();
|
||||||
|
int successSize = CollectionUtils.isNotEmpty(successList) ? successList.size() : 0;
|
||||||
|
List<ApiScenario> errorList = simpleAllApiScenarioList.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getLastReportStatus(), ResultStatus.ERROR.name())).toList();
|
||||||
|
int errorSize = CollectionUtils.isNotEmpty(errorList) ? errorList.size() : 0;
|
||||||
|
|
||||||
|
List<ApiScenario> simpleApiScenarioList = extApiScenarioMapper.getSimpleApiScenarioList(projectId, toStartTime, toEndTime);
|
||||||
|
List<ApiScenario> fakeList = simpleApiScenarioList.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getLastReportStatus(), ResultStatus.FAKE_ERROR.name())).toList();
|
||||||
|
int simpleApiCaseSize = CollectionUtils.isNotEmpty(simpleApiScenarioList) ? simpleApiScenarioList.size() : 0;
|
||||||
|
int fakeSize = CollectionUtils.isNotEmpty(fakeList) ? fakeList.size() : 0;
|
||||||
|
|
||||||
|
List<NameCountDTO> execDTOS = getExecDTOS((int) unDeleteCaseExecCount);
|
||||||
|
statusStatisticsMap.put("execCount", execDTOS);
|
||||||
|
List<NameCountDTO> execRateDTOS = getExecRateDTOS(unExecSize, simpleAllApiScenarioSize, Translator.get("api_management.scenarioExecRate"));
|
||||||
|
statusStatisticsMap.put("execRate", execRateDTOS);
|
||||||
|
List<NameCountDTO> passRateDTOS = getPassRateDTOS(successSize, errorSize, simpleAllApiScenarioSize, Translator.get("api_management.scenarioPassRate"));
|
||||||
|
statusStatisticsMap.put("passRate", passRateDTOS);
|
||||||
|
List<NameCountDTO> apiCaseDTOS = getApiCaseDTOS(fakeSize, simpleApiCaseSize, Translator.get("api_management.apiScenarioCount")) ;
|
||||||
|
statusStatisticsMap.put("apiScenarioCount", apiCaseDTOS);
|
||||||
|
statisticsDTO.setStatusStatisticsMap(statusStatisticsMap);
|
||||||
|
return statisticsDTO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -68,10 +68,13 @@ public class DashboardFrontPageControllerTests extends BaseTest {
|
||||||
private static final String ASSOCIATE_CASE_COUNT = "/dashboard/associate_case_count";
|
private static final String ASSOCIATE_CASE_COUNT = "/dashboard/associate_case_count";
|
||||||
private static final String REVIEW_CASE_COUNT = "/dashboard/review_case_count";
|
private static final String REVIEW_CASE_COUNT = "/dashboard/review_case_count";
|
||||||
private static final String BUG_HANDLE_USER = "/dashboard/bug_handle_user";
|
private static final String BUG_HANDLE_USER = "/dashboard/bug_handle_user";
|
||||||
|
private static final String API_COUNT = "/dashboard/api_count";
|
||||||
|
private static final String API_CASE_COUNT = "/dashboard/api_case_count";
|
||||||
|
private static final String SCENARIO_COUNT = "/dashboard/scenario_count";
|
||||||
|
|
||||||
private static final String REVIEWING_BY_ME = "/dashboard/reviewing_by_me";
|
private static final String REVIEWING_BY_ME = "/dashboard/reviewing_by_me";
|
||||||
private static final String API_CHANGE = "/dashboard/api_change";
|
private static final String API_CHANGE = "/dashboard/api_change";
|
||||||
|
private static final String BUG_HANDLE_USER_LIST = "/dashboard/bug_handle_user/list/";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(1)
|
@Order(1)
|
||||||
|
@ -142,7 +145,7 @@ public class DashboardFrontPageControllerTests extends BaseTest {
|
||||||
projectMapper.updateByPrimaryKeySelective(project);
|
projectMapper.updateByPrimaryKeySelective(project);
|
||||||
OverViewCountDTO gyq4 = dashboardService.projectViewCount(dashboardFrontPageRequest, "default-dashboard-member-user-gyq");
|
OverViewCountDTO gyq4 = dashboardService.projectViewCount(dashboardFrontPageRequest, "default-dashboard-member-user-gyq");
|
||||||
Assertions.assertTrue(gyq4.getXAxis().isEmpty());
|
Assertions.assertTrue(gyq4.getXAxis().isEmpty());
|
||||||
OverViewCountDTO gyq5 = dashboardService.projectBugHandleUser(dashboardFrontPageRequest);
|
OverViewCountDTO gyq5 = dashboardService.projectBugHandleUser(dashboardFrontPageRequest, "admin");
|
||||||
Assertions.assertTrue(gyq5.getXAxis().isEmpty());
|
Assertions.assertTrue(gyq5.getXAxis().isEmpty());
|
||||||
project.setModuleSetting("[\"apiTest\",\"testPlan\",\"caseManagement\",\"bugManagement\"]");
|
project.setModuleSetting("[\"apiTest\",\"testPlan\",\"caseManagement\",\"bugManagement\"]");
|
||||||
project.setId(DEFAULT_PROJECT_ID);
|
project.setId(DEFAULT_PROJECT_ID);
|
||||||
|
@ -266,6 +269,21 @@ public class DashboardFrontPageControllerTests extends BaseTest {
|
||||||
ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||||
StatisticsDTO moduleCount = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), StatisticsDTO.class);
|
StatisticsDTO moduleCount = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), StatisticsDTO.class);
|
||||||
Assertions.assertNotNull(moduleCount);
|
Assertions.assertNotNull(moduleCount);
|
||||||
|
MvcResult apiMvcResult = this.requestPostWithOkAndReturn(API_COUNT, dashboardFrontPageRequest);
|
||||||
|
String apiContentAsString = apiMvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
|
ResultHolder apiResultHolder = JSON.parseObject(apiContentAsString, ResultHolder.class);
|
||||||
|
StatisticsDTO apiCount = JSON.parseObject(JSON.toJSONString(apiResultHolder.getData()), StatisticsDTO.class);
|
||||||
|
Assertions.assertNotNull(apiCount);
|
||||||
|
MvcResult apiCaseMvcResult = this.requestPostWithOkAndReturn(API_CASE_COUNT, dashboardFrontPageRequest);
|
||||||
|
String apiCaseContentAsString = apiCaseMvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
|
ResultHolder apiCaseResultHolder = JSON.parseObject(apiCaseContentAsString, ResultHolder.class);
|
||||||
|
StatisticsDTO apiCaseCount = JSON.parseObject(JSON.toJSONString(apiCaseResultHolder.getData()), StatisticsDTO.class);
|
||||||
|
Assertions.assertNotNull(apiCaseCount);
|
||||||
|
MvcResult scenarioMvcResult = this.requestPostWithOkAndReturn(SCENARIO_COUNT, dashboardFrontPageRequest);
|
||||||
|
String scenarioContentAsString = scenarioMvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
|
ResultHolder scenarioResultHolder = JSON.parseObject(scenarioContentAsString, ResultHolder.class);
|
||||||
|
StatisticsDTO scenarioCount = JSON.parseObject(JSON.toJSONString(scenarioResultHolder.getData()), StatisticsDTO.class);
|
||||||
|
Assertions.assertNotNull(scenarioCount);
|
||||||
MvcResult associateMvcResult = this.requestPostWithOkAndReturn(ASSOCIATE_CASE_COUNT, dashboardFrontPageRequest);
|
MvcResult associateMvcResult = this.requestPostWithOkAndReturn(ASSOCIATE_CASE_COUNT, dashboardFrontPageRequest);
|
||||||
String associateContent = associateMvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
String associateContent = associateMvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
ResultHolder associateResultHolder = JSON.parseObject(associateContent, ResultHolder.class);
|
ResultHolder associateResultHolder = JSON.parseObject(associateContent, ResultHolder.class);
|
||||||
|
@ -285,6 +303,22 @@ public class DashboardFrontPageControllerTests extends BaseTest {
|
||||||
resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||||
moduleCount = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), StatisticsDTO.class);
|
moduleCount = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), StatisticsDTO.class);
|
||||||
Assertions.assertNotNull(moduleCount);
|
Assertions.assertNotNull(moduleCount);
|
||||||
|
apiMvcResult = this.requestPostWithOkAndReturn(API_COUNT, dashboardFrontPageRequest);
|
||||||
|
apiContentAsString = apiMvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
|
apiResultHolder = JSON.parseObject(apiContentAsString, ResultHolder.class);
|
||||||
|
apiCount = JSON.parseObject(JSON.toJSONString(apiResultHolder.getData()), StatisticsDTO.class);
|
||||||
|
Assertions.assertNotNull(apiCount);
|
||||||
|
apiCaseMvcResult = this.requestPostWithOkAndReturn(API_CASE_COUNT, dashboardFrontPageRequest);
|
||||||
|
apiCaseContentAsString = apiCaseMvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
|
apiCaseResultHolder = JSON.parseObject(apiCaseContentAsString, ResultHolder.class);
|
||||||
|
apiCaseCount = JSON.parseObject(JSON.toJSONString(apiCaseResultHolder.getData()), StatisticsDTO.class);
|
||||||
|
Assertions.assertNotNull(apiCaseCount);
|
||||||
|
scenarioMvcResult = this.requestPostWithOkAndReturn(SCENARIO_COUNT, dashboardFrontPageRequest);
|
||||||
|
scenarioContentAsString = scenarioMvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
|
scenarioResultHolder = JSON.parseObject(scenarioContentAsString, ResultHolder.class);
|
||||||
|
scenarioCount = JSON.parseObject(JSON.toJSONString(scenarioResultHolder.getData()), StatisticsDTO.class);
|
||||||
|
Assertions.assertNotNull(scenarioCount);
|
||||||
|
|
||||||
associateMvcResult = this.requestPostWithOkAndReturn(ASSOCIATE_CASE_COUNT, dashboardFrontPageRequest);
|
associateMvcResult = this.requestPostWithOkAndReturn(ASSOCIATE_CASE_COUNT, dashboardFrontPageRequest);
|
||||||
associateContent = associateMvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
associateContent = associateMvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
associateResultHolder = JSON.parseObject(associateContent, ResultHolder.class);
|
associateResultHolder = JSON.parseObject(associateContent, ResultHolder.class);
|
||||||
|
@ -306,6 +340,22 @@ public class DashboardFrontPageControllerTests extends BaseTest {
|
||||||
resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||||
moduleCount = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), StatisticsDTO.class);
|
moduleCount = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), StatisticsDTO.class);
|
||||||
Assertions.assertNotNull(moduleCount);
|
Assertions.assertNotNull(moduleCount);
|
||||||
|
apiMvcResult = this.requestPostWithOkAndReturn(API_COUNT, dashboardFrontPageRequest);
|
||||||
|
apiContentAsString = apiMvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
|
apiResultHolder = JSON.parseObject(apiContentAsString, ResultHolder.class);
|
||||||
|
apiCount = JSON.parseObject(JSON.toJSONString(apiResultHolder.getData()), StatisticsDTO.class);
|
||||||
|
Assertions.assertNotNull(apiCount);
|
||||||
|
apiCaseMvcResult = this.requestPostWithOkAndReturn(API_CASE_COUNT, dashboardFrontPageRequest);
|
||||||
|
apiCaseContentAsString = apiCaseMvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
|
apiCaseResultHolder = JSON.parseObject(apiCaseContentAsString, ResultHolder.class);
|
||||||
|
apiCaseCount = JSON.parseObject(JSON.toJSONString(apiCaseResultHolder.getData()), StatisticsDTO.class);
|
||||||
|
Assertions.assertNotNull(apiCaseCount);
|
||||||
|
scenarioMvcResult = this.requestPostWithOkAndReturn(SCENARIO_COUNT, dashboardFrontPageRequest);
|
||||||
|
scenarioContentAsString = scenarioMvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
|
scenarioResultHolder = JSON.parseObject(scenarioContentAsString, ResultHolder.class);
|
||||||
|
scenarioCount = JSON.parseObject(JSON.toJSONString(scenarioResultHolder.getData()), StatisticsDTO.class);
|
||||||
|
Assertions.assertNotNull(scenarioCount);
|
||||||
|
|
||||||
associateMvcResult = this.requestPostWithOkAndReturn(ASSOCIATE_CASE_COUNT, dashboardFrontPageRequest);
|
associateMvcResult = this.requestPostWithOkAndReturn(ASSOCIATE_CASE_COUNT, dashboardFrontPageRequest);
|
||||||
associateContent = associateMvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
associateContent = associateMvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
associateResultHolder = JSON.parseObject(associateContent, ResultHolder.class);
|
associateResultHolder = JSON.parseObject(associateContent, ResultHolder.class);
|
||||||
|
@ -340,7 +390,6 @@ public class DashboardFrontPageControllerTests extends BaseTest {
|
||||||
Pager.class);
|
Pager.class);
|
||||||
List<ApiDefinitionUpdateDTO> apiList = apiTableData.getList();
|
List<ApiDefinitionUpdateDTO> apiList = apiTableData.getList();
|
||||||
Assertions.assertNotNull(apiList);
|
Assertions.assertNotNull(apiList);
|
||||||
System.out.println(JSON.toJSONString(apiList));
|
|
||||||
dashboardFrontPageRequest.setStartTime(1697971947000L);
|
dashboardFrontPageRequest.setStartTime(1697971947000L);
|
||||||
dashboardFrontPageRequest.setEndTime(1700650347000L);
|
dashboardFrontPageRequest.setEndTime(1700650347000L);
|
||||||
mvcResult = this.requestPostWithOkAndReturn(REVIEWING_BY_ME, dashboardFrontPageRequest);
|
mvcResult = this.requestPostWithOkAndReturn(REVIEWING_BY_ME, dashboardFrontPageRequest);
|
||||||
|
@ -354,7 +403,6 @@ public class DashboardFrontPageControllerTests extends BaseTest {
|
||||||
JSON.parseObject(apiMvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData()),
|
JSON.parseObject(apiMvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData()),
|
||||||
Pager.class);
|
Pager.class);
|
||||||
apiList = apiTableData.getList();
|
apiList = apiTableData.getList();
|
||||||
System.out.println(JSON.toJSONString(apiList));
|
|
||||||
Assertions.assertNotNull(apiList);
|
Assertions.assertNotNull(apiList);
|
||||||
Project project = new Project();
|
Project project = new Project();
|
||||||
project.setModuleSetting("[]");
|
project.setModuleSetting("[]");
|
||||||
|
@ -367,5 +415,13 @@ public class DashboardFrontPageControllerTests extends BaseTest {
|
||||||
projectMapper.updateByPrimaryKeySelective(project);
|
projectMapper.updateByPrimaryKeySelective(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(5)
|
||||||
|
public void testUserList() throws Exception {
|
||||||
|
MvcResult mvcResult = this.requestGetWithOkAndReturn(BUG_HANDLE_USER_LIST + DEFAULT_PROJECT_ID);
|
||||||
|
String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
|
ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
||||||
|
List<SelectOption> list = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), SelectOption.class);
|
||||||
|
Assertions.assertNotNull(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,13 +71,41 @@ INSERT INTO bug (id, num, title, handle_users, handle_user, create_user, create_
|
||||||
VALUES ('dashboard_bug3', 100003, 'oasis3', 'admin', 'admin', 'admin', 1716185577387, 'admin', UNIX_TIMESTAMP() * 1000, 'admin', UNIX_TIMESTAMP() * 1000, '100001100001', 'bug-template-id', 'Local', 'open', '["default-tag"]', null, 0, 5000);
|
VALUES ('dashboard_bug3', 100003, 'oasis3', 'admin', 'admin', 'admin', 1716185577387, 'admin', UNIX_TIMESTAMP() * 1000, 'admin', UNIX_TIMESTAMP() * 1000, '100001100001', 'bug-template-id', 'Local', 'open', '["default-tag"]', null, 0, 5000);
|
||||||
|
|
||||||
INSERT INTO api_definition(id, name, protocol, method, path, status, num, tags, pos, project_id, module_id, latest, version_id, ref_id, description, create_time, create_user, update_time, update_user, delete_user, delete_time, deleted)
|
INSERT INTO api_definition(id, name, protocol, method, path, status, num, tags, pos, project_id, module_id, latest, version_id, ref_id, description, create_time, create_user, update_time, update_user, delete_user, delete_time, deleted)
|
||||||
VALUES ('dashboard_api_definition_id_1', 'gyq_associate_api_definition_id_1', 'HTTP', 'POST','api/test','test-api-status', 1000001, null, 1, '100001100001' , 'gyq_associate_test_module', true, 'v1.10','gyq_associate_api_definition_id_1', null, 1697971947000,'admin', 1697971947000,'admin', null,null,false);
|
VALUES ('dashboard_api_definition_id_1', 'gyq_associate_api_definition_id_1', 'HTTP', 'POST','api/test','DONE', 1000001, null, 1, '100001100001' , 'gyq_associate_test_module', true, 'v1.10','gyq_associate_api_definition_id_1', null, 1697971947000,'admin', 1697971947000,'admin', null,null,false);
|
||||||
|
|
||||||
INSERT INTO api_definition(id, name, protocol, method, path, status, num, tags, pos, project_id, module_id, latest, version_id, ref_id, description, create_time, create_user, update_time, update_user, delete_user, delete_time, deleted)
|
INSERT INTO api_definition(id, name, protocol, method, path, status, num, tags, pos, project_id, module_id, latest, version_id, ref_id, description, create_time, create_user, update_time, update_user, delete_user, delete_time, deleted)
|
||||||
VALUES ('dashboard_api_definition_id_2', 'gyq_associate_api_definition_id_2', 'HTTP', 'POST','api/test','test-api-status', 1000001, null, 1, '100001100001' , 'gyq_associate_test_module', true, 'v1.10','gyq_associate_api_definition_id_1', null, 1697971947000,'admin', 1697971947000,'admin', null,null,false);
|
VALUES ('dashboard_api_definition_id_2', 'gyq_associate_api_definition_id_2', 'TCP', 'POST','api/test','PROCESSING', 1000001, null, 1, '100001100001' , 'gyq_associate_test_module', true, 'v1.10','gyq_associate_api_definition_id_1', null, 1697971947000,'admin', 1697971947000,'admin', null,null,false);
|
||||||
|
|
||||||
|
INSERT INTO api_definition(id, name, protocol, method, path, status, num, tags, pos, project_id, module_id, latest, version_id, ref_id, description, create_time, create_user, update_time, update_user, delete_user, delete_time, deleted)
|
||||||
|
VALUES ('dashboard_api_definition_id_3', 'gyq_associate_api_definition_id_2', 'DUBBO', 'POST','api/test','DEPRECATED', 1000001, null, 1, '100001100001' , 'gyq_associate_test_module', true, 'v1.10','gyq_associate_api_definition_id_1', null, 1697971947000,'admin', 1697971947000,'admin', null,null,false);
|
||||||
|
|
||||||
|
INSERT INTO api_definition(id, name, protocol, method, path, status, num, tags, pos, project_id, module_id, latest, version_id, ref_id, description, create_time, create_user, update_time, update_user, delete_user, delete_time, deleted)
|
||||||
|
VALUES ('dashboard_api_definition_id_4', 'gyq_associate_api_definition_id_2', 'HTTP', 'POST','api/test','DEBUGGING', 1000001, null, 1, '100001100001' , 'gyq_associate_test_module', true, 'v1.10','gyq_associate_api_definition_id_1', null, 1697971947000,'admin', 1697971947000,'admin', null,null,false);
|
||||||
|
|
||||||
INSERT INTO api_test_case(id, name, priority, num, tags, status, last_report_status, last_report_id, pos, project_id, api_definition_id, version_id, environment_id, create_time, create_user, update_time, update_user, delete_time, delete_user, deleted) VALUES
|
INSERT INTO api_test_case(id, name, priority, num, tags, status, last_report_status, last_report_id, pos, project_id, api_definition_id, version_id, environment_id, create_time, create_user, update_time, update_user, delete_time, delete_user, deleted) VALUES
|
||||||
('dashboard_ac_1', 'oasis_ac', 'P0', 1001, null, 'Underway', 'PENDING', null, 100, '100001100001', 'dashboard_api_definition_id_1', 'oasis_ac_version_id', 'oasis_ac_env_id', 1698058347559, 'admin', 1698058347559, 'admin', null, null, false);
|
('dashboard_ac_1', 'oasis_ac', 'P0', 1001, null, 'Underway', 'PENDING', null, 100, '100001100001', 'dashboard_api_definition_id_1', 'oasis_ac_version_id', 'oasis_ac_env_id', 1697971947000, 'admin', 1698058347559, 'admin', null, null, false);
|
||||||
|
|
||||||
|
INSERT INTO api_test_case(id, name, priority, num, tags, status, last_report_status, last_report_id, pos, project_id, api_definition_id, version_id, environment_id, create_time, create_user, update_time, update_user, delete_time, delete_user, deleted) VALUES
|
||||||
|
('dashboard_ac_2', 'oasis_ac', 'P0', 1001, null, 'Underway', 'SUCCESS', null, 100, '100001100001', 'dashboard_api_definition_id_1', 'oasis_ac_version_id', 'oasis_ac_env_id', 1697971947000, 'admin', 1698058347559, 'admin', null, null, false);
|
||||||
|
|
||||||
|
INSERT INTO api_test_case(id, name, priority, num, tags, status, last_report_status, last_report_id, pos, project_id, api_definition_id, version_id, environment_id, create_time, create_user, update_time, update_user, delete_time, delete_user, deleted) VALUES
|
||||||
|
('dashboard_ac_3', 'oasis_ac', 'P0', 1001, null, 'Underway', 'FAKE_ERROR', null, 100, '100001100001', 'dashboard_api_definition_id_1', 'oasis_ac_version_id', 'oasis_ac_env_id', 1697971947000, 'admin', 1698058347559, 'admin', null, null, false);
|
||||||
|
|
||||||
|
INSERT INTO api_test_case(id, name, priority, num, tags, status, last_report_status, last_report_id, pos, project_id, api_definition_id, version_id, environment_id, create_time, create_user, update_time, update_user, delete_time, delete_user, deleted) VALUES
|
||||||
|
('dashboard_ac_4', 'oasis_ac', 'P0', 1001, null, 'Underway', 'ERROR', null, 100, '100001100001', 'dashboard_api_definition_id_1', 'oasis_ac_version_id', 'oasis_ac_env_id', 1697971947000, 'admin', 1698058347559, 'admin', null, null, false);
|
||||||
|
|
||||||
|
INSERT INTO api_scenario(id, name, priority, status, last_report_status, last_report_id, num, pos, version_id, ref_id, project_id, module_id, description, tags, create_user, create_time, delete_time, delete_user, update_user, update_time)
|
||||||
|
VALUES ('dashboard_scenario_one', 'api_scenario', 'p1', 'test-api-status', 'PENDING', null,1000001, 1,'v1.10', 'aspect_gyq_api_scenario_one','100001100001', 'test_module', null,null,'admin', 1697971947000,null,null,'admin', 1697971947000);
|
||||||
|
|
||||||
|
INSERT INTO api_scenario(id, name, priority, status, last_report_status, last_report_id, num, pos, version_id, ref_id, project_id, module_id, description, tags, create_user, create_time, delete_time, delete_user, update_user, update_time)
|
||||||
|
VALUES ('dashboard_scenario_two', 'api_scenario', 'p1', 'test-api-status', 'SUCCESS', null,1000001, 1,'v1.10', 'aspect_gyq_api_scenario_one','100001100001', 'test_module', null,null,'admin', 1697971947000,null,null,'admin', 1697971947000);
|
||||||
|
|
||||||
|
INSERT INTO api_scenario(id, name, priority, status, last_report_status, last_report_id, num, pos, version_id, ref_id, project_id, module_id, description, tags, create_user, create_time, delete_time, delete_user, update_user, update_time)
|
||||||
|
VALUES ('dashboard_scenario_three', 'api_scenario', 'p1', 'test-api-status', 'FAKE_ERROR', null,1000001, 1,'v1.10', 'aspect_gyq_api_scenario_one','100001100001', 'test_module', null,null,'admin', 1697971947000,null,null,'admin', 1697971947000);
|
||||||
|
|
||||||
|
INSERT INTO api_scenario(id, name, priority, status, last_report_status, last_report_id, num, pos, version_id, ref_id, project_id, module_id, description, tags, create_user, create_time, delete_time, delete_user, update_user, update_time)
|
||||||
|
VALUES ('dashboard_scenario_four', 'api_scenario', 'p1', 'test-api-status', 'ERROR', null,1000001, 1,'v1.10', 'aspect_gyq_api_scenario_one','100001100001', 'test_module', null,null,'admin', 1697971947000,null,null,'admin', 1697971947000);
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO api_scenario_step(id, scenario_id, name, sort, enable, resource_id, resource_num, step_type, project_id, parent_id, version_id, ref_type, origin_project_id, config)
|
INSERT INTO api_scenario_step(id, scenario_id, name, sort, enable, resource_id, resource_num, step_type, project_id, parent_id, version_id, ref_type, origin_project_id, config)
|
||||||
VALUE ('dashboard_act_1', 'dashboard_sc_1', 'dd', 1, true, 'dashboard_api_definition_id_1', '1000', 'API', '100001100001', null, 'oasis_ac_version_id', 'REF', '100001100001', null)
|
VALUE ('dashboard_act_1', 'dashboard_sc_1', 'dd', 1, true, 'dashboard_api_definition_id_1', '1000', 'API', '100001100001', null, 'oasis_ac_version_id', 'REF', '100001100001', null)
|
|
@ -1,8 +1,11 @@
|
||||||
package io.metersphere.project.service;
|
package io.metersphere.project.service;
|
||||||
|
|
||||||
|
|
||||||
|
import io.metersphere.project.domain.Project;
|
||||||
|
import io.metersphere.project.mapper.ProjectMapper;
|
||||||
import io.metersphere.sdk.constants.InternalUserRole;
|
import io.metersphere.sdk.constants.InternalUserRole;
|
||||||
import io.metersphere.sdk.constants.UserRoleType;
|
import io.metersphere.sdk.constants.UserRoleType;
|
||||||
|
import io.metersphere.sdk.util.JSON;
|
||||||
import io.metersphere.system.domain.UserRole;
|
import io.metersphere.system.domain.UserRole;
|
||||||
import io.metersphere.system.domain.UserRolePermission;
|
import io.metersphere.system.domain.UserRolePermission;
|
||||||
import io.metersphere.system.dto.user.UserDTO;
|
import io.metersphere.system.dto.user.UserDTO;
|
||||||
|
@ -22,6 +25,14 @@ public class PermissionCheckService {
|
||||||
@Resource
|
@Resource
|
||||||
private UserLoginService userLoginService;
|
private UserLoginService userLoginService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ProjectMapper projectMapper;
|
||||||
|
|
||||||
|
public static final String API_TEST_MODULE = "apiTest";
|
||||||
|
public static final String TEST_PLAN_MODULE = "testPlan";
|
||||||
|
public static final String FUNCTIONAL_CASE_MODULE = "caseManagement";
|
||||||
|
public static final String BUG_MODULE = "bugManagement";
|
||||||
|
|
||||||
public boolean userHasProjectPermission(String userId, String projectId, String permission) {
|
public boolean userHasProjectPermission(String userId, String projectId, String permission) {
|
||||||
UserDTO user = getUserDTO(userId);
|
UserDTO user = getUserDTO(userId);
|
||||||
if (user == null) return false;
|
if (user == null) return false;
|
||||||
|
@ -30,6 +41,17 @@ public class PermissionCheckService {
|
||||||
return checkHasPermission(projectId, permission, user);
|
return checkHasPermission(projectId, permission, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean checkModule(String projectId, String module, String userId, String permission) {
|
||||||
|
Project project = projectMapper.selectByPrimaryKey(projectId);
|
||||||
|
boolean hasPermission = userHasProjectPermission(userId, projectId, permission);
|
||||||
|
if (! hasPermission) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
List<String> moduleIds = JSON.parseArray(project.getModuleSetting(), String.class);
|
||||||
|
return moduleIds.contains(module);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean checkHasPermission(String projectId, String permission, UserDTO user) {
|
private static boolean checkHasPermission(String projectId, String permission, UserDTO user) {
|
||||||
Map<String, List<UserRolePermission>> userRolePermissions = new HashMap<>();
|
Map<String, List<UserRolePermission>> userRolePermissions = new HashMap<>();
|
||||||
Map<String, UserRole> role = new HashMap<>();
|
Map<String, UserRole> role = new HashMap<>();
|
||||||
|
|
|
@ -12,7 +12,6 @@ import io.metersphere.sdk.constants.InternalUserRole;
|
||||||
import io.metersphere.sdk.exception.MSException;
|
import io.metersphere.sdk.exception.MSException;
|
||||||
import io.metersphere.sdk.util.BeanUtils;
|
import io.metersphere.sdk.util.BeanUtils;
|
||||||
import io.metersphere.sdk.util.CommonBeanFactory;
|
import io.metersphere.sdk.util.CommonBeanFactory;
|
||||||
import io.metersphere.sdk.util.JSON;
|
|
||||||
import io.metersphere.sdk.util.Translator;
|
import io.metersphere.sdk.util.Translator;
|
||||||
import io.metersphere.system.domain.TestResourcePool;
|
import io.metersphere.system.domain.TestResourcePool;
|
||||||
import io.metersphere.system.domain.TestResourcePoolBlob;
|
import io.metersphere.system.domain.TestResourcePoolBlob;
|
||||||
|
@ -330,10 +329,5 @@ public class ProjectService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean checkModule(String projectId, String module) {
|
|
||||||
Project project = projectMapper.selectByPrimaryKey(projectId);
|
|
||||||
List<String> moduleIds = JSON.parseArray(project.getModuleSetting(), String.class);
|
|
||||||
return moduleIds.contains(module);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,9 +53,15 @@ public interface ExtExecTaskItemMapper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询批量执行任务报告
|
* 查询批量执行任务报告
|
||||||
* @param request 请求参数
|
*
|
||||||
|
* @param request 请求参数
|
||||||
* @param tableName 表名
|
* @param tableName 表名
|
||||||
* @return 执行任务报告集合
|
* @return 执行任务报告集合
|
||||||
*/
|
*/
|
||||||
List<BatchExecTaskReportDTO> list(@Param("request") BatchExecTaskPageRequest request, @Param("tableName") String tableName);
|
List<BatchExecTaskReportDTO> list(@Param("request") BatchExecTaskPageRequest request, @Param("tableName") String tableName);
|
||||||
|
|
||||||
|
long getUnDeleteCaseExecCount(@Param("projectId") String projectId, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("resourceTypes") List<String> resourceTypes);
|
||||||
|
|
||||||
|
long getUnDeleteScenarioExecCount(@Param("projectId") String projectId, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("resourceTypes") List<String> resourceTypes);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,4 +291,34 @@
|
||||||
where eti.task_id = #{request.taskId}
|
where eti.task_id = #{request.taskId}
|
||||||
<include refid="queryBatchWhereCondition"/>
|
<include refid="queryBatchWhereCondition"/>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getUnDeleteCaseExecCount" resultType="java.lang.Long">
|
||||||
|
select Count(exec_task_item.id) from exec_task_item
|
||||||
|
left join api_test_case on api_test_case.id = exec_task_item.resource_id
|
||||||
|
where api_test_case.deleted = false
|
||||||
|
and exec_task_item.project_id = #{projectId}
|
||||||
|
<if test="startTime != null and endTime != null">
|
||||||
|
and api_test_case.create_time between #{startTime} and #{endTime}
|
||||||
|
</if>
|
||||||
|
<if test="resourceTypes != null and resourceTypes.size() > 0">
|
||||||
|
and exec_task_item.resource_type in
|
||||||
|
<foreach collection="resourceTypes" item="resourceType" open="(" separator="," close=")">
|
||||||
|
#{resourceType}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
<select id="getUnDeleteScenarioExecCount" resultType="java.lang.Long">
|
||||||
|
select Count(exec_task_item.id) from exec_task_item
|
||||||
|
left join api_scenario on api_scenario.id = exec_task_item.resource_id
|
||||||
|
where api_scenario.deleted = false
|
||||||
|
and exec_task_item.project_id = #{projectId}
|
||||||
|
<if test="startTime != null and endTime != null">
|
||||||
|
and api_scenario.create_time between #{startTime} and #{endTime}
|
||||||
|
</if>
|
||||||
|
<if test="resourceTypes != null and resourceTypes.size() > 0">
|
||||||
|
and exec_task_item.resource_type in
|
||||||
|
<foreach collection="resourceTypes" item="resourceType" open="(" separator="," close=")">
|
||||||
|
#{resourceType}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -73,9 +73,9 @@ public interface ExtTestPlanMapper {
|
||||||
|
|
||||||
List<String> selectIdByProjectIdAndWithoutList(@Param("projectId") String projectId, @Param("withoutList") List<String> withoutList);
|
List<String> selectIdByProjectIdAndWithoutList(@Param("projectId") String projectId, @Param("withoutList") List<String> withoutList);
|
||||||
|
|
||||||
List<ProjectCountDTO> projectPlanCount(@Param("projectIds") Set<String> projectIds, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userId") String userId);
|
List<ProjectCountDTO> projectPlanCount(@Param("projectIds") Set<String> projectIds, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("userId") String userId);
|
||||||
|
|
||||||
List<ProjectUserCreateCount> userCreatePlanCount(@Param("projectId") String projectId, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userIds") Set<String> userIds);
|
List<ProjectUserCreateCount> userCreatePlanCount(@Param("projectId") String projectId, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("userIds") Set<String> userIds);
|
||||||
|
|
||||||
|
|
||||||
@BaseConditionFilter
|
@BaseConditionFilter
|
||||||
|
|
|
@ -746,7 +746,9 @@
|
||||||
<foreach collection="projectIds" item="projectId" separator="," open="(" close=")">
|
<foreach collection="projectIds" item="projectId" separator="," open="(" close=")">
|
||||||
#{projectId}
|
#{projectId}
|
||||||
</foreach>
|
</foreach>
|
||||||
AND test_plan.create_time BETWEEN #{startTime} AND #{endTime}
|
<if test="startTime != null and endTime != null">
|
||||||
|
AND test_plan.create_time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
<if test="userId != null and userId != ''">
|
<if test="userId != null and userId != ''">
|
||||||
AND test_plan.create_user = #{userId}
|
AND test_plan.create_user = #{userId}
|
||||||
</if>
|
</if>
|
||||||
|
@ -758,7 +760,9 @@
|
||||||
SELECT test_plan.create_user as userId, count(test_plan.id) as count
|
SELECT test_plan.create_user as userId, count(test_plan.id) as count
|
||||||
FROM test_plan
|
FROM test_plan
|
||||||
WHERE test_plan.project_id = #{projectId}
|
WHERE test_plan.project_id = #{projectId}
|
||||||
AND test_plan.create_time BETWEEN #{startTime} AND #{endTime}
|
<if test="startTime != null and endTime != null">
|
||||||
|
AND test_plan.create_time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
<if test="userIds != null and userIds.size() > 0">
|
<if test="userIds != null and userIds.size() > 0">
|
||||||
and test_plan.create_user in
|
and test_plan.create_user in
|
||||||
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
|
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
|
||||||
|
|
Loading…
Reference in New Issue