fix(任务中心): 修复任务数量统计不准确问题
--bug=1012760 --user=赵勇 【任务中心】任务中心的条数显示不正确 https://www.tapd.cn/55049933/s/1148558
This commit is contained in:
parent
0a496e19bf
commit
d4b4b29787
|
@ -78,36 +78,62 @@
|
|||
|
||||
<select id="getRunningTasks" resultType="java.lang.Integer" parameterType="java.lang.String">
|
||||
SELECT count(tt.id) FROM (
|
||||
(select t.id,t.create_time as executionTime
|
||||
from api_scenario_report t left join `user` t1 ON t.user_id = t1.id left join test_resource_pool t2 on t.actuator = t2.id
|
||||
where to_days(FROM_UNIXTIME(t.create_time/1000))= to_days(now()) and t.execute_type !='Debug' and t.execute_type !='Marge' and t.project_id in
|
||||
(select t.id,'SCENARIO' as executionModule,t.report_type, ifnull(t2.name,'LOCAL') as actuator, t1.`name` as executor,t.create_time as executionTime, t.trigger_mode as triggerMode ,t.status as executionStatus
|
||||
from api_scenario_report t left join `user` t1 ON t.user_id = t1.id left join test_resource_pool t2 on t.actuator = t2.id
|
||||
where to_days(FROM_UNIXTIME(t.create_time/1000))= to_days(now()) and t.execute_type !='Debug' and t.execute_type !='Marge' and t.project_id in
|
||||
<foreach collection="request.projects" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
<if test="request.triggerMode != null and request.triggerMode != ''">
|
||||
and t.trigger_mode = #{request.triggerMode}
|
||||
</if>
|
||||
<if test="request.executionStatus != null and request.executionStatus != ''">
|
||||
and t.status = #{request.executionStatus}
|
||||
</if>
|
||||
<if test="request.executor != null and request.executor != ''">
|
||||
and t.user_id = #{request.executor}
|
||||
</if>
|
||||
and t.status not in ("saved","completed","success","error","STOP")
|
||||
)
|
||||
UNION ALL
|
||||
(select t.id,t.create_time as executionTime
|
||||
from api_definition_exec_result t left join `user` t1 ON t.user_id = t1.id left join test_resource_pool t2 on t.actuator = t2.id
|
||||
where to_days(FROM_UNIXTIME(t.create_time/1000))= to_days(now())
|
||||
and (t.integrated_report_id is null or t.integrated_report_id='null')
|
||||
and t.project_id in
|
||||
UNION ALL
|
||||
(select t.id,'API' as executionModule, t.report_type, ifnull(t2.name,'LOCAL') as actuator, t1.`name` as executor,t.create_time as executionTime, ifnull(t.trigger_mode,'MANUAL') as triggerMode ,ifnull(t.status,'Saved') as executionStatus
|
||||
from api_definition_exec_result t left join `user` t1 ON t.user_id = t1.id left join test_resource_pool t2 on t.actuator = t2.id
|
||||
where to_days(FROM_UNIXTIME(t.create_time/1000))= to_days(now()) and t.project_id in
|
||||
<foreach collection="request.projects" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
||||
<if test="request.triggerMode != null and request.triggerMode != ''">
|
||||
and t.trigger_mode = #{request.triggerMode}
|
||||
</if>
|
||||
<if test="request.executionStatus != null and request.executionStatus != ''">
|
||||
and t.status = #{request.executionStatus}
|
||||
</if>
|
||||
<if test="request.executor != null and request.executor != ''">
|
||||
and t.user_id = #{request.executor}
|
||||
</if>
|
||||
and (t.integrated_report_id is null or t.integrated_report_id = 'null')
|
||||
and t.status not in ("saved","completed","success","error","STOP")
|
||||
)
|
||||
UNION ALL
|
||||
(select t.id,t.create_time as executionTime
|
||||
from load_test_report t left join `user` t1 ON t.user_id = t1.id left join test_resource_pool t2 on t.test_resource_pool_id = t2.id
|
||||
where to_days(FROM_UNIXTIME(t.create_time/1000))= to_days(now()) and
|
||||
t.project_id in
|
||||
UNION ALL
|
||||
(select t.id,'PERFORMANCE' as executionModule,'PERFORMANCE' as report_type, ifnull(t2.name,'LOCAL') as actuator, t1.`name` as executor,t.create_time as executionTime, t.trigger_mode as triggerMode ,t.`status` as executionStatus
|
||||
from load_test_report t left join `user` t1 ON t.user_id = t1.id left join test_resource_pool t2 on t.test_resource_pool_id = t2.id
|
||||
where to_days(FROM_UNIXTIME(t.create_time/1000))= to_days(now()) and t.project_id in
|
||||
<foreach collection="request.projects" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
and t.status not in ("saved","completed","success","error")
|
||||
<if test="request.triggerMode != null and request.triggerMode != ''">
|
||||
and t.trigger_mode = #{request.triggerMode}
|
||||
</if>
|
||||
<if test="request.executionStatus != null and request.executionStatus != ''">
|
||||
and t.status = #{request.executionStatus}
|
||||
</if>
|
||||
<if test="request.executor != null and request.executor != ''">
|
||||
and t.user_id = #{request.executor}
|
||||
</if>
|
||||
and t.status not in ("saved","completed","success","error")
|
||||
)
|
||||
)tt ORDER BY tt.executionTime DESC;
|
||||
)tt;
|
||||
</select>
|
||||
|
||||
<select id="checkActuator" resultType="java.lang.String" parameterType="java.lang.String">
|
||||
|
|
|
@ -20,7 +20,7 @@ public class TaskController {
|
|||
|
||||
@PostMapping("/list/{goPage}/{pageSize}")
|
||||
public Pager<List<TaskCenterDTO>> getTasks(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody TaskCenterRequest request) {
|
||||
request.setProjects(taskService.getOwnerProjectIds(null));
|
||||
request.setProjects(taskService.getOwnerProjectIds(request.getUserId()));
|
||||
request.setGoPage(goPage);
|
||||
request.setPageSize(pageSize);
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
|
|
|
@ -405,6 +405,7 @@ export default {
|
|||
return;
|
||||
}
|
||||
this.condition.projectId = getCurrentProjectID();
|
||||
this.condition.userId = getCurrentUser().id;
|
||||
this.result = this.$post('/task/center/list/' + this.currentPage + '/' + this.pageSize, this.condition, response => {
|
||||
this.total = response.data.itemCount;
|
||||
this.taskData = response.data.listObject;
|
||||
|
|
Loading…
Reference in New Issue