Commit 1190431a authored by 盖献康's avatar 盖献康

Merge branch 'dev' of...

Merge branch 'dev' of ssh://gitlab.91isoft.com:10022/wangfei/vehicle-quality-review into gaixiankang
parents ae13cfcf 55249169
package com.ruoyi.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
......@@ -19,6 +20,10 @@ import lombok.experimental.Accessors;
@Data
public class TaskUserRelation {
// 用户状态禁用
@TableField(exist = false)
public static final String USER_STATUS_PROHIBIT = "1";
/**
* 任务id
*/
......@@ -52,4 +57,8 @@ public class TaskUserRelation {
@ApiModelProperty("部门名称")
private String deptName;
@TableField(exist = false)
@ApiModelProperty("用户状态")
private String status;
}
......@@ -9,6 +9,7 @@ import com.ruoyi.web.request.TaskFindPendingRequest;
import com.ruoyi.web.request.TaskFindRequest;
import com.ruoyi.web.request.TaskListRequest;
import com.ruoyi.web.response.TaskFindResponse;
import com.ruoyi.web.response.TaskScenarioResponse;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -52,4 +53,7 @@ public interface TaskMapper extends BaseMapper<Task> {
* @return
*/
InspectionReportPdfVO selectInspectionReportData(Long taskId);
// 根据任务列表查询对应的场景数量
List<TaskScenarioResponse> findByTaskList(@Param("responses") List<TaskFindResponse> responses);
}
......@@ -23,6 +23,9 @@ public interface TaskUserRelationMapper extends BaseMapper<TaskUserRelation> {
*/
List<TaskUserRelation> selectQTeamMembers(@Param("taskId") Long taskId);
// 根据小组成员id列表查询状态
List<TaskUserRelation> findByIdList(@Param("idList") List<TaskUserRelation> idList);
}
......
......@@ -18,10 +18,7 @@ import com.ruoyi.mapper.*;
import com.ruoyi.service.*;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.web.request.*;
import com.ruoyi.web.response.DataStatisticsResponse;
import com.ruoyi.web.response.ResultCountResponse;
import com.ruoyi.web.response.TaskFindResponse;
import com.ruoyi.web.response.TaskGetInfoResponse;
import com.ruoyi.web.response.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -104,6 +101,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
@Autowired
private ModelTestTaskMapper modelTestTaskMapper;
@Autowired
private TaskUserRelationMapper taskUserRelationMapper;
@Override
public List<Task> findList(TaskListRequest request) {
return taskMapper.findList(request);
......@@ -232,6 +232,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
List<ModelTestTask> modelTestTaskList = modelTestTaskMapper.findByTaskList(responses);
setModelProgress(modelTestTaskList,responses);
// 任务是否有选择场景
List<TaskScenarioResponse> scenarioResponseList = taskMapper.findByTaskList(responses);
setTaskScenario(scenarioResponseList,responses);
for (TaskFindResponse response : responses) {
String[] taskList = response.getTaskList().split(",");
......@@ -667,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) {
if (modelTestTaskList != null && modelTestTaskList.size() != 0) {
......@@ -992,6 +1011,21 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
// 小组成员
List<TaskUserRelation> relation = taskUserRelationService.selectQTeamMembers(id);
// 小组成员状态
List<TaskUserRelation> relationList = taskUserRelationMapper.findByIdList(relation);
for ( TaskUserRelation userRelation : relationList) {
for (TaskUserRelation taskUserRelation : relation) {
if (Objects.equals(userRelation.getUserId(), taskUserRelation.getUserId())) {
taskUserRelation.setStatus(userRelation.getStatus());
// 如果检验员状态为1,则显示已停用
if (Objects.equals(userRelation.getStatus(), TaskUserRelation.USER_STATUS_PROHIBIT)) {
taskUserRelation.setName(taskUserRelation.getName() + "(已停用)");
}
}
}
}
return relation;
}
......
......@@ -121,4 +121,7 @@ public class TaskFindResponse {
@ApiModelProperty("试验方案ID")
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 @@
FROM t_task
WHERE task_name = #{taskName}
</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>
......@@ -23,4 +23,13 @@
task_id = #{taskId}
</if>
</select>
<select id="findByIdList" resultType="com.ruoyi.domain.TaskUserRelation">
select user_id as userId,
status
from sys_user
WHERE sys_user.user_id IN
<foreach item="item" collection="idList" open="(" separator="," close=")">
#{item.userId}
</foreach>
</select>
</mapper>
\ No newline at end of file
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