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
50d9d0f3
Commit
50d9d0f3
authored
Apr 28, 2023
by
陈炎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
first commit
parent
33725a49
Changes
38
Hide whitespace changes
Inline
Side-by-side
Showing
38 changed files
with
1701 additions
and
0 deletions
+1701
-0
Dockerfile
Dockerfile
+14
-0
AfantiOpenApiApplication.java
...com/afanticar/afantiopenapi/AfantiOpenApiApplication.java
+26
-0
ClientIdPrincipalConfig.java
...anticar/afantiopenapi/config/ClientIdPrincipalConfig.java
+21
-0
Constant.java
...ain/java/com/afanticar/afantiopenapi/config/Constant.java
+12
-0
MybatisPlusConfig.java
...com/afanticar/afantiopenapi/config/MybatisPlusConfig.java
+39
-0
RedissonConfig.java
...va/com/afanticar/afantiopenapi/config/RedissonConfig.java
+38
-0
TokenInterceptor.java
.../com/afanticar/afantiopenapi/config/TokenInterceptor.java
+47
-0
WebMvcConfig.java
...java/com/afanticar/afantiopenapi/config/WebMvcConfig.java
+25
-0
BaseController.java
...om/afanticar/afantiopenapi/controller/BaseController.java
+79
-0
CommonDataController.java
...nticar/afantiopenapi/controller/CommonDataController.java
+77
-0
FawOpenController.java
...afanticar/afantiopenapi/controller/FawOpenController.java
+95
-0
AfantiCasFeign.java
...ava/com/afanticar/afantiopenapi/feign/AfantiCasFeign.java
+25
-0
ActivityInfoMapper.java
...om/afanticar/afantiopenapi/mapper/ActivityInfoMapper.java
+16
-0
HongqiAwemeIncentiveMonthlyMapper.java
...antiopenapi/mapper/HongqiAwemeIncentiveMonthlyMapper.java
+16
-0
HongqiAwemeIncentiveQuarterMapper.java
...antiopenapi/mapper/HongqiAwemeIncentiveQuarterMapper.java
+16
-0
HongqiLiveIncentiveMonthlyMapper.java
...fantiopenapi/mapper/HongqiLiveIncentiveMonthlyMapper.java
+16
-0
HongqiLiveIncentiveQuarterMapper.java
...fantiopenapi/mapper/HongqiLiveIncentiveQuarterMapper.java
+16
-0
ActivityInfoStructMapper.java
...afantiopenapi/mapper/struct/ActivityInfoStructMapper.java
+17
-0
HongqiAwemeIncentiveStructMapper.java
...enapi/mapper/struct/HongqiAwemeIncentiveStructMapper.java
+20
-0
HongqiLiveIncentiveStructMapper.java
...penapi/mapper/struct/HongqiLiveIncentiveStructMapper.java
+20
-0
BaseResponse.java
.../java/com/afanticar/afantiopenapi/model/BaseResponse.java
+28
-0
TokenDTO.java
.../java/com/afanticar/afantiopenapi/model/dto/TokenDTO.java
+32
-0
ActivityInfo.java
...om/afanticar/afantiopenapi/model/entity/ActivityInfo.java
+42
-0
HongqiAwemeIncentiveMonthly.java
...antiopenapi/model/entity/HongqiAwemeIncentiveMonthly.java
+76
-0
HongqiAwemeIncentiveQuarter.java
...antiopenapi/model/entity/HongqiAwemeIncentiveQuarter.java
+75
-0
HongqiLiveIncentiveMonthly.java
...fantiopenapi/model/entity/HongqiLiveIncentiveMonthly.java
+77
-0
HongqiLiveIncentiveQuarter.java
...fantiopenapi/model/entity/HongqiLiveIncentiveQuarter.java
+77
-0
ActivityInfoVO.java
.../com/afanticar/afantiopenapi/model/vo/ActivityInfoVO.java
+41
-0
BasePageVO.java
...java/com/afanticar/afantiopenapi/model/vo/BasePageVO.java
+47
-0
HongqiAwemeIncentiveVO.java
...nticar/afantiopenapi/model/vo/HongqiAwemeIncentiveVO.java
+93
-0
HongqiLiveIncentiveVO.java
...anticar/afantiopenapi/model/vo/HongqiLiveIncentiveVO.java
+95
-0
TokenVO.java
...in/java/com/afanticar/afantiopenapi/model/vo/TokenVO.java
+24
-0
BaseService.java
...java/com/afanticar/afantiopenapi/service/BaseService.java
+51
-0
CommonDataService.java
...om/afanticar/afantiopenapi/service/CommonDataService.java
+61
-0
FawOpenService.java
...a/com/afanticar/afantiopenapi/service/FawOpenService.java
+96
-0
JWTUtils.java
...main/java/com/afanticar/afantiopenapi/utils/JWTUtils.java
+23
-0
bootstrap.yml
src/main/resources/bootstrap.yml
+85
-0
logback-spring.xml
src/main/resources/logback-spring.xml
+43
-0
No files found.
Dockerfile
0 → 100644
View file @
50d9d0f3
FROM
registry-vpc.cn-hangzhou.aliyuncs.com/afanticar/base:ppjava8
VOLUME
/tmp
ENV
PROJECT="afanti-open-api"
ENV
APP="/usr/src/app" \
JAR_FILE="target/${PROJECT}-1.0.1.jar"
WORKDIR
$APP
COPY
${JAR_FILE} app.jar
ENTRYPOINT
["/entrypoint.sh"]
\ No newline at end of file
src/main/java/com/afanticar/afantiopenapi/AfantiOpenApiApplication.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
/**
*
* @author Chin
*
*/
@EnableSwagger2
@SpringBootApplication
@EnableScheduling
@EnableFeignClients
@MapperScan
(
basePackages
=
{
"com.afanticar.afantiopenapi.mapper"
})
public
class
AfantiOpenApiApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
AfantiOpenApiApplication
.
class
,
args
);
}
}
src/main/java/com/afanticar/afantiopenapi/config/ClientIdPrincipalConfig.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
config
;
import
lombok.Getter
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Configuration
;
import
java.util.Map
;
/**
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/27/027
*/
@Configuration
@Getter
public
class
ClientIdPrincipalConfig
{
@Value
(
"#{${client.map}}"
)
Map
<
String
,
String
>
maps
;
}
src/main/java/com/afanticar/afantiopenapi/config/Constant.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
config
;
/**
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/28/028
*/
public
class
Constant
{
public
static
final
String
SUCCESS_CODE
=
"200"
;
}
src/main/java/com/afanticar/afantiopenapi/config/MybatisPlusConfig.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
config
;
import
com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor
;
import
com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor
;
import
com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
/**
* @author chenjiawei
* @desc mybatis-plus配置类
* @date 2022/04/19 17:54
**/
@Configuration
public
class
MybatisPlusConfig
{
@Bean
public
MybatisPlusInterceptor
mybatisPlusInterceptor
()
{
MybatisPlusInterceptor
interceptor
=
new
MybatisPlusInterceptor
();
// 分页插件
interceptor
.
addInnerInterceptor
(
paginationInnerInterceptor
());
//乐观锁
interceptor
.
addInnerInterceptor
(
new
OptimisticLockerInnerInterceptor
());
return
interceptor
;
}
/**
* 分页插件,自动识别数据库类型
*/
public
PaginationInnerInterceptor
paginationInnerInterceptor
()
{
PaginationInnerInterceptor
paginationInnerInterceptor
=
new
PaginationInnerInterceptor
();
// 设置最大单页限制数量,默认 500 条,-1 不受限制 设置后无法使用临时不分页
// paginationInnerInterceptor.setMaxLimit(-1L);
// 分页合理化
paginationInnerInterceptor
.
setOverflow
(
true
);
return
paginationInnerInterceptor
;
}
}
src/main/java/com/afanticar/afantiopenapi/config/RedissonConfig.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
config
;
import
jodd.util.StringUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.redisson.Redisson
;
import
org.redisson.api.RedissonClient
;
import
org.redisson.config.Config
;
import
org.redisson.config.SingleServerConfig
;
import
org.springframework.boot.autoconfigure.data.redis.RedisProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
javax.annotation.Resource
;
/**
* @author chin
* @contact chenyan@afanticar.com
* @since 2022/2/14/014
*/
@Configuration
@Slf4j
public
class
RedissonConfig
{
@Resource
private
RedisProperties
redisProperties
;
@Bean
public
RedissonClient
getRedisson
()
{
Config
config
=
new
Config
();
SingleServerConfig
singleServerConfig
=
config
.
useSingleServer
().
setAddress
(
"redis://"
+
this
.
redisProperties
.
getHost
()
+
":"
+
this
.
redisProperties
.
getPort
())
.
setDatabase
(
this
.
redisProperties
.
getDatabase
()).
setConnectTimeout
(
10000
).
setTimeout
(
3000
).
setRetryInterval
(
1500
).
setRetryAttempts
(
3
);
if
(
StringUtil
.
isNotBlank
(
this
.
redisProperties
.
getPassword
()))
{
singleServerConfig
.
setPassword
(
this
.
redisProperties
.
getPassword
());
}
return
Redisson
.
create
(
config
);
}
}
src/main/java/com/afanticar/afantiopenapi/config/TokenInterceptor.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
config
;
import
cn.hutool.core.util.StrUtil
;
import
com.afanticar.afantiopenapi.controller.BaseController
;
import
com.afanticar.afantiopenapi.utils.JWTUtils
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.servlet.HandlerInterceptor
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Set
;
/**
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/26/026
*/
@Component
@Slf4j
public
class
TokenInterceptor
implements
HandlerInterceptor
{
@Value
(
"#{'${ignored.uri}'.split(',')}"
)
private
Set
<
String
>
ignoredUris
;
@Override
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
String
requestUri
=
request
.
getRequestURI
();
if
(
ignoredUris
.
contains
(
requestUri
))
{
return
true
;
}
String
token
=
request
.
getHeader
(
"authorization"
);
if
(
StrUtil
.
isNotBlank
(
token
))
{
request
.
setAttribute
(
"clientId"
,
JWTUtils
.
getClientId
(
token
.
substring
(
8
)));
}
else
{
response
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setStatus
(
HttpServletResponse
.
SC_UNAUTHORIZED
);
response
.
setContentType
(
"application/json"
);
response
.
getWriter
().
append
(
JSONObject
.
toJSONString
(
BaseController
.
error
(
"401"
,
"认证失败"
)));
return
false
;
}
return
true
;
}
}
src/main/java/com/afanticar/afantiopenapi/config/WebMvcConfig.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
config
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
javax.annotation.Resource
;
/**
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/28/028
*/
@Configuration
public
class
WebMvcConfig
implements
WebMvcConfigurer
{
@Resource
TokenInterceptor
tokenInterceptor
;
@Override
public
void
addInterceptors
(
InterceptorRegistry
register
)
{
register
.
addInterceptor
(
tokenInterceptor
);
}
}
\ No newline at end of file
src/main/java/com/afanticar/afantiopenapi/controller/BaseController.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
controller
;
import
com.afanticar.afantiopenapi.model.BaseResponse
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.Map
;
/**
* description
*
* @author LSZ 2021/01/07 16:34
* @contact 648748030@qq.com
*/
public
class
BaseController
{
private
static
String
CODE_SUCCESS
=
"200"
;
private
static
String
CODE_ERROR
=
"500"
;
private
static
String
MSG_ERROR
=
"发生未知异常,请联系管理员"
;
public
static
String
header
=
"clientId"
;
public
static
<
T
>
BaseResponse
<
T
>
success
()
{
BaseResponse
<
T
>
result
=
new
BaseResponse
<>();
result
.
setSuccess
(
true
);
result
.
setCode
(
CODE_SUCCESS
);
return
result
;
}
public
static
<
T
>
BaseResponse
<
T
>
success
(
T
data
)
{
BaseResponse
<
T
>
successResult
=
success
();
successResult
.
setData
(
data
);
return
successResult
;
}
public
static
<
T
>
BaseResponse
<
T
>
error
()
{
return
error
(
CODE_ERROR
,
MSG_ERROR
);
}
public
static
<
T
>
BaseResponse
<
T
>
error
(
String
code
,
String
msg
)
{
BaseResponse
<
T
>
result
=
new
BaseResponse
<>();
result
.
setSuccess
(
false
);
result
.
setMessage
(
msg
);
result
.
setCode
(
code
);
return
result
;
}
public
static
<
T
>
BaseResponse
<
T
>
error
(
T
data
,
String
code
,
String
msg
)
{
BaseResponse
<
T
>
result
=
new
BaseResponse
<>();
result
.
setSuccess
(
false
);
result
.
setMessage
(
msg
);
result
.
setCode
(
code
);
result
.
setData
(
data
);
return
result
;
}
protected
HttpServletRequest
getRequest
()
{
return
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
}
public
Map
<
String
,
String
>
getParameterMap
()
{
Map
<
String
,
String
>
params
=
new
HashMap
();
Map
<
String
,
String
[]>
parameterMap
=
this
.
getRequest
().
getParameterMap
();
Iterator
var3
=
parameterMap
.
entrySet
().
iterator
();
while
(
var3
.
hasNext
())
{
Map
.
Entry
<
String
,
String
[]>
entry
=
(
Map
.
Entry
)
var3
.
next
();
if
(
entry
.
getValue
()
!=
null
&&
((
String
[])
entry
.
getValue
()).
length
!=
0
)
{
params
.
put
(
entry
.
getKey
(),
((
String
[])
entry
.
getValue
())[
0
]);
}
}
return
params
;
}
}
src/main/java/com/afanticar/afantiopenapi/controller/CommonDataController.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
controller
;
import
com.afanticar.afantiopenapi.config.ClientIdPrincipalConfig
;
import
com.afanticar.afantiopenapi.model.BaseResponse
;
import
com.afanticar.afantiopenapi.model.dto.TokenDTO
;
import
com.afanticar.afantiopenapi.model.vo.ActivityInfoVO
;
import
com.afanticar.afantiopenapi.model.vo.BasePageVO
;
import
com.afanticar.afantiopenapi.model.vo.TokenVO
;
import
com.afanticar.afantiopenapi.service.BaseService
;
import
com.afanticar.afantiopenapi.service.CommonDataService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.validation.Valid
;
/**
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/27/027
*/
@Api
(
"公共数据接口"
)
@RestController
@RequestMapping
(
"/public"
)
@Slf4j
public
class
CommonDataController
extends
BaseController
{
@Autowired
ClientIdPrincipalConfig
clientIdPrincipalConfig
;
@Autowired
CommonDataService
commonDataService
;
@Autowired
BaseService
baseService
;
@Value
(
"${common.limit.period:60}"
)
Integer
limitPeriod
;
@Value
(
"${common.limit.threshold:8}"
)
Integer
limit
;
static
String
dateType
=
"common"
;
@ApiOperation
(
value
=
"活动数据信息"
,
notes
=
"活动数据"
,
produces
=
"application/json"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"page_num"
,
value
=
"页码"
,
paramType
=
"path"
,
dataType
=
"Integer"
),
@ApiImplicitParam
(
name
=
"page_size"
,
value
=
"页数"
,
paramType
=
"path"
,
dataType
=
"Integer"
),
})
@GetMapping
(
"/activity"
)
public
BaseResponse
<
BasePageVO
<
ActivityInfoVO
>>
getActionData
(
HttpServletRequest
request
,
@RequestParam
(
name
=
"page_size"
,
defaultValue
=
"100"
,
required
=
false
)
Integer
pageSize
,
@RequestParam
(
name
=
"current_page"
,
defaultValue
=
"1"
,
required
=
false
)
Integer
pageNum
)
{
BaseResponse
check
=
baseService
.
baseLimit
(
request
,
dateType
,
limit
,
limitPeriod
);
if
(
check
!=
null
)
{
return
check
;
}
String
principalId
=
clientIdPrincipalConfig
.
getMaps
().
get
(
request
.
getHeader
(
header
));
return
success
(
commonDataService
.
actionData
(
principalId
,
pageNum
,
pageSize
));
}
@ApiOperation
(
value
=
"获取token"
,
notes
=
"token数据"
,
produces
=
"application/json"
)
@PostMapping
(
"/token"
)
public
BaseResponse
<
TokenVO
>
getToken
(
@RequestBody
@Valid
TokenDTO
dto
)
{
TokenVO
vo
=
commonDataService
.
token
(
dto
);
if
(
vo
==
null
)
{
return
error
();
}
return
success
(
vo
);
}
}
src/main/java/com/afanticar/afantiopenapi/controller/FawOpenController.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
controller
;
import
com.afanticar.afantiopenapi.model.BaseResponse
;
import
com.afanticar.afantiopenapi.model.vo.BasePageVO
;
import
com.afanticar.afantiopenapi.model.vo.HongqiAwemeIncentiveVO
;
import
com.afanticar.afantiopenapi.model.vo.HongqiLiveIncentiveVO
;
import
com.afanticar.afantiopenapi.service.BaseService
;
import
com.afanticar.afantiopenapi.service.FawOpenService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Date
;
/**
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/26/026
*/
@Api
(
"红旗数据接口"
)
@RestController
@RequestMapping
(
"/faw"
)
@Slf4j
public
class
FawOpenController
extends
BaseController
{
@Autowired
FawOpenService
fawOpenService
;
@Autowired
BaseService
baseService
;
@Value
(
"${faw.client}"
)
String
client
;
@Value
(
"${faw.limit.period:60}"
)
Integer
limitPeriod
;
@Value
(
"${faw.limit.threshold:3}"
)
Integer
limit
;
static
String
dataType
=
"faw"
;
@ApiOperation
(
value
=
"视频数据信息"
,
notes
=
"视频数据"
,
produces
=
"application/json"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"publish_date_start"
,
value
=
"开始时间,格式:2023-02-01"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"Date"
),
@ApiImplicitParam
(
name
=
"publish_date_end"
,
value
=
"结束时间,格式:2023-03-01"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"Date"
),
@ApiImplicitParam
(
name
=
"type"
,
value
=
"数据类型,monthly-月度表,quarter-季度表"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"current_page"
,
value
=
"页码"
,
paramType
=
"path"
,
dataType
=
"Integer"
),
@ApiImplicitParam
(
name
=
"page_size"
,
value
=
"页数"
,
paramType
=
"path"
,
dataType
=
"Integer"
),
})
@GetMapping
(
"/aweme"
)
public
BaseResponse
<
BasePageVO
<
HongqiAwemeIncentiveVO
>>
getAwemeData
(
HttpServletRequest
request
,
@RequestParam
(
name
=
"page_size"
,
defaultValue
=
"100"
,
required
=
false
)
Integer
pageSize
,
@RequestParam
(
name
=
"current_page"
,
defaultValue
=
"1"
,
required
=
false
)
Integer
pageNum
,
@RequestParam
(
name
=
"publish_date_start"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
Date
publishDateStart
,
@RequestParam
(
name
=
"publish_date_end"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
Date
publishDateEnd
,
@RequestParam
(
name
=
"type"
)
String
type
)
{
BaseResponse
check
=
baseService
.
baseValidator
(
request
,
client
,
dataType
,
limit
,
limitPeriod
);
if
(
check
!=
null
)
{
return
check
;
}
return
success
(
fawOpenService
.
awemes
(
publishDateStart
,
publishDateEnd
,
type
,
pageNum
,
pageSize
));
}
@ApiOperation
(
value
=
"直播数据信息"
,
notes
=
"直播数据"
,
produces
=
"application/json"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"publish_date_start"
,
value
=
"开始时间,格式:2023-02-01"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"Date"
),
@ApiImplicitParam
(
name
=
"publish_date_end"
,
value
=
"结束时间,格式:2023-03-01"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"Date"
),
@ApiImplicitParam
(
name
=
"type"
,
value
=
"数据类型,monthly-月度表,quarter-季度表"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"current_page"
,
value
=
"页码"
,
paramType
=
"path"
,
dataType
=
"Integer"
),
@ApiImplicitParam
(
name
=
"page_size"
,
value
=
"页数"
,
paramType
=
"path"
,
dataType
=
"Integer"
),
})
@GetMapping
(
"/live"
)
public
BaseResponse
<
BasePageVO
<
HongqiLiveIncentiveVO
>>
getLiveData
(
HttpServletRequest
request
,
@RequestParam
(
name
=
"page_size"
,
defaultValue
=
"100"
,
required
=
false
)
Integer
pageSize
,
@RequestParam
(
name
=
"current_page"
,
defaultValue
=
"1"
,
required
=
false
)
Integer
pageNum
,
@RequestParam
(
name
=
"publish_date_start"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
Date
publishDateStart
,
@RequestParam
(
name
=
"publish_date_end"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
Date
publishDateEnd
,
@RequestParam
(
name
=
"type"
)
String
type
)
{
BaseResponse
check
=
baseService
.
baseValidator
(
request
,
client
,
dataType
,
limit
,
limitPeriod
);
if
(
check
!=
null
)
{
return
check
;
}
return
success
(
fawOpenService
.
lives
(
publishDateStart
,
publishDateEnd
,
type
,
pageNum
,
pageSize
));
}
}
src/main/java/com/afanticar/afantiopenapi/feign/AfantiCasFeign.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
feign
;
import
com.afanticar.afantiopenapi.model.BaseResponse
;
import
com.afanticar.afantiopenapi.model.vo.TokenVO
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.Map
;
/**
* @author Chin
*/
@FeignClient
(
url
=
"${svc-prefix}"
+
"cas"
+
"${svc-suffix}"
,
name
=
"cas"
,
path
=
"/"
)
public
interface
AfantiCasFeign
{
/**
* 分类标签
* @param request 参数
* @return JSONObject结果
*/
@PostMapping
(
value
=
"/oauth/token"
)
BaseResponse
<
TokenVO
>
predict
(
@RequestParam
Map
<
String
,
Object
>
request
);
}
src/main/java/com/afanticar/afantiopenapi/mapper/ActivityInfoMapper.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
mapper
;
import
com.afanticar.afantiopenapi.model.entity.ActivityInfo
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/26/026
*/
@Mapper
@DS
(
"tmp"
)
public
interface
ActivityInfoMapper
extends
BaseMapper
<
ActivityInfo
>
{
}
src/main/java/com/afanticar/afantiopenapi/mapper/HongqiAwemeIncentiveMonthlyMapper.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
mapper
;
import
com.afanticar.afantiopenapi.model.entity.HongqiAwemeIncentiveMonthly
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/26/026
*/
@Mapper
@DS
(
"tmp"
)
public
interface
HongqiAwemeIncentiveMonthlyMapper
extends
BaseMapper
<
HongqiAwemeIncentiveMonthly
>
{
}
src/main/java/com/afanticar/afantiopenapi/mapper/HongqiAwemeIncentiveQuarterMapper.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
mapper
;
import
com.afanticar.afantiopenapi.model.entity.HongqiAwemeIncentiveQuarter
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/26/026
*/
@Mapper
@DS
(
"tmp"
)
public
interface
HongqiAwemeIncentiveQuarterMapper
extends
BaseMapper
<
HongqiAwemeIncentiveQuarter
>
{
}
src/main/java/com/afanticar/afantiopenapi/mapper/HongqiLiveIncentiveMonthlyMapper.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
mapper
;
import
com.afanticar.afantiopenapi.model.entity.HongqiLiveIncentiveMonthly
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/26/026
*/
@Mapper
@DS
(
"tmp"
)
public
interface
HongqiLiveIncentiveMonthlyMapper
extends
BaseMapper
<
HongqiLiveIncentiveMonthly
>
{
}
src/main/java/com/afanticar/afantiopenapi/mapper/HongqiLiveIncentiveQuarterMapper.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
mapper
;
import
com.afanticar.afantiopenapi.model.entity.HongqiLiveIncentiveQuarter
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/26/026
*/
@Mapper
@DS
(
"tmp"
)
public
interface
HongqiLiveIncentiveQuarterMapper
extends
BaseMapper
<
HongqiLiveIncentiveQuarter
>
{
}
src/main/java/com/afanticar/afantiopenapi/mapper/struct/ActivityInfoStructMapper.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
mapper
.
struct
;
import
com.afanticar.afantiopenapi.model.entity.ActivityInfo
;
import
com.afanticar.afantiopenapi.model.vo.ActivityInfoVO
;
import
org.mapstruct.Mapper
;
import
java.util.List
;
/**
* @author Chin
*/
@Mapper
(
componentModel
=
"spring"
)
public
interface
ActivityInfoStructMapper
{
List
<
ActivityInfoVO
>
listActivityInfoToVO
(
List
<
ActivityInfo
>
list
);
}
\ No newline at end of file
src/main/java/com/afanticar/afantiopenapi/mapper/struct/HongqiAwemeIncentiveStructMapper.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
mapper
.
struct
;
import
com.afanticar.afantiopenapi.model.entity.HongqiAwemeIncentiveMonthly
;
import
com.afanticar.afantiopenapi.model.entity.HongqiAwemeIncentiveQuarter
;
import
com.afanticar.afantiopenapi.model.vo.HongqiAwemeIncentiveVO
;
import
org.mapstruct.Mapper
;
import
java.util.List
;
/**
* @author Chin
*/
@Mapper
(
componentModel
=
"spring"
)
public
interface
HongqiAwemeIncentiveStructMapper
{
List
<
HongqiAwemeIncentiveVO
>
listLiveQuarterToVO
(
List
<
HongqiAwemeIncentiveQuarter
>
list
);
List
<
HongqiAwemeIncentiveVO
>
listLiveMonthlyToVO
(
List
<
HongqiAwemeIncentiveMonthly
>
list
);
}
\ No newline at end of file
src/main/java/com/afanticar/afantiopenapi/mapper/struct/HongqiLiveIncentiveStructMapper.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
mapper
.
struct
;
import
com.afanticar.afantiopenapi.model.entity.HongqiLiveIncentiveMonthly
;
import
com.afanticar.afantiopenapi.model.entity.HongqiLiveIncentiveQuarter
;
import
com.afanticar.afantiopenapi.model.vo.HongqiLiveIncentiveVO
;
import
org.mapstruct.Mapper
;
import
java.util.List
;
/**
* @author Chin
*/
@Mapper
(
componentModel
=
"spring"
)
public
interface
HongqiLiveIncentiveStructMapper
{
List
<
HongqiLiveIncentiveVO
>
listLiveQuarterToVO
(
List
<
HongqiLiveIncentiveQuarter
>
list
);
List
<
HongqiLiveIncentiveVO
>
listLiveMonthlyToVO
(
List
<
HongqiLiveIncentiveMonthly
>
list
);
}
\ No newline at end of file
src/main/java/com/afanticar/afantiopenapi/model/BaseResponse.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
model
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/26/026
*/
@Data
@ApiModel
(
"数据返回DTO"
)
public
class
BaseResponse
<
T
>
{
@ApiModelProperty
(
value
=
"状态码"
,
example
=
"200"
)
private
String
code
;
@ApiModelProperty
(
value
=
"状态信息"
,
example
=
"success"
)
private
String
message
;
@ApiModelProperty
(
"数据"
)
private
T
data
;
@ApiModelProperty
(
value
=
"是否成功"
,
example
=
"true"
)
private
Boolean
success
;
}
src/main/java/com/afanticar/afantiopenapi/model/dto/TokenDTO.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
model
.
dto
;
import
com.alibaba.fastjson.annotation.JSONType
;
import
com.fasterxml.jackson.databind.annotation.JsonNaming
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
/**
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/27/027
*/
@Data
@JsonNaming
(
value
=
com
.
fasterxml
.
jackson
.
databind
.
PropertyNamingStrategy
.
SnakeCaseStrategy
.
class
)
@JSONType
(
naming
=
com
.
alibaba
.
fastjson
.
PropertyNamingStrategy
.
SnakeCase
)
@ApiModel
(
"token请求DTO"
)
public
class
TokenDTO
{
@ApiModelProperty
(
value
=
"client_id"
,
example
=
"200"
)
@NotNull
private
String
clientId
;
private
String
grantType
;
@ApiModelProperty
(
value
=
"秘钥"
,
example
=
"200"
)
@NotNull
private
String
clientSecret
;
}
src/main/java/com/afanticar/afantiopenapi/model/entity/ActivityInfo.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
model
.
entity
;
/**
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/26/026
*/
import
com.alibaba.fastjson.annotation.JSONType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.databind.annotation.JsonNaming
;
import
lombok.Data
;
import
java.util.Date
;
/**
* 活动信息
* @author Chin
*/
@Data
@TableName
(
"activity_info"
)
@JsonNaming
(
value
=
com
.
fasterxml
.
jackson
.
databind
.
PropertyNamingStrategy
.
SnakeCaseStrategy
.
class
)
@JSONType
(
naming
=
com
.
alibaba
.
fastjson
.
PropertyNamingStrategy
.
SnakeCase
)
public
class
ActivityInfo
{
/** 活动ID */
@TableId
private
Integer
activityId
;
//private Integer principalId;
/** 活动名称 */
private
String
activityName
;
/** 活动规则 */
private
String
participationRules
;
/** 奖励规则 */
private
String
rewardRules
;
/** When the data was modified */
private
Date
modificationTime
;
/** When the data was created */
private
Date
creationTime
;
}
src/main/java/com/afanticar/afantiopenapi/model/entity/HongqiAwemeIncentiveMonthly.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
model
.
entity
;
import
com.alibaba.fastjson.annotation.JSONType
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.databind.annotation.JsonNaming
;
import
lombok.Data
;
import
java.util.Date
;
/**
* 红旗视频激励记录表_月度
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/26/026
*/
@Data
@TableName
(
"hongqi_aweme_incentive_monthly"
)
@JsonNaming
(
value
=
com
.
fasterxml
.
jackson
.
databind
.
PropertyNamingStrategy
.
SnakeCaseStrategy
.
class
)
@JSONType
(
naming
=
com
.
alibaba
.
fastjson
.
PropertyNamingStrategy
.
SnakeCase
)
public
class
HongqiAwemeIncentiveMonthly
{
/** 活动ID */
private
Integer
activityId
;
/** 统计日期 */
private
Date
statisticsDate
;
private
String
groupName
;
/** 平台 */
private
String
platform
;
/** 大区 */
private
String
region
;
/** 门店编码 */
private
String
storeCode
;
/** 经销商名称 */
private
String
dealerName
;
/** 主播ID */
private
String
authorId
;
/** 视频ID */
private
String
awemeId
;
/** 标题 */
private
String
title
;
/** 链接 */
private
String
link
;
/** 视频发布时间 */
private
Date
publishTime
;
/** 点赞数 */
private
Integer
likeCount
;
/** 评论数 */
private
Integer
commentCount
;
/** 分享数 */
private
Integer
shareCount
;
/** 播放数 */
private
Integer
playVolume
;
/** 互动数 */
private
Integer
interaction
;
/** 是否有效作品 1是, 0否 */
private
Integer
isValid
;
/** 是否活动作品 1是, 0否 */
private
Integer
isActivity
;
/** 是否爆款作品 1是, 0否 */
private
Integer
isPopular
;
/** 是否违规作品 1是, 0否 */
private
Integer
isViolation
;
/** 违规标签 */
private
String
violationTag
;
/** 门店内排行 */
private
String
storeRanking
;
/** 爆款作品奖金 */
private
Long
popularWorksBonus
;
/** 是否删除数据 1是, 0否 */
private
Integer
isDeleted
;
/** 创建时间 */
private
Date
ctime
;
/** 更新时间 */
private
Date
mtime
;
}
src/main/java/com/afanticar/afantiopenapi/model/entity/HongqiAwemeIncentiveQuarter.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
model
.
entity
;
import
com.alibaba.fastjson.annotation.JSONType
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.databind.annotation.JsonNaming
;
import
lombok.Data
;
import
java.util.Date
;
/**
* 红旗视频激励记录表_季度
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/26/026
*/
@Data
@TableName
(
"hongqi_live_incentive_quarter"
)
@JsonNaming
(
value
=
com
.
fasterxml
.
jackson
.
databind
.
PropertyNamingStrategy
.
SnakeCaseStrategy
.
class
)
@JSONType
(
naming
=
com
.
alibaba
.
fastjson
.
PropertyNamingStrategy
.
SnakeCase
)
public
class
HongqiAwemeIncentiveQuarter
{
/** 活动ID */
private
Integer
activityId
;
/** 统计日期 */
private
Date
statisticsDate
;
private
String
groupName
;
/** 平台 */
private
String
platform
;
/** 大区 */
private
String
region
;
/** 门店编码 */
private
String
storeCode
;
/** 经销商名称 */
private
String
dealerName
;
/** 主播ID */
private
String
authorId
;
/** 视频ID */
private
String
awemeId
;
/** 标题 */
private
String
title
;
/** 链接 */
private
String
link
;
/** 视频发布时间 */
private
Date
publishTime
;
/** 点赞数 */
private
Integer
likeCount
;
/** 评论数 */
private
Integer
commentCount
;
/** 分享数 */
private
Integer
shareCount
;
/** 播放数 */
private
Integer
playVolume
;
/** 互动数 */
private
Integer
interaction
;
/** 是否有效作品 1是, 0否 */
private
Byte
isValid
;
/** 是否活动作品 1是, 0否 */
private
Byte
isActivity
;
/** 是否爆款作品 1是, 0否 */
private
Byte
isPopular
;
/** 是否违规作品 1是, 0否 */
private
Byte
isViolation
;
/** 违规标签 */
private
String
violationTag
;
/** 门店内排行 */
private
String
storeRanking
;
/** 爆款作品奖金 */
private
Long
popularWorksBonus
;
/** 是否删除数据 1是, 0否 */
private
Integer
isDeleted
;
/** 创建时间 */
private
Date
ctime
;
/** 更新时间 */
private
Date
mtime
;
}
src/main/java/com/afanticar/afantiopenapi/model/entity/HongqiLiveIncentiveMonthly.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
model
.
entity
;
import
com.alibaba.fastjson.annotation.JSONType
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.databind.annotation.JsonNaming
;
import
lombok.Data
;
import
java.util.Date
;
/**
* 红旗直播激励记录表_月度
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/26/026
*/
@Data
@TableName
(
"hongqi_live_incentive_monthly"
)
@JsonNaming
(
value
=
com
.
fasterxml
.
jackson
.
databind
.
PropertyNamingStrategy
.
SnakeCaseStrategy
.
class
)
@JSONType
(
naming
=
com
.
alibaba
.
fastjson
.
PropertyNamingStrategy
.
SnakeCase
)
public
class
HongqiLiveIncentiveMonthly
{
/** 活动ID */
private
Integer
activityId
;
/** 统计日期 */
private
Date
statisticsDate
;
/** 分组 */
private
String
groupName
;
/** 平台 */
private
String
platform
;
/** 大区 */
private
String
region
;
/** 门店编码 */
private
String
storeCode
;
/** 经销商名称 */
private
String
dealerName
;
/** 主播ID */
private
String
authorId
;
/** 直播ID */
private
String
roomId
;
/** 标题 */
private
String
title
;
/** 链接 */
private
String
link
;
/** 视频发布时间 */
private
Date
publishTime
;
/** 点赞数 */
private
Integer
likeCount
;
/** 评论数 */
private
Integer
commentCount
;
/** 送礼数 */
private
Integer
giftCount
;
/** 观看量 */
private
Integer
watchUserCount
;
/** 直播时长(分钟) */
private
Long
liveDuration
;
/** 互动数 */
private
Integer
interaction
;
/** 是否有效作品 1是, 0否 */
private
Integer
isValid
;
/** 是否活动作品 1是, 0否 */
private
Integer
isActivity
;
/** 是否爆款作品 1是, 0否 */
private
Integer
isPopular
;
/** 是否违规作品 1是, 0否 */
private
Integer
isViolation
;
/** 违规标签 */
private
String
violationTag
;
/** 门店内排行 */
private
String
storeRanking
;
/** 爆款作品奖金 */
private
Long
popularWorksBonus
;
/** 是否删除数据 1是, 0否 */
private
Integer
isDeleted
;
/** 创建时间 */
private
Date
ctime
;
/** 更新时间 */
private
Date
mtime
;
}
src/main/java/com/afanticar/afantiopenapi/model/entity/HongqiLiveIncentiveQuarter.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
model
.
entity
;
import
com.alibaba.fastjson.annotation.JSONType
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.databind.annotation.JsonNaming
;
import
lombok.Data
;
import
java.util.Date
;
/**
* 红旗直播激励记录表_季度
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/26/026
*/
@Data
@TableName
(
"hongqi_live_incentive_quarter"
)
@JsonNaming
(
value
=
com
.
fasterxml
.
jackson
.
databind
.
PropertyNamingStrategy
.
SnakeCaseStrategy
.
class
)
@JSONType
(
naming
=
com
.
alibaba
.
fastjson
.
PropertyNamingStrategy
.
SnakeCase
)
public
class
HongqiLiveIncentiveQuarter
{
/** 活动ID */
private
Integer
activityId
;
/** 统计日期 */
private
Date
statisticsDate
;
/** 分组 */
private
String
groupName
;
/** 平台 */
private
String
platform
;
/** 大区 */
private
String
region
;
/** 门店编码 */
private
String
storeCode
;
/** 经销商名称 */
private
String
dealerName
;
/** 主播ID */
private
String
authorId
;
/** 直播ID */
private
String
roomId
;
/** 标题 */
private
String
title
;
/** 链接 */
private
String
link
;
/** 视频发布时间 */
private
Date
publishTime
;
/** 点赞数 */
private
Integer
likeCount
;
/** 评论数 */
private
Integer
commentCount
;
/** 送礼数 */
private
Integer
giftCount
;
/** 观看量 */
private
Integer
watchUserCount
;
/** 直播时长(分钟) */
private
Long
liveDuration
;
/** 互动数 */
private
Integer
interaction
;
/** 是否有效作品 1是, 0否 */
private
Integer
isValid
;
/** 是否活动作品 1是, 0否 */
private
Integer
isActivity
;
/** 是否爆款作品 1是, 0否 */
private
Integer
isPopular
;
/** 是否违规作品 1是, 0否 */
private
Integer
isViolation
;
/** 违规标签 */
private
String
violationTag
;
/** 门店内排行 */
private
String
storeRanking
;
/** 爆款作品奖金 */
private
Long
popularWorksBonus
;
/** 是否删除数据 1是, 0否 */
private
Integer
isDeleted
;
/** 创建时间 */
private
Date
ctime
;
/** 更新时间 */
private
Date
mtime
;
}
src/main/java/com/afanticar/afantiopenapi/model/vo/ActivityInfoVO.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
model
.
vo
;
/**
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/26/026
*/
import
com.alibaba.fastjson.annotation.JSONType
;
import
com.fasterxml.jackson.databind.annotation.JsonNaming
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
/**
* 活动信息
* @author Chin
*/
@Data
@JsonNaming
(
value
=
com
.
fasterxml
.
jackson
.
databind
.
PropertyNamingStrategy
.
SnakeCaseStrategy
.
class
)
@JSONType
(
naming
=
com
.
alibaba
.
fastjson
.
PropertyNamingStrategy
.
SnakeCase
)
public
class
ActivityInfoVO
{
/** 活动ID */
@ApiModelProperty
(
value
=
"活动ID"
,
example
=
"200"
)
private
Integer
activityId
;
/** 活动名称 */
@ApiModelProperty
(
value
=
"活动名称"
,
example
=
"3月活动"
)
private
String
activityName
;
/** 活动规则 */
@ApiModelProperty
(
value
=
"活动规则"
,
example
=
"规则1:等等"
)
private
String
participationRules
;
/** 奖励规则 */
@ApiModelProperty
(
value
=
"奖励规则"
,
example
=
"奖励规则"
)
private
String
rewardRules
;
/** When the data was created */
@ApiModelProperty
(
value
=
"活动创建时间"
,
example
=
"2023-03-04 10:00:00"
)
private
Date
creationTime
;
}
src/main/java/com/afanticar/afantiopenapi/model/vo/BasePageVO.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
model
.
vo
;
import
com.google.common.collect.Lists
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.List
;
/**
* 统一分页查询VO
* @author Chin
* @date 2023/04/27 14:02
**/
@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
"统一分页查询VO"
)
public
class
BasePageVO
<
T
>
{
@ApiModelProperty
(
"当前页码"
)
private
Integer
current
;
@ApiModelProperty
(
"每页大小"
)
private
Integer
size
;
@ApiModelProperty
(
"数据总量"
)
private
Integer
total
;
@ApiModelProperty
(
"总页数"
)
private
Integer
pages
;
@ApiModelProperty
(
"列表数据"
)
private
List
<
T
>
records
;
public
static
<
T
>
BasePageVO
<
T
>
restPage
(
int
current
,
int
size
,
int
total
,
int
pages
,
List
<
T
>
records
)
{
BasePageVO
<
T
>
result
=
new
BasePageVO
<
T
>(
1
,
30
,
0
,
1
,
Lists
.
newArrayList
());
result
.
setCurrent
(
current
);
result
.
setSize
(
size
);
result
.
setTotal
(
total
);
result
.
setPages
(
pages
);
result
.
setRecords
(
records
);
return
result
;
}
}
src/main/java/com/afanticar/afantiopenapi/model/vo/HongqiAwemeIncentiveVO.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
model
.
vo
;
import
com.alibaba.fastjson.annotation.JSONType
;
import
com.fasterxml.jackson.databind.annotation.JsonNaming
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
/**
* 红旗视频激励记录表_月度
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/26/026
*/
@Data
@JsonNaming
(
value
=
com
.
fasterxml
.
jackson
.
databind
.
PropertyNamingStrategy
.
SnakeCaseStrategy
.
class
)
@JSONType
(
naming
=
com
.
alibaba
.
fastjson
.
PropertyNamingStrategy
.
SnakeCase
)
public
class
HongqiAwemeIncentiveVO
{
/** 活动ID */
@ApiModelProperty
(
value
=
"活动ID"
,
example
=
"200"
)
private
Integer
activityId
;
/** 统计日期 */
@ApiModelProperty
(
value
=
"统计日期"
,
example
=
"2023-03-03"
)
private
Date
statisticsDate
;
@ApiModelProperty
(
value
=
"分组"
,
example
=
"分组2"
)
private
String
groupName
;
/** 平台 */
@ApiModelProperty
(
value
=
"平台"
,
example
=
"抖音"
)
private
String
platform
;
/** 大区 */
@ApiModelProperty
(
value
=
"大区"
,
example
=
"大区20"
)
private
String
region
;
/** 门店编码 */
@ApiModelProperty
(
value
=
"门店编码"
,
example
=
"ABC123"
)
private
String
storeCode
;
/** 经销商名称 */
@ApiModelProperty
(
value
=
"经销商名称"
,
example
=
"经销商200"
)
private
String
dealerName
;
/** 主播ID */
@ApiModelProperty
(
value
=
"主播ID"
,
example
=
"200"
)
private
String
authorId
;
/** 视频ID */
@ApiModelProperty
(
value
=
"视频ID"
,
example
=
"11200"
)
private
String
awemeId
;
/** 标题 */
@ApiModelProperty
(
value
=
"标题"
,
example
=
"标题200"
)
private
String
title
;
/** 链接 */
@ApiModelProperty
(
value
=
"链接"
,
example
=
"链接200"
)
private
String
link
;
/** 视频发布时间 */
@ApiModelProperty
(
value
=
"视频发布时间"
,
example
=
"2023-03-01 18:00:00"
)
private
Date
publishTime
;
/** 点赞数 */
@ApiModelProperty
(
value
=
"点赞数"
,
example
=
"200"
)
private
Integer
likeCount
;
/** 评论数 */
@ApiModelProperty
(
value
=
"评论数"
,
example
=
"200"
)
private
Integer
commentCount
;
/** 分享数 */
@ApiModelProperty
(
value
=
"分享数"
,
example
=
"200"
)
private
Integer
shareCount
;
/** 播放数 */
@ApiModelProperty
(
value
=
"播放数"
,
example
=
"200"
)
private
Integer
playVolume
;
/** 互动数 */
@ApiModelProperty
(
value
=
"互动数"
,
example
=
"200"
)
private
Integer
interaction
;
/** 是否有效作品 1是, 0否 */
@ApiModelProperty
(
value
=
"是否有效作品"
,
example
=
"1"
)
private
Integer
isValid
;
/** 是否活动作品 1是, 0否 */
@ApiModelProperty
(
value
=
"是否活动作品"
,
example
=
"1"
)
private
Integer
isActivity
;
/** 是否爆款作品 1是, 0否 */
@ApiModelProperty
(
value
=
"是否爆款作品"
,
example
=
"1"
)
private
Integer
isPopular
;
/** 是否违规作品 1是, 0否 */
@ApiModelProperty
(
value
=
"是否违规作品"
,
example
=
"0"
)
private
Integer
isViolation
;
/** 违规标签 */
@ApiModelProperty
(
value
=
"违规标签"
,
example
=
"[0]"
)
private
String
violationTag
;
/** 门店内排行 */
@ApiModelProperty
(
value
=
"门店内排行"
,
example
=
"200"
)
private
String
storeRanking
;
/** 爆款作品奖金 */
@ApiModelProperty
(
value
=
"爆款作品奖金"
,
example
=
"200"
)
private
Long
popularWorksBonus
;
}
src/main/java/com/afanticar/afantiopenapi/model/vo/HongqiLiveIncentiveVO.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
model
.
vo
;
import
com.alibaba.fastjson.annotation.JSONType
;
import
com.fasterxml.jackson.databind.annotation.JsonNaming
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
/**
* 红旗直播激励记录表_月度
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/26/026
*/
@Data
@JsonNaming
(
value
=
com
.
fasterxml
.
jackson
.
databind
.
PropertyNamingStrategy
.
SnakeCaseStrategy
.
class
)
@JSONType
(
naming
=
com
.
alibaba
.
fastjson
.
PropertyNamingStrategy
.
SnakeCase
)
public
class
HongqiLiveIncentiveVO
{
/** 活动ID */
@ApiModelProperty
(
value
=
"活动ID"
,
example
=
"200"
)
private
Integer
activityId
;
/** 统计日期 */
@ApiModelProperty
(
value
=
"统计日期"
,
example
=
"2023-03-03"
)
private
Date
statisticsDate
;
/** 分组 */
@ApiModelProperty
(
value
=
"分组"
,
example
=
"分组2"
)
private
String
groupName
;
/** 平台 */
@ApiModelProperty
(
value
=
"平台"
,
example
=
"抖音"
)
private
String
platform
;
/** 大区 */
@ApiModelProperty
(
value
=
"大区"
,
example
=
"大区200"
)
private
String
region
;
/** 门店编码 */
@ApiModelProperty
(
value
=
"门店编码"
,
example
=
"ABC123"
)
private
String
storeCode
;
/** 经销商名称 */
@ApiModelProperty
(
value
=
"经销商名称"
,
example
=
"经销商200"
)
private
String
dealerName
;
/** 主播ID */
@ApiModelProperty
(
value
=
"主播ID"
,
example
=
"200"
)
private
String
authorId
;
/** 直播ID */
@ApiModelProperty
(
value
=
"直播ID"
,
example
=
"11200"
)
private
String
roomId
;
/** 标题 */
@ApiModelProperty
(
value
=
"标题"
,
example
=
"标题200"
)
private
String
title
;
/** 链接 */
@ApiModelProperty
(
value
=
"链接"
,
example
=
"链接"
)
private
String
link
;
/** 视频发布时间 */
@ApiModelProperty
(
value
=
"视频发布时间"
,
example
=
"2023-03-03 10:00:02"
)
private
Date
publishTime
;
/** 点赞数 */
@ApiModelProperty
(
value
=
"点赞数"
,
example
=
"200"
)
private
Integer
likeCount
;
/** 评论数 */
@ApiModelProperty
(
value
=
"评论数"
,
example
=
"200"
)
private
Integer
commentCount
;
/** 送礼数 */
@ApiModelProperty
(
value
=
"送礼数"
,
example
=
"200"
)
private
Integer
giftCount
;
/** 观看量 */
@ApiModelProperty
(
value
=
"观看量"
,
example
=
"200"
)
private
Integer
watchUserCount
;
/** 直播时长(分钟) */
@ApiModelProperty
(
value
=
"直播时长(分钟)"
,
example
=
"210"
)
private
Long
liveDuration
;
/** 互动数 */
@ApiModelProperty
(
value
=
"互动数"
,
example
=
"200"
)
private
Integer
interaction
;
/** 是否有效作品 1是, 0否 */
@ApiModelProperty
(
value
=
"是否有效作品"
,
example
=
"1"
)
private
Integer
isValid
;
/** 是否活动作品 1是, 0否 */
@ApiModelProperty
(
value
=
"是否活动作品"
,
example
=
"1"
)
private
Integer
isActivity
;
/** 是否爆款作品 1是, 0否 */
@ApiModelProperty
(
value
=
"是否爆款作品"
,
example
=
"1"
)
private
Integer
isPopular
;
/** 是否违规作品 1是, 0否 */
@ApiModelProperty
(
value
=
"是否违规作品"
,
example
=
"0"
)
private
Integer
isViolation
;
/** 违规标签 */
@ApiModelProperty
(
value
=
"违规标签"
,
example
=
"[0]"
)
private
String
violationTag
;
/** 门店内排行 */
@ApiModelProperty
(
value
=
"门店内排行"
,
example
=
"2"
)
private
String
storeRanking
;
/** 爆款作品奖金 */
@ApiModelProperty
(
value
=
"爆款作品奖金"
,
example
=
"200"
)
private
Long
popularWorksBonus
;
}
src/main/java/com/afanticar/afantiopenapi/model/vo/TokenVO.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
model
.
vo
;
import
com.alibaba.fastjson.annotation.JSONType
;
import
com.fasterxml.jackson.databind.annotation.JsonNaming
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/27/027
*/
@Data
@JsonNaming
(
value
=
com
.
fasterxml
.
jackson
.
databind
.
PropertyNamingStrategy
.
SnakeCaseStrategy
.
class
)
@JSONType
(
naming
=
com
.
alibaba
.
fastjson
.
PropertyNamingStrategy
.
SnakeCase
)
public
class
TokenVO
{
@ApiModelProperty
(
value
=
"token,有效期30天"
,
example
=
"wastehh"
)
private
String
token
;
@ApiModelProperty
(
value
=
"有效时间,单位秒"
,
example
=
"2591999"
)
private
Long
expiresIn
;
}
src/main/java/com/afanticar/afantiopenapi/service/BaseService.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
service
;
import
com.afanticar.afantiopenapi.controller.BaseController
;
import
com.afanticar.afantiopenapi.model.BaseResponse
;
import
org.redisson.api.RRateLimiter
;
import
org.redisson.api.RateIntervalUnit
;
import
org.redisson.api.RateType
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.concurrent.TimeUnit
;
/**
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/27/027
*/
@Service
public
class
BaseService
{
@Autowired
RedissonClient
redissonClient
;
int
waiting
=
50
;
public
BaseResponse
baseValidator
(
HttpServletRequest
request
,
String
clientId
,
String
dataType
,
Integer
limit
,
Integer
limitPeriod
)
{
if
(!
clientId
.
equals
(
request
.
getHeader
(
BaseController
.
header
)))
{
return
BaseController
.
error
(
"403"
,
"认证用户无访问此数据的权限!"
);
}
String
fawKey
=
String
.
format
(
"%s:limit"
,
dataType
);
RRateLimiter
rateLimiter
=
redissonClient
.
getRateLimiter
(
fawKey
);
rateLimiter
.
trySetRate
(
RateType
.
OVERALL
,
limit
,
limitPeriod
,
RateIntervalUnit
.
SECONDS
);
if
(!
rateLimiter
.
tryAcquire
(
1
,
waiting
,
TimeUnit
.
MILLISECONDS
))
{
return
BaseController
.
error
(
"403"
,
"您的请求太过频繁,请稍后再试!"
);
}
return
null
;
}
public
BaseResponse
baseLimit
(
HttpServletRequest
request
,
String
dataType
,
Integer
limit
,
Integer
limitPeriod
)
{
String
fawKey
=
String
.
format
(
"%s:%s:limit"
,
dataType
,
request
.
getHeader
(
BaseController
.
header
));
RRateLimiter
rateLimiter
=
redissonClient
.
getRateLimiter
(
fawKey
);
rateLimiter
.
trySetRate
(
RateType
.
OVERALL
,
limit
,
limitPeriod
,
RateIntervalUnit
.
SECONDS
);
if
(!
rateLimiter
.
tryAcquire
(
1
,
waiting
,
TimeUnit
.
MILLISECONDS
))
{
return
BaseController
.
error
(
"403"
,
"您的请求太过频繁,请稍后再试!"
);
}
return
null
;
}
}
src/main/java/com/afanticar/afantiopenapi/service/CommonDataService.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
service
;
import
com.afanticar.afantiopenapi.config.Constant
;
import
com.afanticar.afantiopenapi.feign.AfantiCasFeign
;
import
com.afanticar.afantiopenapi.mapper.ActivityInfoMapper
;
import
com.afanticar.afantiopenapi.mapper.struct.ActivityInfoStructMapper
;
import
com.afanticar.afantiopenapi.model.BaseResponse
;
import
com.afanticar.afantiopenapi.model.dto.TokenDTO
;
import
com.afanticar.afantiopenapi.model.entity.ActivityInfo
;
import
com.afanticar.afantiopenapi.model.vo.ActivityInfoVO
;
import
com.afanticar.afantiopenapi.model.vo.BasePageVO
;
import
com.afanticar.afantiopenapi.model.vo.TokenVO
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.github.pagehelper.PageHelper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.mapstruct.factory.Mappers
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/27/027
*/
@Service
@Slf4j
public
class
CommonDataService
{
@Resource
ActivityInfoMapper
activityInfoMapper
;
@Resource
AfantiCasFeign
afantiCasFeign
;
public
BasePageVO
<
ActivityInfoVO
>
actionData
(
String
principalId
,
Integer
pageNum
,
Integer
pageSize
)
{
PageHelper
.
orderBy
(
" creation_time DESC "
);
IPage
<
ActivityInfo
>
page
=
new
Page
<>(
pageNum
,
pageSize
);
QueryWrapper
<
ActivityInfo
>
queryWrapper
=
new
QueryWrapper
<>();
//queryWrapper.eq("principal_id", principalId);
IPage
<
ActivityInfo
>
activityPage
=
activityInfoMapper
.
selectPage
(
page
,
queryWrapper
);
ActivityInfoStructMapper
mapper
=
Mappers
.
getMapper
(
ActivityInfoStructMapper
.
class
);
List
<
ActivityInfoVO
>
vos
=
mapper
.
listActivityInfoToVO
(
activityPage
.
getRecords
());
return
BasePageVO
.
restPage
(
pageNum
,
pageSize
,
(
int
)
activityPage
.
getTotal
(),
(
int
)
activityPage
.
getPages
(),
vos
);
}
public
TokenVO
token
(
TokenDTO
dto
)
{
dto
.
setGrantType
(
"client_credentials"
);
BaseResponse
<
TokenVO
>
response
=
afantiCasFeign
.
predict
(
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
dto
)).
getInnerMap
());
if
(
Constant
.
SUCCESS_CODE
.
equals
(
response
.
getCode
()))
{
return
response
.
getData
();
}
log
.
error
(
"faw请求token失败:{}"
,
JSONObject
.
toJSONString
(
response
));
return
null
;
}
}
src/main/java/com/afanticar/afantiopenapi/service/FawOpenService.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
service
;
import
com.afanticar.afantiopenapi.mapper.HongqiAwemeIncentiveMonthlyMapper
;
import
com.afanticar.afantiopenapi.mapper.HongqiAwemeIncentiveQuarterMapper
;
import
com.afanticar.afantiopenapi.mapper.HongqiLiveIncentiveMonthlyMapper
;
import
com.afanticar.afantiopenapi.mapper.HongqiLiveIncentiveQuarterMapper
;
import
com.afanticar.afantiopenapi.mapper.struct.HongqiAwemeIncentiveStructMapper
;
import
com.afanticar.afantiopenapi.mapper.struct.HongqiLiveIncentiveStructMapper
;
import
com.afanticar.afantiopenapi.model.entity.HongqiAwemeIncentiveMonthly
;
import
com.afanticar.afantiopenapi.model.entity.HongqiAwemeIncentiveQuarter
;
import
com.afanticar.afantiopenapi.model.entity.HongqiLiveIncentiveMonthly
;
import
com.afanticar.afantiopenapi.model.entity.HongqiLiveIncentiveQuarter
;
import
com.afanticar.afantiopenapi.model.vo.BasePageVO
;
import
com.afanticar.afantiopenapi.model.vo.HongqiAwemeIncentiveVO
;
import
com.afanticar.afantiopenapi.model.vo.HongqiLiveIncentiveVO
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.github.pagehelper.PageHelper
;
import
org.mapstruct.factory.Mappers
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.Date
;
import
java.util.List
;
/**
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/26/026
*/
@Service
public
class
FawOpenService
{
@Resource
HongqiAwemeIncentiveMonthlyMapper
hongqiAwemeIncentiveMonthlyMapper
;
@Resource
HongqiAwemeIncentiveQuarterMapper
hongqiAwemeIncentiveQuarterMapper
;
@Resource
HongqiLiveIncentiveMonthlyMapper
hongqiLiveIncentiveMonthlyMapper
;
@Resource
HongqiLiveIncentiveQuarterMapper
hongqiLiveIncentiveQuarterMapper
;
static
String
monthly
=
"monthly"
;
static
String
quarter
=
"quarter"
;
public
BasePageVO
<
HongqiAwemeIncentiveVO
>
awemes
(
Date
publishDateStart
,
Date
publishDateEnd
,
String
type
,
Integer
pageNum
,
Integer
pageSize
)
{
PageHelper
.
orderBy
(
" publish_time DESC "
);
if
(
monthly
.
equals
(
type
))
{
IPage
<
HongqiAwemeIncentiveMonthly
>
page
=
new
Page
<>(
pageNum
,
pageSize
);
QueryWrapper
<
HongqiAwemeIncentiveMonthly
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
between
(
"publish_time"
,
publishDateStart
,
publishDateEnd
);
IPage
<
HongqiAwemeIncentiveMonthly
>
awemePage
=
hongqiAwemeIncentiveMonthlyMapper
.
selectPage
(
page
,
queryWrapper
);
HongqiAwemeIncentiveStructMapper
mapper
=
Mappers
.
getMapper
(
HongqiAwemeIncentiveStructMapper
.
class
);
List
<
HongqiAwemeIncentiveVO
>
vos
=
mapper
.
listLiveMonthlyToVO
(
awemePage
.
getRecords
());
return
BasePageVO
.
restPage
(
pageNum
,
pageSize
,
(
int
)
awemePage
.
getTotal
(),
(
int
)
awemePage
.
getPages
(),
vos
);
}
else
if
(
quarter
.
equals
(
type
))
{
IPage
<
HongqiAwemeIncentiveQuarter
>
page
=
new
Page
<>(
pageNum
,
pageSize
);
QueryWrapper
<
HongqiAwemeIncentiveQuarter
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
between
(
"publish_time"
,
publishDateStart
,
publishDateEnd
);
IPage
<
HongqiAwemeIncentiveQuarter
>
awemePage
=
hongqiAwemeIncentiveQuarterMapper
.
selectPage
(
page
,
queryWrapper
);
HongqiAwemeIncentiveStructMapper
mapper
=
Mappers
.
getMapper
(
HongqiAwemeIncentiveStructMapper
.
class
);
List
<
HongqiAwemeIncentiveVO
>
vos
=
mapper
.
listLiveQuarterToVO
(
awemePage
.
getRecords
());
return
BasePageVO
.
restPage
(
pageNum
,
pageSize
,
(
int
)
awemePage
.
getTotal
(),
(
int
)
awemePage
.
getPages
(),
vos
);
}
else
{
return
new
BasePageVO
<>();
}
}
public
BasePageVO
<
HongqiLiveIncentiveVO
>
lives
(
Date
publishDateStart
,
Date
publishDateEnd
,
String
type
,
Integer
pageNum
,
Integer
pageSize
)
{
PageHelper
.
orderBy
(
" publish_time DESC "
);
if
(
monthly
.
equals
(
type
))
{
IPage
<
HongqiLiveIncentiveMonthly
>
page
=
new
Page
<>(
pageNum
,
pageSize
);
QueryWrapper
<
HongqiLiveIncentiveMonthly
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
between
(
"publish_time"
,
publishDateStart
,
publishDateEnd
);
IPage
<
HongqiLiveIncentiveMonthly
>
awemePage
=
hongqiLiveIncentiveMonthlyMapper
.
selectPage
(
page
,
queryWrapper
);
HongqiLiveIncentiveStructMapper
mapper
=
Mappers
.
getMapper
(
HongqiLiveIncentiveStructMapper
.
class
);
List
<
HongqiLiveIncentiveVO
>
vos
=
mapper
.
listLiveMonthlyToVO
(
awemePage
.
getRecords
());
return
BasePageVO
.
restPage
(
pageNum
,
pageSize
,
(
int
)
awemePage
.
getTotal
(),
(
int
)
awemePage
.
getPages
(),
vos
);
}
else
if
(
quarter
.
equals
(
type
))
{
IPage
<
HongqiLiveIncentiveQuarter
>
page
=
new
Page
<>(
pageNum
,
pageSize
);
QueryWrapper
<
HongqiLiveIncentiveQuarter
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
between
(
"publish_time"
,
publishDateStart
,
publishDateEnd
);
IPage
<
HongqiLiveIncentiveQuarter
>
awemePage
=
hongqiLiveIncentiveQuarterMapper
.
selectPage
(
page
,
queryWrapper
);
HongqiLiveIncentiveStructMapper
mapper
=
Mappers
.
getMapper
(
HongqiLiveIncentiveStructMapper
.
class
);
List
<
HongqiLiveIncentiveVO
>
vos
=
mapper
.
listLiveQuarterToVO
(
awemePage
.
getRecords
());
return
BasePageVO
.
restPage
(
pageNum
,
pageSize
,
(
int
)
awemePage
.
getTotal
(),
(
int
)
awemePage
.
getPages
(),
vos
);
}
else
{
return
new
BasePageVO
<>();
}
}
}
src/main/java/com/afanticar/afantiopenapi/utils/JWTUtils.java
0 → 100644
View file @
50d9d0f3
package
com
.
afanticar
.
afantiopenapi
.
utils
;
import
com.alibaba.fastjson.JSONObject
;
import
com.auth0.jwt.JWT
;
import
com.auth0.jwt.interfaces.DecodedJWT
;
import
java.util.Base64
;
/**
* @author chin
* @contact chenyan@afanticar.com
* @since 2023/4/26/026
*/
public
class
JWTUtils
{
public
static
String
getClientId
(
String
token
)
{
DecodedJWT
jwt
=
JWT
.
decode
(
token
);
Base64
.
Decoder
decoder
=
Base64
.
getUrlDecoder
();
String
payload
=
new
String
(
decoder
.
decode
(
jwt
.
getPayload
()));
return
JSONObject
.
parseObject
(
payload
).
getString
(
"client_id"
);
}
}
src/main/resources/bootstrap.yml
0 → 100644
View file @
50d9d0f3
#logging:
# level:
# com.afanticar.datacenter: debug
spring
:
profiles
:
active
:
local
cloud
:
nacos
:
config
:
server-addr
:
https://dev-nacos.afanticar.net
#local
maxRetry
:
3
namespace
:
09c8e0f2-6c67-4cd4-b167-5883a98a7a4f
#local
ext-config
:
-
data-id
:
dynamic-db-afanti-vault.yml
-
data-id
:
dynamic-db-afanti-tmp-vault.yml
-
data-id
:
common-redis.yml
-
data-id
:
afanti-open-api.yml
vault
:
uri
:
https://vault.afanticar.com
authentication
:
approle
app-role
:
role-id
:
4681a8e7-c4bd-7da6-4dc0-8009e9cc3a58
secret-id
:
e158c4bb-51ae-d5c4-35ec-751fffcc1a02
config
:
lifecycle
:
enabled
:
true
# 阿里云accesskey
aws
:
enabled
:
true
role
:
MqFullAccess
backend
:
alicloud
access-key-property
:
spring.rocket-mq.accessKey
secret-key-property
:
spring.rocket-mq.secretKey
# adb链接
generic
:
enabled
:
true
backend
:
${spring.profiles.active}
default-context
:
etladb
database
:
enabled
:
true
backend
:
${spring.profiles.active}db
role
:
app-role
username-property
:
spring.datasource.dynamic.datasource.master.username
password-property
:
spring.datasource.dynamic.datasource.master.password
#
#
#
#健康检查&监控信息
management
:
metrics
:
tags
:
application
:
${spring.application.name}
endpoints
:
enabled-by-default
:
true
web
:
exposure
:
include
:
"
prometheus,info,health"
base-path
:
"
/"
endpoint
:
health
:
enabled
:
true
health
:
elasticsearch
:
enabled
:
false
mybatis
:
configuration
:
map-underscore-to-camel-case
:
true
mybatis-plus
:
global-config
:
db-config
:
logic-delete-field
:
delete_state
logic-delete-value
:
1
logic-not-delete-value
:
0
insert-strategy
:
ignored
mapper-locations
:
-
classpath*:mapper/*.xml
# configuration:
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
logging
:
level
:
com.afanticar.datacenter.http.mapper.*
:
debug
\ No newline at end of file
src/main/resources/logback-spring.xml
0 → 100644
View file @
50d9d0f3
<?xml version="1.0" encoding="UTF-8"?>
<configuration
debug=
"false"
>
<contextName>
Logback
</contextName>
<springProfile
name=
"local"
>
<appender
name=
"STDOUT"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<encoder
class=
"ch.qos.logback.core.encoder.LayoutWrappingEncoder"
>
<layout
class=
"org.apache.skywalking.apm.toolkit.log.logback.v1.x.mdc.TraceIdMDCPatternLogbackLayout"
>
<Pattern>
%d{yyyy-MM-dd HH:mm:ss.SSS} [%X{tid}] [%thread] %-5level %logger{36} -%msg%n
</Pattern>
</layout>
</encoder>
</appender>
<appender
name=
"ASYNC"
class=
"ch.qos.logback.classic.AsyncAppender"
>
<discardingThreshold>
0
</discardingThreshold>
<queueSize>
1024
</queueSize>
<neverBlock>
true
</neverBlock>
<appender-ref
ref=
"STDOUT"
/>
</appender>
<root
level=
"INFO"
>
<appender-ref
ref=
"ASYNC"
/>
</root>
</springProfile>
<!-- 配置spring使用的参数名 -->
<springProfile
name=
"dev,uat,pro,test,production"
>
<appender
name=
"STDOUT"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<encoder
class=
"ch.qos.logback.core.encoder.LayoutWrappingEncoder"
>
<!-- 引入skywalking日志,添加tid -->
<layout
class=
"org.apache.skywalking.apm.toolkit.log.logback.v1.x.mdc.TraceIdMDCPatternLogbackLayout"
>
<Pattern>
%d{yyyy-MM-dd HH:mm:ss.SSS} [%X{tid}] [%thread] %-5level %logger{36} -%msg%n
</Pattern>
</layout>
</encoder>
</appender>
<!-- 配置异步输出 -->
<appender
name=
"ASYNC"
class=
"ch.qos.logback.classic.AsyncAppender"
>
<discardingThreshold>
0
</discardingThreshold>
<queueSize>
1024
</queueSize>
<neverBlock>
true
</neverBlock>
<appender-ref
ref=
"STDOUT"
/>
</appender>
<root
level=
"INFO"
>
<appender-ref
ref=
"ASYNC"
/>
</root>
</springProfile>
</configuration>
\ No newline at end of file
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