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
5a62112d
Commit
5a62112d
authored
Apr 25, 2025
by
何进财
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat/reportData' into 'master'
feat: 完善时间校验的规则 See merge request
!73
parents
58c64827
949dee05
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
151 additions
and
103 deletions
+151
-103
GlobalExceptionHandler.java
...fanticar/afantiopenapi/config/GlobalExceptionHandler.java
+15
-0
DataReportRequestDTO.java
...anticar/afantiopenapi/model/dto/DataReportRequestDTO.java
+3
-5
DataReportService.java
...om/afanticar/afantiopenapi/service/DataReportService.java
+133
-98
No files found.
src/main/java/com/afanticar/afantiopenapi/config/GlobalExceptionHandler.java
View file @
5a62112d
...
@@ -3,9 +3,12 @@ package com.afanticar.afantiopenapi.config;
...
@@ -3,9 +3,12 @@ package com.afanticar.afantiopenapi.config;
import
com.afanticar.afantiopenapi.constant.ExceptionEnum
;
import
com.afanticar.afantiopenapi.constant.ExceptionEnum
;
import
com.afanticar.afantiopenapi.controller.BaseController
;
import
com.afanticar.afantiopenapi.controller.BaseController
;
import
com.afanticar.afantiopenapi.model.BaseResponse
;
import
com.afanticar.afantiopenapi.model.BaseResponse
;
import
com.afanticar.common.core.api.ResultCodeEnum
;
import
com.afanticar.common.core.exception.ApiException
;
import
org.apache.commons.lang3.exception.ExceptionUtils
;
import
org.apache.commons.lang3.exception.ExceptionUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.http.converter.HttpMessageNotReadableException
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
...
@@ -32,6 +35,18 @@ public class GlobalExceptionHandler {
...
@@ -32,6 +35,18 @@ public class GlobalExceptionHandler {
return
handleError
(
ExceptionEnum
.
ERROR
,
e
);
return
handleError
(
ExceptionEnum
.
ERROR
,
e
);
}
}
@ExceptionHandler
(
HttpMessageNotReadableException
.
class
)
public
BaseResponse
processHttpMessageNotReadableException
(
HttpMessageNotReadableException
e
)
{
LOGGER
.
error
(
"HttpMessageNotReadableException 调用异常 => :{}"
,
ExceptionUtils
.
getStackTrace
(
e
));
return
BaseController
.
error
(
ResultCodeEnum
.
VALIDATE_FAILED
.
getCode
().
toString
(),
e
.
getMessage
());
}
@ExceptionHandler
(
ApiException
.
class
)
public
BaseResponse
processApiException
(
ApiException
e
)
{
LOGGER
.
error
(
"api 调用异常 => :{}"
,
ExceptionUtils
.
getStackTrace
(
e
));
return
BaseController
.
error
(
e
.
getCode
().
toString
(),
e
.
getMessage
());
}
private
BaseResponse
<
Object
>
handleError
(
int
code
,
String
message
,
Exception
ex
)
{
private
BaseResponse
<
Object
>
handleError
(
int
code
,
String
message
,
Exception
ex
)
{
return
BaseController
.
error
(
code
+
""
,
message
);
return
BaseController
.
error
(
code
+
""
,
message
);
}
}
...
...
src/main/java/com/afanticar/afantiopenapi/model/dto/DataReportRequestDTO.java
View file @
5a62112d
...
@@ -6,8 +6,8 @@ import io.swagger.annotations.ApiModel;
...
@@ -6,8 +6,8 @@ import io.swagger.annotations.ApiModel;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotEmpty
;
import
java.time.LocalDate
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -20,12 +20,10 @@ import java.util.List;
...
@@ -20,12 +20,10 @@ import java.util.List;
public
class
DataReportRequestDTO
{
public
class
DataReportRequestDTO
{
@ApiModelProperty
(
"开始时间。格式为:yyyy-MM-dd。例如2024-01-01"
)
@ApiModelProperty
(
"开始时间。格式为:yyyy-MM-dd。例如2024-01-01"
)
@NotBlank
(
message
=
"开始时间不可为空"
)
private
LocalDate
startTime
;
private
String
startTime
;
@ApiModelProperty
(
"结束时间。格式为:yyyy-MM-dd。例如2024-01-01"
)
@ApiModelProperty
(
"结束时间。格式为:yyyy-MM-dd。例如2024-01-01"
)
@NotBlank
(
message
=
"结束时间不可为空"
)
private
LocalDate
endTime
;
private
String
endTime
;
@ApiModelProperty
(
"平台类型 public-公共数据 douyin-抖音 kuaishou-快手xiaohongshu-小红书 shipinhao-视频号"
)
@ApiModelProperty
(
"平台类型 public-公共数据 douyin-抖音 kuaishou-快手xiaohongshu-小红书 shipinhao-视频号"
)
@NotEmpty
(
message
=
"平台类型不可为空,可选类型 public-公共数据 douyin-抖音 kuaishou-快手xiaohongshu-小红书 shipinhao-视频号 "
)
@NotEmpty
(
message
=
"平台类型不可为空,可选类型 public-公共数据 douyin-抖音 kuaishou-快手xiaohongshu-小红书 shipinhao-视频号 "
)
...
...
src/main/java/com/afanticar/afantiopenapi/service/DataReportService.java
View file @
5a62112d
This diff is collapsed.
Click to expand it.
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