Commit 55249169 authored by wdy's avatar wdy

Merge branch 'wangdingyi' into 'dev'

查看待办任务列表是否选择场景

See merge request !246
parents af847352 4605a4e9
...@@ -9,6 +9,7 @@ import com.ruoyi.web.request.TaskFindPendingRequest; ...@@ -9,6 +9,7 @@ import com.ruoyi.web.request.TaskFindPendingRequest;
import com.ruoyi.web.request.TaskFindRequest; import com.ruoyi.web.request.TaskFindRequest;
import com.ruoyi.web.request.TaskListRequest; import com.ruoyi.web.request.TaskListRequest;
import com.ruoyi.web.response.TaskFindResponse; import com.ruoyi.web.response.TaskFindResponse;
import com.ruoyi.web.response.TaskScenarioResponse;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -52,4 +53,7 @@ public interface TaskMapper extends BaseMapper<Task> { ...@@ -52,4 +53,7 @@ public interface TaskMapper extends BaseMapper<Task> {
* @return * @return
*/ */
InspectionReportPdfVO selectInspectionReportData(Long taskId); InspectionReportPdfVO selectInspectionReportData(Long taskId);
// 根据任务列表查询对应的场景数量
List<TaskScenarioResponse> findByTaskList(@Param("responses") List<TaskFindResponse> responses);
} }
...@@ -18,10 +18,7 @@ import com.ruoyi.mapper.*; ...@@ -18,10 +18,7 @@ import com.ruoyi.mapper.*;
import com.ruoyi.service.*; import com.ruoyi.service.*;
import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.web.request.*; import com.ruoyi.web.request.*;
import com.ruoyi.web.response.DataStatisticsResponse; import com.ruoyi.web.response.*;
import com.ruoyi.web.response.ResultCountResponse;
import com.ruoyi.web.response.TaskFindResponse;
import com.ruoyi.web.response.TaskGetInfoResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -235,6 +232,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -235,6 +232,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
List<ModelTestTask> modelTestTaskList = modelTestTaskMapper.findByTaskList(responses); List<ModelTestTask> modelTestTaskList = modelTestTaskMapper.findByTaskList(responses);
setModelProgress(modelTestTaskList,responses); setModelProgress(modelTestTaskList,responses);
// 任务是否有选择场景
List<TaskScenarioResponse> scenarioResponseList = taskMapper.findByTaskList(responses);
setTaskScenario(scenarioResponseList,responses);
for (TaskFindResponse response : responses) { for (TaskFindResponse response : responses) {
String[] taskList = response.getTaskList().split(","); String[] taskList = response.getTaskList().split(",");
...@@ -670,6 +671,21 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -670,6 +671,21 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
} }
private void setTaskScenario(List<TaskScenarioResponse> scenarioResponseList, List<TaskFindResponse> responses) {
if (scenarioResponseList != null && scenarioResponseList.size() != 0) {
for (TaskScenarioResponse response : scenarioResponseList) {
for (TaskFindResponse findResponse : responses) {
if (Objects.equals(findResponse.getId(), response.getTaskId())) {
if (response.getNum() > 0) {
findResponse.setTaskScenario(true);
}
}
}
}
}
}
private void setModelProgress(List<ModelTestTask> modelTestTaskList, List<TaskFindResponse> responses) { private void setModelProgress(List<ModelTestTask> modelTestTaskList, List<TaskFindResponse> responses) {
if (modelTestTaskList != null && modelTestTaskList.size() != 0) { if (modelTestTaskList != null && modelTestTaskList.size() != 0) {
......
...@@ -121,4 +121,7 @@ public class TaskFindResponse { ...@@ -121,4 +121,7 @@ public class TaskFindResponse {
@ApiModelProperty("试验方案ID") @ApiModelProperty("试验方案ID")
private String testSchemeId; private String testSchemeId;
@ApiModelProperty("是否选择场景")
private Boolean taskScenario;
} }
package com.ruoyi.web.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("任务场景VO")
public class TaskScenarioResponse {
@ApiModelProperty("任务id")
private Long taskId;
@ApiModelProperty("场景数量")
private Long num;
}
...@@ -343,6 +343,14 @@ ...@@ -343,6 +343,14 @@
FROM t_task FROM t_task
WHERE task_name = #{taskName} WHERE task_name = #{taskName}
</select> </select>
<select id="findByTaskList" resultType="com.ruoyi.web.response.TaskScenarioResponse">
SELECT COUNT(*) num, task_id as taskId FROM t_task_scenario_relation
WHERE task_id IN
<foreach item="item" collection="responses" open="(" separator="," close=")">
#{item.id}
</foreach>
GROUP BY task_id
</select>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment