Example #1
0
  public List<Long> getAllCampaignId() {
    try {
      CampaignService campaignService = commonService.getService(CampaignService.class);

      GetAllCampaignIdRequest request = new GetAllCampaignIdRequest();
      GetAllCampaignIdResponse response = campaignService.getAllCampaignId(request);

      return response.getCampaignIds();
    } catch (final Exception e) {
      e.printStackTrace();
    }

    return Collections.emptyList();
  }
Example #2
0
  /**
   * 推广计划更新
   *
   * @param list 推广计划列表
   * @return
   * @throws ApiException
   */
  public List<CampaignType> updateCampaign(List<CampaignType> list) throws ApiException {
    if (list == null || list.isEmpty()) {
      return Collections.emptyList();
    }

    UpdateCampaignRequest request = new UpdateCampaignRequest();
    request.setCampaignTypes(list);

    CampaignService campaignService = commonService.getService(CampaignService.class);
    UpdateCampaignResponse response = campaignService.updateCampaign(request);
    if (response == null) return Collections.emptyList();

    return response.getCampaignTypes();
  }
Example #3
0
 public List<CampaignType> getCampaignById(List<Long> camIds) {
   try {
     CampaignService campaignService = commonService.getService(CampaignService.class);
     GetCampaignByCampaignIdRequest request = new GetCampaignByCampaignIdRequest();
     request.setCampaignIds(camIds);
     GetCampaignByCampaignIdResponse response = campaignService.getCampaignByCampaignId(request);
     if (response == null) {
       return Collections.emptyList();
     }
     return response.getCampaignTypes();
   } catch (final Exception e) {
     e.printStackTrace();
   }
   return Collections.emptyList();
 }
Example #4
0
  public List<CampaignType> getAllCampaign() {
    try {
      CampaignService campaignService = commonService.getService(CampaignService.class);

      GetAllCampaignRequest getAllCampaignRequest = new GetAllCampaignRequest();
      GetAllCampaignResponse response = campaignService.getAllCampaign(getAllCampaignRequest);
      if (response == null) {
        return Collections.emptyList();
      }
      return response.getCampaignTypes();
    } catch (final Exception e) {
      e.printStackTrace();
    }

    return Collections.emptyList();
  }
Example #5
0
  // ============================== DELETE ==============================
  public Integer deleteCampaign(List<Long> campaignIds) throws ApiException {
    DeleteCampaignRequest request = new DeleteCampaignRequest();
    request.setCampaignIds(campaignIds);

    CampaignService campaignService = commonService.getService(CampaignService.class);
    DeleteCampaignResponse response = campaignService.deleteCampaign(request);
    if (response == null) {
      try {
        TimeUnit.SECONDS.sleep(3);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }

      if (response != null) return response.getResult();
    }

    return -1;
  }
Example #6
0
  // ============================== ADD ==============================
  public List<CampaignType> addCampaign(List<CampaignType> list) throws ApiException {
    AddCampaignRequest request = new AddCampaignRequest();
    request.setCampaignTypes(list);

    CampaignService campaignService = commonService.getService(CampaignService.class);
    AddCampaignResponse response = campaignService.addCampaign(request);
    if (response == null) {
      try {
        TimeUnit.SECONDS.sleep(3);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }

      if (response != null) return response.getCampaignTypes();
    }

    return Collections.emptyList();
  }