拉取买家订单列表
This commit is contained in:
@@ -8,6 +8,7 @@ import com.rj.common.LbThirdIntegrationConstants;
|
||||
import com.rj.dto.LbThirdIntegrationCredentialUpdateRequest;
|
||||
import com.rj.dto.hxr.HxrAdminOrderApiContext;
|
||||
import com.rj.dto.hxr.HxrAdminUserApiContext;
|
||||
import com.rj.dto.hxr.HxrBuyerOrderApiContext;
|
||||
import com.rj.dto.hxr.HxrFansApiContext;
|
||||
import com.rj.dto.hxr.HxrGoodsApiContext;
|
||||
import com.rj.dto.hxr.HxrUserLoginApiContext;
|
||||
@@ -398,6 +399,37 @@ public class LbThirdIntegrationConfigServiceImpl
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<HxrBuyerOrderApiContext> resolveBuyerOrderApiContext(String tenantId, String token) {
|
||||
if (!StringUtils.hasText(tenantId) || !StringUtils.hasText(token)) {
|
||||
return Optional.empty();
|
||||
}
|
||||
LbThirdIntegrationConfig config = getByTenantIdOrNull(tenantId.trim());
|
||||
if (config == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
if (config.getEnabled() == null || config.getEnabled() != 1) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
String appStr = config.getGoodsApiAppStr();
|
||||
if (!StringUtils.hasText(appStr)) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
try {
|
||||
return Optional.of(new HxrBuyerOrderApiContext(
|
||||
LbThirdIntegrationConfigUtil.resolveBuyerOrderListBaseUrl(config),
|
||||
LbThirdIntegrationConfigUtil.resolveBuyerOrderListLimit(config),
|
||||
LbThirdIntegrationConfigUtil.resolveGoodsApiOrigin(config),
|
||||
LbThirdIntegrationConfigUtil.resolveOrderReferer(config),
|
||||
token.trim(),
|
||||
appStr.trim()));
|
||||
} catch (IllegalStateException e) {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<HxrFansApiContext> resolveFansApiContext(String tenantId, String token) {
|
||||
if (!StringUtils.hasText(tenantId) || !StringUtils.hasText(token)) {
|
||||
@@ -431,6 +463,15 @@ public class LbThirdIntegrationConfigServiceImpl
|
||||
|
||||
@Override
|
||||
public Optional<HxrAdminOrderApiContext> resolveAdminOrderApiContext(String tenantId) {
|
||||
return resolveAdminOrderApiContext(tenantId, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<HxrAdminOrderApiContext> resolveAdminBuyerOrderApiContext(String tenantId) {
|
||||
return resolveAdminOrderApiContext(tenantId, true);
|
||||
}
|
||||
|
||||
private Optional<HxrAdminOrderApiContext> resolveAdminOrderApiContext(String tenantId, boolean buyerOrderList) {
|
||||
if (!StringUtils.hasText(tenantId)) {
|
||||
return Optional.empty();
|
||||
}
|
||||
@@ -448,9 +489,15 @@ public class LbThirdIntegrationConfigServiceImpl
|
||||
}
|
||||
|
||||
try {
|
||||
String baseUrl = buyerOrderList
|
||||
? LbThirdIntegrationConfigUtil.resolveBuyerOrderListBaseUrl(config)
|
||||
: LbThirdIntegrationConfigUtil.resolveOrderSelectBaseUrl(config);
|
||||
int pageLimit = buyerOrderList
|
||||
? LbThirdIntegrationConfigUtil.resolveBuyerOrderListLimit(config)
|
||||
: LbThirdIntegrationConfigUtil.resolveOrderPageLimit(config);
|
||||
return Optional.of(new HxrAdminOrderApiContext(
|
||||
LbThirdIntegrationConfigUtil.resolveOrderSelectBaseUrl(config),
|
||||
LbThirdIntegrationConfigUtil.resolveOrderPageLimit(config),
|
||||
baseUrl,
|
||||
pageLimit,
|
||||
cookieHeader.trim(),
|
||||
LbThirdIntegrationConfigUtil.resolveOrderReferer(config)));
|
||||
} catch (IllegalStateException e) {
|
||||
@@ -581,6 +628,9 @@ public class LbThirdIntegrationConfigServiceImpl
|
||||
if (!StringUtils.hasText(entity.getBuyApiPath())) {
|
||||
entity.setBuyApiPath(LbThirdIntegrationConstants.DEFAULT_BUY_API_PATH);
|
||||
}
|
||||
if (!StringUtils.hasText(entity.getBuyerOrderListPath())) {
|
||||
entity.setBuyerOrderListPath(LbThirdIntegrationConstants.DEFAULT_BUYER_ORDER_LIST_PATH);
|
||||
}
|
||||
if (!StringUtils.hasText(entity.getFansApiPath())) {
|
||||
entity.setFansApiPath(LbThirdIntegrationConstants.DEFAULT_FANS_API_PATH);
|
||||
}
|
||||
@@ -590,6 +640,9 @@ public class LbThirdIntegrationConfigServiceImpl
|
||||
if (entity.getOrderPageLimit() == null) {
|
||||
entity.setOrderPageLimit(LbThirdIntegrationConstants.DEFAULT_ORDER_PAGE_LIMIT);
|
||||
}
|
||||
if (entity.getBuyerOrderListLimit() == null) {
|
||||
entity.setBuyerOrderListLimit(LbThirdIntegrationConstants.DEFAULT_BUYER_ORDER_LIST_LIMIT);
|
||||
}
|
||||
if (entity.getUserPageLimit() == null) {
|
||||
entity.setUserPageLimit(LbThirdIntegrationConstants.DEFAULT_USER_PAGE_LIMIT);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user