| | |
| | | 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); |
| | | } |
| | | }); |
| | | if(!CollectionUtils.isEmpty(ips)) { |
| | | monitorMapper.batchUpdateOnline(ips, new Date(), ApiConstants.UY_OnlineSite_Online); |
| | | } |
| | | } |
| | | } |
| | | notifyService.saveBatch(notifies); |
| | | return Result.ok("操作成功"); |
| | | } |
| | | |
| | |
| | | return Result.ok().data(workOrder); |
| | | } |
| | | |
| | | @Autowired |
| | | private WorkOrderMapper workOrderMapper; |
| | | |
| | | /** |
| | | * 工单导出的逻辑 |
| | | * 标签:同一个ip标签合在一起,针对离线工单(ip相同就不会生成工单),方便运维处理 |
| | |
| | | query.setErrorTypeList(errorTypeList); |
| | | } |
| | | List<WorkOrderVO> export = baseMapper.export(query); |
| | | |
| | | |
| | | List<String> workOrderNos = export.stream().map(WorkOrderVO::getWorkOrderNo).collect(Collectors.toList()); |
| | | List<WorkOrderVO> auditTimeList = workOrderMapper.getAuditTimeList(workOrderNos); |
| | | Map<String, List<Date>> auditTimeMap = auditTimeList.stream() |
| | | .collect(Collectors.groupingBy( |
| | | WorkOrderVO::getWorkOrderNo, // 分组的键 |
| | | Collectors.mapping(WorkOrderVO::getAuditTime, Collectors.toList()))); |
| | | if (!CollectionUtils.isEmpty(workOrderNos)){ |
| | | export.forEach(workOrderVO -> { |
| | | List<Date> auditTimes = auditTimeMap.get(workOrderVO.getWorkOrderNo()); |
| | | if (!CollectionUtils.isEmpty(auditTimes)){ |
| | | //审核通过时间 |
| | | Date passTime = Collections.max(auditTimes); |
| | | ZoneId zoneId = ZoneId.systemDefault(); |
| | | workOrderVO.setPassTime(passTime.toInstant().atZone(zoneId).toLocalDateTime()); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | if (CollectionUtils.isEmpty(export)) return new ArrayList<WorkOrderVO>(); |
| | | List<String> ips = export.stream().map(WorkOrderVO::getIp).collect(Collectors.toList()); |
| | | //查出相同ip的设备、并查出标签 |