2021与蓝度共同重构项目,服务端
zhanzhiqin
2022-05-26 a1c416b13a71c293c3430f2c9cbce97ee96085ba
节目推送结果
已修改3个文件
41 ■■■■ 文件已修改
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/XiXunPlayerService.java 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/utils/LightemitUtils.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java
@@ -143,8 +143,8 @@
        if (!permissionConfig.check(MenuEnum.XIXUN_PROGRAM_PUSH.getCode())) {
            return ResponseUtil.fail("缺少对应用户权限");
        }
        xiXunPlayerService.videoXixunPlayer(pid, lightemitIds);
        return ResponseUtil.success("推送成功");
        return ResponseUtil.success(xiXunPlayerService.videoXixunPlayer(pid, lightemitIds));
    }
    //执行中的节目
ximon-admin/src/main/java/com/sandu/ximon/admin/service/XiXunPlayerService.java
@@ -77,7 +77,7 @@
                                LedSFile file = xiXunFileService.getById(fileId);
                                String fileUrl = file.getFileUrl();
                                String[] split = fileUrl.split("/");
                                sourcePro.setId(split[split.length-1]);
                                sourcePro.setId(split[split.length - 1]);
                                sourcePro.setMd5(file.getMd5());
                            }
                    );
@@ -168,7 +168,9 @@
     * @param programId
     * @param lightemitIds
     */
    public void videoXixunPlayer(long programId, List<Long> lightemitIds) {
    public List<Map> videoXixunPlayer(long programId, List<Long> lightemitIds) {
        //记录操作结果
        List<Map> mapList = new ArrayList<>();
        ProgramPro pro = new ProgramPro();
        ItemPro items = new ItemPro();
@@ -215,11 +217,29 @@
        Collection<PoleLightemitEntity> poleLightemitEntities = poleLightemitService.listByIds(lightemitIds);
        if (poleLightemitEntities != null) {
            Map map;
            for (PoleLightemitEntity entity : poleLightemitEntities) {
                lightemitUtils.clear(entity.getLightemitControlCode());
                poleLightemitService.updateRequestBody(entity.getLightemitControlCode(), jsondata);
                String post = lightemitUtils.post(realtimeServerBean.getCommand() + entity.getLightemitControlCode(), jsondata);
                LogUtils.error("结果:" + post);
                map = new LinkedHashMap();
                String clearResult = lightemitUtils.clear(entity.getLightemitControlCode());
                if (clearResult.contains("does not exist")) {
                    map.put("LightemitId", entity.getLightemitId());
                    map.put("Result", "失败");
                    mapList.add(map);
                } else {
                    poleLightemitService.updateRequestBody(entity.getLightemitControlCode(), jsondata);
                    String post = lightemitUtils.post(realtimeServerBean.getCommand() + entity.getLightemitControlCode(), jsondata);
                    //{"_type":"success","_id":"ce8dc3ff-dc88-43b7-8f55-60abd8700f1a","timestamp":1653555160535}
                    if (post.startsWith("{") && post.endsWith("}") && post.contains("_type\":\"success")) {
                        map.put("LightemitId", entity.getLightemitId());
                        map.put("Result", "成功");
                        mapList.add(map);
                    } else {
                        map.put("LightemitId", entity.getLightemitId());
                        map.put("Result", "失败");
                        mapList.add(map);
                    }
                    LogUtils.error("结果:" + post);
                }
            }
        }
@@ -239,6 +259,8 @@
        /**
         * 熙汛节目推送日志记录结束
         */
        return mapList;
    }
ximon-admin/src/main/java/com/sandu/ximon/admin/utils/LightemitUtils.java
@@ -112,13 +112,14 @@
     *
     * @param ledCode
     */
    public void clear(String ledCode) {
    public String clear(String ledCode) {
        String postBody = new Gson().toJson(new Clear());
        //请求地址
        String url = realtimeServerBean.getCommand() + ledCode;
        //请求
        String result = post(url, postBody);
        LogUtils.error("清屏结果:" + result);
        return result;
    }
    /**