Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
afanti-open-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
java-ms
afanti-open-api
Commits
7693165b
Commit
7693165b
authored
Oct 09, 2024
by
严俊
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev-activity-faw' into dev-activity-faw
parents
bb7f8a32
7ab3a793
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
9 deletions
+28
-9
BaseController.java
...om/afanticar/afantiopenapi/controller/BaseController.java
+4
-0
FawOpenController.java
...afanticar/afantiopenapi/controller/FawOpenController.java
+4
-4
DwdKuaishouAuthorInfoMapper.java
...car/afantiopenapi/mapper/DwdKuaishouAuthorInfoMapper.java
+3
-3
FawActivityDTO.java
...com/afanticar/afantiopenapi/model/dto/FawActivityDTO.java
+1
-1
BaseService.java
...java/com/afanticar/afantiopenapi/service/BaseService.java
+16
-1
No files found.
src/main/java/com/afanticar/afantiopenapi/controller/BaseController.java
View file @
7693165b
...
@@ -6,6 +6,7 @@ import cn.hutool.core.date.DateUtil;
...
@@ -6,6 +6,7 @@ import cn.hutool.core.date.DateUtil;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.afanticar.afantiopenapi.model.BaseResponse
;
import
com.afanticar.afantiopenapi.model.BaseResponse
;
import
com.afanticar.afantiopenapi.model.dto.FawActivityDTO
;
import
com.afanticar.afantiopenapi.model.dto.FawActivityDTO
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
...
@@ -103,6 +104,9 @@ public class BaseController {
...
@@ -103,6 +104,9 @@ public class BaseController {
if
(
DateUtil
.
between
(
publishDateEnd
,
publishDateStart
,
DateUnit
.
DAY
)
>
dateNum
)
{
if
(
DateUtil
.
between
(
publishDateEnd
,
publishDateStart
,
DateUnit
.
DAY
)
>
dateNum
)
{
return
BaseController
.
error
(
"10010"
,
"时间跨度最大为31天!"
);
return
BaseController
.
error
(
"10010"
,
"时间跨度最大为31天!"
);
}
}
// if (CollectionUtils.isEmpty(dto.getActivityIds()) || dto.getActivityIds().size() > 5) {
// return BaseController.error("10010", "活动ID不能为空,最大5个!");
// }
dto
.
setEnd
(
publishDateEnd
);
dto
.
setEnd
(
publishDateEnd
);
dto
.
setStart
(
publishDateStart
);
dto
.
setStart
(
publishDateStart
);
dto
.
setCurrent
(
dto
.
getCurrent
()
==
null
?
1
:
dto
.
getCurrent
());
dto
.
setCurrent
(
dto
.
getCurrent
()
==
null
?
1
:
dto
.
getCurrent
());
...
...
src/main/java/com/afanticar/afantiopenapi/controller/FawOpenController.java
View file @
7693165b
...
@@ -145,7 +145,7 @@ public class FawOpenController extends BaseController {
...
@@ -145,7 +145,7 @@ public class FawOpenController extends BaseController {
@ApiOperation
(
value
=
"抖音活动视频数据信息"
,
notes
=
"抖音活动视频数据"
,
produces
=
"application/json"
)
@ApiOperation
(
value
=
"抖音活动视频数据信息"
,
notes
=
"抖音活动视频数据"
,
produces
=
"application/json"
)
@PostMapping
(
"/activity/douyin/aweme/list"
)
@PostMapping
(
"/activity/douyin/aweme/list"
)
public
BaseResponse
<
BasePageVO
<
HongqiActivityAwemeVO
>>
getDouyinActivityAwemeData
(
@RequestBody
@Validated
FawActivityDTO
dto
)
{
public
BaseResponse
<
BasePageVO
<
HongqiActivityAwemeVO
>>
getDouyinActivityAwemeData
(
@RequestBody
@Validated
FawActivityDTO
dto
)
{
BaseResponse
check
=
baseService
.
base
Limit
(
dataType
,
limit
,
limitPeriod
);
BaseResponse
check
=
baseService
.
pageApi
Limit
(
dataType
,
limit
,
limitPeriod
);
if
(
check
!=
null
)
{
if
(
check
!=
null
)
{
return
check
;
return
check
;
}
}
...
@@ -159,7 +159,7 @@ public class FawOpenController extends BaseController {
...
@@ -159,7 +159,7 @@ public class FawOpenController extends BaseController {
@ApiOperation
(
value
=
"抖音活动直播数据信息"
,
notes
=
"抖音活动直播数据"
,
produces
=
"application/json"
)
@ApiOperation
(
value
=
"抖音活动直播数据信息"
,
notes
=
"抖音活动直播数据"
,
produces
=
"application/json"
)
@PostMapping
(
"/activity/douyin/live/list"
)
@PostMapping
(
"/activity/douyin/live/list"
)
public
BaseResponse
<
BasePageVO
<
HongqiActivityLiveVO
>>
getDouyinActivityLiveData
(
@RequestBody
@Validated
FawActivityDTO
dto
)
{
public
BaseResponse
<
BasePageVO
<
HongqiActivityLiveVO
>>
getDouyinActivityLiveData
(
@RequestBody
@Validated
FawActivityDTO
dto
)
{
BaseResponse
check
=
baseService
.
base
Limit
(
dataType
,
limit
,
limitPeriod
);
BaseResponse
check
=
baseService
.
pageApi
Limit
(
dataType
,
limit
,
limitPeriod
);
if
(
check
!=
null
)
{
if
(
check
!=
null
)
{
return
check
;
return
check
;
}
}
...
@@ -173,7 +173,7 @@ public class FawOpenController extends BaseController {
...
@@ -173,7 +173,7 @@ public class FawOpenController extends BaseController {
@ApiOperation
(
value
=
"快手活动视频数据信息"
,
notes
=
"快手活动视频数据"
,
produces
=
"application/json"
)
@ApiOperation
(
value
=
"快手活动视频数据信息"
,
notes
=
"快手活动视频数据"
,
produces
=
"application/json"
)
@PostMapping
(
"/activity/kuaishou/aweme/list"
)
@PostMapping
(
"/activity/kuaishou/aweme/list"
)
public
BaseResponse
<
BasePageVO
<
HongqiActivityAwemeVO
>>
getKuaishouActivityAwemeData
(
@RequestBody
@Validated
FawActivityDTO
dto
)
{
public
BaseResponse
<
BasePageVO
<
HongqiActivityAwemeVO
>>
getKuaishouActivityAwemeData
(
@RequestBody
@Validated
FawActivityDTO
dto
)
{
BaseResponse
check
=
baseService
.
base
Limit
(
dataType
,
limit
,
limitPeriod
);
BaseResponse
check
=
baseService
.
pageApi
Limit
(
dataType
,
limit
,
limitPeriod
);
if
(
check
!=
null
)
{
if
(
check
!=
null
)
{
return
check
;
return
check
;
}
}
...
@@ -187,7 +187,7 @@ public class FawOpenController extends BaseController {
...
@@ -187,7 +187,7 @@ public class FawOpenController extends BaseController {
@ApiOperation
(
value
=
"快手活动直播数据信息"
,
notes
=
"快手活动直播数据"
,
produces
=
"application/json"
)
@ApiOperation
(
value
=
"快手活动直播数据信息"
,
notes
=
"快手活动直播数据"
,
produces
=
"application/json"
)
@PostMapping
(
"/activity/kuaishou/live/list"
)
@PostMapping
(
"/activity/kuaishou/live/list"
)
public
BaseResponse
<
BasePageVO
<
HongqiActivityLiveVO
>>
getKuaishouActivityLiveData
(
@RequestBody
@Validated
FawActivityDTO
dto
)
{
public
BaseResponse
<
BasePageVO
<
HongqiActivityLiveVO
>>
getKuaishouActivityLiveData
(
@RequestBody
@Validated
FawActivityDTO
dto
)
{
BaseResponse
check
=
baseService
.
base
Limit
(
dataType
,
limit
,
limitPeriod
);
BaseResponse
check
=
baseService
.
pageApi
Limit
(
dataType
,
limit
,
limitPeriod
);
if
(
check
!=
null
)
{
if
(
check
!=
null
)
{
return
check
;
return
check
;
}
}
...
...
src/main/java/com/afanticar/afantiopenapi/mapper/DwdKuaishouAuthorInfoMapper.java
View file @
7693165b
...
@@ -64,7 +64,7 @@ public interface DwdKuaishouAuthorInfoMapper extends BaseMapper<DwdDouyinAuthorI
...
@@ -64,7 +64,7 @@ public interface DwdKuaishouAuthorInfoMapper extends BaseMapper<DwdDouyinAuthorI
" </choose> "
+
" </choose> "
+
" and is_deleted = 0 "
+
" and is_deleted = 0 "
+
" group by aweme_id "
+
" group by aweme_id "
+
" ) t2 on t1.aweme_id = t2.aweme_id "
+
" ) t2 on t1.aweme_id = t2.aweme_id
or t1.other_video_id = t2.aweme_id
"
+
" left join dwd_douyin_author_info t3 on t1.author_id = t3.author_id "
+
" left join dwd_douyin_author_info t3 on t1.author_id = t3.author_id "
+
"where contains(split(t3.principal_ids,','),'869752931296989184')</script>"
)
"where contains(split(t3.principal_ids,','),'869752931296989184')</script>"
)
IPage
<
HongqiActivityAwemeVO
>
douyinActivityAwemes
(
IPage
<
HongqiActivityAwemeVO
>
page
,
@Param
(
"dto"
)
FawActivityDTO
dto
);
IPage
<
HongqiActivityAwemeVO
>
douyinActivityAwemes
(
IPage
<
HongqiActivityAwemeVO
>
page
,
@Param
(
"dto"
)
FawActivityDTO
dto
);
...
@@ -110,7 +110,7 @@ public interface DwdKuaishouAuthorInfoMapper extends BaseMapper<DwdDouyinAuthorI
...
@@ -110,7 +110,7 @@ public interface DwdKuaishouAuthorInfoMapper extends BaseMapper<DwdDouyinAuthorI
" </choose> "
+
" </choose> "
+
" and is_deleted = 0 "
+
" and is_deleted = 0 "
+
" group by aweme_id "
+
" group by aweme_id "
+
" ) t2 on t1.aweme_id = t2.aweme_id "
+
" ) t2 on t1.aweme_id = t2.aweme_id
or t1.other_video_id = t2.aweme_id
"
+
" left join dwd_kuaishou_author_info t3 on t1.author_id = t3.author_id "
+
" left join dwd_kuaishou_author_info t3 on t1.author_id = t3.author_id "
+
"where contains(split(t3.principal_ids,','),'869752931296989184')</script>"
)
"where contains(split(t3.principal_ids,','),'869752931296989184')</script>"
)
IPage
<
HongqiActivityAwemeVO
>
kuaishouActivityAwemes
(
IPage
<
HongqiActivityAwemeVO
>
page
,
@Param
(
"dto"
)
FawActivityDTO
dto
);
IPage
<
HongqiActivityAwemeVO
>
kuaishouActivityAwemes
(
IPage
<
HongqiActivityAwemeVO
>
page
,
@Param
(
"dto"
)
FawActivityDTO
dto
);
...
@@ -163,7 +163,7 @@ public interface DwdKuaishouAuthorInfoMapper extends BaseMapper<DwdDouyinAuthorI
...
@@ -163,7 +163,7 @@ public interface DwdKuaishouAuthorInfoMapper extends BaseMapper<DwdDouyinAuthorI
@Select
(
"<script>select "
+
@Select
(
"<script>select "
+
" t1.room_id, "
+
" t1.room_id, "
+
" t1.title, "
+
" t1.title, "
+
" '
douyin
' as platform, "
+
" '
kuaishou
' as platform, "
+
" t3.dealer_area_names area_name, "
+
" t3.dealer_area_names area_name, "
+
" t3.dealer_store_code dealer_code, "
+
" t3.dealer_store_code dealer_code, "
+
" t3.dealer_name , "
+
" t3.dealer_name , "
+
...
...
src/main/java/com/afanticar/afantiopenapi/model/dto/FawActivityDTO.java
View file @
7693165b
...
@@ -22,7 +22,7 @@ public class FawActivityDTO {
...
@@ -22,7 +22,7 @@ public class FawActivityDTO {
@Min
(
value
=
1
,
message
=
"当前页最小1"
)
@Min
(
value
=
1
,
message
=
"当前页最小1"
)
private
Integer
current
;
private
Integer
current
;
@Max
(
value
=
500
,
message
=
"分页大小最大5
00"
)
@Max
(
value
=
1000
,
message
=
"分页大小最大10
00"
)
private
Integer
size
;
private
Integer
size
;
private
String
publishDateStart
;
private
String
publishDateStart
;
...
...
src/main/java/com/afanticar/afantiopenapi/service/BaseService.java
View file @
7693165b
...
@@ -42,11 +42,26 @@ public class BaseService {
...
@@ -42,11 +42,26 @@ public class BaseService {
String
header
=
"token"
;
String
header
=
"token"
;
String
fawKey
=
String
.
format
(
"%s:%s:limit"
,
dataType
,
header
);
String
fawKey
=
String
.
format
(
"%s:%s:limit"
,
dataType
,
header
);
RRateLimiter
rateLimiter
=
redissonClient
.
getRateLimiter
(
fawKey
);
RRateLimiter
rateLimiter
=
redissonClient
.
getRateLimiter
(
fawKey
);
rateLimiter
.
trySetRate
(
RateType
.
OVERALL
,
limit
,
limitPeriod
,
RateIntervalUnit
.
SECONDS
);
rateLimiter
.
trySetRate
(
RateType
.
OVERALL
,
limit
,
limitPeriod
,
RateIntervalUnit
.
SECONDS
);
if
(!
rateLimiter
.
tryAcquire
(
1
,
waiting
,
TimeUnit
.
MILLISECONDS
))
{
if
(!
rateLimiter
.
tryAcquire
(
1
,
waiting
,
TimeUnit
.
MILLISECONDS
))
{
return
BaseController
.
error
(
"10010"
,
"您的请求太过频繁,请稍后再试!"
);
return
BaseController
.
error
(
"10010"
,
"您的请求太过频繁,请稍后再试!"
);
}
}
return
null
;
return
null
;
}
}
public
BaseResponse
pageApiLimit
(
String
dataType
,
Integer
limit
,
Integer
limitPeriod
)
{
try
{
Thread
.
sleep
(
5000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
String
header
=
"token"
;
String
fawKey
=
String
.
format
(
"%s:%s:limit"
,
dataType
,
header
);
RRateLimiter
rateLimiter
=
redissonClient
.
getRateLimiter
(
fawKey
);
rateLimiter
.
trySetRate
(
RateType
.
OVERALL
,
limit
,
limitPeriod
,
RateIntervalUnit
.
SECONDS
);
if
(!
rateLimiter
.
tryAcquire
(
1
,
waiting
,
TimeUnit
.
MILLISECONDS
))
{
return
BaseController
.
error
(
"10010"
,
"您的请求太过频繁,请稍后再试!"
);
}
return
null
;
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment