| | |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.admin.minio.entity.MinIoConstant; |
| | | import com.sandu.ximon.admin.param.IpVolumeMissionParam; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils; |
| | |
| | | |
| | | |
| | | public boolean addMission(IpVolumeMissionParam missionparam) { |
| | | |
| | | List<Integer> fileIds = missionparam.getFileIds(); |
| | | List<IpVolumeFile> ipVolumeFiles = ipVolumeFileService.listByIds(fileIds); |
| | | ipVolumeFiles.forEach(file -> { |
| | | if (SecurityUtils.getClientId() != null) { |
| | | //非超管用户 |
| | | if (!SecurityUtils.getUserId().equals(file.getClientId()) && !SecurityUtils.getUserId().equals(file.getUserId())) { |
| | | //用户id和客户id都不匹配 |
| | | throw new BusinessException("文件归属异常,创建任务失败"); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | String taskName = missionparam.getMissionName(); |
| | | |
| | |
| | | if (fileEntity == null) { |
| | | throw new BusinessException("fileId为" + fileId + "的文件不存在"); |
| | | } |
| | | if (fileEntity.getUserId() == null && fileEntity.getClientId() != null) { |
| | | fileEntity.setUserId(fileEntity.getClientId()); |
| | | } |
| | | String absolutePath; |
| | | absolutePath = MinIoConstant.getAbsolutePath( |
| | | MinIoConstant.BROADCAST_FILE.getBucketName() + fileEntity.getUserId(), |
| | | fileEntity.getFileName() |
| | | ); |
| | | if (fileEntity.getUserId() == null && fileEntity.getClientId() == null) { |
| | | absolutePath = MinIoConstant.getAbsolutePath( |
| | | MinIoConstant.ADMIN_BROADCAST_FILE.getBucketName(), |
| | | fileEntity.getFileName() |
| | | ); |
| | | } |
| | | |
| | | taskMediaFileVO.setI(i); |
| | | i++; |
| | | taskMediaFileVO.setT(0); |
| | | taskMediaFileVO.setN(absolutePath); |
| | | taskMediaFileVO.setN(fileEntity.getFileUrl()); |
| | | taskMediaFileVO.setS(BigInteger.valueOf(fileEntity.getOriginSize())); |
| | | |
| | | taskMediaFileVOS.add(taskMediaFileVO); |
| | |
| | | taskFileEntity.setFileId(fileId); |
| | | |
| | | IpVolumeFile fileEntity = ipVolumeFileService.getById(fileId); |
| | | String absolutePath; |
| | | absolutePath = MinIoConstant.getAbsolutePath( |
| | | MinIoConstant.BROADCAST_FILE.getBucketName() + fileEntity.getUserId(), |
| | | fileEntity.getFileName() |
| | | ); |
| | | if (fileEntity.getUserId() == null && fileEntity.getClientId() == null) { |
| | | absolutePath = MinIoConstant.getAbsolutePath( |
| | | MinIoConstant.ADMIN_BROADCAST_FILE.getBucketName(), |
| | | fileEntity.getFileName() |
| | | ); |
| | | } |
| | | |
| | | taskMediaFileVO.setI(i); |
| | | i++; |
| | | taskMediaFileVO.setT(0); |
| | | taskMediaFileVO.setN(absolutePath); |
| | | taskMediaFileVO.setN(fileEntity.getFileUrl()); |
| | | taskMediaFileVO.setS(BigInteger.valueOf(fileEntity.getOriginSize())); |
| | | |
| | | taskMediaFileVOS.add(taskMediaFileVO); |
| | |
| | | |
| | | |
| | | //排序字段 |
| | | String orderByResult = "id"; |
| | | String orderByResult = "task_id"; |
| | | //正序、倒叙 |
| | | String orderBySeq = "ASC"; |
| | | if (order != null) { |
| | |
| | | List<IpVolumeMissionBo> ipVolumeMissionBos = new ArrayList<>(); |
| | | LambdaQueryWrapper<IpVolumeMission> eq = Wrappers.lambdaQuery(IpVolumeMission.class); |
| | | |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | |
| | | //不是超管 |
| | | if (SecurityUtils.getClientId() != null) { |
| | | eq = eq.eq(IpVolumeMission::getUserId, SecurityUtils.getUserId()).or(w -> { |
| | |
| | | } |
| | | if (SecurityUtils.getClientId() != null) { |
| | | if (clientService.findClientId()) { |
| | | if (byId.getUserId().equals(SecurityUtils.getUserId())) { |
| | | if (!byId.getUserId().equals(SecurityUtils.getUserId())) { |
| | | throw new BusinessException("任务归属错误"); |
| | | } |
| | | |
| | | } else { |
| | | if (byId.getClientId().equals(SecurityUtils.getUserId())) { |
| | | if (!byId.getClientId().equals(SecurityUtils.getUserId()) && !byId.getUserId().equals(SecurityUtils.getUserId())) { |
| | | throw new BusinessException("任务归属错误"); |
| | | } |
| | | } |