| | |
| | | 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.admin.utils.TaskAPIUtils; |
| | | import com.sandu.ximon.admin.vo.TaskMediaFileVO; |
| | | import com.sandu.ximon.admin.vo.TaskTerminalVO; |
| | |
| | | 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; |
| | |
| | | private final BroadcastV2TaskTerminalService broadcastV2TaskTerminalService; |
| | | |
| | | |
| | | /*public boolean add1() { |
| | | return broadcastV2TaskTerminalService.save(); |
| | | }*/ |
| | | 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(); |
| | | |
| | |
| | | MinIoConstant.BROADCAST_FILE.getBucketName() + fileEntity.getUserId(), |
| | | fileEntity.getFileName() |
| | | ); |
| | | if (fileEntity.getUserId() == null && fileEntity.getClientId() == null) { |
| | | if (fileEntity.getUserId() == null && fileEntity.getClientId() != null) { |
| | | absolutePath = MinIoConstant.getAbsolutePath( |
| | | MinIoConstant.ADMIN_BROADCAST_FILE.getBucketName(), |
| | | fileEntity.getFileName() |
| | |
| | | Integer taskId = TaskAPIUtils.addTask(missionparam); |
| | | // Integer taskId = 1111; |
| | | |
| | | boolean flag; |
| | | if (null != taskId && taskId != 0) { |
| | | IpVolumeMission byId = getById(taskId); |
| | | for (BroadcastV2TaskTerminal v2TaskTerminal : taskTerminalEntityList) { |
| | |
| | | broadcastV2TaskTerminalService.deleteByTaskId(taskId); |
| | | broadcastV2TaskTerminalService.saveTaskTerminal(taskTerminalEntityList); |
| | | broadcastV2TaskFileService.saveBatch(taskFileEntityList); |
| | | return true; |
| | | flag = true; |
| | | } else { |
| | | return false; |
| | | flag = false; |
| | | } |
| | | |
| | | /** |
| | | * IP音柱任务添加日志记录开始 |
| | | */ |
| | | String content = "{任务ID:" + taskId |
| | | + ",任务名:" + taskName |
| | | + ",设备ID集合:" + missionparam.getTerminalIds() |
| | | + " }"; |
| | | StoreOperationRecordsUtils.storeOperationData(missionparam.getTerminalIds(), null, "IP音柱任务添加", content); |
| | | /** |
| | | * IP音柱任务添加日志记录结束 |
| | | */ |
| | | |
| | | |
| | | return flag; |
| | | } |
| | | |
| | | public Integer updateMission(Integer taskId, IpVolumeMissionParam missionparam) { |
| | |
| | | broadcastV2TaskTerminalService.deleteByTaskId(taskId); |
| | | broadcastV2TaskTerminalService.saveBatch(taskTerminalEntityList); |
| | | broadcastV2TaskFileService.saveBatch(taskFileEntityList); |
| | | return 0; |
| | | |
| | | } else { |
| | | return result; |
| | | } |
| | | /** |
| | | * IP音柱任务修改 日志记录开始 |
| | | */ |
| | | String content = "{任务ID:" + taskId |
| | | + ",任务名:" + taskName |
| | | + ",设备ID集合:" + missionparam.getTerminalIds() |
| | | + ",任务编辑结果:" + result |
| | | + " }"; |
| | | StoreOperationRecordsUtils.storeOperationData(missionparam.getTerminalIds(), null, "IP音柱任务修改", content); |
| | | /** |
| | | * IP音柱任务修改 日志记录结束 |
| | | */ |
| | | return result; |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | broadcastV2TaskFileService.deleteByTaskId(taskId); |
| | | broadcastV2TaskTerminalService.deleteByTaskId(taskId); |
| | | // broadcastV2TaskTerminalService.removeById(taskId); |
| | | return 0; |
| | | } else { |
| | | return del; |
| | | } |
| | | |
| | | /** |
| | | * IP音柱任务删除 日志记录开始 |
| | | */ |
| | | String content = "{删除的任务ID:" + taskId |
| | | + ",任务删除结果:" + del |
| | | + " }"; |
| | | StoreOperationRecordsUtils.storeOperationData(null, null, "IP音柱任务删除", content); |
| | | /** |
| | | * IP音柱任务删除 日志记录结束 |
| | | */ |
| | | |
| | | |
| | | return del; |
| | | } |
| | | |
| | | |
| | | public List<IpVolumeMissionBo> missionList(BaseConditionVO baseConditionVO, String keyword) { |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | public List<IpVolumeMissionBo> missionList(BaseConditionVO baseConditionVO, String keyword, Integer order, Integer seq) { |
| | | |
| | | |
| | | //排序字段 |
| | | String orderByResult = "task_id"; |
| | | //正序、倒叙 |
| | | String orderBySeq = "ASC"; |
| | | if (order != null) { |
| | | switch (order) { |
| | | case 1: |
| | | orderByResult = OrderByEnums.IP_VOLUME_MISSION_CREATE_TIME.getCode(); |
| | | break; |
| | | default: |
| | | } |
| | | } |
| | | if (seq != null) { |
| | | switch (seq) { |
| | | case 1: |
| | | orderBySeq = " ASC"; |
| | | break; |
| | | case 2: |
| | | orderBySeq = " DESC"; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | //排序方式 |
| | | String orderBy = orderByResult + " " + orderBySeq; |
| | | 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("任务归属错误"); |
| | | } |
| | | } |