ConvertLiveBean.java 19 KB
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 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737

package com.wd.foundation.bean.response;

import java.util.ArrayList;
import java.util.List;

import android.text.TextUtils;

import com.wd.foundation.bean.base.BaseBean;
import com.wd.foundation.bean.custom.content.ManuscriptImageBean;
import com.wd.foundation.bean.custom.content.PeopleMasterBean;
import com.wd.foundation.bean.live.RoomDataBean;
import com.wd.foundation.bean.mail.LiveInfo;
import com.wd.foundation.bean.mail.MliveBean;
import com.wd.foundation.bean.mail.ShareInfo;
import com.wd.foundation.bean.mail.VliveBean;
import com.wd.foundation.bean.pop.PopUpsBean;

/**
 * 转化后的直播实体类
 *
 * @author wondertek
 */
public class ConvertLiveBean extends BaseBean {
    /**
     * 内容详情获取,内容详情没有就不传,服务端默认为0
     */
    private String contentRelId = "0";

    /**
     * 内容详情获取,内容详情没有就不传,服务端默认为0
     */
    private String relType = "0";

    /**
     * 封面图
     */
    public String previewPicUrl;

    /**
     * 直播id
     */
    private String liveId;

    private String contentType;

    /**
     * 直播状态 wait待开播running直播中end已结束cancel已取消paused暂停expire过期
     */
    private String status;

    /**
     * 标题
     */
    private String title;

    /**
     * 简介
     */
    private String description;

    /**
     * 简介
     */
    public String newIntroduction;

    /**
     * 预告资源地址
     */
    private String previewSourceUrl;

    /**
     * 预告片类型,0-图片,1-视频
     */
    private int previewType;

    /**
     * 直播和回放资源地址数组(因为有可能是多路直播,所以是个数组)
     */
    private List<VliveBean> liveSourceList;

    /**
     * general-竖屏,news-横屏
     */
    private String liveLandScape;

    /**
     * 计划开播时间
     */
    private String planStartTime;

    /**
     * 开播时间 2023-08-28 10:55:42
     */
    public String startTime;

    private String mliveId;

    private String roomId;

    /**
     * 判断 确定1手机直播--竖屏 2推流直播--横屏 3拉流直播--横屏 4电商直播 (竖屏) 5 是播流直播 6 是多路直播
     */
    private int tplId;

    /**
     * 1、普通2、VR 为埋点做准备
     */
    private String liveStreamType = "";

    /**
     * 分享字段【BFF聚合】
     */
    private ShareInfo shareInfo;

    /**
     * 直播 创建人id
     */

    private String createUserId;

    /**
     * 直播 创建人名称
     */
    private String createUserName;

    /**
     * 直播 垫片 url
     */
    private String padImageUri;

    /**
     * 彩蛋信息
     */
    private List<PopUpsBean> popUps;

    /**
     * 是否有彩蛋 0-无 1-有
     */
    private String hasPopUp;

    /**
     * 【迭代三】是否Vr,0:否,1:是
     */
    private boolean vrType = false;

    /**
     * 人民号内容
     */
    private PeopleMasterBean rmhInfo;

    /**
     * 房间人次数信息
     */
    private RoomDataBean roomDataBean;

    private MliveBean mliveBean;

    /**
     * 直播公告
     */
    private String notice;

    // 是否开启评论 1是 0否
    private int openComment;

    // 点赞样式 Love爱心型 thumb点赞手势 pray 祈福 buddha 佛手
    private String likesStyle;

    // 是否开启点赞 1是 0否
    private int likeEnable;

    // 内容预评论显示开关;1显示 0隐藏
    private int preCommentFlag;

    // 直播样式 0-正常模式,1-隐藏直播 2-隐藏大家聊
    private int liveStyle;

    // 背景样式 0-蓝色 1-红色 2-黑色
    private int backgroundStyle;

