| | |
| | | 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; |
| | |
| | | import com.sandu.ximon.dao.domain.BroadcastV2TaskTerminal; |
| | | import com.sandu.ximon.dao.domain.IpVolumeFile; |
| | | import com.sandu.ximon.dao.domain.IpVolumeMission; |
| | | import com.sandu.ximon.dao.enums.OrderByEnums; |
| | | import com.sandu.ximon.dao.mapper.IpVolumeMissionMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | |
| | | |
| | | 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); |
| | |
| | | } |
| | | |
| | | |
| | | public List<IpVolumeMissionBo> missionList(BaseConditionVO baseConditionVO, String keyword, Integer order,Integer seq) { |
| | | public List<IpVolumeMissionBo> missionList(BaseConditionVO baseConditionVO, String keyword, Integer order, Integer seq) { |
| | | |
| | | |
| | | //排序字段 |
| | | String orderByResult = "create_time"; |
| | | String orderByResult = "task_id"; |
| | | //正序、倒叙 |
| | | String orderBySeq = "ASC"; |
| | | if (order != null) { |
| | | switch (order) { |
| | | case 1: |
| | | orderByResult = "create_time"; |
| | | orderByResult = OrderByEnums.IP_VOLUME_MISSION_CREATE_TIME.getCode(); |
| | | break; |
| | | default: |
| | | } |
| | |
| | | } |
| | | //排序方式 |
| | | String orderBy = orderByResult + " " + orderBySeq; |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), orderBy); |
| | | if (baseConditionVO != null) { |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), orderBy); |
| | | } |
| | | |
| | | 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("任务归属错误"); |
| | | } |
| | | } |