Skip to content

Commit

Permalink
Merge pull request #3 from Hyq0719/feature/hyq/2022/02/vivo
Browse files Browse the repository at this point in the history
Feature/hyq/2022/02/vivo
  • Loading branch information
黄悦麒 authored Feb 8, 2022
2 parents 508fe2c + ed393ef commit 2cabb00
Show file tree
Hide file tree
Showing 97 changed files with 12,163 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public static void parseBaseEntity(Map<String, List<BaseEntity>> map, BaseEntity
baseEntity.setType(TYPE_MAP.get(type));
return;
}
if (OBJECT_TYPE_SET.contains(type)) {
if (OBJECT_TYPE_SET.contains(type) || type.endsWith("Dto")) {
String className = GeneratorUtils.toUpperCaseFirstOne(baseEntity.getCamelProperty() + "Struct");

SingleFileEntity sfe = new SingleFileEntity();
Expand Down Expand Up @@ -171,7 +171,7 @@ public static void parseBaseEntity(Map<String, List<BaseEntity>> map, BaseEntity
baseEntity.setType(TYPE_MAP.get(type));
return;
}
if (OBJECT_TYPE_SET.contains(type)) {
if (OBJECT_TYPE_SET.contains(type) || type.endsWith("Dto")) {
String className;
if ("items".equals(camelProperty)) {
className = GeneratorUtils.toUpperCaseFirstOne(classPrefix + "ItemsStruct");
Expand Down Expand Up @@ -283,6 +283,7 @@ private static Map<String, String> getTypeMap() {
map.put("double", "Double");
map.put("Double", "Double");
map.put("file", "File");
map.put("Decimal", "BigDecimal");

// 集合
map.put("number[]", "List<Long>");
Expand Down Expand Up @@ -318,6 +319,7 @@ private static Set<String> getObjectTypeSet() {
set.add("list");
set.add("List");
set.add("对象列表");
set.add("PageInfo");
return set;
}

Expand All @@ -338,22 +340,30 @@ private static void addImportList(BaseEntity entity, SingleFileEntity sfe) {
if (importList == null) {
importList = new ArrayList<>();
}
if (importList.contains("import java.util.List")) {
return;
if (!importList.contains("import java.util.List")) {
importList.add("import java.util.List");
sfe.importList(importList);
}
importList.add("import java.util.List");
sfe.importList(importList);
}
if (entity.getType().contains("file")) {
List<String> importList = sfe.getImportList();
if (importList == null) {
importList = new ArrayList<>();
}
if (importList.contains("import java.io.File")) {
return;
if (!importList.contains("import java.io.File")) {
importList.add("import java.io.File");
sfe.importList(importList);
}
}
if (entity.getType().contains("Decimal")) {
List<String> importList = sfe.getImportList();
if (importList == null) {
importList = new ArrayList<>();
}
if (!importList.contains("import java.math.BigDecimal")) {
importList.add("import java.math.BigDecimal;");
sfe.importList(importList);
}
importList.add("import java.io.File");
sfe.importList(importList);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static CrawlerResult handleRequestAndResponse(WebDriver driver) {
crawlerResult.setClassPrefix(entityPrefix);

List<WebElement> tableElements = driver.findElements(By.tagName("table"));
if (tableElements.size() < 2) {
if (tableElements.size() < Math.max(requestTableLoc, responseTableLoc)) {
throw new RuntimeException("Crawler <table> size error");
}
if (requestTableLoc != -1) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
package com.hyq0719.mktapi.vivo.api;

import com.hyq0719.mktapi.common.ApiClient;
import com.hyq0719.mktapi.common.RetryStrategy;
import com.hyq0719.mktapi.common.annotation.ApiRequestMapping;
import com.hyq0719.mktapi.common.constant.RequestConstants;
import com.hyq0719.mktapi.common.executor.parameter.Pair;
import com.hyq0719.mktapi.vivo.VivoApiRequest;
import com.hyq0719.mktapi.vivo.bean.acoountService.*;
import com.hyq0719.mktapi.vivo.bean.common.VivoResponse;

import java.util.List;

/**
* @author hyq0719
* @description vivo商业开放平台——账号服务
*/
public class AccountServiceApi extends AbstractVivoApi {
private volatile AccountFetch accountFetch;
private volatile AccountFetchAccount accountFetchAccount;
private volatile AccountAdvertiserQuery accountAdvertiserQuery;
private volatile AccountBalanceQuery accountBalanceQuery;
private volatile FinanceUpdateDailyBudget financeUpdateDailyBudget;
private volatile FinanceFundsQueryFounds financeFundsQueryFounds;
private volatile FinanceTransferQueryTransfers financeTransferQueryTransfers;

public AccountServiceApi(ApiClient apiClient, RetryStrategy retryStrategy) {
super(apiClient, retryStrategy);
}

public AccountFetch accountFetch() {
if (accountFetch == null) {
synchronized (AccountFetch.class) {
if (accountFetch == null) {
accountFetch = (AccountFetch) init(AccountFetch.class);
}
}
}
return accountFetch;
}

public AccountFetchAccount accountFetchAccount() {
if (accountFetchAccount == null) {
synchronized (AccountFetchAccount.class) {
if (accountFetchAccount == null) {
accountFetchAccount = (AccountFetchAccount) init(AccountFetchAccount.class);
}
}
}
return accountFetchAccount;
}

public AccountAdvertiserQuery accountAdvertiserQuery() {
if (accountAdvertiserQuery == null) {
synchronized (AccountAdvertiserQuery.class) {
if (accountAdvertiserQuery == null) {
accountAdvertiserQuery = (AccountAdvertiserQuery) init(AccountAdvertiserQuery.class);
}
}
}
return accountAdvertiserQuery;
}

public AccountBalanceQuery accountBalanceQuery() {
if (accountBalanceQuery == null) {
synchronized (AccountBalanceQuery.class) {
if (accountBalanceQuery == null) {
accountBalanceQuery = (AccountBalanceQuery) init(AccountBalanceQuery.class);
}
}
}
return accountBalanceQuery;
}

public FinanceUpdateDailyBudget financeUpdateDailyBudget() {
if (financeUpdateDailyBudget == null) {
synchronized (FinanceUpdateDailyBudget.class) {
if (financeUpdateDailyBudget == null) {
financeUpdateDailyBudget = (FinanceUpdateDailyBudget) init(FinanceUpdateDailyBudget.class);
}
}
}
return financeUpdateDailyBudget;
}

public FinanceFundsQueryFounds financeFundsQueryFounds() {
if (financeFundsQueryFounds == null) {
synchronized (FinanceFundsQueryFounds.class) {
if (financeFundsQueryFounds == null) {
financeFundsQueryFounds = (FinanceFundsQueryFounds) init(FinanceFundsQueryFounds.class);
}
}
}
return financeFundsQueryFounds;
}

public FinanceTransferQueryTransfers financeTransferQueryTransfers() {
if (financeTransferQueryTransfers == null) {
synchronized (FinanceTransferQueryTransfers.class) {
if (financeTransferQueryTransfers == null) {
financeTransferQueryTransfers = (FinanceTransferQueryTransfers) init(FinanceTransferQueryTransfers.class);
}
}
}
return financeTransferQueryTransfers;
}

@ApiRequestMapping(value = "/account/fetch", method = RequestConstants.GET, usePostBody =
false, contentTypes = {RequestConstants.CONTENT_TYPE_TEXT_PLAIN})
public class AccountFetch extends VivoApiRequest<AccountFetchRequest, VivoResponse<AccountFetchResponseData>> {
@Override
public void setRequestParam(List<Pair> localVarQueryParams, List<Pair> localVarCollectionQueryParams,
AccountFetchRequest request) {
String advertiserId = request.getAdvertiserId();
if (advertiserId != null) {
localVarQueryParams.addAll(parameterToPair(ADVERTISER_ID, advertiserId));
}
}
}

@ApiRequestMapping(value = "/account/fetch/account", method = RequestConstants.GET, usePostBody =
false, contentTypes = {RequestConstants.CONTENT_TYPE_TEXT_PLAIN})
public class AccountFetchAccount extends VivoApiRequest<AccountFetchAccountRequest,
VivoResponse<AccountFetchAccountResponseData>> {
@Override
public void setRequestParam(List<Pair> localVarQueryParams, List<Pair> localVarCollectionQueryParams,
AccountFetchAccountRequest request) {
String advertiserId = request.getAdvertiserId();
if (advertiserId != null) {
localVarQueryParams.addAll(parameterToPair(ADVERTISER_ID, advertiserId));
}
}
}

@ApiRequestMapping(value = "/account/advertiser/query", method = RequestConstants.POST, contentTypes = {
RequestConstants.CONTENT_TYPE_JSON})
public class AccountAdvertiserQuery extends VivoApiRequest<AccountAdvertiserQueryRequest,
VivoResponse<AccountAdvertiserQueryResponseData>> {
@Override
public void setRequestParam(List<Pair> localVarQueryParams, List<Pair> localVarCollectionQueryParams,
AccountAdvertiserQueryRequest request) {
String advertiserId = request.getAdvertiserId();
if (advertiserId != null) {
localVarQueryParams.addAll(parameterToPair(ADVERTISER_ID, advertiserId));
}
}
}

@ApiRequestMapping(value = "/account/balance/query", method = RequestConstants.GET, usePostBody =
false, contentTypes = {RequestConstants.CONTENT_TYPE_TEXT_PLAIN})
public class AccountBalanceQuery extends VivoApiRequest<AccountBalanceQueryRequest,
VivoResponse<AccountBalanceQueryResponseData>> {
@Override
public void setRequestParam(List<Pair> localVarQueryParams, List<Pair> localVarCollectionQueryParams,
AccountBalanceQueryRequest request) {
String advertiserId = request.getAdvertiserId();
if (advertiserId != null) {
localVarQueryParams.addAll(parameterToPair(ADVERTISER_ID, advertiserId));
}
}
}

@ApiRequestMapping(value = "/finance/update/dailyBudget", method = RequestConstants.POST, contentTypes = {
RequestConstants.CONTENT_TYPE_JSON})
public class FinanceUpdateDailyBudget extends VivoApiRequest<FinanceUpdateDailyBudgetRequest,
VivoResponse<String>> {
@Override
public void setRequestParam(List<Pair> localVarQueryParams, List<Pair> localVarCollectionQueryParams,
FinanceUpdateDailyBudgetRequest request) {
String advertiserId = request.getAdvertiserId();
if (advertiserId != null) {
localVarQueryParams.addAll(parameterToPair(ADVERTISER_ID, advertiserId));
}
}
}

@ApiRequestMapping(value = "/finance/transfer/queryTransfers", method = RequestConstants.POST, contentTypes = {
RequestConstants.CONTENT_TYPE_JSON})
public class FinanceFundsQueryFounds extends VivoApiRequest<FinanceFundsQueryFoundsRequest,
VivoResponse<FinanceFundsQueryFoundsResponseData>> {
@Override
public void setRequestParam(List<Pair> localVarQueryParams, List<Pair> localVarCollectionQueryParams,
FinanceFundsQueryFoundsRequest request) {
String advertiserId = request.getAdvertiserId();
if (advertiserId != null) {
localVarQueryParams.addAll(parameterToPair(ADVERTISER_ID, advertiserId));
}
}
}

@ApiRequestMapping(value = "/finance/transfer/queryTransfers", method = RequestConstants.POST, contentTypes = {
RequestConstants.CONTENT_TYPE_JSON})
public class FinanceTransferQueryTransfers extends VivoApiRequest<FinanceTransferQueryTransfersRequest,
VivoResponse<FinanceTransferQueryTransfersResponseData>> {
@Override
public void setRequestParam(List<Pair> localVarQueryParams, List<Pair> localVarCollectionQueryParams,
FinanceTransferQueryTransfersRequest request) {
String advertiserId = request.getAdvertiserId();
if (advertiserId != null) {
localVarQueryParams.addAll(parameterToPair(ADVERTISER_ID, advertiserId));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

import java.util.List;

/**
* @author hyq0719
* @description vivo商业开放平台——数据接入
*/
public class DataAccessApi extends AbstractVivoApi {
private volatile AdvertiserBehaviorUpload advertiserBehaviorUpload;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
import java.util.List;

/**
* vivo商业开放平台——数据洞察api
* @author hyq0719
* @description vivo商业开放平台——数据洞察
*/
public class DataQueryApi extends AbstractVivoApi {
private volatile AdstatementSummaryQuery adstatementSummaryQuery;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
import java.util.List;
import java.util.Map;

/**
* @author hyq0719
* @description vivo商业开放平台——人群管理
*/
public class DmpTagApi extends AbstractVivoApi {
private volatile AdDmpTagUpload adDmpTagUpload;
private volatile AdDmpTagCreate adDmpTagCreate;
Expand Down
Loading

0 comments on commit 2cabb00

Please sign in to comment.