    // 直播类型 0-视频直播,1-文字直播
    private int liveWay;

    // 是否开启挂角 true:开启 false:关闭
    private boolean handAngleSwitch;

    // 挂角图片url
    private String handAngleImageUri;

    // 挂角链接
    private String handAngleLink;

    /**
     * 稿件封面图地址【BFF聚合】
     */
    private List<ManuscriptImageBean> fullColumnImgUrls;

    private NewsDetailBean newsDetailBean;

    /**
     * 文字直播的封面地址
     */
    private String TextLiveCover = "";

    /**
     * 本地数据,人民号直播单个直播流地址
     */
    private GetPullAddressBean getPullAddressBean;

    /**
     * 本地数据,人民号直播多个直播流地址
     */
    private List<GetPullAddressBean> getPullAddressBeanList;

    /**
     * 直播背景图的 已经部署到dev了,客户端可以加下
     */
    public LiveInfo.BackgroundBean background;

    /**
     * 1 开启,2 关闭
     */
    private int bestNoticer = 2;

    /**
     * 直播间,当前用户被禁言
     */
    public boolean barrageEnable;

    private String fromPage;

    public String getFromPage() {
        return fromPage;
    }

    public void setFromPage(String fromPage) {
        this.fromPage = fromPage;
    }

    public boolean unBarrageAndCanComment() {
        return !barrageEnable && openComment == 1;
    }

    public List<GetPullAddressBean> getGetPullAddressBeanList() {
        return getPullAddressBeanList;
    }

    public void setGetPullAddressBeanList(List<GetPullAddressBean> getPullAddressBeanList) {
        this.getPullAddressBeanList = getPullAddressBeanList;
    }

    public GetPullAddressBean getGetPullAddressBean() {
        return getPullAddressBean;
    }

    public void setGetPullAddressBean(GetPullAddressBean getPullAddressBean) {
        this.getPullAddressBean = getPullAddressBean;
    }

    public NewsDetailBean getNewsDetailBean() {
        return newsDetailBean;
    }

    public boolean isHandAngleSwitch() {
        return handAngleSwitch;
    }

    public void setHandAngleSwitch(boolean handAngleSwitch) {
        this.handAngleSwitch = handAngleSwitch;
    }

    public String getHandAngleImageUri() {
        return handAngleImageUri;
    }

    public void setHandAngleImageUri(String handAngleImageUri) {
        this.handAngleImageUri = handAngleImageUri;
    }

    public String getHandAngleLink() {
        return handAngleLink;
    }

    public void setHandAngleLink(String handAngleLink) {
        this.handAngleLink = handAngleLink;
    }

    // 处理获取封面地址
    public String getTextLiveCover() {
        return TextLiveCover;
    }

    public int getBestNoticer() {
        return bestNoticer;
    }

    public void setBestNoticer(int bestNoticer) {
        this.bestNoticer = bestNoticer;
    }

    public List<ManuscriptImageBean> getFullColumnImgUrls() {
        return fullColumnImgUrls;
    }

    public void setFullColumnImgUrls(List<ManuscriptImageBean> fullColumnImgUrls) {
        for (ManuscriptImageBean manuscriptImageBean : fullColumnImgUrls) {
            if (manuscriptImageBean.landscape == 1 && !TextUtils.isEmpty(manuscriptImageBean.url)) {
                TextLiveCover = manuscriptImageBean.url;
            }
        }
        this.fullColumnImgUrls = fullColumnImgUrls;
    }

    public String getContentRelId() {
        return contentRelId;
    }

    public void setContentRelId(String contentRelId) {
        this.contentRelId = contentRelId;
    }

    public String getRelType() {
        return relType;
    }

    public void setRelType(String relType) {
        this.relType = relType;
    }

    public int getLiveStyle() {
        return liveStyle;
    }

    public void setLiveStyle(int liveStyle) {
        this.liveStyle = liveStyle;
    }

