Пример #1
0
  /**
   * 变更MDN
   *
   * @param resources 资源
   * @param serviceTagId 服务标签ID
   * @param changeDescription 变更描述
   * @param coverArea 重点覆盖地域
   * @param coverIsp 重点覆盖ISP
   */
  @Transactional(readOnly = false)
  public void saveResourcesByMdn(
      Resources resources,
      Integer serviceTagId,
      String changeDescription,
      String coverArea,
      String coverIsp) {

    /* 新增或更新资源Resources的服务变更Change. */

    Change change = comm.changeServcie.saveOrUpdateChangeByResources(resources, changeDescription);

    MdnItem mdnItem = this.getMdnItem(resources.getServiceId());

    /* 比较资源变更前和变更后的值. */

    boolean isChange =
        comm.compareResourcesService.compareMdnItem(
            resources, change, mdnItem, coverArea, coverIsp);

    ServiceTag serviceTag = comm.serviceTagService.getServiceTag(serviceTagId);

    // 当资源有更改的时候,更改状态.如果和资源不相关的如:服务标签,指派人等变更,则不变更资源的状态.
    if (isChange) {
      serviceTag.setStatus(ResourcesConstant.Status.已变更.toInteger());
      resources.setStatus(ResourcesConstant.Status.已变更.toInteger());
    }
    resources.setServiceTag(serviceTag);
    comm.serviceTagService.saveOrUpdate(serviceTag);

    mdnItem.setCoverArea(coverArea);
    mdnItem.setCoverIsp(coverIsp);

    this.saveOrUpdate(mdnItem);

    // 更新resources

    comm.resourcesService.saveOrUpdate(resources);
  }
Пример #2
0
  /**
   * @param apply 服务申请
   * @param coverArea 覆盖地区
   * @param coverIsp 覆盖ISP
   * @param vodDomains 点播域名数组
   * @param vodBandwidths 点播加速服务带宽(含单位)数组
   * @param vodProtocols 播放协议数组
   * @param sourceOutBandwidths 源站出口带宽(含单位)数组
   * @param sourceStreamerUrls 源站Streamer公网地址 数组
   * @param liveDomains 直播服务域名数组
   * @param liveBandwidths 直播加速服务带宽(含单位)数组
   * @param liveProtocols 播放协议数组
   * @param bandwidths 出口带宽(含单位)数组
   * @param channelNames 频道名称数组
   * @param channelGUIDs 频道GUID数组
   * @param streamOutModes 直播流输出模式:1-Encoder模式;2-Transfer模式 数组
   * @param encoderModes 编码器模式:1-HTTP拉流;2-RTMP推流 数组
   * @param httpUrls HTTP流地址 数组
   * @param httpBitrates HTTP流混合码率数组
   * @param hlsUrls M3U8流地址数组
   * @param hlsBitrates M3U8流混合码率数组
   */
  @Transactional(readOnly = false)
  public void saveMdnToApply(
      Apply apply,
      String coverArea,
      String coverIsp,
      // vod
      String[] vodDomains,
      String[] vodBandwidths,
      String[] vodProtocols,
      String[] sourceOutBandwidths,
      String[] sourceStreamerUrls
          // live
          ,
      String[] liveDomains,
      String[] liveBandwidths,
      String[] liveProtocols,
      String[] bandwidths,
      String[] channelNames,
      String[] channelGUIDs,
      String[] streamOutModes,
      String[] encoderModes,
      String[] httpUrls,
      String[] httpBitrates,
      String[] hlsUrls,
      String[] hlsBitrates) {

    // Step1. 创建一个服务申请Apply

    comm.applyService.saveApplyByServiceType(apply, ApplyConstant.ServiceType.MDN.toInteger());

    // Step2. 创建一个MDN.

    MdnItem mdnItem = new MdnItem();
    mdnItem.setApply(apply);
    mdnItem.setCoverArea(coverArea);
    mdnItem.setCoverIsp(coverIsp);
    mdnItem.setIdentifier(
        comm.applyService.generateIdentifier(ResourcesConstant.ServiceType.MDN.toInteger()));
    this.saveOrUpdate(mdnItem);

    // Step2. 创建vod MDN.

    this.saveMdnVodItem(
        mdnItem, vodDomains, vodBandwidths, vodProtocols, sourceOutBandwidths, sourceStreamerUrls);

    // Step3. 创建live MDN.

    this.saveMdnLiveItem(
        mdnItem,
        liveDomains,
        liveBandwidths,
        liveProtocols,
        bandwidths,
        channelNames,
        channelGUIDs,
        streamOutModes,
        encoderModes,
        httpUrls,
        httpBitrates,
        hlsUrls,
        hlsBitrates);
  }