| | |
| | | import com.ycl.utils.http.HttpUtils; |
| | | import com.ycl.utils.redis.RedisCache; |
| | | import com.ycl.utils.uuid.IdUtils; |
| | | import constant.ApiConstants; |
| | | import constant.Constants; |
| | | import constant.RedisConstant; |
| | | import enumeration.ErrorType; |
| | |
| | | UrgentLevelEnum.WARNING, |
| | | workOrder.getWorkOrderNo()); |
| | | notifyService.save(notify); |
| | | List<String> errorList = workOrderErrorTypeMapper.getErrorList(workOrder.getWorkOrderNo()) |
| | | .stream().map(SysDictData::getDictValue).collect(Collectors.toList()); |
| | | List<WorkOrderVO> workOrderVOS = workOrderErrorTypeMapper.getErrorListByNumbers(Arrays.asList(workOrder.getWorkOrderNo())); |
| | | |
| | | // 同步点位状态 |
| | | if (form.getAuditingResult() == WorkOrderStatusEnum.AUDITING_SUCCESS) { |
| | | ywPointService.updateRecovery(Collections.singletonList(workOrder.getSerialNumber()), 0); |
| | | //如果工单为离线工单那么修改点位pingOnline为在线 |
| | | if(!CollectionUtils.isEmpty(errorList) && errorList.contains(ErrorType.DEVICE_OFFLINE.getValue())){ |
| | | new LambdaUpdateChainWrapper<>(ywPointMapper) |
| | | .eq(YwPoint::getSerialNumber, workOrder.getSerialNumber()) |
| | | .set(YwPoint::getUpdateTime, new Date()) |
| | | .set(YwPoint::getPingOnline, 1) |
| | | .update(); |
| | | if (!CollectionUtils.isEmpty(workOrderVOS)) { |
| | | List<String> ips = new ArrayList<>(); |
| | | for (WorkOrderVO workOrderVO : workOrderVOS) { |
| | | if(ErrorType.DEVICE_OFFLINE.getValue().equals(workOrderVO.getErrorType())){ |
| | | ips.add(workOrderVO.getIp()); |
| | | } |
| | | } |
| | | if(!CollectionUtils.isEmpty(ips)) { |
| | | monitorMapper.batchUpdateOnline(ips, new Date(), ApiConstants.UY_OnlineSite_Online); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | workOrder.getWorkOrderNo()); |
| | | notifies.add(notify); |
| | | } |
| | | notifyService.saveBatch(notifies); |
| | | // 同步点位状态 |
| | | if (form.getAuditingResult() == WorkOrderStatusEnum.AUDITING_SUCCESS) { |
| | | ywPointService.updateRecovery(serialNumbers, 0); |
| | | //筛选出离线工单ip并修改在线状态 |
| | | if (!CollectionUtils.isEmpty(serialNumbers)) { |
| | | Map<String, List<String>> errorTypes = workOrderErrorTypeMapper.getErrorListByNumbers(workOrderNoList).stream().collect(Collectors.groupingBy( |
| | | WorkOrderVO::getIp, |
| | | Collectors.mapping( |
| | | WorkOrderVO::getErrorType, |
| | | Collectors.toList() |
| | | ) |
| | | )); |
| | | List<String> ips = new ArrayList<>(); |
| | | errorTypes.forEach((key, value) -> { |
| | | if (!CollectionUtils.isEmpty(value) && value.contains(ErrorType.DEVICE_OFFLINE.getValue())) { |
| | | ips.add(key); |
| | | } |
| | | notifyService.saveBatch(notifies); |
| | | }); |
| | | if(!CollectionUtils.isEmpty(ips)) { |
| | | monitorMapper.batchUpdateOnline(ips, new Date(), ApiConstants.UY_OnlineSite_Online); |
| | | } |
| | | } |
| | | } |
| | | return Result.ok("操作成功"); |
| | | } |
| | | |