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
a28cbd2f
Commit
a28cbd2f
authored
Dec 18, 2024
by
王明生
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feats: 完成比亚迪数据接口开发
parent
dbd6d6d9
Changes
26
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
793 additions
and
103 deletions
+793
-103
pom.xml
pom.xml
+6
-0
AfantiOpenApiApplication.java
...com/afanticar/afantiopenapi/AfantiOpenApiApplication.java
+2
-0
RedissonConfig.java
...va/com/afanticar/afantiopenapi/config/RedissonConfig.java
+8
-2
WebMvcConfig.java
...java/com/afanticar/afantiopenapi/config/WebMvcConfig.java
+6
-0
PrincipalEnum.java
...a/com/afanticar/afantiopenapi/constant/PrincipalEnum.java
+17
-4
BaseController.java
...om/afanticar/afantiopenapi/controller/BaseController.java
+15
-1
BydOpenController.java
...afanticar/afantiopenapi/controller/BydOpenController.java
+190
-0
MemberInfoMapper.java
.../com/afanticar/afantiopenapi/mapper/MemberInfoMapper.java
+5
-3
XiaoHongShuAuthorDayMapper.java
...icar/afantiopenapi/mapper/XiaoHongShuAuthorDayMapper.java
+22
-1
XiaoHongShuAuthorInfoMapper.java
...car/afantiopenapi/mapper/XiaoHongShuAuthorInfoMapper.java
+16
-1
XiaoHongShuMemberDayMapper.java
...icar/afantiopenapi/mapper/XiaoHongShuMemberDayMapper.java
+24
-12
XiaoHongShuNoteDayMapper.java
...nticar/afantiopenapi/mapper/XiaoHongShuNoteDayMapper.java
+34
-1
XiaoHongShuNoteInfoMapper.java
...ticar/afantiopenapi/mapper/XiaoHongShuNoteInfoMapper.java
+16
-1
BaseADB.java
...ava/com/afanticar/afantiopenapi/model/entity/BaseADB.java
+21
-0
XiaoHongShuAuthorDay.java
...icar/afantiopenapi/model/entity/XiaoHongShuAuthorDay.java
+8
-3
XiaoHongShuAuthorInfo.java
...car/afantiopenapi/model/entity/XiaoHongShuAuthorInfo.java
+20
-14
XiaoHongShuNoteDay.java
...nticar/afantiopenapi/model/entity/XiaoHongShuNoteDay.java
+11
-5
XiaoHongShuNoteInfo.java
...ticar/afantiopenapi/model/entity/XiaoHongShuNoteInfo.java
+18
-5
XiaoHongShuNoteDocQTO.java
...nticar/afantiopenapi/model/qto/XiaoHongShuNoteDocQTO.java
+36
-0
BydXiaoHongShuAuthorDayVO.java
...car/afantiopenapi/model/vo/BydXiaoHongShuAuthorDayVO.java
+71
-0
BydXiaoHongShuMemberDayVO.java
...car/afantiopenapi/model/vo/BydXiaoHongShuMemberDayVO.java
+35
-34
BydXiaoHongShuNoteDayVO.java
...ticar/afantiopenapi/model/vo/BydXiaoHongShuNoteDayVO.java
+51
-0
BaseService.java
...java/com/afanticar/afantiopenapi/service/BaseService.java
+6
-1
BydOpenService.java
...a/com/afanticar/afantiopenapi/service/BydOpenService.java
+134
-15
XiaoHongShuNoteDocService.java
...icar/afantiopenapi/service/XiaoHongShuNoteDocService.java
+11
-0
bootstrap.yml
src/main/resources/bootstrap.yml
+10
-0
No files found.
pom.xml
View file @
a28cbd2f
...
...
@@ -118,6 +118,12 @@
<version>
1.0.2
</version>
</dependency>
<dependency>
<groupId>
com.afanticar
</groupId>
<artifactId>
common-es
</artifactId>
<version>
1.3.0
</version>
</dependency>
<!-- mybatis的分页插件 -->
<dependency>
<groupId>
com.github.pagehelper
</groupId>
...
...
src/main/java/com/afanticar/afantiopenapi/AfantiOpenApiApplication.java
View file @
a28cbd2f
...
...
@@ -20,6 +20,8 @@ import org.springframework.scheduling.annotation.EnableScheduling;
public
class
AfantiOpenApiApplication
{
public
static
void
main
(
String
[]
args
)
{
System
.
setProperty
(
"mybatis - plus.configuration.log - impl"
,
"org.apache.ibatis.logging.stdout.StdOutImpl"
);
SpringApplication
.
run
(
AfantiOpenApiApplication
.
class
,
args
);
}
...
...
src/main/java/com/afanticar/afantiopenapi/config/RedissonConfig.java
View file @
a28cbd2f
...
...
@@ -27,8 +27,14 @@ public class RedissonConfig {
@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
);
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
());
}
...
...
src/main/java/com/afanticar/afantiopenapi/config/WebMvcConfig.java
View file @
a28cbd2f
package
com
.
afanticar
.
afantiopenapi
.
config
;
import
com.afanticar.afantiopenapi.controller.BydOpenController
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
...
...
@@ -18,14 +19,19 @@ public class WebMvcConfig implements WebMvcConfigurer {
// @Resource
// TokenInterceptor tokenInterceptor;
@Resource
BydOpenController
bydOpenController
;
@Bean
public
TokenInterceptor
getLoginInterceptor
(){
return
new
TokenInterceptor
();
}
@Override
public
void
addInterceptors
(
InterceptorRegistry
register
)
{
register
.
addInterceptor
(
getLoginInterceptor
());
register
.
addInterceptor
(
bydOpenController
);
}
}
\ No newline at end of file
src/main/java/com/afanticar/afantiopenapi/constant/PrincipalEnum.java
View file @
a28cbd2f
package
com
.
afanticar
.
afantiopenapi
.
constant
;
import
java.util.Arrays
;
import
java.util.Optional
;
public
enum
PrincipalEnum
{
BYD_WC
(
"1270917477950984192"
,
"比亚迪-王朝"
),
BYD_HY
(
"1270917477950984192"
,
"比亚迪-海洋"
),
BYD_TS
(
"1270917477950984192"
,
"比亚迪-腾势"
),
BYD_FCB
(
"1270917477950984192"
,
"比亚迪-方程豹"
);
BYD_FCB
(
"1270917477950984192"
,
"比亚迪-方程豹"
),
SQDZ
(
"869753088184930304"
,
"SWM斯威汽车"
);
// TODO: 修改ID
public
final
String
id
;
public
final
String
n
ame
;
public
final
String
shortN
ame
;
PrincipalEnum
(
String
id
,
String
n
ame
)
{
PrincipalEnum
(
String
id
,
String
shortN
ame
)
{
this
.
id
=
id
;
this
.
name
=
name
;
this
.
shortName
=
shortName
;
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
PrincipalEnum
.
BYD_HY
.
name
());
}
public
static
Optional
<
PrincipalEnum
>
getPrincipal
(
String
principalCode
)
{
return
Arrays
.
stream
(
PrincipalEnum
.
values
()).
filter
(
x
->
x
.
name
().
equals
(
principalCode
)).
findFirst
();
}
}
src/main/java/com/afanticar/afantiopenapi/controller/BaseController.java
View file @
a28cbd2f
...
...
@@ -4,13 +4,19 @@ import cn.hutool.core.date.DateException;
import
cn.hutool.core.date.DateUnit
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.afanticar.afantiopenapi.constant.ExceptionEnum
;
import
com.afanticar.afantiopenapi.model.BaseResponse
;
import
com.afanticar.afantiopenapi.model.dto.FawActivityDTO
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.SneakyThrows
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.springframework.web.servlet.handler.HandlerInterceptorAdapter
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Iterator
;
...
...
@@ -22,7 +28,7 @@ import java.util.Map;
* @author LSZ 2021/01/07 16:34
* @contact 648748030@qq.com
*/
public
class
BaseController
{
public
class
BaseController
extends
HandlerInterceptorAdapter
{
private
static
String
CODE_SUCCESS
=
"200"
;
...
...
@@ -114,4 +120,12 @@ public class BaseController {
return
null
;
}
@SneakyThrows
public
static
void
setResponse
(
HttpServletResponse
response
,
Integer
errorCode
,
String
msg
)
{
response
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setStatus
(
errorCode
);
response
.
setContentType
(
"application/json"
);
response
.
getWriter
().
append
(
JSONObject
.
toJSONString
(
BaseController
.
error
(
errorCode
.
toString
(),
msg
)));
}
}
src/main/java/com/afanticar/afantiopenapi/controller/BydOpenController.java
0 → 100644
View file @
a28cbd2f
This diff is collapsed.
Click to expand it.
src/main/java/com/afanticar/afantiopenapi/mapper/MemberInfoMapper.java
View file @
a28cbd2f
...
...
@@ -9,17 +9,19 @@ import org.apache.ibatis.annotations.Select;
import
java.util.List
;
@Mapper
@DS
(
"
tm
p"
)
@DS
(
"
afanti-bi-ap
p"
)
public
interface
MemberInfoMapper
extends
BaseMapper
<
MemberInfo
>
{
@Select
(
"select * \n"
+
@Select
(
"<script>"
+
"select * \n"
+
"from dim_matrix_member_info \n"
+
"where end_time ='2099-01-01'\n"
+
"and is_valid =1\n"
+
"and matrix_member_id in "
+
"<foreach collection='memberIds' item='item' open='(' separator=',' close=')'>"
+
" #{item} "
+
"</foreach>"
"</foreach>"
+
"</script>"
)
List
<
MemberInfo
>
queryMemberInfoListByMemberIds
(
List
<
String
>
memberIds
);
}
src/main/java/com/afanticar/afantiopenapi/mapper/XiaoHongShuAuthorDayMapper.java
View file @
a28cbd2f
...
...
@@ -3,9 +3,30 @@ package com.afanticar.afantiopenapi.mapper;
import
com.afanticar.afantiopenapi.model.entity.XiaoHongShuAuthorDay
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
java.time.LocalDate
;
@Mapper
@DS
(
"
tm
p"
)
@DS
(
"
afanti-bi-ap
p"
)
public
interface
XiaoHongShuAuthorDayMapper
extends
BaseMapper
<
XiaoHongShuAuthorDay
>
{
@Select
(
"select * "
+
"from dws_xiaohongshu_author_action_day \n"
+
"where author_id in (\n"
+
" select author_id from ads_xiaohongshu_author_info \n"
+
" where contains(principal_ids, #{principalId}) and is_deleted=0 \n"
+
")\n"
+
"and statistics_day >= #{startDate} \n"
+
"and statistics_day <= #{endDate} \n"
+
"order by statistics_day,author_id"
)
Page
<
XiaoHongShuAuthorDay
>
queryAuthorDayByPrincipalId
(
Page
page
,
@Param
(
"principalId"
)
String
principalId
,
@Param
(
"startDate"
)
LocalDate
startDate
,
@Param
(
"endDate"
)
LocalDate
endDate
);
}
src/main/java/com/afanticar/afantiopenapi/mapper/XiaoHongShuAuthorInfoMapper.java
View file @
a28cbd2f
package
com
.
afanticar
.
afantiopenapi
.
mapper
;
import
com.afanticar.afantiopenapi.model.entity.MemberInfo
;
import
com.afanticar.afantiopenapi.model.entity.XiaoHongShuAuthorInfo
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Select
;
import
java.util.List
;
@Mapper
@DS
(
"
tm
p"
)
@DS
(
"
afanti-bi-ap
p"
)
public
interface
XiaoHongShuAuthorInfoMapper
extends
BaseMapper
<
XiaoHongShuAuthorInfo
>
{
@Select
(
"<script>"
+
"select * \n"
+
"from ads_xiaohongshu_author_info \n"
+
"where 1=1\n"
+
"and author_id in \n"
+
"<foreach collection='authorIds' item='item' open='(' separator=',' close=')'>"
+
" #{item} "
+
"</foreach>"
+
"</script>"
)
List
<
XiaoHongShuAuthorInfo
>
queryAuthorInfoListByAuthorIds
(
List
<
String
>
authorIds
);
}
src/main/java/com/afanticar/afantiopenapi/mapper/XiaoHongShuMemberDayMapper.java
View file @
a28cbd2f
package
com
.
afanticar
.
afantiopenapi
.
mapper
;
import
com.afanticar.afantiopenapi.model.entity.XiaoHongShuMemberDay
;
import
com.afanticar.afantiopenapi.model.vo.BydXiaoHongShuMemberDayVO
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
java.time.LocalDate
;
import
java.util.List
;
import
java.util.Set
;
@Mapper
@DS
(
"
tm
p"
)
@DS
(
"
afanti-bi-ap
p"
)
public
interface
XiaoHongShuMemberDayMapper
extends
BaseMapper
<
XiaoHongShuMemberDay
>
{
@Select
(
"select a.* \n"
+
"from dws_xiaohongshu_member_action_day a \n"
+
"inner join (select matrix_member_ids from ads_xiaohongshu_author_info where contains(principal_ids, #{principalId})) b \n"
+
"on contains(b.matrix_member_ids,a.matrix_member_id)\n"
+
"where 1=1\n"
+
@Select
(
"select a.matrix_member_id,b.matrix_member_name as member_name,b.matrix_member_code as member_code,\n"
+
" b.area_name,b.village_name,b.principal_name,b.province_name,b.city_name,\n"
+
" a.statistics_day as stats_date,a.fans_count_total as fans_cnt_total,\n"
+
" a.fans_count_total_di as fans_cnt_di,a.note_count_di as note_cnt_di,\n"
+
" a.note_digg_count_di as note_like_cnt_di,a.note_collect_count_di as note_collect_count_di,\n"
+
" a.note_share_count_di as note_share_cnt_di \n"
+
"from dws_xiaohongshu_member_action_day a \n"
+
"inner join dim_matrix_member_info b on a.matrix_member_id =b.matrix_member_id\n"
+
"where 1=1 \n"
+
"and statistics_day >= #{startDate}\n"
+
"and statistics_day <= #{endDate}"
)
List
<
XiaoHongShuMemberDay
>
queryMemberDayByPrincipalId
(
@Param
(
"principalId"
)
String
principalId
,
@Param
(
"startDate"
)
LocalDate
startDate
,
@Param
(
"endDate"
)
LocalDate
endDate
);
"and statistics_day <= #{endDate}\n"
+
"and principal_id=#{principalId} \n"
+
"and end_time='2099-01-01' \n"
+
"and is_valid=1 \n"
+
"order by statistics_day,a.matrix_member_id"
)
Page
<
BydXiaoHongShuMemberDayVO
>
queryMemberDayByPrincipalId
(
Page
page
,
@Param
(
"principalId"
)
String
principalId
,
@Param
(
"startDate"
)
LocalDate
startDate
,
@Param
(
"endDate"
)
LocalDate
endDate
);
}
src/main/java/com/afanticar/afantiopenapi/mapper/XiaoHongShuNoteDayMapper.java
View file @
a28cbd2f
...
...
@@ -3,9 +3,42 @@ package com.afanticar.afantiopenapi.mapper;
import
com.afanticar.afantiopenapi.model.entity.XiaoHongShuNoteDay
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
java.time.LocalDate
;
@Mapper
@DS
(
"
tm
p"
)
@DS
(
"
afanti-bi-ap
p"
)
public
interface
XiaoHongShuNoteDayMapper
extends
BaseMapper
<
XiaoHongShuNoteDay
>
{
@Select
(
"<script> \n"
+
"select * \n"
+
"from dws_xiaohongshu_note_action_day \n"
+
"where author_id in (\n"
+
" select author_id from ads_xiaohongshu_author_info \n"
+
" where contains(principal_ids, #{principalId}) and is_deleted=0 \n"
+
") \n"
+
"<if test=\"pubStart != null and pubEnd != null\">"
+
"and note_id in (\n"
+
" select note_id from ads_xiaohongshu_note_info \n"
+
" where publish_time between #{pubStart} and #{pubEnd} \n"
+
")\n"
+
"</if>"
+
"and statistics_day >= #{statsStart} \n"
+
"and statistics_day >= #{statsEnd} \n"
+
"order by statistics_day,note_id \n"
+
"</script>"
)
Page
<
XiaoHongShuNoteDay
>
queryNoteDayByPrincipalId
(
Page
page
,
@Param
(
"principalId"
)
String
principalId
,
@Param
(
"statsStart"
)
LocalDate
statsStart
,
@Param
(
"statsEnd"
)
LocalDate
statsEnd
,
@Param
(
"pubStart"
)
LocalDate
pubStart
,
@Param
(
"pubEnd"
)
LocalDate
pubEnd
);
}
src/main/java/com/afanticar/afantiopenapi/mapper/XiaoHongShuNoteInfoMapper.java
View file @
a28cbd2f
package
com
.
afanticar
.
afantiopenapi
.
mapper
;
import
com.afanticar.afantiopenapi.model.entity.XiaoHongShuAuthorInfo
;
import
com.afanticar.afantiopenapi.model.entity.XiaoHongShuNoteInfo
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Select
;
import
java.util.List
;
@Mapper
@DS
(
"
tm
p"
)
@DS
(
"
afanti-bi-ap
p"
)
public
interface
XiaoHongShuNoteInfoMapper
extends
BaseMapper
<
XiaoHongShuNoteInfo
>
{
@Select
(
"<script>"
+
"select * \n"
+
"from ads_xiaohongshu_note_info \n"
+
"where 1=1\n"
+
"and note_id in \n"
+
"<foreach collection='noteIds' item='item' open='(' separator=',' close=')'>"
+
" #{item} "
+
"</foreach>"
+
"</script>"
)
List
<
XiaoHongShuNoteInfo
>
queryNoteInfoListByNoteIds
(
List
<
String
>
noteIds
);
}
src/main/java/com/afanticar/afantiopenapi/model/entity/BaseADB.java
0 → 100644
View file @
a28cbd2f
package
com
.
afanticar
.
afantiopenapi
.
model
.
entity
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
public
class
BaseADB
{
public
List
<
String
>
getList
(
String
text
)
{
return
Arrays
.
stream
(
Optional
.
ofNullable
(
text
).
orElse
(
""
)
.
replace
(
"["
,
""
)
.
replace
(
"]"
,
""
)
.
replace
(
"\""
,
""
)
.
split
(
","
)
)
.
map
(
String:
:
trim
)
.
filter
(
x
->
!
""
.
equals
(
x
))
.
collect
(
Collectors
.
toList
());
}
}
src/main/java/com/afanticar/afantiopenapi/model/entity/XiaoHongShuAuthorDay.java
View file @
a28cbd2f
...
...
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import
com.fasterxml.jackson.databind.annotation.JsonNaming
;
import
lombok.Data
;
import
java.time.LocalDate
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -12,11 +13,11 @@ import java.util.List;
@TableName
(
"dws_xiaohongshu_author_action_day"
)
@JsonNaming
(
value
=
com
.
fasterxml
.
jackson
.
databind
.
PropertyNamingStrategy
.
SnakeCaseStrategy
.
class
)
@JSONType
(
naming
=
com
.
alibaba
.
fastjson
.
PropertyNamingStrategy
.
SnakeCase
)
public
class
XiaoHongShuAuthorDay
{
public
class
XiaoHongShuAuthorDay
extends
BaseADB
{
/**
* 统计日期,格式为YYYY-MM-DD 00:00:00
*/
private
Date
statisticsDay
;
private
Local
Date
statisticsDay
;
/**
* 主播ID
...
...
@@ -101,7 +102,7 @@ public class XiaoHongShuAuthorDay {
/**
* 成员ID数组
*/
private
List
<
String
>
matrixMemberIds
;
private
String
matrixMemberIds
;
/**
* 是否为推测数据
...
...
@@ -202,4 +203,8 @@ public class XiaoHongShuAuthorDay {
* 本日直播总观看人次
*/
private
Integer
liveTotalWatchUserTime
;
public
List
<
String
>
getMemberIds
()
{
return
getList
(
this
.
matrixMemberIds
);
}
}
src/main/java/com/afanticar/afantiopenapi/model/entity/XiaoHongShuAuthorInfo.java
View file @
a28cbd2f
package
com
.
afanticar
.
afantiopenapi
.
model
.
entity
;
import
com.alibaba.fastjson.annotation.JSONType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.databind.annotation.JsonNaming
;
import
lombok.Data
;
import
java.
util.Dat
e
;
import
java.
time.LocalDateTim
e
;
import
java.util.List
;
@Data
@TableName
(
"ads_xiaohongshu_author_info"
)
@JsonNaming
(
value
=
com
.
fasterxml
.
jackson
.
databind
.
PropertyNamingStrategy
.
SnakeCaseStrategy
.
class
)
@JSONType
(
naming
=
com
.
alibaba
.
fastjson
.
PropertyNamingStrategy
.
SnakeCase
)
public
class
XiaoHongShuAuthorInfo
{
public
class
XiaoHongShuAuthorInfo
extends
BaseADB
{
/**
* 主播ID
*/
...
...
@@ -191,60 +193,64 @@ public class XiaoHongShuAuthorInfo {
/**
* 数据同步更新的时间点
*/
private
Dat
e
dataUpdateTime
;
private
LocalDateTim
e
dataUpdateTime
;
/**
* 账号收录时间
*/
private
Dat
e
includedTime
;
private
LocalDateTim
e
includedTime
;
/**
* 创建时间
*/
private
Dat
e
ctime
;
private
LocalDateTim
e
ctime
;
/**
* 更新时间
*/
private
Dat
e
mtime
;
private
LocalDateTim
e
mtime
;
/**
* 成员ids
*/
private
List
<
String
>
matrixMemberIds
;
private
String
matrixMemberIds
;
/**
* 获赞+收藏
*/
private
Integer
favedCount
;
//
private Integer favedCount;
/**
* 关注数
*/
private
Integer
followingCount
;
//
private Integer followingCount;
/**
* 点赞数
*/
private
Integer
likeCountTotal
;
//
private Integer likeCountTotal;
/**
* 收藏数
*/
private
Integer
collectCountTotal
;
//
private Integer collectCountTotal;
/**
* 主播总作品数
*/
private
Integer
noteCountTotal
;
//
private Integer noteCountTotal;
/**
* 认证类型: 0-未认证, 1-个人认证,2-企业认证(蓝v),3-机构认证
*/
private
String
verificationType
;
private
Integer
verificationType
;
/**
* 是否代运营账号,1:是,0否
*/
private
Integer
isAgentAuthor
;
// private Integer isAgentAuthor;
public
List
<
String
>
getMemberIds
()
{
return
getList
(
this
.
matrixMemberIds
);
}
}
src/main/java/com/afanticar/afantiopenapi/model/entity/XiaoHongShuNoteDay.java
View file @
a28cbd2f
...
...
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
import
com.fasterxml.jackson.databind.annotation.JsonNaming
;
import
lombok.Data
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -12,7 +14,7 @@ import java.util.List;
@TableName
(
"dws_xiaohongshu_note_action_day"
)
@JsonNaming
(
value
=
com
.
fasterxml
.
jackson
.
databind
.
PropertyNamingStrategy
.
SnakeCaseStrategy
.
class
)
@JSONType
(
naming
=
com
.
alibaba
.
fastjson
.
PropertyNamingStrategy
.
SnakeCase
)
public
class
XiaoHongShuNoteDay
{
public
class
XiaoHongShuNoteDay
extends
BaseADB
{
/**
* 小红书号
*/
...
...
@@ -91,22 +93,22 @@ public class XiaoHongShuNoteDay {
/**
* 统计日期,格式为YYYY-MM-DD 00:00:00
*/
private
Date
statisticsDay
;
private
Local
Date
statisticsDay
;
/**
* 入库时间
*/
private
Dat
e
ctime
;
private
LocalDateTim
e
ctime
;
/**
* 修改时间
*/
private
Dat
e
mtime
;
private
LocalDateTim
e
mtime
;
/**
* 成员ID数组
*/
private
List
<
String
>
matrixMemberIds
;
private
String
matrixMemberIds
;
/**
* 是否为推测数据
...
...
@@ -127,4 +129,8 @@ public class XiaoHongShuNoteDay {
* 预估的模拟阅读增量:(点赞增量+评论增量+收藏增量+转发增量)*20
*/
private
Integer
simulateReadCountDi
;
public
List
<
String
>
getMemberIds
()
{
return
getList
(
this
.
matrixMemberIds
);
}
}
src/main/java/com/afanticar/afantiopenapi/model/entity/XiaoHongShuNoteInfo.java
View file @
a28cbd2f
package
com
.
afanticar
.
afantiopenapi
.
model
.
entity
;
import
com.alibaba.fastjson.annotation.JSONType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.databind.annotation.JsonNaming
;
import
lombok.Data
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -12,7 +14,7 @@ import java.util.List;
@TableName
(
"ads_xiaohongshu_note_info"
)
@JsonNaming
(
value
=
com
.
fasterxml
.
jackson
.
databind
.
PropertyNamingStrategy
.
SnakeCaseStrategy
.
class
)
@JSONType
(
naming
=
com
.
alibaba
.
fastjson
.
PropertyNamingStrategy
.
SnakeCase
)
public
class
XiaoHongShuNoteInfo
{
public
class
XiaoHongShuNoteInfo
extends
BaseADB
{
/**
* 小红书号
*/
...
...
@@ -86,17 +88,17 @@ public class XiaoHongShuNoteInfo {
/**
* 成员ids
*/
private
List
<
String
>
matrixMemberIds
;
private
String
matrixMemberIds
;
/**
* 笔记发布时间
*/
private
Dat
e
publishTime
;
private
LocalDateTim
e
publishTime
;
/**
* 数据同步更新的时间点
*/
private
Dat
e
dataUpdateTime
;
private
LocalDateTim
e
dataUpdateTime
;
/**
* 笔记状态: 1-可见,0-不可见
...
...
@@ -106,7 +108,7 @@ public class XiaoHongShuNoteInfo {
/**
* 话题ID列表
*/
private
List
<
String
>
topicIds
;
private
String
topicIds
;
/**
* 话题名
...
...
@@ -172,4 +174,15 @@ public class XiaoHongShuNoteInfo {
* 产品名称
*/
private
String
goodsName
;
public
List
<
String
>
getMemberIds
()
{
return
getList
(
this
.
matrixMemberIds
);
}
public
List
<
String
>
getTopicNames
()
{
return
getList
(
this
.
noteTopic
);
}
}
src/main/java/com/afanticar/afantiopenapi/model/qto/XiaoHongShuNoteDocQTO.java
0 → 100644
View file @
a28cbd2f
package
com
.
afanticar
.
afantiopenapi
.
model
.
qto
;
import
com.afanticar.core.annotation.Id
;
import
com.afanticar.core.annotation.Index
;
import
com.alibaba.fastjson.PropertyNamingStrategy
;
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.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
@Data
@AllArgsConstructor
@NoArgsConstructor
@JSONType
(
naming
=
PropertyNamingStrategy
.
SnakeCase
)
@JsonNaming
(
value
=
com
.
fasterxml
.
jackson
.
databind
.
PropertyNamingStrategy
.
SnakeCaseStrategy
.
class
)
@ApiModel
(
value
=
"小红书笔记正文"
,
description
=
"小红书笔记正文"
)
@Index
(
name
=
"dwd-xiaohongshu-note-info"
)
public
class
XiaoHongShuNoteDocQTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
8753897697871869807L
;
@Id
private
String
id
;
@ApiModelProperty
(
"笔记ID"
)
private
String
noteId
;
/**
* 违规类型:22:画面提及违禁词
*/
@ApiModelProperty
(
"正文"
)
private
String
description
;
}
src/main/java/com/afanticar/afantiopenapi/model/vo/BydXiaoHongShuAuthorDayVO.java
0 → 100644
View file @
a28cbd2f
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.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
import
java.util.List
;
@Data
@JsonNaming
(
value
=
com
.
fasterxml
.
jackson
.
databind
.
PropertyNamingStrategy
.
SnakeCaseStrategy
.
class
)
@JSONType
(
naming
=
com
.
alibaba
.
fastjson
.
PropertyNamingStrategy
.
SnakeCase
)
public
class
BydXiaoHongShuAuthorDayVO
{
@ApiModelProperty
(
value
=
"主播ID"
,
example
=
"123456"
)
private
String
authorId
;
@ApiModelProperty
(
value
=
"主播昵称"
,
example
=
"张三"
)
private
String
nickname
;
@ApiModelProperty
(
value
=
"主播code"
,
example
=
"a123456"
)
private
String
code
;
@ApiModelProperty
(
value
=
"主播头像"
,
example
=
"http://xxxxx"
)
private
String
avatarUrl
;
@ApiModelProperty
(
value
=
"是否蓝V"
,
example
=
"true|false"
)
private
boolean
isBlueV
;
@ApiModelProperty
(
value
=
"账号收录时间"
,
example
=
"2024-11-01 14:21:12"
)
private
LocalDateTime
includeTime
;
@ApiModelProperty
(
value
=
"成员信息"
,
example
=
"[{...},{...}]"
)
private
List
<
MemberInfo
>
memberInfos
;
@ApiModelProperty
(
value
=
"统计日期"
,
example
=
"2023-03-03"
)
private
LocalDate
statsDate
;
@ApiModelProperty
(
value
=
"粉丝数"
,
example
=
"200"
)
private
Integer
fansCntTotal
;
@ApiModelProperty
(
value
=
"粉丝新增数"
,
example
=
"200"
)
private
Integer
fansCntDi
;
@ApiModelProperty
(
value
=
"笔记新增数"
,
example
=
"200"
)
private
Integer
noteCntDi
;
@ApiModelProperty
(
value
=
"笔记点赞新增数"
,
example
=
"200"
)
private
Integer
noteLikeCntDi
;
@ApiModelProperty
(
value
=
"笔记评论新增数"
,
example
=
"200"
)
private
Integer
noteCommentCntDi
;
@ApiModelProperty
(
value
=
"笔记收藏新增数"
,
example
=
"200"
)
private
Integer
noteFavoriteCntDi
;
@ApiModelProperty
(
value
=
"笔记分享新增数"
,
example
=
"200"
)
private
Integer
noteShareCntDi
;
@Data
public
static
class
MemberInfo
{
@ApiModelProperty
(
value
=
"品牌名称"
,
example
=
"比亚迪-海洋"
)
private
String
principalName
;
@ApiModelProperty
(
value
=
"门店ID"
,
example
=
"A11111"
)
private
String
memberId
;
@ApiModelProperty
(
value
=
"门店名称"
,
example
=
"南京宁星"
)
private
String
memberName
;
@ApiModelProperty
(
value
=
"门店编码"
,
example
=
"ABC123"
)
private
String
memberCode
;
@ApiModelProperty
(
value
=
"大区名称"
,
example
=
"大区名称1"
)
private
String
areaName
;
@ApiModelProperty
(
value
=
"小区名称"
,
example
=
"200"
)
private
String
villageName
;
@ApiModelProperty
(
value
=
"省份名称"
,
example
=
"广东"
)
private
String
provinceName
;
@ApiModelProperty
(
value
=
"城市名称"
,
example
=
"深圳"
)
private
String
cityName
;
}
}
src/main/java/com/afanticar/afantiopenapi/model/vo/BydXiaoHongShuMemberDayVO.java
View file @
a28cbd2f
...
...
@@ -12,44 +12,45 @@ import java.util.List;
@JsonNaming
(
value
=
com
.
fasterxml
.
jackson
.
databind
.
PropertyNamingStrategy
.
SnakeCaseStrategy
.
class
)
@JSONType
(
naming
=
com
.
alibaba
.
fastjson
.
PropertyNamingStrategy
.
SnakeCase
)
public
class
BydXiaoHongShuMemberDayVO
{
/**
* BydXiaoHongShuMemberDayVO(storeName=null, storeCode=null, storeId=null, storeType=null, areaName=南区,
* villageName=, principalName=SWM斯威汽车, provinceName=广东省, cityName=广州市, statsDate=null, fansCntTotal=null,
* fansCntDi=null, noteCntDi=null, noteLikeCntDi=null, noteCommentCntDi=null, noteFavoriteCntDi=null, noteShareCntDi=null)
*
* b.matrix_member_name as member_name,b.matrix_member_code as member_code,\n" +
* " b.area_name,b.village_name,b.principal_name,b.province_name,b.city_name,\n" +
* " a.statistics_day,a.fans_count_total,a.fans_count_total_di,a.note_count_di,\n" +
* " a.note_digg_count_di,a.note_collect_count_di,a.note_share_count_di \n" +
*/
@ApiModelProperty
(
value
=
"品牌名称"
,
example
=
"比亚迪-海洋"
)
private
String
principalName
;
@ApiModelProperty
(
value
=
"门店名称"
,
example
=
"南京宁星"
)
private
Integer
store
Name
;
private
String
member
Name
;
@ApiModelProperty
(
value
=
"门店编码"
,
example
=
"ABC123"
)
private
Integer
storeCode
;
@ApiModelProperty
(
value
=
"门店ID"
,
example
=
"200"
)
private
Integer
storeId
;
@ApiModelProperty
(
value
=
"门店类型"
,
example
=
"门店类型1"
)
private
Integer
storeType
;
private
String
memberCode
;
@ApiModelProperty
(
value
=
"大区名称"
,
example
=
"大区名称1"
)
private
Integer
areaName
;
@ApiModelProperty
(
value
=
"大区ID"
,
example
=
"200"
)
private
Integer
villageName
;
@ApiModelProperty
(
value
=
"品牌名称"
,
example
=
"比亚迪-海洋"
)
private
Integer
principalName
;
private
String
areaName
;
@ApiModelProperty
(
value
=
"小区名称"
,
example
=
"200"
)
private
String
villageName
;
@ApiModelProperty
(
value
=
"省份名称"
,
example
=
"广东"
)
private
Integer
provinceName
;
private
String
provinceName
;
@ApiModelProperty
(
value
=
"城市名称"
,
example
=
"深圳"
)
private
Integer
cityName
;
private
List
<
BydXiaoHongShuMemberDayDetailVO
>
detailList
;
private
String
cityName
;
@Data
public
static
class
BydXiaoHongShuMemberDayDetailVO
{
@ApiModelProperty
(
value
=
"统计日期"
,
example
=
"2023-03-03"
)
private
LocalDate
statsDate
;
@ApiModelProperty
(
value
=
"粉丝数"
,
example
=
"200"
)
private
Integer
fansCntTotal
;
@ApiModelProperty
(
value
=
"粉丝新增数"
,
example
=
"200"
)
private
Integer
fansCntDi
;
@ApiModelProperty
(
value
=
"笔记新增数"
,
example
=
"200"
)
private
Integer
noteCntDi
;
@ApiModelProperty
(
value
=
"笔记点赞新增数"
,
example
=
"200"
)
private
Integer
noteLikeCntDi
;
@ApiModelProperty
(
value
=
"笔记评论新增数"
,
example
=
"200"
)
private
Integer
noteCommentCntDi
;
@ApiModelProperty
(
value
=
"笔记收藏新增数"
,
example
=
"200"
)
private
Integer
noteFavoriteCntDi
;
@ApiModelProperty
(
value
=
"笔记分享新增数"
,
example
=
"200"
)
private
Integer
noteShareCntDi
;
}
@ApiModelProperty
(
value
=
"统计日期"
,
example
=
"2023-03-03"
)
private
LocalDate
statsDate
;
@ApiModelProperty
(
value
=
"粉丝数"
,
example
=
"200"
)
private
Integer
fansCntTotal
;
@ApiModelProperty
(
value
=
"粉丝新增数"
,
example
=
"200"
)
private
Integer
fansCntDi
;
@ApiModelProperty
(
value
=
"笔记新增数"
,
example
=
"200"
)
private
Integer
noteCntDi
;
@ApiModelProperty
(
value
=
"笔记点赞新增数"
,
example
=
"200"
)
private
Integer
noteLikeCntDi
;
@ApiModelProperty
(
value
=
"笔记评论新增数"
,
example
=
"200"
)
private
Integer
noteCommentCntDi
;
@ApiModelProperty
(
value
=
"笔记收藏新增数"
,
example
=
"200"
)
private
Integer
noteFavoriteCntDi
;
@ApiModelProperty
(
value
=
"笔记分享新增数"
,
example
=
"200"
)
private
Integer
noteShareCntDi
;
}
src/main/java/com/afanticar/afantiopenapi/model/vo/BydXiaoHongShuNoteDayVO.java
0 → 100644
View file @
a28cbd2f
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.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.List
;
@Data
@JsonNaming
(
value
=
com
.
fasterxml
.
jackson
.
databind
.
PropertyNamingStrategy
.
SnakeCaseStrategy
.
class
)
@JSONType
(
naming
=
com
.
alibaba
.
fastjson
.
PropertyNamingStrategy
.
SnakeCase
)
public
class
BydXiaoHongShuNoteDayVO
{
@ApiModelProperty
(
value
=
"笔记ID"
,
example
=
"123456"
)
private
String
noteId
;
@ApiModelProperty
(
value
=
"统计日期"
,
example
=
"2023-03-03"
)
private
LocalDate
statsDate
;
@ApiModelProperty
(
value
=
"笔记标题"
,
example
=
"..."
)
private
String
noteTitle
;
@ApiModelProperty
(
value
=
"主播ID"
,
example
=
"123456"
)
private
String
authorId
;
@ApiModelProperty
(
value
=
"发布时间"
,
example
=
"2024-11-01 00:10:23"
)
private
LocalDateTime
publishTime
;
@ApiModelProperty
(
value
=
"笔记类型"
,
example
=
"笔记类型(normal:图文,video:视频)"
)
private
String
noteType
;
@ApiModelProperty
(
value
=
"分享链接"
,
example
=
"..."
)
private
String
shareUrl
;
@ApiModelProperty
(
value
=
"封面链接"
,
example
=
"..."
)
private
String
coverUrl
;
@ApiModelProperty
(
value
=
"话题列表"
,
example
=
"..."
)
private
List
<
String
>
topicNames
;
@ApiModelProperty
(
value
=
"笔记点赞数"
,
example
=
"200"
)
private
Integer
likeCnt
;
@ApiModelProperty
(
value
=
"笔记评论数"
,
example
=
"200"
)
private
Integer
commentCnt
;
@ApiModelProperty
(
value
=
"笔记收藏数"
,
example
=
"200"
)
private
Integer
collectCnt
;
@ApiModelProperty
(
value
=
"笔记分享数"
,
example
=
"200"
)
private
Integer
shareCnt
;
@ApiModelProperty
(
value
=
"笔记正文"
,
example
=
"..."
)
private
String
description
;
@ApiModelProperty
(
value
=
"数据更新时间"
,
example
=
"...."
)
private
LocalDateTime
dataUpdateTime
;
}
src/main/java/com/afanticar/afantiopenapi/service/BaseService.java
View file @
a28cbd2f
...
...
@@ -49,7 +49,12 @@ public class BaseService {
return
null
;
}
public
BaseResponse
pageApiLimit
(
String
dataType
,
Integer
limit
,
Integer
limitPeriod
)
{
/**
* @param dataType
* @param limit 对应trySetRate中的rate
* @param limitPeriod 对应trySetRate中的rateInterval,即rate time interval
*/
public
<
T
>
BaseResponse
<
T
>
pageApiLimit
(
String
dataType
,
Integer
limit
,
Integer
limitPeriod
)
{
try
{
Thread
.
sleep
(
5000
);
}
catch
(
InterruptedException
e
)
{
...
...
src/main/java/com/afanticar/afantiopenapi/service/BydOpenService.java
View file @
a28cbd2f
...
...
@@ -2,18 +2,23 @@ package com.afanticar.afantiopenapi.service;
import
com.afanticar.afantiopenapi.constant.PrincipalEnum
;
import
com.afanticar.afantiopenapi.mapper.*
;
import
com.afanticar.afantiopenapi.model.entity.HongqiAwemeIncentiveMonthly
;
import
com.afanticar.afantiopenapi.model.entity.MemberInfo
;
import
com.afanticar.afantiopenapi.model.entity.XiaoHongShuMemberDay
;
import
com.afanticar.afantiopenapi.model.entity.XiaoHongShuNoteInfo
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.afanticar.afantiopenapi.model.entity.*
;
import
com.afanticar.afantiopenapi.model.qto.XiaoHongShuNoteDocQTO
;
import
com.afanticar.afantiopenapi.model.vo.BasePageVO
;
import
com.afanticar.afantiopenapi.model.vo.BydXiaoHongShuAuthorDayVO
;
import
com.afanticar.afantiopenapi.model.vo.BydXiaoHongShuMemberDayVO
;
import
com.afanticar.afantiopenapi.model.vo.BydXiaoHongShuNoteDayVO
;
import
com.afanticar.core.entity.EsBaseQuery
;
import
com.afanticar.core.entity.InnerHits
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.time.LocalDate
;
import
java.util.List
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
@Service
...
...
@@ -27,23 +32,137 @@ public class BydOpenService {
@Resource
XiaoHongShuAuthorDayMapper
authorDayMapper
;
@Resource
XiaoHongShuNoteInfo
noteInfoMapper
;
XiaoHongShuNoteInfo
Mapper
noteInfoMapper
;
@Resource
XiaoHongShuNoteDayMapper
noteDayMapper
;
@Resource
XiaoHongShuNoteDocService
noteDocService
;
public
BasePageVO
<
BydXiaoHongShuMemberDayVO
>
fetchMemberDaySnap
(
PrincipalEnum
principal
,
LocalDate
startDate
,
LocalDate
endDate
,
Integer
currentPage
,
Integer
pageSize
){
Page
<
BydXiaoHongShuMemberDayVO
>
page
=
new
Page
<>(
currentPage
,
pageSize
);
Page
<
BydXiaoHongShuMemberDayVO
>
data
=
memberDayMapper
.
queryMemberDayByPrincipalId
(
page
,
principal
.
id
,
startDate
,
endDate
);
// List<String> memberIds = data.stream().map(XiaoHongShuMemberDay::getMatrixMemberId).collect(Collectors.toList());
// List<MemberInfo> memberInfos = memberInfoMapper.queryMemberInfoListByMemberIds(memberIds);
return
BasePageVO
.
restPage
((
int
)
data
.
getCurrent
(),
(
int
)
data
.
getSize
(),
(
int
)
data
.
getTotal
(),
(
int
)
data
.
getPages
(),
data
.
getRecords
());
}
public
BasePageVO
<
BydXiaoHongShuAuthorDayVO
>
fetchAuthorDaySnap
(
PrincipalEnum
principal
,
LocalDate
startDate
,
LocalDate
endDate
,
Integer
currentPage
,
Integer
pageSize
){
Page
<
XiaoHongShuAuthorDay
>
page
=
new
Page
<>(
currentPage
,
pageSize
);
Page
<
XiaoHongShuAuthorDay
>
data
=
authorDayMapper
.
queryAuthorDayByPrincipalId
(
page
,
principal
.
id
,
startDate
,
endDate
);
List
<
String
>
authorIds
=
data
.
getRecords
().
stream
().
map
(
XiaoHongShuAuthorDay:
:
getAuthorId
).
distinct
().
collect
(
Collectors
.
toList
());
// QueryWrapper<XiaoHongShuAuthorInfo> wrapper = new QueryWrapper<>();
// wrapper.in("author_id", authorIds);
Map
<
String
,
XiaoHongShuAuthorInfo
>
authorInfos
=
authorInfoMapper
.
queryAuthorInfoListByAuthorIds
(
authorIds
).
stream
().
distinct
()
.
collect
(
Collectors
.
toMap
(
XiaoHongShuAuthorInfo:
:
getAuthorId
,
Function
.
identity
()));
public
void
fetchMemberDayData
(
PrincipalEnum
principal
,
LocalDate
startDate
,
LocalDate
endDate
,
Integer
pageNum
,
Integer
pageSize
){
IPage
<
XiaoHongShuMemberDay
>
page
=
new
Page
<>(
pageNum
,
pageSize
);
QueryWrapper
<
XiaoHongShuMemberDay
>
queryWrapper
=
new
QueryWrapper
<>();
List
<
String
>
memberIds
=
authorInfos
.
values
().
stream
()
.
flatMap
(
o
->
o
.
getMemberIds
().
stream
())
.
collect
(
Collectors
.
toList
());
List
<
XiaoHongShuMemberDay
>
data
=
memberDayMapper
.
queryMemberDayByPrincipalId
(
principal
.
id
,
startDate
,
endDate
);
List
<
String
>
memberIds
=
data
.
stream
().
map
(
XiaoHongShuMemberDay:
:
getMatrixMemberId
).
collect
(
Collectors
.
toList
());
List
<
MemberInfo
>
memberInfos
=
memberInfoMapper
.
queryMemberInfoListByMemberIds
(
memberIds
);
Map
<
String
,
MemberInfo
>
memberInfos
=
memberInfoMapper
.
queryMemberInfoListByMemberIds
(
memberIds
).
stream
().
distinct
()
.
collect
(
Collectors
.
toMap
(
MemberInfo:
:
getMatrixMemberId
,
Function
.
identity
()));
List
<
BydXiaoHongShuAuthorDayVO
>
voList
=
data
.
getRecords
().
stream
().
map
(
x
->{
BydXiaoHongShuAuthorDayVO
vo
=
new
BydXiaoHongShuAuthorDayVO
();
XiaoHongShuAuthorInfo
authorInfo
=
authorInfos
.
get
(
x
.
getAuthorId
());
vo
.
setAuthorId
(
x
.
getAuthorId
());
vo
.
setNickname
(
authorInfo
.
getNickname
());
vo
.
setCode
(
authorInfo
.
getCode
());
vo
.
setAvatarUrl
(
authorInfo
.
getAvatar
());
vo
.
setBlueV
(
Optional
.
ofNullable
(
authorInfo
.
getVerificationType
()).
orElse
(
100
).
equals
(
2
));
vo
.
setIncludeTime
(
authorInfo
.
getIncludedTime
());
if
(
Optional
.
ofNullable
(
authorInfo
.
getMemberIds
()).
isPresent
())
{
vo
.
setMemberInfos
(
authorInfo
.
getMemberIds
().
stream
().
map
(
id
->{
System
.
out
.
println
(
"memberId: "
+
id
);
MemberInfo
info
=
memberInfos
.
get
(
id
);
BydXiaoHongShuAuthorDayVO
.
MemberInfo
infoVo
=
new
BydXiaoHongShuAuthorDayVO
.
MemberInfo
();
infoVo
.
setMemberId
(
info
.
getMatrixMemberId
());
infoVo
.
setMemberCode
(
info
.
getMatrixMemberCode
());
infoVo
.
setMemberName
(
info
.
getMatrixMemberName
());
infoVo
.
setAreaName
(
info
.
getAreaName
());
infoVo
.
setVillageName
(
info
.
getVillageName
());
infoVo
.
setPrincipalName
(
info
.
getPrincipalName
());
infoVo
.
setCityName
(
info
.
getCityName
());
infoVo
.
setProvinceName
(
info
.
getProvinceName
());
return
infoVo
;
}).
collect
(
Collectors
.
toList
()));
}
else
{
vo
.
setMemberInfos
(
new
ArrayList
<>());
System
.
out
.
println
(
authorInfo
.
getAuthorId
());
}
vo
.
setStatsDate
(
x
.
getStatisticsDay
());
vo
.
setFansCntTotal
(
x
.
getFansCountTotal
());
vo
.
setFansCntDi
(
x
.
getFansCountTotalDi
());
vo
.
setNoteCntDi
(
x
.
getNoteCountDi
());
vo
.
setNoteLikeCntDi
(
x
.
getDiggCountDi
());
vo
.
setNoteCommentCntDi
(
x
.
getNoteCommentCountDi
());
vo
.
setNoteFavoriteCntDi
(
x
.
getCollectCountDi
());
vo
.
setNoteShareCntDi
(
x
.
getNoteShareCountDi
());
return
vo
;
}).
collect
(
Collectors
.
toList
());
return
BasePageVO
.
restPage
((
int
)
data
.
getCurrent
(),
(
int
)
data
.
getSize
(),
(
int
)
data
.
getTotal
(),
(
int
)
data
.
getPages
(),
voList
);
}
public
BasePageVO
<
BydXiaoHongShuNoteDayVO
>
fetchNoteDaySnap
(
PrincipalEnum
principal
,
LocalDate
statsStart
,
LocalDate
statsEnd
,
LocalDate
pubStart
,
LocalDate
pubEnd
,
Integer
currentPage
,
Integer
pageSize
){
Page
<
XiaoHongShuNoteDay
>
page
=
new
Page
<>(
currentPage
,
pageSize
);
Page
<
XiaoHongShuNoteDay
>
data
=
noteDayMapper
.
queryNoteDayByPrincipalId
(
page
,
principal
.
id
,
statsStart
,
statsEnd
,
pubStart
,
pubEnd
);
List
<
String
>
noteIds
=
data
.
getRecords
().
stream
().
map
(
XiaoHongShuNoteDay:
:
getNoteId
).
distinct
().
collect
(
Collectors
.
toList
());
Map
<
String
,
XiaoHongShuNoteInfo
>
noteInfos
=
noteInfoMapper
.
queryNoteInfoListByNoteIds
(
noteIds
).
stream
().
distinct
()
.
collect
(
Collectors
.
toMap
(
XiaoHongShuNoteInfo:
:
getNoteId
,
Function
.
identity
()));
EsBaseQuery
esQuery
=
new
EsBaseQuery
();
esQuery
.
terms
(
"note_id"
,
noteIds
);
List
<
InnerHits
<
XiaoHongShuNoteDocQTO
>>
searchResult
=
noteDocService
.
search
(
esQuery
).
getHits
().
getHits
();
Map
<
String
,
String
>
noteDocs
=
CollectionUtils
.
isNotEmpty
(
searchResult
)
?
searchResult
.
stream
()
.
map
(
InnerHits:
:
getSource
)
.
collect
(
Collectors
.
toMap
(
XiaoHongShuNoteDocQTO:
:
getNoteId
,
XiaoHongShuNoteDocQTO:
:
getDescription
))
:
new
HashMap
<>();
List
<
BydXiaoHongShuNoteDayVO
>
voList
=
data
.
getRecords
().
stream
().
map
(
x
->{
BydXiaoHongShuNoteDayVO
vo
=
new
BydXiaoHongShuNoteDayVO
();
vo
.
setNoteId
(
x
.
getNoteId
());
vo
.
setStatsDate
(
x
.
getStatisticsDay
());
XiaoHongShuNoteInfo
noteInfo
=
noteInfos
.
get
(
x
.
getNoteId
());
if
(
Optional
.
ofNullable
(
noteInfo
).
isPresent
())
{
vo
.
setNoteTitle
(
noteInfo
.
getNoteTitle
());
vo
.
setPublishTime
(
noteInfo
.
getPublishTime
());
vo
.
setNoteType
(
noteInfo
.
getNoteType
());
vo
.
setShareUrl
(
noteInfo
.
getShareUrl
());
vo
.
setCoverUrl
(
noteInfo
.
getCoverUrl
());
vo
.
setTopicNames
(
noteInfo
.
getTopicNames
());
}
else
{
System
.
out
.
println
(
x
.
getNoteId
());
}
vo
.
setAuthorId
(
x
.
getAuthorId
());
vo
.
setLikeCnt
(
x
.
getDiggCount
());
vo
.
setCommentCnt
(
x
.
getCommentCount
());
vo
.
setCollectCnt
(
x
.
getCollectCount
());
vo
.
setShareCnt
(
x
.
getShareCount
());
vo
.
setDescription
(
noteDocs
.
get
(
x
.
getNoteId
()));
vo
.
setDataUpdateTime
(
x
.
getMtime
());
return
vo
;
}).
collect
(
Collectors
.
toList
());
return
BasePageVO
.
restPage
((
int
)
data
.
getCurrent
(),
(
int
)
data
.
getSize
(),
(
int
)
data
.
getTotal
(),
(
int
)
data
.
getPages
(),
voList
);
}
}
src/main/java/com/afanticar/afantiopenapi/service/XiaoHongShuNoteDocService.java
0 → 100644
View file @
a28cbd2f
package
com
.
afanticar
.
afantiopenapi
.
service
;
import
com.afanticar.afantiopenapi.model.qto.XiaoHongShuNoteDocQTO
;
import
com.afanticar.core.service.EsBaseService
;
import
org.springframework.stereotype.Service
;
@Service
public
class
XiaoHongShuNoteDocService
extends
EsBaseService
<
XiaoHongShuNoteDocQTO
>
{
}
src/main/resources/bootstrap.yml
View file @
a28cbd2f
...
...
@@ -17,6 +17,7 @@ spring:
-
data-id
:
dynamic-db-afanti-tmp-vault.yml
-
data-id
:
common-redis.yml
-
data-id
:
afanti-open-api.yml
-
data-id
:
common-spark-es-vault.yml
vault
:
uri
:
https://vault.afanticar.com
authentication
:
approle
...
...
@@ -53,6 +54,15 @@ spring:
username-property
:
spring.datasource.dynamic.datasource.tmp.username
password-property
:
spring.datasource.dynamic.datasource.tmp.password
elasticsearch
:
enabled
:
true
backend
:
${spring.profiles.active}db
role
:
sparkes-role
username-property
:
elasticsearch.username
password-property
:
elasticsearch.password
mvc
:
date-format
:
"
yyyy-MM-dd"
#
#
#
...
...
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