From 67b483b124d74ba1ef5701b508d4e808e26b0d2e Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期五, 11 三月 2022 15:13:09 +0800
Subject: [PATCH] fix
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PlayPlanNvService.java | 83 ++++++++++++++++++++++-------------------
1 files changed, 45 insertions(+), 38 deletions(-)
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PlayPlanNvService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PlayPlanNvService.java
index 79bdac8..17d41a4 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PlayPlanNvService.java
+++ b/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());
@@ -113,51 +113,58 @@
program.setPages(JSON.parseObject(pushToLed.getPages(), List.class));
program.setSchedule(JSON.parseObject(pushToLed.getSchedule(), Map.class));
program.setNoticeUrl(VnnoxConstant.NOTIFY_URL);
- /* Map schedule = JSON.parseObject(pushToLed.getSchedule(), Map.class);
- Map<String,Object> push=new HashMap<>();
- push.put("playerIds",playerIds);
- push.put("pages",pages);
- push.put("schedule",schedule);
- 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=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){
+ List<String> success = new ArrayList<>();
+ List<String> fail = new ArrayList<>();
+ 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;
}
+
+ public Object getByPlanId(Long planId) {
+ PlayPlanNv byId = getById(planId);
+ if (byId == null) {
+ throw new BusinessException("鎵句笉鍒拌璁″垝");
+ }
+ LEDProgram byId1 = ledProgramService.getById(byId.getLedProgramId());
+ if (byId1 == null) {
+ throw new BusinessException("鎵句笉鍒拌鑺傜洰");
+ }
+ 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;
+ }
}
--
Gitblit v1.9.3