| | |
| | | import com.ycl.platform.wvp.WVPResult; |
| | | import com.ycl.system.Result; |
| | | import com.ycl.system.domain.SysConfig; |
| | | import com.ycl.system.entity.SysDictData; |
| | | import com.ycl.system.mapper.SysConfigMapper; |
| | | import com.ycl.system.mapper.SysDictDataMapper; |
| | | import com.ycl.system.mapper.SysDictTypeMapper; |
| | | import com.ycl.system.model.LoginUser; |
| | | import com.ycl.system.page.PageUtil; |
| | | import com.ycl.utils.DateUtils; |
| | |
| | | private final SysConfigMapper configMapper; |
| | | private final ServerConfig serverConfig; |
| | | private final ReportMapper reportMapper; |
| | | private final SysDictDataMapper dictDataMapper; |
| | | |
| | | @Value("${rtsp.server:http://127.0.0.1:7788}") |
| | | private String rtspServer; |
| | |
| | | for (WorkOrder workOrder : workOrderList) { |
| | | WorkOrder databaseWorkOrder = mapping.get(workOrder.getSerialNumber()); |
| | | if (Objects.nonNull(databaseWorkOrder)) { |
| | | List<WorkOrderErrorType> workOrderErrorTypeList = new LambdaQueryChainWrapper<>(workOrderErrorTypeMapper) |
| | | .select(WorkOrderErrorType::getErrorName) |
| | | .eq(WorkOrderErrorType::getWorkOrderNo, workOrder.getWorkOrderNo()) |
| | | .list(); |
| | | List<String> errorNameList = workOrderErrorTypeList.stream().map(WorkOrderErrorType::getErrorName).collect(Collectors.toList()); |
| | | String errorType = databaseWorkOrder.getErrorType(); |
| | | if (workOrder.getErrorType().equals(errorType)) { |
| | | if (errorNameList.contains(errorType)) { |
| | | // 如果,国标码、故障类型都一样,则跳过不处理 |
| | | continue; |
| | | } else { |
| | | // 错误类型不一样,就更新错误类型,并且重置工单状态为待处理 |
| | | errorType = errorType + "," + workOrder.getErrorType(); |
| | | databaseWorkOrder.setErrorType(errorType); |
| | | databaseWorkOrder.setStatus(WorkOrderStatusEnum.DISTRIBUTED); |
| | | // 错误类型不一样,就新增一个错误类型,并且重置工单状态为待处理 |
| | | List<SysDictData> errorTypeDictList = dictDataMapper.selectDictDataByType("error_type"); |
| | | String finalErrorType = errorType; |
| | | List<SysDictData> targetErrorTypes = errorTypeDictList.stream().filter(item -> finalErrorType.equals(item.getDictValue())).collect(Collectors.toList()); |
| | | if (! CollectionUtils.isEmpty(targetErrorTypes)) { |
| | | errorType = targetErrorTypes.get(0).getDictValue(); |
| | | } |
| | | WorkOrderErrorType workOrderErrorType = new WorkOrderErrorType(); |
| | | workOrderErrorType.setWorkOrderNo(databaseWorkOrder.getWorkOrderNo()); |
| | | Date now = new Date(); |
| | | workOrderErrorType.setCreateTime(now); |
| | | workOrderErrorType.setUpdateTime(now); |
| | | workOrderErrorTypeMapper.insert(workOrderErrorType); |
| | | |
| | | databaseWorkOrder.setStatus(WorkOrderStatusEnum.DISTRIBUTED); |
| | | databaseWorkOrder.setUpdateTime(now); |
| | | baseMapper.updateById(databaseWorkOrder); |
| | | updateNum++; |
| | |
| | | } else { |
| | | workOrder.setCreateTime(new Date()); |
| | | workOrder.setUpdateTime(new Date()); |
| | | // 如果报备过,使用最新报备的错误类型 |
| | | Report report = reportMapper.checkPointReported(workOrder.getSerialNumber()); |
| | | if (Objects.nonNull(report)) { |
| | | workOrder.setErrorType(report.getErrorType()); |
| | | } |
| | | // // 如果报备过,使用最新报备的错误类型 |
| | | // Report report = reportMapper.checkPointReported(workOrder.getSerialNumber()); |
| | | // if (Objects.nonNull(report)) { |
| | | // workOrder.setErrorType(report.getErrorType()); |
| | | // } |
| | | waitAddList.add(workOrder); |
| | | } |
| | | } |