2021与蓝度共同重构项目,服务端
liuhaonan
2022-03-14 228d1be133e0fd2f1f46a29af8bc9cbda3d18d74
ximon-admin/src/main/java/com/sandu/ximon/admin/utils/LightemitUtils.java
@@ -15,6 +15,10 @@
import java.io.IOException;
/**
 * 熙讯屏幕控制
 */
@Component
public class LightemitUtils {
    @Autowired
@@ -32,7 +36,7 @@
    private OkHttpClient client = new OkHttpClient();
    public void init(){
    public void init() {
        //重新获取单例
        poleLightemitService = applicationContext.getBean(PoleLightemitService.class);
    }
@@ -117,7 +121,7 @@
        //请求
//        poleLightemitService.updateRequestBody(ledCode, "");
        String result = post(url, postBody);
        LogUtils.error("清屏结果:"+result);
        LogUtils.error("清屏结果:" + result);
    }
    /**
@@ -138,12 +142,14 @@
        //请求
        String result = post(url, postBody);
    }
    /**
     * html传输至led屏, 通过url获取html
     *
     * @param ledCode
     * @param username
     */
    public void postHtmlUseNginx(String ledCode, String username){
    public void postHtmlUseNginx(String ledCode, String username) {
        PostHtml postHtml = new PostHtml(nginxConfigBean.getUrl() + username + "_" + ledCode + ".html");
        String postBody = new Gson().toJson(postHtml);
@@ -153,11 +159,12 @@
        //保存led数据
        poleLightemitService.updateRequestBody(ledCode, postBody);
        //请求
        String result =  post(url,postBody);
        String result = post(url, postBody);
    }
    /**
     * 视频传输至led屏
     *
     * @param screenWidth
     * @param screenHeight
     * @param filename
@@ -175,12 +182,12 @@
        //led开发板视频列表请求body
        SetPlayList setPlayList = new SetPlayList();
        setPlayList.list[0] = "/data/data/com.xixun.xy.conn/files/local/abc/"+filename;
        setPlayList.list[0] = "/data/data/com.xixun.xy.conn/files/local/abc/" + filename;
//        setPlayList.pathList[0] = "";
        try{
        try {
            setPlayList.width = Integer.valueOf(screenWidth);
            setPlayList.height = Integer.valueOf(screenHeight);
        }catch (Exception e){
        } catch (Exception e) {
            return;
        }
        String postBody = new Gson().toJson(setPlayList);
@@ -192,12 +199,13 @@
    /**
     * led屏字幕设置
     *
     * @param subTitleSet
     * @param ledCode
     */
    public void subTitleSet(SubTitleSet subTitleSet, String ledCode, Boolean isSave){
        String postBody =  new Gson().toJson(subTitleSet);
        if(isSave == true){
    public void subTitleSet(SubTitleSet subTitleSet, String ledCode, Boolean isSave) {
        String postBody = new Gson().toJson(subTitleSet);
        if (isSave == true) {
            poleLightemitService.updateRequestBody(ledCode, postBody);
        }
        this.post(realtimeServerBean.getCommand() + ledCode, postBody);
@@ -334,24 +342,24 @@
        //请求
        String result = post(realtimeServerBean.getCommand() + ledCode, postBody);
        LogUtils.error("设置结果:-------------------"+result);
        LogUtils.error("设置结果:-------------------" + result);
    }
//    获取led音量
    public String getVoiume(String ledCode){
    //    获取led音量
    public String getVoiume(String ledCode) {
        GetVolume getVolume = new GetVolume();
        String postBody = new Gson().toJson(getVolume);
        //请求
        String result =  post(realtimeServerBean.getCommand() + ledCode,postBody);
        String result = post(realtimeServerBean.getCommand() + ledCode, postBody);
        //请求
        if(StringUtils.isNotBlank(result)){
            try{
        if (StringUtils.isNotBlank(result)) {
            try {
                return JSONObject.parseObject(result).get("result").toString();
            }catch (Exception e){
            } catch (Exception e) {
                return "0";
            }
        }else{
        } else {
            return "0";
        }
    }