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
b83553a9
Commit
b83553a9
authored
May 20, 2020
by
裴大威
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat-1002907' into 'master'
1002907小程序首页改版 See merge request rays/pcloud-book!728
parents
38b91486
9ce628b4
Hide whitespace changes
Inline
Side-by-side
Showing
56 changed files
with
1610 additions
and
178 deletions
+1610
-178
BookConstant.java
...main/java/com/pcloud/book/book/constant/BookConstant.java
+2
-0
AppletBooklistBiz.java
...in/java/com/pcloud/book/applet/biz/AppletBooklistBiz.java
+24
-2
AppletNewsBiz.java
...c/main/java/com/pcloud/book/applet/biz/AppletNewsBiz.java
+23
-2
AppletUserBookcaseBiz.java
...ava/com/pcloud/book/applet/biz/AppletUserBookcaseBiz.java
+24
-0
AppletBooklistBizImpl.java
...om/pcloud/book/applet/biz/impl/AppletBooklistBizImpl.java
+81
-19
AppletNewsBizImpl.java
...va/com/pcloud/book/applet/biz/impl/AppletNewsBizImpl.java
+69
-14
AppletUserBookcaseBizImpl.java
...cloud/book/applet/biz/impl/AppletUserBookcaseBizImpl.java
+35
-1
AppletBooklistClassifyDao.java
...com/pcloud/book/applet/dao/AppletBooklistClassifyDao.java
+33
-0
AppletNewsClassifyDao.java
...ava/com/pcloud/book/applet/dao/AppletNewsClassifyDao.java
+32
-0
AppletUserBookcaseDao.java
...ava/com/pcloud/book/applet/dao/AppletUserBookcaseDao.java
+11
-0
AppletBooklistClassifyDaoImpl.java
...d/book/applet/dao/impl/AppletBooklistClassifyDaoImpl.java
+22
-0
AppletNewsClassifyDaoImpl.java
...cloud/book/applet/dao/impl/AppletNewsClassifyDaoImpl.java
+22
-0
AppletUserBookcaseDaoImpl.java
...cloud/book/applet/dao/impl/AppletUserBookcaseDaoImpl.java
+20
-0
AppletBooklistClassifyDTO.java
...com/pcloud/book/applet/dto/AppletBooklistClassifyDTO.java
+6
-0
AppletNewsClassifyDTO.java
...ava/com/pcloud/book/applet/dto/AppletNewsClassifyDTO.java
+4
-0
UserLastBookReDTO.java
...in/java/com/pcloud/book/applet/dto/UserLastBookReDTO.java
+3
-0
AppletBooklistClassify.java
...com/pcloud/book/applet/entity/AppletBooklistClassify.java
+3
-0
AppletBooklistClassifyUser.java
...pcloud/book/applet/entity/AppletBooklistClassifyUser.java
+34
-0
AppletNewsClassify.java
...ava/com/pcloud/book/applet/entity/AppletNewsClassify.java
+3
-0
AppletNewsClassifyUser.java
...com/pcloud/book/applet/entity/AppletNewsClassifyUser.java
+33
-0
AppletUserBookcase.java
...ava/com/pcloud/book/applet/entity/AppletUserBookcase.java
+3
-0
AppletHomeFacade.java
.../java/com/pcloud/book/applet/facade/AppletHomeFacade.java
+98
-8
RightsSettingBiz.java
...a/com/pcloud/book/rightsSetting/biz/RightsSettingBiz.java
+10
-9
RightsSettingBizImpl.java
...oud/book/rightsSetting/biz/impl/RightsSettingBizImpl.java
+163
-49
RightsSettingCheck.java
...m/pcloud/book/rightsSetting/check/RightsSettingCheck.java
+25
-3
RightsItemGroupDao.java
...com/pcloud/book/rightsSetting/dao/RightsItemGroupDao.java
+2
-1
RightsNowPicDao.java
...va/com/pcloud/book/rightsSetting/dao/RightsNowPicDao.java
+1
-1
RightsItemGroupDaoImpl.java
...d/book/rightsSetting/dao/impl/RightsItemGroupDaoImpl.java
+8
-2
RightsNowPicDaoImpl.java
...loud/book/rightsSetting/dao/impl/RightsNowPicDaoImpl.java
+8
-2
ReadTypeCountDTO.java
...a/com/pcloud/book/rightsSetting/dto/ReadTypeCountDTO.java
+27
-0
RightsSettingDto.java
...a/com/pcloud/book/rightsSetting/dto/RightsSettingDto.java
+5
-0
RightsItemGroup.java
...com/pcloud/book/rightsSetting/entity/RightsItemGroup.java
+9
-0
RightsNowPic.java
...va/com/pcloud/book/rightsSetting/entity/RightsNowPic.java
+3
-0
RightsReadType.java
.../com/pcloud/book/rightsSetting/entity/RightsReadType.java
+46
-0
RightsSetting.java
...a/com/pcloud/book/rightsSetting/entity/RightsSetting.java
+12
-0
RightsSettingItem.java
...m/pcloud/book/rightsSetting/entity/RightsSettingItem.java
+17
-0
RightsSettingTitle.java
.../pcloud/book/rightsSetting/entity/RightsSettingTitle.java
+13
-1
PicTypeEnum.java
...java/com/pcloud/book/rightsSetting/enums/PicTypeEnum.java
+33
-0
RightsWeekTypeEnum.java
...m/pcloud/book/rightsSetting/enums/RightsWeekTypeEnum.java
+74
-0
RightsSettingFacede.java
...pcloud/book/rightsSetting/facade/RightsSettingFacede.java
+40
-14
RightsReadTypeMapper.java
...cloud/book/rightsSetting/mapper/RightsReadTypeMapper.java
+34
-0
RightsSettingTitleMapper.java
...d/book/rightsSetting/mapper/RightsSettingTitleMapper.java
+8
-2
PcloudGroupActivityBiz.java
...ava/com/pcloud/book/skill/biz/PcloudGroupActivityBiz.java
+1
-1
PcloudGroupActivityBizImpl.java
...cloud/book/skill/biz/impl/PcloudGroupActivityBizImpl.java
+5
-2
generatorConfig.xml
pcloud-service-book/src/main/resources/generatorConfig.xml
+1
-1
AppletBooklist.xml
...-book/src/main/resources/mapper/applet/AppletBooklist.xml
+20
-2
AppletBooklistClassify.xml
...c/main/resources/mapper/applet/AppletBooklistClassify.xml
+46
-6
AppletNews.xml
...vice-book/src/main/resources/mapper/applet/AppletNews.xml
+49
-0
AppletNewsClassify.xml
...k/src/main/resources/mapper/applet/AppletNewsClassify.xml
+45
-6
AppletUserBookcase.xml
...k/src/main/resources/mapper/applet/AppletUserBookcase.xml
+46
-3
RightItemGroup.xml
...rc/main/resources/mapper/rightssetting/RightItemGroup.xml
+25
-6
RightNowPic.xml
...k/src/main/resources/mapper/rightssetting/RightNowPic.xml
+15
-6
RightsReadTypeMapper.xml
...n/resources/mapper/rightssetting/RightsReadTypeMapper.xml
+140
-0
RightsSettingItemMapper.xml
...esources/mapper/rightssetting/RightsSettingItemMapper.xml
+25
-6
RightsSettingMapper.xml
...in/resources/mapper/rightssetting/RightsSettingMapper.xml
+7
-4
RightsSettingTitleMapper.xml
...sources/mapper/rightssetting/RightsSettingTitleMapper.xml
+62
-5
No files found.
pcloud-facade-book/src/main/java/com/pcloud/book/book/constant/BookConstant.java
View file @
b83553a9
...
@@ -133,6 +133,8 @@ public class BookConstant {
...
@@ -133,6 +133,8 @@ public class BookConstant {
public
static
final
Random
RANDOM
=
new
Random
();
public
static
final
Random
RANDOM
=
new
Random
();
public
static
final
Integer
zero
=
0
;
/**
/**
* 微信群默认头像
* 微信群默认头像
*/
*/
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/AppletBooklistBiz.java
View file @
b83553a9
...
@@ -71,7 +71,7 @@ public interface AppletBooklistBiz {
...
@@ -71,7 +71,7 @@ public interface AppletBooklistBiz {
* @param numPerPage
* @param numPerPage
* @return
* @return
*/
*/
PageBeanNew
<
AppletBooklistDTO
>
listBooklist
(
Integer
currentPage
,
Integer
numPerPage
,
String
name
);
PageBeanNew
<
AppletBooklistDTO
>
listBooklist
(
Integer
currentPage
,
Integer
numPerPage
,
String
name
,
Long
classifyId
);
/**
/**
* 书单添加图书
* 书单添加图书
...
@@ -107,7 +107,7 @@ public interface AppletBooklistBiz {
...
@@ -107,7 +107,7 @@ public interface AppletBooklistBiz {
* @param numPerPage
* @param numPerPage
* @return
* @return
*/
*/
PageBeanNew
<
AppletBooklistDTO
>
listBooklist4Wechat
(
Long
classifyId
,
Integer
currentPage
,
Integer
numPerPage
);
PageBeanNew
<
AppletBooklistDTO
>
listBooklist4Wechat
(
Long
classifyId
,
Integer
currentPage
,
Integer
numPerPage
,
Long
wechatUserId
);
/**
/**
* 客户端根据id获取书单
* 客户端根据id获取书单
...
@@ -124,4 +124,26 @@ public interface AppletBooklistBiz {
...
@@ -124,4 +124,26 @@ public interface AppletBooklistBiz {
* @return
* @return
*/
*/
BookDTO4Booklist
getByBookIdAdviserChannel
(
Long
adviserId
,
Long
channelId
,
Long
bookId
);
BookDTO4Booklist
getByBookIdAdviserChannel
(
Long
adviserId
,
Long
channelId
,
Long
bookId
);
/**
* 用户选择书单栏目
* @author:zhuyajie
* @date:2020/5/14 11:21
* * @param null
*/
void
addUserBooklistClassify
(
List
<
Long
>
classifyIds
,
Long
wechatUserId
);
/**
* 所有书单栏目列表+用户选择的书单栏目
* @author:zhuyajie
* @date:2020/5/14 11:21
* * @param null
*/
List
<
AppletBooklistClassifyDTO
>
getAllBooklistClassify4Wechat
(
Long
wechatUserId
);
/**
* 用户选择的书单栏目
* @author:zhuyajie
* @date:2020/5/14 11:21
* * @param null
*/
List
<
AppletBooklistClassifyDTO
>
getBooklistClassifyByUser
(
Long
wechatUserId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/AppletNewsBiz.java
View file @
b83553a9
...
@@ -74,7 +74,7 @@ public interface AppletNewsBiz {
...
@@ -74,7 +74,7 @@ public interface AppletNewsBiz {
*/
*/
PageBeanNew
<
AppletNewsDTO
>
listAppletNews
(
Integer
currentPage
,
Integer
numPerPage
,
String
name
,
PageBeanNew
<
AppletNewsDTO
>
listAppletNews
(
Integer
currentPage
,
Integer
numPerPage
,
String
name
,
Long
firstClassify
,
Long
secondClassify
,
Long
gradeLabelId
,
Long
firstClassify
,
Long
secondClassify
,
Long
gradeLabelId
,
Long
subjectLabelId
,
Long
rightsClassifyId
,
String
source
);
Long
subjectLabelId
,
Long
rightsClassifyId
,
String
source
,
Long
newsClassifyId
);
/**
/**
* 获取所有资讯栏目
* 获取所有资讯栏目
...
@@ -89,7 +89,7 @@ public interface AppletNewsBiz {
...
@@ -89,7 +89,7 @@ public interface AppletNewsBiz {
* @param newsClassifyId
* @param newsClassifyId
* @return
* @return
*/
*/
PageBeanNew
<
AppletNewsDTO
>
listAppletNews4Wechat
(
Integer
currentPage
,
Integer
numPerPage
,
Long
newsClassifyId
);
PageBeanNew
<
AppletNewsDTO
>
listAppletNews4Wechat
(
Integer
currentPage
,
Integer
numPerPage
,
Long
newsClassifyId
,
Long
wechatUserId
);
/**
/**
* 添加资讯评论
* 添加资讯评论
...
@@ -171,6 +171,27 @@ public interface AppletNewsBiz {
...
@@ -171,6 +171,27 @@ public interface AppletNewsBiz {
* * @param null
* * @param null
*/
*/
String
getUrlNumberByUrl
(
String
jumpUrl
);
String
getUrlNumberByUrl
(
String
jumpUrl
);
/**
* 用户选择资讯栏目
* @author:zhuyajie
* @date:2020/5/14 11:21
* * @param null
*/
void
addUserNewsClassify
(
List
<
Long
>
newsClassifyIds
,
Long
wechatUserId
);
/**
* 所有资讯栏目列表+用户选择的资讯栏目
* @author:zhuyajie
* @date:2020/5/14 11:21
* * @param null
*/
List
<
AppletNewsClassifyDTO
>
getAllNewsClassify4Wechat
(
Long
wechatUserId
);
/**
* 用户选择的资讯栏目
* @author:zhuyajie
* @date:2020/5/14 11:21
* * @param null
*/
List
<
AppletNewsClassifyDTO
>
getNewsClassifyByUser
(
Long
wechatUserId
);
/**
/**
* 资讯统计分析
* 资讯统计分析
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/AppletUserBookcaseBiz.java
View file @
b83553a9
...
@@ -53,4 +53,28 @@ public interface AppletUserBookcaseBiz {
...
@@ -53,4 +53,28 @@ public interface AppletUserBookcaseBiz {
* * @param null
* * @param null
*/
*/
void
deleteByIds
(
List
<
Long
>
ids
,
Long
wechatUserId
);
void
deleteByIds
(
List
<
Long
>
ids
,
Long
wechatUserId
);
/**
* 更新读者关于本书的阅读方式
* @param appletUserBookcase
*/
void
updateUserReadType
(
AppletUserBookcase
appletUserBookcase
);
/**
* 获取读者关于本书的阅读方式
* @param wechatUserId
* @param bookId
* @param adviserId
* @param channelId
* @return
*/
AppletUserBookcase
getUserReadType
(
Long
wechatUserId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
);
/**
* 已读书刊随机换一本书展示
* @author:zhuyajie
* @date:2020/5/15 14:49
* * @param null
*/
void
randomChangeBook
(
Long
wechatUserId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletBooklistBizImpl.java
View file @
b83553a9
...
@@ -10,16 +10,19 @@ import com.pcloud.book.applet.dto.AppletBooklistDTO;
...
@@ -10,16 +10,19 @@ import com.pcloud.book.applet.dto.AppletBooklistDTO;
import
com.pcloud.book.applet.dto.BookDTO4Booklist
;
import
com.pcloud.book.applet.dto.BookDTO4Booklist
;
import
com.pcloud.book.applet.entity.AppletBooklist
;
import
com.pcloud.book.applet.entity.AppletBooklist
;
import
com.pcloud.book.applet.entity.AppletBooklistClassify
;
import
com.pcloud.book.applet.entity.AppletBooklistClassify
;
import
com.pcloud.book.applet.entity.AppletBooklistClassifyUser
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.biz.BookBiz
;
import
com.pcloud.book.book.biz.BookBiz
;
import
com.pcloud.book.book.dao.BookRaysClassifyDao
;
import
com.pcloud.book.book.dao.BookRaysClassifyDao
;
import
com.pcloud.book.consumer.app.AssistTempletConsr
;
import
com.pcloud.book.consumer.app.AssistTempletConsr
;
import
com.pcloud.book.consumer.user.AdviserConsr
;
import
com.pcloud.book.consumer.user.AdviserConsr
;
import
com.pcloud.common.constant.CacheConstant
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.cache.redis.JedisClusterUtils
;
import
com.pcloud.common.utils.cache.redis.JedisClusterUtils
;
import
com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto
;
import
com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -40,6 +43,8 @@ import java.util.stream.Collectors;
...
@@ -40,6 +43,8 @@ import java.util.stream.Collectors;
@Component
@Component
public
class
AppletBooklistBizImpl
implements
AppletBooklistBiz
{
public
class
AppletBooklistBizImpl
implements
AppletBooklistBiz
{
private
static
final
String
BOOKLIST_BOOK
=
CacheConstant
.
BOOK
+
"APPLET:listBooklist4Wechat_"
;
@Autowired
@Autowired
private
AppletBooklistClassifyDao
appletBooklistClassifyDao
;
private
AppletBooklistClassifyDao
appletBooklistClassifyDao
;
@Autowired
@Autowired
...
@@ -100,7 +105,7 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
...
@@ -100,7 +105,7 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
appletBooklistDao
.
deleteById
(
id
);
appletBooklistDao
.
deleteById
(
id
);
appletBooklistDao
.
deleteConfigByBooklistId
(
id
);
appletBooklistDao
.
deleteConfigByBooklistId
(
id
);
//删除客户端缓存
//删除客户端缓存
JedisClusterUtils
.
del
(
"BOOK:APPLET:listBooklist4Wechat_"
+
id
);
JedisClusterUtils
.
del
(
BOOKLIST_BOOK
+
id
);
}
}
@Override
@Override
...
@@ -122,9 +127,10 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
...
@@ -122,9 +127,10 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
}
}
@Override
@Override
public
PageBeanNew
<
AppletBooklistDTO
>
listBooklist
(
Integer
currentPage
,
Integer
numPerPage
,
String
name
)
{
public
PageBeanNew
<
AppletBooklistDTO
>
listBooklist
(
Integer
currentPage
,
Integer
numPerPage
,
String
name
,
Long
classifyId
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"name"
,
name
);
paramMap
.
put
(
"name"
,
name
);
paramMap
.
put
(
"classifyId"
,
classifyId
);
PageBeanNew
<
AppletBooklistDTO
>
pageBeanNew
=
appletBooklistDao
.
listPageNew
(
PageBeanNew
<
AppletBooklistDTO
>
pageBeanNew
=
appletBooklistDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"listBooklist"
);
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"listBooklist"
);
if
(
null
==
pageBeanNew
||
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
())){
if
(
null
==
pageBeanNew
||
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
())){
...
@@ -156,7 +162,7 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
...
@@ -156,7 +162,7 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
appletBooklistDao
.
deleteConfigByBooklistId
(
booklistId
);
appletBooklistDao
.
deleteConfigByBooklistId
(
booklistId
);
appletBooklistDao
.
addBooklistConfig
(
configDTOS
);
appletBooklistDao
.
addBooklistConfig
(
configDTOS
);
//删除客户端缓存
//删除客户端缓存
JedisClusterUtils
.
del
(
"BOOK:APPLET:listBooklist4Wechat_"
+
booklistId
);
JedisClusterUtils
.
del
(
BOOKLIST_BOOK
+
booklistId
);
}
}
@Override
@Override
...
@@ -217,28 +223,36 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
...
@@ -217,28 +223,36 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
}
}
@Override
@Override
public
PageBeanNew
<
AppletBooklistDTO
>
listBooklist4Wechat
(
Long
classifyId
,
Integer
currentPage
,
Integer
numPerPage
){
public
PageBeanNew
<
AppletBooklistDTO
>
listBooklist4Wechat
(
Long
classifyId
,
Integer
currentPage
,
Integer
numPerPage
,
Long
wechatUserId
)
{
if
(
null
==
classifyId
){
//没有栏目id取第一个
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
List
<
AppletBooklistClassifyDTO
>
classifyDTOS
=
getAllBooklistClassify
(
true
);
if
(
null
==
classifyId
)
{
//首页书单推荐
if
(
ListUtils
.
isEmpty
(
classifyDTOS
)){
List
<
Long
>
classifyIds
=
appletBooklistClassifyDao
.
getClassifyIdsByUserId
(
wechatUserId
);
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"没有书单栏目"
);
if
(
ListUtils
.
isEmpty
(
classifyIds
))
{
//没有栏目id取第一个
List
<
AppletBooklistClassifyDTO
>
classifyDTOS
=
getAllBooklistClassify
(
true
);
if
(
ListUtils
.
isEmpty
(
classifyDTOS
))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
}
classifyId
=
classifyDTOS
.
get
(
0
).
getId
();
classifyIds
.
add
(
classifyId
);
}
}
classifyId
=
classifyDTOS
.
get
(
0
).
getId
();
map
.
put
(
"classifyIdList"
,
classifyIds
);
map
.
put
(
"order"
,
1
);
}
else
{
map
.
put
(
"classifyId"
,
classifyId
);
}
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"classifyId"
,
classifyId
);
PageBeanNew
<
AppletBooklistDTO
>
pageBeanNew
=
appletBooklistDao
.
listPageNew
(
PageBeanNew
<
AppletBooklistDTO
>
pageBeanNew
=
appletBooklistDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
map
,
"listBooklist4Wechat"
);
new
PageParam
(
currentPage
,
numPerPage
),
map
,
"listBooklist4Wechat"
);
if
(
null
==
pageBeanNew
||
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
())){
if
(
null
==
pageBeanNew
||
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
()))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
}
}
for
(
AppletBooklistDTO
booklistDTO
:
pageBeanNew
.
getRecordList
()){
for
(
AppletBooklistDTO
booklistDTO
:
pageBeanNew
.
getRecordList
())
{
Long
booklistId
=
booklistDTO
.
getId
();
Long
booklistId
=
booklistDTO
.
getId
();
String
key
=
"BOOK:APPLET:listBooklist4Wechat_"
+
booklistId
;
String
key
=
BOOKLIST_BOOK
+
booklistId
;
List
<
BookDTO4Booklist
>
bookList
=
JedisClusterUtils
.
getJsonList
(
key
,
BookDTO4Booklist
.
class
);
List
<
BookDTO4Booklist
>
bookList
=
JedisClusterUtils
.
getJsonList
(
key
,
BookDTO4Booklist
.
class
);
if
(
ListUtils
.
isEmpty
(
bookList
)){
if
(
ListUtils
.
isEmpty
(
bookList
))
{
bookList
=
appletBooklistDao
.
getBookBaseByBooklistId
(
booklistId
,
0
,
3
);
bookList
=
appletBooklistDao
.
getBookBaseByBooklistId
(
booklistId
,
0
,
3
);
JedisClusterUtils
.
setJson
(
key
,
bookList
);
JedisClusterUtils
.
setJson
(
key
,
bookList
);
JedisClusterUtils
.
expire
(
key
,
3600
);
}
}
booklistDTO
.
setBookDTO4Booklists
(
bookList
);
booklistDTO
.
setBookDTO4Booklists
(
bookList
);
}
}
...
@@ -268,4 +282,52 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
...
@@ -268,4 +282,52 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
}
}
return
bookDTO4Booklist
;
return
bookDTO4Booklist
;
}
}
@Override
public
void
addUserBooklistClassify
(
List
<
Long
>
classifyIds
,
Long
wechatUserId
)
{
if
(
null
==
wechatUserId
){
return
;
}
appletBooklistClassifyDao
.
deleteClassifyByWechatUesrId
(
wechatUserId
);
if
(
ListUtils
.
isEmpty
(
classifyIds
)){
List
<
AppletBooklistClassifyDTO
>
classifyDTOS
=
getAllBooklistClassify
(
true
);
if
(
ListUtils
.
isEmpty
(
classifyDTOS
)){
return
;
}
classifyIds
.
add
(
classifyDTOS
.
get
(
0
).
getId
());
}
List
<
AppletBooklistClassifyUser
>
addList
=
new
ArrayList
<>();
for
(
Long
classifyId
:
classifyIds
){
AppletBooklistClassifyUser
classifyUser
=
new
AppletBooklistClassifyUser
();
classifyUser
.
setClassifyId
(
classifyId
);
classifyUser
.
setWechatUserId
(
wechatUserId
);
addList
.
add
(
classifyUser
);
}
appletBooklistClassifyDao
.
batchInsertUserBooklistClassify
(
addList
);
}
@Override
public
List
<
AppletBooklistClassifyDTO
>
getAllBooklistClassify4Wechat
(
Long
wechatUserId
)
{
List
<
AppletBooklistClassifyDTO
>
list
=
appletBooklistClassifyDao
.
getAllBooklistClassify
(
true
);
if
(
ListUtils
.
isEmpty
(
list
))
{
return
new
ArrayList
<>();
}
List
<
Long
>
chooseIds
=
appletBooklistClassifyDao
.
getClassifyIdsByUserId
(
wechatUserId
);
if
(
ListUtils
.
isEmpty
(
chooseIds
))
{
chooseIds
.
add
(
list
.
get
(
0
).
getId
());
}
for
(
AppletBooklistClassifyDTO
appletNewsClassifyDTO
:
list
)
{
if
(!
ListUtils
.
isEmpty
(
chooseIds
)
&&
chooseIds
.
contains
(
appletNewsClassifyDTO
.
getId
()))
{
appletNewsClassifyDTO
.
setChoose
(
true
);
}
else
{
appletNewsClassifyDTO
.
setChoose
(
false
);
}
}
return
list
;
}
@Override
public
List
<
AppletBooklistClassifyDTO
>
getBooklistClassifyByUser
(
Long
wechatUserId
)
{
return
appletBooklistClassifyDao
.
getClassifysByUserId
(
wechatUserId
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletNewsBizImpl.java
View file @
b83553a9
...
@@ -14,6 +14,7 @@ import com.pcloud.book.applet.dto.PvuvDTO;
...
@@ -14,6 +14,7 @@ import com.pcloud.book.applet.dto.PvuvDTO;
import
com.pcloud.book.applet.entity.AppletLinkClick
;
import
com.pcloud.book.applet.entity.AppletLinkClick
;
import
com.pcloud.book.applet.entity.AppletNews
;
import
com.pcloud.book.applet.entity.AppletNews
;
import
com.pcloud.book.applet.entity.AppletNewsClassify
;
import
com.pcloud.book.applet.entity.AppletNewsClassify
;
import
com.pcloud.book.applet.entity.AppletNewsClassifyUser
;
import
com.pcloud.book.applet.entity.AppletNewsComment
;
import
com.pcloud.book.applet.entity.AppletNewsComment
;
import
com.pcloud.book.applet.enums.DataRecordTypeEnum
;
import
com.pcloud.book.applet.enums.DataRecordTypeEnum
;
import
com.pcloud.book.applet.enums.DataTypeEnum
;
import
com.pcloud.book.applet.enums.DataTypeEnum
;
...
@@ -147,11 +148,12 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
...
@@ -147,11 +148,12 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
@Override
@Override
public
PageBeanNew
<
AppletNewsDTO
>
listAppletNews
(
Integer
currentPage
,
Integer
numPerPage
,
String
name
,
public
PageBeanNew
<
AppletNewsDTO
>
listAppletNews
(
Integer
currentPage
,
Integer
numPerPage
,
String
name
,
Long
firstClassify
,
Long
secondClassify
,
Long
gradeLabelId
,
Long
firstClassify
,
Long
secondClassify
,
Long
gradeLabelId
,
Long
subjectLabelId
,
Long
rightsClassifyId
,
String
source
)
{
Long
subjectLabelId
,
Long
rightsClassifyId
,
String
source
,
Long
newsClassifyId
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"name"
,
name
);
paramMap
.
put
(
"name"
,
name
);
paramMap
.
put
(
"rightsClassifyId"
,
rightsClassifyId
);
paramMap
.
put
(
"rightsClassifyId"
,
rightsClassifyId
);
paramMap
.
put
(
"source"
,
source
);
paramMap
.
put
(
"source"
,
source
);
paramMap
.
put
(
"newsClassifyId"
,
newsClassifyId
);
//处理分类
//处理分类
if
(
null
!=
firstClassify
){
if
(
null
!=
firstClassify
){
BaseTempletClassify
classify
=
new
BaseTempletClassify
();
BaseTempletClassify
classify
=
new
BaseTempletClassify
();
...
@@ -270,23 +272,28 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
...
@@ -270,23 +272,28 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
}
}
@Override
@Override
public
PageBeanNew
<
AppletNewsDTO
>
listAppletNews4Wechat
(
Integer
currentPage
,
Integer
numPerPage
,
Long
newsClassifyId
)
{
public
PageBeanNew
<
AppletNewsDTO
>
listAppletNews4Wechat
(
Integer
currentPage
,
Integer
numPerPage
,
Long
newsClassifyId
,
Long
wechatUserId
)
{
if
(
null
==
newsClassifyId
){
//没有栏目id取第一个
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
List
<
AppletNewsClassifyDTO
>
classifyDTOS
=
getAllNewsClassify
(
true
);
if
(
null
==
newsClassifyId
)
{
//首页资讯
if
(
ListUtils
.
isEmpty
(
classifyDTOS
)){
List
<
Long
>
classifyIds
=
appletNewsClassifyDao
.
getClassifyIdsByUserId
(
wechatUserId
);
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"没有资讯栏目"
);
if
(
ListUtils
.
isEmpty
(
classifyIds
))
{
//没有栏目id取第一个
List
<
AppletNewsClassifyDTO
>
classifyDTOS
=
getAllNewsClassify
(
true
);
if
(
ListUtils
.
isEmpty
(
classifyDTOS
))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
new
ArrayList
<>());
}
newsClassifyId
=
classifyDTOS
.
get
(
0
).
getId
();
classifyIds
.
add
(
newsClassifyId
);
}
}
newsClassifyId
=
classifyDTOS
.
get
(
0
).
getId
();
paramMap
.
put
(
"newsClassifyIdList"
,
classifyIds
);
paramMap
.
put
(
"order"
,
1
);
}
else
{
//栏目下的资讯
paramMap
.
put
(
"newsClassifyId"
,
newsClassifyId
);
}
}
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"newsClassifyId"
,
newsClassifyId
);
paramMap
.
put
(
"showState"
,
true
);
PageBeanNew
<
AppletNewsDTO
>
pageBeanNew
=
appletNewsDao
.
listPageNew
(
PageBeanNew
<
AppletNewsDTO
>
pageBeanNew
=
appletNewsDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
)
,
paramMap
,
"listAppletNews
"
);
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"listAppletNews4Wechat
"
);
if
(
null
==
pageBeanNew
||
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
())){
if
(
null
==
pageBeanNew
||
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
()))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
}
}
fillLabel
(
pageBeanNew
.
getRecordList
());
return
pageBeanNew
;
return
pageBeanNew
;
}
}
...
@@ -517,4 +524,52 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
...
@@ -517,4 +524,52 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
return
exist
;
return
exist
;
}
}
@Override
public
void
addUserNewsClassify
(
List
<
Long
>
newsClassifyIds
,
Long
wechatUserId
)
{
if
(
null
==
wechatUserId
){
return
;
}
appletNewsClassifyDao
.
deleteClassifyByWechatUesrId
(
wechatUserId
);
if
(
ListUtils
.
isEmpty
(
newsClassifyIds
)){
List
<
AppletNewsClassifyDTO
>
list
=
appletNewsClassifyDao
.
getAllNewsClassify
(
true
);
if
(
ListUtils
.
isEmpty
(
list
)){
return
;
}
newsClassifyIds
.
add
(
list
.
get
(
0
).
getId
());
}
List
<
AppletNewsClassifyUser
>
addList
=
new
ArrayList
<>();
for
(
Long
classifyId
:
newsClassifyIds
){
AppletNewsClassifyUser
classifyUser
=
new
AppletNewsClassifyUser
();
classifyUser
.
setNewsClassifyId
(
classifyId
);
classifyUser
.
setWechatUserId
(
wechatUserId
);
addList
.
add
(
classifyUser
);
}
appletNewsClassifyDao
.
batchInsertUserNewsClassify
(
addList
);
}
@Override
public
List
<
AppletNewsClassifyDTO
>
getAllNewsClassify4Wechat
(
Long
wechatUserId
)
{
List
<
AppletNewsClassifyDTO
>
list
=
appletNewsClassifyDao
.
getAllNewsClassify
(
true
);
if
(
ListUtils
.
isEmpty
(
list
))
{
return
new
ArrayList
<>();
}
List
<
Long
>
chooseIds
=
appletNewsClassifyDao
.
getClassifyIdsByUserId
(
wechatUserId
);
if
(
ListUtils
.
isEmpty
(
chooseIds
))
{
chooseIds
.
add
(
list
.
get
(
0
).
getId
());
}
for
(
AppletNewsClassifyDTO
appletNewsClassifyDTO
:
list
)
{
if
(!
ListUtils
.
isEmpty
(
chooseIds
)
&&
chooseIds
.
contains
(
appletNewsClassifyDTO
.
getId
()))
{
appletNewsClassifyDTO
.
setChoose
(
true
);
}
else
{
appletNewsClassifyDTO
.
setChoose
(
false
);
}
}
return
list
;
}
@Override
public
List
<
AppletNewsClassifyDTO
>
getNewsClassifyByUser
(
Long
wechatUserId
)
{
return
appletNewsClassifyDao
.
getClassifysByUserId
(
wechatUserId
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletUserBookcaseBizImpl.java
View file @
b83553a9
...
@@ -17,6 +17,7 @@ import com.pcloud.book.group.dto.BookServeDTO;
...
@@ -17,6 +17,7 @@ import com.pcloud.book.group.dto.BookServeDTO;
import
com.pcloud.book.group.enums.JoinGroupTypeEnum
;
import
com.pcloud.book.group.enums.JoinGroupTypeEnum
;
import
com.pcloud.book.rightsSetting.biz.RightsSettingBiz
;
import
com.pcloud.book.rightsSetting.biz.RightsSettingBiz
;
import
com.pcloud.book.rightsSetting.dto.RightsSettingDto
;
import
com.pcloud.book.rightsSetting.dto.RightsSettingDto
;
import
com.pcloud.book.util.common.ThreadPoolUtils
;
import
com.pcloud.common.constant.CacheConstant
;
import
com.pcloud.common.constant.CacheConstant
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageBeanNew
;
...
@@ -37,6 +38,7 @@ import java.util.List;
...
@@ -37,6 +38,7 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.util.Optional
;
import
java.util.Random
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -64,7 +66,6 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
...
@@ -64,7 +66,6 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
@Override
@Override
public
void
addUserBook
(
AppletUserBookcase
appletUserBookcase
)
{
public
void
addUserBook
(
AppletUserBookcase
appletUserBookcase
)
{
//数据库去重
//数据库去重
appletUserBookcaseDao
.
deleteByBookIdUserId
(
appletUserBookcase
);
appletUserBookcaseDao
.
insert
(
appletUserBookcase
);
appletUserBookcaseDao
.
insert
(
appletUserBookcase
);
Long
wechatUserId
=
appletUserBookcase
.
getWechatUserId
();
Long
wechatUserId
=
appletUserBookcase
.
getWechatUserId
();
JedisClusterUtils
.
del
(
USER_BOOK_CASE
+
wechatUserId
);
JedisClusterUtils
.
del
(
USER_BOOK_CASE
+
wechatUserId
);
...
@@ -215,9 +216,42 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
...
@@ -215,9 +216,42 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
@Override
@Override
public
void
deleteByIds
(
List
<
Long
>
ids
,
Long
wechatUserId
)
{
public
void
deleteByIds
(
List
<
Long
>
ids
,
Long
wechatUserId
)
{
if
(
ListUtils
.
isEmpty
(
ids
)){
return
;
}
appletUserBookcaseDao
.
deleteByIds
(
ids
);
appletUserBookcaseDao
.
deleteByIds
(
ids
);
JedisClusterUtils
.
del
(
USER_BOOK_CASE
+
wechatUserId
);
JedisClusterUtils
.
del
(
USER_BOOK_CASE
+
wechatUserId
);
JedisClusterUtils
.
del
(
USER_BOOK_CASE_COUNT
+
wechatUserId
);
JedisClusterUtils
.
del
(
USER_BOOK_CASE_COUNT
+
wechatUserId
);
}
}
@Override
@ParamLog
(
"更新读者关于本书的阅读方式"
)
public
void
updateUserReadType
(
AppletUserBookcase
appletUserBookcase
)
{
appletUserBookcaseDao
.
updateUserReadType
(
appletUserBookcase
);
}
@Override
@ParamLog
(
"获取用户当前本书的阅读方式"
)
public
AppletUserBookcase
getUserReadType
(
Long
wechatUserId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
)
{
AppletUserBookcase
appletUserBookcase
=
appletUserBookcaseDao
.
getUserReadType
(
wechatUserId
,
bookId
,
adviserId
,
channelId
);
return
appletUserBookcase
;
}
@Override
public
void
randomChangeBook
(
Long
wechatUserId
)
{
List
<
AppletUserBookcase
>
bookcaseList
=
appletUserBookcaseDao
.
getListByUserId
(
wechatUserId
);
//无书或只有一本不处理
if
(
ListUtils
.
isEmpty
(
bookcaseList
)
||
bookcaseList
.
size
()==
1
){
return
;
}
//去除最近一本书
bookcaseList
.
remove
(
0
);
//随机取一本书埋点
AppletUserBookcase
appletUserBookcase
=
bookcaseList
.
get
(
new
Random
().
nextInt
(
bookcaseList
.
size
()));
this
.
addUserBook
(
appletUserBookcase
);
ThreadPoolUtils
.
OTHER_THREAD_POOL
.
execute
(()->{
this
.
listByWechatUserId
(
wechatUserId
,
0
,
1
);
});
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/AppletBooklistClassifyDao.java
View file @
b83553a9
...
@@ -2,6 +2,7 @@ package com.pcloud.book.applet.dao;
...
@@ -2,6 +2,7 @@ package com.pcloud.book.applet.dao;
import
com.pcloud.book.applet.dto.AppletBooklistClassifyDTO
;
import
com.pcloud.book.applet.dto.AppletBooklistClassifyDTO
;
import
com.pcloud.book.applet.entity.AppletBooklistClassify
;
import
com.pcloud.book.applet.entity.AppletBooklistClassify
;
import
com.pcloud.book.applet.entity.AppletBooklistClassifyUser
;
import
com.pcloud.common.core.dao.BaseDao
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
import
java.util.List
;
...
@@ -18,4 +19,36 @@ public interface AppletBooklistClassifyDao extends BaseDao<AppletBooklistClassif
...
@@ -18,4 +19,36 @@ public interface AppletBooklistClassifyDao extends BaseDao<AppletBooklistClassif
* @return
* @return
*/
*/
List
<
AppletBooklistClassifyDTO
>
getAllBooklistClassify
(
Boolean
showState
);
List
<
AppletBooklistClassifyDTO
>
getAllBooklistClassify
(
Boolean
showState
);
/**
* 用户选择书单栏目
* @author:zhuyajie
* @date:2020/5/14 11:15
* * @param null
*/
void
batchInsertUserBooklistClassify
(
List
<
AppletBooklistClassifyUser
>
booklistClassifyUsers
);
/**
* 用户删除书单栏目
*
* @author:zhuyajie
* @date:2020/5/14 11:15 * @param null
*/
void
deleteClassifyByWechatUesrId
(
Long
wechatUserId
);
/**
* 获取用户选择的书单栏目id
*
* @author:zhuyajie
* @date:2020/5/14 11:18 * @param null
*/
List
<
Long
>
getClassifyIdsByUserId
(
Long
wechatUserId
);
/**
* 获取用户选择的书单栏目
*
* @author:zhuyajie
* @date:2020/5/14 11:32 * @param null
*/
List
<
AppletBooklistClassifyDTO
>
getClassifysByUserId
(
Long
wechatUserId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/AppletNewsClassifyDao.java
View file @
b83553a9
...
@@ -2,6 +2,7 @@ package com.pcloud.book.applet.dao;
...
@@ -2,6 +2,7 @@ package com.pcloud.book.applet.dao;
import
com.pcloud.book.applet.dto.AppletNewsClassifyDTO
;
import
com.pcloud.book.applet.dto.AppletNewsClassifyDTO
;
import
com.pcloud.book.applet.entity.AppletNewsClassify
;
import
com.pcloud.book.applet.entity.AppletNewsClassify
;
import
com.pcloud.book.applet.entity.AppletNewsClassifyUser
;
import
com.pcloud.common.core.dao.BaseDao
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
import
java.util.List
;
...
@@ -19,4 +20,35 @@ public interface AppletNewsClassifyDao extends BaseDao<AppletNewsClassify> {
...
@@ -19,4 +20,35 @@ public interface AppletNewsClassifyDao extends BaseDao<AppletNewsClassify> {
* @return
* @return
*/
*/
List
<
AppletNewsClassifyDTO
>
getAllNewsClassify
(
Boolean
showState
);
List
<
AppletNewsClassifyDTO
>
getAllNewsClassify
(
Boolean
showState
);
/**
* 用户选择资讯栏目
* @author:zhuyajie
* @date:2020/5/14 11:15
* * @param null
*/
void
batchInsertUserNewsClassify
(
List
<
AppletNewsClassifyUser
>
appletNewsClassifyUsers
);
/**
* 用户删除资讯栏目
*
* @author:zhuyajie
* @date:2020/5/14 11:15 * @param null
*/
void
deleteClassifyByWechatUesrId
(
Long
wechatUserId
);
/**
* 获取用户选择的资讯栏目id
*
* @author:zhuyajie
* @date:2020/5/14 11:18 * @param null
*/
List
<
Long
>
getClassifyIdsByUserId
(
Long
wechatUserId
);
/**
* 获取用户选择的资讯栏目
*
* @author:zhuyajie
* @date:2020/5/14 11:32 * @param null
*/
List
<
AppletNewsClassifyDTO
>
getClassifysByUserId
(
Long
wechatUserId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/AppletUserBookcaseDao.java
View file @
b83553a9
...
@@ -56,4 +56,15 @@ public interface AppletUserBookcaseDao extends BaseDao<AppletUserBookcase> {
...
@@ -56,4 +56,15 @@ public interface AppletUserBookcaseDao extends BaseDao<AppletUserBookcase> {
* * @param null
* * @param null
*/
*/
void
deleteByIds
(
List
<
Long
>
ids
);
void
deleteByIds
(
List
<
Long
>
ids
);
void
updateUserReadType
(
AppletUserBookcase
appletUserBookcase
);
AppletUserBookcase
getUserReadType
(
Long
wechatUserId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
);
/**
* 查书架列表
* @author:zhuyajie
* @date:2020/5/15
* * @param null
*/
List
<
AppletUserBookcase
>
getListByUserId
(
Long
wechatUserId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/impl/AppletBooklistClassifyDaoImpl.java
View file @
b83553a9
...
@@ -3,7 +3,9 @@ package com.pcloud.book.applet.dao.impl;
...
@@ -3,7 +3,9 @@ package com.pcloud.book.applet.dao.impl;
import
com.pcloud.book.applet.dao.AppletBooklistClassifyDao
;
import
com.pcloud.book.applet.dao.AppletBooklistClassifyDao
;
import
com.pcloud.book.applet.dto.AppletBooklistClassifyDTO
;
import
com.pcloud.book.applet.dto.AppletBooklistClassifyDTO
;
import
com.pcloud.book.applet.entity.AppletBooklistClassify
;
import
com.pcloud.book.applet.entity.AppletBooklistClassify
;
import
com.pcloud.book.applet.entity.AppletBooklistClassifyUser
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -25,4 +27,24 @@ public class AppletBooklistClassifyDaoImpl extends BaseDaoImpl<AppletBooklistCla
...
@@ -25,4 +27,24 @@ public class AppletBooklistClassifyDaoImpl extends BaseDaoImpl<AppletBooklistCla
map
.
put
(
"showState"
,
showState
);
map
.
put
(
"showState"
,
showState
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getAllBooklistClassify"
),
map
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getAllBooklistClassify"
),
map
);
}
}
@Override
public
void
batchInsertUserBooklistClassify
(
List
<
AppletBooklistClassifyUser
>
booklistClassifyUsers
)
{
getSessionTemplate
().
insert
(
getStatement
(
"batchInsertUserBooklistClassify"
),
booklistClassifyUsers
);
}
@Override
public
void
deleteClassifyByWechatUesrId
(
Long
wechatUserId
)
{
getSessionTemplate
().
delete
(
getStatement
(
"deleteClassifyByWechatUesrId"
),
wechatUserId
);
}
@Override
public
List
<
Long
>
getClassifyIdsByUserId
(
Long
wechatUserId
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getClassifyIdsByUserId"
),
wechatUserId
);
}
@Override
public
List
<
AppletBooklistClassifyDTO
>
getClassifysByUserId
(
Long
wechatUserId
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getClassifysByUserId"
),
wechatUserId
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/impl/AppletNewsClassifyDaoImpl.java
View file @
b83553a9
...
@@ -3,7 +3,9 @@ package com.pcloud.book.applet.dao.impl;
...
@@ -3,7 +3,9 @@ package com.pcloud.book.applet.dao.impl;
import
com.pcloud.book.applet.dao.AppletNewsClassifyDao
;
import
com.pcloud.book.applet.dao.AppletNewsClassifyDao
;
import
com.pcloud.book.applet.dto.AppletNewsClassifyDTO
;
import
com.pcloud.book.applet.dto.AppletNewsClassifyDTO
;
import
com.pcloud.book.applet.entity.AppletNewsClassify
;
import
com.pcloud.book.applet.entity.AppletNewsClassify
;
import
com.pcloud.book.applet.entity.AppletNewsClassifyUser
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -23,4 +25,24 @@ public class AppletNewsClassifyDaoImpl extends BaseDaoImpl<AppletNewsClassify> i
...
@@ -23,4 +25,24 @@ public class AppletNewsClassifyDaoImpl extends BaseDaoImpl<AppletNewsClassify> i
map
.
put
(
"showState"
,
showState
);
map
.
put
(
"showState"
,
showState
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getAllNewsClassify"
),
map
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getAllNewsClassify"
),
map
);
}
}
@Override
public
void
batchInsertUserNewsClassify
(
List
<
AppletNewsClassifyUser
>
appletNewsClassifyUsers
)
{
getSessionTemplate
().
insert
(
getStatement
(
"batchInsertUserNewsClassify"
),
appletNewsClassifyUsers
);
}
@Override
public
void
deleteClassifyByWechatUesrId
(
Long
wechatUserId
)
{
getSessionTemplate
().
delete
(
getStatement
(
"deleteClassifyByWechatUesrId"
),
wechatUserId
);
}
@Override
public
List
<
Long
>
getClassifyIdsByUserId
(
Long
wechatUserId
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getClassifyIdsByUserId"
),
wechatUserId
);
}
@Override
public
List
<
AppletNewsClassifyDTO
>
getClassifysByUserId
(
Long
wechatUserId
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getClassifysByUserId"
),
wechatUserId
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/impl/AppletUserBookcaseDaoImpl.java
View file @
b83553a9
...
@@ -66,4 +66,24 @@ public class AppletUserBookcaseDaoImpl extends BaseDaoImpl<AppletUserBookcase> i
...
@@ -66,4 +66,24 @@ public class AppletUserBookcaseDaoImpl extends BaseDaoImpl<AppletUserBookcase> i
public
void
deleteByIds
(
List
<
Long
>
list
)
{
public
void
deleteByIds
(
List
<
Long
>
list
)
{
getSessionTemplate
().
delete
(
getStatement
(
"deleteByIds"
),
list
);
getSessionTemplate
().
delete
(
getStatement
(
"deleteByIds"
),
list
);
}
}
@Override
public
void
updateUserReadType
(
AppletUserBookcase
appletUserBookcase
)
{
getSessionTemplate
().
update
(
getStatement
(
"updateUserReadType"
),
appletUserBookcase
);
}
@Override
public
AppletUserBookcase
getUserReadType
(
Long
wechatUserId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"wechatUserId"
,
wechatUserId
);
paramMap
.
put
(
"bookId"
,
bookId
);
paramMap
.
put
(
"adviserId"
,
adviserId
);
paramMap
.
put
(
"channelId"
,
channelId
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getUserReadType"
),
paramMap
);
}
@Override
public
List
<
AppletUserBookcase
>
getListByUserId
(
Long
wechatUserId
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getListByUserId"
),
wechatUserId
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dto/AppletBooklistClassifyDTO.java
View file @
b83553a9
...
@@ -23,4 +23,10 @@ public class AppletBooklistClassifyDTO extends BaseDto {
...
@@ -23,4 +23,10 @@ public class AppletBooklistClassifyDTO extends BaseDto {
@ApiModelProperty
(
"是否展示"
)
@ApiModelProperty
(
"是否展示"
)
private
Boolean
showState
;
private
Boolean
showState
;
@ApiModelProperty
(
"图标"
)
private
String
pic
;
@ApiModelProperty
(
"用户是否选择"
)
private
Boolean
choose
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dto/AppletNewsClassifyDTO.java
View file @
b83553a9
...
@@ -24,5 +24,9 @@ public class AppletNewsClassifyDTO extends BaseDto {
...
@@ -24,5 +24,9 @@ public class AppletNewsClassifyDTO extends BaseDto {
@ApiModelProperty
(
"资讯数量"
)
@ApiModelProperty
(
"资讯数量"
)
private
Integer
newsCount
;
private
Integer
newsCount
;
@ApiModelProperty
(
"图标"
)
private
String
pic
;
@ApiModelProperty
(
"用户是否选择"
)
private
Boolean
choose
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dto/UserLastBookReDTO.java
View file @
b83553a9
...
@@ -29,4 +29,7 @@ public class UserLastBookReDTO {
...
@@ -29,4 +29,7 @@ public class UserLastBookReDTO {
@ApiModelProperty
(
"权益id"
)
@ApiModelProperty
(
"权益id"
)
private
Long
rightSettingId
;
private
Long
rightSettingId
;
@ApiModelProperty
(
"阅读方式"
)
private
Integer
readType
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/entity/AppletBooklistClassify.java
View file @
b83553a9
...
@@ -17,4 +17,7 @@ public class AppletBooklistClassify extends BaseEntity {
...
@@ -17,4 +17,7 @@ public class AppletBooklistClassify extends BaseEntity {
@ApiModelProperty
(
"是否展示"
)
@ApiModelProperty
(
"是否展示"
)
private
Boolean
showState
;
private
Boolean
showState
;
@ApiModelProperty
(
"图标"
)
private
String
pic
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/entity/AppletBooklistClassifyUser.java
0 → 100644
View file @
b83553a9
package
com
.
pcloud
.
book
.
applet
.
entity
;
import
java.util.Date
;
import
java.io.Serializable
;
import
lombok.Data
;
/**
* 用户书单栏目选择(AppletBooklistClassifyUser)实体类
*
* @author makejava
* @since 2020-05-14 14:40:31
*/
@Data
public
class
AppletBooklistClassifyUser
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
92412747639655546L
;
private
Long
id
;
/**
* 书单栏目id
*/
private
Long
classifyId
;
private
Long
wechatUserId
;
/**
* 创建时间
*/
private
Date
createTime
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/entity/AppletNewsClassify.java
View file @
b83553a9
...
@@ -17,4 +17,7 @@ public class AppletNewsClassify extends BaseEntity {
...
@@ -17,4 +17,7 @@ public class AppletNewsClassify extends BaseEntity {
@ApiModelProperty
(
"是否展示"
)
@ApiModelProperty
(
"是否展示"
)
private
Boolean
showState
;
private
Boolean
showState
;
@ApiModelProperty
(
"图标"
)
private
String
pic
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/entity/AppletNewsClassifyUser.java
0 → 100644
View file @
b83553a9
package
com
.
pcloud
.
book
.
applet
.
entity
;
import
java.util.Date
;
import
java.io.Serializable
;
import
lombok.Data
;
/**
* 用户咨询栏目选择(AppletNewsClassifyUser)实体类
*
* @author makejava
* @since 2020-05-14 11:13:03
*/
@Data
public
class
AppletNewsClassifyUser
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
80975015210568526L
;
private
Long
id
;
/**
* 栏目id
*/
private
Long
newsClassifyId
;
/**
* 用户id
*/
private
Long
wechatUserId
;
private
Date
createTime
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/entity/AppletUserBookcase.java
View file @
b83553a9
...
@@ -20,4 +20,7 @@ public class AppletUserBookcase extends BaseEntity {
...
@@ -20,4 +20,7 @@ public class AppletUserBookcase extends BaseEntity {
@ApiModelProperty
(
"编辑id"
)
@ApiModelProperty
(
"编辑id"
)
private
Long
adviserId
;
private
Long
adviserId
;
@ApiModelProperty
(
"阅读类型"
)
private
Integer
readType
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/facade/AppletHomeFacade.java
View file @
b83553a9
...
@@ -178,12 +178,13 @@ public class AppletHomeFacade {
...
@@ -178,12 +178,13 @@ public class AppletHomeFacade {
@RequestHeader
(
"token"
)
String
token
,
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页数量"
)
Integer
numPerPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页数量"
)
Integer
numPerPage
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
@ApiParam
(
"名称查询"
)
String
name
)
throws
PermissionException
{
@RequestParam
(
value
=
"name"
,
required
=
false
)
@ApiParam
(
"名称查询"
)
String
name
,
@RequestParam
(
value
=
"classifyId"
,
required
=
false
)
@ApiParam
(
"书单栏目id"
)
Long
classifyId
)
throws
PermissionException
{
SessionUtil
.
getInfoToken4Redis
(
token
);
SessionUtil
.
getInfoToken4Redis
(
token
);
if
(
null
==
currentPage
||
null
==
numPerPage
){
if
(
null
==
currentPage
||
null
==
numPerPage
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少分页参数"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少分页参数"
);
}
}
return
new
ResponseDto
<>(
appletBooklistBiz
.
listBooklist
(
currentPage
,
numPerPage
,
name
));
return
new
ResponseDto
<>(
appletBooklistBiz
.
listBooklist
(
currentPage
,
numPerPage
,
name
,
classifyId
));
}
}
@ApiOperation
(
"书单添加图书"
)
@ApiOperation
(
"书单添加图书"
)
...
@@ -320,13 +321,15 @@ public class AppletHomeFacade {
...
@@ -320,13 +321,15 @@ public class AppletHomeFacade {
@ApiOperation
(
"客户端获取书单列表"
)
@ApiOperation
(
"客户端获取书单列表"
)
@GetMapping
(
"listBooklist4Wechat"
)
@GetMapping
(
"listBooklist4Wechat"
)
public
ResponseDto
<
PageBeanNew
<
AppletBooklistDTO
>>
listBooklist4Wechat
(
public
ResponseDto
<
PageBeanNew
<
AppletBooklistDTO
>>
listBooklist4Wechat
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
value
=
"classifyId"
,
required
=
false
)
@ApiParam
(
"书单栏目id"
)
Long
classifyId
,
@RequestParam
(
value
=
"classifyId"
,
required
=
false
)
@ApiParam
(
"书单栏目id"
)
Long
classifyId
,
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页数量"
)
Integer
numPerPage
){
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页数量"
)
Integer
numPerPage
){
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
currentPage
||
null
==
numPerPage
){
if
(
null
==
currentPage
||
null
==
numPerPage
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少分页参数"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少分页参数"
);
}
}
return
new
ResponseDto
<>(
appletBooklistBiz
.
listBooklist4Wechat
(
classifyId
,
currentPage
,
numPerPage
));
return
new
ResponseDto
<>(
appletBooklistBiz
.
listBooklist4Wechat
(
classifyId
,
currentPage
,
numPerPage
,
wechatUserId
));
}
}
@ApiOperation
(
"客户端根据id获取书单"
)
@ApiOperation
(
"客户端根据id获取书单"
)
...
@@ -448,26 +451,29 @@ public class AppletHomeFacade {
...
@@ -448,26 +451,29 @@ public class AppletHomeFacade {
@RequestParam
(
value
=
"gradeLabelId"
,
required
=
false
)
@ApiParam
(
"年级标签"
)
Long
gradeLabelId
,
@RequestParam
(
value
=
"gradeLabelId"
,
required
=
false
)
@ApiParam
(
"年级标签"
)
Long
gradeLabelId
,
@RequestParam
(
value
=
"subjectLabelId"
,
required
=
false
)
@ApiParam
(
"科目标签"
)
Long
subjectLabelId
,
@RequestParam
(
value
=
"subjectLabelId"
,
required
=
false
)
@ApiParam
(
"科目标签"
)
Long
subjectLabelId
,
@RequestParam
(
value
=
"rightsClassifyId"
,
required
=
false
)
@ApiParam
(
"权益分类"
)
Long
rightsClassifyId
,
@RequestParam
(
value
=
"rightsClassifyId"
,
required
=
false
)
@ApiParam
(
"权益分类"
)
Long
rightsClassifyId
,
@RequestParam
(
value
=
"source"
,
required
=
false
)
@ApiParam
(
"来源"
)
String
source
@RequestParam
(
value
=
"source"
,
required
=
false
)
@ApiParam
(
"来源"
)
String
source
,
@RequestParam
(
value
=
"newsClassifyId"
,
required
=
false
)
@ApiParam
(
"资讯栏目id"
)
Long
newsClassifyId
)
throws
PermissionException
{
)
throws
PermissionException
{
SessionUtil
.
getInfoToken4Redis
(
token
);
SessionUtil
.
getInfoToken4Redis
(
token
);
if
(
null
==
currentPage
||
null
==
numPerPage
){
if
(
null
==
currentPage
||
null
==
numPerPage
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少分页参数"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少分页参数"
);
}
}
return
new
ResponseDto
<>(
appletNewsBiz
.
listAppletNews
(
currentPage
,
numPerPage
,
name
,
firstClassify
,
secondClassify
,
gradeLabelId
,
return
new
ResponseDto
<>(
appletNewsBiz
.
listAppletNews
(
currentPage
,
numPerPage
,
name
,
firstClassify
,
secondClassify
,
gradeLabelId
,
subjectLabelId
,
rightsClassifyId
,
source
));
subjectLabelId
,
rightsClassifyId
,
source
,
newsClassifyId
));
}
}
@ApiOperation
(
"客户端资讯列表"
)
@ApiOperation
(
"客户端资讯列表"
)
@GetMapping
(
"listAppletNews4Wechat"
)
@GetMapping
(
"listAppletNews4Wechat"
)
public
ResponseDto
<
PageBeanNew
<
AppletNewsDTO
>>
listAppletNews4Wechat
(
public
ResponseDto
<
PageBeanNew
<
AppletNewsDTO
>>
listAppletNews4Wechat
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页数量"
)
Integer
numPerPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页数量"
)
Integer
numPerPage
,
@RequestParam
(
value
=
"newsClassifyId"
,
required
=
false
)
@ApiParam
(
"资讯栏目id"
)
Long
newsClassifyId
)
{
@RequestParam
(
value
=
"newsClassifyId"
,
required
=
false
)
@ApiParam
(
"资讯栏目id"
)
Long
newsClassifyId
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
currentPage
||
null
==
numPerPage
){
if
(
null
==
currentPage
||
null
==
numPerPage
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少分页参数"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少分页参数"
);
}
}
return
new
ResponseDto
<>(
appletNewsBiz
.
listAppletNews4Wechat
(
currentPage
,
numPerPage
,
newsClassifyId
));
return
new
ResponseDto
<>(
appletNewsBiz
.
listAppletNews4Wechat
(
currentPage
,
numPerPage
,
newsClassifyId
,
wechatUserId
));
}
}
@ApiOperation
(
"添加资讯评论"
)
@ApiOperation
(
"添加资讯评论"
)
...
@@ -606,13 +612,14 @@ public class AppletHomeFacade {
...
@@ -606,13 +612,14 @@ public class AppletHomeFacade {
@RequestParam
(
value
=
"adviserId"
)
Long
adviserId
,
@RequestParam
(
value
=
"adviserId"
)
Long
adviserId
,
@RequestParam
(
value
=
"bookId"
)
Long
bookId
,
@RequestParam
(
value
=
"bookId"
)
Long
bookId
,
@RequestParam
(
value
=
"rightsSettingId"
)
Long
rightsSettingId
,
@RequestParam
(
value
=
"rightsSettingId"
)
Long
rightsSettingId
,
@RequestParam
(
value
=
"channelId"
)
Long
channelId
@RequestParam
(
value
=
"channelId"
)
Long
channelId
,
@RequestParam
(
value
=
"readType"
,
required
=
false
)
@ApiParam
(
"阅读方式1轻松2高效3深度"
)
Integer
readType
)
{
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
wechatUserId
){
if
(
null
==
wechatUserId
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少参数"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少参数"
);
}
}
return
new
ResponseDto
<>(
pcloudGroupActivityBiz
.
getGroupActivity4Applet
(
rightsSettingId
,
adviserId
,
bookId
,
channelId
));
return
new
ResponseDto
<>(
pcloudGroupActivityBiz
.
getGroupActivity4Applet
(
rightsSettingId
,
adviserId
,
bookId
,
channelId
,
readType
));
}
}
@ApiOperation
(
"资讯来源列表"
)
@ApiOperation
(
"资讯来源列表"
)
...
@@ -707,6 +714,89 @@ public class AppletHomeFacade {
...
@@ -707,6 +714,89 @@ public class AppletHomeFacade {
subjectLabelId
,
linkOnly
,
rightsClassifyId
));
subjectLabelId
,
linkOnly
,
rightsClassifyId
));
}
}
@ApiOperation
(
"用户选择资讯栏目"
)
@PostMapping
(
"addUserNewsClassify"
)
public
ResponseDto
<?>
addUserNewsClassify
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestBody
List
<
Long
>
newsClassifyIds
){
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
appletNewsBiz
.
addUserNewsClassify
(
newsClassifyIds
,
wechatUserId
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"所有资讯栏目列表+用户选择的资讯栏目"
)
@GetMapping
(
"getAllNewsClassify4Wechat"
)
public
ResponseDto
<
List
<
AppletNewsClassifyDTO
>>
getAllNewsClassify4Wechat
(
@CookieValue
(
"userInfo"
)
String
userInfo
){
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
appletNewsBiz
.
getAllNewsClassify4Wechat
(
wechatUserId
));
}
@ApiOperation
(
"用户选择的资讯栏目"
)
@GetMapping
(
"getNewsClassifyByUser"
)
public
ResponseDto
<
List
<
AppletNewsClassifyDTO
>>
getNewsClassifyByUser
(
@CookieValue
(
"userInfo"
)
String
userInfo
){
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
appletNewsBiz
.
getNewsClassifyByUser
(
wechatUserId
));
}
@ApiOperation
(
"用户选择书单栏目"
)
@PostMapping
(
"addUserBooklistClassify"
)
public
ResponseDto
<?>
addUserBooklistClassify
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestBody
List
<
Long
>
classifyIds
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
appletBooklistBiz
.
addUserBooklistClassify
(
classifyIds
,
wechatUserId
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"所有书单栏目列表+用户选择的书单栏目"
)
@GetMapping
(
"getAllBooklistClassify4Wechat"
)
public
ResponseDto
<
List
<
AppletBooklistClassifyDTO
>>
getAllBooklistClassify4Wechat
(
@CookieValue
(
"userInfo"
)
String
userInfo
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
appletBooklistBiz
.
getAllBooklistClassify4Wechat
(
wechatUserId
));
}
@ApiOperation
(
"用户选择的书单栏目"
)
@GetMapping
(
"getBooklistClassifyByUser"
)
public
ResponseDto
<
List
<
AppletBooklistClassifyDTO
>>
getBooklistClassifyByUser
(
@CookieValue
(
"userInfo"
)
String
userInfo
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
appletBooklistBiz
.
getBooklistClassifyByUser
(
wechatUserId
));
}
@ApiOperation
(
"已读书刊随机换一本书展示"
)
@GetMapping
(
"randomChangeBook"
)
public
ResponseDto
<?>
randomChangeBook
(
@CookieValue
(
"userInfo"
)
String
userInfo
){
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
appletUserBookcaseBiz
.
randomChangeBook
(
wechatUserId
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"更新读者关于本书的阅读方式"
)
@PostMapping
(
"updateUserReadType"
)
public
ResponseDto
<?>
updateUserReadType
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestBody
@ApiParam
(
"图书"
)
AppletUserBookcase
appletUserBookcase
){
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
appletUserBookcase
||
null
==
appletUserBookcase
.
getBookId
()
||
null
==
appletUserBookcase
.
getAdviserId
()
||
null
==
appletUserBookcase
.
getChannelId
()){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少参数"
);
}
appletUserBookcase
.
setWechatUserId
(
wechatUserId
);
appletUserBookcaseBiz
.
updateUserReadType
(
appletUserBookcase
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"获取用户当前本书的阅读方式"
)
@GetMapping
(
"getUserReadType"
)
public
ResponseDto
<
AppletUserBookcase
>
getUserReadType
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"bookId"
)
Long
bookId
,
@RequestParam
(
"adviserId"
)
Long
adviserId
,
@RequestParam
(
"channelId"
)
Long
channelId
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
bookId
||
null
==
adviserId
||
null
==
channelId
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少参数"
);
}
AppletUserBookcase
appletUserBookcase
=
appletUserBookcaseBiz
.
getUserReadType
(
wechatUserId
,
bookId
,
adviserId
,
channelId
);
return
new
ResponseDto
<>(
appletUserBookcase
);
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/biz/RightsSettingBiz.java
View file @
b83553a9
...
@@ -8,7 +8,6 @@ import com.pcloud.book.rightsSetting.entity.RightsNowPic;
...
@@ -8,7 +8,6 @@ import com.pcloud.book.rightsSetting.entity.RightsNowPic;
import
com.pcloud.book.rightsSetting.entity.RightsSetting
;
import
com.pcloud.book.rightsSetting.entity.RightsSetting
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingClassify
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingClassify
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingItem
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingItem
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageBeanNew
;
import
java.util.List
;
import
java.util.List
;
...
@@ -43,7 +42,7 @@ public interface RightsSettingBiz {
...
@@ -43,7 +42,7 @@ public interface RightsSettingBiz {
* @param rightsType
* @param rightsType
* @return
* @return
*/
*/
List
<
RightsSettingItem
>
getItemsByRightsSettingId
(
Long
rightsSettingId
,
String
rightsType
);
List
<
RightsSettingItem
>
getItemsByRightsSettingId
(
Long
rightsSettingId
,
String
rightsType
,
Integer
readType
);
/**
/**
* 小程序首页权益查询
* 小程序首页权益查询
...
@@ -61,7 +60,7 @@ public interface RightsSettingBiz {
...
@@ -61,7 +60,7 @@ public interface RightsSettingBiz {
* @param rightsType
* @param rightsType
* @return
* @return
*/
*/
RightsSettingDto
getItemByRightsSettingId4AppletHome
(
Long
rightsSettingId
,
Long
wechatUserId
,
String
rightsType
);
RightsSettingDto
getItemByRightsSettingId4AppletHome
(
Long
rightsSettingId
,
Long
wechatUserId
,
String
rightsType
,
Integer
readType
);
/**
/**
* 每周/长期权益查询--小程序
* 每周/长期权益查询--小程序
...
@@ -70,7 +69,7 @@ public interface RightsSettingBiz {
...
@@ -70,7 +69,7 @@ public interface RightsSettingBiz {
* @param wechatUserId
* @param wechatUserId
* @return
* @return
*/
*/
List
<
RightsSettingItem
>
getItemsByRightsSettingId4Applet
(
Long
rightsSettingId
,
String
rightsType
,
Long
wechatUserId
);
List
<
RightsSettingItem
>
getItemsByRightsSettingId4Applet
(
Long
rightsSettingId
,
String
rightsType
,
Long
wechatUserId
,
Integer
readType
);
/**
/**
* 查所有权益分类
* 查所有权益分类
...
@@ -96,22 +95,24 @@ public interface RightsSettingBiz {
...
@@ -96,22 +95,24 @@ public interface RightsSettingBiz {
* @Param [rightsSettingId, wechatUserId, type]
* @Param [rightsSettingId, wechatUserId, type]
* @return com.pcloud.book.rightsSetting.entity.RightsSetting
* @return com.pcloud.book.rightsSetting.entity.RightsSetting
**/
**/
RightsSetting
getRightsSettingRightsNowItemsByType
(
Long
rightsSettingId
,
Long
wechatUserId
,
Integer
type
,
Long
adviserId
,
Long
bookId
,
Long
channelId
);
RightsSetting
getRightsSettingRightsNowItemsByType
(
Long
rightsSettingId
,
Long
wechatUserId
,
Integer
type
,
Long
adviserId
,
Long
bookId
,
Long
channelId
,
Integer
readType
);
RightsSetting
getRightsSettingGiftCoupons
(
Long
rightsSettingId
,
Long
wechatUserId
);
RightsSetting
getRightsSettingGiftCoupons
(
Long
rightsSettingId
,
Long
wechatUserId
,
Integer
readType
);
FillRightsSettingAppletsDTO
getFillRightsSettingApplets
(
Long
rightsSettingId
,
Long
wechatUserId
,
Long
rightsClassifyId
,
FillRightsSettingAppletsDTO
getFillRightsSettingApplets
(
Long
rightsSettingId
,
Long
wechatUserId
,
Long
rightsClassifyId
,
Integer
top
);
Integer
top
);
List
<
RightsItemGroup
>
getRightsItemGroups
(
Long
rightsSettingId
,
Long
adviserId
,
Long
bookId
,
Long
channelId
,
Boolean
removeCanNotBuy
);
List
<
RightsItemGroup
>
getRightsItemGroups
(
Long
rightsSettingId
,
Long
adviserId
,
Long
bookId
,
Long
channelId
,
Boolean
removeCanNotBuy
,
Integer
readType
);
RightsSettingDto
getRightSettingByBookId
(
Long
bookId
,
Long
adviserId
,
Long
channelId
);
RightsSettingDto
getRightSettingByBookId
(
Long
bookId
,
Long
adviserId
,
Long
channelId
);
List
<
RightsNowPic
>
getAllDefaultRightsNowPics
();
List
<
RightsNowPic
>
getAllDefaultRightsNowPics
(
Integer
type
);
void
addRightsNowPic
(
RightsNowPic
rightsNowPic
);
void
addRightsNowPic
(
RightsNowPic
rightsNowPic
);
PageBeanNew
<
RightsNowPic
>
getRightsNowPics
(
Integer
currentPage
,
Integer
numPerPage
);
PageBeanNew
<
RightsNowPic
>
getRightsNowPics
(
Integer
currentPage
,
Integer
numPerPage
,
Integer
type
);
void
deleteRightsNowPic
(
Long
rightsNowPicId
);
void
deleteRightsNowPic
(
Long
rightsNowPicId
);
RightsSettingDto
getReadType4Book
(
Long
wechatUserId
,
Long
bookId
,
Long
channelId
,
Long
adviserId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/biz/impl/RightsSettingBizImpl.java
View file @
b83553a9
...
@@ -3,17 +3,21 @@ package com.pcloud.book.rightsSetting.biz.impl;
...
@@ -3,17 +3,21 @@ package com.pcloud.book.rightsSetting.biz.impl;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.appcenter.assist.dto.AssistTempletDTO
;
import
com.pcloud.appcenter.assist.dto.AssistTempletDTO
;
import
com.pcloud.book.applet.biz.AppletGroupSearchRecordBiz
;
import
com.pcloud.book.applet.biz.AppletGroupSearchRecordBiz
;
import
com.pcloud.book.applet.biz.AppletNewsBiz
;
import
com.pcloud.book.applet.biz.AppletNewsBiz
;
import
com.pcloud.book.applet.biz.AppletUserBookcaseBiz
;
import
com.pcloud.book.applet.dao.AppletNewsDao
;
import
com.pcloud.book.applet.dao.AppletNewsDao
;
import
com.pcloud.book.applet.dto.AppletGroupStatementDTO
;
import
com.pcloud.book.applet.dto.AppletGroupStatementDTO
;
import
com.pcloud.book.applet.dto.AppletNewsDTO
;
import
com.pcloud.book.applet.dto.AppletNewsDTO
;
import
com.pcloud.book.applet.entity.AppletNews
;
import
com.pcloud.book.applet.entity.AppletNews
;
import
com.pcloud.book.applet.entity.AppletUserBookcase
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.biz.BookAdviserBiz
;
import
com.pcloud.book.book.biz.BookAdviserBiz
;
import
com.pcloud.book.book.biz.BookBiz
;
import
com.pcloud.book.book.biz.BookBiz
;
import
com.pcloud.book.book.constant.BookConstant
;
import
com.pcloud.book.book.dao.BookLabelDao
;
import
com.pcloud.book.book.dao.BookLabelDao
;
import
com.pcloud.book.book.dto.BookAdviserDto
;
import
com.pcloud.book.book.dto.BookAdviserDto
;
import
com.pcloud.book.book.dto.BookDto
;
import
com.pcloud.book.book.dto.BookDto
;
...
@@ -23,6 +27,7 @@ import com.pcloud.book.consumer.app.AssistTempletConsr;
...
@@ -23,6 +27,7 @@ import com.pcloud.book.consumer.app.AssistTempletConsr;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.consumer.reader.ReaderConsr
;
import
com.pcloud.book.consumer.reader.ReaderConsr
;
import
com.pcloud.book.consumer.resource.ProductConsr
;
import
com.pcloud.book.consumer.resource.ProductConsr
;
import
com.pcloud.book.cultivate.enums.ReadTypeEnum
;
import
com.pcloud.book.custom.biz.CustomPlanBiz
;
import
com.pcloud.book.custom.biz.CustomPlanBiz
;
import
com.pcloud.book.custom.entity.CustomPlan
;
import
com.pcloud.book.custom.entity.CustomPlan
;
import
com.pcloud.book.custom.mapper.CustomPlanMapper
;
import
com.pcloud.book.custom.mapper.CustomPlanMapper
;
...
@@ -42,6 +47,7 @@ import com.pcloud.book.rightsSetting.dao.RightsReadPlanDao;
...
@@ -42,6 +47,7 @@ import com.pcloud.book.rightsSetting.dao.RightsReadPlanDao;
import
com.pcloud.book.rightsSetting.dao.RightsSettingDAO
;
import
com.pcloud.book.rightsSetting.dao.RightsSettingDAO
;
import
com.pcloud.book.rightsSetting.dao.RightsSettingItemDao
;
import
com.pcloud.book.rightsSetting.dao.RightsSettingItemDao
;
import
com.pcloud.book.rightsSetting.dto.FillRightsSettingAppletsDTO
;
import
com.pcloud.book.rightsSetting.dto.FillRightsSettingAppletsDTO
;
import
com.pcloud.book.rightsSetting.dto.ReadTypeCountDTO
;
import
com.pcloud.book.rightsSetting.dto.RightsSettingDto
;
import
com.pcloud.book.rightsSetting.dto.RightsSettingDto
;
import
com.pcloud.book.rightsSetting.entity.BaseTempletClassify
;
import
com.pcloud.book.rightsSetting.entity.BaseTempletClassify
;
import
com.pcloud.book.rightsSetting.entity.RightsCustomRelation
;
import
com.pcloud.book.rightsSetting.entity.RightsCustomRelation
;
...
@@ -49,6 +55,7 @@ import com.pcloud.book.rightsSetting.entity.RightsItemGroup;
...
@@ -49,6 +55,7 @@ import com.pcloud.book.rightsSetting.entity.RightsItemGroup;
import
com.pcloud.book.rightsSetting.entity.RightsNowItem
;
import
com.pcloud.book.rightsSetting.entity.RightsNowItem
;
import
com.pcloud.book.rightsSetting.entity.RightsNowPic
;
import
com.pcloud.book.rightsSetting.entity.RightsNowPic
;
import
com.pcloud.book.rightsSetting.entity.RightsReadPlan
;
import
com.pcloud.book.rightsSetting.entity.RightsReadPlan
;
import
com.pcloud.book.rightsSetting.entity.RightsReadType
;
import
com.pcloud.book.rightsSetting.entity.RightsSetting
;
import
com.pcloud.book.rightsSetting.entity.RightsSetting
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingClassify
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingClassify
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingItem
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingItem
;
...
@@ -56,11 +63,11 @@ import com.pcloud.book.rightsSetting.entity.RightsSettingTitle;
...
@@ -56,11 +63,11 @@ import com.pcloud.book.rightsSetting.entity.RightsSettingTitle;
import
com.pcloud.book.rightsSetting.enums.RightsItemGroupType
;
import
com.pcloud.book.rightsSetting.enums.RightsItemGroupType
;
import
com.pcloud.book.rightsSetting.enums.RightsNowItemType
;
import
com.pcloud.book.rightsSetting.enums.RightsNowItemType
;
import
com.pcloud.book.rightsSetting.enums.RightsTypeEnum
;
import
com.pcloud.book.rightsSetting.enums.RightsTypeEnum
;
import
com.pcloud.book.rightsSetting.mapper.RightsReadTypeMapper
;
import
com.pcloud.book.rightsSetting.mapper.RightsSettingTitleMapper
;
import
com.pcloud.book.rightsSetting.mapper.RightsSettingTitleMapper
;
import
com.pcloud.book.skill.biz.PcloudGroupActivityBiz
;
import
com.pcloud.book.skill.biz.PcloudGroupActivityBiz
;
import
com.pcloud.book.skill.dao.PcloudGroupActivityDao
;
import
com.pcloud.book.skill.dao.PcloudGroupActivityDao
;
import
com.pcloud.book.skill.dto.GroupActivity4AppletDTO
;
import
com.pcloud.book.skill.dto.GroupActivity4AppletDTO
;
import
com.pcloud.book.util.common.CommonUtils
;
import
com.pcloud.book.util.common.YesOrNoEnums
;
import
com.pcloud.book.util.common.YesOrNoEnums
;
import
com.pcloud.channelcenter.wechat.dto.AccountSettingDto
;
import
com.pcloud.channelcenter.wechat.dto.AccountSettingDto
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.aspect.ParamLog
;
...
@@ -72,7 +79,7 @@ import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
...
@@ -72,7 +79,7 @@ import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtilParent
;
import
com.pcloud.common.utils.string.StringUtilParent
;
import
com.pcloud.resourcecenter.product.dto.ProductDto
;
import
com.pcloud.resourcecenter.product.dto.ProductDto
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.apache.commons.lang3.ArrayUtils
;
...
@@ -93,6 +100,8 @@ import java.util.Random;
...
@@ -93,6 +100,8 @@ import java.util.Random;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
lombok.extern.slf4j.Slf4j
;
@Service
@Service
@Slf4j
@Slf4j
public
class
RightsSettingBizImpl
implements
RightsSettingBiz
{
public
class
RightsSettingBizImpl
implements
RightsSettingBiz
{
...
@@ -152,9 +161,14 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -152,9 +161,14 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
@Autowired
@Autowired
private
AppletGroupSearchRecordBiz
appletGroupSearchRecordBiz
;
private
AppletGroupSearchRecordBiz
appletGroupSearchRecordBiz
;
@Autowired
private
RightsReadTypeMapper
rightsReadTypeMapper
;
@Autowired
private
AppletUserBookcaseBiz
appletUserBookcaseBiz
;
@Override
@Override
@ParamLog
(
"新增权益设置"
)
@ParamLog
(
"新增权益设置"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Long
addRightsSetting
(
RightsSetting
rightsSetting
)
{
public
Long
addRightsSetting
(
RightsSetting
rightsSetting
)
{
rightsSettingCheck
.
rightsSettingCheck
(
rightsSetting
);
rightsSettingCheck
.
rightsSettingCheck
(
rightsSetting
);
setClassifyAndLabel
(
rightsSetting
);
setClassifyAndLabel
(
rightsSetting
);
...
@@ -162,6 +176,15 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -162,6 +176,15 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"已存在相同的权益设置"
);
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"已存在相同的权益设置"
);
}
}
rightsSettingDAO
.
insert
(
rightsSetting
);
rightsSettingDAO
.
insert
(
rightsSetting
);
Long
rightsSettingId
=
rightsSetting
.
getId
();
if
(
null
==
rightsSettingId
){
throw
new
BookBizException
(
BookBizException
.
DB_DML_FAIL
,
"新增权益设置失败"
);
}
List
<
RightsReadType
>
rightsReadTypes
=
rightsSetting
.
getRightsReadTypes
();
if
(!
ListUtils
.
isEmpty
(
rightsReadTypes
)){
rightsReadTypes
.
forEach
(
e
->
e
.
setRightsSettingId
(
rightsSettingId
));
rightsReadTypeMapper
.
batchInsert
(
rightsReadTypes
);
}
return
rightsSetting
.
getId
();
return
rightsSetting
.
getId
();
}
}
...
@@ -209,8 +232,10 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -209,8 +232,10 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
@Override
@Override
@ParamLog
(
"删除权益设置"
)
@ParamLog
(
"删除权益设置"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
deleteRightsSetting
(
Long
id
)
{
public
void
deleteRightsSetting
(
Long
id
)
{
rightsSettingDAO
.
deleteByPrimaryKey
(
id
);
rightsSettingDAO
.
deleteByPrimaryKey
(
id
);
rightsReadTypeMapper
.
deleteByRightsSettingId
(
id
);
//删除即享权益项
//删除即享权益项
rightsNowItemDao
.
deleteByRightsSettingId
(
id
);
rightsNowItemDao
.
deleteByRightsSettingId
(
id
);
rightsSettingItemDao
.
deleteByRightsSettingId
(
id
,
null
);
rightsSettingItemDao
.
deleteByRightsSettingId
(
id
,
null
);
...
@@ -231,10 +256,17 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -231,10 +256,17 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
setClassifyAndLabel
(
rightsSetting
);
setClassifyAndLabel
(
rightsSetting
);
rightsSetting
.
setUpdateTime
(
new
Date
());
rightsSetting
.
setUpdateTime
(
new
Date
());
rightsSettingDAO
.
updateByPrimaryKey
(
rightsSetting
);
rightsSettingDAO
.
updateByPrimaryKey
(
rightsSetting
);
Long
rightsSettingId
=
rightsSetting
.
getId
();
//更新阅读方式
rightsReadTypeMapper
.
deleteByRightsSettingId
(
rightsSettingId
);
List
<
RightsReadType
>
rightsReadTypes
=
rightsSetting
.
getRightsReadTypes
();
if
(!
ListUtils
.
isEmpty
(
rightsReadTypes
)){
rightsReadTypes
.
forEach
(
e
->
e
.
setRightsSettingId
(
rightsSettingId
));
rightsReadTypeMapper
.
batchInsert
(
rightsReadTypes
);
}
//更新即享权益
//更新即享权益
updateRightNowItemByRightId
(
rightsSetting
);
updateRightNowItemByRightId
(
rightsSetting
);
//新增/修改每周或长期权益
//新增/修改每周或长期权益
this
.
batchInsertRightsSettingItem
(
rightsSetting
.
getRightsSettingWeekItems
(),
rightsSetting
.
getId
(),
RightsTypeEnum
.
WEEK
.
value
);
if
(!
ListUtils
.
isEmpty
(
rightsSetting
.
getRightsSettingWeekItems
())){
if
(!
ListUtils
.
isEmpty
(
rightsSetting
.
getRightsSettingWeekItems
())){
for
(
RightsSettingItem
rightsSettingItem
:
rightsSetting
.
getRightsSettingWeekItems
())
{
for
(
RightsSettingItem
rightsSettingItem
:
rightsSetting
.
getRightsSettingWeekItems
())
{
rightsSettingItem
.
setUuid
(
StringUtil
.
getUUID
());
rightsSettingItem
.
setUuid
(
StringUtil
.
getUUID
());
...
@@ -246,6 +278,12 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -246,6 +278,12 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
rightsSettingItem
.
setRightsSettingId
(
rightsSetting
.
getId
());
rightsSettingItem
.
setRightsSettingId
(
rightsSetting
.
getId
());
rightsSettingItem
.
setRightsType
(
RightsTypeEnum
.
WEEK
.
value
);
rightsSettingItem
.
setRightsType
(
RightsTypeEnum
.
WEEK
.
value
);
List
<
RightsSettingItem
>
list
=
rightsSettingItemDao
.
queryAll
(
rightsSettingItem
);
List
<
RightsSettingItem
>
list
=
rightsSettingItemDao
.
queryAll
(
rightsSettingItem
);
//更新阅读计划
updateReadPlan
(
rightsSetting
,
list
);
this
.
batchInsertRightsSettingItem
(
rightsSetting
.
getRightsSettingLongTermItems
(),
rightsSetting
.
getId
(),
RightsTypeEnum
.
LONG_TERM
.
value
);
}
private
void
updateReadPlan
(
RightsSetting
rightsSetting
,
List
<
RightsSettingItem
>
list
)
{
List
<
RightsReadPlan
>
rightsReadPlans
=
new
ArrayList
<>();
List
<
RightsReadPlan
>
rightsReadPlans
=
new
ArrayList
<>();
List
<
RightsCustomRelation
>
rightsCustomRelations
=
new
ArrayList
<>();
List
<
RightsCustomRelation
>
rightsCustomRelations
=
new
ArrayList
<>();
if
(!
ListUtils
.
isEmpty
(
list
))
{
if
(!
ListUtils
.
isEmpty
(
list
))
{
...
@@ -277,7 +315,6 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -277,7 +315,6 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
//批量插入rightsReadPlans和rightsCustomRelations
//批量插入rightsReadPlans和rightsCustomRelations
rightsReadPlanDao
.
insert
(
rightsReadPlans
);
rightsReadPlanDao
.
insert
(
rightsReadPlans
);
rightsCustomRelationDao
.
insert
(
rightsCustomRelations
);
rightsCustomRelationDao
.
insert
(
rightsCustomRelations
);
this
.
batchInsertRightsSettingItem
(
rightsSetting
.
getRightsSettingLongTermItems
(),
rightsSetting
.
getId
(),
RightsTypeEnum
.
LONG_TERM
.
value
);
}
}
@ParamLog
(
"更新权益的即享权益项集合"
)
@ParamLog
(
"更新权益的即享权益项集合"
)
...
@@ -442,8 +479,24 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -442,8 +479,24 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
rightsSetting
.
setBookName
(
bookDto
==
null
?
""
:
bookDto
.
getBookName
());
rightsSetting
.
setBookName
(
bookDto
==
null
?
""
:
bookDto
.
getBookName
());
}
}
fillRightsNowItems
(
rightsSetting
);
fillRightsNowItems
(
rightsSetting
);
rightsSetting
.
setRightsItemGroups
(
getRightsItemGroups
(
rightsSetting
.
getId
(),
null
,
null
,
null
,
false
));
rightsSetting
.
setRightsItemGroups
(
getRightsItemGroups
(
rightsSetting
.
getId
(),
null
,
null
,
null
,
false
,
null
));
fillGiftCouponPack
(
rightsSetting
);
fillGiftCouponPack
(
rightsSetting
,
null
);
//设置每周权益
setWeekRights
(
rightsSetting
);
//设置长期权益
rightsSetting
.
setRightsSettingLongTermItems
(
getItemsByRightsSettingId
(
id
,
RightsTypeEnum
.
LONG_TERM
.
value
,
null
));
//设置阅读方式
setReadType
(
rightsSetting
);
return
rightsSetting
;
}
private
void
setReadType
(
RightsSetting
rightsSetting
)
{
List
<
RightsReadType
>
rightsReadTypes
=
rightsReadTypeMapper
.
getByRightsSettingId
(
rightsSetting
.
getId
());
rightsSetting
.
setRightsReadTypes
(
ListUtils
.
isEmpty
(
rightsReadTypes
)
?
new
ArrayList
<>()
:
rightsReadTypes
);
}
private
void
setWeekRights
(
RightsSetting
rightsSetting
)
{
Long
id
=
rightsSetting
.
getId
();
List
<
RightsSettingItem
>
rightsItems
=
rightsSettingItemDao
.
getItemsByRightsSettingId4Read
(
id
,
RightsTypeEnum
.
WEEK
.
value
);
List
<
RightsSettingItem
>
rightsItems
=
rightsSettingItemDao
.
getItemsByRightsSettingId4Read
(
id
,
RightsTypeEnum
.
WEEK
.
value
);
List
<
Long
>
itemIdList
=
new
ArrayList
<>();
List
<
Long
>
itemIdList
=
new
ArrayList
<>();
for
(
RightsSettingItem
item
:
rightsItems
)
{
for
(
RightsSettingItem
item
:
rightsItems
)
{
...
@@ -486,8 +539,6 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -486,8 +539,6 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
}
}
rightsSetting
.
setRightsSettingWeekItems
(
rightsItems
);
rightsSetting
.
setRightsSettingWeekItems
(
rightsItems
);
rightsSetting
.
setRightsSettingLongTermItems
(
getItemsByRightsSettingId
(
id
,
RightsTypeEnum
.
LONG_TERM
.
value
));
return
rightsSetting
;
}
}
/**
/**
...
@@ -498,8 +549,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -498,8 +549,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
* @Param [rightsSetting, wechatUserId]
* @Param [rightsSetting, wechatUserId]
**/
**/
@ParamLog
(
value
=
"填充线上网课"
,
isAfterReturn
=
false
)
@ParamLog
(
value
=
"填充线上网课"
,
isAfterReturn
=
false
)
private
RightsSetting
setOnlineCourse
(
RightsSetting
rightsSetting
,
Long
wechatUserId
)
{
private
RightsSetting
setOnlineCourse
(
RightsSetting
rightsSetting
,
Long
wechatUserId
,
Integer
readType
)
{
RightsSettingTitle
rightsSettingTitle
=
getRightsSettingTitle
(
rightsSetting
,
RightsNowItemType
.
ONLINE_COURSE
);
RightsSettingTitle
rightsSettingTitle
=
getRightsSettingTitle
(
rightsSetting
,
RightsNowItemType
.
ONLINE_COURSE
,
readType
);
List
<
RightsNowItem
>
nowItems
=
rightsNowItemDao
.
getListByRightsSettingId
(
rightsSetting
.
getId
(),
Collections
.
singletonList
(
RightsNowItemType
.
ONLINE_COURSE
.
value
));
List
<
RightsNowItem
>
nowItems
=
rightsNowItemDao
.
getListByRightsSettingId
(
rightsSetting
.
getId
(),
Collections
.
singletonList
(
RightsNowItemType
.
ONLINE_COURSE
.
value
));
processNowItems
(
rightsSettingTitle
,
nowItems
,
RightsNowItemType
.
ONLINE_COURSE
,
rightsSetting
.
getId
(),
wechatUserId
,
2L
,
3
);
processNowItems
(
rightsSettingTitle
,
nowItems
,
RightsNowItemType
.
ONLINE_COURSE
,
rightsSetting
.
getId
(),
wechatUserId
,
2L
,
3
);
rightsSetting
.
setOnlineRightsSettingTitle
(
rightsSettingTitle
);
rightsSetting
.
setOnlineRightsSettingTitle
(
rightsSettingTitle
);
...
@@ -514,8 +565,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -514,8 +565,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
* @return void
* @return void
**/
**/
@ParamLog
(
value
=
"填充学习工具"
,
isAfterReturn
=
false
)
@ParamLog
(
value
=
"填充学习工具"
,
isAfterReturn
=
false
)
private
RightsSetting
setLearningTool
(
RightsSetting
rightsSetting
,
Long
wechatUserId
)
{
private
RightsSetting
setLearningTool
(
RightsSetting
rightsSetting
,
Long
wechatUserId
,
Integer
readType
)
{
RightsSettingTitle
rightsSettingTitle
=
getRightsSettingTitle
(
rightsSetting
,
RightsNowItemType
.
LEARNING_TOOL
);
RightsSettingTitle
rightsSettingTitle
=
getRightsSettingTitle
(
rightsSetting
,
RightsNowItemType
.
LEARNING_TOOL
,
readType
);
List
<
RightsNowItem
>
nowItems
=
rightsNowItemDao
.
getListByRightsSettingId
(
rightsSetting
.
getId
(),
Collections
.
singletonList
(
RightsNowItemType
.
LEARNING_TOOL
.
value
));
List
<
RightsNowItem
>
nowItems
=
rightsNowItemDao
.
getListByRightsSettingId
(
rightsSetting
.
getId
(),
Collections
.
singletonList
(
RightsNowItemType
.
LEARNING_TOOL
.
value
));
processNowItems
(
rightsSettingTitle
,
nowItems
,
RightsNowItemType
.
LEARNING_TOOL
,
rightsSetting
.
getId
(),
wechatUserId
,
3L
,
1
);
processNowItems
(
rightsSettingTitle
,
nowItems
,
RightsNowItemType
.
LEARNING_TOOL
,
rightsSetting
.
getId
(),
wechatUserId
,
3L
,
1
);
rightsSetting
.
setLearningToolTitle
(
rightsSettingTitle
);
rightsSetting
.
setLearningToolTitle
(
rightsSettingTitle
);
...
@@ -530,8 +581,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -530,8 +581,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
* @return void
* @return void
**/
**/
@ParamLog
(
value
=
"填充抽奖"
,
isAfterReturn
=
false
)
@ParamLog
(
value
=
"填充抽奖"
,
isAfterReturn
=
false
)
private
RightsSetting
setDraw
(
RightsSetting
rightsSetting
,
Long
wechatUserId
)
{
private
RightsSetting
setDraw
(
RightsSetting
rightsSetting
,
Long
wechatUserId
,
Integer
readType
)
{
RightsSettingTitle
rightsSettingTitle
=
getRightsSettingTitle
(
rightsSetting
,
RightsNowItemType
.
DRAW
);
RightsSettingTitle
rightsSettingTitle
=
getRightsSettingTitle
(
rightsSetting
,
RightsNowItemType
.
DRAW
,
readType
);
List
<
RightsNowItem
>
nowItems
=
rightsNowItemDao
.
getListByRightsSettingId
(
rightsSetting
.
getId
(),
Collections
.
singletonList
(
RightsNowItemType
.
DRAW
.
value
));
List
<
RightsNowItem
>
nowItems
=
rightsNowItemDao
.
getListByRightsSettingId
(
rightsSetting
.
getId
(),
Collections
.
singletonList
(
RightsNowItemType
.
DRAW
.
value
));
processNowItems
(
rightsSettingTitle
,
nowItems
,
RightsNowItemType
.
DRAW
,
rightsSetting
.
getId
(),
wechatUserId
,
4L
,
1
);
processNowItems
(
rightsSettingTitle
,
nowItems
,
RightsNowItemType
.
DRAW
,
rightsSetting
.
getId
(),
wechatUserId
,
4L
,
1
);
rightsSetting
.
setDrawSettingTitle
(
rightsSettingTitle
);
rightsSetting
.
setDrawSettingTitle
(
rightsSettingTitle
);
...
@@ -539,8 +590,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -539,8 +590,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
}
}
@ParamLog
(
value
=
"填充礼券包"
,
isAfterReturn
=
false
)
@ParamLog
(
value
=
"填充礼券包"
,
isAfterReturn
=
false
)
private
RightsSetting
setGiftCouponPackage
(
RightsSetting
rightsSetting
,
Long
wechatUserId
)
{
private
RightsSetting
setGiftCouponPackage
(
RightsSetting
rightsSetting
,
Long
wechatUserId
,
Integer
readType
)
{
fillGiftCouponPack
(
rightsSetting
);
fillGiftCouponPack
(
rightsSetting
,
readType
);
fillUserGiftReceiveStatus
(
rightsSetting
,
wechatUserId
);
fillUserGiftReceiveStatus
(
rightsSetting
,
wechatUserId
);
return
rightsSetting
;
return
rightsSetting
;
}
}
...
@@ -552,8 +603,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -552,8 +603,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
* @Param [rightsSetting, learningTool]
* @Param [rightsSetting, learningTool]
* @return com.pcloud.book.rightsSetting.entity.RightsSettingTitle
* @return com.pcloud.book.rightsSetting.entity.RightsSettingTitle
**/
**/
private
RightsSettingTitle
getRightsSettingTitle
(
RightsSetting
rightsSetting
,
RightsNowItemType
learningTool
)
{
private
RightsSettingTitle
getRightsSettingTitle
(
RightsSetting
rightsSetting
,
RightsNowItemType
learningTool
,
Integer
readType
)
{
List
<
RightsSettingTitle
>
rightsSettingTitles
=
rightsSettingTitleMapper
.
getByRightSettingId
(
rightsSetting
.
getId
());
List
<
RightsSettingTitle
>
rightsSettingTitles
=
rightsSettingTitleMapper
.
getByRightSettingId
(
rightsSetting
.
getId
()
,
readType
);
Map
<
Integer
,
RightsSettingTitle
>
rightsSettingTitleMap
=
new
HashMap
<>();
Map
<
Integer
,
RightsSettingTitle
>
rightsSettingTitleMap
=
new
HashMap
<>();
if
(!
ListUtils
.
isEmpty
(
rightsSettingTitles
))
{
if
(!
ListUtils
.
isEmpty
(
rightsSettingTitles
))
{
rightsSettingTitleMap
=
rightsSettingTitles
.
stream
().
collect
(
Collectors
.
toMap
(
RightsSettingTitle:
:
getRightsSettingNowType
,
Function
.
identity
()));
rightsSettingTitleMap
=
rightsSettingTitles
.
stream
().
collect
(
Collectors
.
toMap
(
RightsSettingTitle:
:
getRightsSettingNowType
,
Function
.
identity
()));
...
@@ -575,6 +626,9 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -575,6 +626,9 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
private
void
processNowItems
(
RightsSettingTitle
rightsSettingTitle
,
List
<
RightsNowItem
>
nowItems
,
RightsNowItemType
itemType
,
private
void
processNowItems
(
RightsSettingTitle
rightsSettingTitle
,
List
<
RightsNowItem
>
nowItems
,
RightsNowItemType
itemType
,
Long
rightsSettingId
,
Long
wechatUserId
,
Long
rightsClassifyId
,
Long
rightsSettingId
,
Long
wechatUserId
,
Long
rightsClassifyId
,
Integer
top
)
{
Integer
top
)
{
if
(
null
==
rightsSettingTitle
||
null
==
rightsSettingTitle
.
getRightsSettingId
()){
return
;
}
List
<
RightsNowItem
>
items
=
Lists
.
newArrayList
();
List
<
RightsNowItem
>
items
=
Lists
.
newArrayList
();
if
(
CollectionUtils
.
isEmpty
(
nowItems
))
{
if
(
CollectionUtils
.
isEmpty
(
nowItems
))
{
// 填充咨询
// 填充咨询
...
@@ -622,7 +676,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -622,7 +676,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
types
.
add
(
RightsNowItemType
.
ONLINE_COURSE
.
value
);
types
.
add
(
RightsNowItemType
.
ONLINE_COURSE
.
value
);
types
.
add
(
RightsNowItemType
.
LEARNING_TOOL
.
value
);
types
.
add
(
RightsNowItemType
.
LEARNING_TOOL
.
value
);
types
.
add
(
RightsNowItemType
.
DRAW
.
value
);
types
.
add
(
RightsNowItemType
.
DRAW
.
value
);
List
<
RightsSettingTitle
>
rightsSettingTitles
=
rightsSettingTitleMapper
.
getByRightSettingId
(
rightsSetting
.
getId
());
List
<
RightsSettingTitle
>
rightsSettingTitles
=
rightsSettingTitleMapper
.
getByRightSettingId
(
rightsSetting
.
getId
()
,
null
);
RightsSettingTitle
rightsSettingTitler4Online
=
new
RightsSettingTitle
();
RightsSettingTitle
rightsSettingTitler4Online
=
new
RightsSettingTitle
();
RightsSettingTitle
rightsSettingTitler4Learningtool
=
new
RightsSettingTitle
();
RightsSettingTitle
rightsSettingTitler4Learningtool
=
new
RightsSettingTitle
();
RightsSettingTitle
rightsSettingTitler4Draw
=
new
RightsSettingTitle
();
RightsSettingTitle
rightsSettingTitler4Draw
=
new
RightsSettingTitle
();
...
@@ -742,9 +796,12 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -742,9 +796,12 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
}
}
}
}
private
void
fillGiftCouponPack
(
RightsSetting
rightsSetting
)
{
private
void
fillGiftCouponPack
(
RightsSetting
rightsSetting
,
Integer
readType
)
{
List
<
RightsNowItem
>
giftCouponPackItems
=
rightsNowItemDao
.
getGiftCouponListByRightsSettingId
(
rightsSetting
.
getId
());
List
<
RightsNowItem
>
giftCouponPackItems
=
rightsNowItemDao
.
getGiftCouponListByRightsSettingId
(
rightsSetting
.
getId
());
RightsSettingTitle
rightsSettingTitle
=
getRightsSettingTitle
(
rightsSetting
,
RightsNowItemType
.
GIFT_COUPON_PACKAGE
);
RightsSettingTitle
rightsSettingTitle
=
getRightsSettingTitle
(
rightsSetting
,
RightsNowItemType
.
GIFT_COUPON_PACKAGE
,
readType
);
if
(
null
==
rightsSettingTitle
||
null
==
rightsSettingTitle
.
getRightsSettingId
()){
return
;
}
if
(
null
!=
rightsSetting
.
getGiftCouponPackageTitle
())
{
if
(
null
!=
rightsSetting
.
getGiftCouponPackageTitle
())
{
// 礼券包默认开启
// 礼券包默认开启
rightsSettingTitle
.
setOpenState
(
true
);
rightsSettingTitle
.
setOpenState
(
true
);
...
@@ -885,10 +942,11 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -885,10 +942,11 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
}
}
@Override
@Override
public
List
<
RightsSettingItem
>
getItemsByRightsSettingId
(
Long
rightsSettingId
,
String
rightsType
)
{
public
List
<
RightsSettingItem
>
getItemsByRightsSettingId
(
Long
rightsSettingId
,
String
rightsType
,
Integer
readType
)
{
RightsSettingItem
item
=
new
RightsSettingItem
();
RightsSettingItem
item
=
new
RightsSettingItem
();
item
.
setRightsSettingId
(
rightsSettingId
);
item
.
setRightsSettingId
(
rightsSettingId
);
item
.
setRightsType
(
rightsType
);
item
.
setRightsType
(
rightsType
);
item
.
setReadType
(
readType
);
return
rightsSettingItemDao
.
queryAll
(
item
);
return
rightsSettingItemDao
.
queryAll
(
item
);
}
}
...
@@ -913,21 +971,21 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -913,21 +971,21 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
@Override
@Override
@ParamLog
(
value
=
"小程序首页本周/长期权益查询"
,
isAfterReturn
=
false
)
@ParamLog
(
value
=
"小程序首页本周/长期权益查询"
,
isAfterReturn
=
false
)
public
RightsSettingDto
getItemByRightsSettingId4AppletHome
(
Long
rightsSettingId
,
Long
wechatUserId
,
String
rightsType
)
{
public
RightsSettingDto
getItemByRightsSettingId4AppletHome
(
Long
rightsSettingId
,
Long
wechatUserId
,
String
rightsType
,
Integer
readType
)
{
RightsSettingDto
rightsSettingDto
=
new
RightsSettingDto
();
RightsSettingDto
rightsSettingDto
=
new
RightsSettingDto
();
//每周/长期权益
//每周/长期权益
if
(
RightsTypeEnum
.
WEEK
.
value
.
equals
(
rightsType
))
{
if
(
RightsTypeEnum
.
WEEK
.
value
.
equals
(
rightsType
))
{
rightsSettingDto
.
setRightsSettingWeekItems
(
getItemsByRightsSettingId4Applet
(
rightsSettingId
,
RightsTypeEnum
.
WEEK
.
value
,
wechatUserId
));
rightsSettingDto
.
setRightsSettingWeekItems
(
getItemsByRightsSettingId4Applet
(
rightsSettingId
,
RightsTypeEnum
.
WEEK
.
value
,
wechatUserId
,
readType
));
}
else
if
(
RightsTypeEnum
.
LONG_TERM
.
value
.
equals
(
rightsType
))
{
}
else
if
(
RightsTypeEnum
.
LONG_TERM
.
value
.
equals
(
rightsType
))
{
rightsSettingDto
.
setRightsSettingLongTermItems
(
getItemsByRightsSettingId4Applet
(
rightsSettingId
,
RightsTypeEnum
.
LONG_TERM
.
value
,
wechatUserId
));
rightsSettingDto
.
setRightsSettingLongTermItems
(
getItemsByRightsSettingId4Applet
(
rightsSettingId
,
RightsTypeEnum
.
LONG_TERM
.
value
,
wechatUserId
,
readType
));
}
}
return
rightsSettingDto
;
return
rightsSettingDto
;
}
}
@Override
@Override
public
List
<
RightsSettingItem
>
getItemsByRightsSettingId4Applet
(
Long
rightsSettingId
,
String
rightsType
,
Long
wechatUserId
)
{
public
List
<
RightsSettingItem
>
getItemsByRightsSettingId4Applet
(
Long
rightsSettingId
,
String
rightsType
,
Long
wechatUserId
,
Integer
readType
)
{
List
<
RightsSettingItem
>
list
=
getItemsByRightsSettingId
(
rightsSettingId
,
rightsType
);
List
<
RightsSettingItem
>
list
=
getItemsByRightsSettingId
(
rightsSettingId
,
rightsType
,
readType
);
if
(
ListUtils
.
isEmpty
(
list
))
{
if
(
ListUtils
.
isEmpty
(
list
))
{
return
new
ArrayList
<>();
return
new
ArrayList
<>();
}
}
...
@@ -1096,52 +1154,53 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -1096,52 +1154,53 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
@ParamLog
(
"根据权益id和类型获取即享权益项"
)
@ParamLog
(
"根据权益id和类型获取即享权益项"
)
@Override
@Override
public
RightsSetting
getRightsSettingRightsNowItemsByType
(
Long
rightsSettingId
,
Long
wechatUserId
,
Integer
type
,
Long
adviserId
,
Long
bookId
,
Long
channelId
)
{
public
RightsSetting
getRightsSettingRightsNowItemsByType
(
Long
rightsSettingId
,
Long
wechatUserId
,
Integer
type
,
Long
adviserId
,
Long
bookId
,
Long
channelId
,
Integer
readType
)
{
RightsSetting
rightsSetting
=
rightsSettingDAO
.
selectByPrimaryKey
(
rightsSettingId
);
RightsSetting
rightsSetting
=
rightsSettingDAO
.
selectByPrimaryKey
(
rightsSettingId
);
if
(
rightsSetting
==
null
)
{
if
(
rightsSetting
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"未找到权益!"
);
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"未找到权益!"
);
}
}
// 获取配套资料
// 获取配套资料
if
(
RightsNowItemType
.
SERVES
.
value
.
equals
(
type
)){
if
(
RightsNowItemType
.
SERVES
.
value
.
equals
(
type
)){
return
setServe
(
rightsSetting
,
adviserId
,
bookId
,
channelId
);
return
setServe
(
rightsSetting
,
adviserId
,
bookId
,
channelId
,
readType
);
}
}
// 获取抽奖权益
// 获取抽奖权益
if
(
RightsNowItemType
.
DRAW
.
value
.
equals
(
type
))
{
if
(
RightsNowItemType
.
DRAW
.
value
.
equals
(
type
))
{
return
setDraw
(
rightsSetting
,
wechatUserId
);
return
setDraw
(
rightsSetting
,
wechatUserId
,
readType
);
}
}
// 获取学习工具权益
// 获取学习工具权益
if
(
RightsNowItemType
.
LEARNING_TOOL
.
value
.
equals
(
type
))
{
if
(
RightsNowItemType
.
LEARNING_TOOL
.
value
.
equals
(
type
))
{
return
setLearningTool
(
rightsSetting
,
wechatUserId
);
return
setLearningTool
(
rightsSetting
,
wechatUserId
,
readType
);
}
}
// 获取线上网课权益
// 获取线上网课权益
if
(
RightsNowItemType
.
ONLINE_COURSE
.
value
.
equals
(
type
))
{
if
(
RightsNowItemType
.
ONLINE_COURSE
.
value
.
equals
(
type
))
{
return
setOnlineCourse
(
rightsSetting
,
wechatUserId
);
return
setOnlineCourse
(
rightsSetting
,
wechatUserId
,
readType
);
}
}
// 获取专享礼券包权益
// 获取专享礼券包权益
if
(
RightsNowItemType
.
GIFT_COUPON_PACKAGE
.
value
.
equals
(
type
))
{
if
(
RightsNowItemType
.
GIFT_COUPON_PACKAGE
.
value
.
equals
(
type
))
{
return
setGiftCouponPackage
(
rightsSetting
,
wechatUserId
);
return
setGiftCouponPackage
(
rightsSetting
,
wechatUserId
,
readType
);
}
}
return
rightsSetting
;
return
rightsSetting
;
}
}
@ParamLog
(
value
=
"填充配套资料"
,
isAfterReturn
=
false
)
@ParamLog
(
value
=
"填充配套资料"
,
isAfterReturn
=
false
)
private
RightsSetting
setServe
(
RightsSetting
rightsSetting
,
Long
adviserId
,
Long
bookId
,
Long
channelId
)
{
private
RightsSetting
setServe
(
RightsSetting
rightsSetting
,
Long
adviserId
,
Long
bookId
,
Long
channelId
,
Integer
readType
)
{
RightsSettingTitle
rightsSettingTitle
=
rightsSettingTitleMapper
.
getByRightSettingIdAndType
(
rightsSetting
.
getId
(),
RightsNowItemType
.
SERVES
.
value
);
RightsSettingTitle
rightsSettingTitle
=
rightsSettingTitleMapper
.
getByRightSettingIdAndType
(
rightsSetting
.
getId
(),
RightsNowItemType
.
SERVES
.
value
,
null
);
rightsSetting
.
setServesTitle
(
rightsSettingTitle
!=
null
?
rightsSettingTitle
:
new
RightsSettingTitle
());
rightsSetting
.
setServesTitle
(
rightsSettingTitle
!=
null
?
rightsSettingTitle
:
new
RightsSettingTitle
());
rightsSetting
.
setRightsItemGroups
(
getRightsItemGroups
(
rightsSetting
.
getId
(),
adviserId
,
bookId
,
channelId
,
true
));
rightsSetting
.
setRightsItemGroups
(
getRightsItemGroups
(
rightsSetting
.
getId
(),
adviserId
,
bookId
,
channelId
,
true
,
readType
));
return
rightsSetting
;
return
rightsSetting
;
}
}
@ParamLog
(
"根据权益id获取即享权益项专享礼包"
)
@ParamLog
(
"根据权益id获取即享权益项专享礼包"
)
@Override
@Override
public
RightsSetting
getRightsSettingGiftCoupons
(
Long
rightsSettingId
,
Long
wechatUserId
)
{
public
RightsSetting
getRightsSettingGiftCoupons
(
Long
rightsSettingId
,
Long
wechatUserId
,
Integer
readType
)
{
RightsSetting
rightsSetting
=
new
RightsSetting
();
RightsSetting
rightsSetting
=
new
RightsSetting
();
rightsSetting
.
setId
(
rightsSettingId
);
rightsSetting
.
setId
(
rightsSettingId
);
RightsSettingTitle
rightsSettingTitle4Gift
=
rightsSettingTitleMapper
.
getByRightSettingIdAndType
(
rightsSettingId
,
RightsNowItemType
.
GIFT_COUPON_PACKAGE
.
value
);
RightsSettingTitle
rightsSettingTitle4Gift
=
rightsSettingTitleMapper
.
getByRightSettingIdAndType
(
rightsSettingId
,
RightsNowItemType
.
GIFT_COUPON_PACKAGE
.
value
,
readType
);
if
(
null
!=
rightsSettingTitle4Gift
)
{
if
(
null
==
rightsSettingTitle4Gift
||
null
==
rightsSettingTitle4Gift
.
getRightsSettingId
())
{
r
ightsSetting
.
setGiftCouponPackageTitle
(
rightsSettingTitle4Gift
)
;
r
eturn
rightsSetting
;
}
}
fillGiftCouponPack
(
rightsSetting
);
rightsSetting
.
setGiftCouponPackageTitle
(
rightsSettingTitle4Gift
);
fillGiftCouponPack
(
rightsSetting
,
readType
);
fillUserGiftReceiveStatus
(
rightsSetting
,
wechatUserId
);
fillUserGiftReceiveStatus
(
rightsSetting
,
wechatUserId
);
return
rightsSetting
;
return
rightsSetting
;
}
}
...
@@ -1197,11 +1256,11 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -1197,11 +1256,11 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
@ParamLog
(
"根据权益id获取即享权益配套资料分组集合"
)
@ParamLog
(
"根据权益id获取即享权益配套资料分组集合"
)
@Override
@Override
public
List
<
RightsItemGroup
>
getRightsItemGroups
(
Long
rightsSettingId
,
Long
adviserId
,
Long
bookId
,
Long
channelId
,
Boolean
removeCanNotBuy
)
{
public
List
<
RightsItemGroup
>
getRightsItemGroups
(
Long
rightsSettingId
,
Long
adviserId
,
Long
bookId
,
Long
channelId
,
Boolean
removeCanNotBuy
,
Integer
readType
)
{
if
(
rightsSettingId
==
null
)
{
if
(
rightsSettingId
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
}
List
<
RightsItemGroup
>
groups
=
rightsItemGroupDao
.
getListByRightSettingId
(
rightsSettingId
);
List
<
RightsItemGroup
>
groups
=
rightsItemGroupDao
.
getListByRightSettingId
(
rightsSettingId
,
readType
);
if
(
ListUtils
.
isEmpty
(
groups
))
{
if
(
ListUtils
.
isEmpty
(
groups
))
{
return
groups
;
return
groups
;
}
}
...
@@ -1254,15 +1313,15 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -1254,15 +1313,15 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
@ParamLog
(
"获取即享权益图片库"
)
@ParamLog
(
"获取即享权益图片库"
)
@Override
@Override
public
List
<
RightsNowPic
>
getAllDefaultRightsNowPics
()
{
public
List
<
RightsNowPic
>
getAllDefaultRightsNowPics
(
Integer
type
)
{
return
rightsNowPicDao
.
getAllDefaultRightsNowPics
();
return
rightsNowPicDao
.
getAllDefaultRightsNowPics
(
type
);
}
}
@ParamLog
(
"新增即享权益图片"
)
@ParamLog
(
"新增即享权益图片"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
@Override
public
void
addRightsNowPic
(
RightsNowPic
rightsNowPic
)
{
public
void
addRightsNowPic
(
RightsNowPic
rightsNowPic
)
{
if
(
rightsNowPic
==
null
||
StringUtil
.
isEmpty
(
rightsNowPic
.
getPicUrl
())){
if
(
rightsNowPic
==
null
||
StringUtil
.
isEmpty
(
rightsNowPic
.
getPicUrl
())
||
null
==
rightsNowPic
.
getType
()
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
}
rightsNowPic
.
setDefaultPic
(
false
);
rightsNowPic
.
setDefaultPic
(
false
);
...
@@ -1271,11 +1330,13 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -1271,11 +1330,13 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
@ParamLog
(
"获取即享权益图片列表"
)
@ParamLog
(
"获取即享权益图片列表"
)
@Override
@Override
public
PageBeanNew
<
RightsNowPic
>
getRightsNowPics
(
Integer
currentPage
,
Integer
numPerPage
)
{
public
PageBeanNew
<
RightsNowPic
>
getRightsNowPics
(
Integer
currentPage
,
Integer
numPerPage
,
Integer
type
)
{
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<=
0
){
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<=
0
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
}
PageBeanNew
<
RightsNowPic
>
pageNew
=
rightsNowPicDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
new
HashMap
<>(),
"getRightsNowPics"
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"type"
,
type
);
PageBeanNew
<
RightsNowPic
>
pageNew
=
rightsNowPicDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
map
,
"getRightsNowPics"
);
return
pageNew
;
return
pageNew
;
}
}
...
@@ -1289,6 +1350,58 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -1289,6 +1350,58 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
rightsNowPicDao
.
deleteById
(
rightsNowPicId
);
rightsNowPicDao
.
deleteById
(
rightsNowPicId
);
}
}
@Override
@ParamLog
(
"获取当前图书的阅读方式"
)
public
RightsSettingDto
getReadType4Book
(
Long
wechatUserId
,
Long
bookId
,
Long
channelId
,
Long
adviserId
)
{
RightsSettingDto
rightsSettingDto
=
rightsSettingDAO
.
getByBookId
(
bookId
);
AppletUserBookcase
appletUserBookcase
=
appletUserBookcaseBiz
.
getUserReadType
(
wechatUserId
,
bookId
,
adviserId
,
channelId
);
Integer
chooseReadType
=
null
==
appletUserBookcase
||
null
==
appletUserBookcase
.
getReadType
()
?
null
:
appletUserBookcase
.
getReadType
();
if
(
null
!=
rightsSettingDto
)
{
Long
rightsSettingId
=
rightsSettingDto
.
getId
();
ReadTypeCountDTO
readTypeCountDTO
=
rightsSettingTitleMapper
.
getCount4Title
(
rightsSettingId
);
List
<
RightsReadType
>
rightsReadTypes
=
rightsReadTypeMapper
.
getByRightsSettingId
(
rightsSettingId
);
setReadType
(
rightsSettingDto
,
readTypeCountDTO
,
rightsReadTypes
);
rightsSettingDto
.
setChooseReadType
(
chooseReadType
);
return
rightsSettingDto
;
}
//根据分类获取权益
BookAdviserDto
adviserDto
=
bookAdviserBiz
.
getBase
(
bookId
,
channelId
,
adviserId
);
if
(
null
!=
adviserDto
)
{
rightsSettingDto
=
getByLabel
(
adviserDto
.
getTempletId
(),
adviserDto
.
getSecondTempletId
(),
adviserDto
.
getGraLabelId
(),
adviserDto
.
getSubLabelId
());
if
(
null
==
rightsSettingDto
)
{
log
.
error
(
"该书没有匹配的分类权益,bookId="
+
bookId
);
return
new
RightsSettingDto
();
}
List
<
RightsReadType
>
rightsReadTypes
=
rightsReadTypeMapper
.
getByRightsSettingId
(
rightsSettingDto
.
getId
());
ReadTypeCountDTO
readTypeCountDTO
=
rightsSettingTitleMapper
.
getCount4Title
(
rightsSettingDto
.
getId
());
setReadType
(
rightsSettingDto
,
readTypeCountDTO
,
rightsReadTypes
);
rightsSettingDto
.
setChooseReadType
(
chooseReadType
);
}
return
rightsSettingDto
;
}
private
void
setReadType
(
RightsSettingDto
rightsSettingDto
,
ReadTypeCountDTO
readTypeCountDTO
,
List
<
RightsReadType
>
rightsReadTypes
)
{
if
(!
ListUtils
.
isEmpty
(
rightsReadTypes
)
&&
null
!=
readTypeCountDTO
&&
(
!
Objects
.
equals
(
BookConstant
.
zero
,
readTypeCountDTO
.
getEasyReadCount
())
||
!
Objects
.
equals
(
BookConstant
.
zero
,
readTypeCountDTO
.
getEfficientReadCount
())
||
!
Objects
.
equals
(
BookConstant
.
zero
,
readTypeCountDTO
.
getDeepReadCount
())
)){
rightsReadTypes
.
forEach
(
e
->
{
if
(
ReadTypeEnum
.
QS_READ
.
value
.
equals
(
e
.
getReadType
()))
{
e
.
setRightsCount
(
readTypeCountDTO
.
getEasyReadCount
());
}
else
if
(
ReadTypeEnum
.
GX_READ
.
value
.
equals
(
e
.
getReadType
()))
{
e
.
setRightsCount
(
readTypeCountDTO
.
getEfficientReadCount
());
}
else
if
(
ReadTypeEnum
.
SD_READ
.
value
.
equals
(
e
.
getReadType
()))
{
e
.
setRightsCount
(
readTypeCountDTO
.
getDeepReadCount
());
}
});
}
rightsSettingDto
.
setRightsReadTypes
(
ListUtils
.
isEmpty
(
rightsReadTypes
)
?
new
ArrayList
<>()
:
rightsReadTypes
);
}
@ParamLog
(
"移除不能购买的应用或作品"
)
@ParamLog
(
"移除不能购买的应用或作品"
)
private
void
removeCanNotBuy
(
List
<
RightsNowItem
>
nowItems
)
{
private
void
removeCanNotBuy
(
List
<
RightsNowItem
>
nowItems
)
{
if
(
ListUtils
.
isEmpty
(
nowItems
))
{
if
(
ListUtils
.
isEmpty
(
nowItems
))
{
...
@@ -1338,7 +1451,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -1338,7 +1451,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
@ParamLog
(
"用户是否领取专享礼包券"
)
@ParamLog
(
"用户是否领取专享礼包券"
)
private
void
fillUserGiftReceiveStatus
(
RightsSetting
rightsSetting
,
Long
wechatUserId
)
{
private
void
fillUserGiftReceiveStatus
(
RightsSetting
rightsSetting
,
Long
wechatUserId
)
{
if
(
rightsSetting
==
null
||
wechatUserId
==
null
||
ListUtils
.
isEmpty
(
rightsSetting
.
getGiftCouponPackageTitle
().
getRightsSettingItemList
()))
{
if
(
rightsSetting
==
null
||
wechatUserId
==
null
||
null
==
rightsSetting
.
getGiftCouponPackageTitle
()
||
ListUtils
.
isEmpty
(
rightsSetting
.
getGiftCouponPackageTitle
().
getRightsSettingItemList
()))
{
return
;
return
;
}
}
List
<
Long
>
list
=
giftReceiveDao
.
getUserReceiveGiftId
(
wechatUserId
,
rightsSetting
.
getId
());
List
<
Long
>
list
=
giftReceiveDao
.
getUserReceiveGiftId
(
wechatUserId
,
rightsSetting
.
getId
());
...
@@ -1358,6 +1471,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -1358,6 +1471,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
* 根据书刊获取权益
* 根据书刊获取权益
* @return
* @return
*/
*/
@Override
public
RightsSettingDto
getRightSettingByBookId
(
Long
bookId
,
Long
adviserId
,
Long
channelId
){
public
RightsSettingDto
getRightSettingByBookId
(
Long
bookId
,
Long
adviserId
,
Long
channelId
){
//根据分类获取权益
//根据分类获取权益
BookAdviserDto
adviserDto
=
bookAdviserBiz
.
getBase
(
bookId
,
channelId
,
adviserId
);
BookAdviserDto
adviserDto
=
bookAdviserBiz
.
getBase
(
bookId
,
channelId
,
adviserId
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/check/RightsSettingCheck.java
View file @
b83553a9
...
@@ -5,12 +5,14 @@ import com.pcloud.book.rightsSetting.entity.RightsItemGroup;
...
@@ -5,12 +5,14 @@ import com.pcloud.book.rightsSetting.entity.RightsItemGroup;
import
com.pcloud.book.rightsSetting.entity.RightsNowItem
;
import
com.pcloud.book.rightsSetting.entity.RightsNowItem
;
import
com.pcloud.book.rightsSetting.entity.RightsSetting
;
import
com.pcloud.book.rightsSetting.entity.RightsSetting
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingItem
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingItem
;
import
com.pcloud.book.rightsSetting.enums.RightsWeekTypeEnum
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -52,9 +54,29 @@ public class RightsSettingCheck {
...
@@ -52,9 +54,29 @@ public class RightsSettingCheck {
if
(
ListUtils
.
isEmpty
(
list
))
{
if
(
ListUtils
.
isEmpty
(
list
))
{
return
;
return
;
}
}
List
<
Long
>
classifyIds
=
list
.
stream
().
filter
(
s
->
s
.
getRightsClassifyId
()
!=
null
).
map
(
RightsSettingItem:
:
getRightsClassifyId
).
distinct
().
collect
(
Collectors
.
toList
());
Map
<
Long
,
List
<
RightsSettingItem
>>
listMap
=
list
.
stream
().
collect
(
Collectors
.
groupingBy
(
RightsSettingItem:
:
getRightsClassifyId
));
if
(
classifyIds
.
size
()
<
list
.
size
())
{
for
(
Map
.
Entry
<
Long
,
List
<
RightsSettingItem
>>
entry
:
listMap
.
entrySet
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"权益分类不能重复!"
);
List
<
RightsSettingItem
>
items
=
entry
.
getValue
();
if
(
items
.
size
()
>
1
)
{
int
easyReadCount
=
0
;
int
efficientReadCount
=
0
;
int
deepReadCount
=
0
;
for
(
RightsSettingItem
item
:
items
)
{
if
(
null
!=
item
.
getEasyRead
()
&&
item
.
getEasyRead
())
{
++
easyReadCount
;
}
if
(
null
!=
item
.
getEfficientRead
()
&&
item
.
getEfficientRead
())
{
++
efficientReadCount
;
}
if
(
null
!=
item
.
getDeepRead
()
&&
item
.
getDeepRead
())
{
++
deepReadCount
;
}
}
Integer
typeId
=
items
.
get
(
0
).
getRightsClassifyId
().
intValue
();
if
(
easyReadCount
>
1
||
efficientReadCount
>
1
||
deepReadCount
>
1
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"查询到对应的权益分类阅读方式有重复配置,请修改权益分类:"
+
RightsWeekTypeEnum
.
getValue
(
typeId
));
}
}
}
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/dao/RightsItemGroupDao.java
View file @
b83553a9
...
@@ -18,5 +18,5 @@ public interface RightsItemGroupDao extends BaseDao<RightsItemGroup> {
...
@@ -18,5 +18,5 @@ public interface RightsItemGroupDao extends BaseDao<RightsItemGroup> {
void
deleteByRightsSettingId
(
Long
rightsSettingId
);
void
deleteByRightsSettingId
(
Long
rightsSettingId
);
List
<
RightsItemGroup
>
getListByRightSettingId
(
Long
rightsSettingId
);
List
<
RightsItemGroup
>
getListByRightSettingId
(
Long
rightsSettingId
,
Integer
readType
);
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/dao/RightsNowPicDao.java
View file @
b83553a9
...
@@ -6,5 +6,5 @@ import com.pcloud.common.core.dao.BaseDao;
...
@@ -6,5 +6,5 @@ import com.pcloud.common.core.dao.BaseDao;
import
java.util.List
;
import
java.util.List
;
public
interface
RightsNowPicDao
extends
BaseDao
<
RightsNowPic
>
{
public
interface
RightsNowPicDao
extends
BaseDao
<
RightsNowPic
>
{
List
<
RightsNowPic
>
getAllDefaultRightsNowPics
();
List
<
RightsNowPic
>
getAllDefaultRightsNowPics
(
Integer
type
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/dao/impl/RightsItemGroupDaoImpl.java
View file @
b83553a9
...
@@ -5,7 +5,9 @@ import com.pcloud.book.rightsSetting.entity.RightsItemGroup;
...
@@ -5,7 +5,9 @@ import com.pcloud.book.rightsSetting.entity.RightsItemGroup;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @ClassName com.pcloud.book.rightsSetting.dao.impl.RightsItemGroupDaoImpl
* @ClassName com.pcloud.book.rightsSetting.dao.impl.RightsItemGroupDaoImpl
...
@@ -28,7 +30,10 @@ public class RightsItemGroupDaoImpl extends BaseDaoImpl<RightsItemGroup> impleme
...
@@ -28,7 +30,10 @@ public class RightsItemGroupDaoImpl extends BaseDaoImpl<RightsItemGroup> impleme
}
}
@Override
@Override
public
List
<
RightsItemGroup
>
getListByRightSettingId
(
Long
rightsSettingId
)
{
public
List
<
RightsItemGroup
>
getListByRightSettingId
(
Long
rightsSettingId
,
Integer
readType
)
{
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getListByRightSettingId"
),
rightsSettingId
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"rightsSettingId"
,
rightsSettingId
);
map
.
put
(
"readType"
,
readType
);
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getListByRightSettingId"
),
map
);
}
}
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/dao/impl/RightsNowPicDaoImpl.java
View file @
b83553a9
...
@@ -3,9 +3,12 @@ package com.pcloud.book.rightsSetting.dao.impl;
...
@@ -3,9 +3,12 @@ package com.pcloud.book.rightsSetting.dao.impl;
import
com.pcloud.book.rightsSetting.dao.RightsNowPicDao
;
import
com.pcloud.book.rightsSetting.dao.RightsNowPicDao
;
import
com.pcloud.book.rightsSetting.entity.RightsNowPic
;
import
com.pcloud.book.rightsSetting.entity.RightsNowPic
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @ClassName com.pcloud.book.rightsSetting.dao.impl.RightsItemPicDaoImpl
* @ClassName com.pcloud.book.rightsSetting.dao.impl.RightsItemPicDaoImpl
...
@@ -17,7 +20,9 @@ import java.util.List;
...
@@ -17,7 +20,9 @@ import java.util.List;
@Component
(
"rightsNowPicDao"
)
@Component
(
"rightsNowPicDao"
)
public
class
RightsNowPicDaoImpl
extends
BaseDaoImpl
<
RightsNowPic
>
implements
RightsNowPicDao
{
public
class
RightsNowPicDaoImpl
extends
BaseDaoImpl
<
RightsNowPic
>
implements
RightsNowPicDao
{
@Override
@Override
public
List
<
RightsNowPic
>
getAllDefaultRightsNowPics
()
{
public
List
<
RightsNowPic
>
getAllDefaultRightsNowPics
(
Integer
type
)
{
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getAllDefaultRightsNowPics"
));
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"type"
,
type
);
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getAllDefaultRightsNowPics"
),
map
);
}
}
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/dto/ReadTypeCountDTO.java
0 → 100644
View file @
b83553a9
package
com
.
pcloud
.
book
.
rightsSetting
.
dto
;
import
lombok.Data
;
/**
* @ClassName com.pcloud.book.rightsSetting.dto.ReadTypeCountDTO
* @Author 吴博
* @Description 每种阅读方式配置的权益数量DTO
* @Date 2020/5/15 9:25
* @Version 1.0
**/
@Data
public
class
ReadTypeCountDTO
{
//阅读类型
private
Long
rightsSettingId
;
//轻松阅读权益数量
private
Integer
easyReadCount
;
//高效阅读权益数量
private
Integer
efficientReadCount
;
//深度阅读权益数量
private
Integer
deepReadCount
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/dto/RightsSettingDto.java
View file @
b83553a9
...
@@ -21,4 +21,9 @@ public class RightsSettingDto extends RightsSetting {
...
@@ -21,4 +21,9 @@ public class RightsSettingDto extends RightsSetting {
* 书名
* 书名
*/
*/
private
String
bookName
;
private
String
bookName
;
/**
* 当前选择的读书类型
*/
private
Integer
chooseReadType
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/entity/RightsItemGroup.java
View file @
b83553a9
...
@@ -48,4 +48,12 @@ public class RightsItemGroup extends BaseEntity {
...
@@ -48,4 +48,12 @@ public class RightsItemGroup extends BaseEntity {
@ApiModelProperty
(
"应用或作品集合"
)
@ApiModelProperty
(
"应用或作品集合"
)
private
List
<
RightsNowItem
>
rightsNowItems
;
private
List
<
RightsNowItem
>
rightsNowItems
;
@ApiModelProperty
(
"轻松阅读"
)
private
Boolean
easyRead
;
@ApiModelProperty
(
"高效阅读"
)
private
Boolean
efficientRead
;
@ApiModelProperty
(
"深度阅读"
)
private
Boolean
deepRead
;
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/entity/RightsNowPic.java
View file @
b83553a9
...
@@ -22,4 +22,6 @@ public class RightsNowPic extends BaseEntity {
...
@@ -22,4 +22,6 @@ public class RightsNowPic extends BaseEntity {
@ApiModelProperty
(
"是否默认图片"
)
@ApiModelProperty
(
"是否默认图片"
)
private
Boolean
defaultPic
;
private
Boolean
defaultPic
;
@ApiModelProperty
(
"图片库类型(1立享权益2资讯3书单4书刊分类)"
)
private
Integer
type
;
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/entity/RightsReadType.java
0 → 100644
View file @
b83553a9
package
com
.
pcloud
.
book
.
rightsSetting
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.util.Date
;
import
javax.validation.constraints.Size
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.Range
;
@Data
@ApiModel
public
class
RightsReadType
{
private
Long
id
;
@ApiModelProperty
(
"权益id"
)
private
Long
rightsSettingId
;
@ApiModelProperty
(
"阅读类型 1,轻松 2 高效 3 深度"
)
@Range
(
min
=
1
,
max
=
3
,
message
=
"阅读类型只能是轻松、高效和深度"
)
private
Integer
readType
;
@ApiModelProperty
(
"描述"
)
@Size
(
max
=
30
,
message
=
"描述最多30个字"
)
private
String
description
;
@ApiModelProperty
(
"学习时长1-10"
)
@Range
(
min
=
1
,
max
=
10
,
message
=
"学习时长只能选择1-10"
)
private
Integer
learningLength
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
updateTime
;
@ApiModelProperty
(
"权益数量"
)
private
Integer
rightsCount
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/entity/RightsSetting.java
View file @
b83553a9
...
@@ -5,8 +5,11 @@ import io.swagger.annotations.ApiModelProperty;
...
@@ -5,8 +5,11 @@ import io.swagger.annotations.ApiModelProperty;
import
java.util.List
;
import
java.util.List
;
import
javax.validation.Valid
;
import
javax.validation.constraints.Size
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NonNull
;
import
lombok.NonNull
;
import
org.hibernate.validator.constraints.Length
;
@Data
@Data
public
class
RightsSetting
extends
BaseTempletClassify
{
public
class
RightsSetting
extends
BaseTempletClassify
{
...
@@ -89,6 +92,15 @@ public class RightsSetting extends BaseTempletClassify {
...
@@ -89,6 +92,15 @@ public class RightsSetting extends BaseTempletClassify {
@ApiModelProperty
(
"权益配套资料分组集合"
)
@ApiModelProperty
(
"权益配套资料分组集合"
)
private
List
<
RightsItemGroup
>
rightsItemGroups
;
private
List
<
RightsItemGroup
>
rightsItemGroups
;
@ApiModelProperty
(
"权益阅读方式标题"
)
@Length
(
min
=
0
,
max
=
30
,
message
=
"权益阅读方式标题最大30个字"
)
private
String
readTypeTitle
;
@ApiModelProperty
(
"权益de阅读方式"
)
@Size
(
min
=
3
,
max
=
3
,
message
=
"目前有且只有3种阅读方式"
)
@Valid
private
List
<
RightsReadType
>
rightsReadTypes
;
public
RightsSetting
()
{
public
RightsSetting
()
{
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/entity/RightsSettingItem.java
View file @
b83553a9
...
@@ -79,4 +79,20 @@ public class RightsSettingItem extends BaseEntity {
...
@@ -79,4 +79,20 @@ public class RightsSettingItem extends BaseEntity {
@ApiModelProperty
(
"社群"
)
@ApiModelProperty
(
"社群"
)
private
List
<
GroupActivity4AppletDTO
>
groupActivity4AppletList
;
private
List
<
GroupActivity4AppletDTO
>
groupActivity4AppletList
;
/**
* 轻松阅读
*/
private
Boolean
easyRead
;
/**
* 高效阅读
*/
private
Boolean
efficientRead
;
/**
* 深度阅读
*/
private
Boolean
deepRead
;
/**
* 阅读方式1轻松2高效3深度
*/
private
Integer
readType
;
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/entity/RightsSettingTitle.java
View file @
b83553a9
...
@@ -35,6 +35,17 @@ public class RightsSettingTitle {
...
@@ -35,6 +35,17 @@ public class RightsSettingTitle {
* 列表
* 列表
*/
*/
private
List
<
RightsNowItem
>
rightsSettingItemList
;
private
List
<
RightsNowItem
>
rightsSettingItemList
;
/**
* 轻松阅读
*/
private
Boolean
easyRead
;
/**
* 高效阅读
*/
private
Boolean
efficientRead
;
/**
* 深度阅读
*/
private
Boolean
deepRead
;
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/enums/PicTypeEnum.java
0 → 100644
View file @
b83553a9
package
com
.
pcloud
.
book
.
rightsSetting
.
enums
;
/**
* 图片库类型
* @author:zhuyajie
* @date:2020/5/19 10:39
* * @param null
*/
public
enum
PicTypeEnum
{
/**
* 1立享权益
*/
rights_now
(
1
),
/**
* 2资讯
*/
news
(
2
),
/**
* 3书单
*/
booklist
(
3
),
/**
* 4书刊分类
*/
applet_book_classify
(
4
);
public
final
Integer
value
;
PicTypeEnum
(
Integer
value
)
{
this
.
value
=
value
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/enums/RightsWeekTypeEnum.java
0 → 100644
View file @
b83553a9
package
com
.
pcloud
.
book
.
rightsSetting
.
enums
;
/**
* @描述:权益类型-
* @作者:zhuyajie
* @创建时间:17:36 2020/4/19
* @版本:1.0
*/
public
enum
RightsWeekTypeEnum
{
/**
* 7线上学习/阅读提醒
*/
ONLINE_REMIND
(
7
,
"线上学习/阅读提醒"
),
/**
* 8线上读书活动
*/
ONLINE_READING_ACTIVITY
(
8
,
"线上读书活动"
),
/**
* 9书单推荐
*/
BOOK_RECOMMEND
(
9
,
"书单推荐"
),
/**
* 10资讯推送
*/
NEWS_PUSH
(
10
,
"资讯推送"
),
/**
* 11亲子活动设计
*/
FAMILY_ACTIVITY
(
11
,
"亲子活动设计"
),
/**
* 12线上精品课
*/
ONLINE_QUALITY_COURSE
(
12
,
"线上精品课"
),
/**
*13线下读书活动推荐
*/
OFFLINE_READING_ACTIVITY
(
13
,
"线下读书活动推荐"
),
/**
* 14抢兑课程/实物礼品
*/
COURSE_OR_GIFT
(
14
,
"抢兑课程/实物礼品"
);
public
final
Integer
key
;
public
final
String
value
;
RightsWeekTypeEnum
(
Integer
key
,
String
value
)
{
this
.
value
=
value
;
this
.
key
=
key
;
}
public
static
String
getValue
(
Integer
key
)
{
for
(
RightsWeekTypeEnum
typeEnum
:
RightsWeekTypeEnum
.
values
())
{
if
(
typeEnum
.
getKey
().
equals
(
key
))
{
return
typeEnum
.
getValue
();
}
}
return
null
;
}
public
Integer
getKey
()
{
return
key
;
}
public
String
getValue
()
{
return
value
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/facade/RightsSettingFacede.java
View file @
b83553a9
...
@@ -4,6 +4,7 @@ import com.pcloud.book.base.exception.BookBizException;
...
@@ -4,6 +4,7 @@ import com.pcloud.book.base.exception.BookBizException;
import
com.pcloud.book.rightsSetting.biz.RightsSettingBiz
;
import
com.pcloud.book.rightsSetting.biz.RightsSettingBiz
;
import
com.pcloud.book.rightsSetting.dto.RightsSettingDto
;
import
com.pcloud.book.rightsSetting.dto.RightsSettingDto
;
import
com.pcloud.book.rightsSetting.entity.RightsNowPic
;
import
com.pcloud.book.rightsSetting.entity.RightsNowPic
;
import
com.pcloud.book.rightsSetting.entity.RightsReadType
;
import
com.pcloud.book.rightsSetting.entity.RightsSetting
;
import
com.pcloud.book.rightsSetting.entity.RightsSetting
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingClassify
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingClassify
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingItem
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingItem
;
...
@@ -14,7 +15,9 @@ import com.pcloud.common.utils.SessionUtil;
...
@@ -14,7 +15,9 @@ import com.pcloud.common.utils.SessionUtil;
import
com.pcloud.common.utils.cookie.Cookie
;
import
com.pcloud.common.utils.cookie.Cookie
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
javax.validation.Valid
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
@@ -29,6 +32,7 @@ import java.util.List;
...
@@ -29,6 +32,7 @@ import java.util.List;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.Min
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
lombok.SneakyThrows
;
import
lombok.SneakyThrows
;
@RequestMapping
(
"rightsSetting"
)
@RequestMapping
(
"rightsSetting"
)
...
@@ -39,7 +43,8 @@ public class RightsSettingFacede {
...
@@ -39,7 +43,8 @@ public class RightsSettingFacede {
private
RightsSettingBiz
rightsSettingBiz
;
private
RightsSettingBiz
rightsSettingBiz
;
@PostMapping
(
"addRightsSetting"
)
@PostMapping
(
"addRightsSetting"
)
public
ResponseDto
<
Long
>
addRightsSetting
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
RightsSetting
rightsSetting
)
throws
PermissionException
{
public
ResponseDto
<
Long
>
addRightsSetting
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
@Validated
RightsSetting
rightsSetting
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<
Long
>(
rightsSettingBiz
.
addRightsSetting
(
rightsSetting
));
return
new
ResponseDto
<
Long
>(
rightsSettingBiz
.
addRightsSetting
(
rightsSetting
));
}
}
...
@@ -52,7 +57,8 @@ public class RightsSettingFacede {
...
@@ -52,7 +57,8 @@ public class RightsSettingFacede {
}
}
@PostMapping
(
"updateRightsSetting"
)
@PostMapping
(
"updateRightsSetting"
)
public
ResponseDto
<?>
updateRightsSetting
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
RightsSetting
rightsSetting
)
throws
PermissionException
{
public
ResponseDto
<?>
updateRightsSetting
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
@Validated
RightsSetting
rightsSetting
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
SessionUtil
.
getToken4Redis
(
token
);
rightsSettingBiz
.
updateRightsSetting
(
rightsSetting
);
rightsSettingBiz
.
updateRightsSetting
(
rightsSetting
);
return
new
ResponseDto
<>();
return
new
ResponseDto
<>();
...
@@ -117,12 +123,14 @@ public class RightsSettingFacede {
...
@@ -117,12 +123,14 @@ public class RightsSettingFacede {
public
ResponseDto
<?>
getItemByRightsSettingId4AppletHome
(
public
ResponseDto
<?>
getItemByRightsSettingId4AppletHome
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"rightsSettingId"
)
Long
rightsSettingId
,
@RequestParam
(
"rightsSettingId"
)
Long
rightsSettingId
,
@RequestParam
(
value
=
"rightsType"
,
required
=
false
)
String
rightsType
)
{
@RequestParam
(
value
=
"rightsType"
,
required
=
false
)
String
rightsType
,
@RequestParam
(
value
=
"readType"
,
required
=
false
)
@ApiParam
(
"阅读方式1轻松2高效3深度"
)
Integer
readType
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
rightsSettingId
||
StringUtil
.
isEmpty
(
rightsType
))
{
if
(
null
==
rightsSettingId
||
StringUtil
.
isEmpty
(
rightsType
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数缺失!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数缺失!"
);
}
}
return
new
ResponseDto
<>(
rightsSettingBiz
.
getItemByRightsSettingId4AppletHome
(
rightsSettingId
,
wechatUserId
,
rightsType
));
return
new
ResponseDto
<>(
rightsSettingBiz
.
getItemByRightsSettingId4AppletHome
(
rightsSettingId
,
wechatUserId
,
rightsType
,
readType
));
}
}
@ApiOperation
(
"所有权益分类"
)
@ApiOperation
(
"所有权益分类"
)
...
@@ -155,22 +163,24 @@ public class RightsSettingFacede {
...
@@ -155,22 +163,24 @@ public class RightsSettingFacede {
message
=
"权益类型不能小于1"
)
Integer
rightsSettingType
,
message
=
"权益类型不能小于1"
)
Integer
rightsSettingType
,
@RequestParam
(
value
=
"adviserId"
,
required
=
false
)
Long
adviserId
,
@RequestParam
(
value
=
"adviserId"
,
required
=
false
)
Long
adviserId
,
@RequestParam
(
value
=
"bookId"
,
required
=
false
)
Long
bookId
,
@RequestParam
(
value
=
"bookId"
,
required
=
false
)
Long
bookId
,
@RequestParam
(
value
=
"channelId"
,
required
=
false
)
Long
channelId
)
{
@RequestParam
(
value
=
"channelId"
,
required
=
false
)
Long
channelId
,
@RequestParam
(
value
=
"readType"
,
required
=
false
)
@ApiParam
(
"阅读方式1轻松2高效3深度"
)
Integer
readType
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
rightsSettingBiz
.
getRightsSettingRightsNowItemsByType
(
rightsSettingId
,
wechatUserId
,
rightsSettingType
,
adviserId
,
bookId
,
channelId
));
return
new
ResponseDto
<>(
rightsSettingBiz
.
getRightsSettingRightsNowItemsByType
(
rightsSettingId
,
wechatUserId
,
rightsSettingType
,
adviserId
,
bookId
,
channelId
,
readType
));
}
}
@ApiOperation
(
"根据权益id获取即享权益项专享礼包"
)
@ApiOperation
(
"根据权益id获取即享权益项专享礼包"
)
@GetMapping
(
"getRightsSettingGiftCoupons"
)
@GetMapping
(
"getRightsSettingGiftCoupons"
)
public
ResponseDto
<
RightsSetting
>
getRightsSettingGiftCoupons
(
public
ResponseDto
<
RightsSetting
>
getRightsSettingGiftCoupons
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"rightsSettingId"
)
Long
rightsSettingId
@RequestParam
(
"rightsSettingId"
)
Long
rightsSettingId
,
@RequestParam
(
value
=
"readType"
,
required
=
false
)
@ApiParam
(
"阅读方式1轻松2高效3深度"
)
Integer
readType
)
throws
PermissionException
{
)
throws
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
rightsSettingId
)
{
if
(
null
==
rightsSettingId
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数缺失!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数缺失!"
);
}
}
return
new
ResponseDto
<>(
rightsSettingBiz
.
getRightsSettingGiftCoupons
(
rightsSettingId
,
wechatUserId
));
return
new
ResponseDto
<>(
rightsSettingBiz
.
getRightsSettingGiftCoupons
(
rightsSettingId
,
wechatUserId
,
readType
));
}
}
@ApiOperation
(
"根据权益id获取即享权益项补充咨询"
)
@ApiOperation
(
"根据权益id获取即享权益项补充咨询"
)
...
@@ -193,13 +203,14 @@ public class RightsSettingFacede {
...
@@ -193,13 +203,14 @@ public class RightsSettingFacede {
@RequestParam
(
"rightsSettingId"
)
Long
rightsSettingId
,
@RequestParam
(
"rightsSettingId"
)
Long
rightsSettingId
,
@RequestParam
(
"adviserId"
)
Long
adviserId
,
@RequestParam
(
"adviserId"
)
Long
adviserId
,
@RequestParam
(
"bookId"
)
Long
bookId
,
@RequestParam
(
"bookId"
)
Long
bookId
,
@RequestParam
(
"channelId"
)
Long
channelId
@RequestParam
(
"channelId"
)
Long
channelId
,
@RequestParam
(
value
=
"readType"
,
required
=
false
)
@ApiParam
(
"阅读方式1轻松2高效3深度"
)
Integer
readType
)
throws
PermissionException
{
)
throws
PermissionException
{
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
rightsSettingId
){
if
(
null
==
rightsSettingId
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数缺失!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数缺失!"
);
}
}
return
new
ResponseDto
<>(
rightsSettingBiz
.
getRightsItemGroups
(
rightsSettingId
,
adviserId
,
bookId
,
channelId
,
true
));
return
new
ResponseDto
<>(
rightsSettingBiz
.
getRightsItemGroups
(
rightsSettingId
,
adviserId
,
bookId
,
channelId
,
true
,
readType
));
}
}
@ApiOperation
(
"根据书刊的分类获取对应的分类权益信息"
)
@ApiOperation
(
"根据书刊的分类获取对应的分类权益信息"
)
...
@@ -217,10 +228,11 @@ public class RightsSettingFacede {
...
@@ -217,10 +228,11 @@ public class RightsSettingFacede {
@ApiOperation
(
"获取即享权益默认图片库"
)
@ApiOperation
(
"获取即享权益默认图片库"
)
@GetMapping
(
"getAllDefaultRightsNowPics"
)
@GetMapping
(
"getAllDefaultRightsNowPics"
)
public
ResponseDto
<?>
getAllDefaultRightsNowPics
(
public
ResponseDto
<?>
getAllDefaultRightsNowPics
(
@RequestHeader
(
"token"
)
String
token
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"type"
,
required
=
false
)
@ApiParam
(
"图片类型(1立享权益2资讯3书单4书刊分类)"
)
Integer
type
)
throws
PermissionException
{
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
rightsSettingBiz
.
getAllDefaultRightsNowPics
());
return
new
ResponseDto
<>(
rightsSettingBiz
.
getAllDefaultRightsNowPics
(
type
));
}
}
@ApiOperation
(
"新增即享权益图片"
)
@ApiOperation
(
"新增即享权益图片"
)
...
@@ -239,10 +251,11 @@ public class RightsSettingFacede {
...
@@ -239,10 +251,11 @@ public class RightsSettingFacede {
public
ResponseDto
<?>
getRightsNowPics
(
public
ResponseDto
<?>
getRightsNowPics
(
@RequestHeader
(
"token"
)
String
token
,
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
Integer
numPerPage
@RequestParam
(
"numPerPage"
)
Integer
numPerPage
,
@RequestParam
(
value
=
"type"
,
required
=
false
)
@ApiParam
(
"图片类型(1立享权益2资讯3书单4书刊分类)"
)
Integer
type
)
throws
PermissionException
{
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
rightsSettingBiz
.
getRightsNowPics
(
currentPage
,
numPerPage
));
return
new
ResponseDto
<>(
rightsSettingBiz
.
getRightsNowPics
(
currentPage
,
numPerPage
,
type
));
}
}
@ApiOperation
(
"删除即享权益图片"
)
@ApiOperation
(
"删除即享权益图片"
)
...
@@ -256,4 +269,16 @@ public class RightsSettingFacede {
...
@@ -256,4 +269,16 @@ public class RightsSettingFacede {
return
new
ResponseDto
<>();
return
new
ResponseDto
<>();
}
}
@ApiOperation
(
"获取当前图书的阅读方式"
)
@GetMapping
(
"getReadType4Book"
)
public
ResponseDto
<
RightsSettingDto
>
getReadType4Book
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"bookId"
)
Long
bookId
,
@RequestParam
(
"channelId"
)
Long
channelId
,
@RequestParam
(
"adviserId"
)
Long
adviserId
)
throws
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
RightsSettingDto
rightsSettingDto
=
rightsSettingBiz
.
getReadType4Book
(
wechatUserId
,
bookId
,
channelId
,
adviserId
);
return
new
ResponseDto
<>(
rightsSettingDto
);
}
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/mapper/RightsReadTypeMapper.java
0 → 100644
View file @
b83553a9
package
com
.
pcloud
.
book
.
rightsSetting
.
mapper
;
import
com.pcloud.book.rightsSetting.dto.ReadTypeCountDTO
;
import
com.pcloud.book.rightsSetting.entity.RightsReadType
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.ibatis.annotations.MapKey
;
import
org.apache.ibatis.annotations.Mapper
;
@Mapper
public
interface
RightsReadTypeMapper
{
int
deleteByPrimaryKey
(
Long
id
);
int
insert
(
RightsReadType
record
);
int
insertSelective
(
RightsReadType
record
);
RightsReadType
selectByPrimaryKey
(
Long
id
);
int
updateByPrimaryKeySelective
(
RightsReadType
record
);
int
updateByPrimaryKey
(
RightsReadType
record
);
void
deleteByRightsSettingId
(
Long
rightsSettingId
);
void
batchInsert
(
List
<
RightsReadType
>
rightsReadTypes
);
List
<
RightsReadType
>
getByRightsSettingId
(
Long
rightsSettingId
);
@MapKey
(
"readType"
)
Map
<
Integer
,
ReadTypeCountDTO
>
getCounMapt4Title
(
Long
rightsSettingId
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/mapper/RightsSettingTitleMapper.java
View file @
b83553a9
package
com
.
pcloud
.
book
.
rightsSetting
.
mapper
;
package
com
.
pcloud
.
book
.
rightsSetting
.
mapper
;
import
com.pcloud.book.rightsSetting.dto.ReadTypeCountDTO
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingTitle
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingTitle
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.ibatis.annotations.MapKey
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -18,7 +21,9 @@ public interface RightsSettingTitleMapper {
...
@@ -18,7 +21,9 @@ public interface RightsSettingTitleMapper {
void
batchUpdate
(
List
<
RightsSettingTitle
>
rightsSettingTitles
);
void
batchUpdate
(
List
<
RightsSettingTitle
>
rightsSettingTitles
);
List
<
RightsSettingTitle
>
getByRightSettingId
(
Long
rightsSettingId
);
List
<
RightsSettingTitle
>
getByRightSettingId
(
@Param
(
"rightsSettingId"
)
Long
rightsSettingId
,
@Param
(
"readType"
)
Integer
readType
);
RightsSettingTitle
getByRightSettingIdAndType
(
@Param
(
"rightsSettingId"
)
Long
rightsSettingId
,
@Param
(
"type"
)
Integer
type
);
RightsSettingTitle
getByRightSettingIdAndType
(
@Param
(
"rightsSettingId"
)
Long
rightsSettingId
,
@Param
(
"type"
)
Integer
type
,
@Param
(
"readType"
)
Integer
readType
);
ReadTypeCountDTO
getCount4Title
(
Long
rightsSettingId
);
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/skill/biz/PcloudGroupActivityBiz.java
View file @
b83553a9
...
@@ -43,5 +43,5 @@ public interface PcloudGroupActivityBiz {
...
@@ -43,5 +43,5 @@ public interface PcloudGroupActivityBiz {
* 根据分类获取社群共读
* 根据分类获取社群共读
* @return
* @return
*/
*/
GroupActivity4AppletDTO
getGroupActivity4Applet
(
Long
rightSettingId
,
Long
adviserId
,
Long
bookId
,
Long
channelId
);
GroupActivity4AppletDTO
getGroupActivity4Applet
(
Long
rightSettingId
,
Long
adviserId
,
Long
bookId
,
Long
channelId
,
Integer
readType
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/biz/impl/PcloudGroupActivityBizImpl.java
View file @
b83553a9
...
@@ -290,7 +290,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
...
@@ -290,7 +290,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
}
}
@Override
@Override
public
GroupActivity4AppletDTO
getGroupActivity4Applet
(
Long
rightSettingId
,
Long
adviserId
,
Long
bookId
,
Long
channelId
)
{
public
GroupActivity4AppletDTO
getGroupActivity4Applet
(
Long
rightSettingId
,
Long
adviserId
,
Long
bookId
,
Long
channelId
,
Integer
readType
)
{
BookDto
adviserBook
=
bookBiz
.
getAdviserBook
(
bookId
,
adviserId
,
channelId
);
BookDto
adviserBook
=
bookBiz
.
getAdviserBook
(
bookId
,
adviserId
,
channelId
);
BookDto
dto
=
Optional
.
ofNullable
(
adviserBook
).
orElseThrow
(()
->
new
BookBizException
(
BookBizException
.
ID_NOT_EXIST
,
"未找到相关书刊"
));
BookDto
dto
=
Optional
.
ofNullable
(
adviserBook
).
orElseThrow
(()
->
new
BookBizException
(
BookBizException
.
ID_NOT_EXIST
,
"未找到相关书刊"
));
// 处理分类和标签
// 处理分类和标签
...
@@ -306,7 +306,10 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
...
@@ -306,7 +306,10 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
return
new
GroupActivity4AppletDTO
();
return
new
GroupActivity4AppletDTO
();
}
}
// 是否开启社群服务开关
// 是否开启社群服务开关
RightsSettingTitle
right
=
rightsSettingTitleMapper
.
getByRightSettingIdAndType
(
rightSettingId
,
RightsNowItemType
.
GROUP_SERVICE
.
value
);
RightsSettingTitle
right
=
rightsSettingTitleMapper
.
getByRightSettingIdAndType
(
rightSettingId
,
RightsNowItemType
.
GROUP_SERVICE
.
value
,
readType
);
if
(
null
==
right
){
return
new
GroupActivity4AppletDTO
();
}
groupActivity4AppletDTO
.
setOpenStatus
(
Objects
.
isNull
(
right
.
getOpenState
())
?
false
:
right
.
getOpenState
());
groupActivity4AppletDTO
.
setOpenStatus
(
Objects
.
isNull
(
right
.
getOpenState
())
?
false
:
right
.
getOpenState
());
groupActivity4AppletDTO
.
setRightsSettingTitle
(
right
.
getRightsSettingTitle
());
groupActivity4AppletDTO
.
setRightsSettingTitle
(
right
.
getRightsSettingTitle
());
groupActivity4AppletDTO
.
setRightsSettingDesc
(
right
.
getRightsSettingDesc
());
groupActivity4AppletDTO
.
setRightsSettingDesc
(
right
.
getRightsSettingDesc
());
...
...
pcloud-service-book/src/main/resources/generatorConfig.xml
View file @
b83553a9
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
selectByExampleQueryId="false">
selectByExampleQueryId="false">
</table>-->
</table>-->
<table
tableName=
"rights_
setting_title"
domainObjectName=
"RightsSettingTitl
e"
<table
tableName=
"rights_
read_type"
domainObjectName=
"RightsReadTyp
e"
enableCountByExample=
"false"
enableUpdateByExample=
"false"
enableCountByExample=
"false"
enableUpdateByExample=
"false"
enableDeleteByExample=
"false"
enableSelectByExample=
"false"
enableDeleteByExample=
"false"
enableSelectByExample=
"false"
selectByExampleQueryId=
"false"
>
selectByExampleQueryId=
"false"
>
...
...
pcloud-service-book/src/main/resources/mapper/applet/AppletBooklist.xml
View file @
b83553a9
...
@@ -103,6 +103,9 @@
...
@@ -103,6 +103,9 @@
<if
test=
"name != null"
>
<if
test=
"name != null"
>
AND b.booklist_name LIKE CONCAT("%", #{name} ,"%")
AND b.booklist_name LIKE CONCAT("%", #{name} ,"%")
</if>
</if>
<if
test=
"classifyId >0"
>
AND b.classify_id= #{classifyId}
</if>
GROUP BY b.id
GROUP BY b.id
order by b.create_time desc
order by b.create_time desc
</select>
</select>
...
@@ -154,10 +157,25 @@
...
@@ -154,10 +157,25 @@
FROM applet_booklist b
FROM applet_booklist b
LEFT JOIN applet_booklist_config c ON b.id=c.booklist_id
LEFT JOIN applet_booklist_config c ON b.id=c.booklist_id
WHERE 1=1
WHERE 1=1
AND b.classify_id= #{classifyId}
<if
test=
"classifyId != null"
>
AND b.classify_id= #{classifyId}
</if>
<if
test=
"classifyIdList != null"
>
AND b.classify_id in
<foreach
collection=
"classifyIdList"
item=
"item"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
</if>
GROUP BY b.id
GROUP BY b.id
HAVING COUNT(c.id)>0
HAVING COUNT(c.id)>0
order by b.create_time desc
<choose>
<when
test=
"order>0 and order == 1"
>
ORDER BY RAND()
</when>
<otherwise>
order by b.create_time desc
</otherwise>
</choose>
</select>
</select>
<select
id=
"getBookBaseByBooklistId"
parameterType=
"map"
resultType=
"com.pcloud.book.applet.dto.BookDTO4Booklist"
>
<select
id=
"getBookBaseByBooklistId"
parameterType=
"map"
resultType=
"com.pcloud.book.applet.dto.BookDTO4Booklist"
>
...
...
pcloud-service-book/src/main/resources/mapper/applet/AppletBooklistClassify.xml
View file @
b83553a9
...
@@ -8,18 +8,20 @@
...
@@ -8,18 +8,20 @@
<result
column=
"show_state"
property=
"showState"
jdbcType=
"BOOLEAN"
/>
<result
column=
"show_state"
property=
"showState"
jdbcType=
"BOOLEAN"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"pic"
property=
"pic"
jdbcType=
"VARCHAR"
/>
</resultMap>
</resultMap>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
id, classify_name, seq, show_state, create_time,update_time
id, classify_name, seq, show_state, create_time,update_time
,pic
</sql>
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.applet.entity.AppletBooklistClassify"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.applet.entity.AppletBooklistClassify"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into applet_booklist_classify (
insert into applet_booklist_classify (
classify_name, seq, show_state, create_time, update_time
classify_name, seq, show_state, create_time, update_time
, pic
)
)
values (
values (
#{classifyName}, #{seq}, #{showState}, NOW(), NOW()
#{classifyName}, #{seq}, #{showState}, NOW(), NOW()
, #{pic}
)
)
</insert>
</insert>
...
@@ -35,6 +37,9 @@
...
@@ -35,6 +37,9 @@
<if
test=
"showState != null"
>
<if
test=
"showState != null"
>
show_state = #{showState},
show_state = #{showState},
</if>
</if>
<if
test=
"pic != null"
>
pic=#{pic},
</if>
update_time=NOW()
update_time=NOW()
</set>
</set>
where id = #{id,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
...
@@ -57,7 +62,8 @@
...
@@ -57,7 +62,8 @@
b.classify_name classifyName,
b.classify_name classifyName,
b.seq seq,
b.seq seq,
COUNT(c.id) booklistCount,
COUNT(c.id) booklistCount,
b.show_state showState
b.show_state showState,
b.pic
FROM applet_booklist_classify b
FROM applet_booklist_classify b
LEFT JOIN applet_booklist c ON b.id=c.classify_id
LEFT JOIN applet_booklist c ON b.id=c.classify_id
WHERE 1=1
WHERE 1=1
...
@@ -75,13 +81,46 @@
...
@@ -75,13 +81,46 @@
<select
id=
"getAllBooklistClassify"
parameterType=
"map"
resultType=
"com.pcloud.book.applet.dto.AppletBooklistClassifyDTO"
>
<select
id=
"getAllBooklistClassify"
parameterType=
"map"
resultType=
"com.pcloud.book.applet.dto.AppletBooklistClassifyDTO"
>
SELECT
SELECT
id, classify_name classifyName, seq, show_state showState
id, classify_name classifyName, seq, show_state showState
, pic
FROM applet_booklist_classify
FROM applet_booklist_classify
where 1=1
where 1=1
<if
test=
"showState != null"
>
<if
test=
"showState != null"
>
AND show_state = #{showState}
AND show_state = #{showState}
</if>
</if>
ORDER BY seq ASC
ORDER BY seq ASC, id asc
</select>
<insert
id=
"batchInsertUserBooklistClassify"
parameterType=
"list"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into applet_booklist_classify_user (
classify_id, wechat_user_id, create_time)
values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
( #{item.classifyId}, #{item.wechatUserId}, NOW() )
</foreach>
</insert>
<delete
id=
"deleteClassifyByWechatUesrId"
parameterType=
"long"
>
DELETE FROM applet_booklist_classify_user
WHERE wechat_user_id = #{wechatUserId}
</delete>
<select
id=
"getClassifyIdsByUserId"
parameterType=
"long"
resultType=
"long"
>
SELECT classify_id
FROM applet_booklist_classify_user
WHERE wechat_user_id = #{wechatUserId}
</select>
<select
id=
"getClassifysByUserId"
parameterType=
"long"
resultType=
"com.pcloud.book.applet.dto.AppletBooklistClassifyDTO"
>
SELECT
c.id, c.classify_name classifyName, c.seq, c.show_state showState, c.pic
FROM
applet_booklist_classify_user u
LEFT JOIN applet_booklist_classify c ON u.classify_id = c.id
WHERE
u.wechat_user_id = #{wechatUserId}
AND c.show_state = 1
ORDER BY
c.seq ASC
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/applet/AppletNews.xml
View file @
b83553a9
...
@@ -384,4 +384,52 @@
...
@@ -384,4 +384,52 @@
ORDER BY n.create_time DESC
ORDER BY n.create_time DESC
</select>
</select>
<select
id=
"listAppletNews4Wechat"
parameterType=
"map"
resultType=
"com.pcloud.book.applet.dto.AppletNewsDTO"
>
SELECT
n.id,
n.news_name newsName,
n.source,
n.news_classify_id newsClassifyId,
n.pro_label_id proLabelId,
n.dep_label_id depLabelId,
n.pur_label_id purLabelId,
n.type,
n.digest,
n.pic1,
n.pic2,
n.pic3,
n.content,
n.show_state showState,
c.news_classify newsClassify,
n.create_time createTime,
n.first_classify firstClassify,
n.second_classify secondClassify,
n.grade_label_id gradeLabelId,
n.subject_label_id subjectLabelId,
n.rights_classify_id rightsClassifyId,
n.jump_type jumpType,
n.jump_url jumpUrl
FROM applet_news n
LEFT JOIN applet_news_classify c ON n.news_classify_id=c.id
WHERE n.show_state = 1
<if
test=
"newsClassifyId >0"
>
AND n.news_classify_id = #{newsClassifyId}
</if>
<if
test=
"newsClassifyIdList != null"
>
AND n.news_classify_id in
<foreach
collection=
"newsClassifyIdList"
item=
"item"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
</if>
<choose>
<when
test=
"order>0 and order == 1"
>
ORDER BY RAND()
</when>
<otherwise>
ORDER BY n.create_time DESC
</otherwise>
</choose>
</select>
</mapper>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/applet/AppletNewsClassify.xml
View file @
b83553a9
...
@@ -8,18 +8,19 @@
...
@@ -8,18 +8,19 @@
<result
column=
"show_state"
property=
"showState"
jdbcType=
"BOOLEAN"
/>
<result
column=
"show_state"
property=
"showState"
jdbcType=
"BOOLEAN"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"pic"
property=
"pic"
jdbcType=
"VARCHAR"
/>
</resultMap>
</resultMap>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
id, news_classify, seq, show_state, create_time,update_time
id, news_classify, seq, show_state, create_time,update_time
, pic
</sql>
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.applet.entity.AppletNewsClassify"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.applet.entity.AppletNewsClassify"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into applet_news_classify (
insert into applet_news_classify (
news_classify, seq, show_state, create_time, update_time
news_classify, seq, show_state, create_time, update_time
, pic
)
)
values (
values (
#{newsClassify}, #{seq}, #{showState}, NOW(), NOW()
#{newsClassify}, #{seq}, #{showState}, NOW(), NOW()
, #{pic}
)
)
</insert>
</insert>
...
@@ -35,6 +36,9 @@
...
@@ -35,6 +36,9 @@
<if
test=
"showState != null"
>
<if
test=
"showState != null"
>
show_state = #{showState},
show_state = #{showState},
</if>
</if>
<if
test=
"pic != null"
>
pic=#{pic},
</if>
update_time=NOW()
update_time=NOW()
</set>
</set>
where id = #{id,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
...
@@ -57,7 +61,8 @@
...
@@ -57,7 +61,8 @@
b.news_classify newsClassify,
b.news_classify newsClassify,
b.seq seq,
b.seq seq,
COUNT(c.id) newsCount,
COUNT(c.id) newsCount,
b.show_state showState
b.show_state showState,
b.pic pic
FROM applet_news_classify b
FROM applet_news_classify b
LEFT JOIN applet_news c ON b.id=c.news_classify_id
LEFT JOIN applet_news c ON b.id=c.news_classify_id
WHERE 1=1
WHERE 1=1
...
@@ -75,13 +80,46 @@
...
@@ -75,13 +80,46 @@
<select
id=
"getAllNewsClassify"
parameterType=
"map"
resultType=
"com.pcloud.book.applet.dto.AppletNewsClassifyDTO"
>
<select
id=
"getAllNewsClassify"
parameterType=
"map"
resultType=
"com.pcloud.book.applet.dto.AppletNewsClassifyDTO"
>
SELECT
SELECT
id, news_classify newsClassify, seq, show_state showState
id, news_classify newsClassify, seq, show_state showState
, pic
FROM applet_news_classify
FROM applet_news_classify
where 1=1
where 1=1
<if
test=
"showState != null"
>
<if
test=
"showState != null"
>
AND show_state = #{showState}
AND show_state = #{showState}
</if>
</if>
ORDER BY seq ASC
ORDER BY seq ASC, id asc
</select>
<insert
id=
"batchInsertUserNewsClassify"
parameterType=
"list"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into applet_news_classify_user (
news_classify_id, wechat_user_id, create_time)
values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
( #{item.newsClassifyId}, #{item.wechatUserId}, NOW() )
</foreach>
</insert>
<delete
id=
"deleteClassifyByWechatUesrId"
parameterType=
"long"
>
DELETE FROM applet_news_classify_user
WHERE wechat_user_id = #{wechatUserId}
</delete>
<select
id=
"getClassifyIdsByUserId"
parameterType=
"long"
resultType=
"long"
>
SELECT news_classify_id
FROM applet_news_classify_user
WHERE wechat_user_id = #{wechatUserId}
</select>
<select
id=
"getClassifysByUserId"
parameterType=
"long"
resultType=
"com.pcloud.book.applet.dto.AppletNewsClassifyDTO"
>
SELECT
c.id, c.news_classify newsClassify, c.seq, c.show_state showState, c.pic
FROM
applet_news_classify_user u
LEFT JOIN applet_news_classify c ON u.news_classify_id = c.id
WHERE
u.wechat_user_id = #{wechatUserId}
AND c.show_state = 1
ORDER BY
c.seq ASC
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/applet/AppletUserBookcase.xml
View file @
b83553a9
...
@@ -8,10 +8,11 @@
...
@@ -8,10 +8,11 @@
<result
column=
"channel_id"
property=
"channelId"
jdbcType=
"BIGINT"
/>
<result
column=
"channel_id"
property=
"channelId"
jdbcType=
"BIGINT"
/>
<result
column=
"adviser_id"
property=
"adviserId"
jdbcType=
"BIGINT"
/>
<result
column=
"adviser_id"
property=
"adviserId"
jdbcType=
"BIGINT"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"read_type"
property=
"readType"
jdbcType=
"TINYINT"
/>
</resultMap>
</resultMap>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
id, wechat_user_id, book_id, channel_id, adviser_id, create_time
id, wechat_user_id, book_id, channel_id, adviser_id, create_time
,read_type
</sql>
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.applet.entity.AppletUserBookcase"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.applet.entity.AppletUserBookcase"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
...
@@ -21,6 +22,9 @@
...
@@ -21,6 +22,9 @@
values (
values (
#{wechatUserId}, #{bookId}, #{channelId}, #{adviserId}, NOW()
#{wechatUserId}, #{bookId}, #{channelId}, #{adviserId}, NOW()
)
)
on duplicate key
update
create_time = now()
</insert>
</insert>
<select
id=
"listByWechatUserId"
parameterType=
"long"
resultType=
"com.pcloud.book.applet.dto.AppletUserBookcaseDTO"
>
<select
id=
"listByWechatUserId"
parameterType=
"long"
resultType=
"com.pcloud.book.applet.dto.AppletUserBookcaseDTO"
>
...
@@ -97,7 +101,8 @@
...
@@ -97,7 +101,8 @@
SELECT
SELECT
t.book_id bookId,
t.book_id bookId,
t.adviser_id adviserId,
t.adviser_id adviserId,
t.channel_id channelId
t.channel_id channelId,
t.read_type readType
FROM
FROM
applet_user_bookcase t
applet_user_bookcase t
INNER JOIN book_group t1 ON t.book_id = t1.book_id
INNER JOIN book_group t1 ON t.book_id = t1.book_id
...
@@ -116,7 +121,8 @@
...
@@ -116,7 +121,8 @@
SELECT
SELECT
t.book_id bookId,
t.book_id bookId,
t.adviser_id adviserId,
t.adviser_id adviserId,
t.channel_id channelId
t.channel_id channelId,
t.read_type readType
FROM
FROM
applet_user_bookcase t
applet_user_bookcase t
WHERE
WHERE
...
@@ -136,4 +142,40 @@
...
@@ -136,4 +142,40 @@
</foreach>
</foreach>
</delete>
</delete>
<update
id=
"updateUserReadType"
parameterType=
"com.pcloud.book.applet.entity.AppletUserBookcase"
>
update
applet_user_bookcase
set
read_type = #{readType}
WHERE
wechat_user_id=#{wechatUserId}
AND book_id=#{bookId}
AND channel_id=#{channelId}
AND adviser_id=#{adviserId}
</update>
<select
id=
"getUserReadType"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from
applet_user_bookcase
where
wechat_user_id=#{wechatUserId}
AND book_id=#{bookId}
AND channel_id=#{channelId}
AND adviser_id=#{adviserId}
limit 1
</select>
<select
id=
"getListByUserId"
parameterType=
"long"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM
applet_user_bookcase
WHERE
wechat_user_id = #{wechatUserId}
ORDER BY
create_time DESC
</select>
</mapper>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/rightssetting/RightItemGroup.xml
View file @
b83553a9
...
@@ -13,10 +13,13 @@
...
@@ -13,10 +13,13 @@
<result
property=
"desc2"
column=
"desc2"
jdbcType=
"VARCHAR"
/>
<result
property=
"desc2"
column=
"desc2"
jdbcType=
"VARCHAR"
/>
<result
property=
"desc3"
column=
"desc3"
jdbcType=
"VARCHAR"
/>
<result
property=
"desc3"
column=
"desc3"
jdbcType=
"VARCHAR"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"easy_read"
jdbcType=
"TINYINT"
property=
"easyRead"
/>
<result
column=
"efficient_read"
jdbcType=
"TINYINT"
property=
"efficientRead"
/>
<result
column=
"deep_read"
jdbcType=
"TINYINT"
property=
"deepRead"
/>
</resultMap>
</resultMap>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
id, rights_setting_id, name, show_state, type, pic, desc1, desc2, desc3, create_time
id, rights_setting_id, name, show_state, type, pic, desc1, desc2, desc3, create_time
, easy_read,efficient_read,deep_read
</sql>
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
...
@@ -34,7 +37,8 @@
...
@@ -34,7 +37,8 @@
<insert
id=
"insert"
parameterType=
"com.pcloud.book.rightsSetting.entity.RightsItemGroup"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.rightsSetting.entity.RightsItemGroup"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into rights_item_group
insert into rights_item_group
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
rights_setting_id, name, show_state, type, pic, desc1, desc2, desc3, create_time
rights_setting_id, name, show_state, type, pic, desc1, desc2, desc3, create_time,
easy_read,efficient_read,deep_read
</trim>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{rightsSettingId,jdbcType=BIGINT},
#{rightsSettingId,jdbcType=BIGINT},
...
@@ -45,13 +49,15 @@
...
@@ -45,13 +49,15 @@
#{desc1,jdbcType=VARCHAR},
#{desc1,jdbcType=VARCHAR},
#{desc2,jdbcType=VARCHAR},
#{desc2,jdbcType=VARCHAR},
#{desc3,jdbcType=VARCHAR},
#{desc3,jdbcType=VARCHAR},
NOW()
NOW(),
#{easyRead},#{efficientRead},#{deepRead}
</trim>
</trim>
</insert>
</insert>
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.rightsSetting.entity.RightsItemGroup"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.rightsSetting.entity.RightsItemGroup"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into rights_item_group (
insert into rights_item_group (
rights_setting_id, name, show_state, type, pic, desc1, desc2, desc3, create_time
rights_setting_id, name, show_state, type, pic, desc1, desc2, desc3, create_time,
easy_read,efficient_read,deep_read
) values
) values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(
(
...
@@ -63,7 +69,8 @@
...
@@ -63,7 +69,8 @@
#{item.desc1,jdbcType=VARCHAR},
#{item.desc1,jdbcType=VARCHAR},
#{item.desc2,jdbcType=VARCHAR},
#{item.desc2,jdbcType=VARCHAR},
#{item.desc3,jdbcType=VARCHAR},
#{item.desc3,jdbcType=VARCHAR},
NOW()
NOW(),
#{item.easyRead},#{item.efficientRead},#{item.deepRead}
)
)
</foreach>
</foreach>
</insert>
</insert>
...
@@ -73,10 +80,21 @@
...
@@ -73,10 +80,21 @@
where rights_setting_id=#{rightsSettingId}
where rights_setting_id=#{rightsSettingId}
</delete>
</delete>
<select
id=
"getListByRightSettingId"
parameterType=
"
long
"
resultMap=
"BaseResultMap"
>
<select
id=
"getListByRightSettingId"
parameterType=
"
map
"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
select
<include
refid=
"Base_Column_List"
/>
from rights_item_group
from rights_item_group
where rights_setting_id=#{rightsSettingId}
where rights_setting_id=#{rightsSettingId}
<choose>
<when
test=
"readType==1"
>
and easy_read=1
</when>
<when
test=
"readType==2"
>
and efficient_read=1
</when>
<when
test=
"readType==3"
>
and deep_read=1
</when>
</choose>
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/rightssetting/RightNowPic.xml
View file @
b83553a9
...
@@ -7,10 +7,11 @@
...
@@ -7,10 +7,11 @@
<result
property=
"picUrl"
column=
"pic_url"
jdbcType=
"VARCHAR"
/>
<result
property=
"picUrl"
column=
"pic_url"
jdbcType=
"VARCHAR"
/>
<result
property=
"defaultPic"
column=
"default_pic"
jdbcType=
"BOOLEAN"
/>
<result
property=
"defaultPic"
column=
"default_pic"
jdbcType=
"BOOLEAN"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"type"
column=
"type"
jdbcType=
"INTEGER"
/>
</resultMap>
</resultMap>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
id, pic_url, default_pic, create_time
id, pic_url, default_pic, create_time
, type
</sql>
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
...
@@ -28,38 +29,46 @@
...
@@ -28,38 +29,46 @@
<insert
id=
"insert"
parameterType=
"com.pcloud.book.rightsSetting.entity.RightsNowPic"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.rightsSetting.entity.RightsNowPic"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into rights_now_pic
insert into rights_now_pic
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
pic_url, default_pic, create_time
pic_url, default_pic, create_time
, type
</trim>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{picUrl,jdbcType=VARCHAR},
#{picUrl,jdbcType=VARCHAR},
#{defaultPic,jdbcType=BOOLEAN},
#{defaultPic,jdbcType=BOOLEAN},
NOW()
NOW(),
#{type}
</trim>
</trim>
</insert>
</insert>
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.rightsSetting.entity.RightsNowPic"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.rightsSetting.entity.RightsNowPic"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into rights_now_pic (
insert into rights_now_pic (
pic_url, default_pic, create_time
pic_url, default_pic, create_time
, type
) values
) values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(
(
#{item.picUrl,jdbcType=VARCHAR},
#{item.picUrl,jdbcType=VARCHAR},
#{item.defaultPic,jdbcType=BOOLEAN},
#{item.defaultPic,jdbcType=BOOLEAN},
NOW()
NOW(),
#{type}
)
)
</foreach>
</foreach>
</insert>
</insert>
<select
id=
"getAllDefaultRightsNowPics"
resultMap=
"BaseResultMap"
>
<select
id=
"getAllDefaultRightsNowPics"
resultMap=
"BaseResultMap"
parameterType=
"map"
>
select
<include
refid=
"Base_Column_List"
/>
select
<include
refid=
"Base_Column_List"
/>
from rights_now_pic
from rights_now_pic
where default_pic=1
where default_pic=1
<if
test=
"type != null"
>
and type = #{type}
</if>
</select>
</select>
<select
id=
"getRightsNowPics"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
<select
id=
"getRightsNowPics"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
select
<include
refid=
"Base_Column_List"
/>
from rights_now_pic
from rights_now_pic
where default_pic=0
where default_pic=0
<if
test=
"type != null"
>
and type = #{type}
</if>
order by create_time desc
order by create_time desc
</select>
</select>
...
...
pcloud-service-book/src/main/resources/mapper/rightssetting/RightsReadTypeMapper.xml
0 → 100644
View file @
b83553a9
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.rightsSetting.mapper.RightsReadTypeMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.rightsSetting.entity.RightsReadType"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"rights_setting_id"
property=
"rightsSettingId"
jdbcType=
"BIGINT"
/>
<result
column=
"read_type"
property=
"readType"
jdbcType=
"INTEGER"
/>
<result
column=
"description"
property=
"description"
jdbcType=
"VARCHAR"
/>
<result
column=
"learning_length"
property=
"learningLength"
jdbcType=
"INTEGER"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, rights_setting_id, read_type, description, learning_length, create_time, update_time
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
select
<include
refid=
"Base_Column_List"
/>
from rights_read_type
where id = #{id,jdbcType=BIGINT}
</select>
<select
id=
"getByRightsSettingId"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from rights_read_type
where rights_setting_id = #{rightsSettingId,jdbcType=BIGINT}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Long"
>
delete from rights_read_type
where id = #{id,jdbcType=BIGINT}
</delete>
<delete
id=
"deleteByRightsSettingId"
parameterType=
"long"
>
delete
from
rights_read_type
where
rights_setting_id = #{rightsSettingId}
</delete>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.rightsSetting.entity.RightsReadType"
>
insert into rights_read_type (id, rights_setting_id, read_type,
description, learning_length, create_time,
update_time)
values (#{id,jdbcType=BIGINT}, #{rightsSettingId,jdbcType=BIGINT}, #{readType,jdbcType=INTEGER},
#{description,jdbcType=VARCHAR}, #{learningLength,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.pcloud.book.rightsSetting.entity.RightsReadType"
>
insert into rights_read_type
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"rightsSettingId != null"
>
rights_setting_id,
</if>
<if
test=
"readType != null"
>
read_type,
</if>
<if
test=
"description != null"
>
description,
</if>
<if
test=
"learningLength != null"
>
learning_length,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=BIGINT},
</if>
<if
test=
"rightsSettingId != null"
>
#{rightsSettingId,jdbcType=BIGINT},
</if>
<if
test=
"readType != null"
>
#{readType,jdbcType=INTEGER},
</if>
<if
test=
"description != null"
>
#{description,jdbcType=VARCHAR},
</if>
<if
test=
"learningLength != null"
>
#{learningLength,jdbcType=INTEGER},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.rightsSetting.entity.RightsReadType"
>
insert into rights_read_type (rights_setting_id, read_type,
description, learning_length, create_time, update_time)
values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
( #{item.rightsSettingId,jdbcType=BIGINT}, #{item.readType,jdbcType=INTEGER},
#{item.description,jdbcType=VARCHAR}, #{item.learningLength,jdbcType=INTEGER},now(), now())
</foreach>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.pcloud.book.rightsSetting.entity.RightsReadType"
>
update rights_read_type
<set
>
<if
test=
"rightsSettingId != null"
>
rights_setting_id = #{rightsSettingId,jdbcType=BIGINT},
</if>
<if
test=
"readType != null"
>
read_type = #{readType,jdbcType=INTEGER},
</if>
<if
test=
"description != null"
>
description = #{description,jdbcType=VARCHAR},
</if>
<if
test=
"learningLength != null"
>
learning_length = #{learningLength,jdbcType=INTEGER},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.pcloud.book.rightsSetting.entity.RightsReadType"
>
update rights_read_type
set rights_setting_id = #{rightsSettingId,jdbcType=BIGINT},
read_type = #{readType,jdbcType=INTEGER},
description = #{description,jdbcType=VARCHAR},
learning_length = #{learningLength,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/rightssetting/RightsSettingItemMapper.xml
View file @
b83553a9
...
@@ -11,6 +11,9 @@
...
@@ -11,6 +11,9 @@
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"title"
column=
"title"
jdbcType=
"VARCHAR"
/>
<result
property=
"title"
column=
"title"
jdbcType=
"VARCHAR"
/>
<result
property=
"uuid"
column=
"uuid"
jdbcType=
"VARCHAR"
/>
<result
property=
"uuid"
column=
"uuid"
jdbcType=
"VARCHAR"
/>
<result
property=
"easyRead"
column=
"easy_read"
jdbcType=
"TINYINT"
/>
<result
property=
"efficientRead"
column=
"efficient_read"
jdbcType=
"TINYINT"
/>
<result
property=
"deepRead"
column=
"deep_read"
jdbcType=
"TINYINT"
/>
</resultMap>
</resultMap>
<!--通过实体作为筛选条件查询-->
<!--通过实体作为筛选条件查询-->
...
@@ -19,7 +22,7 @@
...
@@ -19,7 +22,7 @@
i.id, i.rights_setting_id rightsSettingId,
i.id, i.rights_setting_id rightsSettingId,
i.rights_type rightsType, i.rights_classify_id rightsClassifyId,
i.rights_type rightsType, i.rights_classify_id rightsClassifyId,
i.description, i.create_time createTime, i.title,i.uuid,IFNULL(p.is_open,0) isOpen,p.service_desc serviceDesc,
i.description, i.create_time createTime, i.title,i.uuid,IFNULL(p.is_open,0) isOpen,p.service_desc serviceDesc,
c.book_id bookId
c.book_id bookId
, i.easy_read easyRead,i.efficient_read efficientRead,i.deep_read deepRead
from book.rights_setting_item i
from book.rights_setting_item i
left join book.rights_read_plan p on i.id=p.rights_setting_item_id
left join book.rights_read_plan p on i.id=p.rights_setting_item_id
LEFT JOIN rights_setting c ON c.id=i.rights_setting_id
LEFT JOIN rights_setting c ON c.id=i.rights_setting_id
...
@@ -36,14 +39,27 @@
...
@@ -36,14 +39,27 @@
<if
test=
"rightsClassifyId != null "
>
<if
test=
"rightsClassifyId != null "
>
and i.rights_classify_id = #{rightsClassifyId}
and i.rights_classify_id = #{rightsClassifyId}
</if>
</if>
<choose>
<when
test=
"readType==1"
>
and i.easy_read=1
</when>
<when
test=
"readType==2"
>
and i.efficient_read=1
</when>
<when
test=
"readType==3"
>
and i.deep_read=1
</when>
</choose>
</where>
</where>
order by i.id asc
order by i.id asc
</select>
</select>
<!--新增所有列-->
<!--新增所有列-->
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into book.rights_setting_item(rights_setting_id, rights_type, rights_classify_id, description, create_time,title,uuid)
insert into book.rights_setting_item(rights_setting_id, rights_type, rights_classify_id, description, create_time,title,uuid,
values (#{rightsSettingId}, #{rightsType}, #{rightsClassifyId}, #{description}, NOW(), #{title},#{uuid})
easy_read,efficient_read,deep_read)
values (#{rightsSettingId}, #{rightsType}, #{rightsClassifyId}, #{description}, NOW(), #{title},#{uuid},
#{easyRead},#{efficientRead},#{deepRead})
</insert>
</insert>
<!--通过权益主键删除-->
<!--通过权益主键删除-->
...
@@ -58,7 +74,8 @@
...
@@ -58,7 +74,8 @@
<!--批量新增-->
<!--批量新增-->
<insert
id=
"batchInsert"
useGeneratedKeys=
"true"
parameterType=
"java.util.List"
>
<insert
id=
"batchInsert"
useGeneratedKeys=
"true"
parameterType=
"java.util.List"
>
insert into book.rights_setting_item (
insert into book.rights_setting_item (
rights_setting_id, rights_type, rights_classify_id, description, create_time,title,uuid
rights_setting_id, rights_type, rights_classify_id, description, create_time,title,uuid,
easy_read,efficient_read,deep_read
)
)
values
values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
...
@@ -69,7 +86,8 @@
...
@@ -69,7 +86,8 @@
#{item.description,jdbcType=VARCHAR},
#{item.description,jdbcType=VARCHAR},
NOW(),
NOW(),
#{item.title},
#{item.title},
#{item.uuid}
#{item.uuid},
#{item.easyRead},#{item.efficientRead},#{item.deepRead}
)
)
</foreach>
</foreach>
</insert>
</insert>
...
@@ -87,7 +105,8 @@
...
@@ -87,7 +105,8 @@
select
select
i.id, i.rights_setting_id rightsSettingId,
i.id, i.rights_setting_id rightsSettingId,
i.rights_type rightsType, i.rights_classify_id rightsClassifyId,
i.rights_type rightsType, i.rights_classify_id rightsClassifyId,
i.description, i.create_time createTime, i.title,i.uuid,IFNULL(p.is_open,0) isOpen,p.service_desc serviceDesc
i.description, i.create_time createTime, i.title,i.uuid,IFNULL(p.is_open,0) isOpen,p.service_desc serviceDesc,
i.easy_read easyRead,i.efficient_read efficientRead,i.deep_read deepRead
from book.rights_setting_item i
from book.rights_setting_item i
left join book.rights_read_plan p on i.id=p.rights_setting_item_id
left join book.rights_read_plan p on i.id=p.rights_setting_item_id
<where>
<where>
...
...
pcloud-service-book/src/main/resources/mapper/rightssetting/RightsSettingMapper.xml
View file @
b83553a9
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
<result
column=
"online_course_open"
property=
"onlineCourseOpen"
jdbcType=
"BOOLEAN"
/>
<result
column=
"online_course_open"
property=
"onlineCourseOpen"
jdbcType=
"BOOLEAN"
/>
<result
column=
"learning_tool_open"
property=
"learningToolOpen"
jdbcType=
"BOOLEAN"
/>
<result
column=
"learning_tool_open"
property=
"learningToolOpen"
jdbcType=
"BOOLEAN"
/>
<result
column=
"draw_open"
property=
"drawNowOpen"
jdbcType=
"BOOLEAN"
/>
<result
column=
"draw_open"
property=
"drawNowOpen"
jdbcType=
"BOOLEAN"
/>
<result
column=
"read_type_title"
property=
"readTypeTitle"
jdbcType=
"VARCHAR"
/>
</resultMap>
</resultMap>
<resultMap
id=
"DtoResultMap"
type=
"com.pcloud.book.rightsSetting.dto.RightsSettingDto"
>
<resultMap
id=
"DtoResultMap"
type=
"com.pcloud.book.rightsSetting.dto.RightsSettingDto"
>
...
@@ -38,11 +39,12 @@
...
@@ -38,11 +39,12 @@
<result
column=
"online_course_open"
property=
"onlineCourseOpen"
jdbcType=
"BOOLEAN"
/>
<result
column=
"online_course_open"
property=
"onlineCourseOpen"
jdbcType=
"BOOLEAN"
/>
<result
column=
"learning_tool_open"
property=
"learningToolOpen"
jdbcType=
"BOOLEAN"
/>
<result
column=
"learning_tool_open"
property=
"learningToolOpen"
jdbcType=
"BOOLEAN"
/>
<result
column=
"draw_open"
property=
"drawNowOpen"
jdbcType=
"BOOLEAN"
/>
<result
column=
"draw_open"
property=
"drawNowOpen"
jdbcType=
"BOOLEAN"
/>
<result
column=
"read_type_title"
property=
"readTypeTitle"
jdbcType=
"VARCHAR"
/>
</resultMap>
</resultMap>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
id, introduce, detail, count, first_classify, second_classify, grade_label_id, subject_label_id,
id, introduce, detail, count, first_classify, second_classify, grade_label_id, subject_label_id,
create_time, update_time, enable_group_service, rights_setting_type, book_id
create_time, update_time, enable_group_service, rights_setting_type, book_id
,online_course_open,learning_tool_open,draw_open
,online_course_open,learning_tool_open,draw_open
,read_type_title
</sql>
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
select
select
...
@@ -59,12 +61,12 @@
...
@@ -59,12 +61,12 @@
count, first_classify, second_classify,
count, first_classify, second_classify,
grade_label_id, subject_label_id, create_time,
grade_label_id, subject_label_id, create_time,
update_time, enable_group_service, rights_setting_type, book_id,
update_time, enable_group_service, rights_setting_type, book_id,
online_course_open,learning_tool_open,draw_open)
online_course_open,learning_tool_open,draw_open
,read_type_title
)
values ( #{introduce,jdbcType=VARCHAR}, #{detail,jdbcType=VARCHAR},
values ( #{introduce,jdbcType=VARCHAR}, #{detail,jdbcType=VARCHAR},
#{count,jdbcType=INTEGER}, #{firstClassify,jdbcType=BIGINT}, #{secondClassify,jdbcType=BIGINT},
#{count,jdbcType=INTEGER}, #{firstClassify,jdbcType=BIGINT}, #{secondClassify,jdbcType=BIGINT},
#{gradeLabelId,jdbcType=BIGINT}, #{subjectLabelId,jdbcType=BIGINT}, now(),
#{gradeLabelId,jdbcType=BIGINT}, #{subjectLabelId,jdbcType=BIGINT}, now(),
#{updateTime,jdbcType=TIMESTAMP}, #{enableGroupService}, #{rightsSettingType}, #{bookId},
#{updateTime,jdbcType=TIMESTAMP}, #{enableGroupService}, #{rightsSettingType}, #{bookId},
#{onlineCourseOpen},#{learningToolOpen},#{drawNowOpen})
#{onlineCourseOpen},#{learningToolOpen},#{drawNowOpen}
,#{readTypeTitle}
)
</insert>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.pcloud.book.rightsSetting.entity.RightsSetting"
>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.pcloud.book.rightsSetting.entity.RightsSetting"
>
update rights_setting
update rights_setting
...
@@ -131,7 +133,8 @@
...
@@ -131,7 +133,8 @@
book_id = #{bookId},
book_id = #{bookId},
online_course_open = #{onlineCourseOpen},
online_course_open = #{onlineCourseOpen},
learning_tool_open = #{learningToolOpen},
learning_tool_open = #{learningToolOpen},
draw_open = #{drawNowOpen}
draw_open = #{drawNowOpen},
read_type_title = #{readTypeTitle}
where id = #{id,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</update>
...
...
pcloud-service-book/src/main/resources/mapper/rightssetting/RightsSettingTitleMapper.xml
View file @
b83553a9
...
@@ -10,20 +10,23 @@
...
@@ -10,20 +10,23 @@
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
<result
column=
"rights_setting_now_type"
jdbcType=
"TINYINT"
property=
"rightsSettingNowType"
/>
<result
column=
"rights_setting_now_type"
jdbcType=
"TINYINT"
property=
"rightsSettingNowType"
/>
<result
column=
"easy_read"
jdbcType=
"TINYINT"
property=
"easyRead"
/>
<result
column=
"efficient_read"
jdbcType=
"TINYINT"
property=
"efficientRead"
/>
<result
column=
"deep_read"
jdbcType=
"TINYINT"
property=
"deepRead"
/>
</resultMap>
</resultMap>
<sql
id=
"baseSql"
>
<sql
id=
"baseSql"
>
id, rights_setting_id, rights_setting_title,
id, rights_setting_id, rights_setting_title,
rights_setting_desc, open_state, create_time,
rights_setting_desc, open_state, create_time,
update_time,rights_setting_now_type
update_time,rights_setting_now_type
,easy_read,efficient_read,deep_read
</sql>
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.rightsSetting.entity.RightsSettingTitle"
>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.rightsSetting.entity.RightsSettingTitle"
>
insert into rights_setting_title (id, rights_setting_id, rights_setting_title,
insert into rights_setting_title (id, rights_setting_id, rights_setting_title,
rights_setting_desc, open_state, create_time,
rights_setting_desc, open_state, create_time,
update_time,rights_setting_now_type)
update_time,rights_setting_now_type
,easy_read,efficient_read,deep_read
)
values (#{id,jdbcType=BIGINT}, #{rightsSettingId,jdbcType=BIGINT}, #{rightsSettingTitle,jdbcType=VARCHAR},
values (#{id,jdbcType=BIGINT}, #{rightsSettingId,jdbcType=BIGINT}, #{rightsSettingTitle,jdbcType=VARCHAR},
#{rightsSettingDesc,jdbcType=VARCHAR}, #{openState,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP},
#{rightsSettingDesc,jdbcType=VARCHAR}, #{openState,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP},#{rightsSettingNowType})
#{updateTime,jdbcType=TIMESTAMP},#{rightsSettingNowType}
,#{easyRead},#{efficientRead},#{deepRead}
)
</insert>
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.pcloud.book.rightsSetting.entity.RightsSettingTitle"
>
<insert
id=
"insertSelective"
parameterType=
"com.pcloud.book.rightsSetting.entity.RightsSettingTitle"
>
insert into rights_setting_title
insert into rights_setting_title
...
@@ -86,11 +89,13 @@
...
@@ -86,11 +89,13 @@
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.rightsSetting.entity.RightsSettingTitle"
>
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.rightsSetting.entity.RightsSettingTitle"
>
insert into rights_setting_title (id, rights_setting_id, rights_setting_title,
insert into rights_setting_title (id, rights_setting_id, rights_setting_title,
rights_setting_desc, open_state, create_time, update_time,rights_setting_now_type)
rights_setting_desc, open_state, create_time, update_time,rights_setting_now_type,
easy_read,efficient_read,deep_read)
values
values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(#{item.id,jdbcType=BIGINT}, #{item.rightsSettingId,jdbcType=BIGINT}, #{item.rightsSettingTitle,jdbcType=VARCHAR},
(#{item.id,jdbcType=BIGINT}, #{item.rightsSettingId,jdbcType=BIGINT}, #{item.rightsSettingTitle,jdbcType=VARCHAR},
#{item.rightsSettingDesc,jdbcType=VARCHAR}, #{item.openState,jdbcType=TINYINT}, now(), now(),#{item.rightsSettingNowType})
#{item.rightsSettingDesc,jdbcType=VARCHAR}, #{item.openState,jdbcType=TINYINT}, now(), now(),#{item.rightsSettingNowType},
#{item.easyRead},#{item.efficientRead},#{item.deepRead})
</foreach>
</foreach>
</insert>
</insert>
...
@@ -113,6 +118,21 @@
...
@@ -113,6 +118,21 @@
when id=#{item.id} then #{item.openState}
when id=#{item.id} then #{item.openState}
</foreach>
</foreach>
</trim>
</trim>
<trim
prefix=
"easy_read =case"
suffix=
"end,"
>
<foreach
collection=
"list"
item=
"item"
index=
"index"
>
when id=#{item.id} then #{item.easyRead}
</foreach>
</trim>
<trim
prefix=
"efficient_read =case"
suffix=
"end,"
>
<foreach
collection=
"list"
item=
"item"
index=
"index"
>
when id=#{item.id} then #{item.efficientRead}
</foreach>
</trim>
<trim
prefix=
"deep_read =case"
suffix=
"end,"
>
<foreach
collection=
"list"
item=
"item"
index=
"index"
>
when id=#{item.id} then #{item.deepRead}
</foreach>
</trim>
</trim>
</trim>
where id in
where id in
<foreach
collection=
"list"
index=
"index"
item=
"item"
separator=
","
open=
"("
close=
")"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
separator=
","
open=
"("
close=
")"
>
...
@@ -127,6 +147,17 @@
...
@@ -127,6 +147,17 @@
rights_setting_title
rights_setting_title
where
where
rights_setting_id = #{rightsSettingId}
rights_setting_id = #{rightsSettingId}
<choose>
<when
test=
"readType==1"
>
and easy_read=1
</when>
<when
test=
"readType==2"
>
and efficient_read=1
</when>
<when
test=
"readType==3"
>
and deep_read=1
</when>
</choose>
</select>
</select>
<select
id=
"getByRightSettingIdAndType"
resultMap=
"BaseResultMap"
parameterType=
"map"
>
<select
id=
"getByRightSettingIdAndType"
resultMap=
"BaseResultMap"
parameterType=
"map"
>
...
@@ -138,6 +169,31 @@
...
@@ -138,6 +169,31 @@
rights_setting_id = #{rightsSettingId}
rights_setting_id = #{rightsSettingId}
and
and
rights_setting_now_type = #{type}
rights_setting_now_type = #{type}
<choose>
<when
test=
"readType==1"
>
and easy_read=1
</when>
<when
test=
"readType==2"
>
and efficient_read=1
</when>
<when
test=
"readType==3"
>
and deep_read=1
</when>
</choose>
</select>
<select
id=
"getCount4Title"
resultType=
"com.pcloud.book.rightsSetting.dto.ReadTypeCountDTO"
parameterType=
"long"
>
SELECT
rights_setting_id rightsSettingId,
SUM(IFNULL(easy_read, 0)) easyReadCount,
SUM(IFNULL(efficient_read, 0)) efficientReadCount,
SUM(IFNULL(deep_read, 0)) deepReadCount
FROM
`rights_setting_title`
GROUP BY
rights_setting_id
HAVING
rights_setting_id = #{rightsSettingId};
</select>
</select>
</mapper>
</mapper>
\ 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