| | |
| | | package com.ard.sample.wayline.service.impl; |
| | | |
| | | import com.ard.oss.service.impl.OssServiceContext; |
| | | import com.ard.ossdock.service.impl.OssDockServiceContext; |
| | | import com.ard.route.domain.route.ArdRouteInfo; |
| | | import com.ard.route.service.IArdRouteInfoService; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | |
| | | private IArdRouteInfoService _ardRouteInfoService; |
| | | |
| | | @Resource |
| | | private OssServiceContext _ossService; |
| | | private OssDockServiceContext _ossService; |
| | | |
| | | @Autowired |
| | | private IDeviceService deviceService; |
| | |
| | | // get file url |
| | | // URL url = waylineFileService.getObjectUrl(waylineFile.get().getWaylineId()); |
| | | URL url = null; |
| | | String minioUrl = subStringMinioUrlName(ardRouteOpt.getPath()); |
| | | String minioUrl = subStringMinioUrlName(ardRouteOpt.getPath1()); |
| | | String md5 = ""; |
| | | try (InputStream inputStream = _ossService.getObject(kmzPath, minioUrl)) { |
| | | md5 = DigestUtils.md5Hex(inputStream); |
| | |
| | | return Optional.ofNullable(entity2Dto(jobEntity)); |
| | | } |
| | | |
| | | public List<WaylineJobDTO> getJobByJobParentId(String parentId) { |
| | | List<WaylineJobEntity> jobEntities = mapper.selectList( |
| | | new LambdaQueryWrapper<WaylineJobEntity>() |
| | | .eq(WaylineJobEntity::getParentId, parentId)); |
| | | if (CollectionUtils.isEmpty(jobEntities)) { |
| | | return Collections.emptyList(); // 返回不可变空列表,更安全 |
| | | } |
| | | return jobEntities.stream() |
| | | .map(this::entity2Dto) // 调用原有的单个转换方法 |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | /** |
| | | * 更新作业信息 |
| | | * |
| | |
| | | Page<WaylineJobEntity> pageData = mapper.selectPage( |
| | | new Page<WaylineJobEntity>(page, pageSize), |
| | | new LambdaQueryWrapper<WaylineJobEntity>() |
| | | .isNull(WaylineJobEntity::getParentId) |
| | | // 实际开始时间筛选,允许为空,为空则不进行筛选 |
| | | .ge(startTime != null, WaylineJobEntity::getBeginTime, startTime) |
| | | .le(endTime != null, WaylineJobEntity::getBeginTime, endTime) |
| | |
| | | .ne(isComplete != null && !isComplete, WaylineJobEntity::getStatus, 3) |
| | | // 任务状态筛选,允许为空,为空则不进行筛选 |
| | | .eq(status != null, WaylineJobEntity::getStatus, status) |
| | | .orderByDesc(WaylineJobEntity::getId)); |
| | | .orderByDesc(WaylineJobEntity::getBeginTime)); |
| | | List<WaylineJobDTO> records = pageData.getRecords() |
| | | .stream() |
| | | .map(this::entity2Dto) |
| | | .peek(job -> { |
| | | List<WaylineJobDTO> childOpt = this.getJobByJobParentId(job.getJobId()); |
| | | job.setChildren(childOpt); |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | |
| | | return new PaginationData<WaylineJobDTO>(records, new Pagination(pageData)); |
| | |
| | | |
| | | // get file url |
| | | URL url = null; |
| | | String minioUrl = subStringMinioUrlName(ardRouteOpt.getPath()); |
| | | String minioUrl = subStringMinioUrlName(ardRouteOpt.getPath1()); |
| | | String md5 = ""; |
| | | try (InputStream inputStream = _ossService.getObject(kmzPath, minioUrl)) { |
| | | md5 = DigestUtils.md5Hex(inputStream); |