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
cf3f443f
Commit
cf3f443f
authored
Aug 24, 2023
by
陈炎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
更改时间请求格式
parent
5dbd7b7d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
7 deletions
+32
-7
FawOpenController.java
...afanticar/afantiopenapi/controller/FawOpenController.java
+32
-7
No files found.
src/main/java/com/afanticar/afantiopenapi/controller/FawOpenController.java
View file @
cf3f443f
package
com
.
afanticar
.
afantiopenapi
.
controller
;
package
com
.
afanticar
.
afantiopenapi
.
controller
;
import
cn.hutool.core.date.DateException
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
com.afanticar.afantiopenapi.model.BaseResponse
;
import
com.afanticar.afantiopenapi.model.BaseResponse
;
import
com.afanticar.afantiopenapi.model.vo.BasePageVO
;
import
com.afanticar.afantiopenapi.model.vo.BasePageVO
;
...
@@ -14,7 +15,6 @@ import io.swagger.annotations.ApiOperation;
...
@@ -14,7 +15,6 @@ import io.swagger.annotations.ApiOperation;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
@@ -55,6 +55,8 @@ public class FawOpenController extends BaseController {
...
@@ -55,6 +55,8 @@ public class FawOpenController extends BaseController {
static
String
dataType
=
"faw"
;
static
String
dataType
=
"faw"
;
static
String
monthly
=
"monthly"
,
quarter
=
"quarter"
;
@ApiOperation
(
value
=
"视频数据信息"
,
notes
=
"视频数据"
,
produces
=
"application/json"
)
@ApiOperation
(
value
=
"视频数据信息"
,
notes
=
"视频数据"
,
produces
=
"application/json"
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"publish_date_start"
,
value
=
"开始时间,格式:2023-02-01 00:00:00"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"Date"
),
@ApiImplicitParam
(
name
=
"publish_date_start"
,
value
=
"开始时间,格式:2023-02-01 00:00:00"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"Date"
),
...
@@ -66,12 +68,19 @@ public class FawOpenController extends BaseController {
...
@@ -66,12 +68,19 @@ public class FawOpenController extends BaseController {
@GetMapping
(
"/aweme"
)
@GetMapping
(
"/aweme"
)
public
BaseResponse
<
BasePageVO
<
HongqiAwemeIncentiveVO
>>
getAwemeData
(
HttpServletRequest
request
,
@Max
(
value
=
500
,
message
=
"单页数据page_size过大"
)
@RequestParam
(
name
=
"page_size"
,
defaultValue
=
"100"
,
required
=
false
)
Integer
pageSize
,
public
BaseResponse
<
BasePageVO
<
HongqiAwemeIncentiveVO
>>
getAwemeData
(
HttpServletRequest
request
,
@Max
(
value
=
500
,
message
=
"单页数据page_size过大"
)
@RequestParam
(
name
=
"page_size"
,
defaultValue
=
"100"
,
required
=
false
)
Integer
pageSize
,
@RequestParam
(
name
=
"current_page"
,
defaultValue
=
"1"
,
required
=
false
)
Integer
pageNum
,
@RequestParam
(
name
=
"current_page"
,
defaultValue
=
"1"
,
required
=
false
)
Integer
pageNum
,
@NotNull
(
message
=
"publish_date_start不能为空"
)
@RequestParam
(
name
=
"publish_date_start"
,
required
=
false
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
Date
publishDateStart
,
@NotNull
(
message
=
"publish_date_start不能为空"
)
@RequestParam
(
name
=
"publish_date_start"
,
required
=
false
)
String
publishDateStartStr
,
@NotNull
(
message
=
"publish_date_end不能为空"
)
@RequestParam
(
name
=
"publish_date_end"
,
required
=
false
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
Date
publishDateEnd
,
@NotNull
(
message
=
"publish_date_end不能为空"
)
@RequestParam
(
name
=
"publish_date_end"
,
required
=
false
)
String
publishDateEndStr
,
@NotNull
(
message
=
"type不能为空"
)
@RequestParam
(
name
=
"type"
,
required
=
false
)
String
type
)
{
@NotNull
(
message
=
"type不能为空"
)
@RequestParam
(
name
=
"type"
,
required
=
false
)
String
type
)
{
Date
publishDateEnd
=
parseDate
(
publishDateEndStr
),
publishDateStart
=
parseDate
(
publishDateStartStr
);
if
(
publishDateEnd
==
null
||
publishDateStart
==
null
)
{
return
error
(
"90001"
,
"publish_date_end或publish_date_start时间格式不合法"
);
}
log
.
info
(
"AAAAAAAAA:"
+
limit
);
log
.
info
(
"AAAAAAAAA:"
+
limit
);
BaseResponse
check
=
baseService
.
baseValidator
(
request
,
client
,
dataType
,
limit
,
limitPeriod
);
publishDateEnd
=
endTime
(
publishDateEnd
);
publishDateEnd
=
endTime
(
publishDateEnd
);
if
(!
type
.
equals
(
quarter
)
&&
!
type
.
equals
(
monthly
))
{
return
error
(
"90001"
,
"type传参异常,未开放数据类型"
);
}
BaseResponse
check
=
baseService
.
baseValidator
(
request
,
client
,
dataType
,
limit
,
limitPeriod
);
if
(
check
!=
null
)
{
if
(
check
!=
null
)
{
return
check
;
return
check
;
}
}
...
@@ -89,17 +98,33 @@ public class FawOpenController extends BaseController {
...
@@ -89,17 +98,33 @@ public class FawOpenController extends BaseController {
@GetMapping
(
"/live"
)
@GetMapping
(
"/live"
)
public
BaseResponse
<
BasePageVO
<
HongqiLiveIncentiveVO
>>
getLiveData
(
HttpServletRequest
request
,
@Max
(
value
=
500
,
message
=
"单页数据page_size过大"
)
@RequestParam
(
name
=
"page_size"
,
defaultValue
=
"100"
,
required
=
false
)
Integer
pageSize
,
public
BaseResponse
<
BasePageVO
<
HongqiLiveIncentiveVO
>>
getLiveData
(
HttpServletRequest
request
,
@Max
(
value
=
500
,
message
=
"单页数据page_size过大"
)
@RequestParam
(
name
=
"page_size"
,
defaultValue
=
"100"
,
required
=
false
)
Integer
pageSize
,
@RequestParam
(
name
=
"current_page"
,
defaultValue
=
"1"
,
required
=
false
)
Integer
pageNum
,
@RequestParam
(
name
=
"current_page"
,
defaultValue
=
"1"
,
required
=
false
)
Integer
pageNum
,
@NotNull
(
message
=
"publish_date_start不能为空"
)
@RequestParam
(
name
=
"publish_date_start"
,
required
=
false
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
Date
publishDateStart
,
@NotNull
(
message
=
"publish_date_start不能为空"
)
@RequestParam
(
name
=
"publish_date_start"
,
required
=
false
)
String
publishDateStartStr
,
@NotNull
(
message
=
"publish_date_end不能为空"
)
@RequestParam
(
name
=
"publish_date_end"
,
required
=
false
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
Date
publishDateEnd
,
@NotNull
(
message
=
"publish_date_end不能为空"
)
@RequestParam
(
name
=
"publish_date_end"
,
required
=
false
)
String
publishDateEndStr
,
@NotNull
(
message
=
"type不能为空"
)
@RequestParam
(
name
=
"type"
,
required
=
false
)
String
type
)
{
@NotNull
(
message
=
"type不能为空"
)
@RequestParam
(
name
=
"type"
,
required
=
false
)
String
type
)
{
BaseResponse
check
=
baseService
.
baseValidator
(
request
,
client
,
dataType
,
limit
,
limitPeriod
);
Date
publishDateEnd
=
parseDate
(
publishDateEndStr
),
publishDateStart
=
parseDate
(
publishDateStartStr
);
if
(
publishDateEnd
==
null
||
publishDateStart
==
null
)
{
return
error
(
"90001"
,
"publish_date_end或者publish_date_start时间格式不合法"
);
}
publishDateEnd
=
endTime
(
publishDateEnd
);
publishDateEnd
=
endTime
(
publishDateEnd
);
if
(!
type
.
equals
(
quarter
)
&&
!
type
.
equals
(
monthly
))
{
return
error
(
"90001"
,
"type传参异常,未开放数据类型!"
);
}
BaseResponse
check
=
baseService
.
baseValidator
(
request
,
client
,
dataType
,
limit
,
limitPeriod
);
if
(
check
!=
null
)
{
if
(
check
!=
null
)
{
return
check
;
return
check
;
}
}
return
success
(
fawOpenService
.
lives
(
publishDateStart
,
publishDateEnd
,
type
,
pageNum
,
pageSize
));
return
success
(
fawOpenService
.
lives
(
publishDateStart
,
publishDateEnd
,
type
,
pageNum
,
pageSize
));
}
}
private
static
Date
parseDate
(
String
publishDateStr
)
{
Date
publishDate
=
null
;
try
{
publishDate
=
DateUtil
.
parse
(
publishDateStr
,
"yyyy-MM-dd"
);
}
catch
(
DateException
ignore
)
{
}
return
publishDate
;
}
private
Date
endTime
(
Date
endDate
)
{
private
Date
endTime
(
Date
endDate
)
{
return
DateUtil
.
endOfDay
(
endDate
);
return
DateUtil
.
endOfDay
(
endDate
);
}
}
...
...
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