    public int getBackgroundStyle() {
        return backgroundStyle;
    }

    public void setBackgroundStyle(int backgroundStyle) {
        this.backgroundStyle = backgroundStyle;
    }

    public int getLiveWay() {
        return liveWay;
    }

    public void setLiveWay(int liveWay) {
        this.liveWay = liveWay;
    }

    public int getOpenComment() {
        return openComment;
    }

    public void setOpenComment(int openComment) {
        this.openComment = openComment;
    }

    public String getLikesStyle() {
        return likesStyle;
    }

    public void setLikesStyle(String likesStyle) {
        this.likesStyle = likesStyle;
    }

    public int getPreCommentFlag() {
        return preCommentFlag;
    }

    public void setPreCommentFlag(int preCommentFlag) {
        this.preCommentFlag = preCommentFlag;
    }

    public int getLikeEnable() {
        return likeEnable;
    }

    public void setLikeEnable(int likeEnable) {
        this.likeEnable = likeEnable;
    }

    public String getNotice() {
        return notice;
    }

    public void setNotice(String notice) {
        this.notice = notice;
    }

    public String getLiveLandScape() {
        return liveLandScape;
    }

    public void setLiveLandScape(String liveLandScape) {
        this.liveLandScape = liveLandScape;
    }

    public MliveBean getMliveBean() {
        return mliveBean;
    }

    public void setMliveBean(MliveBean mliveBean) {
        this.mliveBean = mliveBean;
    }

    public RoomDataBean getRoomDataBean() {
        return roomDataBean;
    }

    public void setRoomDataBean(RoomDataBean roomDataBean) {
        this.roomDataBean = roomDataBean;
    }

    public PeopleMasterBean getRmhInfo() {
        return rmhInfo;
    }

    public void setRmhInfo(PeopleMasterBean rmhInfo) {
        this.rmhInfo = rmhInfo;
    }

    public boolean isVrType() {
        return vrType;
    }

    public void setVrType(boolean vrType) {
        this.vrType = vrType;
    }

    public String getHasPopUp() {
        return hasPopUp;
    }

    public void setHasPopUp(String hasPopUp) {
        this.hasPopUp = hasPopUp;
    }

    /**
     * 是否有彩蛋
     *
     * @return
     */
    public boolean isHasPopUp() {
        return Integer.parseInt(hasPopUp) == 1;
    }

    public List<PopUpsBean> getPopUps() {
        return popUps;
    }

    public void setPopUps(List<PopUpsBean> popUps) {
        this.popUps = popUps;
    }

    public String getPadImageUri() {
        return padImageUri;
    }

    public void setPadImageUri(String padImageUri) {
        this.padImageUri = padImageUri;
    }

    public String getCreateUserId() {
        return createUserId;
    }

    public void setCreateUserId(String createUserId) {
        this.createUserId = createUserId;
    }

