| | |
| | | |
| | | import java.math.BigInteger; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | |
| | |
| | | public class IpVolumeMissionService extends BaseServiceImpl<IpVolumeMissionMapper, IpVolumeMission> { |
| | | private final IpVolumeMissionMapper ipVolumeMissionMapper; |
| | | private final ClientService clientService; |
| | | private final IpVolumeService ipVolumeService; |
| | | private final IpVolumeFileService ipVolumeFileService; |
| | | private final BroadcastV2TaskFileService broadcastV2TaskFileService; |
| | | private final BroadcastV2TaskTerminalService broadcastV2TaskTerminalService; |
| | |
| | | taskFileEntity.setFileId(fileId); |
| | | |
| | | IpVolumeFile fileEntity = ipVolumeFileService.getById(fileId); |
| | | if(fileEntity==null){ |
| | | throw new BusinessException("fileId为"+fileId+"的文件不存在"); |
| | | if (fileEntity == null) { |
| | | throw new BusinessException("fileId为" + fileId + "的文件不存在"); |
| | | } |
| | | // String absolutePath = MinIoConstant.getAbsolutePath( |
| | | // MinIoConstant.BROADCAST_FILE.getBucketName() + fileEntity.getUserId(), |
| | |
| | | //return new ArrayList<>(); |
| | | } |
| | | |
| | | public IpVolumeMission getByTaskId(Integer taskId) { |
| | | public TaskVO getByTaskId(Integer taskId) { |
| | | TaskVO task = TaskAPIUtils.getTask(taskId); |
| | | if (task == null) { |
| | | throw new BusinessException("服务器未找到该任务"); |
| | |
| | | if (byId == null) { |
| | | throw new BusinessException("本地未找到该任务"); |
| | | } |
| | | if (SecurityUtils.getClientId() != null) { |
| | | if (clientService.findClientId()) { |
| | | if (byId.getUserId() != SecurityUtils.getUserId()) { |
| | | throw new BusinessException("任务归属错误"); |
| | | } |
| | | |
| | | byId.setWeeks("0" + Integer.toBinaryString(byId.getWeek())); |
| | | } else { |
| | | if (byId.getClientId() != SecurityUtils.getUserId()) { |
| | | throw new BusinessException("任务归属错误"); |
| | | } |
| | | } |
| | | |
| | | return byId; |
| | | |
| | | } |
| | | task.setWeeks("0" + Integer.toBinaryString(byId.getWeek())); |
| | | // byId.setWeeks("0" + Integer.toBinaryString(byId.getWeek())); |
| | | task.setBdate(byId.getOnDate()); |
| | | task.setEdate(byId.getOffDate()); |
| | | |
| | | List<BroadcastV2TaskFile> taskFiles = broadcastV2TaskFileService.list(Wrappers.lambdaQuery(BroadcastV2TaskFile.class) |
| | | .eq(BroadcastV2TaskFile::getTaskId, taskId)); |
| | | List<BroadcastV2TaskTerminal> taskTerminals = broadcastV2TaskTerminalService.list(Wrappers.lambdaQuery(BroadcastV2TaskTerminal.class) |
| | | .eq(BroadcastV2TaskTerminal::getTaskId, taskId)); |
| | | |
| | | if (!taskFiles.isEmpty()) { |
| | | taskFiles.forEach( |
| | | fileId -> { |
| | | // IpVolumeFile volumeFile = ipVolumeFileService.getById(fileId.getFileId()); |
| | | // if(volumeFile==null){ |
| | | // throw new BusinessException("任务文件不存在"); |
| | | // } |
| | | task.getFileIds().add(fileId.getFileId()); |
| | | // byId.getFileIds().add(fileId.getFileId()); |
| | | } |
| | | ); |
| | | |
| | | } |
| | | if (!taskTerminals.isEmpty()) { |
| | | taskTerminals.forEach( |
| | | terminalId -> { |
| | | // BroadcastTerminalV2Entity v2Entity = ipVolumeService.getById(terminalId.getTerminalId()); |
| | | // if(v2Entity==null){ |
| | | // throw new BusinessException("该任务暂无设备使用"); |
| | | // } |
| | | task.getTerminalIds().add(terminalId.getTerminalId()); |
| | | // byId.getTerminalIds().add(terminalId.getTerminalId()); |
| | | } |
| | | ); |
| | | } |
| | | |
| | | return task; |
| | | |
| | | |
| | | } |