2021与蓝度共同重构项目,服务端
liuhaonan
2022-08-04 681d31e1de290eebd5f5ecb0a0e07a2a66cd01ae
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
package com.sandu.ximon.admin.dto.nova;
 
import com.sandu.ximon.admin.config.VnnoxConstant;
import com.sandu.ximon.dao.domain.LEDProgramFile;
import lombok.Data;
 
import java.util.ArrayList;
import java.util.List;
 
@Data
public class PlayerWidget {
    //  组件名称,用于日志查询使用,若不填写,日志查询时很难区分
    private String name;
    //  组件类型
    //PICTURE - 图片
    //VIDEO-视频
    //ARCH_TEXT- 文本
    //SIMPLE_RSS - rss媒体
    //HTML - 网页媒体
    //STREAM_MEDIA - 流媒体
    //BOX - 窗口
    //WEATHER - 简易天气组件
    private PlayerWidgetType type;
    //  图片和视频为必填项,内容为图片或视频的md5值
    private String md5;
    //  图片或视频的大小byte
    private PlayerWidgetDisplayType displayType;
    //    文字整体背景颜色,#00000000代表透明色
    private String backgroundColor;
    //  当播放方式为“滚动”时必填
    private PlayerWidgetScrollAttribute scrollAttribute;
    //  多行文字显示集合
    private List<PlayerWidgetLine> lines;
    //  图片或视频的大小byte
    private Long size;
    //  组件的播放时长,精确到毫秒
    private Long duration;
    //  图片\视频\rss\网页媒体\流媒体的访问地址, 需要自行验证地址的有效性
    private String url;
    //  组件的上下覆盖顺序,数字越大图层越往上,默认0
    private Integer zIndex;
    //  组件在页面的位置
    private PlayerLayout layout;
    //  组件的入场特效,默认无特效
    private PlayerAnimation inAnimation;
    //  窗口的内容,类型为窗口时必填,参考Widget的属性,也可以参考下面的示例
    private List<PlayerMedia> mediaList;
    //  html组件离线播放媒体(定制功能)
    private PlayerOffline offline;
 
 
    private String address;
 
    private Double latitude;
 
    private Double longitude;
 
    private Integer width;
 
    private Integer height;
 
    private Integer refreshPeriod;
 
    private Integer fontSize;
 
    private Boolean bold;
 
    private Boolean italic;
 
    private Boolean underline;
 
    private String color;
 
    private Integer tempUnit;
 
    private Integer unitSymbol;
 
    private Boolean weatherEnable;
 
    private Boolean tempEnable;
 
    private Boolean windEnable;
 
    private Boolean humidEnable;
 
    private Boolean currentTempEnable;
 
    private Boolean isShowInOneLine;
 
 
    public PlayerWidget generateMediaWidget(String widgetName,
                                            Integer zIndex,
                                            PlayerWidgetType playerWidgetType,
                                            LEDProgramFile file,
                                            PlayerLayout playerLayout,
                                            PlayerAnimation animation) {
        this.setName(widgetName);
        this.setZIndex(zIndex);
        this.setType(playerWidgetType);
        this.setSize(Long.getLong(file.getSize()));
        this.setMd5(file.getMd5());
        this.setDuration(VnnoxConstant.REDIS_MAX_SAVE_TIME);
        this.setUrl(file.getFileUrl());
        this.setLayout(playerLayout);
        this.setInAnimation(animation);
        return this;
    }
 
    public PlayerWidget generateScrollUpTextWidget(String widgetName,
                                                   Integer zIndex,
                                                   Long duration,
                                                   List<String> content,
                                                   String contentColor,
                                                   Integer fontSize,
                                                   PlayerLayout playerLayout) {
        this.setName(widgetName);
        this.setZIndex(zIndex);
        this.setType(PlayerWidgetType.ARCH_TEXT);
        this.setDisplayType(PlayerWidgetDisplayType.SCROLL);
        this.setBackgroundColor("#00000000");
        this.setScrollAttribute(
                new PlayerWidgetScrollAttribute(
                        PlayerWidgetScrollAttributeAnimation.MARQUEE_UP, 1
                )
        );
        this.setDuration(duration);
 
 
        List<PlayerWidgetLine> playerWidgetLineList = new ArrayList<>();
 
        for (String str : content) {
            PlayerWidgetLine playerWidgetLine = new PlayerWidgetLine();
            List<PlayerWidgetLineTextAttributes> playerWidgetLineTextAttributesList =
                    new ArrayList<>();
            PlayerWidgetLineTextAttributes playerWidgetLineTextAttributes =
                    new PlayerWidgetLineTextAttributes();
            playerWidgetLineTextAttributes.setContent(str);
            playerWidgetLineTextAttributes.setTextColor(contentColor);  //  "#337FE5"
            playerWidgetLineTextAttributes.setFontSize(fontSize);
            playerWidgetLineTextAttributes.setBold(true);
            playerWidgetLineTextAttributes.setUnderline(false);
            playerWidgetLineTextAttributesList.add(playerWidgetLineTextAttributes);
            playerWidgetLine.setTextAttributes(playerWidgetLineTextAttributesList);
            playerWidgetLineList.add(playerWidgetLine);
        }
 
        this.setLines(playerWidgetLineList);
        this.setLayout(playerLayout);
        return this;
    }
 
    public PlayerWidget generateLeftScrollTextWidget(
            String widgetName,
            Integer zIndex,
            Long duration,
            String content,
            String contentColor,
            Integer fontSize,
            PlayerLayout playerLayout
    ) {
        this.setName(widgetName);
        this.setZIndex(zIndex);
        this.setType(PlayerWidgetType.ARCH_TEXT);
        this.setDisplayType(PlayerWidgetDisplayType.SCROLL);
        this.setBackgroundColor("#00000000");
        this.setScrollAttribute(
                new PlayerWidgetScrollAttribute(
                        PlayerWidgetScrollAttributeAnimation.MARQUEE_LEFT, 2
                )
        );
        this.setDuration(duration);
        List<PlayerWidgetLine> playerWidgetLineList = new ArrayList<>();
 
        List<PlayerWidgetLineTextAttributes> playerWidgetLineTextAttributesList =
                new ArrayList<>();
        PlayerWidgetLine playerWidgetLine = new PlayerWidgetLine();
 
        PlayerWidgetLineTextAttributes playerWidgetLineTextAttributes =
                new PlayerWidgetLineTextAttributes();
        playerWidgetLineTextAttributes.setContent(content);
        playerWidgetLineTextAttributes.setTextColor(contentColor);  //  "#337FE5"
        playerWidgetLineTextAttributes.setFontSize(fontSize);
        playerWidgetLineTextAttributes.setBold(true);
 
        playerWidgetLineTextAttributesList.add(playerWidgetLineTextAttributes);
        playerWidgetLine.setTextAttributes(playerWidgetLineTextAttributesList);
 
        playerWidgetLineList.add(playerWidgetLine);
        this.setLines(playerWidgetLineList);
        this.setLayout(playerLayout);
        return this;
    }
 
 
 
 
}