2021与蓝度共同重构项目,服务端
liuhaonan
2022-02-18 81d00b6d3079d721b8c0d2ffa6ef51c10a433eae
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PlayPlanNvService.java
@@ -7,13 +7,12 @@
import com.sandu.ximon.admin.config.VnnoxConstant;
import com.sandu.ximon.admin.param.PlayPlanParam;
import com.sandu.ximon.admin.security.SecurityUtils;
import com.sandu.ximon.admin.utils.VnnoxAPIUtil;
import com.sandu.ximon.admin.utils.VnnoxProgramAPIUtil;
import com.sandu.ximon.admin.utils.request.PlayerProgram;
import com.sandu.ximon.admin.utils.response.VnnoxResult;
import com.sandu.ximon.admin.utils.response.VnnoxResultResponse;
import com.sandu.ximon.dao.domain.BroadcastV2TaskTerminal;
import com.sandu.ximon.dao.domain.LedPlayerEntity;
import com.sandu.ximon.dao.domain.PlayPlanNv;
import com.sandu.ximon.dao.domain.PushToLed;
import com.sandu.ximon.dao.domain.*;
import com.sandu.ximon.dao.enums.AdministratorEnums;
import com.sandu.ximon.dao.mapper.PlayPlanNvMapper;
import lombok.AllArgsConstructor;
@@ -32,6 +31,8 @@
    private final PlayPlanNvMapper playPlanMapper;
    private final VnnoxProgramAPIUtil vnnoxProgramAPIUtil;
    private final LedPlayerEntityService ledPlayerEntityService;
    private VnnoxAPIUtil vnnoxAPIUtil;
    private final LEDProgramService ledProgramService;
    public boolean addPlan(PlayPlanParam playPlanParam) {
@@ -40,17 +41,22 @@
            playPlan.setUserId(SecurityUtils.getUserId());
        }
        playPlan.setName(playPlanParam.getName());
       /* playPlan.setLedProgramName(playPlanParam.getLedProgramName());
        playPlan.setLedProgramName(playPlanParam.getLedProgramName());
        LEDProgram byId = ledProgramService.getById(playPlanParam.getLedProgramId());
        if(byId==null){
            throw new BusinessException("ledProgramId有误,未找到该节目");
        }
        playPlan.setLedProgramId(playPlanParam.getLedProgramId());
        playPlan.setVolume(playPlanParam.getVolume());
        playPlan.setApplySeries(playPlanParam.getApplySeries());
        playPlan.setStartDate(playPlanParam.getStartDate());
        playPlan.setEndDate(playPlanParam.getEndDate());
        playPlan.setWeekDays(playPlanParam.getWeekDays());
        playPlan.setSchedule(playPlanParam.getSchedule());
        playPlan.setSchedule(JSON.toJSONString(playPlanParam.getSchedule()));
        playPlan.setStartTime(playPlanParam.getStartTime());
        playPlan.setEndTime(playPlanParam.getEndTime());*/
        BeanUtils.copyProperties(playPlanParam, playPlan);
        playPlan.setEndTime(playPlanParam.getEndTime());
      //  BeanUtils.copyProperties(playPlanParam, playPlan);
        return save(playPlan);
@@ -71,7 +77,7 @@
        playPlan.setStartDate(playPlanParam.getStartDate());
        playPlan.setEndDate(playPlanParam.getEndDate());
        playPlan.setWeekDays(playPlanParam.getWeekDays());
        playPlan.setSchedule(playPlanParam.getSchedule());
        playPlan.setSchedule(JSON.toJSONString(playPlanParam.getSchedule()));
        playPlan.setStartTime(playPlanParam.getStartTime());
        playPlan.setEndTime(playPlanParam.getEndTime());
@@ -92,6 +98,7 @@
    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){
            throw new BusinessException("未找到该播放计划");
        }
@@ -114,9 +121,27 @@
        push.put("noticeUrl", VnnoxConstant.SCREEN_SHOT_NOTIFY_URL);
*/
        VnnoxResultResponse vnnoxResultResponse = vnnoxProgramAPIUtil.normalProgram(program);
        VnnoxResult vnnoxResult = vnnoxAPIUtil.volChange(playerIds, Integer.valueOf(one.getVolume()).intValue());
       // VnnoxResultResponse vnnoxResultResponse = vnnoxProgramAPIUtil.normalProgram(push);
        List<String> success = vnnoxResultResponse.getData().getSuccess();
        List<String> fail = vnnoxResultResponse.getData().getFail();
        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();
//        }
//        //success.addAll(vnnoxResult.getSuccess());
//        if(vnnoxResultResponse.getData().getFail()!=null&vnnoxResultResponse.getData()!=null){
//            fail= vnnoxResultResponse.getData().getFail();
//        }
        if(vnnoxResultResponse.getData()!=null){
            success = vnnoxResultResponse.getData().getSuccess();
            fail= vnnoxResultResponse.getData().getFail();
        }
       // fail.addAll(vnnoxResult.getFail());
        Map<String,Object> result=new HashMap<>();
        List<LedPlayerEntity> successList= new ArrayList<>();
        List<LedPlayerEntity> faileList= new ArrayList<>();
@@ -127,6 +152,7 @@
            faileList.add( ledPlayerEntityService.getByPlayerId(playerId));
        }
        result.put("success",successList);
        result.put("fail",faileList);