| | |
| | | import com.github.pagehelper.Page; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.admin.dto.LightTaskDto; |
| | | import com.sandu.ximon.admin.dto.SingleLightOrderDto; |
| | |
| | | |
| | | private final PoleService poleService; |
| | | private final LightTaskPoleRelationService lightTaskPoleRelationService; |
| | | private final LightTaskMapper lightTaskMapper; |
| | | |
| | | /** |
| | | * 新增路灯任务 |
| | |
| | | return Optional.ofNullable(responseCommonFrame).map(WrapResponseCommonFrame::getResponseInnerFrame).orElse(null); |
| | | } |
| | | |
| | | public List<LightTaskDto> listLightTask(int pageNo, int pageSize, String keyword) { |
| | | public List<LightTaskDto> listLightTask(BaseConditionVO conditionVO, String keyword) { |
| | | LambdaQueryWrapper<LightTask> wrapper = Wrappers.lambdaQuery(LightTask.class); |
| | | if (StrUtil.isNotBlank(keyword)) { |
| | | wrapper.like(LightTask::getTaskName, keyword); |
| | | } |
| | | Long clientId = SecurityUtils.getClientId(); |
| | | if (clientId != null) { |
| | | wrapper.eq(LightTask::getClientId, clientId); |
| | | //不是超管需要筛选 |
| | | if (SecurityUtils.getClientId() != null) { |
| | | wrapper.eq(LightTask::getClientId, SecurityUtils.getUserId()).or(w -> { |
| | | w.eq(LightTask::getUserId, SecurityUtils.getUserId()); |
| | | }); |
| | | } |
| | | |
| | | PageHelper.startPage(pageNo, pageSize); |
| | | if (conditionVO != null) { |
| | | PageHelper.startPage(conditionVO.getPageNo(), conditionVO.getPageSize()); |
| | | } |
| | | List<LightTask> list = list(wrapper); |
| | | |
| | | Page<LightTaskDto> page = new Page<>(); |
| | |
| | | } |
| | | return page; |
| | | } |
| | | |
| | | /** |
| | | * 执行中的路灯任务 |
| | | * |
| | | * @return |
| | | */ |
| | | public List<LightTaskDto> listTask() { |
| | | Long clientId = SecurityUtils.getClientId(); |
| | | List<LightTask> lightTasks = lightTaskMapper.listLightTask(clientId); |
| | | Page<LightTaskDto> page = new Page<>(); |
| | | BeanUtils.copyProperties(lightTasks, page); |
| | | for (LightTask lightTask : lightTasks) { |
| | | LightTaskDto lightTaskDto = new LightTaskDto(); |
| | | BeanUtils.copyProperties(lightTask, lightTaskDto); |
| | | lightTaskDto.setWeekList(TaskOrderUtil.parseLightWeek2List(lightTask.getWeek())); |
| | | page.add(lightTaskDto); |
| | | } |
| | | return page; |
| | | } |
| | | |
| | | |
| | | // 每个路灯发送控制帧 返回关联列表 |
| | | private List<LightTaskPoleRelation> sendControllerFrame(LightTask lightTask, List<Long> poleIdList, String framePayload) { |
| | |
| | | // } |
| | | // lightTaskPoleRelationService.remove(Wrappers.lambdaQuery(LightTaskPoleRelation.class).in(LightTaskPoleRelation::getTaskId, taskIdList)); |
| | | taskIdList.forEach( |
| | | taskId->{ |
| | | lightTaskPoleRelationService.remove(Wrappers.lambdaQuery(LightTaskPoleRelation.class).eq(LightTaskPoleRelation::getTaskId,taskId)); |
| | | taskId -> { |
| | | lightTaskPoleRelationService.remove(Wrappers.lambdaQuery(LightTaskPoleRelation.class).eq(LightTaskPoleRelation::getTaskId, taskId)); |
| | | } |
| | | ); |
| | | |