ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PlayPlanNvController.java
@@ -43,7 +43,7 @@ } @PostMapping("/update/{planId}") public ResponseVO<Object> updateLEDPlan(@PathVariable Long planId,@RequestBody @Validated PlayPlanParam param) { public ResponseVO<Object> updateLEDPlan(@PathVariable Long planId, @RequestBody @Validated PlayPlanParam param) { return ResponseUtil.success(playPlanNvService.updatePlan(planId, param)); } @@ -52,24 +52,25 @@ return ResponseUtil.success(playPlanNvService.deletePlan(plianIds)); } @PostMapping(value ="/push/{plianId}",produces = "application/json;charset=UTF-8") public ResponseVO<Object> pushToLed(@PathVariable Long plianId,@RequestBody List<String> playerIds) { return ResponseUtil.success(playPlanNvService.pushToLed(plianId,playerIds)); @PostMapping(value = "/push/{plianId}", produces = "application/json;charset=UTF-8") public ResponseVO<Object> pushToLed(@PathVariable Long plianId, @RequestBody List<String> playerIds) { return ResponseUtil.success(playPlanNvService.pushToLed(plianId, playerIds)); } @GetMapping("/listPlan") public ResponseVO<Object> list(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) { PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); LambdaQueryWrapper<PlayPlanNv> wrapper = new LambdaQueryWrapper<>();// if(AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getAdministratorIdentity())){ wrapper= Wrappers.lambdaQuery(PlayPlanNv.class).eq(PlayPlanNv::getUserId,SecurityUtils.getUserId()); if (AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getAdministratorIdentity())) { wrapper = Wrappers.lambdaQuery(PlayPlanNv.class).eq(PlayPlanNv::getUserId, SecurityUtils.getUserId()); } wrapper=Wrappers.lambdaQuery(PlayPlanNv.class); if(StrUtil.isNotBlank(keyword)){ wrapper.like(PlayPlanNv::getName,keyword); wrapper = Wrappers.lambdaQuery(PlayPlanNv.class); if (StrUtil.isNotBlank(keyword)) { wrapper.like(PlayPlanNv::getName, keyword); } List<PlayPlanNv> list = playPlanNvService.list(wrapper); //PlayPlanParam param=new PlayPlanParam(); list.forEach(plan->{ list.forEach(plan -> { plan.setPlan(JSON.parseObject(plan.getSchedule(), Map.class)); }); return ResponseUtil.successPage(list); ximon-admin/src/main/java/com/sandu/ximon/admin/service/IpVolumeMissionService.java
@@ -63,14 +63,14 @@ if (missionparam.getTerminalIds().size() <= 0) { throw new BusinessException("播放终端不可为空"); // return 3; // return 3; } // 封装播放终端 List<TaskTerminalVO> taskTerminalVOList = new ArrayList<>(); // 封装数据库中任务终端绑定 List<BroadcastV2TaskTerminal> taskTerminalEntityList = new ArrayList<>(); for(Integer id: new HashSet<>(missionparam.getTerminalIds())) { for (Integer id : new HashSet<>(missionparam.getTerminalIds())) { TaskTerminalVO taskTerminalVO = new TaskTerminalVO(); BroadcastV2TaskTerminal taskTerminalEntity = new BroadcastV2TaskTerminal(); @@ -85,7 +85,7 @@ List<TaskMediaFileVO> taskMediaFileVOS = new ArrayList<>(); List<BroadcastV2TaskFile> taskFileEntityList = new ArrayList<>(); int i = 1; for(Integer fileId: new HashSet<>(missionparam.getFileIds())) { for (Integer fileId : new HashSet<>(missionparam.getFileIds())) { TaskMediaFileVO taskMediaFileVO = new TaskMediaFileVO(); BroadcastV2TaskFile taskFileEntity = new BroadcastV2TaskFile(); @@ -117,13 +117,13 @@ if (null != taskId && taskId != 0) { IpVolumeMission byId = getById(taskId); for (BroadcastV2TaskTerminal v2TaskTerminal: taskTerminalEntityList) { for (BroadcastV2TaskTerminal v2TaskTerminal : taskTerminalEntityList) { v2TaskTerminal.setTaskId(taskId); } for (BroadcastV2TaskFile v2TaskFile :taskFileEntityList) { for (BroadcastV2TaskFile v2TaskFile : taskFileEntityList) { v2TaskFile.setTaskId(taskId); } if (byId==null) { if (byId == null) { // 向数据库添加该任务记录 IpVolumeMission mission = new IpVolumeMission(); @@ -179,15 +179,15 @@ String taskName = missionparam.getMissionName(); if(null == taskName || "".equals(taskName)) { if (null == taskName || "".equals(taskName)) { return 4; } if(missionparam.getFileIds().size()<=0){ if (missionparam.getFileIds().size() <= 0) { return 5; } if(missionparam.getTerminalIds().size()<=0){ if (missionparam.getTerminalIds().size() <= 0) { return 6; } @@ -196,7 +196,7 @@ List<TaskTerminalVO> taskTerminalVOList = new ArrayList<>(); // 封装数据库中任务终端绑定 List<BroadcastV2TaskTerminal> taskTerminalEntityList = new ArrayList<>(); for(Integer id: new HashSet<>(missionparam.getTerminalIds())) { for (Integer id : new HashSet<>(missionparam.getTerminalIds())) { TaskTerminalVO taskTerminalVO = new TaskTerminalVO(); BroadcastV2TaskTerminal taskTerminalEntity = new BroadcastV2TaskTerminal(); @@ -211,7 +211,7 @@ List<TaskMediaFileVO> taskMediaFileVOS = new ArrayList<>(); List<BroadcastV2TaskFile> taskFileEntityList = new ArrayList<>(); int i = 1; for(Integer fileId: new HashSet<>(missionparam.getFileIds())) { for (Integer fileId : new HashSet<>(missionparam.getFileIds())) { TaskMediaFileVO taskMediaFileVO = new TaskMediaFileVO(); BroadcastV2TaskFile taskFileEntity = new BroadcastV2TaskFile(); @@ -241,12 +241,12 @@ // 向IP音柱服务器更新任务 Integer result = TaskAPIUtils.updateTask(taskId, missionparam); if(result==0){ if (result == 0) { IpVolumeMission byId = getById(taskId); for (BroadcastV2TaskTerminal v2TaskTerminal: taskTerminalEntityList) { for (BroadcastV2TaskTerminal v2TaskTerminal : taskTerminalEntityList) { v2TaskTerminal.setTaskId(taskId); } for (BroadcastV2TaskFile v2TaskFile :taskFileEntityList) { for (BroadcastV2TaskFile v2TaskFile : taskFileEntityList) { v2TaskFile.setTaskId(taskId); } if (null == byId) { @@ -264,7 +264,7 @@ mission.setOffDate(missionparam.getOffDate()); mission.setWeek(Integer.parseInt(missionparam.getWeek(), 2));//时间由二进制字符串转换为十进制 mission.setMissionVolume(missionparam.getMissionVolume()); // mission.setMissionFileUrl(missionparam.getFiles().toString()); // mission.setMissionFileUrl(missionparam.getFiles().toString()); mission.setNumberInPlay(missionparam.getTerminals().length); /*TaskTerminalVO[] terminals = missionparam.getTerminals();*/ @@ -279,7 +279,7 @@ mission.setOffDate(missionparam.getOffDate()); mission.setWeek(Integer.parseInt(missionparam.getWeek(), 2));//时间由二进制字符串转换为十进制 mission.setMissionVolume(missionparam.getMissionVolume()); // mission.setMissionFileUrl(missionparam.getFiles().toString()); // mission.setMissionFileUrl(missionparam.getFiles().toString()); mission.setNumberInPlay(missionparam.getTerminals().length); System.out.println(updateById(mission)); System.out.println("----------------------------------------------------------"); @@ -290,59 +290,59 @@ broadcastV2TaskFileService.saveBatch(taskFileEntityList); return 0; }else { } else { return result; } } /** * 删除任务 * * @param taskId * @return0:成功 1:任务不处于空闲状态 2:服务器删除失败 * @return0:成功 1:任务不处于空闲状态 2:服务器删除失败 */ public Integer deleteMission(Integer taskId) { Integer del = TaskAPIUtils.delTask(taskId); if(del==0){ if (del == 0) { IpVolumeMission byId = getById(taskId); if (byId == null) { return -1; return -1; } removeById(taskId); broadcastV2TaskFileService.removeById(taskId); broadcastV2TaskTerminalService.removeById(taskId); return 0; } else { } else { return del; } } public List<IpVolumeMissionBo> missionList(BaseConditionVO baseConditionVO,String keyword) { // PageHelper.startPage(baseConditionVO.getPageNo(),baseConditionVO.getPageSize()); public List<IpVolumeMissionBo> missionList(BaseConditionVO baseConditionVO, String keyword) { // PageHelper.startPage(baseConditionVO.getPageNo(),baseConditionVO.getPageSize()); boolean r = clientService.findClientId(); //ture代表有上级客户 查询通过userID List<IpVolumeMissionBo> ipVolumeMissionBos = new ArrayList<>(); LambdaQueryWrapper<IpVolumeMission> eq=new LambdaQueryWrapper<>(); LambdaQueryWrapper<IpVolumeMission> eq = new LambdaQueryWrapper<>(); PageHelper.startPage(baseConditionVO.getPageNo(),baseConditionVO.getPageSize()); if(r){ eq = Wrappers.lambdaQuery(IpVolumeMission.class).eq(IpVolumeMission::getUserId, SecurityUtils.getUserId()); }else { eq = Wrappers.lambdaQuery(IpVolumeMission.class).eq(IpVolumeMission::getClientId,SecurityUtils.getUserId()); PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); if (r) { eq = Wrappers.lambdaQuery(IpVolumeMission.class).eq(IpVolumeMission::getUserId, SecurityUtils.getUserId()); } else { eq = Wrappers.lambdaQuery(IpVolumeMission.class).eq(IpVolumeMission::getClientId, SecurityUtils.getUserId()); } if(!keyword.isEmpty()){ eq.like(IpVolumeMission::getMissionName,keyword); if (!keyword.isEmpty()) { eq.like(IpVolumeMission::getMissionName, keyword); } List<IpVolumeMission> list = list(eq); // ipVolumeMissionBos = ipVolumeMissionMapper.listAllByClientId(); for (IpVolumeMission mission: list) { for (IpVolumeMission mission : list) { List<String> fileName = broadcastV2TaskFileService.findByTaskid(mission.getTaskId()); IpVolumeMissionBo bo=new IpVolumeMissionBo(); IpVolumeMissionBo bo = new IpVolumeMissionBo(); BeanUtils.copyProperties(mission, bo); bo.setFileNames(fileName); ipVolumeMissionBos.add(bo); @@ -358,18 +358,18 @@ //return new ArrayList<>(); } public IpVolumeMission getByTaskId(Integer taskId){ public IpVolumeMission getByTaskId(Integer taskId) { TaskVO task = TaskAPIUtils.getTask(taskId); if(task==null){ if (task == null) { throw new BusinessException("服务器未找到该任务"); } IpVolumeMission byId = getById(taskId); if(byId==null){ if (byId == null) { throw new BusinessException("本地未找到该任务"); } byId.setWeeks("0"+Integer.toBinaryString(byId.getWeek())); byId.setWeeks("0" + Integer.toBinaryString(byId.getWeek())); return byId; ximon-admin/src/main/java/com/sandu/ximon/admin/service/PlayPlanNvService.java
@@ -43,7 +43,7 @@ playPlan.setName(playPlanParam.getName()); playPlan.setLedProgramName(playPlanParam.getLedProgramName()); LEDProgram byId = ledProgramService.getById(playPlanParam.getLedProgramId()); if(byId==null){ if (byId == null) { throw new BusinessException("ledProgramId有误,未找到该节目"); } playPlan.setLedProgramId(playPlanParam.getLedProgramId()); @@ -55,7 +55,7 @@ playPlan.setSchedule(JSON.toJSONString(playPlanParam.getSchedule())); playPlan.setStartTime(playPlanParam.getStartTime()); playPlan.setEndTime(playPlanParam.getEndTime()); // BeanUtils.copyProperties(playPlanParam, playPlan); // BeanUtils.copyProperties(playPlanParam, playPlan); return save(playPlan); @@ -86,7 +86,7 @@ } public boolean deletePlan(List<Long> ids) { for(Long id:ids){ for (Long id : ids) { PlayPlanNv byId = getById(id); if (byId == null) { throw new BusinessException("部分操作对象不存在"); @@ -95,17 +95,17 @@ return removeByIds(ids); } public Map<String, Object> pushToLed(Long planId,List<String> playerIds){ public Map<String, Object> pushToLed(Long planId, List<String> playerIds) { // public PlayerProgram pushToLed(Long planId){ PushToLed pushToLed = playPlanMapper.pushToLed(planId); PlayPlanNv one =getOne(Wrappers.lambdaQuery(PlayPlanNv.class).eq(PlayPlanNv::getId, planId)); if(pushToLed==null){ PlayPlanNv one = getOne(Wrappers.lambdaQuery(PlayPlanNv.class).eq(PlayPlanNv::getId, planId)); if (pushToLed == null) { throw new BusinessException("未找到该播放计划"); } //List<String> playerIds=new ArrayList<>(); // playerIds.add("872bb51ae0f06e70c21e913cf3dc9e4d"); // playerIds.add("872bb51ae0f06e70c21e913cf3dc9e4d"); //List<Map<String,Object>> pages = JSON.parseObject(pushToLed.getPages(), List.class); PlayerProgram program=new PlayerProgram(); PlayerProgram program = new PlayerProgram(); program.setPlayerIds(playerIds); System.out.println(pushToLed.getPages()); @@ -124,8 +124,8 @@ VnnoxResult vnnoxResult = vnnoxAPIUtil.volChange(playerIds, Integer.valueOf(one.getVolume()).intValue()); // VnnoxResultResponse vnnoxResultResponse = vnnoxProgramAPIUtil.normalProgram(push); List<String> success=new ArrayList<>(); List<String> fail= new ArrayList<>(); List<String> success = new ArrayList<>(); List<String> fail = new ArrayList<>(); // List<String> success=new ArrayList<>(); // if(vnnoxResultResponse.getData().getSuccess()!=null&&vnnoxResultResponse.getData()!=null){ // success = vnnoxResultResponse.getData().getSuccess(); @@ -135,29 +135,29 @@ // if(vnnoxResultResponse.getData().getFail()!=null&vnnoxResultResponse.getData()!=null){ // fail= vnnoxResultResponse.getData().getFail(); // } if(vnnoxResultResponse.getData()!=null){ if (vnnoxResultResponse.getData() != null) { success = vnnoxResultResponse.getData().getSuccess(); fail= vnnoxResultResponse.getData().getFail(); fail = vnnoxResultResponse.getData().getFail(); } // fail.addAll(vnnoxResult.getFail()); Map<String,Object> result=new HashMap<>(); List<LedPlayerEntity> successList= new ArrayList<>(); List<LedPlayerEntity> faileList= new ArrayList<>(); for (String playerId:success){ // fail.addAll(vnnoxResult.getFail()); Map<String, Object> result = new HashMap<>(); List<LedPlayerEntity> successList = new ArrayList<>(); List<LedPlayerEntity> faileList = new ArrayList<>(); for (String playerId : success) { successList.add(ledPlayerEntityService.getByPlayerId(playerId)); } for (String playerId:fail){ faileList.add( ledPlayerEntityService.getByPlayerId(playerId)); for (String playerId : fail) { faileList.add(ledPlayerEntityService.getByPlayerId(playerId)); } result.put("success",successList); result.put("fail",faileList); result.put("success", successList); result.put("fail", faileList); return result; // return program; // return program; } @@ -172,15 +172,15 @@ } Map schedule = JSON.parseObject(byId.getSchedule(), Map.class); List pages = JSON.parseObject(byId1.getPages(), List.class); Map plan=new HashMap(); plan.put("planId",byId.getId()); plan.put("planName",byId.getName()); plan.put("programId",byId1.getId()); plan.put("programName",byId1.getName()); plan.put("planVolume",byId.getVolume()); plan.put("preview",byId1.getPreview()); plan.put("pages",pages); plan.put("schedule",schedule); return plan; Map plan = new HashMap(); plan.put("planId", byId.getId()); plan.put("planName", byId.getName()); plan.put("programId", byId1.getId()); plan.put("programName", byId1.getName()); plan.put("planVolume", byId.getVolume()); plan.put("preview", byId1.getPreview()); plan.put("pages", pages); plan.put("schedule", schedule); return plan; } }