|
|
|
@ -104,9 +104,6 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
|
|
|
|
|
@Autowired |
|
|
|
|
private TaskNoUserDataScopeMapper taskNoUserDataScopeMapper; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private RedisTemplate redisTemplate; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 正在调用开始任务的id集合 |
|
|
|
|
*/ |
|
|
|
@ -533,42 +530,12 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public BladePage<TaskVo> page(TaskDTO taskDTO) { |
|
|
|
|
List<TaskVo> inspects = (List<TaskVo>) redisTemplate.opsForValue().get("inspect_list" + taskDTO.getCurrent() + taskDTO.getSize()); |
|
|
|
|
Long total = (Long) redisTemplate.opsForValue().get("inspect_list_total"); |
|
|
|
|
if(ObjectUtil.isEmpty(inspects) || ObjectUtil.isEmpty(total)){ |
|
|
|
|
Query query=new Query(); |
|
|
|
|
query.setSize(taskDTO.getSize()); |
|
|
|
|
query.setCurrent(taskDTO.getCurrent()); |
|
|
|
|
IPage<TaskVo> pages = Condition.getPage(query); |
|
|
|
|
List<TaskVo> list = this.baseMapper.getAllPageList(pages,taskDTO); |
|
|
|
|
List<TaskVo> limit = list.stream().peek(taskVo -> { |
|
|
|
|
// 获取机器人信息
|
|
|
|
|
if (taskVo.getAutoVideo().equals(PlanContants.InspectTypeEnum.ROBOT.getVal()) ) { |
|
|
|
|
if (Func.isNotEmpty( ObjectUtil.isNotEmpty(taskVo.getUserId()))) { |
|
|
|
|
taskVo.setRobot(robotService.getDetailByUserId(taskVo.getUserId())); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
pages.setRecords(limit); |
|
|
|
|
redisTemplate.opsForValue().set("inspect_list" + taskDTO.getCurrent() + taskDTO.getSize(),limit); |
|
|
|
|
redisTemplate.expire("inspect_list" + taskDTO.getCurrent() + taskDTO.getSize(),30, TimeUnit.SECONDS); |
|
|
|
|
redisTemplate.opsForValue().set("inspect_list_total",pages.getTotal()); |
|
|
|
|
redisTemplate.expire("inspect_list_total",30, TimeUnit.SECONDS); |
|
|
|
|
return BladePage.of(pages); |
|
|
|
|
} |
|
|
|
|
BladePage page = new BladePage(); |
|
|
|
|
page.setRecords(inspects); |
|
|
|
|
page.setCurrent(taskDTO.getCurrent()); |
|
|
|
|
page.setSize(taskDTO.getSize()); |
|
|
|
|
page.setTotal(total); |
|
|
|
|
return page; |
|
|
|
|
|
|
|
|
|
/* Query query = new Query(); |
|
|
|
|
Query query = new Query(); |
|
|
|
|
query.setSize(taskDTO.getSize()); |
|
|
|
|
query.setCurrent(taskDTO.getCurrent()); |
|
|
|
|
IPage<TaskVo> pages = Condition.getPage(query); |
|
|
|
|
List<TaskVo> list = this.baseMapper.getAllPageList(pages,taskDTO); |
|
|
|
|
list = list.stream().map(taskVo -> { |
|
|
|
|
list = list.stream().peek(taskVo -> { |
|
|
|
|
// 获取机器人信息
|
|
|
|
|
if (taskVo.getAutoVideo().equals(PlanContants.InspectTypeEnum.ROBOT.getVal()) ) { |
|
|
|
|
if (Func.isNotEmpty( ObjectUtil.isNotEmpty(taskVo.getUserId()))) { |
|
|
|
@ -580,11 +547,10 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
|
|
|
|
|
long inspectTime = DateUtil.between(taskVo.getStartTime(), taskVo.getEndTime()).toMinutes(); |
|
|
|
|
taskVo.setInspectTime(Optional.of(inspectTime).orElse(0L)); |
|
|
|
|
} |
|
|
|
|
return taskVo; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
pages.setRecords(list); |
|
|
|
|
BladePage<TaskVo> bladePage = BladePage.of(pages); |
|
|
|
|
return bladePage;*/ |
|
|
|
|
return bladePage; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void getQueryWrapper(TaskDTO taskDTO, LambdaQueryWrapper<TaskEntity> queryWrapper) { |
|
|
|
|