2021与蓝度共同重构项目,服务端
liuhaonan
2022-08-16 77d4d872d13145e8aef2f6a361202e87cf84ee8f
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PlayPlanNvService.java
@@ -1,5 +1,6 @@
package com.sandu.ximon.admin.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
@@ -27,6 +28,7 @@
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
 * 播放计划
@@ -188,12 +190,20 @@
        nova.forEach(n -> {
            playerIds.add(n.getPlayerId());
        });
        List<String> success = new ArrayList<>();
        List<String> fail = new ArrayList<>();
        //拼接成功失败的结果
        Map<String, Object> result = new HashMap<>();
        List<NovaPushResultVO> successList = new ArrayList<>();
        List<NovaPushResultVO> faileList = new ArrayList<>();
        List<List<String>> split = CollectionUtil.split(playerIds, 100);
        for (List<String> playIds : split) {
        PlayerProgram program = new PlayerProgram();
        program.setPlayerIds(playerIds);
            program.setPlayerIds(playIds);
        //获取节目实体
        List<PlayerPage> programDtos = JSON.parseArray(pushToLed.getPages(), PlayerPage.class);
        programDtos.forEach(
@@ -234,17 +244,12 @@
        VnnoxResultResponse vnnoxResultResponse = vnnoxProgramAPIUtil.normalProgram(program);
        vnnoxAPIUtil.volChange(playerIds, Integer.valueOf(pushToLed.getVolume()).intValue());
        List<String> success = new ArrayList<>();
        List<String> fail = new ArrayList<>();
        if (vnnoxResultResponse.getData() != null) {
            success = vnnoxResultResponse.getData().getSuccess();
            fail = vnnoxResultResponse.getData().getFail();
        }
        //拼接成功失败的结果
        Map<String, Object> result = new HashMap<>();
        List<NovaPushResultVO> successList = new ArrayList<>();
        List<NovaPushResultVO> faileList = new ArrayList<>();
        List<String> finalSuccess = success;
        List<String> finalFail = fail;
        nova.forEach(n -> {
@@ -254,6 +259,8 @@
                faileList.add(n);
            }
        });
        }
        result.put("success", successList);
        result.put("fail", faileList);
@@ -288,30 +295,30 @@
            throw new BusinessException("未找到节目");
        }
        List<SchedulesDTO> schedulesDTOS = JSON.parseArray(one.getSchedules(), SchedulesDTO.class);
        ProgramSchedule programSchedule = new ProgramSchedule();
        programSchedule.setSchedules(schedulesDTOS);
        List<String> playerIds = new ArrayList<>();
        nova.forEach(
                n -> {
                    playerIds.add(n.getPlayerId());
                }
        );
        //设置
        programSchedule.setPlayerIds(playerIds);
        VnnoxResultResponse vnnoxResultResponse = vnnoxProgramAPIUtil.timeProgram(programSchedule);
        List<String> success = new ArrayList<>();
        List<String> fail = new ArrayList<>();
        if (vnnoxResultResponse.getData() != null) {
            success = vnnoxResultResponse.getData().getSuccess();
            fail = vnnoxResultResponse.getData().getFail();
        }
        //拼接成功失败的结果
        Map<String, Object> result = new HashMap<>();
        List<NovaPushResultVO> successList = new ArrayList<>();
        List<NovaPushResultVO> faileList = new ArrayList<>();
        List<List<String>> split = CollectionUtil.split(nova.stream().map(NovaPushResultVO::getPlayerId).collect(Collectors.toList()), 100);
        for (List<String> playerIds : split) {
            //设置
            ProgramSchedule programSchedule = new ProgramSchedule();
            programSchedule.setSchedules(schedulesDTOS);
            programSchedule.setPlayerIds(playerIds);
            VnnoxResultResponse vnnoxResultResponse = vnnoxProgramAPIUtil.timeProgram(programSchedule);
            if (vnnoxResultResponse.getData() != null) {
                success = vnnoxResultResponse.getData().getSuccess();
                fail = vnnoxResultResponse.getData().getFail();
            }
        List<String> finalSuccess = success;
        List<String> finalFail = fail;
        nova.forEach(
                n -> {
                    if (finalSuccess.contains(n.getPlayerId())) {
@@ -322,6 +329,7 @@
                }
        );
        }
        result.put("success", successList);
        result.put("fail", faileList);
@@ -426,11 +434,19 @@
            throw new BusinessException("请不要操作其他人的节目");
        }
        String pages = ledProgram.getPages();
        List<String> playerIds = new ArrayList<>();
        nova.forEach(n -> {
            playerIds.add(n.getPlayerId());
        });
        List<String> success = new ArrayList<>();
        List<String> fail = new ArrayList<>();
        //拼接成功失败的结果
        Map<String, Object> result = new HashMap<>();
        List<NovaPushResultVO> successList = new ArrayList<>();
        List<NovaPushResultVO> faileList = new ArrayList<>();
        List<List<String>> split = CollectionUtil.split(nova.stream().map(NovaPushResultVO::getPlayerId).collect(Collectors.toList()), 100);
        for (List<String> playerIds : split) {
        PlayerProgram program = new PlayerProgram();
        List<PlayerPage> programDtos = JSON.parseArray(pages, PlayerPage.class);
        programDtos.forEach(
@@ -461,17 +477,12 @@
            throw new BusinessException("推送失败");
        }
        List<String> success = new ArrayList<>();
        List<String> fail = new ArrayList<>();
        if (vnnoxResultResponse.getData() != null) {
            success = vnnoxResultResponse.getData().getSuccess();
            fail = vnnoxResultResponse.getData().getFail();
        }
        //拼接成功失败的结果
        Map<String, Object> result = new HashMap<>();
        List<NovaPushResultVO> successList = new ArrayList<>();
        List<NovaPushResultVO> faileList = new ArrayList<>();
        List<String> finalSuccess = success;
        List<String> finalFail = fail;
        nova.forEach(n -> {
@@ -481,6 +492,7 @@
                faileList.add(n);
            }
        });
        }
        result.put("success", successList);
        result.put("fail", faileList);