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
214207bf
Commit
214207bf
authored
Dec 19, 2024
by
王明生
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feats: 优化代码,增加成员ID和数据更新时间
parent
9125e610
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
59 additions
and
23 deletions
+59
-23
XiaoHongShuMemberDayMapper.java
...icar/afantiopenapi/mapper/XiaoHongShuMemberDayMapper.java
+9
-11
XiaoHongShuAuthorDay.java
...icar/afantiopenapi/model/entity/XiaoHongShuAuthorDay.java
+3
-2
XiaoHongShuMemberDay.java
...icar/afantiopenapi/model/entity/XiaoHongShuMemberDay.java
+5
-3
BydXiaoHongShuAuthorDayVO.java
...car/afantiopenapi/model/vo/BydXiaoHongShuAuthorDayVO.java
+2
-0
BydXiaoHongShuMemberDayVO.java
...car/afantiopenapi/model/vo/BydXiaoHongShuMemberDayVO.java
+8
-4
BydOpenService.java
...a/com/afanticar/afantiopenapi/service/BydOpenService.java
+32
-3
No files found.
src/main/java/com/afanticar/afantiopenapi/mapper/XiaoHongShuMemberDayMapper.java
View file @
214207bf
...
@@ -16,23 +16,21 @@ import java.time.LocalDate;
...
@@ -16,23 +16,21 @@ import java.time.LocalDate;
public
interface
XiaoHongShuMemberDayMapper
extends
BaseMapper
<
XiaoHongShuMemberDay
>
{
public
interface
XiaoHongShuMemberDayMapper
extends
BaseMapper
<
XiaoHongShuMemberDay
>
{
@Select
(
"select a.matrix_member_id,b.matrix_member_name as member_name,b.matrix_member_code as member_code,\n"
+
@Select
(
"select * \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"
+
"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"
+
"where 1=1 \n"
+
"and statistics_day >= #{startDate}\n"
+
"and statistics_day >= #{startDate}\n"
+
"and statistics_day <= #{endDate}\n"
+
"and statistics_day <= #{endDate}\n"
+
"and principal_id=#{principalId} \n"
+
"and matrix_member_id in (\n"
+
"and end_time='2099-01-01' \n"
+
" select matrix_member_id \n"
+
"and is_valid=1 \n"
+
" from dim_matrix_member_info \n"
+
" where principal_id=#{principalId} \n"
+
" and is_valid=1 \n"
+
" and end_time ='2099-01-01'"
+
") \n"
+
"order by statistics_day,a.matrix_member_id"
"order by statistics_day,a.matrix_member_id"
)
)
Page
<
BydXiaoHongShuMemberDayVO
>
queryMemberDayByPrincipalId
(
Page
<
XiaoHongShuMemberDay
>
queryMemberDayByPrincipalId
(
Page
page
,
Page
page
,
@Param
(
"principalId"
)
String
principalId
,
@Param
(
"principalId"
)
String
principalId
,
@Param
(
"startDate"
)
LocalDate
startDate
,
@Param
(
"startDate"
)
LocalDate
startDate
,
...
...
src/main/java/com/afanticar/afantiopenapi/model/entity/XiaoHongShuAuthorDay.java
View file @
214207bf
...
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.annotation.JsonNaming;
...
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.annotation.JsonNaming;
import
lombok.Data
;
import
lombok.Data
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -92,12 +93,12 @@ public class XiaoHongShuAuthorDay extends BaseADB{
...
@@ -92,12 +93,12 @@ public class XiaoHongShuAuthorDay extends BaseADB{
/**
/**
* 数据更新时间
* 数据更新时间
*/
*/
private
Dat
e
mtime
;
private
LocalDateTim
e
mtime
;
/**
/**
* 数据创建时间
* 数据创建时间
*/
*/
private
Dat
e
ctime
;
private
LocalDateTim
e
ctime
;
/**
/**
* 成员ID数组
* 成员ID数组
...
...
src/main/java/com/afanticar/afantiopenapi/model/entity/XiaoHongShuMemberDay.java
View file @
214207bf
...
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
...
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
import
com.fasterxml.jackson.databind.annotation.JsonNaming
;
import
com.fasterxml.jackson.databind.annotation.JsonNaming
;
import
lombok.Data
;
import
lombok.Data
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
import
java.util.Date
;
@Data
@Data
...
@@ -50,17 +52,17 @@ public class XiaoHongShuMemberDay {
...
@@ -50,17 +52,17 @@ public class XiaoHongShuMemberDay {
/**
/**
* 统计日期,YYYY-MM-DD 00:00:00
* 统计日期,YYYY-MM-DD 00:00:00
*/
*/
private
Date
statisticsDay
;
private
Local
Date
statisticsDay
;
/**
/**
* 数据更新时间
* 数据更新时间
*/
*/
private
Dat
e
mtime
;
private
LocalDateTim
e
mtime
;
/**
/**
* 数据创建时间
* 数据创建时间
*/
*/
private
Dat
e
ctime
;
private
LocalDateTim
e
ctime
;
/**
/**
* 本日笔记发布数
* 本日笔记发布数
...
...
src/main/java/com/afanticar/afantiopenapi/model/vo/BydXiaoHongShuAuthorDayVO.java
View file @
214207bf
...
@@ -48,6 +48,8 @@ public class BydXiaoHongShuAuthorDayVO {
...
@@ -48,6 +48,8 @@ public class BydXiaoHongShuAuthorDayVO {
private
Integer
noteFavoriteCntDi
;
private
Integer
noteFavoriteCntDi
;
@ApiModelProperty
(
value
=
"笔记分享新增数"
,
example
=
"200"
)
@ApiModelProperty
(
value
=
"笔记分享新增数"
,
example
=
"200"
)
private
Integer
noteShareCntDi
;
private
Integer
noteShareCntDi
;
@ApiModelProperty
(
value
=
"数据更新时间"
,
example
=
"...."
)
private
LocalDateTime
dataUpdateTime
;
@Data
@Data
public
static
class
MemberInfo
{
public
static
class
MemberInfo
{
...
...
src/main/java/com/afanticar/afantiopenapi/model/vo/BydXiaoHongShuMemberDayVO.java
View file @
214207bf
...
@@ -6,7 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
...
@@ -6,7 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
lombok.Data
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.
util.List
;
import
java.
time.LocalDateTime
;
@Data
@Data
@JsonNaming
(
value
=
com
.
fasterxml
.
jackson
.
databind
.
PropertyNamingStrategy
.
SnakeCaseStrategy
.
class
)
@JsonNaming
(
value
=
com
.
fasterxml
.
jackson
.
databind
.
PropertyNamingStrategy
.
SnakeCaseStrategy
.
class
)
...
@@ -22,12 +22,14 @@ public class BydXiaoHongShuMemberDayVO {
...
@@ -22,12 +22,14 @@ public class BydXiaoHongShuMemberDayVO {
* " a.statistics_day,a.fans_count_total,a.fans_count_total_di,a.note_count_di,\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" +
* " a.note_digg_count_di,a.note_collect_count_di,a.note_share_count_di \n" +
*/
*/
@ApiModelProperty
(
value
=
"
品牌名称"
,
example
=
"比亚迪-海洋
"
)
@ApiModelProperty
(
value
=
"
门店ID"
,
example
=
"A12345
"
)
private
String
principalName
;
private
String
memberId
;
@ApiModelProperty
(
value
=
"门店名称"
,
example
=
"南京宁星"
)
@ApiModelProperty
(
value
=
"门店名称"
,
example
=
"南京宁星"
)
private
String
memberName
;
private
String
memberName
;
@ApiModelProperty
(
value
=
"门店编码"
,
example
=
"ABC123"
)
@ApiModelProperty
(
value
=
"门店编码"
,
example
=
"ABC123"
)
private
String
memberCode
;
private
String
memberCode
;
@ApiModelProperty
(
value
=
"品牌名称"
,
example
=
"比亚迪-海洋"
)
private
String
principalName
;
@ApiModelProperty
(
value
=
"大区名称"
,
example
=
"大区名称1"
)
@ApiModelProperty
(
value
=
"大区名称"
,
example
=
"大区名称1"
)
private
String
areaName
;
private
String
areaName
;
@ApiModelProperty
(
value
=
"小区名称"
,
example
=
"200"
)
@ApiModelProperty
(
value
=
"小区名称"
,
example
=
"200"
)
...
@@ -50,7 +52,9 @@ public class BydXiaoHongShuMemberDayVO {
...
@@ -50,7 +52,9 @@ public class BydXiaoHongShuMemberDayVO {
@ApiModelProperty
(
value
=
"笔记评论新增数"
,
example
=
"200"
)
@ApiModelProperty
(
value
=
"笔记评论新增数"
,
example
=
"200"
)
private
Integer
noteCommentCntDi
;
private
Integer
noteCommentCntDi
;
@ApiModelProperty
(
value
=
"笔记收藏新增数"
,
example
=
"200"
)
@ApiModelProperty
(
value
=
"笔记收藏新增数"
,
example
=
"200"
)
private
Integer
note
Favorite
CntDi
;
private
Integer
note
Collect
CntDi
;
@ApiModelProperty
(
value
=
"笔记分享新增数"
,
example
=
"200"
)
@ApiModelProperty
(
value
=
"笔记分享新增数"
,
example
=
"200"
)
private
Integer
noteShareCntDi
;
private
Integer
noteShareCntDi
;
@ApiModelProperty
(
value
=
"数据更新时间"
,
example
=
"...."
)
private
LocalDateTime
dataUpdateTime
;
}
}
src/main/java/com/afanticar/afantiopenapi/service/BydOpenService.java
View file @
214207bf
...
@@ -12,7 +12,6 @@ import com.afanticar.core.entity.EsBaseQuery;
...
@@ -12,7 +12,6 @@ import com.afanticar.core.entity.EsBaseQuery;
import
com.afanticar.core.entity.InnerHits
;
import
com.afanticar.core.entity.InnerHits
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -43,11 +42,40 @@ public class BydOpenService {
...
@@ -43,11 +42,40 @@ public class BydOpenService {
public
BasePageVO
<
BydXiaoHongShuMemberDayVO
>
fetchMemberDaySnap
(
PrincipalEnum
principal
,
public
BasePageVO
<
BydXiaoHongShuMemberDayVO
>
fetchMemberDaySnap
(
PrincipalEnum
principal
,
LocalDate
startDate
,
LocalDate
endDate
,
Integer
currentPage
,
Integer
pageSize
){
LocalDate
startDate
,
LocalDate
endDate
,
Integer
currentPage
,
Integer
pageSize
){
Page
<
BydXiaoHongShuMemberDayVO
>
page
=
new
Page
<>(
currentPage
,
pageSize
);
Page
<
BydXiaoHongShuMemberDayVO
>
page
=
new
Page
<>(
currentPage
,
pageSize
);
Page
<
BydXiaoHongShuMemberDayVO
>
data
=
memberDayMapper
.
queryMemberDayByPrincipalId
(
page
,
principal
.
id
,
startDate
,
endDate
);
Page
<
XiaoHongShuMemberDay
>
data
=
memberDayMapper
.
queryMemberDayByPrincipalId
(
page
,
principal
.
id
,
startDate
,
endDate
);
List
<
String
>
memberIds
=
data
.
getRecords
().
stream
().
map
(
XiaoHongShuMemberDay:
:
getMatrixMemberId
).
distinct
().
collect
(
Collectors
.
toList
());
Map
<
String
,
MemberInfo
>
memberInfos
=
memberInfoMapper
.
queryMemberInfoListByMemberIds
(
memberIds
.
isEmpty
()?
Collections
.
singletonList
(
"XXX"
)
:
memberIds
)
.
stream
().
distinct
()
.
collect
(
Collectors
.
toMap
(
MemberInfo:
:
getMatrixMemberId
,
Function
.
identity
()));
List
<
BydXiaoHongShuMemberDayVO
>
voList
=
data
.
getRecords
().
stream
().
map
(
x
->{
BydXiaoHongShuMemberDayVO
vo
=
new
BydXiaoHongShuMemberDayVO
();
vo
.
setMemberId
(
x
.
getMatrixMemberId
());
MemberInfo
info
=
memberInfos
.
get
(
x
.
getMatrixMemberId
());
if
(
Objects
.
nonNull
(
info
))
{
vo
.
setMemberName
(
info
.
getMatrixMemberName
());
vo
.
setMemberCode
(
info
.
getMatrixMemberCode
());
vo
.
setPrincipalName
(
info
.
getPrincipalName
());
vo
.
setAreaName
(
info
.
getAreaName
());
vo
.
setVillageName
(
info
.
getVillageName
());
vo
.
setCityName
(
info
.
getCityName
());
vo
.
setProvinceName
(
info
.
getProvinceName
());
}
vo
.
setStatsDate
(
x
.
getStatisticsDay
());
vo
.
setFansCntTotal
(
x
.
getFansCountTotal
());
vo
.
setFansCntDi
(
x
.
getFansCountTotalDi
());
vo
.
setNoteCntDi
(
x
.
getNoteCountDi
());
vo
.
setNoteLikeCntDi
(
x
.
getNoteDiggCountDi
());
vo
.
setNoteCommentCntDi
(
x
.
getNoteCommentCountDi
());
vo
.
setNoteCollectCntDi
(
x
.
getNoteCollectCountDi
());
vo
.
setNoteShareCntDi
(
x
.
getNoteShareCountDi
());
return
vo
;
}).
collect
(
Collectors
.
toList
());
// List<String> memberIds = data.stream().map(XiaoHongShuMemberDay::getMatrixMemberId).collect(Collectors.toList());
// List<String> memberIds = data.stream().map(XiaoHongShuMemberDay::getMatrixMemberId).collect(Collectors.toList());
// List<MemberInfo> memberInfos = memberInfoMapper.queryMemberInfoListByMemberIds(memberIds);
// List<MemberInfo> memberInfos = memberInfoMapper.queryMemberInfoListByMemberIds(memberIds);
return
BasePageVO
.
restPage
((
int
)
data
.
getCurrent
(),
(
int
)
data
.
getSize
(),
(
int
)
data
.
getTotal
(),
(
int
)
data
.
getPages
(),
data
.
getRecords
()
);
return
BasePageVO
.
restPage
((
int
)
data
.
getCurrent
(),
(
int
)
data
.
getSize
(),
(
int
)
data
.
getTotal
(),
(
int
)
data
.
getPages
(),
voList
);
}
}
...
@@ -108,6 +136,7 @@ public class BydOpenService {
...
@@ -108,6 +136,7 @@ public class BydOpenService {
vo
.
setNoteCommentCntDi
(
x
.
getNoteCommentCountDi
());
vo
.
setNoteCommentCntDi
(
x
.
getNoteCommentCountDi
());
vo
.
setNoteFavoriteCntDi
(
x
.
getCollectCountDi
());
vo
.
setNoteFavoriteCntDi
(
x
.
getCollectCountDi
());
vo
.
setNoteShareCntDi
(
x
.
getNoteShareCountDi
());
vo
.
setNoteShareCntDi
(
x
.
getNoteShareCountDi
());
vo
.
setDataUpdateTime
(
x
.
getMtime
());
return
vo
;
return
vo
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
...
...
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