    public String getCreateUserName() {
        return createUserName;
    }

    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }

    public String getLiveStreamType() {
        return liveStreamType;
    }

    public void setLiveStreamType(String liveStreamType) {
        this.liveStreamType = liveStreamType;
    }

    public int getTplId() {
        return tplId;
    }

    public void setTplId(int tplId) {
        this.tplId = tplId;
    }

    public String getContentType() {
        return contentType;
    }

    public void setContentType(String contentType) {
        this.contentType = contentType;
    }

    public String getLiveId() {
        return liveId;
    }

    public void setLiveId(String liveId) {
        this.liveId = liveId;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getTitle() {
        // if (title.length() > 15) {
        // title = title.substring(0, 14) + "...";
        // return title;
        // }
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getPreviewSourceUrl() {
        return previewSourceUrl;
    }

    public void setPreviewSourceUrl(String previewSourceUrl) {
        this.previewSourceUrl = previewSourceUrl;
    }

    public int getPreviewType() {
        return previewType;
    }

    public void setPreviewType(int previewType) {
        this.previewType = previewType;
    }

    public String getPlanStartTime() {
        return planStartTime;
    }

    public void setPlanStartTime(String planStartTime) {
        this.planStartTime = planStartTime;
    }

    public ShareInfo getShareInfo() {
        return shareInfo;
    }

    public void setShareInfo(ShareInfo shareInfo) {
        this.shareInfo = shareInfo;
    }

    public String getMliveId() {
        return mliveId;
    }

    public void setMliveId(String mliveId) {
        this.mliveId = mliveId;
    }

    public String getRoomId() {
        return roomId;
    }

    public void setRoomId(String roomId) {
        this.roomId = roomId;
    }

    public List<VliveBean> getLiveSourceList() {
        return liveSourceList;
    }

    public void setLiveSourceList(List<VliveBean> liveSourceList) {
        this.liveSourceList = liveSourceList;
    }

    public ConvertLiveBean(String liveId) {
        this.liveId = liveId;
        this.contentType = contentType;
        this.status = "wait";
        this.title = "云守护|春暖花开,又见神鸟出没林间,“东方宝石”朱鹮云守护|春暖花开,又见神鸟出没林间,“东方宝石”朱鹮";
        this.description = "云守护|春暖花开,又见神鸟出没林间,“东方宝石”朱鹮云守护|春暖花开,又见神鸟出没林间,“东方宝石”朱鹮";
        this.previewSourceUrl = "https://live.video.weibocdn.com/4898082770127687_index.m3u8";
        this.previewType = 1;
        this.liveSourceList = new ArrayList<>();
        liveSourceList.add(new VliveBean("2312"));
        this.planStartTime = "1683700913";
        this.mliveId = 20000000886L + "";
        this.roomId = "e825b8ad-3bd0-422a-ab35-39f73d742c15";
        this.tplId = 5;
        this.liveStreamType = "1";
        this.shareInfo = null;
        this.createUserId = "1311";
        this.createUserName = "createUserName测试直播房主";
        this.padImageUri = padImageUri;
        this.popUps = popUps;
        this.hasPopUp = "0";
        this.vrType = false;
    }

    public ConvertLiveBean(NewsDetailBean mContentBean, LiveInfo mOriginalLiveInfo, String relType, String relId,
        String coverUrl) {
        startTime = mOriginalLiveInfo.getStartTime();
        background = mOriginalLiveInfo.getBackground();
        // 详情页原始数据
        newsDetailBean = mContentBean;
        ShareInfo shareInfo = mContentBean.getShareInfo();
        if (shareInfo != null) {
            setShareInfo(shareInfo);
        }
        setLiveId(mContentBean.getNewsId());
        setContentType(mContentBean.getNewsType());
        // 详情标题
        setTitle(mContentBean.getNewsTitle());
        setDescription(mContentBean.getNewsSummary());
        // 预约直播详情页简介 fixme 待设置简介
        newIntroduction = mContentBean.getNewIntroduction();
        setRelType(relType);
        setContentRelId(relId);
        // 兼容旧直播间没有这个字段
        if (!isBlank(mOriginalLiveInfo.getTplId())) {
            setTplId(Integer.valueOf(mOriginalLiveInfo.getTplId()));
        }
        // 兼容旧直播间没有这个字段
        if (!isBlank(mOriginalLiveInfo.getCreateUserId())) {
            setCreateUserId(mOriginalLiveInfo.getCreateUserId());
        }
        // 兼容旧直播间没有这个字段
        if (!isBlank(mOriginalLiveInfo.getCreateUserName())) {
            setCreateUserName(mOriginalLiveInfo.getCreateUserName());
        }
        // 兼容旧直播间没有这个字段
        if (!isBlank(mOriginalLiveInfo.getPadImageUri())) {
            setPadImageUri(mOriginalLiveInfo.getPadImageUri());
        }
        // 兼容旧直播间没有这个字段 彩蛋信息
        if (mContentBean.getPopUps() != null && mContentBean.getPopUps().size() > 0) {
            setPopUps(mContentBean.getPopUps());
        }
        // 兼容旧直播间没有这个字段 彩蛋 是否展示
        if (!isBlank(mContentBean.getHasPopUp())) {
            setHasPopUp(mContentBean.getHasPopUp());
        }
        // 兼容旧直播间没有这个字段 房主信息
        if (mContentBean.getRmhInfo() != null) {
            setRmhInfo(mContentBean.getRmhInfo());
        }
        // //兼容旧直播间没有这个字段 直播公告
        // if (mContentBean.getLiveInfo() != null && mContentBean.getLiveInfo().getNotice() != null ) {
        //// setNotice("直播公告" + mContentBean.getLiveInfo().getNotice());
        // }
        // 兼容旧直播间没有这个字段 直播样式
        setLiveStyle(mOriginalLiveInfo.getLiveStyle());
        // 兼容旧直播间没有这个字段 直播类型
        setLiveWay(mOriginalLiveInfo.getLiveWay());
        // 兼容旧直播间没有这个字段 背景样式
        setBackgroundStyle(mOriginalLiveInfo.getBackgroundStyle());
        setOpenComment(mOriginalLiveInfo.getOpenComment());
        setLikesStyle(mOriginalLiveInfo.getLikesStyle());
        setPreCommentFlag(mOriginalLiveInfo.getPreCommentFlag());
        setLikeEnable(mOriginalLiveInfo.getLikeEnable());
        // 兼容旧直播间没有这个字段 文字直播用的封面地址
        if (mContentBean.getFullColumnImgUrls() != null && mContentBean.getFullColumnImgUrls().size() > 0) {
            setFullColumnImgUrls(mContentBean.getFullColumnImgUrls());
        } else {
            if (!TextUtils.isEmpty(coverUrl)) {
                List<ManuscriptImageBean> manuscriptImageBeans = new ArrayList<>();
                ManuscriptImageBean manuscriptImageBean = new ManuscriptImageBean();
                manuscriptImageBean.landscape = 1;
                manuscriptImageBean.url = coverUrl;
                manuscriptImageBeans.add(manuscriptImageBean);
                setFullColumnImgUrls(manuscriptImageBeans);
            }
        }
        // 兼容旧直播间没有这个字段 直播 是否Vr 是否展示
        setVrType(mOriginalLiveInfo.getVrType() == 1);
        MliveBean mMliveBean = mOriginalLiveInfo.getMlive();
        if (mMliveBean != null) {
            setMliveId(mMliveBean.getMliveId());
            setRoomId(mMliveBean.getRoomId());
            setMliveBean(mMliveBean);
        }
        String liveStatus = getStringValue(mOriginalLiveInfo.getLiveState());
        setStatus(liveStatus);
        // 兼容旧直播间没有这个字段 是否开启挂角 true:开启 false:关闭
        setHandAngleSwitch(mOriginalLiveInfo.isHandAngleSwitch());
        // 兼容旧直播间没有这个字段 挂角图片url
        setHandAngleImageUri(mOriginalLiveInfo.getHandAngleImageUri());
        // 兼容旧直播间没有这个字段 挂角链接
        setHandAngleLink(mOriginalLiveInfo.getHandAngleLink());
    }

    /**
     * 获取字符串字段的值,已做非空判断
     *
     * @param value
     * @return
     */
    public static String getStringValue(String value) {
        if (isBlank(value)) {
            return "";
        } else {
            return value;
        }
    }

    /**
     * 判断字符串是否为空或者空字符串 如果字符串是空或空字符串则返回true,否则返回false。也可以使用Android自带的TextUtil
     */
    private static boolean isBlank(String value) {
        return null == value || 0 == value.length() || "".equals(value.trim());
    }

}