| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | 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.VnnoxProgramAPIUtil; |
| | | import com.sandu.ximon.admin.utils.request.PlayerProgram; |
| | | import com.sandu.ximon.admin.utils.response.VnnoxResultResponse; |
| | | import com.sandu.ximon.dao.domain.PlayPlanNv; |
| | | import com.sandu.ximon.dao.domain.PushToLed; |
| | | import com.sandu.ximon.dao.enums.AdministratorEnums; |
| | |
| | | public class PlayPlanNvService extends BaseServiceImpl<PlayPlanNvMapper, PlayPlanNv> { |
| | | |
| | | private final PlayPlanNvMapper playPlanMapper; |
| | | private final VnnoxProgramAPIUtil vnnoxProgramAPIUtil; |
| | | |
| | | public boolean addPlan(PlayPlanParam playPlanParam) { |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | public boolean deletePlan(Long id) { |
| | | PlayPlanNv byId = getById(id); |
| | | if (byId == null) { |
| | | throw new BusinessException("操作对象不存在"); |
| | | public boolean deletePlan(List<Long> ids) { |
| | | for(Long id:ids){ |
| | | PlayPlanNv byId = getById(id); |
| | | if (byId == null) { |
| | | throw new BusinessException("部分操作对象不存在"); |
| | | } |
| | | } |
| | | |
| | | return removeById(id); |
| | | |
| | | return removeByIds(ids); |
| | | } |
| | | |
| | | public Map<String, Object> pushToLed(Long planId){ |
| | | public Map<String, Object> pushToLed(Long planId,List<String> playerIds){ |
| | | // public PlayerProgram pushToLed(Long planId){ |
| | | PushToLed pushToLed = playPlanMapper.pushToLed(planId); |
| | | if(pushToLed==null){ |
| | | throw new BusinessException("未找到该播放计划"); |
| | | } |
| | | List<String> playerIds=new ArrayList<>(); |
| | | playerIds.add("led的编号"); |
| | | List<Map<String,Object>> pages = JSON.parseObject(pushToLed.getPages(), List.class); |
| | | Map schedule = JSON.parseObject(pushToLed.getSchedule(), Map.class); |
| | | Map<String,Object> push=new HashMap<>(); |
| | | //List<String> playerIds=new ArrayList<>(); |
| | | // playerIds.add("872bb51ae0f06e70c21e913cf3dc9e4d"); |
| | | //List<Map<String,Object>> pages = JSON.parseObject(pushToLed.getPages(), List.class); |
| | | PlayerProgram program=new PlayerProgram(); |
| | | program.setPlayerIds(playerIds); |
| | | System.out.println(pushToLed.getPages()); |
| | | |
| | | System.out.println(JSON.parseArray(pushToLed.getPages(), Map.class)); |
| | | 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","这里是回调地址"); |
| | | push.put("noticeUrl", VnnoxConstant.SCREEN_SHOT_NOTIFY_URL); |
| | | */ |
| | | VnnoxResultResponse vnnoxResultResponse = vnnoxProgramAPIUtil.normalProgram(program); |
| | | // VnnoxResultResponse vnnoxResultResponse = vnnoxProgramAPIUtil.normalProgram(push); |
| | | List<String> success = vnnoxResultResponse.getData().getSuccess(); |
| | | List<String> fail = vnnoxResultResponse.getData().getFail(); |
| | | Map<String,Object> result=new HashMap<>(); |
| | | result.put("success",success); |
| | | result.put("fail",fail); |
| | | |
| | | return push; |
| | | return result; |
| | | // return program; |
| | | |
| | | } |
| | | } |