|
|
@@ -52,14 +52,13 @@ public class MallStatsOpenApiClientImpl implements MallStatsOpenApiClient
|
|
52
|
52
|
}
|
|
53
|
53
|
|
|
54
|
54
|
@Override
|
|
55
|
|
- public MallStatsOverviewVo fetchOverview(String statDate, int statYear)
|
|
|
55
|
+ public MallStatsOverviewVo fetchOverview(int statYear)
|
|
56
|
56
|
{
|
|
57
|
57
|
if (!properties.isEnabled() || StringUtils.isEmpty(properties.getBaseUrl()))
|
|
58
|
58
|
{
|
|
59
|
59
|
return null;
|
|
60
|
60
|
}
|
|
61
|
|
- String dateKey = StringUtils.isNotEmpty(statDate) ? statDate.trim() : "today";
|
|
62
|
|
- String cacheKey = CACHE_KEY_PREFIX + dateKey + ":" + statYear;
|
|
|
61
|
+ String cacheKey = CACHE_KEY_PREFIX + statYear;
|
|
63
|
62
|
MallStatsOverviewVo cached = redisCache.getCacheObject(cacheKey);
|
|
64
|
63
|
if (cached != null)
|
|
65
|
64
|
{
|
|
|
@@ -67,7 +66,7 @@ public class MallStatsOpenApiClientImpl implements MallStatsOpenApiClient
|
|
67
|
66
|
}
|
|
68
|
67
|
try
|
|
69
|
68
|
{
|
|
70
|
|
- MallStatsOverviewVo overview = requestOverview(statDate, statYear);
|
|
|
69
|
+ MallStatsOverviewVo overview = requestOverview(statYear);
|
|
71
|
70
|
if (overview != null)
|
|
72
|
71
|
{
|
|
73
|
72
|
int ttl = Math.max(1, properties.getCacheTtlMinutes());
|
|
|
@@ -77,21 +76,18 @@ public class MallStatsOpenApiClientImpl implements MallStatsOpenApiClient
|
|
77
|
76
|
}
|
|
78
|
77
|
catch (Exception ex)
|
|
79
|
78
|
{
|
|
80
|
|
- log.warn("拉取商城统计 overview 失败 statDate={} statYear={}: {}", statDate, statYear, ex.getMessage());
|
|
|
79
|
+ log.warn("拉取商城统计 overview 失败 statYear={}: {}", statYear, ex.getMessage());
|
|
81
|
80
|
return null;
|
|
82
|
81
|
}
|
|
83
|
82
|
}
|
|
84
|
83
|
|
|
85
|
|
- private MallStatsOverviewVo requestOverview(String statDate, int statYear) throws Exception
|
|
|
84
|
+ private MallStatsOverviewVo requestOverview(int statYear) throws Exception
|
|
86
|
85
|
{
|
|
87
|
86
|
String base = trimTrailingSlash(properties.getBaseUrl());
|
|
88
|
|
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(base + "/api/open/stats/overview")
|
|
89
|
|
- .queryParam("statYear", statYear);
|
|
90
|
|
- if (StringUtils.isNotEmpty(statDate))
|
|
91
|
|
- {
|
|
92
|
|
- builder.queryParam("statDate", statDate.trim());
|
|
93
|
|
- }
|
|
94
|
|
- URI uri = builder.build(true).toUri();
|
|
|
87
|
+ URI uri = UriComponentsBuilder.fromHttpUrl(base + "/api/open/stats/overview")
|
|
|
88
|
+ .queryParam("statYear", statYear)
|
|
|
89
|
+ .build(true)
|
|
|
90
|
+ .toUri();
|
|
95
|
91
|
|
|
96
|
92
|
HttpHeaders headers = new HttpHeaders();
|
|
97
|
93
|
headers.set(MallStatsOpenTokenSupport.TOKEN_HEADER, tokenSupport.createToken(properties));
|