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
500f2e12
Commit
500f2e12
authored
Jul 27, 2020
by
桂前礼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: [1003304] 小程序首页资讯推荐栏获取当前书刊周权益资讯类型下的资讯
parent
ccf617a3
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
370 additions
and
25 deletions
+370
-25
AppletNewsBizImpl.java
...va/com/pcloud/book/applet/biz/impl/AppletNewsBizImpl.java
+33
-12
AppletUserBookcaseDao.java
...ava/com/pcloud/book/applet/dao/AppletUserBookcaseDao.java
+5
-0
AppletUserBookcaseDaoImpl.java
...cloud/book/applet/dao/impl/AppletUserBookcaseDaoImpl.java
+15
-0
AppletNewsDTO.java
...c/main/java/com/pcloud/book/applet/dto/AppletNewsDTO.java
+2
-1
AppletHomeFacade.java
.../java/com/pcloud/book/applet/facade/AppletHomeFacade.java
+3
-5
RightsSettingBiz.java
...a/com/pcloud/book/rightsSetting/biz/RightsSettingBiz.java
+7
-0
RightsSettingBizImpl.java
...oud/book/rightsSetting/biz/impl/RightsSettingBizImpl.java
+87
-3
RightsSettingDAO.java
...a/com/pcloud/book/rightsSetting/dao/RightsSettingDAO.java
+2
-0
RightsSettingItemDao.java
...m/pcloud/book/rightsSetting/dao/RightsSettingItemDao.java
+2
-2
RightsSettingDAOImpl.java
...oud/book/rightsSetting/dao/impl/RightsSettingDAOImpl.java
+5
-0
RightsSettingItemDaoImpl.java
...book/rightsSetting/dao/impl/RightsSettingItemDaoImpl.java
+4
-2
AppletNews.xml
...vice-book/src/main/resources/mapper/applet/AppletNews.xml
+117
-0
AppletUserBookcase.xml
...k/src/main/resources/mapper/applet/AppletUserBookcase.xml
+23
-0
RightsSettingItemMapper.xml
...esources/mapper/rightssetting/RightsSettingItemMapper.xml
+54
-0
RightsSettingMapper.xml
...in/resources/mapper/rightssetting/RightsSettingMapper.xml
+11
-0
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletNewsBizImpl.java
View file @
500f2e12
package
com
.
pcloud
.
book
.
applet
.
biz
.
impl
;
import
cn.hutool.core.collection.CollUtil
;
import
com.google.common.collect.Lists
;
import
com.pcloud.appcenter.assist.dto.AssistTempletDTO
;
import
com.pcloud.book.applet.biz.AppletNewsBiz
;
import
com.pcloud.book.applet.biz.AppletUserBookcaseBiz
;
import
com.pcloud.book.applet.contants.AppletConstants
;
import
com.pcloud.book.applet.dao.AppletLinkClickDao
;
import
com.pcloud.book.applet.dao.AppletNewsClassifyDao
;
import
com.pcloud.book.applet.dao.AppletNewsCommentDao
;
import
com.pcloud.book.applet.dao.AppletNewsDao
;
import
com.pcloud.book.applet.dao.AppletNewsServeDao
;
import
com.pcloud.book.applet.dao.AppletUserBookcaseDao
;
import
com.pcloud.book.applet.dto.AppletNewsClassifyDTO
;
import
com.pcloud.book.applet.dto.AppletNewsCommentDTO
;
import
com.pcloud.book.applet.dto.AppletNewsCustomTagDTO
;
...
...
@@ -23,6 +26,7 @@ import com.pcloud.book.applet.entity.AppletNewsClassifyUser;
import
com.pcloud.book.applet.entity.AppletNewsComment
;
import
com.pcloud.book.applet.entity.AppletNewsCustomTag
;
import
com.pcloud.book.applet.entity.AppletNewsServe
;
import
com.pcloud.book.applet.entity.AppletUserBookcase
;
import
com.pcloud.book.applet.enums.AppletNewsServeTypeEnum
;
import
com.pcloud.book.applet.enums.DataRecordTypeEnum
;
import
com.pcloud.book.applet.enums.DataTypeEnum
;
...
...
@@ -46,19 +50,18 @@ import com.pcloud.common.utils.NumberUtil;
import
com.pcloud.common.utils.cache.redis.JedisClusterUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.readercenter.wechat.entity.WechatUser
;
import
org.apache.commons.collections.MapUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.awt.*
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -89,6 +92,10 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
private
AppletNewsServeDao
appletNewsServeDao
;
@Autowired
private
PersonalAppletsDao
personalAppletsDao
;
@Autowired
private
AppletUserBookcaseBiz
appletUserBookcaseBiz
;
@Autowired
private
AppletUserBookcaseDao
appletUserBookcaseDao
;
@Override
public
Long
addAppletNewsClassify
(
AppletNewsClassify
appletNewsClassify
)
{
...
...
@@ -340,9 +347,23 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
@Override
public
PageBeanNew
<
AppletNewsDTO
>
listAppletNews4Wechat
(
Integer
currentPage
,
Integer
numPerPage
,
Long
newsClassifyId
,
Long
wechatUserId
)
{
PageBeanNew
<
AppletNewsDTO
>
pageBeanNew
=
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
;
PageBeanNew
<
AppletNewsDTO
>
pageBeanNew
=
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
if
(
null
==
newsClassifyId
)
{
//首页资讯
if
(
null
==
newsClassifyId
||
newsClassifyId
==
1
)
{
// 推荐栏目下的3条资讯更改为取自首页当前书刊的周权益下(资讯推送)权益分类
// 1.当周权益下未配置,直接根据当前书刊所属分类获取最新资讯,优先呈现本书有周权益配置了的资讯,其次获取本书所属分类下最新更新的。
// 2.当碰到部分无分类属性的书刊,沿用现有线上的推荐栏配置逻辑
AppletUserBookcase
userReadBook
=
appletUserBookcaseDao
.
getUserReadBook
(
wechatUserId
);
if
(
Objects
.
nonNull
(
userReadBook
))
{
// 获取周权益资讯
pageBeanNew
=
rightsSettingBiz
.
getWeekRightsSettingNewsByBookId
(
userReadBook
,
currentPage
,
numPerPage
);
if
(
CollUtil
.
isNotEmpty
(
pageBeanNew
.
getRecordList
()))
{
return
pageBeanNew
;
}
}
// WARN: 分类为 null 或者 1 时,表示首页推荐,此时,若上面方法没有查到数据,固定分页参数为[0,3]
List
<
Long
>
classifyIds
=
appletNewsClassifyDao
.
getClassifyIdsByUserId
(
wechatUserId
);
if
(
ListUtils
.
isEmpty
(
classifyIds
))
{
//没有栏目id取第一个
List
<
AppletNewsClassifyDTO
>
classifyDTOS
=
getAllNewsClassify
(
true
);
...
...
@@ -355,14 +376,14 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
paramMap
.
put
(
"newsClassifyIdList"
,
classifyIds
);
paramMap
.
put
(
"order"
,
1
);
//首页3条缓存5小时
if
(
currentPage
==
0
&&
numPerPage
==
3
){
List
<
AppletNewsDTO
>
homeList
=
JedisClusterUtils
.
getJsonList
(
AppletConstants
.
HOME_NEWS_LIST
,
AppletNewsDTO
.
class
);
if
(!
ListUtils
.
isEmpty
(
homeList
))
{
pageBeanNew
=
new
PageBeanNew
<>(
0
,
3
,
homeList
.
size
(),
homeList
);
}
else
{
pageBeanNew
=
appletNewsDao
.
listPageNew
(
new
PageParam
(
0
,
3
),
paramMap
,
"listAppletNews4Wechat"
);
JedisClusterUtils
.
setJsonList
(
AppletConstants
.
HOME_NEWS_LIST
,
pageBeanNew
.
getRecordList
(),
5
*
3600
);
}
List
<
AppletNewsDTO
>
homeList
=
JedisClusterUtils
.
getJsonList
(
AppletConstants
.
HOME_NEWS_LIST
,
AppletNewsDTO
.
class
);
if
(!
ListUtils
.
isEmpty
(
homeList
))
{
pageBeanNew
=
new
PageBeanNew
<>(
0
,
3
,
3
,
homeList
);
}
else
{
pageBeanNew
=
appletNewsDao
.
listPageNew
(
new
PageParam
(
0
,
3
),
paramMap
,
"listAppletNews4Wechat"
);
// 避免前端推荐分类分页参数生效
pageBeanNew
=
new
PageBeanNew
<>(
0
,
3
,
3
,
pageBeanNew
.
getRecordList
()
);
JedisClusterUtils
.
setJsonList
(
AppletConstants
.
HOME_NEWS_LIST
,
pageBeanNew
.
getRecordList
(),
5
*
3600
);
}
}
else
{
//栏目下的资讯
paramMap
.
put
(
"newsClassifyId"
,
newsClassifyId
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/AppletUserBookcaseDao.java
View file @
500f2e12
...
...
@@ -4,6 +4,7 @@ import com.pcloud.book.applet.dto.AppletUserBookcaseDTO;
import
com.pcloud.book.applet.dto.UserLastBookReDTO
;
import
com.pcloud.book.applet.entity.AppletUserBookcase
;
import
com.pcloud.book.applet.entity.AppletUserClickRecord
;
import
com.pcloud.book.rightsSetting.entity.BaseTempletClassify
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
...
...
@@ -98,4 +99,8 @@ public interface AppletUserBookcaseDao extends BaseDao<AppletUserBookcase> {
List
<
Long
>
getBookIdsByIds
(
List
<
Long
>
ids
);
AppletUserBookcaseDTO
getUserBookInfoByWechatUserId
(
Long
bookId
,
Long
channelId
,
Long
adviserId
);
AppletUserBookcase
getUserReadBook
(
Long
wechatUserId
);
BaseTempletClassify
getBookClassifyInfo
(
Long
bookId
,
Long
channelId
,
Long
adviserId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/impl/AppletUserBookcaseDaoImpl.java
View file @
500f2e12
...
...
@@ -5,6 +5,7 @@ import com.pcloud.book.applet.dto.AppletUserBookcaseDTO;
import
com.pcloud.book.applet.dto.UserLastBookReDTO
;
import
com.pcloud.book.applet.entity.AppletUserBookcase
;
import
com.pcloud.book.applet.entity.AppletUserClickRecord
;
import
com.pcloud.book.rightsSetting.entity.BaseTempletClassify
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
...
...
@@ -126,4 +127,18 @@ public class AppletUserBookcaseDaoImpl extends BaseDaoImpl<AppletUserBookcase> i
map
.
put
(
"bookId"
,
bookId
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getUserBookInfoByWechatUserId"
),
map
);
}
@Override
public
AppletUserBookcase
getUserReadBook
(
Long
wechatUserId
)
{
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getUserReadBook"
),
wechatUserId
);
}
@Override
public
BaseTempletClassify
getBookClassifyInfo
(
Long
bookId
,
Long
channelId
,
Long
adviserId
)
{
Map
<
String
,
Long
>
map
=
new
HashMap
<>();
map
.
put
(
"channelId"
,
channelId
);
map
.
put
(
"adviserId"
,
adviserId
);
map
.
put
(
"bookId"
,
bookId
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getBookClassifyInfo"
),
map
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dto/AppletNewsDTO.java
View file @
500f2e12
package
com
.
pcloud
.
book
.
applet
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.book.applet.entity.AppletNewsServe
;
import
com.pcloud.common.dto.BaseDto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
import
java.util.List
;
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
@ApiModel
(
"小程序资讯"
)
public
class
AppletNewsDTO
extends
BaseDto
{
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/facade/AppletHomeFacade.java
View file @
500f2e12
...
...
@@ -36,7 +36,9 @@ import com.pcloud.common.utils.NumberUtil;
import
com.pcloud.common.utils.SessionUtil
;
import
com.pcloud.common.utils.cookie.Cookie
;
import
com.pcloud.common.utils.string.StringUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.CookieValue
;
...
...
@@ -51,10 +53,6 @@ import org.springframework.web.bind.annotation.RestController;
import
java.util.List
;
import
java.util.Map
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
@Api
(
description
=
"小睿小程序首页"
)
@RestController
(
"appletHomeFacade"
)
@RequestMapping
(
"appletHome"
)
...
...
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/biz/RightsSettingBiz.java
View file @
500f2e12
package
com
.
pcloud
.
book
.
rightsSetting
.
biz
;
import
com.pcloud.book.applet.dto.AppletNewsDTO
;
import
com.pcloud.book.applet.entity.AppletUserBookcase
;
import
com.pcloud.book.rightsSetting.dto.FillRightsSettingAppletsDTO
;
import
com.pcloud.book.rightsSetting.dto.RightsSettingDto
;
import
com.pcloud.book.rightsSetting.entity.BaseTempletClassify
;
...
...
@@ -123,4 +125,9 @@ public interface RightsSettingBiz {
* * @param null
*/
void
copyRightsSetting
(
List
<
Long
>
volLabelIds
);
/**
* 根据书以及阅读方式查询周权益下的咨询
*/
PageBeanNew
<
AppletNewsDTO
>
getWeekRightsSettingNewsByBookId
(
AppletUserBookcase
userReadBook
,
Integer
currentPage
,
Integer
numPerPage
);
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/biz/impl/RightsSettingBizImpl.java
View file @
500f2e12
package
com
.
pcloud
.
book
.
rightsSetting
.
biz
.
impl
;
import
cn.hutool.core.collection.CollUtil
;
import
com.google.common.collect.Lists
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.appcenter.assist.dto.AssistTempletDTO
;
...
...
@@ -8,6 +9,7 @@ import com.pcloud.book.applet.biz.AppletGroupSearchRecordBiz;
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.AppletUserBookcaseDao
;
import
com.pcloud.book.applet.dto.AppletGroupStatementDTO
;
import
com.pcloud.book.applet.dto.AppletNewsDTO
;
import
com.pcloud.book.applet.entity.AppletNews
;
...
...
@@ -87,7 +89,6 @@ import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtilParent
;
import
com.pcloud.resourcecenter.product.dto.ProductDto
;
import
java.util.Comparator
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.MapUtils
;
...
...
@@ -97,9 +98,9 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Iterator
;
...
...
@@ -108,7 +109,6 @@ import java.util.Map;
import
java.util.Objects
;
import
java.util.Random
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
...
...
@@ -185,6 +185,10 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
private
ErpConsr
erpConsr
;
@Autowired
private
BookRaysClassifyBiz
bookRaysClassifyBiz
;
@Autowired
private
AppletUserBookcaseDao
appletUserBookcaseDao
;
@Autowired
private
RightsSettingBiz
rightsSettingBiz
;
@Override
@ParamLog
(
"新增权益设置"
)
...
...
@@ -2353,4 +2357,84 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
}
}
@Override
public
PageBeanNew
<
AppletNewsDTO
>
getWeekRightsSettingNewsByBookId
(
AppletUserBookcase
userReadBook
,
Integer
currentPage
,
Integer
numPerPage
)
{
PageBeanNew
<
AppletNewsDTO
>
appletNewsDTOS
=
new
PageBeanNew
<>();
List
<
RightsSettingDto
>
rightsSettingDtos
=
rightsSettingDAO
.
listByBookId
(
userReadBook
.
getBookId
());
if
(
CollUtil
.
isEmpty
(
rightsSettingDtos
))
{
return
getAppletNewsDTOPageBeanNew
(
userReadBook
,
currentPage
,
numPerPage
);
}
Integer
deepRead
=
null
;
Integer
easyRead
=
null
;
Integer
efficientRead
=
null
;
if
(
ReadTypeEnum
.
QS_READ
.
value
.
equals
(
userReadBook
.
getReadType
()))
{
easyRead
=
1
;
}
else
if
(
ReadTypeEnum
.
GX_READ
.
value
.
equals
(
userReadBook
.
getReadType
()))
{
efficientRead
=
1
;
}
else
if
(
ReadTypeEnum
.
SD_READ
.
value
.
equals
(
userReadBook
.
getReadType
()))
{
deepRead
=
1
;
}
// 查询书刊权益ID列表
List
<
Long
>
rightsSettingIds
=
rightsSettingDtos
.
stream
().
map
(
RightsSettingDto:
:
getId
).
collect
(
Collectors
.
toList
());
if
(
CollUtil
.
isNotEmpty
(
rightsSettingIds
))
{
Map
<
String
,
Object
>
map
=
CollUtil
.
newHashMap
(
4
);
map
.
put
(
"list"
,
rightsSettingIds
);
map
.
put
(
"deepRead"
,
deepRead
);
map
.
put
(
"easyRead"
,
easyRead
);
map
.
put
(
"efficientRead"
,
efficientRead
);
appletNewsDTOS
=
rightsSettingItemDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
map
,
"selectNewsByRightsSettingIds"
);
}
if
(
Objects
.
nonNull
(
appletNewsDTOS
)
&&
CollUtil
.
isNotEmpty
(
appletNewsDTOS
.
getRecordList
()))
{
return
appletNewsDTOS
;
}
else
{
return
getAppletNewsDTOPageBeanNew
(
userReadBook
,
currentPage
,
numPerPage
);
}
}
private
PageBeanNew
<
AppletNewsDTO
>
getAppletNewsDTOPageBeanNew
(
AppletUserBookcase
userReadBook
,
Integer
currentPage
,
Integer
numPerPage
)
{
PageBeanNew
<
AppletNewsDTO
>
appletNewsDTOS
=
new
PageBeanNew
<>();
// 查询书籍分类下对应的资讯分类
BaseTempletClassify
baseTempletClassify
=
appletUserBookcaseDao
.
getBookClassifyInfo
(
userReadBook
.
getBookId
(),
userReadBook
.
getChannelId
(),
userReadBook
.
getAdviserId
());
if
(
Objects
.
nonNull
(
baseTempletClassify
)&&
Objects
.
nonNull
(
baseTempletClassify
.
getFirstClassify
()))
{
rightsSettingBiz
.
setClassifyAndLabel
(
baseTempletClassify
);
Integer
deepRead
=
null
;
Integer
easyRead
=
null
;
Integer
efficientRead
=
null
;
if
(
ReadTypeEnum
.
QS_READ
.
value
.
equals
(
userReadBook
.
getReadType
()))
{
easyRead
=
1
;
}
else
if
(
ReadTypeEnum
.
GX_READ
.
value
.
equals
(
userReadBook
.
getReadType
()))
{
efficientRead
=
1
;
}
else
if
(
ReadTypeEnum
.
SD_READ
.
value
.
equals
(
userReadBook
.
getReadType
()))
{
deepRead
=
1
;
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"firstClassify"
,
baseTempletClassify
.
getFirstClassify
());
map
.
put
(
"secondClassify"
,
baseTempletClassify
.
getSecondClassify
());
map
.
put
(
"gradeLabelId"
,
baseTempletClassify
.
getGradeLabelId
());
map
.
put
(
"subjectLabelId"
,
baseTempletClassify
.
getSubjectLabelId
());
map
.
put
(
"deepRead"
,
deepRead
);
map
.
put
(
"easyRead"
,
easyRead
);
map
.
put
(
"efficientRead"
,
efficientRead
);
PageBeanNew
<
AppletNewsDTO
>
page
=
appletNewsDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
map
,
"getClassifyNewsByTempletLabel"
);
if
(
Objects
.
nonNull
(
page
)
&&
CollUtil
.
isNotEmpty
(
page
.
getRecordList
()))
{
appletNewsDTOS
=
page
;
}
else
{
map
.
put
(
"firstClassify"
,
baseTempletClassify
.
getFirstClassify
());
map
.
put
(
"secondClassify"
,
baseTempletClassify
.
getSecondClassify
());
map
.
put
(
"gradeLabelId"
,
baseTempletClassify
.
getGradeLabelId
());
map
.
put
(
"subjectLabelId"
,
baseTempletClassify
.
getSubjectLabelId
());
map
.
put
(
"rightsType"
,
null
);
page
=
appletNewsDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
map
,
"getPageByNewsByTempletLabel"
);
if
(
Objects
.
nonNull
(
page
)
&&
CollUtil
.
isNotEmpty
(
page
.
getRecordList
()))
{
appletNewsDTOS
=
page
;
}
}
}
return
appletNewsDTOS
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/dao/RightsSettingDAO.java
View file @
500f2e12
...
...
@@ -21,4 +21,6 @@ public interface RightsSettingDAO extends BaseDao<RightsSetting> {
RightsSettingDto
getByBookId
(
Long
bookId
);
List
<
RightsSettingDto
>
listRightsSettingPage
(
Map
<
String
,
Object
>
map
);
List
<
RightsSettingDto
>
listByBookId
(
Long
bookId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/dao/RightsSettingItemDao.java
View file @
500f2e12
package
com
.
pcloud
.
book
.
rightsSetting
.
dao
;
import
com.pcloud.book.applet.dto.AppletNewsDTO
;
import
com.pcloud.book.rightsSetting.dto.ReadTypeCountDTO
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingClassify
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingItem
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.ArrayList
;
import
java.util.Map
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* 每周/长期权益(RightsSettingItem)表数据库访问层
...
...
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/dao/impl/RightsSettingDAOImpl.java
View file @
500f2e12
...
...
@@ -52,4 +52,9 @@ public class RightsSettingDAOImpl extends BaseDaoImpl<RightsSetting> implement
public
List
<
RightsSettingDto
>
listRightsSettingPage
(
Map
<
String
,
Object
>
map
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"listRightsSettingPage"
),
map
);
}
@Override
public
List
<
RightsSettingDto
>
listByBookId
(
Long
bookId
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"listByBookId"
),
bookId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/dao/impl/RightsSettingItemDaoImpl.java
View file @
500f2e12
package
com
.
pcloud
.
book
.
rightsSetting
.
dao
.
impl
;
import
cn.hutool.core.collection.CollUtil
;
import
com.pcloud.book.applet.dto.AppletNewsDTO
;
import
com.pcloud.book.rightsSetting.dao.RightsSettingItemDao
;
import
com.pcloud.book.rightsSetting.dto.ReadTypeCountDTO
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingClassify
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingItem
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
com.pcloud.common.utils.ListUtils
;
import
java.util.ArrayList
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -93,4 +94,5 @@ public class RightsSettingItemDaoImpl extends BaseDaoImpl<RightsSettingItem> imp
map
.
put
(
"rightsSettingId"
,
rightsSettingId
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getRightSettingInfo"
),
map
);
}
}
pcloud-service-book/src/main/resources/mapper/applet/AppletNews.xml
View file @
500f2e12
...
...
@@ -551,4 +551,121 @@
ORDER BY create_time DESC
</select>
<select
id=
"getPageByNewsByTempletLabel"
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,
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,
n.url_number urlNumber,
n.show_source showSource,
n.show_link showLink
FROM applet_news n
WHERE 1=1
and n.show_state = 1
<if
test=
"firstClassify != null"
>
and n.first_classify = #{firstClassify}
</if>
<if
test=
"secondClassify != null"
>
and n.second_classify = #{secondClassify}
</if>
<if
test=
"gradeLabelId != null"
>
and n.grade_label_id = #{gradeLabelId}
</if>
<if
test=
"subjectLabelId != null"
>
and n.subject_label_id = #{subjectLabelId}
</if>
AND n.rights_classify_id IN(
SELECT id FROM rights_setting_classify WHERE 1=1
<if
test=
"rightsType != null"
>
AND rights_type = #{rightsType}
</if>
)
<choose>
<when
test=
"agentId >0"
>
and n.agent_id in (#{agentId} ,0)
</when>
<otherwise>
and n.agent_id = 0
</otherwise>
</choose>
ORDER BY n.agent_id desc, n.create_time DESC
</select>
<select
id=
"getClassifyNewsByTempletLabel"
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,
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,
n.url_number urlNumber,
n.show_source showSource,
n.show_link showLink
FROM
applet_news n
LEFT JOIN rights_setting_item_detail d ON d.serve_id = n.id
LEFT JOIN rights_setting_item i ON d.rights_setting_item_id = i.id
LEFT JOIN rights_setting s ON s.id = i.rights_setting_id
WHERE
s.rights_setting_type = 1 AND i.open_state = 1 AND i.rights_type = 'WEEK' AND i.rights_classify_id = 10 AND d.serve_type = 'NEWS'
<if
test=
"firstClassify != null"
>
and s.first_classify = #{firstClassify}
</if>
<if
test=
"secondClassify != null"
>
and s.second_classify = #{secondClassify}
</if>
<if
test=
"gradeLabelId != null"
>
and s.grade_label_id = #{gradeLabelId}
</if>
<if
test=
"subjectLabelId != null"
>
and s.subject_label_id = #{subjectLabelId}
</if>
<if
test=
"deepRead!=null"
>
AND i.deep_read = #{deepRead}
</if>
<if
test=
"easyRead!=null"
>
AND i.easy_read = #{easyRead}
</if>
<if
test=
"efficientRead!=null"
>
AND i.efficient_read = #{efficientRead}
</if>
ORDER BY n.create_time DESC
</select>
</mapper>
pcloud-service-book/src/main/resources/mapper/applet/AppletUserBookcase.xml
View file @
500f2e12
...
...
@@ -260,4 +260,26 @@
LIMIT 1
</select>
<select
id=
"getUserReadBook"
parameterType=
"long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from applet_user_bookcase where wechat_user_id = #{wechatUserId} order by create_time desc limit 1
</select>
<select
id=
"getBookClassifyInfo"
parameterType=
"map"
resultType=
"com.pcloud.book.rightsSetting.entity.BaseTempletClassify"
>
SELECT b.TEMPLET_ID firstClassify,
b.SECOND_TEMPLET_ID secondClassify,
b.GRA_LABEL_ID gradeLabelId,
b.SUB_LABEL_ID subjectLabelId,
b.vol_label_id volLabelId
FROM applet_user_bookcase a
LEFT JOIN book_adviser b ON a.book_id = b.BOOK_ID
AND a.channel_id = b.CHANNEL_ID
AND a.adviser_id = b.ADVISER_ID
WHERE b.IS_DELETE = 0
AND a.book_id = #{bookId}
AND a.channel_id = #{channelId}
AND a.adviser_id = #{adviserId}
ORDER BY a.create_time DESC
LIMIT 1
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/rightssetting/RightsSettingItemMapper.xml
View file @
500f2e12
...
...
@@ -218,4 +218,57 @@
</if>
</select>
<select
id=
"selectNewsByRightsSettingIds"
parameterType=
"map"
resultType=
"com.pcloud.book.applet.dto.AppletNewsDTO"
>
SELECT
distinct c.id AS id,
c.news_name AS newsName,
c.source AS source,
c.news_classify_id AS newsClassifyId,
c.pro_label_id AS proLabelId,
c.dep_label_id AS depLabelId,
c.pur_label_id AS purLabelId,
c.type AS type,
c.digest AS digest,
c.pic1 AS pic1,
c.pic2 AS pic2,
c.pic3 AS pic3,
c.content AS content,
c.show_state AS showState,
c.create_time AS createTime,
c.first_classify AS firstClassify,
c.second_classify AS secondClassify,
c.grade_label_id AS gradeLabelId,
c.subject_label_id AS subjectLabelId,
c.rights_classify_id AS rightsClassifyId,
c.jump_type AS jumpType,
c.jump_url AS jumpUrl,
c.url_number AS urlNumber,
c.custom_tag_id AS customTagId,
c.show_source AS showSource,
c.show_link AS showLink
FROM
rights_setting_item a
LEFT JOIN rights_setting_item_detail b ON a.id = b.rights_setting_item_id
RIGHT JOIN applet_news c ON c.id = b.serve_id
WHERE
b.serve_type = 'NEWS'
AND a.rights_type ='WEEK'
AND a.open_state = 1
AND a.rights_classify_id = 10
<if
test=
"deepRead!=null"
>
AND a.deep_read = #{deepRead}
</if>
<if
test=
"easyRead!=null"
>
AND a.easy_read = #{easyRead}
</if>
<if
test=
"efficientRead!=null"
>
AND a.efficient_read = #{efficientRead}
</if>
AND rights_setting_id IN
<foreach
collection=
"list"
item=
"item"
separator=
","
open=
"("
close=
")"
>
${item}
</foreach>
order by c.create_time
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/rightssetting/RightsSettingMapper.xml
View file @
500f2e12
...
...
@@ -248,4 +248,14 @@
limit 1
</select>
<select
id=
"listByBookId"
parameterType=
"map"
resultMap=
"DtoResultMap"
>
select
<include
refid=
"Base_Column_List_own"
/>
from
rights_setting r
left join rights_setting_book_relation b on r.id = b.rights_setting_id
WHERE b.book_id = #{bookId}
and rights_setting_type = 2
</select>
</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