2021与蓝度共同重构项目,服务端
liuhaonan
2022-07-20 edd224b12bf3514533796e2da89be3af0d8361f5
优化
已修改3个文件
36 ■■■■■ 文件已修改
ximon-admin/src/main/java/com/sandu/ximon/admin/dto/nova/PlayerProgram.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LEDProgramService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PlayPlanNvService.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/dto/nova/PlayerProgram.java
@@ -18,7 +18,7 @@
    //  播放时间排期,如果为空,会全天24小时循环播放
    private  Map schedule;
    //  需要播放的页面内容集合
    private  List<Map<String,Object>> pages ;
    private  List<ProgramDto> pages ;
    //  节目下载进度通知接口,会通过此接口将节目的下载进度发给客户,接口的响应时间不能超过3s
    private String noticeUrl;
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LEDProgramService.java
@@ -35,6 +35,9 @@
        led.setPreview(receiveParam.getPreviewUrl());
        led.setWidth(receiveParam.getWidth());
        led.setHeight(receiveParam.getHeight());
        if (receiveParam.getPages() == null) {
            throw new BusinessException("节目内容丢失");
        }
        led.setPages(JSON.toJSONString(receiveParam.getPages()));
        return save(led);
    }
@@ -51,6 +54,9 @@
        led.setPreview(receiveParam.getPreviewUrl());
        led.setWidth(receiveParam.getWidth());
        led.setHeight(receiveParam.getHeight());
        if (receiveParam.getPages() == null) {
            throw new BusinessException("节目内容丢失");
        }
        led.setPages(JSON.toJSONString(receiveParam.getPages()));
        return updateById(led);
    }
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PlayPlanNvService.java
@@ -169,10 +169,13 @@
    }
    public Map<String, Object> pushToLed(Long planId, List<NovaPushResultVO> nova) {
        if(nova==null){
        if (nova == null) {
            throw new BusinessException("请选择正确的LED屏");
        }
        PushToLed pushToLed = playPlanMapper.pushToLed(planId);
        if (pushToLed.getPages() == null) {
            throw new BusinessException("节目内容丢失");
        }
        PlayPlanNv byId = getById(planId);
        if (pushToLed == null) {
            throw new BusinessException("未找到该播放计划");
@@ -186,8 +189,26 @@
        program.setPlayerIds(playerIds);
        //获取节目实体
        program.setPages(JSON.parseObject(pushToLed.getPages(), List.class));
        List<ProgramDto> programDtos = JSON.parseArray(pushToLed.getPages(), ProgramDto.class);
        programDtos.forEach(
                programDto -> {
                    programDto.getWidgets().forEach(
                            widget -> {
                                String url = widget.getUrl();
                                LEDProgramFile one = fileService.getOne(Wrappers.lambdaQuery(LEDProgramFile.class).eq(LEDProgramFile::getFileUrl, url));
                                if (one == null) {
                                    throw new BusinessException("节目文件已失效");
                                }
                                widget.setMd5(one.getMd5());
                                widget.setSize(one.getSize());
                            }
                    );
                }
        );
        program.setPages(programDtos);
        //获取节目定时实体
        program.setSchedule((JSON.parseObject(pushToLed.getSchedule(), Map.class)));
@@ -392,6 +413,9 @@
        if (ledProgram == null) {
            throw new BusinessException("未找到节目");
        }
        if (ledProgram.getPages() == null) {
            throw new BusinessException("节目内容丢失");
        }
        if (SecurityUtils.getClientId() != null && !Objects.equals(ledProgram.getClientId(), SecurityUtils.getUserId()) && !Objects.equals(ledProgram.getClientId(), SecurityUtils.getClientId())) {
            throw new BusinessException("请不要操作其他人的节目");
        }