Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
徐少华
midjourney-proxy
Commits
447cf109
Commit
447cf109
authored
Jul 17, 2020
by
田超
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/1003275' into 'master'
feat: [1003275] 群筛选方案优化 See merge request rays/pcloud-book!825
parents
67c43053
858e806a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
13 deletions
+20
-13
ESBookGroupQrcodeBizImpl.java
...com/pcloud/book/es/biz/impl/ESBookGroupQrcodeBizImpl.java
+16
-13
ESBookGroupQrcode.java
...ain/java/com/pcloud/book/es/entity/ESBookGroupQrcode.java
+4
-0
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/es/biz/impl/ESBookGroupQrcodeBizImpl.java
View file @
447cf109
...
...
@@ -2,7 +2,6 @@ package com.pcloud.book.es.biz.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.IterUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.pcloud.book.book.constant.BookConstant
;
...
...
@@ -35,6 +34,7 @@ import org.elasticsearch.index.query.QueryBuilders;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.elasticsearch.core.ElasticsearchTemplate
;
import
org.springframework.stereotype.Component
;
...
...
@@ -200,9 +200,13 @@ public class ESBookGroupQrcodeBizImpl implements ESBookGroupQrcodeBiz {
ESGroupBookQrcodeDTO
qrcodeDTO
=
qrcodeDTOMap
.
get
(
qrcode
.
getWeixinGroupId
());
if
(
qrcodeDTO
!=
null
)
{
qrcode
.
setCityTags
(
qrcodeDTO
.
getCityTags
());
qrcode
.
setMaleCount
(
qrcodeDTO
.
getMaleCount
());
qrcode
.
setFemaleCount
(
qrcodeDTO
.
getFemaleCount
());
qrcode
.
setUnknownCount
(
qrcodeDTO
.
getUnknownCount
());
int
male
=
qrcodeDTO
.
getMaleCount
()
==
null
?
0
:
qrcodeDTO
.
getMaleCount
();
int
female
=
qrcodeDTO
.
getFemaleCount
()
==
null
?
0
:
qrcodeDTO
.
getFemaleCount
();
int
unknown
=
qrcodeDTO
.
getUnknownCount
()
==
null
?
0
:
qrcodeDTO
.
getUnknownCount
();
qrcode
.
setMaleCount
(
male
);
qrcode
.
setFemaleCount
(
female
);
qrcode
.
setUnknownCount
(
unknown
);
qrcode
.
setGroupMemberCount
(
male
+
female
+
unknown
);
}
}
...
...
@@ -263,18 +267,21 @@ public class ESBookGroupQrcodeBizImpl implements ESBookGroupQrcodeBiz {
@Override
public
PageBeanNew
<
GroupQrcodeSearchDTO
>
search
(
String
text
,
Integer
pageSize
,
Integer
pageNum
)
{
QueryBuilder
queryBuilder
;
PageRequest
pageRequest
;
if
(
StrUtil
.
isEmpty
(
text
))
{
queryBuilder
=
QueryBuilders
.
boolQuery
();
pageRequest
=
new
PageRequest
(
pageNum
,
pageSize
,
new
Sort
(
Sort
.
Direction
.
DESC
,
"groupMemberCount"
,
"userNumber"
));
}
else
{
pageRequest
=
new
PageRequest
(
pageNum
,
pageSize
);
queryBuilder
=
QueryBuilders
.
multiMatchQuery
(
text
,
"pressTags"
,
"cityTags"
,
"groupNameTags"
,
"pressTags"
,
"bookNameTags"
,
"groupName"
,
"qrcodeBookName"
);
}
Page
<
ESBookGroupQrcode
>
page
=
bookGroupQrcodeRepository
.
search
(
queryBuilder
,
new
PageRequest
(
pageNum
,
pageSize
)
);
Page
<
ESBookGroupQrcode
>
page
=
bookGroupQrcodeRepository
.
search
(
queryBuilder
,
pageRequest
);
List
<
GroupQrcodeSearchDTO
>
list
=
convert
(
page
.
getContent
());
if
(
CollUtil
.
isEmpty
(
list
)){
return
new
PageBeanNew
<>(
pageNum
,
pageSize
,
null
);
if
(
CollUtil
.
isEmpty
(
list
))
{
return
new
PageBeanNew
<>(
pageNum
,
pageSize
,
null
);
}
return
new
PageBeanNew
<>(
pageNum
,
pageSize
,(
int
)
page
.
getTotalElements
(),
list
);
return
new
PageBeanNew
<>(
pageNum
,
pageSize
,
(
int
)
page
.
getTotalElements
(),
list
);
}
private
List
<
GroupQrcodeSearchDTO
>
convert
(
List
<
ESBookGroupQrcode
>
content
)
{
...
...
@@ -287,11 +294,7 @@ public class ESBookGroupQrcodeBizImpl implements ESBookGroupQrcodeBiz {
GroupQrcodeSearchDTO
groupQrcodeSearchDTO
=
new
GroupQrcodeSearchDTO
();
if
(
CollUtil
.
isNotEmpty
(
content
)){
BeanUtil
.
copyProperties
(
esBookGroupQrcode
,
groupQrcodeSearchDTO
);
int
male
=
esBookGroupQrcode
.
getMaleCount
()==
null
?
0
:
esBookGroupQrcode
.
getMaleCount
();
int
female
=
esBookGroupQrcode
.
getFemaleCount
()==
null
?
0
:
esBookGroupQrcode
.
getFemaleCount
();
int
unknown
=
esBookGroupQrcode
.
getUnknownCount
()==
null
?
0
:
esBookGroupQrcode
.
getUnknownCount
();
groupQrcodeSearchDTO
.
setGroupMemberCount
(
male
+
female
+
unknown
);
groupQrcodeSearchDTO
.
setPayMemberCount
(
esBookGroupQrcode
.
getFemaleCount
());
groupQrcodeSearchDTO
.
setPayMemberCount
(
esBookGroupQrcode
.
getAmountActuallyPaid
()
==
null
?
0
:
Math
.
toIntExact
(
esBookGroupQrcode
.
getAmountActuallyPaid
()));
if
(
StrUtil
.
isEmpty
(
esBookGroupQrcode
.
getPurchaseAmount
())){
groupQrcodeSearchDTO
.
setPurchaseAmount
(
BigDecimal
.
ZERO
);
}
else
{
...
...
pcloud-service-book/src/main/java/com/pcloud/book/es/entity/ESBookGroupQrcode.java
View file @
447cf109
...
...
@@ -175,5 +175,9 @@ public class ESBookGroupQrcode {
@Field
(
type
=
FieldType
.
String
,
index
=
FieldIndex
.
not_analyzed
)
private
String
isbn
;
/**
* 成员总人数
*/
private
Integer
groupMemberCount
;
}
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