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
b4ac1cba
Commit
b4ac1cba
authored
Aug 13, 2020
by
吴博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: [1003373] 首页当前在读书设计优化调整
parent
1afc74b9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
9 deletions
+44
-9
BookConstant.java
...main/java/com/pcloud/book/book/constant/BookConstant.java
+2
-0
AppletUserBookcaseBizImpl.java
...cloud/book/applet/biz/impl/AppletUserBookcaseBizImpl.java
+42
-9
No files found.
pcloud-facade-book/src/main/java/com/pcloud/book/book/constant/BookConstant.java
View file @
b4ac1cba
...
...
@@ -373,6 +373,8 @@ public class BookConstant {
public
static
final
String
NO_RESOURCE_REMIND
=
"no_resource_remind"
;
public
static
final
Integer
HOME_BOOK_PAGE
=
3
;
public
static
final
String
DEFAULT_NEWS_PIC
=
"https://oss.5rs.me/oss/uploadfe/jpg/c469a21a758b79e00783fe3a70a605c5.jpg"
;
/**
* 群二维码永久图文素材,html 源代码
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletUserBookcaseBizImpl.java
View file @
b4ac1cba
package
com
.
pcloud
.
book
.
applet
.
biz
.
impl
;
import
com.google.gson.internal.
$Gson$Preconditions
;
import
com.pcloud.appcenter.assist.dto.AssistTempletDTO
;
import
com.pcloud.book.applet.biz.AppletNewsBiz
;
import
com.pcloud.book.applet.biz.AppletUserBookcaseBiz
;
...
...
@@ -13,6 +14,7 @@ import com.pcloud.book.applet.entity.AppletUserBookcase;
import
com.pcloud.book.applet.entity.AppletUserClickRecord
;
import
com.pcloud.book.applet.enums.AppletNewsServeTypeEnum
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.constant.BookConstant
;
import
com.pcloud.book.book.dao.BookRaysClassifyDao
;
import
com.pcloud.book.book.entity.BookRaysClassify
;
import
com.pcloud.book.consumer.app.AssistTempletConsr
;
...
...
@@ -120,17 +122,20 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
}
//首页数据是否正确
Boolean
correct
=
true
;
if
(
0
==
currentPage
&&
1
==
numPerPage
&&
!
ListUtils
.
isEmpty
(
bookcaseDTOS
))
{
AppletUserBookcaseDTO
appletUserBookcase
=
bookcaseDTOS
.
get
(
0
);
Integer
correctCount
=
0
;
if
(
0
==
currentPage
&&
BookConstant
.
HOME_BOOK_PAGE
==
numPerPage
&&
!
ListUtils
.
isEmpty
(
bookcaseDTOS
))
{
for
(
AppletUserBookcaseDTO
appletUserBookcase
:
bookcaseDTOS
)
{
Long
settingId
=
appletUserBookcase
.
getRightsSettingId
()
==
null
?
0L
:
appletUserBookcase
.
getRightsSettingId
();
RightsSettingDto
rightsSettingDto
=
rightsSettingBiz
.
getRightsSettingByBookId4AppletHome
(
appletUserBookcase
.
getBookId
(),
appletUserBookcase
.
getAdviserId
(),
appletUserBookcase
.
getChannelId
());
Long
actualSettingId
=
rightsSettingDto
.
getId
()
==
null
?
0L
:
rightsSettingDto
.
getId
();
if
(!
actualSettingId
.
equals
(
settingId
))
{
correct
=
false
;
appletUserBookcaseDao
.
updateRightsSettingId
(
actualSettingId
>
0
?
actualSettingId
:
null
,
appletUserBookcase
.
getBookId
(),
appletUserBookcase
.
getAdviserId
(),
appletUserBookcase
.
getChannelId
());
}
else
{
++
correctCount
;
}
}
if
(!
ListUtils
.
isEmpty
(
bookcaseDTOS
)
&&
count
>
0
&&
correct
)
{
}
if
(!
ListUtils
.
isEmpty
(
bookcaseDTOS
)
&&
count
>
0
&&
correctCount
.
equals
(
bookcaseDTOS
.
size
()))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
count
,
bookcaseDTOS
);
}
//数据库查询
...
...
@@ -314,20 +319,48 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
@Override
public
void
randomChangeBook
(
Long
wechatUserId
)
{
List
<
AppletUserBookcase
>
bookcaseList
=
appletUserBookcaseDao
.
getListByUserId
(
wechatUserId
);
//无书或只有
一
本不处理
if
(
ListUtils
.
isEmpty
(
bookcaseList
)
||
bookcaseList
.
size
()
==
1
)
{
//无书或只有
3
本不处理
if
(
ListUtils
.
isEmpty
(
bookcaseList
)
||
bookcaseList
.
size
()
<
BookConstant
.
HOME_BOOK_PAGE
)
{
return
;
}
//去除最近一本书
Integer
removeCount
=
bookcaseList
.
size
()
-
BookConstant
.
HOME_BOOK_PAGE
;
removeCount
=
removeCount
>=
BookConstant
.
HOME_BOOK_PAGE
?
BookConstant
.
HOME_BOOK_PAGE
:
removeCount
;
//去除最近3本书
for
(
int
i
=
0
;
i
<
removeCount
;
i
++)
{
bookcaseList
.
remove
(
0
);
}
//随机取一本书埋点
AppletUserBookcase
appletUserBookcase
=
bookcaseList
.
get
(
new
Random
().
nextInt
(
bookcaseList
.
size
()));
if
(
bookcaseList
.
size
()
>
BookConstant
.
HOME_BOOK_PAGE
)
{
bookcaseList
=
getRandomList
(
bookcaseList
,
BookConstant
.
HOME_BOOK_PAGE
);
}
bookcaseList
.
stream
().
forEach
(
appletUserBookcase
->
{
this
.
addUserBook
(
appletUserBookcase
);
});
ThreadPoolUtils
.
OTHER_THREAD_POOL
.
execute
(()
->
{
this
.
listByWechatUserId
(
wechatUserId
,
0
,
1
);
this
.
listByWechatUserId
(
wechatUserId
,
0
,
BookConstant
.
HOME_BOOK_PAGE
);
});
}
private
List
<
AppletUserBookcase
>
getRandomList
(
List
<
AppletUserBookcase
>
paramList
,
int
count
)
{
if
(
paramList
.
size
()
<
count
)
{
return
paramList
;
}
Random
random
=
new
Random
();
List
<
Integer
>
tempList
=
new
ArrayList
<
Integer
>();
List
<
AppletUserBookcase
>
newList
=
new
ArrayList
<
AppletUserBookcase
>();
int
temp
=
0
;
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
temp
=
random
.
nextInt
(
paramList
.
size
());
//将产生的随机数作为被抽list的索引
if
(!
tempList
.
contains
(
temp
))
{
tempList
.
add
(
temp
);
newList
.
add
(
paramList
.
get
(
temp
));
}
else
{
i
--;
}
}
return
newList
;
}
@Override
public
List
<
Long
>
getBookcaseIdListByUser
(
Long
wechatUserId
)
{
return
appletUserBookcaseDao
.
getBookcaseIdListByUser
(
wechatUserId
);
...
...
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