2021与蓝度共同重构项目,服务端
liuhaonan
2022-07-22 d9a9d8a2dad1d1e57b184bf8f972a03d654d883a
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PlayPlanNvService.java
@@ -29,10 +29,7 @@
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
 * 播放计划
@@ -172,7 +169,13 @@
    }
    public Map<String, Object> pushToLed(Long planId, List<NovaPushResultVO> nova) {
        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,12 @@
        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("请不要操作其他人的节目");
        }
        String pages = ledProgram.getPages();
        List<String> playerIds = new ArrayList<>();
        nova.forEach(n -> {