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
ac20bae8
Commit
ac20bae8
authored
May 28, 2021
by
朱亚洁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:[1004709]小睿H5完整版
parent
931ba96a
Hide whitespace changes
Inline
Side-by-side
Showing
111 changed files
with
3469 additions
and
535 deletions
+3469
-535
AnswerSubscribeUserDTO.java
...va/com/pcloud/book/applet/dto/AnswerSubscribeUserDTO.java
+37
-0
AppletOuterBooklistDTO.java
...va/com/pcloud/book/applet/dto/AppletOuterBooklistDTO.java
+6
-0
AppletThirdResources.java
...a/com/pcloud/book/applet/entity/AppletThirdResources.java
+7
-0
AppletService.java
...in/java/com/pcloud/book/applet/service/AppletService.java
+5
-0
BookGroupService.java
.../java/com/pcloud/book/group/service/BookGroupService.java
+5
-0
AnswerSubscribeBiz.java
...n/java/com/pcloud/book/applet/biz/AnswerSubscribeBiz.java
+11
-1
AppletBannerBiz.java
...main/java/com/pcloud/book/applet/biz/AppletBannerBiz.java
+8
-0
AppletBooklistBiz.java
...in/java/com/pcloud/book/applet/biz/AppletBooklistBiz.java
+8
-0
AppletRecordAggrStatisBiz.java
...com/pcloud/book/applet/biz/AppletRecordAggrStatisBiz.java
+16
-0
AppletRecordBiz.java
...main/java/com/pcloud/book/applet/biz/AppletRecordBiz.java
+2
-2
AppletResourceApplyBiz.java
...va/com/pcloud/book/applet/biz/AppletResourceApplyBiz.java
+30
-0
AppletThirdResourcesBiz.java
...a/com/pcloud/book/applet/biz/AppletThirdResourcesBiz.java
+9
-0
AppletUserBookcaseBiz.java
...ava/com/pcloud/book/applet/biz/AppletUserBookcaseBiz.java
+4
-4
ServeCollectBiz.java
...main/java/com/pcloud/book/applet/biz/ServeCollectBiz.java
+3
-3
AnswerSubscribeBizImpl.java
...m/pcloud/book/applet/biz/impl/AnswerSubscribeBizImpl.java
+89
-2
AppletBannerBizImpl.java
.../com/pcloud/book/applet/biz/impl/AppletBannerBizImpl.java
+45
-2
AppletBooklistBizImpl.java
...om/pcloud/book/applet/biz/impl/AppletBooklistBizImpl.java
+41
-0
AppletGroupSearchRecordBizImpl.java
.../book/applet/biz/impl/AppletGroupSearchRecordBizImpl.java
+2
-1
AppletRecordAggrStatisBizImpl.java
...d/book/applet/biz/impl/AppletRecordAggrStatisBizImpl.java
+100
-3
AppletRecordBizImpl.java
.../com/pcloud/book/applet/biz/impl/AppletRecordBizImpl.java
+20
-4
AppletResourceApplyBizImpl.java
...loud/book/applet/biz/impl/AppletResourceApplyBizImpl.java
+72
-0
AppletThirdResourcesBizImpl.java
...oud/book/applet/biz/impl/AppletThirdResourcesBizImpl.java
+68
-9
AppletUserBookcaseBizImpl.java
...cloud/book/applet/biz/impl/AppletUserBookcaseBizImpl.java
+79
-109
ServeCollectBizImpl.java
.../com/pcloud/book/applet/biz/impl/ServeCollectBizImpl.java
+10
-6
AppletResourceApplyConstants.java
...ud/book/applet/contants/AppletResourceApplyConstants.java
+91
-0
AnswerSubscribePopupDao.java
...a/com/pcloud/book/applet/dao/AnswerSubscribePopupDao.java
+24
-0
AppletRecordSevenDayDao.java
...a/com/pcloud/book/applet/dao/AppletRecordSevenDayDao.java
+21
-0
AppletResourceApplyDao.java
...va/com/pcloud/book/applet/dao/AppletResourceApplyDao.java
+50
-0
AppletUserBookcaseDao.java
...ava/com/pcloud/book/applet/dao/AppletUserBookcaseDao.java
+3
-3
ServeCollectDao.java
...main/java/com/pcloud/book/applet/dao/ServeCollectDao.java
+2
-2
AnswerSubscribePopupDaoImpl.java
...oud/book/applet/dao/impl/AnswerSubscribePopupDaoImpl.java
+22
-0
AppletRecordSevenDayDaoImpl.java
...oud/book/applet/dao/impl/AppletRecordSevenDayDaoImpl.java
+36
-0
AppletResourceApplyDaoImpl.java
...loud/book/applet/dao/impl/AppletResourceApplyDaoImpl.java
+53
-0
AppletUserBookcaseDaoImpl.java
...cloud/book/applet/dao/impl/AppletUserBookcaseDaoImpl.java
+6
-6
ServeCollectDaoImpl.java
.../com/pcloud/book/applet/dao/impl/ServeCollectDaoImpl.java
+4
-4
AddResourceApplyDTO.java
.../java/com/pcloud/book/applet/dto/AddResourceApplyDTO.java
+30
-0
AnswerSubscribeDTO.java
...n/java/com/pcloud/book/applet/dto/AnswerSubscribeDTO.java
+14
-0
AppletBannerDTO.java
...main/java/com/pcloud/book/applet/dto/AppletBannerDTO.java
+4
-0
AppletRecordDTO.java
...main/java/com/pcloud/book/applet/dto/AppletRecordDTO.java
+13
-0
AppletThirdResourcesDTO.java
...a/com/pcloud/book/applet/dto/AppletThirdResourcesDTO.java
+6
-0
UserLastBookReDTO.java
...in/java/com/pcloud/book/applet/dto/UserLastBookReDTO.java
+2
-8
AnswerSubscribePopup.java
...a/com/pcloud/book/applet/entity/AnswerSubscribePopup.java
+49
-0
AppletBanner.java
...main/java/com/pcloud/book/applet/entity/AppletBanner.java
+3
-0
AppletLinkClick.java
...n/java/com/pcloud/book/applet/entity/AppletLinkClick.java
+10
-6
AppletRecordSevenDay.java
...a/com/pcloud/book/applet/entity/AppletRecordSevenDay.java
+71
-0
AppletResourceApply.java
...va/com/pcloud/book/applet/entity/AppletResourceApply.java
+41
-0
AppletThirdResourcesClick.java
.../pcloud/book/applet/entity/AppletThirdResourcesClick.java
+3
-0
AppletUserBookcase.java
...ava/com/pcloud/book/applet/entity/AppletUserBookcase.java
+2
-0
AppletHomeFacade.java
.../java/com/pcloud/book/applet/facade/AppletHomeFacade.java
+42
-6
AppletRecordAggrStatisFacade.java
...loud/book/applet/facade/AppletRecordAggrStatisFacade.java
+21
-0
AppletRecordFacade.java
...ava/com/pcloud/book/applet/facade/AppletRecordFacade.java
+4
-2
AppletThirdResourcesFacade.java
...pcloud/book/applet/facade/AppletThirdResourcesFacade.java
+18
-1
ServeCollectFacade.java
...ava/com/pcloud/book/applet/facade/ServeCollectFacade.java
+7
-4
AppletServiceImpl.java
...om/pcloud/book/applet/service/impl/AppletServiceImpl.java
+12
-1
BookSet.java
...-book/src/main/java/com/pcloud/book/book/set/BookSet.java
+3
-30
BrowseRecordConsr.java
...cloud/book/consumer/analysisengine/BrowseRecordConsr.java
+13
-0
QrcodeSceneConsr.java
...va/com/pcloud/book/consumer/channel/QrcodeSceneConsr.java
+12
-0
ReaderConsr.java
...ain/java/com/pcloud/book/consumer/reader/ReaderConsr.java
+64
-0
ESBookAndAdviserBizImpl.java
.../com/pcloud/book/es/biz/impl/ESBookAndAdviserBizImpl.java
+5
-42
ESBookAndAdviserFacade.java
...ava/com/pcloud/book/es/facade/ESBookAndAdviserFacade.java
+8
-0
BookGroupBiz.java
...src/main/java/com/pcloud/book/group/biz/BookGroupBiz.java
+1
-1
ResourcePageBiz.java
.../main/java/com/pcloud/book/group/biz/ResourcePageBiz.java
+108
-3
WeworkTeacherBiz.java
...main/java/com/pcloud/book/group/biz/WeworkTeacherBiz.java
+16
-0
BookGroupBizImpl.java
...java/com/pcloud/book/group/biz/impl/BookGroupBizImpl.java
+8
-24
ResourcePageBizImpl.java
...a/com/pcloud/book/group/biz/impl/ResourcePageBizImpl.java
+301
-108
WeworkTeacherBizImpl.java
.../com/pcloud/book/group/biz/impl/WeworkTeacherBizImpl.java
+42
-0
ResourcePageConstants.java
...com/pcloud/book/group/constant/ResourcePageConstants.java
+140
-0
ResourcePageCollectDao.java
...ava/com/pcloud/book/group/dao/ResourcePageCollectDao.java
+9
-0
ResourcePageCourseDao.java
...java/com/pcloud/book/group/dao/ResourcePageCourseDao.java
+20
-0
ResourcePageDao.java
.../main/java/com/pcloud/book/group/dao/ResourcePageDao.java
+24
-15
ResourcePageItemDao.java
...n/java/com/pcloud/book/group/dao/ResourcePageItemDao.java
+15
-0
ResourcePageToolDao.java
...n/java/com/pcloud/book/group/dao/ResourcePageToolDao.java
+20
-0
ResourcePageCollectDaoImpl.java
...cloud/book/group/dao/impl/ResourcePageCollectDaoImpl.java
+5
-0
ResourcePageCourseDaoImpl.java
...pcloud/book/group/dao/impl/ResourcePageCourseDaoImpl.java
+32
-0
ResourcePageDaoImpl.java
...a/com/pcloud/book/group/dao/impl/ResourcePageDaoImpl.java
+29
-10
ResourcePageItemDaoImpl.java
...m/pcloud/book/group/dao/impl/ResourcePageItemDaoImpl.java
+17
-0
ResourcePageToolDaoImpl.java
...m/pcloud/book/group/dao/impl/ResourcePageToolDaoImpl.java
+26
-0
ResourcePageCourseDTO.java
...java/com/pcloud/book/group/dto/ResourcePageCourseDTO.java
+50
-0
ResourcePageUrlDTO.java
...in/java/com/pcloud/book/group/dto/ResourcePageUrlDTO.java
+20
-0
ResourcePage.java
.../main/java/com/pcloud/book/group/entity/ResourcePage.java
+9
-0
ResourcePageCollect.java
...ava/com/pcloud/book/group/entity/ResourcePageCollect.java
+5
-1
ResourcePageCourse.java
...java/com/pcloud/book/group/entity/ResourcePageCourse.java
+69
-0
ResourcePageTool.java
...n/java/com/pcloud/book/group/entity/ResourcePageTool.java
+31
-0
BookGroupFacadeImpl.java
...om/pcloud/book/group/facade/impl/BookGroupFacadeImpl.java
+2
-1
ResourcePageFacade.java
...com/pcloud/book/group/facade/impl/ResourcePageFacade.java
+64
-4
WeworkTeacherFacadeImpl.java
...cloud/book/group/facade/impl/WeworkTeacherFacadeImpl.java
+24
-0
WeworkTeacherMapper.java
...ava/com/pcloud/book/group/mapper/WeworkTeacherMapper.java
+8
-0
BookGroupServiceImpl.java
.../pcloud/book/group/service/impl/BookGroupServiceImpl.java
+7
-0
WeworkTeacherVO.java
...c/main/java/com/pcloud/book/group/vo/WeworkTeacherVO.java
+4
-0
AppletRecordCHMapper.java
...m/pcloud/book/mapper/clickhouse/AppletRecordCHMapper.java
+3
-0
BookProps.java
.../main/java/com/pcloud/book/util/properties/BookProps.java
+11
-0
AppletRecordCHMapper.xml
...main/resources/clickhouse/applet/AppletRecordCHMapper.xml
+38
-0
AnswerSubscribePopupDao.xml
.../main/resources/mapper/applet/AnswerSubscribePopupDao.xml
+77
-0
AppletBanner.xml
...ce-book/src/main/resources/mapper/applet/AppletBanner.xml
+26
-0
AppletLinkClickMapper.xml
...rc/main/resources/mapper/applet/AppletLinkClickMapper.xml
+5
-2
AppletOuterBooklistDao.xml
...c/main/resources/mapper/applet/AppletOuterBooklistDao.xml
+25
-0
AppletRecordDayServe.Mapper.xml
...n/resources/mapper/applet/AppletRecordDayServe.Mapper.xml
+9
-3
AppletRecordServe.Mapper.xml
...main/resources/mapper/applet/AppletRecordServe.Mapper.xml
+9
-3
AppletRecordSevenDayDao.xml
.../main/resources/mapper/applet/AppletRecordSevenDayDao.xml
+129
-0
AppletResourceApplyDao.xml
...c/main/resources/mapper/applet/AppletResourceApplyDao.xml
+100
-0
AppletThirdResources.xml
...src/main/resources/mapper/applet/AppletThirdResources.xml
+21
-0
AppletThirdResourcesClickMapper.xml
...sources/mapper/applet/AppletThirdResourcesClickMapper.xml
+5
-2
AppletUserBookcase.xml
...k/src/main/resources/mapper/applet/AppletUserBookcase.xml
+55
-35
ServeCollect.Mapper.xml
.../src/main/resources/mapper/applet/ServeCollect.Mapper.xml
+15
-6
BookAdviser.Mapper.xml
...ook/src/main/resources/mapper/book/BookAdviser.Mapper.xml
+1
-1
ResourcePageCollectDao.xml
...rc/main/resources/mapper/group/ResourcePageCollectDao.xml
+15
-3
ResourcePageCourseDao.xml
...src/main/resources/mapper/group/ResourcePageCourseDao.xml
+137
-0
ResourcePageDao.xml
...-book/src/main/resources/mapper/group/ResourcePageDao.xml
+67
-51
ResourcePageItemDao.xml
...k/src/main/resources/mapper/group/ResourcePageItemDao.xml
+44
-1
ResourcePageToolDao.xml
...k/src/main/resources/mapper/group/ResourcePageToolDao.xml
+68
-0
WeworkTeacherMapper.xml
...k/src/main/resources/mapper/group/WeworkTeacherMapper.xml
+57
-0
No files found.
pcloud-facade-book/src/main/java/com/pcloud/book/applet/dto/AnswerSubscribeUserDTO.java
0 → 100644
View file @
ac20bae8
package
com
.
pcloud
.
book
.
applet
.
dto
;
import
com.pcloud.common.dto.BaseDto
;
import
lombok.Data
;
/**
* @ClassName com.pcloud.book.applet.dto.AnswerSubscribeUserDTO
* @Author zhuyajie
* @Description 用户书刊订阅信息
* @Date 2021/5/14 16:36
* @Version 1.0
**/
@Data
public
class
AnswerSubscribeUserDTO
extends
BaseDto
{
/**
* 书刊id
*/
private
Long
bookId
;
/**
* 渠道id
*/
private
Long
channelId
;
/**
* 编辑id
*/
private
Long
adviserId
;
/**
* 图书名称
*/
private
String
bookName
;
/**
* H5页面链接
*/
private
String
url
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/applet/dto/AppletOuterBooklistDTO.java
View file @
ac20bae8
...
...
@@ -7,6 +7,7 @@ import com.pcloud.common.entity.BaseEntity;
import
java.util.Date
;
import
java.util.List
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
...
...
@@ -66,4 +67,8 @@ public class AppletOuterBooklistDTO extends BaseDto {
* 书单推荐是否在小程序首页展示
*/
private
Integer
isShowHome
;
@ApiModelProperty
(
"适用人群类型"
)
private
List
<
Integer
>
crowdTypeList
;
}
\ No newline at end of file
pcloud-facade-book/src/main/java/com/pcloud/book/applet/entity/AppletThirdResources.java
View file @
ac20bae8
...
...
@@ -69,4 +69,10 @@ public class AppletThirdResources extends BaseEntity {
@ApiModelProperty
(
"小程序原始id"
)
private
String
baseAppId
;
@ApiModelProperty
(
"适用人群类型"
)
private
List
<
Integer
>
crowdTypeList
;
@ApiModelProperty
(
"内容类型"
)
private
List
<
Integer
>
contentTypeList
;
}
\ No newline at end of file
pcloud-facade-book/src/main/java/com/pcloud/book/applet/service/AppletService.java
View file @
ac20bae8
package
com
.
pcloud
.
book
.
applet
.
service
;
import
com.pcloud.book.applet.dto.AnswerSubscribeUserDTO
;
import
com.pcloud.book.applet.dto.AppletAppOrProductDTO
;
import
com.pcloud.book.applet.dto.AppletNewsDTO
;
import
com.pcloud.book.applet.dto.AppletNewsVO
;
...
...
@@ -144,4 +145,8 @@ public interface AppletService {
@RequestMapping
(
"getSameClassifyUserIds"
)
ResponseEntity
<
ResponseDto
<
List
<
Long
>>>
getSameClassifyUserIds
(
@RequestBody
List
<
Long
>
wechatUserIds
);
@ApiOperation
(
"查询用户书刊订阅信息"
)
@GetMapping
(
"getUserSubscribeInfo"
)
ResponseEntity
<
ResponseDto
<
AnswerSubscribeUserDTO
>>
getUserSubscribeInfo
(
@RequestParam
(
"wechatUserId"
)
Long
wechatUserId
);
}
pcloud-facade-book/src/main/java/com/pcloud/book/group/service/BookGroupService.java
View file @
ac20bae8
...
...
@@ -277,4 +277,9 @@ public interface BookGroupService {
@ApiOperation
(
"获取所有编辑书籍"
)
ResponseEntity
<
ResponseDto
<
PageBeanNew
<
BookGroupDTO
>>>
getAllRaysScene
(
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
Integer
numPerPage
);
@ApiOperation
(
"二维码是否开启小睿"
)
@GetMapping
(
"isOpenRaysScene"
)
ResponseEntity
<
ResponseDto
<
Boolean
>>
isOpenRaysScene
(
@RequestParam
(
value
=
"sceneId"
,
required
=
false
)
Long
sceneId
,
@RequestParam
(
value
=
"bookGroupId"
,
required
=
false
)
Long
bookGroupId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/AnswerSubscribeBiz.java
View file @
ac20bae8
package
com
.
pcloud
.
book
.
applet
.
biz
;
import
com.pcloud.book.applet.dto.AnswerSubscribeDTO
;
import
com.pcloud.book.applet.dto.AnswerSubscribeUserDTO
;
import
java.util.Map
;
...
...
@@ -12,7 +13,7 @@ public interface AnswerSubscribeBiz {
* @date:2020/9/16 16:24
* * @param null
*/
void
answerSubscribe
(
AnswerSubscribeDTO
answerSubscribeDTO
);
AnswerSubscribeDTO
answerSubscribe
(
AnswerSubscribeDTO
answerSubscribeDTO
);
/**
* 查询是否订阅
...
...
@@ -42,4 +43,13 @@ public interface AnswerSubscribeBiz {
* @param answerSubscribeDTO
*/
void
cancelAnswerSubscribe
(
AnswerSubscribeDTO
answerSubscribeDTO
);
/**
* 查用户订阅信息
* @author:zhuyajie
* @date:2021/5/14 16:41
* * @param null
*/
AnswerSubscribeUserDTO
getUserSubscribeInfo
(
Long
wechatUserId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/AppletBannerBiz.java
View file @
ac20bae8
...
...
@@ -75,4 +75,12 @@ public interface AppletBannerBiz {
* @param showState
*/
void
autoChageBannerState
(
Long
id
,
Integer
showState
);
/**
* H5首页-banner列表
* @author:zhuyajie
* @date:2021/5/11 16:05
* * @param null
*/
PageBeanNew
<
AppletBannerDTO
>
getBannerByGradeLabel4ResourcePage
(
Long
gradeLabelId
,
Integer
currentPage
,
Integer
numPerPage
);
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/AppletBooklistBiz.java
View file @
ac20bae8
...
...
@@ -311,4 +311,12 @@ public interface AppletBooklistBiz {
* * @param null
*/
Map
<
Long
,
AppletOuterBooklistDTO
>
getBooklistInfoByIds
(
List
<
Long
>
booklistIds
);
/**
* H5首页-精选书单
* @author:zhuyajie
* @date:2021/5/11 15:33
* * @param null
*/
PageBeanNew
<
AppletOuterBooklistDTO
>
getBooklistByGradeLabel4ResourcePage
(
Long
gradeLabelId
,
Integer
currentPage
,
Integer
numPerPage
);
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/AppletRecordAggrStatisBiz.java
View file @
ac20bae8
...
...
@@ -21,4 +21,20 @@ public interface AppletRecordAggrStatisBiz {
* 同步数据并更新缓存
*/
void
syncDataAndUpdateCache
(
String
date
);
/**
* 更新H5资源广场
* @author:zhuyajie
* @date:2021/5/13 15:31
* * @param null
*/
void
updateH5Resource
();
/**
* H5资源页
* @author:zhuyajie
* @date:2021/5/13 15:33
* * @param null
*/
PageBeanNew
getResource4H5
(
Long
wechatUserId
,
Long
officialAccountsId
,
String
keyword
,
Integer
sourceType
,
Integer
currentPage
,
Integer
numPerPage
);
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/AppletRecordBiz.java
View file @
ac20bae8
...
...
@@ -65,7 +65,7 @@ public interface AppletRecordBiz {
* @param typeName
* @return
*/
PageBeanNew
<
AppletRecordDTO
>
listAppletRecord
(
Long
wechatUserId
,
String
date
,
List
<
Integer
>
recordTypes
,
String
queryName
,
Integer
currentPage
,
Integer
numPerPage
,
String
typeName
);
PageBeanNew
<
AppletRecordDTO
>
listAppletRecord
(
Long
wechatUserId
,
String
date
,
List
<
Integer
>
recordTypes
,
String
queryName
,
Integer
currentPage
,
Integer
numPerPage
,
String
typeName
,
Long
officialAccountsId
);
List
<
String
>
listUnreachableDate
(
Long
wechatUserId
);
...
...
@@ -89,7 +89,7 @@ public interface AppletRecordBiz {
* @param date
* @return
*/
List
<
AppletRecordDTO
>
getAppletRecordCatalogue
(
Long
wechatUserId
,
String
date
);
List
<
AppletRecordDTO
>
getAppletRecordCatalogue
(
Long
wechatUserId
,
String
date
,
Long
officialAccountsId
);
/**
* 手动处理应用作品和资讯的typeCode
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/AppletResourceApplyBiz.java
0 → 100644
View file @
ac20bae8
package
com
.
pcloud
.
book
.
applet
.
biz
;
import
com.pcloud.book.applet.dto.AddResourceApplyDTO
;
import
java.util.List
;
public
interface
AppletResourceApplyBiz
{
/**
* 添加适用范围
* @author:zhuyajie
* @date:2021/5/8 15:13
* * @param null
*/
void
addResourceApply
(
AddResourceApplyDTO
addResourceApplyDTO
);
/**
* 查适用人群
* @author:zhuyajie
* @date:2021/5/8 15:47
* * @param null
*/
List
<
Integer
>
getCrowdTypeList
(
Long
targetId
,
String
targetType
);
/**
* 查内容类型
* @author:zhuyajie
* @date:2021/5/8 15:47
* * @param null
*/
List
<
Integer
>
getContentTypeList
(
Long
targetId
,
String
targetType
);
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/AppletThirdResourcesBiz.java
View file @
ac20bae8
...
...
@@ -38,4 +38,13 @@ public interface AppletThirdResourcesBiz {
Map
<
Long
,
AppletThirdResources
>
getAppletMapByIds
(
List
<
Long
>
list
);
List
<
AppletThirdResources
>
getThirdResourcesByNewsId
(
Long
newsId
);
/**
* H5资源页-我的-为你推荐
* @author:zhuyajie
* @date:2021/5/11 11:02
* * @param null
*/
PageBeanNew
<
AppletThirdResources
>
getThirdResourcesByGradeLabel4ResourcePage
(
Long
gradeLabelId
,
Integer
currentPage
,
Integer
numPerPage
);
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/AppletUserBookcaseBiz.java
View file @
ac20bae8
...
...
@@ -30,7 +30,7 @@ public interface AppletUserBookcaseBiz {
* @param numPerPage
* @return
*/
PageBeanNew
<
AppletUserBookcaseDTO
>
listByWechatUserId
(
Long
wechatUserId
,
Integer
currentPage
,
Integer
numPerPage
);
PageBeanNew
<
AppletUserBookcaseDTO
>
listByWechatUserId
(
Long
wechatUserId
,
Integer
currentPage
,
Integer
numPerPage
,
Long
officialAccountsId
);
/**
* 新增用户资源点击记录
...
...
@@ -47,7 +47,7 @@ public interface AppletUserBookcaseBiz {
Map
<
String
,
Object
>
getUserClickStatistic
(
Long
wechatUserId
,
Long
bookId
,
Long
channelId
,
Long
adviserId
);
UserLastBookReDTO
getUserLastBookRe
(
Long
wechatUserId
);
UserLastBookReDTO
getUserLastBookRe
(
Long
wechatUserId
,
Long
officialAccountsId
);
/**
* 批量删除
...
...
@@ -55,7 +55,7 @@ public interface AppletUserBookcaseBiz {
* @date:2020/5/11 16:06
* * @param null
*/
void
deleteByIds
(
List
<
Long
>
ids
,
Long
wechatUserId
);
void
deleteByIds
(
List
<
Long
>
ids
,
Long
wechatUserId
,
Long
officialAccountsId
);
/**
* 更新读者关于本书的阅读方式
...
...
@@ -87,7 +87,7 @@ public interface AppletUserBookcaseBiz {
* @date:2020/5/29 13:11
* * @param null
*/
List
<
Long
>
getBookcaseIdListByUser
(
Long
wechatUserId
);
List
<
Long
>
getBookcaseIdListByUser
(
Long
wechatUserId
,
Long
officialAccountsId
);
/**
* 书刊访问量
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/ServeCollectBiz.java
View file @
ac20bae8
...
...
@@ -28,7 +28,7 @@ public interface ServeCollectBiz {
/**
* 分页查询
*/
PageBeanNew
getList
(
Long
wechatUserId
,
Integer
currentPage
,
Integer
numPerPage
,
String
typeCode
);
PageBeanNew
getList
(
Long
wechatUserId
,
Integer
currentPage
,
Integer
numPerPage
,
String
typeCode
,
Long
officialAccountsId
);
/**
* 新增数据
...
...
@@ -77,7 +77,7 @@ public interface ServeCollectBiz {
* @param wechatUserId
* @return
*/
List
<
Long
>
getAllCollect
(
Long
wechatUserId
,
String
typeCode
);
List
<
Long
>
getAllCollect
(
Long
wechatUserId
,
String
typeCode
,
Long
officialAccountsId
);
/**
* 查询收藏情况
...
...
@@ -93,7 +93,7 @@ public interface ServeCollectBiz {
* @param wechatUserId
* @return
*/
List
<
CollectionTypeNameAndCountDTO
>
getTypeNameAndCountByWechatId
(
Long
wechatUserId
);
List
<
CollectionTypeNameAndCountDTO
>
getTypeNameAndCountByWechatId
(
Long
wechatUserId
,
Long
officialAccountsId
);
/**
* 分类分页查询
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AnswerSubscribeBizImpl.java
View file @
ac20bae8
...
...
@@ -3,18 +3,25 @@ package com.pcloud.book.applet.biz.impl;
import
com.pcloud.book.applet.biz.AnswerSubscribeBiz
;
import
com.pcloud.book.applet.dao.AnswerSubscribeAdviserDao
;
import
com.pcloud.book.applet.dao.AnswerSubscribeDao
;
import
com.pcloud.book.applet.dao.AnswerSubscribePopupDao
;
import
com.pcloud.book.applet.dto.AnswerSubscribeCountDto
;
import
com.pcloud.book.applet.dto.AnswerSubscribeDTO
;
import
com.pcloud.book.applet.dto.AnswerSubscribeUserDTO
;
import
com.pcloud.book.applet.entity.AnswerSubscribe
;
import
com.pcloud.book.applet.entity.AnswerSubscribeAdviser
;
import
com.pcloud.book.applet.entity.AnswerSubscribePopup
;
import
com.pcloud.book.applet.enums.AnswerSendStateEnum
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.biz.BookBiz
;
import
com.pcloud.book.book.dto.BookDto
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.consumer.message.TemplateConsr
;
import
com.pcloud.book.consumer.reader.ReaderConsr
;
import
com.pcloud.book.consumer.user.AdviserConsr
;
import
com.pcloud.book.group.biz.ResourcePageBiz
;
import
com.pcloud.book.group.vo.ResourcePageVO
;
import
com.pcloud.book.util.properties.BookProps
;
import
com.pcloud.channelcenter.qrcode.dto.GroupQrcodeVO
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.constant.SceneCode
;
import
com.pcloud.common.core.constant.SendType
;
...
...
@@ -23,6 +30,7 @@ import com.pcloud.common.core.dto.AppletTemplateMessageDto;
import
com.pcloud.common.utils.DateUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.readercenter.wechat.entity.WechatUserOfficialAccounts
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -58,21 +66,62 @@ public class AnswerSubscribeBizImpl implements AnswerSubscribeBiz {
private
AnswerSubscribeAdviserDao
answerSubscribeAdviserDao
;
@Autowired
private
ResourcePageBiz
resourcePageBiz
;
@Autowired
private
AnswerSubscribePopupDao
answerSubscribePopupDao
;
@Autowired
private
QrcodeSceneConsr
qrcodeSceneConsr
;
@Autowired
private
ReaderConsr
readerConsr
;
@Override
public
void
answerSubscribe
(
AnswerSubscribeDTO
answerSubscribeDTO
)
{
public
AnswerSubscribeDTO
answerSubscribe
(
AnswerSubscribeDTO
answerSubscribeDTO
)
{
if
(
null
==
answerSubscribeDTO
.
getBookId
()
||
null
==
answerSubscribeDTO
.
getAdviserId
()
||
null
==
answerSubscribeDTO
.
getChannelId
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少书刊参数"
);
}
if
(
null
==
answerSubscribeDTO
.
getSubscribeType
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少订阅类型"
);
}
AnswerSubscribe
answerSubscribe
=
new
AnswerSubscribe
();
BeanUtils
.
copyProperties
(
answerSubscribeDTO
,
answerSubscribe
);
List
<
AnswerSubscribe
>
list
=
answerSubscribeDao
.
getRecordByUserBook
(
answerSubscribe
);
if
(!
ListUtils
.
isEmpty
(
list
))
{
return
;
return
new
AnswerSubscribeDTO
()
;
}
answerSubscribe
.
setResourceCount
(
resourcePageBiz
.
getResourceCounts
(
answerSubscribeDTO
.
getBookId
(),
answerSubscribeDTO
.
getAdviserId
(),
answerSubscribeDTO
.
getChannelId
()));
answerSubscribeDao
.
insert
(
answerSubscribe
);
return
getSubscribeQrcode
(
answerSubscribeDTO
);
}
/**
* 查询公众号关注情况
* @author:zhuyajie
* @date:2021/5/14 16:34
* * @param null
*/
private
AnswerSubscribeDTO
getSubscribeQrcode
(
AnswerSubscribeDTO
answerSubscribeDTO
)
{
AnswerSubscribeDTO
dto
=
new
AnswerSubscribeDTO
();
Long
wechatUserId
=
answerSubscribeDTO
.
getWechatUserId
();
Long
accountSettingId
=
answerSubscribeDTO
.
getAccountSettingId
();
//是否关注
String
openId
=
readerConsr
.
getOpenIdByWechatUserIdAndOfficialAccountsId
(
wechatUserId
,
accountSettingId
);
WechatUserOfficialAccounts
accounts
=
readerConsr
.
getOfficialAccounts
(
accountSettingId
,
openId
,
wechatUserId
);
Boolean
isSubscribe
=
false
;
if
(
null
!=
accounts
)
{
isSubscribe
=
accounts
.
getIsSubscribe
()
==
1
?
true
:
false
;
}
AnswerSubscribePopup
popup
=
new
AnswerSubscribePopup
();
popup
.
setWechatUserId
(
wechatUserId
);
popup
.
setAccountSettingId
(
accountSettingId
);
popup
.
setBookId
(
answerSubscribeDTO
.
getBookId
());
popup
.
setChannelId
(
answerSubscribeDTO
.
getChannelId
());
popup
.
setAdviserId
(
answerSubscribeDTO
.
getAdviserId
());
popup
.
setSubscribeType
(
answerSubscribeDTO
.
getSubscribeType
());
answerSubscribePopupDao
.
insert
(
popup
);
GroupQrcodeVO
groupQrcodeVO
=
qrcodeSceneConsr
.
getSubscribeQrcode
(
accountSettingId
);
dto
.
setQrcodeUrl
(
groupQrcodeVO
.
getQrcodeUrl
());
dto
.
setIsSubscribe
(
isSubscribe
);
return
dto
;
}
@Override
...
...
@@ -223,6 +272,44 @@ public class AnswerSubscribeBizImpl implements AnswerSubscribeBiz {
answerSubscribeDao
.
cancelAnswerSubscribe
(
answerSubscribeDTO
);
}
@Override
public
AnswerSubscribeUserDTO
getUserSubscribeInfo
(
Long
wechatUserId
)
{
AnswerSubscribeUserDTO
answerSubscribeUserDTO
=
new
AnswerSubscribeUserDTO
();
AnswerSubscribePopup
popup
=
answerSubscribePopupDao
.
getLastRecord
(
wechatUserId
);
if
(
null
==
popup
)
{
return
answerSubscribeUserDTO
;
}
answerSubscribeUserDTO
.
setBookId
(
popup
.
getBookId
());
answerSubscribeUserDTO
.
setChannelId
(
popup
.
getChannelId
());
answerSubscribeUserDTO
.
setAdviserId
(
popup
.
getAdviserId
());
if
(
popup
.
getSubscribeType
()
==
1
)
{
//书刊订阅
ResourcePageVO
resourcePageVO
=
resourcePageBiz
.
getResourcePageByBookId
(
popup
.
getBookId
(),
popup
.
getChannelId
(),
popup
.
getAdviserId
(),
wechatUserId
);
answerSubscribeUserDTO
.
setBookName
(
null
==
resourcePageVO
?
null
:
resourcePageVO
.
getBookName
());
//小睿书流程有推送链接
if
(
null
!=
resourcePageVO
&&
resourcePageVO
.
getOpenRays
()
==
1
)
{
String
host
=
BookProps
.
getWechatDomain
();
if
(
"uat"
.
equals
(
BookProps
.
getSystemEnv
()))
{
host
=
host
.
replace
(
"wechat666"
,
"weixin35515"
);
}
else
{
host
=
host
.
replace
(
"wechat666"
,
"weixin23"
);
}
String
url
=
""
;
if
(
null
!=
resourcePageVO
.
getSceneId
())
{
url
=
host
+
"/rayh5/book?sceneId="
+
resourcePageVO
.
getSceneId
();
}
else
if
(
null
!=
resourcePageVO
.
getBookGroupId
())
{
url
=
host
+
"/rayh5/book?bookGroupId="
+
resourcePageVO
.
getId
();
}
answerSubscribeUserDTO
.
setUrl
(
url
);
}
}
if
(
StringUtil
.
isEmpty
(
answerSubscribeUserDTO
.
getBookName
()))
{
BookDto
bookDto
=
bookBiz
.
getBaseById
(
popup
.
getBookId
());
answerSubscribeUserDTO
.
setBookName
(
null
==
bookDto
?
null
:
bookDto
.
getBookName
());
}
return
answerSubscribeUserDTO
;
}
private
void
sendAppletTemplateMsg
(
Long
wechatUserId
,
Long
accountSettingId
,
String
bookName
)
{
bookName
=
bookName
.
length
()
>
13
?
bookName
.
substring
(
0
,
13
)
+
"..."
:
bookName
;
AppletTemplateMessageDto
appletTemplateMessage
;
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletBannerBizImpl.java
View file @
ac20bae8
...
...
@@ -9,8 +9,11 @@ import com.pcloud.advertising.advertising.dto.AdvertisingSpaceItemDTO;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.book.applet.biz.AppletBannerBiz
;
import
com.pcloud.book.applet.biz.AppletNewsBiz
;
import
com.pcloud.book.applet.biz.AppletResourceApplyBiz
;
import
com.pcloud.book.applet.contants.AppletResourceApplyConstants
;
import
com.pcloud.book.applet.dao.AppletBannerDao
;
import
com.pcloud.book.applet.dao.AppletUserBookcaseDao
;
import
com.pcloud.book.applet.dto.AddResourceApplyDTO
;
import
com.pcloud.book.applet.dto.AppletBannerDTO
;
import
com.pcloud.book.applet.dto.AppletBannerStats
;
import
com.pcloud.book.applet.dto.AppletBannerTrendDTO
;
...
...
@@ -42,9 +45,8 @@ import com.pcloud.facade.quartz.entity.ScheduleJob;
import
com.pcloud.facade.quartz.service.ScheduleService
;
import
com.pcloud.readercenter.common.enums.YesOrNoNumEnum
;
import
com.pcloud.resourcecenter.product.dto.ProductDto
;
import
com.pcloud.usercenter.common.enums.YesOrNoEnum
;
import
com.pcloud.wechatgroup.base.exception.WechatGroupBizException
;
import
lombok.extern.slf4j.Slf4j
;
import
org.codehaus.jackson.JsonParseException
;
import
org.quartz.SchedulerException
;
import
org.springframework.beans.BeanUtils
;
...
...
@@ -65,6 +67,12 @@ import java.util.concurrent.CompletableFuture;
import
java.util.concurrent.ExecutionException
;
import
java.util.stream.Collectors
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.ListUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
static
com
.
pcloud
.
book
.
book
.
constant
.
BookConstant
.
JOB_NAME_BANNER_PUT_OFF
;
import
static
com
.
pcloud
.
book
.
book
.
constant
.
BookConstant
.
JOB_NAME_BANNER_PUT_ON
;
...
...
@@ -97,6 +105,8 @@ public class AppletBannerBizImpl implements AppletBannerBiz {
private
RightsSettingBannerBiz
rightsSettingBannerBiz
;
@Autowired
private
AdvertisingConsr
advertisingConsr
;
@Autowired
private
AppletResourceApplyBiz
appletResourceApplyBiz
;
@Override
...
...
@@ -119,9 +129,24 @@ public class AppletBannerBizImpl implements AppletBannerBiz {
addSimpleJob4Banner
(
id
,
JOB_NAME_BANNER_PUT_OFF
+
id
,
appletBanner
.
getEndTime
(),
YesOrNoEnums
.
NO
.
getValue
());
}
this
.
updateResourceApply
(
id
,
appletBanner
.
getCrowdTypeList
());
return
id
;
}
/**
* 更新适用人群
* @author:zhuyajie
* @date:2021/5/8 16:02
* * @param null
*/
private
void
updateResourceApply
(
Long
id
,
List
<
Integer
>
crowdTypeList
)
{
AddResourceApplyDTO
addResourceApplyDTO
=
new
AddResourceApplyDTO
();
addResourceApplyDTO
.
setTargetId
(
id
);
addResourceApplyDTO
.
setTargetType
(
AppletResourceApplyConstants
.
TargetTypeEnum
.
BANNER
.
getValue
());
addResourceApplyDTO
.
setCrowdTypeList
(
crowdTypeList
);
appletResourceApplyBiz
.
addResourceApply
(
addResourceApplyDTO
);
}
private
void
addSimpleJob4Banner
(
Long
id
,
String
jobName
,
Date
startTime
,
Integer
showState
)
{
Long
second
=
(
startTime
.
getTime
()
-
System
.
currentTimeMillis
())
/
1000
;
ScheduleJob
scheduleJob
=
new
ScheduleJob
();
...
...
@@ -178,6 +203,10 @@ public class AppletBannerBizImpl implements AppletBannerBiz {
}
}
if
(
null
==
appletBanner
.
getShowState
())
{
//非上下架修改
this
.
updateResourceApply
(
id
,
appletBanner
.
getCrowdTypeList
());
}
}
@Override
...
...
@@ -207,6 +236,7 @@ public class AppletBannerBizImpl implements AppletBannerBiz {
String
uv
=
Objects
.
nonNull
(
appletBannerStats
.
getUv
())
?
String
.
valueOf
(
appletBannerStats
.
getUv
())
:
"0"
;
appletBannerDTO
.
setClickPVUV
(
pv
+
"/"
+
uv
);
}
appletBannerDTO
.
setCrowdTypeList
(
appletResourceApplyBiz
.
getCrowdTypeList
(
id
,
AppletResourceApplyConstants
.
TargetTypeEnum
.
BANNER
.
getValue
()));
}
return
appletBannerDTO
;
}
...
...
@@ -554,4 +584,17 @@ public class AppletBannerBizImpl implements AppletBannerBiz {
appletBannerDao
.
update
(
appletBanner
);
}
@Override
public
PageBeanNew
<
AppletBannerDTO
>
getBannerByGradeLabel4ResourcePage
(
Long
gradeLabelId
,
Integer
currentPage
,
Integer
numPerPage
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"crowdType"
,
gradeLabelId
.
intValue
());
PageBeanNew
<
AppletBannerDTO
>
pageBeanNew
=
appletBannerDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"listBannerByGrade"
);
if
(
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
()))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
pageBeanNew
.
getTotalCount
(),
new
ArrayList
<>());
}
// 填充 资讯 | 作品 | 应用 信息
fillServeInfo
(
pageBeanNew
.
getRecordList
());
return
pageBeanNew
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletBooklistBizImpl.java
View file @
ac20bae8
...
...
@@ -3,12 +3,15 @@ package com.pcloud.book.applet.biz.impl;
import
com.pcloud.appcenter.assist.dto.AssistTempletDTO
;
import
com.pcloud.book.applet.biz.AppletBooklistBiz
;
import
com.pcloud.book.applet.biz.AppletNewsBiz
;
import
com.pcloud.book.applet.biz.AppletResourceApplyBiz
;
import
com.pcloud.book.applet.contants.AppletConstants
;
import
com.pcloud.book.applet.contants.AppletResourceApplyConstants
;
import
com.pcloud.book.applet.dao.AppletBooklistClassifyDao
;
import
com.pcloud.book.applet.dao.AppletBooklistDao
;
import
com.pcloud.book.applet.dao.AppletOuterBookDao
;
import
com.pcloud.book.applet.dao.AppletOuterBooklistDao
;
import
com.pcloud.book.applet.dto.AddBookParamDTO
;
import
com.pcloud.book.applet.dto.AddResourceApplyDTO
;
import
com.pcloud.book.applet.dto.AppletBooklistClassifyDTO
;
import
com.pcloud.book.applet.dto.AppletBooklistDTO
;
import
com.pcloud.book.applet.dto.AppletOuterBookDTO
;
...
...
@@ -39,6 +42,7 @@ import com.pcloud.book.util.properties.BookProps;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.DateUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.cache.redis.JedisClusterUtils
;
import
com.pcloud.common.utils.httpclient.UrlUtils
;
...
...
@@ -54,6 +58,7 @@ import org.springframework.stereotype.Component;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -92,6 +97,8 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
private
ESBookAndAdviserBiz
esBookAndAdviserBiz
;
@Autowired
private
AgentConsr
agentConsr
;
@Autowired
private
AppletResourceApplyBiz
appletResourceApplyBiz
;
@Override
...
...
@@ -578,9 +585,24 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
}
appletOuterBooklistDao
.
addOuterBooklistConfig
(
addDTOS
);
}
this
.
updateResourceApply
(
appletOuterBooklist
.
getId
(),
appletOuterBooklistDTO
.
getCrowdTypeList
());
return
appletOuterBooklist
.
getId
();
}
/**
* 更新适用人群
* @author:zhuyajie
* @date:2021/5/8 16:02
* * @param null
*/
private
void
updateResourceApply
(
Long
id
,
List
<
Integer
>
crowdTypeList
)
{
AddResourceApplyDTO
addResourceApplyDTO
=
new
AddResourceApplyDTO
();
addResourceApplyDTO
.
setTargetId
(
id
);
addResourceApplyDTO
.
setTargetType
(
AppletResourceApplyConstants
.
TargetTypeEnum
.
BOOKLIST
.
getValue
());
addResourceApplyDTO
.
setCrowdTypeList
(
crowdTypeList
);
appletResourceApplyBiz
.
addResourceApply
(
addResourceApplyDTO
);
}
private
void
checkBooklistParam
(
AppletOuterBooklistDTO
appletOuterBooklistDTO
){
if
(
StringUtil
.
isEmpty
(
appletOuterBooklistDTO
.
getBooklistName
())){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少书单主题名称"
);
...
...
@@ -606,6 +628,7 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
BeanUtils
.
copyProperties
(
appletOuterBooklist
,
appletOuterBooklistDTO
);
List
<
Long
>
bookIds
=
appletOuterBooklistDao
.
getBookIdsByBooklistId
(
booklistId
);
appletOuterBooklistDTO
.
setOuterBookIdList
(
bookIds
);
appletOuterBooklistDTO
.
setCrowdTypeList
(
appletResourceApplyBiz
.
getCrowdTypeList
(
booklistId
,
AppletResourceApplyConstants
.
TargetTypeEnum
.
BOOKLIST
.
getValue
()));
return
appletOuterBooklistDTO
;
}
...
...
@@ -822,4 +845,22 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
public
Map
<
Long
,
AppletOuterBooklistDTO
>
getBooklistInfoByIds
(
List
<
Long
>
booklistIds
)
{
return
appletOuterBooklistDao
.
getByIds
(
booklistIds
);
}
@Override
public
PageBeanNew
<
AppletOuterBooklistDTO
>
getBooklistByGradeLabel4ResourcePage
(
Long
gradeLabelId
,
Integer
currentPage
,
Integer
numPerPage
)
{
String
startDate
=
DateUtils
.
formatDate
(
DateUtils
.
addDay
(
new
Date
(),
-
7
),
DateUtils
.
DATE_FORMAT_DATEONLY
);
//根据标签查询,按照近7天浏览量排序
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"startDate"
,
startDate
);
paramMap
.
put
(
"crowdType"
,
gradeLabelId
.
intValue
());
PageBeanNew
<
Long
>
idPageBean
=
appletOuterBooklistDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"listBooklistIdByGradeLabelAndClickCount"
);
if
(
ListUtils
.
isEmpty
(
idPageBean
.
getRecordList
()))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
idPageBean
.
getTotalCount
(),
new
ArrayList
<>());
}
//书单内容
Map
<
Long
,
AppletOuterBooklistDTO
>
booklistDTOMap
=
this
.
getByIds
(
idPageBean
.
getRecordList
());
List
<
AppletOuterBooklistDTO
>
list
=
new
ArrayList
<>();
list
.
addAll
(
booklistDTOMap
.
values
());
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
idPageBean
.
getTotalCount
(),
list
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletGroupSearchRecordBizImpl.java
View file @
ac20bae8
...
...
@@ -34,6 +34,7 @@ import com.pcloud.book.skill.biz.PcloudGroupActivityBiz;
import
com.pcloud.book.skill.dao.PcloudGroupActivityDao
;
import
com.pcloud.book.applet.dto.GroupActivity4AppletDTO
;
import
com.pcloud.book.util.common.YesOrNoEnums
;
import
com.pcloud.book.util.properties.BookProps
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
...
...
@@ -349,7 +350,7 @@ public class AppletGroupSearchRecordBizImpl implements AppletGroupSearchRecordBi
@Override
public
PageBeanNew
<
AppletGroupManageDTO
>
getGroupList4AppletHome
(
Long
wechatUserId
,
Integer
currentPage
,
Integer
numPerPage
,
Long
officialAccountsId
)
{
//用户最近读的书
PageBeanNew
<
AppletUserBookcaseDTO
>
bookcaseDTOPageBeanNew
=
appletUserBookcaseBiz
.
listByWechatUserId
(
wechatUserId
,
currentPage
,
1
);
PageBeanNew
<
AppletUserBookcaseDTO
>
bookcaseDTOPageBeanNew
=
appletUserBookcaseBiz
.
listByWechatUserId
(
wechatUserId
,
currentPage
,
1
,
BookProps
.
getMiniOfficialAccountsId
()
);
if
(
null
==
bookcaseDTOPageBeanNew
||
ListUtils
.
isEmpty
(
bookcaseDTOPageBeanNew
.
getRecordList
()))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletRecordAggrStatisBizImpl.java
View file @
ac20bae8
package
com
.
pcloud
.
book
.
applet
.
biz
.
impl
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.google.common.collect.Lists
;
import
com.pcloud.book.applet.biz.AppletRecordAggrStatisBiz
;
import
com.pcloud.book.applet.biz.AppletRecordBiz
;
import
com.pcloud.book.applet.biz.ServeCollectBiz
;
import
com.pcloud.book.applet.contants.AppletConstants
;
import
com.pcloud.book.applet.dao.AppletRecordDao
;
import
com.pcloud.book.applet.dao.AppletRecordSevenDayDao
;
import
com.pcloud.book.applet.dto.AppletRecordDTO
;
import
com.pcloud.book.applet.entity.AppletRecord
;
import
com.pcloud.book.applet.entity.AppletRecordSevenDay
;
import
com.pcloud.book.applet.entity.ServeCollect
;
import
com.pcloud.book.applet.enums.AppletRankTypeEnum
;
import
com.pcloud.book.applet.enums.AppletRecordTypeEnum
;
import
com.pcloud.book.applet.enums.AppletSourceTypeEnum
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.consumer.reader.ReaderConsr
;
import
com.pcloud.book.group.biz.ResourcePageBiz
;
import
com.pcloud.book.group.constant.ResourcePageConstants
;
import
com.pcloud.book.group.dao.WeworkTeacherFriendRecordDao
;
import
com.pcloud.book.mapper.clickhouse.AppletRecordCHMapper
;
import
com.pcloud.book.util.common.YesOrNoEnums
;
import
com.pcloud.book.util.properties.BookProps
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.utils.BeanUtils
;
import
com.pcloud.common.utils.DateUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.cache.redis.JedisClusterUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.readercenter.common.enums.YesOrNoNumEnum
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.ibatis.session.ResultContext
;
...
...
@@ -33,7 +41,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
java.text.MessageFormat
;
import
java.util.Date
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.LinkedList
;
import
java.util.List
;
...
...
@@ -41,6 +50,9 @@ import java.util.Map;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
@Service
(
"appletRecordAggrStatisBiz"
)
public
class
AppletRecordAggrStatisBizImpl
implements
AppletRecordAggrStatisBiz
{
...
...
@@ -56,6 +68,12 @@ public class AppletRecordAggrStatisBizImpl implements AppletRecordAggrStatisBiz
private
WeworkTeacherFriendRecordDao
weworkTeacherFriendRecordDao
;
@Autowired
private
ServeCollectBiz
serveCollectBiz
;
@Autowired
private
ResourcePageBiz
resourcePageBiz
;
@Autowired
private
AppletRecordSevenDayDao
appletRecordSevenDayDao
;
@Autowired
private
ReaderConsr
readerConsr
;
@Override
public
PageBeanNew
getAggrStatis
(
Long
wechatUserId
,
String
keyword
,
Integer
sourceType
,
Integer
rankType
,
Integer
currentPage
,
Integer
numPerPage
)
{
...
...
@@ -284,4 +302,83 @@ public class AppletRecordAggrStatisBizImpl implements AppletRecordAggrStatisBiz
}
}
}
/**
* 将 clickHouse 的资源排行加入到 数据库
*/
@Override
public
void
updateH5Resource
()
{
//资源广场模块
for
(
ResourcePageConstants
.
ResourceSourceTypeEnum
sourceTypeEnum
:
ResourcePageConstants
.
ResourceSourceTypeEnum
.
values
())
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"offset"
,
0
);
paramMap
.
put
(
"limit"
,
1000
);
if
(
"pro"
.
equals
(
BookProps
.
getSystemEnv
()))
{
paramMap
.
put
(
"beginDate"
,
DateUtils
.
formatDate
(
DateUtils
.
addDay
(
DateUtils
.
getDayBegin
(),
-
7
)));
}
paramMap
.
put
(
"endDate"
,
DateUtils
.
formatDate
(
DateUtils
.
addDay
(
DateUtils
.
getDayEnd
(),
-
1
)));
paramMap
.
put
(
"sourceKeywords"
,
Arrays
.
asList
(
sourceTypeEnum
.
getKeywords
()));
//资源广场模块搜索-7天内扫码量高的资源
List
<
AppletRecordDTO
>
sevenDaysourceAggrStatis
=
appletRecordCHMapper
.
getAggrStatis4H5
(
paramMap
);
if
(
ListUtils
.
isEmpty
(
sevenDaysourceAggrStatis
))
{
continue
;
}
List
<
Long
>
fromIdList
=
sevenDaysourceAggrStatis
.
stream
().
filter
(
s
->
s
!=
null
&&
s
.
getFromId
()>
0
).
map
(
AppletRecordDTO:
:
getFromId
).
collect
(
Collectors
.
toList
());
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"endDate"
,
DateUtils
.
formatDate
(
DateUtils
.
addDay
(
DateUtils
.
getDayEnd
(),
-
1
)));
map
.
put
(
"fromIdList"
,
fromIdList
);
//7天内扫码量高的资源的总扫码量
List
<
AppletRecordDTO
>
sourceAggrStatis
=
appletRecordCHMapper
.
getAggrStatis4H5
(
map
);
appletRecordBiz
.
fillAppletRecord
(
sourceAggrStatis
,
YesOrNoNumEnum
.
NO
.
getValue
());
sourceAggrStatis
=
sourceAggrStatis
.
stream
().
filter
(
x
->
x
.
getSourceDelete
()
==
0
).
collect
(
Collectors
.
toList
());
if
(
ListUtils
.
isEmpty
(
sourceAggrStatis
))
{
continue
;
}
appletRecordSevenDayDao
.
deleteBySourceType
(
sourceTypeEnum
.
getCode
());
List
<
AppletRecordSevenDay
>
serveList
=
new
ArrayList
<>();
BeanUtils
.
copyListProperties
(
sourceAggrStatis
,
serveList
,
AppletRecordSevenDay
.
class
);
serveList
.
forEach
(
s
->
s
.
setSourceType
(
sourceTypeEnum
.
getCode
()));
appletRecordSevenDayDao
.
insert
(
serveList
);
}
}
@Override
public
PageBeanNew
getResource4H5
(
Long
wechatUserId
,
Long
officialAccountsId
,
String
keyword
,
Integer
sourceType
,
Integer
currentPage
,
Integer
numPerPage
)
{
if
(
null
==
sourceType
&&
StringUtil
.
isEmpty
(
keyword
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少参数"
);
}
//最多查询50个
Integer
maxCount
=
50
;
List
<
AppletRecordDTO
>
countList
;
if
(
StringUtils
.
isNotEmpty
(
keyword
))
{
//关键词搜索
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"sourceKeywords"
,
Arrays
.
asList
(
keyword
));
paramMap
.
put
(
"offset"
,
0
);
paramMap
.
put
(
"limit"
,
maxCount
);
paramMap
.
put
(
"endDate"
,
DateUtils
.
formatDate
(
DateUtils
.
addDay
(
DateUtils
.
getDayEnd
(),
-
1
)));
countList
=
appletRecordCHMapper
.
getAggrStatis4H5
(
paramMap
);
}
else
{
//无关键词-根据学龄段搜索
Long
gradeLabel
=
resourcePageBiz
.
getUserGrade
(
wechatUserId
,
officialAccountsId
);
List
<
Long
>
gradeLabelIds
=
readerConsr
.
getUserGradeIdByParentId
(
gradeLabel
);
countList
=
appletRecordSevenDayDao
.
getResourceByGrade4H5
(
sourceType
,
gradeLabelIds
,
maxCount
);
}
if
(
ListUtils
.
isEmpty
(
countList
))
{
return
new
PageBeanNew
(
currentPage
,
numPerPage
,
0
,
Lists
.
newArrayList
());
}
appletRecordBiz
.
fillAppletRecord
(
countList
,
YesOrNoNumEnum
.
NO
.
getValue
());
countList
=
countList
.
stream
().
filter
(
x
->
x
.
getSourceDelete
()
==
0
).
collect
(
Collectors
.
toList
());
if
(
ListUtils
.
isEmpty
(
countList
))
{
return
new
PageBeanNew
(
currentPage
,
numPerPage
,
0
,
Lists
.
newArrayList
());
}
List
<
AppletRecordDTO
>
recordDTOS
=
countList
.
stream
().
skip
(
currentPage
*
numPerPage
).
limit
(
numPerPage
).
collect
(
Collectors
.
toList
());
PageBeanNew
pageBeanNew
=
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
countList
.
size
(),
recordDTOS
);
return
pageBeanNew
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletRecordBizImpl.java
View file @
ac20bae8
...
...
@@ -41,6 +41,7 @@ import com.pcloud.book.book.dao.BookDao;
import
com.pcloud.book.book.dto.BookDto
;
import
com.pcloud.book.consumer.app.AppConsr
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.consumer.reader.ReaderConsr
;
import
com.pcloud.book.consumer.resource.ProductConsr
;
import
com.pcloud.book.group.biz.WeworkTeacherBiz
;
import
com.pcloud.book.group.dto.WxWorkTeacherDTO
;
...
...
@@ -65,6 +66,8 @@ import com.pcloud.common.utils.cache.redis.RedisSessionUtils;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.readercenter.common.enums.YesOrNoNumEnum
;
import
com.pcloud.resourcecenter.product.dto.ProductDto
;
import
com.pcloud.resourcecenter.product.dto.ProductLabelDto
;
import
org.apache.commons.collections.MapUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -131,6 +134,8 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
private
BookDao
bookDao
;
@Autowired
private
AppletTrackMapper
appletTrackMapper
;
@Autowired
private
ReaderConsr
readerConsr
;
@Override
@ParamLog
(
"通过ID查询单条数据"
)
...
...
@@ -227,13 +232,14 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
@Override
@ParamLog
(
value
=
"我的足迹"
,
isAfterReturn
=
false
)
public
PageBeanNew
<
AppletRecordDTO
>
listAppletRecord
(
Long
wechatUserId
,
String
date
,
List
<
Integer
>
recordTypes
,
String
queryName
,
Integer
currentPage
,
Integer
numPerPage
,
String
typeName
)
{
Integer
currentPage
,
Integer
numPerPage
,
String
typeName
,
Long
officialAccountsId
)
{
List
<
Long
>
wechatUserIds
=
readerConsr
.
getRelateUserIdList
(
wechatUserId
,
officialAccountsId
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
if
(!
ListUtils
.
isEmpty
(
recordTypes
)
&&
!
recordTypes
.
contains
(
AppletRecordTypeEnum
.
NEWS
.
value
)
&&
!
recordTypes
.
contains
(
AppletRecordTypeEnum
.
PRODUCT
.
value
))
{
typeName
=
null
;
}
paramMap
.
put
(
"wechatUserId
"
,
wechatUserId
);
paramMap
.
put
(
"wechatUserId
s"
,
wechatUserIds
);
if
(!
ListUtils
.
isEmpty
(
recordTypes
))
{
paramMap
.
put
(
"recordTypes"
,
recordTypes
);
}
...
...
@@ -285,9 +291,10 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
@Override
@ParamLog
(
"获取足迹目录"
)
public
List
<
AppletRecordDTO
>
getAppletRecordCatalogue
(
Long
wechatUserId
,
String
date
)
{
public
List
<
AppletRecordDTO
>
getAppletRecordCatalogue
(
Long
wechatUserId
,
String
date
,
Long
officialAccountsId
)
{
List
<
Long
>
wechatUserIds
=
readerConsr
.
getRelateUserIdList
(
wechatUserId
,
officialAccountsId
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"wechatUserId
"
,
wechatUserId
);
paramMap
.
put
(
"wechatUserId
s"
,
wechatUserIds
);
List
<
AppletRecordDTO
>
appletRecordDTOS
=
null
;
if
(
StringUtil
.
isEmpty
(
date
))
{
//从总表中查
...
...
@@ -739,6 +746,9 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
appletAppOrProductDTO
.
setServePic
(
appDto
.
getSquareImg
());
appletAppOrProductDTO
.
setServeTypeCode
(
appDto
.
getTypeCode
());
appletAppOrProductDTO
.
setServeTypeName
(
appDto
.
getTypeName
());
appletRecordDTO
.
setPurLabelId
(
appDto
.
getPurLabelId
());
appletRecordDTO
.
setProLabelId
(
appDto
.
getProLabelId
());
appletRecordDTO
.
setDepLabelId
(
appDto
.
getDepLabelId
());
accountSettingDto
=
qrcodeSceneConsr
.
getWechatInfo
(
appDto
.
getChannelId
());
if
(
null
==
accountSettingDto
)
{
appletRecordDTO
.
setSourceDelete
(
YesOrNoNumEnum
.
YES
.
getValue
());
...
...
@@ -779,6 +789,12 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
appletAppOrProductDTO
.
setServeTypeCode
(
productDto
.
getProductTypeDto
().
getTypeCode
());
appletAppOrProductDTO
.
setServeTypeName
(
productDto
.
getProductTypeDto
().
getTypeName
());
}
if
(!
ListUtils
.
isEmpty
(
productDto
.
getProductLabels
()))
{
ProductLabelDto
labelDto
=
productDto
.
getProductLabels
().
get
(
0
);
appletRecordDTO
.
setProLabelId
(
labelDto
.
getProLabelId
());
appletRecordDTO
.
setPurLabelId
(
labelDto
.
getPurLabelId
());
appletRecordDTO
.
setDepLabelId
(
labelDto
.
getDepLabelId
());
}
//获取channelId,/C1404/product/display/10234028?adviserId=1001587&proType=MEMBER&source_type=QRCODE
Long
channelId
=
null
;
String
url
=
appletRecordDTO
.
getLinkUrl
();
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletResourceApplyBizImpl.java
0 → 100644
View file @
ac20bae8
package
com
.
pcloud
.
book
.
applet
.
biz
.
impl
;
import
com.pcloud.book.applet.biz.AppletResourceApplyBiz
;
import
com.pcloud.book.applet.contants.AppletResourceApplyConstants
;
import
com.pcloud.book.applet.dao.AppletResourceApplyDao
;
import
com.pcloud.book.applet.dto.AddResourceApplyDTO
;
import
com.pcloud.book.applet.entity.AppletResourceApply
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @ClassName com.pcloud.book.applet.biz.impl.AppletResourceApplyBizImpl
* @Author zhuyajie
* @Description 资源适用范围
* @Date 2021/5/8 15:12
* @Version 1.0
**/
@Component
public
class
AppletResourceApplyBizImpl
implements
AppletResourceApplyBiz
{
@Autowired
private
AppletResourceApplyDao
appletResourceApplyDao
;
@Override
public
void
addResourceApply
(
AddResourceApplyDTO
addResourceApplyDTO
)
{
if
(
null
==
addResourceApplyDTO
||
null
==
addResourceApplyDTO
.
getTargetId
()
||
StringUtil
.
isEmpty
(
addResourceApplyDTO
.
getTargetType
()))
{
return
;
}
Long
targetId
=
addResourceApplyDTO
.
getTargetId
();
String
targetType
=
addResourceApplyDTO
.
getTargetType
();
appletResourceApplyDao
.
deleteCrowdType
(
targetId
,
targetType
);
appletResourceApplyDao
.
deleteContentType
(
targetId
,
targetType
);
if
(!
ListUtils
.
isEmpty
(
addResourceApplyDTO
.
getCrowdTypeList
()))
{
List
<
AppletResourceApply
>
crowdList
=
new
ArrayList
<>();
for
(
Integer
crowdType
:
addResourceApplyDTO
.
getCrowdTypeList
())
{
AppletResourceApply
apply
=
new
AppletResourceApply
();
apply
.
setTargetId
(
targetId
);
apply
.
setTargetType
(
targetType
);
apply
.
setCrowdType
(
crowdType
);
crowdList
.
add
(
apply
);
}
appletResourceApplyDao
.
insert
(
crowdList
);
}
if
(!
ListUtils
.
isEmpty
(
addResourceApplyDTO
.
getContentTypeList
()))
{
List
<
AppletResourceApply
>
contentList
=
new
ArrayList
<>();
for
(
Integer
contentType
:
addResourceApplyDTO
.
getContentTypeList
())
{
AppletResourceApply
apply
=
new
AppletResourceApply
();
apply
.
setTargetId
(
targetId
);
apply
.
setTargetType
(
targetType
);
apply
.
setContentType
(
contentType
);
contentList
.
add
(
apply
);
}
appletResourceApplyDao
.
insert
(
contentList
);
}
}
@Override
public
List
<
Integer
>
getCrowdTypeList
(
Long
targetId
,
String
targetType
)
{
return
appletResourceApplyDao
.
getCrowdTypeList
(
targetId
,
targetType
);
}
@Override
public
List
<
Integer
>
getContentTypeList
(
Long
targetId
,
String
targetType
)
{
return
appletResourceApplyDao
.
getContentTypeList
(
targetId
,
targetType
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletThirdResourcesBizImpl.java
View file @
ac20bae8
package
com
.
pcloud
.
book
.
applet
.
biz
.
impl
;
import
c
n.hutool.core.util.StrUtil
;
import
c
om.pcloud.book.applet.biz.AppletResourceApplyBiz
;
import
com.pcloud.book.applet.biz.AppletThirdResourcesBiz
;
import
com.pcloud.book.applet.contants.AppletResourceApplyConstants
;
import
com.pcloud.book.applet.dao.AppletLinkClickDao
;
import
com.pcloud.book.applet.dao.AppletNewsDao
;
import
com.pcloud.book.applet.dao.AppletThirdResourcesClickDao
;
import
com.pcloud.book.applet.dao.AppletThirdResourcesDao
;
import
com.pcloud.book.applet.dto.AddResourceApplyDTO
;
import
com.pcloud.book.applet.dto.AppletChartDateDTO
;
import
com.pcloud.book.applet.dto.AppletThirdResourcesDTO
;
import
com.pcloud.book.applet.dto.PvuvDTO
;
...
...
@@ -24,10 +26,11 @@ import com.pcloud.book.group.enums.UseTypeEnum;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.DateUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.readercenter.wechat.entity.WechatUser
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.MapUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -35,6 +38,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -42,6 +46,9 @@ import java.util.Objects;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
cn.hutool.core.util.StrUtil
;
import
lombok.extern.slf4j.Slf4j
;
@Slf4j
@Service
(
"appletThirdResourcesBiz"
)
public
class
AppletThirdResourcesBizImpl
implements
AppletThirdResourcesBiz
{
...
...
@@ -62,6 +69,8 @@ public class AppletThirdResourcesBizImpl implements AppletThirdResourcesBiz {
private
AdviserConsr
adviserConsr
;
@Autowired
private
AppletThirdResourcesPicMapper
appletThirdResourcesPicMapper
;
@Autowired
private
AppletResourceApplyBiz
appletResourceApplyBiz
;
@Override
public
PageBeanNew
<
AppletThirdResourcesDTO
>
getListThirdResourcesAnalysis
(
String
keyValue
,
String
source
,
...
...
@@ -243,6 +252,7 @@ public class AppletThirdResourcesBizImpl implements AppletThirdResourcesBiz {
if
(
thirdResourcesDTO
.
getType
()
==
2
)
{
addPicResources
(
thirdResourcesDTO
.
getId
(),
thirdResourcesDTO
.
getPicUrlList
());
}
this
.
updateResourceApply
(
thirdResources
.
getId
(),
thirdResourcesDTO
.
getCrowdTypeList
(),
thirdResourcesDTO
.
getContentTypeList
());
}
/**
...
...
@@ -268,7 +278,15 @@ public class AppletThirdResourcesBizImpl implements AppletThirdResourcesBiz {
@Override
public
AppletThirdResources
getAppletsById
(
Long
id
)
{
return
thirdResourcesDao
.
getById
(
id
);
AppletThirdResources
appletThirdResources
=
thirdResourcesDao
.
getById
(
id
);
if
(
null
==
appletThirdResources
)
{
return
new
AppletThirdResources
();
}
appletThirdResources
.
setCrowdTypeList
(
appletResourceApplyBiz
.
getCrowdTypeList
(
id
,
AppletResourceApplyConstants
.
TargetTypeEnum
.
THIRD_RESOURCE
.
getValue
()));
appletThirdResources
.
setContentTypeList
(
appletResourceApplyBiz
.
getContentTypeList
(
id
,
AppletResourceApplyConstants
.
TargetTypeEnum
.
THIRD_RESOURCE
.
getValue
()));
return
appletThirdResources
;
}
@Override
...
...
@@ -305,6 +323,22 @@ public class AppletThirdResourcesBizImpl implements AppletThirdResourcesBiz {
if
(
thirdResourcesDTO
.
getType
()
==
2
)
{
addPicResources
(
thirdResources
.
getId
(),
thirdResourcesDTO
.
getPicUrlList
());
}
this
.
updateResourceApply
(
thirdResources
.
getId
(),
thirdResourcesDTO
.
getCrowdTypeList
(),
thirdResourcesDTO
.
getContentTypeList
());
}
/**
* 更新适用人群
* @author:zhuyajie
* @date:2021/5/8 16:02
* * @param null
*/
private
void
updateResourceApply
(
Long
id
,
List
<
Integer
>
crowdTypeList
,
List
<
Integer
>
contentTypeList
)
{
AddResourceApplyDTO
addResourceApplyDTO
=
new
AddResourceApplyDTO
();
addResourceApplyDTO
.
setTargetId
(
id
);
addResourceApplyDTO
.
setTargetType
(
AppletResourceApplyConstants
.
TargetTypeEnum
.
THIRD_RESOURCE
.
getValue
());
addResourceApplyDTO
.
setCrowdTypeList
(
crowdTypeList
);
addResourceApplyDTO
.
setContentTypeList
(
contentTypeList
);
appletResourceApplyBiz
.
addResourceApply
(
addResourceApplyDTO
);
}
@Override
...
...
@@ -365,14 +399,25 @@ public class AppletThirdResourcesBizImpl implements AppletThirdResourcesBiz {
return
new
HashMap
<>();
}
//推送图片类型
List
<
Long
>
thirdResourceIds
=
appletsByIds
.
stream
().
filter
(
s
->
s
.
getType
()
==
2
)
setResourcesPic
(
appletsByIds
);
Map
<
Long
,
AppletThirdResources
>
appletThirdResourcesMap
=
appletsByIds
.
stream
().
collect
(
Collectors
.
toMap
(
e
->
e
.
getId
(),
Function
.
identity
(),(
key1
,
key2
)
->
key2
));
return
appletThirdResourcesMap
;
}
private
void
setResourcesPic
(
List
<
AppletThirdResources
>
thirdResourcesList
)
{
if
(
ListUtils
.
isEmpty
(
thirdResourcesList
))
{
return
;
}
//推送图片类型
List
<
Long
>
thirdResourceIds
=
thirdResourcesList
.
stream
().
filter
(
s
->
s
.
getType
()
==
2
)
.
map
(
AppletThirdResources:
:
getId
).
collect
(
Collectors
.
toList
());
if
(!
ListUtils
.
isEmpty
(
thirdResourceIds
))
{
List
<
AppletThirdResourcesPic
>
picList
=
appletThirdResourcesPicMapper
.
getPicListByResourceIds
(
thirdResourceIds
);
Map
<
Long
,
List
<
String
>>
picMap
=
picList
.
stream
().
collect
(
Collectors
.
groupingBy
(
AppletThirdResourcesPic:
:
getThirdResourcesId
,
Collectors
.
mapping
(
AppletThirdResourcesPic:
:
getPicUrl
,
Collectors
.
toList
())));
if
(!
MapUtils
.
isEmpty
(
picMap
))
{
for
(
AppletThirdResources
resources
:
appletsByIds
)
{
for
(
AppletThirdResources
resources
:
thirdResourcesList
)
{
if
(
picMap
.
containsKey
(
resources
.
getId
()))
{
List
<
String
>
picUrlList
=
picMap
.
get
(
resources
.
getId
());
resources
.
setPicUrlList
(
picUrlList
);
...
...
@@ -380,14 +425,28 @@ public class AppletThirdResourcesBizImpl implements AppletThirdResourcesBiz {
}
}
}
Map
<
Long
,
AppletThirdResources
>
appletThirdResourcesMap
=
appletsByIds
.
stream
().
collect
(
Collectors
.
toMap
(
e
->
e
.
getId
(),
Function
.
identity
(),(
key1
,
key2
)
->
key2
));
return
appletThirdResourcesMap
;
}
@Override
public
List
<
AppletThirdResources
>
getThirdResourcesByNewsId
(
Long
newsId
)
{
return
thirdResourcesDao
.
getThirdResourcesByNewsId
(
newsId
);
}
@Override
public
PageBeanNew
<
AppletThirdResources
>
getThirdResourcesByGradeLabel4ResourcePage
(
Long
gradeLabelId
,
Integer
currentPage
,
Integer
numPerPage
)
{
String
startDate
=
DateUtils
.
formatDate
(
DateUtils
.
addDay
(
new
Date
(),
-
7
),
DateUtils
.
DATE_FORMAT_DATEONLY
);
//根据标签查询,按照近7天浏览量排序
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"startDate"
,
startDate
);
paramMap
.
put
(
"crowdType"
,
gradeLabelId
.
intValue
());
PageBeanNew
<
Long
>
idPageBean
=
thirdResourcesDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"listResourceIdByGradeLabelAndClickCount"
);
if
(
ListUtils
.
isEmpty
(
idPageBean
.
getRecordList
()))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
idPageBean
.
getTotalCount
(),
new
ArrayList
<>());
}
//资源详情
List
<
AppletThirdResources
>
thirdResources
=
thirdResourcesDao
.
getAppletsByIds
(
idPageBean
.
getRecordList
());
//推送图片类型
setResourcesPic
(
thirdResources
);
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
idPageBean
.
getTotalCount
(),
thirdResources
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletUserBookcaseBizImpl.java
View file @
ac20bae8
...
...
@@ -2,23 +2,16 @@ package com.pcloud.book.applet.biz.impl;
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.AppletThirdResourcesDao
;
import
com.pcloud.book.applet.dao.AppletUserBookcaseDao
;
import
com.pcloud.book.applet.dto.AppletNewsDTO
;
import
com.pcloud.book.applet.dto.AppletNewsServeDTO
;
import
com.pcloud.book.applet.dto.AppletTaskDTO
;
import
com.pcloud.book.applet.dto.AppletUserBookcaseDTO
;
import
com.pcloud.book.applet.dto.BaseTempletClassifyDTO
;
import
com.pcloud.book.applet.dto.BookResourceExcelDTO
;
import
com.pcloud.book.applet.dto.UserLastBookReDTO
;
import
com.pcloud.book.applet.entity.AppletThirdResources
;
import
com.pcloud.book.applet.entity.AppletUserBookcase
;
import
com.pcloud.book.applet.entity.AppletUserClickRecord
;
import
com.pcloud.book.applet.enums.AppletNewsServeTypeEnum
;
import
com.pcloud.book.applet.enums.AppletRecordTypeEnum
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.biz.BookAdviserBiz
;
import
com.pcloud.book.book.biz.BookBiz
;
...
...
@@ -26,6 +19,7 @@ import com.pcloud.book.book.constant.BookConstant;
import
com.pcloud.book.book.dao.BookDao
;
import
com.pcloud.book.book.dao.BookLabelDao
;
import
com.pcloud.book.book.dao.BookRaysClassifyDao
;
import
com.pcloud.book.book.dto.BookAdviserDto
;
import
com.pcloud.book.book.entity.BookLabel
;
import
com.pcloud.book.book.entity.BookRaysClassify
;
import
com.pcloud.book.consumer.app.AssistTempletConsr
;
...
...
@@ -35,38 +29,31 @@ import com.pcloud.book.consumer.user.AdviserConsr;
import
com.pcloud.book.copyright.tools.ExcelUtil
;
import
com.pcloud.book.es.biz.ESBookAndAdviserBiz
;
import
com.pcloud.book.group.biz.BookGroupBiz
;
import
com.pcloud.book.group.biz.ResourcePageBiz
;
import
com.pcloud.book.group.dto.BookServeDTO
;
import
com.pcloud.book.group.enums.AppAndProductTypeEnum
;
import
com.pcloud.book.group.enums.JoinGroupTypeEnum
;
import
com.pcloud.book.push.dao.PersonalAppletsDao
;
import
com.pcloud.book.push.entity.PersonalApplets
;
import
com.pcloud.book.rightsSetting.biz.RightsSettingBiz
;
import
com.pcloud.book.rightsSetting.dao.RightsSettingDAO
;
import
com.pcloud.book.rightsSetting.dto.RightsSettingDto
;
import
com.pcloud.book.rightsSetting.entity.RightsNowItem
;
import
com.pcloud.book.rightsSetting.entity.RightsReadType
;
import
com.pcloud.book.rightsSetting.entity.RightsSetting
;
import
com.pcloud.book.rightsSetting.enums.RightsNowItemTypeNew
;
import
com.pcloud.book.rightsSetting.enums.RightsServeTypeEnum
;
import
com.pcloud.book.util.common.ThreadPoolUtils
;
import
com.pcloud.book.util.properties.BookProps
;
import
com.pcloud.channelcenter.base.exceptions.ChannelBizException
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.BeanUtils
;
import
com.pcloud.common.utils.DateUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.cache.redis.JedisClusterUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.readercenter.common.enums.YesOrNoNumEnum
;
import
com.pcloud.readercenter.rmall.constants.RmallContants
;
import
com.pcloud.readercenter.rmall.enums.MoneyReceiveTypeEnum
;
import
com.pcloud.readercenter.userlabel.dto.UserGradeLabelIdDTO
;
import
com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.regexp.RE
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.multipart.MultipartFile
;
...
...
@@ -113,10 +100,6 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
@Autowired
private
ESBookAndAdviserBiz
esBookAndAdviserBiz
;
@Autowired
private
PersonalAppletsDao
personalAppletsDao
;
@Autowired
private
AppletNewsBiz
appletNewsBiz
;
@Autowired
private
RightsSettingDAO
rightsSettingDAO
;
@Autowired
private
BookAdviserBiz
bookAdviserBiz
;
...
...
@@ -129,13 +112,13 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
@Autowired
private
BookDao
bookDao
;
@Autowired
private
AppletThirdResourcesDao
appletThirdResourcesDao
;
@Autowired
private
RmallBookMoneyRecordService
rmallBookMoneyRecordService
;
@Autowired
private
BookLabelDao
bookLabelDao
;
@Autowired
private
ReaderConsr
readerConsr
;
@Autowired
private
ResourcePageBiz
resourcePageBiz
;
@Override
@ParamLog
(
"小程序用户添加书架"
)
...
...
@@ -150,47 +133,73 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
(
null
==
appletUserBookcase
.
getChannelId
()
||
null
==
appletUserBookcase
.
getAdviserId
()))
{
return
appletTaskDTO
;
}
if
(
null
==
appletUserBookcase
.
getRightsSettingId
())
{
//书刊对应的权益
RightsSettingDto
rightsSettingDto
=
rightsSettingBiz
.
getReadType4Book
(
wechatUserId
,
appletUserBookcase
.
getBookId
(),
appletUserBookcase
.
getChannelId
(),
appletUserBookcase
.
getAdviserId
());
appletUserBookcase
.
setRightsSettingId
(
rightsSettingDto
==
null
?
null
:
rightsSettingDto
.
getId
());
if
(
null
==
appletUserBookcase
.
getReadType
())
{
//取书刊第一种阅读方式
if
(
null
!=
rightsSettingDto
&&
!
ListUtils
.
isEmpty
(
rightsSettingDto
.
getRightsReadTypes
()))
{
for
(
RightsReadType
rightsReadType
:
rightsSettingDto
.
getRightsReadTypes
())
{
if
(
null
!=
rightsReadType
&&
null
!=
rightsReadType
.
getRightsCount
()
&&
rightsReadType
.
getRightsCount
()
>
0
)
{
appletUserBookcase
.
setReadType
(
rightsReadType
.
getReadType
());
break
;
}
}
}
}
}
//小程序和H5公众号用户id
List
<
Long
>
wechatUserIdList
=
readerConsr
.
getRelateUserIdList
(
wechatUserId
,
appletUserBookcase
.
getOfficialAccountsId
());
//查询这本书书架中有没有
AppletUserBookcase
userBook
=
appletUserBookcaseDao
.
getUserReadType
(
wechatUserId
,
appletUserBookcase
.
getBookId
(),
appletUserBookcase
.
getAdviserId
(),
appletUserBookcase
.
getChannelId
());
if
(
null
==
userBook
)
{
AppletUserBookcase
userBook
=
appletUserBookcaseDao
.
getUserReadType
(
wechatUserIdList
,
appletUserBookcase
.
getBookId
(),
appletUserBookcase
.
getAdviserId
(),
appletUserBookcase
.
getChannelId
());
//小程序领取书币任务埋点
if
(
null
==
userBook
&&
appletUserBookcase
.
getOfficialAccountsId
().
equals
(
BookProps
.
getMiniOfficialAccountsId
()))
{
Integer
taskCount
=
readerConsr
.
getTaskCount
(
wechatUserId
,
MoneyReceiveTypeEnum
.
NEW_BOOK
.
key
);
Integer
subtractTaskCount
=
RmallContants
.
NEW_BOOK_MONEY_TIMES
-
1
;
if
(
null
!=
taskCount
&&
subtractTaskCount
.
equals
(
taskCount
))
{
isFinish
=
1
;
}
RMALL_SIGN_IN
.
execute
(()->{
//收藏埋点
RmallBookMoneyRecord
rmallBookMoneyRecord
=
new
RmallBookMoneyRecord
();
rmallBookMoneyRecord
.
setWechatUserId
(
wechatUserId
);
rmallBookMoneyRecord
.
setRecordType
(
MoneyReceiveTypeEnum
.
NEW_BOOK
.
key
);
rmallBookMoneyRecordService
.
insert
(
rmallBookMoneyRecord
);
});
}
//数据库去重
appletUserBookcaseDao
.
insert
(
appletUserBookcase
);
JedisClusterUtils
.
del
(
AppletConstants
.
USER_BOOK_CASE
+
wechatUserId
);
JedisClusterUtils
.
del
(
AppletConstants
.
USER_BOOK_CASE_COUNT
+
wechatUserId
);
esBookAndAdviserBiz
.
updateBookAndAdviserToES
(
Collections
.
singletonList
(
appletUserBookcase
.
getBookId
()));
//保存书刊
if
(
null
==
userBook
)
{
appletUserBookcaseDao
.
insert
(
appletUserBookcase
);
}
else
{
appletUserBookcaseDao
.
insert
(
userBook
);
}
appletTaskDTO
.
setIsFinishTask
(
isFinish
);
//清除缓存
delBookcaseRedis
(
wechatUserId
,
appletUserBookcase
.
getOfficialAccountsId
());
//更新用户年级标签
updateUserGradeLabel
(
appletUserBookcase
);
return
appletTaskDTO
;
}
private
void
updateUserGradeLabel
(
AppletUserBookcase
appletUserBookcase
)
{
//用户没有标签,更新用户年级标签
UserGradeLabelIdDTO
labelIdDTO
=
readerConsr
.
getUserGrade
(
appletUserBookcase
.
getWechatUserId
(),
appletUserBookcase
.
getOfficialAccountsId
());
if
(
null
!=
labelIdDTO
)
{
return
;
}
BookAdviserDto
bookAdviserDto
=
bookAdviserBiz
.
getBase
(
appletUserBookcase
.
getBookId
(),
appletUserBookcase
.
getChannelId
(),
appletUserBookcase
.
getAdviserId
());
if
(
null
==
bookAdviserDto
)
{
return
;
}
Long
gradeId
=
null
;
if
(
null
!=
bookAdviserDto
.
getGraLabelId
())
{
gradeId
=
resourcePageBiz
.
getGradeByGradeLabelId
(
bookAdviserDto
.
getGraLabelId
());
}
if
(
null
!=
bookAdviserDto
.
getDepLabelId
())
{
gradeId
=
resourcePageBiz
.
getGradeByDepLabelId
(
bookAdviserDto
.
getDepLabelId
());
}
if
(
null
!=
gradeId
)
{
readerConsr
.
addUserGradeLabel
(
appletUserBookcase
.
getWechatUserId
(),
appletUserBookcase
.
getOfficialAccountsId
(),
gradeId
);
}
}
private
void
delBookcaseRedis
(
Long
wechatUserId
,
Long
officialAccountsId
)
{
List
<
Long
>
wechatUserIdList
=
readerConsr
.
getRelateUserIdList
(
wechatUserId
,
officialAccountsId
);
for
(
Long
userId
:
wechatUserIdList
)
{
JedisClusterUtils
.
del
(
AppletConstants
.
USER_BOOK_CASE
+
userId
);
JedisClusterUtils
.
del
(
AppletConstants
.
USER_BOOK_CASE_COUNT
+
userId
);
}
}
@Override
public
PageBeanNew
<
AppletUserBookcaseDTO
>
listByWechatUserId
(
Long
wechatUserId
,
Integer
currentPage
,
Integer
numPerPage
)
{
public
PageBeanNew
<
AppletUserBookcaseDTO
>
listByWechatUserId
(
Long
wechatUserId
,
Integer
currentPage
,
Integer
numPerPage
,
Long
officialAccountsId
)
{
List
<
Long
>
wechatUserIdList
=
readerConsr
.
getRelateUserIdList
(
wechatUserId
,
officialAccountsId
);
//缓存中查
String
key
=
AppletConstants
.
USER_BOOK_CASE
+
wechatUserId
;
String
field
=
currentPage
+
"-"
+
numPerPage
;
...
...
@@ -201,27 +210,12 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
if
(!
StringUtil
.
isEmpty
(
countStr
))
{
count
=
Integer
.
valueOf
(
countStr
);
}
//首页数据是否正确
Boolean
correct
=
true
;
Integer
correctCount
=
0
;
if
(
0
==
currentPage
&&
BookConstant
.
HOME_BOOK_PAGE
==
numPerPage
&&
!
ListUtils
.
isEmpty
(
bookcaseDTOS
))
{
for
(
AppletUserBookcaseDTO
appletUserBookcase
:
bookcaseDTOS
)
{
Long
settingId
=
appletUserBookcase
.
getRightsSettingId
()
==
null
?
0L
:
appletUserBookcase
.
getRightsSettingId
();
RightsSettingDto
rightsSettingDto
=
rightsSettingBiz
.
getRightsSettingByBookId4AppletHome
(
appletUserBookcase
.
getBookId
(),
appletUserBookcase
.
getAdviserId
(),
appletUserBookcase
.
getChannelId
());
Long
actualSettingId
=
rightsSettingDto
.
getId
()
==
null
?
0L
:
rightsSettingDto
.
getId
();
if
(!
actualSettingId
.
equals
(
settingId
))
{
appletUserBookcaseDao
.
updateRightsSettingId
(
actualSettingId
>
0
?
actualSettingId
:
null
,
appletUserBookcase
.
getBookId
(),
appletUserBookcase
.
getAdviserId
(),
appletUserBookcase
.
getChannelId
());
}
else
{
++
correctCount
;
}
}
}
if
(!
ListUtils
.
isEmpty
(
bookcaseDTOS
)
&&
count
>
0
&&
correctCount
.
equals
(
bookcaseDTOS
.
size
()))
{
if
(!
ListUtils
.
isEmpty
(
bookcaseDTOS
)
&&
count
>
0
)
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
count
,
bookcaseDTOS
);
}
//数据库查询
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"wechatUserId
"
,
wechatUserId
);
map
.
put
(
"wechatUserId
List"
,
wechatUserIdList
);
PageBeanNew
<
AppletUserBookcaseDTO
>
pageBeanNew
=
appletUserBookcaseDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
map
,
"listByWechatUserId"
);
if
(
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
()))
{
...
...
@@ -396,60 +390,34 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
}
@ParamLog
(
"获取用户最后一次点击的书
(有社群书的取最后一次社群书,没有的取现代纸书)
"
)
@ParamLog
(
"获取用户最后一次点击的书"
)
@Override
public
UserLastBookReDTO
getUserLastBookRe
(
Long
wechatUserId
)
{
public
UserLastBookReDTO
getUserLastBookRe
(
Long
wechatUserId
,
Long
officialAccountsId
)
{
if
(
wechatUserId
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
List
<
Long
>
wechatUserIdList
=
readerConsr
.
getRelateUserIdList
(
wechatUserId
,
officialAccountsId
);
UserLastBookReDTO
lastBookRe
;
// 首先判断是否是馆配图书
lastBookRe
=
appletUserBookcaseDao
.
getUserLastGroupBook
(
wechatUserId
);
if
(
Objects
.
nonNull
(
lastBookRe
)
&&
bookBiz
.
checkIsLibraryBook
(
lastBookRe
.
getAdviserId
(),
lastBookRe
.
getBookId
()))
{
// 查询是否是社群书
lastBookRe
.
setBookGroup
(
bookDao
.
checkIsGroupBook
(
lastBookRe
.
getBookId
())
>
0
);
}
else
{
//查询最后一本社群书
lastBookRe
=
appletUserBookcaseDao
.
getUserLastGroupBookRe
(
wechatUserId
);
}
if
(
lastBookRe
!=
null
)
{
//查询最后开启小睿的一本书
lastBookRe
=
appletUserBookcaseDao
.
getUserLastRe
(
wechatUserIdList
);
if
(
Objects
.
nonNull
(
lastBookRe
))
{
lastBookRe
.
setHasBook
(
true
);
RightsSettingDto
rightsSettingDto
=
rightsSettingBiz
.
getRightsSettingByBookId4AppletHome
(
lastBookRe
.
getBookId
(),
lastBookRe
.
getAdviserId
(),
lastBookRe
.
getChannelId
());
if
(
rightsSettingDto
!=
null
)
{
lastBookRe
.
setRightSettingId
(
rightsSettingDto
.
getId
());
}
}
else
{
//查询最后一本书
lastBookRe
=
appletUserBookcaseDao
.
getUserLastRe
(
wechatUserId
);
if
(
lastBookRe
!=
null
)
{
lastBookRe
.
setBookGroup
(
false
);
lastBookRe
.
setHasBook
(
true
);
RightsSettingDto
rightsSettingDto
=
rightsSettingBiz
.
getRightsSettingByBookId4AppletHome
(
lastBookRe
.
getBookId
(),
lastBookRe
.
getAdviserId
(),
lastBookRe
.
getChannelId
());
if
(
rightsSettingDto
!=
null
)
{
lastBookRe
.
setRightSettingId
(
rightsSettingDto
.
getId
());
}
}
else
{
lastBookRe
=
new
UserLastBookReDTO
();
lastBookRe
.
setHasBook
(
false
);
}
}
if
(
lastBookRe
.
getHasBook
())
{
//判断是否是馆配图书
lastBookRe
.
setIsLibraryBook
(
bookBiz
.
checkIsLibraryBook
(
lastBookRe
.
getAdviserId
(),
lastBookRe
.
getBookId
())
?
1
:
0
);
}
if
(
Objects
.
isNull
(
lastBookRe
.
getRightSettingId
()))
{
lastBookRe
.
set
RightSettingId
(
bookBiz
.
getDefaultRightsSettingId
()
);
}
else
{
lastBookRe
=
new
UserLastBookReDTO
();
lastBookRe
.
set
HasBook
(
false
);
}
return
lastBookRe
;
}
@Override
public
void
deleteByIds
(
List
<
Long
>
ids
,
Long
wechatUserId
)
{
public
void
deleteByIds
(
List
<
Long
>
ids
,
Long
wechatUserId
,
Long
officialAccountsId
)
{
if
(
ListUtils
.
isEmpty
(
ids
))
{
return
;
}
appletUserBookcaseDao
.
deleteByIds
(
ids
);
JedisClusterUtils
.
del
(
AppletConstants
.
USER_BOOK_CASE
+
wechatUserId
);
JedisClusterUtils
.
del
(
AppletConstants
.
USER_BOOK_CASE_COUNT
+
wechatUserId
);
delBookcaseRedis
(
wechatUserId
,
officialAccountsId
);
ThreadPoolUtils
.
OTHER_THREAD_POOL
.
execute
(()->{
esBookAndAdviserBiz
.
updateBookAndAdviserToES
(
appletUserBookcaseDao
.
getBookIdsByIds
(
ids
));
});
...
...
@@ -464,12 +432,13 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
@Override
@ParamLog
(
"获取用户当前本书的阅读方式"
)
public
AppletUserBookcase
getUserReadType
(
Long
wechatUserId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
)
{
AppletUserBookcase
appletUserBookcase
=
appletUserBookcaseDao
.
getUserReadType
(
wechatUserId
,
bookId
,
adviserId
,
channelId
);
AppletUserBookcase
appletUserBookcase
=
appletUserBookcaseDao
.
getUserReadType
(
Arrays
.
asList
(
wechatUserId
)
,
bookId
,
adviserId
,
channelId
);
return
appletUserBookcase
;
}
@Override
public
void
randomChangeBook
(
Long
wechatUserId
)
{
Long
officialAccountsId
=
BookProps
.
getMiniOfficialAccountsId
();
List
<
AppletUserBookcase
>
bookcaseList
=
appletUserBookcaseDao
.
getListByUserId
(
wechatUserId
);
//无书或只有3本不处理
if
(
ListUtils
.
isEmpty
(
bookcaseList
)
||
bookcaseList
.
size
()
<
BookConstant
.
HOME_BOOK_PAGE
)
{
...
...
@@ -489,17 +458,18 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
bookcaseList
.
stream
().
forEach
(
e
->
e
.
setBookGroupId
(
null
==
e
.
getBookGroupId
()
?
0L
:
e
.
getBookGroupId
()));
//升序排序
bookcaseList
=
bookcaseList
.
stream
().
sorted
(
Comparator
.
comparing
(
AppletUserBookcase:
:
getBookGroupId
)).
collect
(
Collectors
.
toList
());
addUserBooks
(
bookcaseList
,
wechatUserId
);
addUserBooks
(
bookcaseList
,
wechatUserId
,
officialAccountsId
);
ThreadPoolUtils
.
OTHER_THREAD_POOL
.
execute
(()
->
{
this
.
listByWechatUserId
(
wechatUserId
,
0
,
BookConstant
.
HOME_BOOK_PAGE
);
this
.
listByWechatUserId
(
wechatUserId
,
0
,
BookConstant
.
HOME_BOOK_PAGE
,
officialAccountsId
);
});
}
private
void
addUserBooks
(
List
<
AppletUserBookcase
>
bookcaseList
,
Long
wechatUserId
)
{
private
void
addUserBooks
(
List
<
AppletUserBookcase
>
bookcaseList
,
Long
wechatUserId
,
Long
officialAccountsId
)
{
if
(
ListUtils
.
isEmpty
(
bookcaseList
))
{
return
;
}
bookcaseList
.
stream
().
forEach
(
appletUserBookcase
->
{
appletUserBookcase
.
setOfficialAccountsId
(
officialAccountsId
);
if
(
null
==
appletUserBookcase
.
getRightsSettingId
())
{
//书刊对应的权益
RightsSettingDto
rightsSettingDto
=
rightsSettingBiz
.
getReadType4Book
(
wechatUserId
,
appletUserBookcase
.
getBookId
(),
appletUserBookcase
.
getChannelId
(),
appletUserBookcase
.
getAdviserId
());
appletUserBookcase
.
setRightsSettingId
(
rightsSettingDto
==
null
?
null
:
rightsSettingDto
.
getId
());
...
...
@@ -517,8 +487,7 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
});
//数据库去重
appletUserBookcaseDao
.
insert
(
bookcaseList
);
JedisClusterUtils
.
del
(
AppletConstants
.
USER_BOOK_CASE
+
wechatUserId
);
JedisClusterUtils
.
del
(
AppletConstants
.
USER_BOOK_CASE_COUNT
+
wechatUserId
);
delBookcaseRedis
(
wechatUserId
,
officialAccountsId
);
List
<
Long
>
bookIds
=
bookcaseList
.
stream
().
map
(
e
->
e
.
getBookId
()).
collect
(
Collectors
.
toList
());
if
(!
ListUtils
.
isEmpty
(
bookIds
))
{
esBookAndAdviserBiz
.
updateBookAndAdviserToES
(
bookIds
);
...
...
@@ -546,8 +515,9 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
}
@Override
public
List
<
Long
>
getBookcaseIdListByUser
(
Long
wechatUserId
)
{
return
appletUserBookcaseDao
.
getBookcaseIdListByUser
(
wechatUserId
);
public
List
<
Long
>
getBookcaseIdListByUser
(
Long
wechatUserId
,
Long
officialAccountsId
)
{
List
<
Long
>
wechatUserIdList
=
readerConsr
.
getRelateUserIdList
(
wechatUserId
,
officialAccountsId
);
return
appletUserBookcaseDao
.
getBookcaseIdListByUser
(
wechatUserIdList
);
}
@Override
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/ServeCollectBizImpl.java
View file @
ac20bae8
...
...
@@ -98,9 +98,11 @@ public class ServeCollectBizImpl implements ServeCollectBiz {
@Override
@ParamLog
(
"查询多条数据"
)
public
PageBeanNew
getList
(
Long
wechatUserId
,
Integer
currentPage
,
Integer
numPerPage
,
String
typeCode
)
{
public
PageBeanNew
getList
(
Long
wechatUserId
,
Integer
currentPage
,
Integer
numPerPage
,
String
typeCode
,
Long
officialAccountsId
)
{
List
<
Long
>
wechatUserIds
=
readerConsr
.
getRelateUserIdList
(
wechatUserId
,
officialAccountsId
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"wechatUserId
"
,
wechatUserId
);
paramMap
.
put
(
"wechatUserId
s"
,
wechatUserIds
);
paramMap
.
put
(
"typeCode"
,
typeCode
);
PageBeanNew
pageBeanNew
=
serveCollectDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"getList"
);
List
recordList
=
pageBeanNew
.
getRecordList
();
...
...
@@ -392,8 +394,9 @@ public class ServeCollectBizImpl implements ServeCollectBiz {
}
@Override
public
List
<
CollectionTypeNameAndCountDTO
>
getTypeNameAndCountByWechatId
(
Long
wechatUserId
)
{
return
serveCollectDao
.
getTypeNameAndCountByWechatId
(
wechatUserId
);
public
List
<
CollectionTypeNameAndCountDTO
>
getTypeNameAndCountByWechatId
(
Long
wechatUserId
,
Long
officialAccountsId
)
{
List
<
Long
>
wechatUserIds
=
readerConsr
.
getRelateUserIdList
(
wechatUserId
,
officialAccountsId
);
return
serveCollectDao
.
getTypeNameAndCountByWechatId
(
wechatUserIds
);
}
@Override
...
...
@@ -645,8 +648,9 @@ public class ServeCollectBizImpl implements ServeCollectBiz {
}
@Override
public
List
<
Long
>
getAllCollect
(
Long
wechatUserId
,
String
typeCode
)
{
return
serveCollectDao
.
getAllCollect
(
wechatUserId
,
typeCode
);
public
List
<
Long
>
getAllCollect
(
Long
wechatUserId
,
String
typeCode
,
Long
officialAccountsId
)
{
List
<
Long
>
wechatUserIds
=
readerConsr
.
getRelateUserIdList
(
wechatUserId
,
officialAccountsId
);
return
serveCollectDao
.
getAllCollect
(
wechatUserIds
,
typeCode
);
}
@Override
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/contants/AppletResourceApplyConstants.java
0 → 100644
View file @
ac20bae8
package
com
.
pcloud
.
book
.
applet
.
contants
;
/**
* @ClassName com.pcloud.book.applet.contants.AppletResourceApplyConstants
* @Author zhuyajie
* @Description 资源适用范围
* @Date 2021/5/8 14:54
* @Version 1.0
**/
public
class
AppletResourceApplyConstants
{
/**
* 资源类型
* @author:zhuyajie
* @date:2021/5/8 15:03
* * @param null
*/
public
enum
TargetTypeEnum
{
THIRD_RESOURCE
(
"THIRD_RESOURCE"
),
BOOKLIST
(
"BOOKLIST"
),
BANNER
(
"BANNER"
),
TEACHER
(
"TEACHER"
);
private
String
value
;
public
String
getValue
()
{
return
value
;
}
TargetTypeEnum
(
String
value
)
{
this
.
value
=
value
;
}
}
/**
* 适用人群
* @author:zhuyajie
* @date:2021/5/8 15:03
* * @param null
*/
public
enum
CrowdTypeEnum
{
PRESCHOOL
(
1
,
"学龄前"
),
PRIMARY_SCHOOL
(
2
,
"小学"
),
JUNIOR_HIGH_SCHOOL
(
3
,
"初中"
),
SENIOR_HIGH_SCHOOL
(
4
,
"高中"
),
UNIVERSITY
(
5
,
"大学"
),
ADULT
(
6
,
"成人"
);
private
Integer
code
;
private
String
name
;
public
Integer
getCode
()
{
return
code
;
}
public
String
getName
()
{
return
name
;
}
CrowdTypeEnum
(
Integer
code
,
String
name
)
{
this
.
code
=
code
;
this
.
name
=
name
;
}
}
/**
* 内容类型
* @author:zhuyajie
* @date:2021/5/8 15:07
* * @param null
*/
public
enum
ContentTypeEnum
{
ONLINE
(
1
,
"线上网课"
),
OFFILINE
(
2
,
"线下班"
),
GROUP
(
3
,
"社群"
),
RESOURCE
(
4
,
"资源服务"
);
private
Integer
code
;
private
String
name
;
public
Integer
getCode
()
{
return
code
;
}
public
String
getName
()
{
return
name
;
}
ContentTypeEnum
(
Integer
code
,
String
name
)
{
this
.
code
=
code
;
this
.
name
=
name
;
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/AnswerSubscribePopupDao.java
0 → 100644
View file @
ac20bae8
package
com
.
pcloud
.
book
.
applet
.
dao
;
import
com.pcloud.book.applet.entity.AnswerSubscribePopup
;
import
com.pcloud.common.core.dao.BaseDao
;
/**
* 用户书刊订阅二维码弹出记录(AnswerSubscribePopup)表数据库访问层
*
* @author makejava
* @since 2021-05-14 15:28:33
*/
public
interface
AnswerSubscribePopupDao
extends
BaseDao
<
AnswerSubscribePopup
>{
/**
* 查最近记录
* @author:zhuyajie
* @date:2021/5/14 16:44
* * @param null
*/
AnswerSubscribePopup
getLastRecord
(
Long
wechatUserId
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/AppletRecordSevenDayDao.java
0 → 100644
View file @
ac20bae8
package
com
.
pcloud
.
book
.
applet
.
dao
;
import
com.pcloud.book.applet.dto.AppletRecordDTO
;
import
com.pcloud.book.applet.entity.AppletRecordSevenDay
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
/**
* H5资源广场(关键词搜索7天浏览量高的应用作品)(AppletRecordSevenDay)表数据库访问层
*
* @author makejava
* @since 2021-05-19 17:18:26
*/
public
interface
AppletRecordSevenDayDao
extends
BaseDao
<
AppletRecordSevenDay
>{
void
deleteBySourceType
(
Integer
sourceType
);
List
<
AppletRecordDTO
>
getResourceByGrade4H5
(
Integer
sourceType
,
List
<
Long
>
gradeLabelIds
,
Integer
limit
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/AppletResourceApplyDao.java
0 → 100644
View file @
ac20bae8
package
com
.
pcloud
.
book
.
applet
.
dao
;
import
com.pcloud.book.applet.entity.AppletResourceApply
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
/**
* 第三方资源/书单/banner适用范围(AppletResourceApply)表数据库访问层
*
* @author makejava
* @since 2021-05-08 14:11:42
*/
public
interface
AppletResourceApplyDao
extends
BaseDao
<
AppletResourceApply
>{
/**
* 删除适用人群
* @author:zhuyajie
* @date:2021/5/8 15:27
* * @param null
*/
void
deleteCrowdType
(
Long
targetId
,
String
targetType
);
/**
* 删除内容类型
* @author:zhuyajie
* @date:2021/5/8 15:27
* * @param null
*/
void
deleteContentType
(
Long
targetId
,
String
targetType
);
/**
* 查适用人群
* @author:zhuyajie
* @date:2021/5/8 15:48
* * @param null
*/
List
<
Integer
>
getCrowdTypeList
(
Long
targetId
,
String
targetType
);
/**
* 查内容类型
* @author:zhuyajie
* @date:2021/5/8 15:48
* * @param null
*/
List
<
Integer
>
getContentTypeList
(
Long
targetId
,
String
targetType
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/AppletUserBookcaseDao.java
View file @
ac20bae8
...
...
@@ -49,7 +49,7 @@ public interface AppletUserBookcaseDao extends BaseDao<AppletUserBookcase> {
UserLastBookReDTO
getUserLastGroupBookRe
(
Long
wechatUserId
);
UserLastBookReDTO
getUserLastRe
(
L
ong
wechatUserId
);
UserLastBookReDTO
getUserLastRe
(
L
ist
<
Long
>
wechatUserIdList
);
/**
* 批量删除
...
...
@@ -61,7 +61,7 @@ public interface AppletUserBookcaseDao extends BaseDao<AppletUserBookcase> {
void
updateUserReadType
(
AppletUserBookcase
appletUserBookcase
);
AppletUserBookcase
getUserReadType
(
L
ong
wechatUserId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
);
AppletUserBookcase
getUserReadType
(
L
ist
<
Long
>
wechatUserIdList
,
Long
bookId
,
Long
adviserId
,
Long
channelId
);
/**
* 查书架列表
* @author:zhuyajie
...
...
@@ -76,7 +76,7 @@ public interface AppletUserBookcaseDao extends BaseDao<AppletUserBookcase> {
* @date:2020/5/29 13:11
* * @param null
*/
List
<
Long
>
getBookcaseIdListByUser
(
L
ong
wechatUserId
);
List
<
Long
>
getBookcaseIdListByUser
(
L
ist
<
Long
>
wechatUserIdList
);
/**
* 更新书刊对应的权益
* @author:zhuyajie
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/ServeCollectDao.java
View file @
ac20bae8
...
...
@@ -23,13 +23,13 @@ public interface ServeCollectDao extends BaseDao<ServeCollect> {
List
<
ServeCollect
>
getList4RightsSetting
(
List
<
ServeCollect
>
serveCollects
);
List
<
Long
>
getAllCollect
(
L
ong
wechatUserId
,
String
typeCode
);
List
<
Long
>
getAllCollect
(
L
ist
<
Long
>
wechatUserIds
,
String
typeCode
);
List
<
ServeCollectDTO
>
getList4Collect
(
List
<
ServeCollectDTO
>
serveCollects
);
List
<
ServeCollect
>
getList4RightsSettingByWechatUserId
(
Long
wechatUserId
);
List
<
CollectionTypeNameAndCountDTO
>
getTypeNameAndCountByWechatId
(
L
ong
wechatUserId
);
List
<
CollectionTypeNameAndCountDTO
>
getTypeNameAndCountByWechatId
(
L
ist
<
Long
>
wechatUserIds
);
ServeCollectDTO
isCollected
(
Long
wechatUserId
,
Long
serveId
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/impl/AnswerSubscribePopupDaoImpl.java
0 → 100644
View file @
ac20bae8
package
com
.
pcloud
.
book
.
applet
.
dao
.
impl
;
import
com.pcloud.book.applet.dao.AnswerSubscribePopupDao
;
import
com.pcloud.book.applet.entity.AnswerSubscribePopup
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
/**
* @ClassName com.pcloud.book.applet.dao.impl.AnswerSubscribePopupDaoImpl
* @Author zhuyajie
* @Description 书刊订阅二维码弹出记录
* @Date 2021/5/14 15:30
* @Version 1.0
**/
@Component
public
class
AnswerSubscribePopupDaoImpl
extends
BaseDaoImpl
<
AnswerSubscribePopup
>
implements
AnswerSubscribePopupDao
{
@Override
public
AnswerSubscribePopup
getLastRecord
(
Long
wechatUserId
)
{
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getLastRecord"
),
wechatUserId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/impl/AppletRecordSevenDayDaoImpl.java
0 → 100644
View file @
ac20bae8
package
com
.
pcloud
.
book
.
applet
.
dao
.
impl
;
import
com.pcloud.book.applet.dao.AppletRecordSevenDayDao
;
import
com.pcloud.book.applet.dto.AppletRecordDTO
;
import
com.pcloud.book.applet.entity.AppletRecordSevenDay
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @ClassName com.pcloud.book.applet.dao.impl.AppletRecordSevenDayDaoImpl
* @Author zhuyajie
* @Description 资源7天统计
* @Date 2021/5/19 17:22
* @Version 1.0
**/
@Component
public
class
AppletRecordSevenDayDaoImpl
extends
BaseDaoImpl
<
AppletRecordSevenDay
>
implements
AppletRecordSevenDayDao
{
@Override
public
void
deleteBySourceType
(
Integer
sourceType
)
{
getSessionTemplate
().
delete
(
getStatement
(
"deleteBySourceType"
),
sourceType
);
}
@Override
public
List
<
AppletRecordDTO
>
getResourceByGrade4H5
(
Integer
sourceType
,
List
<
Long
>
gradeLabelIds
,
Integer
limit
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"sourceType"
,
sourceType
);
map
.
put
(
"gradeLabelIds"
,
gradeLabelIds
);
map
.
put
(
"limit"
,
limit
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getResourceByGrade4H5"
),
map
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/impl/AppletResourceApplyDaoImpl.java
0 → 100644
View file @
ac20bae8
package
com
.
pcloud
.
book
.
applet
.
dao
.
impl
;
import
com.pcloud.book.applet.dao.AppletResourceApplyDao
;
import
com.pcloud.book.applet.entity.AppletResourceApply
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @ClassName com.pcloud.book.applet.dao.impl.AppletResourceApplyDaoImpl
* @Author zhuyajie
* @Description
* @Date 2021/5/8 14:46
* @Version 1.0
**/
@Component
public
class
AppletResourceApplyDaoImpl
extends
BaseDaoImpl
<
AppletResourceApply
>
implements
AppletResourceApplyDao
{
@Override
public
void
deleteCrowdType
(
Long
targetId
,
String
targetType
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"targetId"
,
targetId
);
map
.
put
(
"targetType"
,
targetType
);
getSessionTemplate
().
delete
(
getStatement
(
"deleteCrowdType"
),
map
);
}
@Override
public
void
deleteContentType
(
Long
targetId
,
String
targetType
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"targetId"
,
targetId
);
map
.
put
(
"targetType"
,
targetType
);
getSessionTemplate
().
delete
(
getStatement
(
"deleteContentType"
),
map
);
}
@Override
public
List
<
Integer
>
getCrowdTypeList
(
Long
targetId
,
String
targetType
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"targetId"
,
targetId
);
map
.
put
(
"targetType"
,
targetType
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getCrowdTypeList"
),
map
);
}
@Override
public
List
<
Integer
>
getContentTypeList
(
Long
targetId
,
String
targetType
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"targetId"
,
targetId
);
map
.
put
(
"targetType"
,
targetType
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getContentTypeList"
),
map
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/impl/AppletUserBookcaseDaoImpl.java
View file @
ac20bae8
...
...
@@ -62,8 +62,8 @@ public class AppletUserBookcaseDaoImpl extends BaseDaoImpl<AppletUserBookcase> i
}
@Override
public
UserLastBookReDTO
getUserLastRe
(
L
ong
wechatUserId
)
{
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getUserLastRe"
),
wechatUserId
);
public
UserLastBookReDTO
getUserLastRe
(
L
ist
<
Long
>
wechatUserIdList
)
{
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getUserLastRe"
),
wechatUserId
List
);
}
@Override
...
...
@@ -77,9 +77,9 @@ public class AppletUserBookcaseDaoImpl extends BaseDaoImpl<AppletUserBookcase> i
}
@Override
public
AppletUserBookcase
getUserReadType
(
L
ong
wechatUserId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
)
{
public
AppletUserBookcase
getUserReadType
(
L
ist
<
Long
>
wechatUserIdList
,
Long
bookId
,
Long
adviserId
,
Long
channelId
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"wechatUserId
"
,
wechatUserId
);
paramMap
.
put
(
"wechatUserId
List"
,
wechatUserIdList
);
paramMap
.
put
(
"bookId"
,
bookId
);
paramMap
.
put
(
"adviserId"
,
adviserId
);
paramMap
.
put
(
"channelId"
,
channelId
);
...
...
@@ -92,8 +92,8 @@ public class AppletUserBookcaseDaoImpl extends BaseDaoImpl<AppletUserBookcase> i
}
@Override
public
List
<
Long
>
getBookcaseIdListByUser
(
L
ong
wechatUserId
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getBookcaseIdListByUser"
),
wechatUserId
);
public
List
<
Long
>
getBookcaseIdListByUser
(
L
ist
<
Long
>
wechatUserIdList
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getBookcaseIdListByUser"
),
wechatUserId
List
);
}
@Override
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/impl/ServeCollectDaoImpl.java
View file @
ac20bae8
...
...
@@ -43,8 +43,8 @@ public class ServeCollectDaoImpl extends BaseDaoImpl<ServeCollect> implements Se
}
@Override
public
List
<
CollectionTypeNameAndCountDTO
>
getTypeNameAndCountByWechatId
(
L
ong
wechatUserId
)
{
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getTypeNameAndCountByWechatId"
),
wechatUserId
);
public
List
<
CollectionTypeNameAndCountDTO
>
getTypeNameAndCountByWechatId
(
L
ist
<
Long
>
wechatUserIds
)
{
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getTypeNameAndCountByWechatId"
),
wechatUserId
s
);
}
@Override
...
...
@@ -76,9 +76,9 @@ public class ServeCollectDaoImpl extends BaseDaoImpl<ServeCollect> implements Se
}
@Override
public
List
<
Long
>
getAllCollect
(
L
ong
wechatUserId
,
String
typeCode
)
{
public
List
<
Long
>
getAllCollect
(
L
ist
<
Long
>
wechatUserIds
,
String
typeCode
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"wechatUserId
"
,
wechatUserId
);
paramMap
.
put
(
"wechatUserId
s"
,
wechatUserIds
);
paramMap
.
put
(
"typeCode"
,
typeCode
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getAllCollect"
),
paramMap
);
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/dto/AddResourceApplyDTO.java
0 → 100644
View file @
ac20bae8
package
com
.
pcloud
.
book
.
applet
.
dto
;
import
java.util.List
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @ClassName com.pcloud.book.applet.dto.AddResourceApplyDTO
* @Author zhuyajie
* @Description 资源适用范围
* @Date 2021/5/8 15:13
* @Version 1.0
**/
@Data
public
class
AddResourceApplyDTO
{
@ApiModelProperty
(
"第三方资源/外部书单/banner主键"
)
private
Long
targetId
;
@ApiModelProperty
(
"目标类型"
)
private
String
targetType
;
@ApiModelProperty
(
"适用人群类型"
)
private
List
<
Integer
>
crowdTypeList
;
@ApiModelProperty
(
"内容类型"
)
private
List
<
Integer
>
contentTypeList
;
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dto/AnswerSubscribeDTO.java
View file @
ac20bae8
...
...
@@ -35,4 +35,17 @@ public class AnswerSubscribeDTO extends BaseDto {
*/
private
Long
accountSettingId
;
/**
* 用户是否关注公众号
*/
private
Boolean
isSubscribe
;
/**
* 公众号二维码
*/
private
String
qrcodeUrl
;
/**
* 订阅类型(1书刊订阅2书刊答案订阅)
*/
private
Integer
subscribeType
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/dto/AppletBannerDTO.java
View file @
ac20bae8
...
...
@@ -8,6 +8,7 @@ import lombok.Data;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
import
java.util.List
;
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
...
...
@@ -80,4 +81,7 @@ public class AppletBannerDTO extends BaseDto {
@ApiModelProperty
(
"广告位置"
)
private
String
adPosition
;
@ApiModelProperty
(
"适用人群类型"
)
private
List
<
Integer
>
crowdTypeList
;
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dto/AppletRecordDTO.java
View file @
ac20bae8
...
...
@@ -99,4 +99,17 @@ public class AppletRecordDTO {
@ApiModelProperty
(
"图书封面"
)
private
String
coverImg
;
/**
* 专业标签
*/
private
Long
proLabelId
;
/**
* 深度标签
*/
private
Long
depLabelId
;
/**
* 目的标签
*/
private
Long
purLabelId
;
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dto/AppletThirdResourcesDTO.java
View file @
ac20bae8
...
...
@@ -109,5 +109,11 @@ public class AppletThirdResourcesDTO extends BaseDto {
@ApiModelProperty
(
"小程序原始id"
)
private
String
baseAppId
;
@ApiModelProperty
(
"适用人群类型"
)
private
List
<
Integer
>
crowdTypeList
;
@ApiModelProperty
(
"内容类型"
)
private
List
<
Integer
>
contentTypeList
;
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dto/UserLastBookReDTO.java
View file @
ac20bae8
...
...
@@ -17,8 +17,8 @@ public class UserLastBookReDTO {
@ApiModelProperty
(
"书id"
)
private
Long
bookId
;
@ApiModelProperty
(
"是否
社群
书"
)
private
Boolean
bookGroup
;
@ApiModelProperty
(
"是否
小睿
书"
)
private
Boolean
openRays
;
@ApiModelProperty
(
"编辑id"
)
private
Long
adviserId
;
...
...
@@ -26,12 +26,6 @@ public class UserLastBookReDTO {
@ApiModelProperty
(
"运营Id"
)
private
Long
channelId
;
@ApiModelProperty
(
"权益id"
)
private
Long
rightSettingId
;
@ApiModelProperty
(
"阅读方式"
)
private
Integer
readType
;
@ApiModelProperty
(
"是否馆配图书"
)
private
Integer
isLibraryBook
;
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/entity/AnswerSubscribePopup.java
0 → 100644
View file @
ac20bae8
package
com
.
pcloud
.
book
.
applet
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
java.util.Date
;
import
java.io.Serializable
;
import
lombok.Data
;
/**
* 用户书刊订阅二维码弹出记录(AnswerSubscribePopup)实体类
*
* @author makejava
* @since 2021-05-14 15:28:33
*/
@Data
public
class
AnswerSubscribePopup
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
-
89378633611621717L
;
/**
* 主键
*/
private
Long
id
;
/**
* 用户id
*/
private
Long
wechatUserId
;
/**
* 公众号id
*/
private
Long
accountSettingId
;
/**
* 书刊id
*/
private
Long
bookId
;
/**
* 渠道id
*/
private
Long
channelId
;
/**
* 编辑id
*/
private
Long
adviserId
;
/**
* 订阅类型(1书刊订阅2书刊答案订阅)
*/
private
Integer
subscribeType
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/entity/AppletBanner.java
View file @
ac20bae8
...
...
@@ -8,6 +8,7 @@ import lombok.Data;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
import
java.util.List
;
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
...
...
@@ -63,4 +64,6 @@ public class AppletBanner extends BaseEntity {
@ApiModelProperty
(
"更新banner是否涉及定时任务"
)
private
Integer
isTime
;
@ApiModelProperty
(
"适用人群类型"
)
private
List
<
Integer
>
crowdTypeList
;
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/entity/AppletLinkClick.java
View file @
ac20bae8
...
...
@@ -22,17 +22,15 @@ public class AppletLinkClick extends BaseEntity {
/**
* 用户id
*/
@NotNull
private
Long
wechatUserId
;
/**
* 1资讯/2
券库
* 1资讯/2
券库/3编辑群/4第三方群/5书单
*/
@NotNull
private
Integer
typeId
;
/**
* 业务id
*/
@NotNull
private
Long
fromId
;
/**
* 业务id
...
...
@@ -48,7 +46,12 @@ public class AppletLinkClick extends BaseEntity {
)
private
Date
createTime
;
/**
* 公众号id
*/
private
Long
officialAccountsId
;
/**
* 书单id
*/
private
Long
booklistId
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/entity/AppletRecordSevenDay.java
0 → 100644
View file @
ac20bae8
package
com
.
pcloud
.
book
.
applet
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
java.util.Date
;
import
java.io.Serializable
;
import
lombok.Data
;
/**
* H5资源广场(关键词搜索7天浏览量高的应用作品)(AppletRecordSevenDay)实体类
*
* @author makejava
* @since 2021-05-19 17:18:26
*/
@Data
public
class
AppletRecordSevenDay
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
615812208250214724L
;
/**
* 主键
*/
private
Long
id
;
/**
* 5 作品6 应用
*/
private
Integer
recordType
;
/**
* 来源id
*/
private
Long
fromId
;
/**
* 来源名称
*/
private
String
fromName
;
/**
* 应用作品类型
*/
private
String
typeCode
;
/**
* 跳转链接
*/
private
String
linkUrl
;
/**
* 专业标签
*/
private
Long
proLabelId
;
/**
* 深度标签
*/
private
Long
depLabelId
;
/**
* 目的标签
*/
private
Long
purLabelId
;
/**
* 浏览量
*/
private
Integer
clickCount
;
/**
* 浏览人数
*/
private
Integer
userCount
;
/**
* 模块栏目类型(1手抄报2涂色3DIY4亲子游戏5试卷6课件7作文8知识点)
*/
private
Integer
sourceType
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/entity/AppletResourceApply.java
0 → 100644
View file @
ac20bae8
package
com
.
pcloud
.
book
.
applet
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
java.util.Date
;
import
java.io.Serializable
;
import
lombok.Data
;
/**
* 第三方资源/书单/banner适用范围(AppletResourceApply)实体类
*
* @author makejava
* @since 2021-05-08 14:11:42
*/
@Data
public
class
AppletResourceApply
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
-
81487714212498658L
;
/**
* 主键
*/
private
Long
id
;
/**
* 第三方资源/外部书单/banner主键
*/
private
Long
targetId
;
/**
* 目标类型
*/
private
String
targetType
;
/**
* 适用用户学龄段类型
*/
private
Integer
crowdType
;
/**
* 适用内容类型
*/
private
Integer
contentType
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/entity/AppletThirdResourcesClick.java
View file @
ac20bae8
...
...
@@ -30,4 +30,6 @@ public class AppletThirdResourcesClick extends BaseEntity {
private
Long
newsId
;
@ApiModelProperty
(
"奖包券id"
)
private
Long
giftPackageId
;
@ApiModelProperty
(
"公众号id"
)
private
Long
officialAccountsId
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/entity/AppletUserBookcase.java
View file @
ac20bae8
...
...
@@ -29,4 +29,6 @@ public class AppletUserBookcase extends BaseEntity {
@ApiModelProperty
(
"是否社群书"
)
private
Long
bookGroupId
;
private
Long
officialAccountsId
;
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/facade/AppletHomeFacade.java
View file @
ac20bae8
...
...
@@ -619,11 +619,13 @@ public class AppletHomeFacade {
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestBody
@ApiParam
(
"图书"
)
AppletUserBookcase
appletUserBookcase
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Long
officialAccountsId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
if
(
null
==
appletUserBookcase
||
null
==
appletUserBookcase
.
getBookId
()
||
null
==
appletUserBookcase
.
getAdviserId
()
||
null
==
appletUserBookcase
.
getChannelId
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少参数"
);
}
appletUserBookcase
.
setWechatUserId
(
wechatUserId
);
appletUserBookcase
.
setOfficialAccountsId
(
officialAccountsId
);
return
new
ResponseDto
<>(
appletUserBookcaseBiz
.
addUserBook
(
appletUserBookcase
));
}
...
...
@@ -634,10 +636,11 @@ public class AppletHomeFacade {
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页数量"
)
Integer
numPerPage
){
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Long
officialAccountsId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
if
(
null
==
currentPage
||
null
==
numPerPage
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少分页参数"
);
}
return
new
ResponseDto
<>(
appletUserBookcaseBiz
.
listByWechatUserId
(
wechatUserId
,
currentPage
,
numPerPage
));
return
new
ResponseDto
<>(
appletUserBookcaseBiz
.
listByWechatUserId
(
wechatUserId
,
currentPage
,
numPerPage
,
officialAccountsId
));
}
@ApiOperation
(
"小程序首页书籍信息"
)
...
...
@@ -740,7 +743,8 @@ public class AppletHomeFacade {
@CookieValue
(
"userInfo"
)
String
userInfo
)
throws
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
appletUserBookcaseBiz
.
getUserLastBookRe
(
wechatUserId
));
Long
officialAccountsId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
return
new
ResponseDto
<>(
appletUserBookcaseBiz
.
getUserLastBookRe
(
wechatUserId
,
officialAccountsId
));
}
@ApiOperation
(
"获取社群共读"
)
...
...
@@ -811,7 +815,8 @@ public class AppletHomeFacade {
@PostMapping
(
"deleteBookcaseRecordByIds"
)
public
ResponseDto
<?>
deleteBookcaseRecordByIds
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestBody
List
<
Long
>
ids
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
appletUserBookcaseBiz
.
deleteByIds
(
ids
,
wechatUserId
);
Long
officialAccountsId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
appletUserBookcaseBiz
.
deleteByIds
(
ids
,
wechatUserId
,
officialAccountsId
);
return
new
ResponseDto
<>();
}
...
...
@@ -822,6 +827,9 @@ public class AppletHomeFacade {
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少参数"
);
}
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Long
officialAccountsId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
appletLinkClick
.
setWechatUserId
(
wechatUserId
);
appletLinkClick
.
setOfficialAccountsId
(
officialAccountsId
);
appletNewsBiz
.
addClickRecord
(
appletLinkClick
);
return
new
ResponseDto
<>();
}
...
...
@@ -967,10 +975,11 @@ public class AppletHomeFacade {
@GetMapping
(
"getBookcaseIdListByUser"
)
public
ResponseDto
<?>
getBookcaseIdListByUser
(
@CookieValue
(
"userInfo"
)
String
userInfo
){
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Long
officialAccountsId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
if
(!
NumberUtil
.
isNumber
(
wechatUserId
)){
throw
BookBizException
.
PARAM_DELETION
;
}
return
new
ResponseDto
<>(
appletUserBookcaseBiz
.
getBookcaseIdListByUser
(
wechatUserId
));
return
new
ResponseDto
<>(
appletUserBookcaseBiz
.
getBookcaseIdListByUser
(
wechatUserId
,
officialAccountsId
));
}
@ApiOperation
(
"批量更新资讯自定义标识"
)
...
...
@@ -1193,8 +1202,7 @@ public class AppletHomeFacade {
}
answerSubscribeDTO
.
setWechatUserId
(
wechatUserId
);
answerSubscribeDTO
.
setAccountSettingId
(
accountSettingId
);
answerSubscribeBiz
.
answerSubscribe
(
answerSubscribeDTO
);
return
new
ResponseDto
<>();
return
new
ResponseDto
<>(
answerSubscribeBiz
.
answerSubscribe
(
answerSubscribeDTO
));
}
@ApiOperation
(
"答案订阅"
)
...
...
@@ -1257,6 +1265,34 @@ public class AppletHomeFacade {
}
@ApiOperation
(
"H5首页-精选书单"
)
@GetMapping
(
"getBooklistByGradeLabel4ResourcePage"
)
public
ResponseDto
<?>
getBooklistByGradeLabel4ResourcePage
(
@RequestParam
(
"gradeLabelId"
)
Long
gradeLabelId
,
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
Integer
numPerPage
)
{
if
(
null
==
gradeLabelId
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少用户年级标签"
);
}
if
(
null
==
currentPage
||
null
==
numPerPage
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少分页参数"
);
}
return
new
ResponseDto
<>(
appletBooklistBiz
.
getBooklistByGradeLabel4ResourcePage
(
gradeLabelId
,
currentPage
,
numPerPage
));
}
@ApiOperation
(
"H5首页-banner列表"
)
@GetMapping
(
"getBannerByGradeLabel4ResourcePage"
)
public
ResponseDto
<?>
getBannerByGradeLabel4ResourcePage
(
@RequestParam
(
"gradeLabelId"
)
Long
gradeLabelId
,
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页数量"
)
Integer
numPerPage
)
{
if
(
null
==
gradeLabelId
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少用户年级标签"
);
}
if
(
null
==
currentPage
||
null
==
numPerPage
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少分页参数"
);
}
return
new
ResponseDto
<>(
appletBannerBiz
.
getBannerByGradeLabel4ResourcePage
(
gradeLabelId
,
currentPage
,
numPerPage
));
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/facade/AppletRecordAggrStatisFacade.java
View file @
ac20bae8
...
...
@@ -13,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Arrays
;
/**
* (AppletRecordAggrWeekStatis)表控制层
*
...
...
@@ -39,4 +41,23 @@ public class AppletRecordAggrStatisFacade {
return
new
ResponseDto
<>(
appletRecordAggrStatisBiz
.
getAggrStatis
(
wechatUserId
,
keyword
,
sourceType
,
rankType
,
currentPage
,
numPerPage
));
}
@ApiOperation
(
"H5资源查询"
)
@GetMapping
(
"getResource4H5"
)
public
ResponseDto
<?>
getResource4H5
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
value
=
"keyword"
,
required
=
false
)
String
keyword
,
@RequestParam
(
value
=
"sourceType"
,
required
=
false
)
Integer
sourceType
,
@RequestParam
(
value
=
"currentPage"
,
defaultValue
=
"0"
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
defaultValue
=
"10"
)
Integer
numPerPage
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Long
officialAccountsId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
return
new
ResponseDto
<>(
appletRecordAggrStatisBiz
.
getResource4H5
(
wechatUserId
,
officialAccountsId
,
keyword
,
sourceType
,
currentPage
,
numPerPage
));
}
@ApiOperation
(
"更新H5资源广场资源"
)
@GetMapping
(
"updateH5Resource"
)
public
ResponseDto
<?>
updateH5Resource
()
{
appletRecordAggrStatisBiz
.
updateH5Resource
();
return
new
ResponseDto
<>();
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/facade/AppletRecordFacade.java
View file @
ac20bae8
...
...
@@ -94,8 +94,9 @@ public class AppletRecordFacade {
public
ResponseDto
<
PageBeanNew
<
AppletRecordDTO
>>
listAppletRecord
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestBody
AppletRecordQueryVO
appletRecordQueryVO
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Long
officialAccountsId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
PageBeanNew
<
AppletRecordDTO
>
recordDTOPageBeanNew
=
appletRecordBiz
.
listAppletRecord
(
wechatUserId
,
appletRecordQueryVO
.
getDate
(),
appletRecordQueryVO
.
getRecordTypes
(),
appletRecordQueryVO
.
getQueryName
(),
appletRecordQueryVO
.
getCurrentPage
(),
appletRecordQueryVO
.
getNumPerPage
(),
appletRecordQueryVO
.
getTypeName
());
appletRecordQueryVO
.
getRecordTypes
(),
appletRecordQueryVO
.
getQueryName
(),
appletRecordQueryVO
.
getCurrentPage
(),
appletRecordQueryVO
.
getNumPerPage
(),
appletRecordQueryVO
.
getTypeName
()
,
officialAccountsId
);
return
new
ResponseDto
<>(
recordDTOPageBeanNew
);
}
...
...
@@ -111,7 +112,8 @@ public class AppletRecordFacade {
public
ResponseDto
<
List
<
AppletRecordDTO
>>
getAppletRecordCatalogue
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestBody
AppletRecordQueryVO
appletRecordQueryVO
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
List
<
AppletRecordDTO
>
appletRecordDTOS
=
appletRecordBiz
.
getAppletRecordCatalogue
(
wechatUserId
,
appletRecordQueryVO
.
getDate
());
Long
officialAccountsId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
List
<
AppletRecordDTO
>
appletRecordDTOS
=
appletRecordBiz
.
getAppletRecordCatalogue
(
wechatUserId
,
appletRecordQueryVO
.
getDate
(),
officialAccountsId
);
return
new
ResponseDto
<>(
appletRecordDTOS
);
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/facade/AppletThirdResourcesFacade.java
View file @
ac20bae8
...
...
@@ -40,9 +40,12 @@ public class AppletThirdResourcesFacade {
public
ResponseDto
<?>
addClickRecord
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestBody
@ApiParam
AppletThirdResourcesClick
thirdResourcesClick
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
thirdResourcesClick
||
null
==
thirdResourcesClick
.
getThirdResourcesId
()
||
null
==
thirdResourcesClick
.
getWechatUserId
())
{
Long
officialAccountsId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
if
(
null
==
thirdResourcesClick
||
null
==
thirdResourcesClick
.
getThirdResourcesId
()
)
{
throw
new
WechatUserException
(
WechatUserException
.
FIELD_IS_NULL
,
"缺失参数"
);
}
thirdResourcesClick
.
setWechatUserId
(
wechatUserId
);
thirdResourcesClick
.
setOfficialAccountsId
(
officialAccountsId
);
thirdResourcesBiz
.
addServiceRecord
(
thirdResourcesClick
);
return
new
ResponseDto
<>();
}
...
...
@@ -163,4 +166,17 @@ public class AppletThirdResourcesFacade {
return
new
ResponseDto
<>(
thirdResourceRecordDTOPageBeanNew
);
}
@ApiOperation
(
"H5资源页-我的-为你推荐"
)
@GetMapping
(
"getThirdResourcesByGradeLabel4ResourcePage"
)
public
ResponseDto
<?>
getThirdResourcesByGradeLabel4ResourcePage
(
@RequestParam
(
"gradeLabelId"
)
Long
gradeLabelId
,
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
Integer
numPerPage
)
{
if
(
null
==
gradeLabelId
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少用户年级标签"
);
}
if
(
null
==
currentPage
||
null
==
numPerPage
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少分页参数"
);
}
return
new
ResponseDto
<>(
thirdResourcesBiz
.
getThirdResourcesByGradeLabel4ResourcePage
(
gradeLabelId
,
currentPage
,
numPerPage
));
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/facade/ServeCollectFacade.java
View file @
ac20bae8
...
...
@@ -54,7 +54,8 @@ public class ServeCollectFacade {
@RequestParam
(
value
=
"numPerPage"
,
defaultValue
=
"10"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
serveCollectBiz
.
getList
(
wechatUserId
,
currentPage
,
numPerPage
,
typeCode
));
Long
officialAccountsId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
return
new
ResponseDto
<>(
serveCollectBiz
.
getList
(
wechatUserId
,
currentPage
,
numPerPage
,
typeCode
,
officialAccountsId
));
}
@ApiOperation
(
"新增"
)
...
...
@@ -104,12 +105,13 @@ public class ServeCollectFacade {
return
new
ResponseDto
<>();
}
@ApiOperation
(
"
删除
"
)
@ApiOperation
(
"
获取所有的收藏id
"
)
@GetMapping
(
"getAllCollect"
)
public
ResponseDto
<?>
getAllCollect
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
value
=
"typeCode"
,
required
=
false
)
String
typeCode
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
List
<
Long
>
ids
=
serveCollectBiz
.
getAllCollect
(
wechatUserId
,
typeCode
);
Long
officialAccountsId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
List
<
Long
>
ids
=
serveCollectBiz
.
getAllCollect
(
wechatUserId
,
typeCode
,
officialAccountsId
);
return
new
ResponseDto
<>(
ListUtils
.
isEmpty
(
ids
)
?
new
ArrayList
<>()
:
ids
);
}
...
...
@@ -117,7 +119,8 @@ public class ServeCollectFacade {
@GetMapping
(
"getTypeNameAndCountByWechatUserId"
)
public
ResponseDto
<
List
<
CollectionTypeNameAndCountDTO
>>
getTypeNameAndCountByWechatUserId
(
@CookieValue
(
"userInfo"
)
String
userInfo
){
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
List
<
CollectionTypeNameAndCountDTO
>
typeNameAndCountByWechatId
=
serveCollectBiz
.
getTypeNameAndCountByWechatId
(
wechatUserId
);
Long
officialAccountsId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
List
<
CollectionTypeNameAndCountDTO
>
typeNameAndCountByWechatId
=
serveCollectBiz
.
getTypeNameAndCountByWechatId
(
wechatUserId
,
officialAccountsId
);
return
new
ResponseDto
<>(
ListUtils
.
isEmpty
(
typeNameAndCountByWechatId
)
?
new
ArrayList
<>()
:
typeNameAndCountByWechatId
);
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/service/impl/AppletServiceImpl.java
View file @
ac20bae8
package
com
.
pcloud
.
book
.
applet
.
service
.
impl
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.pcloud.book.applet.biz.AnswerSubscribeBiz
;
import
com.pcloud.book.applet.biz.AppletBannerBiz
;
import
com.pcloud.book.applet.biz.AppletBooklistBiz
;
...
...
@@ -13,6 +12,7 @@ import com.pcloud.book.applet.biz.AppletThirdResourcesStaticBiz;
import
com.pcloud.book.applet.biz.AppletUserBookcaseBiz
;
import
com.pcloud.book.applet.biz.ReadBookRecordBiz
;
import
com.pcloud.book.applet.biz.ServeCollectBiz
;
import
com.pcloud.book.applet.dto.AnswerSubscribeUserDTO
;
import
com.pcloud.book.applet.dto.AppletAppOrProductDTO
;
import
com.pcloud.book.applet.dto.AppletNewsDTO
;
import
com.pcloud.book.applet.dto.AppletNewsVO
;
...
...
@@ -24,6 +24,7 @@ import com.pcloud.book.applet.dto.PcloudGroupActivityDTO;
import
com.pcloud.book.applet.dto.ServeCollectDTO
;
import
com.pcloud.book.applet.entity.ServeCollect
;
import
com.pcloud.book.applet.service.AppletService
;
import
com.pcloud.book.group.biz.ResourcePageBiz
;
import
com.pcloud.book.rightsSetting.biz.RightsSettingBiz
;
import
com.pcloud.book.skill.biz.PcloudGroupActivityBiz
;
import
com.pcloud.book.skill.entity.PcloudGroupActivity
;
...
...
@@ -90,6 +91,8 @@ public class AppletServiceImpl implements AppletService {
private
ReadBookRecordBiz
readBookRecordBiz
;
@Autowired
private
AppletUserBookcaseBiz
appletUserBookcaseBiz
;
@Autowired
private
ResourcePageBiz
resourcePageBiz
;
@Override
...
...
@@ -206,6 +209,8 @@ public class AppletServiceImpl implements AppletService {
@GetMapping
(
"updateAggrStatisCache"
)
public
void
updateAggrStatisCache
(){
appletRecordAggrStatisBiz
.
updateAggrStatisCache
();
appletRecordAggrStatisBiz
.
updateH5Resource
();
resourcePageBiz
.
insertCourseStatistic
();
}
@Override
...
...
@@ -259,4 +264,10 @@ public class AppletServiceImpl implements AppletService {
public
ResponseEntity
<
ResponseDto
<
List
<
Long
>>>
getSameClassifyUserIds
(
@RequestBody
List
<
Long
>
wechatUserIds
){
return
ResponseHandleUtil
.
toResponse
(
appletUserBookcaseBiz
.
getSameClassifyUserIds
(
wechatUserIds
));
}
@Override
@GetMapping
(
"getUserSubscribeInfo"
)
public
ResponseEntity
<
ResponseDto
<
AnswerSubscribeUserDTO
>>
getUserSubscribeInfo
(
@RequestParam
(
"wechatUserId"
)
Long
wechatUserId
){
return
ResponseHandleUtil
.
toResponse
(
answerSubscribeBiz
.
getUserSubscribeInfo
(
wechatUserId
));
}
}
pcloud-service-book/src/main/java/com/pcloud/book/book/set/BookSet.java
View file @
ac20bae8
...
...
@@ -2025,38 +2025,11 @@ public class BookSet {
if
(
ListUtils
.
isEmpty
(
recordList
))
{
return
;
}
List
<
BookSceneIdListDTO
>
bookSceneIdListDTOS
=
new
ArrayList
<>();
for
(
Object
obj
:
recordList
)
{
BookDto
bookDto
=
(
BookDto
)
obj
;
BookSceneIdListDTO
dto
=
new
BookSceneIdListDTO
();
dto
.
setAdviserId
(
bookDto
.
getAdviserId
());
dto
.
setBookId
(
bookDto
.
getBookId
());
dto
.
setChannelId
(
bookDto
.
getChannelId
());
bookSceneIdListDTOS
.
add
(
dto
);
}
List
<
BookSceneIdListDTO
>
sceneIdListDTOS
=
qrcodeSceneConsr
.
listSceneIds4Book
(
bookSceneIdListDTOS
);
Map
<
String
,
List
<
Long
>>
bookSceneIdMap
=
new
HashMap
<>();
if
(!
ListUtils
.
isEmpty
(
sceneIdListDTOS
))
{
for
(
BookSceneIdListDTO
dto
:
sceneIdListDTOS
)
{
if
(!
ListUtils
.
isEmpty
(
dto
.
getSceneIds
()))
{
String
key
=
dto
.
getBookId
()
+
"-"
+
dto
.
getAdviserId
()
+
"-"
+
dto
.
getChannelId
();
bookSceneIdMap
.
put
(
key
,
dto
.
getSceneIds
());
}
}
}
for
(
Object
obj
:
recordList
)
{
BookDto
bookDto
=
(
BookDto
)
obj
;
Integer
isOpenRobotProcess
=
0
;
String
key
=
bookDto
.
getBookId
()
+
"-"
+
bookDto
.
getAdviserId
()
+
"-"
+
bookDto
.
getChannelId
();
if
(!
MapUtils
.
isEmpty
(
bookSceneIdMap
)
&&
bookSceneIdMap
.
containsKey
(
key
))
{
List
<
Long
>
sceneIdList
=
bookSceneIdMap
.
get
(
key
);
//开启小睿的二维码
List
<
Long
>
openRaysSceneIds
=
resourcePageBiz
.
getOpenRaysSceneIds
(
sceneIdList
);
if
(!
ListUtils
.
isEmpty
(
openRaysSceneIds
))
{
isOpenRobotProcess
=
1
;
}
}
bookDto
.
setIsOpenRobotProcess
(
isOpenRobotProcess
);
//开启小睿
Boolean
openRays
=
resourcePageBiz
.
isOpenRaysBook
(
bookDto
.
getBookId
(),
bookDto
.
getChannelId
(),
bookDto
.
getAdviserId
());
bookDto
.
setIsOpenRobotProcess
(
openRays
?
1
:
0
);
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/consumer/analysisengine/BrowseRecordConsr.java
View file @
ac20bae8
...
...
@@ -7,6 +7,7 @@ import cn.hutool.core.collection.CollUtil;
import
com.pcloud.analysisengine.browse.dto.BookBrowseAndScanStatsDTO
;
import
com.pcloud.analysisengine.browse.dto.BookServeBrowseCountParameterDTO
;
import
com.pcloud.analysisengine.browse.dto.BrowseCacheRecordDto
;
import
com.pcloud.analysisengine.browse.dto.BrowseRecordStatisticDTO
;
import
com.pcloud.analysisengine.browse.dto.GroupBrowseStatisticVO
;
import
com.pcloud.analysisengine.browse.dto.SBookAnalyzeDto
;
import
com.pcloud.analysisengine.browse.service.BrowseRecordService
;
...
...
@@ -197,4 +198,16 @@ public class BrowseRecordConsr {
return
bookBrowseAndScanStatsDTOS
;
}
@ParamLog
(
"浏览量高的资源"
)
public
List
<
BrowseRecordStatisticDTO
>
getResourceTopIn7Day4H5
(
List
<
String
>
typeCodes
)
{
if
(
ListUtils
.
isEmpty
(
typeCodes
))
{
return
new
ArrayList
<>();
}
try
{
return
ResponseHandleUtil
.
parseList
(
browseRecordService
.
getResourceTopIn7Day4H5
(
typeCodes
),
BrowseRecordStatisticDTO
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"调用失败"
+
e
.
getMessage
(),
e
);
}
return
null
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/consumer/channel/QrcodeSceneConsr.java
View file @
ac20bae8
...
...
@@ -597,4 +597,16 @@ public class QrcodeSceneConsr {
}
return
0
;
}
@ParamLog
(
"查书刊订阅的公众号二维码"
)
public
GroupQrcodeVO
getSubscribeQrcode
(
Long
accountSettingId
)
{
GroupQrcodeVO
qrcodeVO
=
new
GroupQrcodeVO
();
try
{
qrcodeVO
=
ResponseHandleUtil
.
parseResponse
(
qrcodeSceneService
.
getSubscribeQrcode
(
accountSettingId
),
GroupQrcodeVO
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"调用qrcodeSceneService.getSubscribeQrcode失败"
+
e
.
getMessage
(),
e
);
}
return
qrcodeVO
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/consumer/reader/ReaderConsr.java
View file @
ac20bae8
...
...
@@ -8,8 +8,11 @@ import com.pcloud.readercenter.applet.entity.AppletQuestion;
import
com.pcloud.readercenter.applet.service.AppletUserService
;
import
com.pcloud.readercenter.rmall.entity.RmallBookMoneyRecord
;
import
com.pcloud.readercenter.rmall.service.RmallBookMoneyRecordService
;
import
com.pcloud.readercenter.userlabel.dto.UserGradeLabelIdDTO
;
import
com.pcloud.readercenter.userlabel.service.UserLabelService
;
import
com.pcloud.readercenter.wechat.dto.NickNameAndOpenIdDto
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -22,6 +25,7 @@ import com.pcloud.readercenter.wechat.dto.SpecialBookDTO4Reader;
import
com.pcloud.readercenter.wechat.dto.SpecialBookQueryDTO4Reader
;
import
com.pcloud.readercenter.wechat.dto.BuyBookProcessingDataDTO
;
import
com.pcloud.readercenter.wechat.dto.Wechat
;
import
com.pcloud.readercenter.wechat.entity.WechatUserOfficialAccounts
;
import
com.pcloud.usercenter.party.agent.dto.AgentCity
;
import
com.pcloud.usercenter.party.agent.service.AgentService
;
import
org.slf4j.Logger
;
...
...
@@ -62,6 +66,8 @@ public class ReaderConsr {
private
RmallBookMoneyRecordService
rmallBookMoneyRecordService
;
@Autowired
private
AppletUserService
appletUserService
;
@Autowired
private
UserLabelService
userLabelService
;
public
WechatUser
getWechatUser
(
Long
wechatUserId
)
throws
BizException
{
if
(
wechatUserId
==
null
)
{
...
...
@@ -378,6 +384,64 @@ public class ReaderConsr {
}
return
appletQuestionMap
;
}
@ParamLog
(
"查用户年级标签"
)
public
UserGradeLabelIdDTO
getUserGrade
(
Long
wechatUserId
,
Long
officialAccountsId
)
{
UserGradeLabelIdDTO
dto
=
new
UserGradeLabelIdDTO
();
try
{
dto
=
ResponseHandleUtil
.
parseResponse
(
userLabelService
.
getUserGrade
(
wechatUserId
,
officialAccountsId
),
UserGradeLabelIdDTO
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"调用userLabelService.getUserGrade失败"
+
e
.
getMessage
(),
e
);
}
return
dto
;
}
@ParamLog
(
"查询指定用户是否授权"
)
public
WechatUserOfficialAccounts
getOfficialAccounts
(
Long
officialAccountsId
,
String
openId
,
Long
wechatUserId
)
{
WechatUserOfficialAccounts
accounts
=
new
WechatUserOfficialAccounts
();
try
{
accounts
=
ResponseHandleUtil
.
parseResponse
(
wechatUserService
.
getOfficialAccounts
(
officialAccountsId
,
openId
,
wechatUserId
),
WechatUserOfficialAccounts
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"调用wechatUserService.getOfficialAccounts失败"
+
e
.
getMessage
(),
e
);
}
return
accounts
;
}
@ParamLog
(
"获取关联公众号用户id列表(777和23/35515)"
)
public
List
<
Long
>
getRelateUserIdList
(
Long
wechatUserId
,
Long
officialAccountsId
)
{
List
<
Long
>
list
=
new
ArrayList
<>();
if
(
null
==
officialAccountsId
)
{
return
Arrays
.
asList
(
wechatUserId
);
}
try
{
list
=
ResponseHandleUtil
.
parseList
(
wechatUserService
.
getRelateUserIdList
(
wechatUserId
,
officialAccountsId
),
Long
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"调用wechatUserService.getRelateUserIdList失败"
+
e
.
getMessage
(),
e
);
}
return
list
;
}
@ParamLog
(
"更新用户年级标签"
)
public
void
addUserGradeLabel
(
Long
userId
,
Long
officialAccountsId
,
Long
labelId
)
{
try
{
userLabelService
.
addUserGradeLabel
(
userId
,
officialAccountsId
,
labelId
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"调用userLabelService.addUserGradeLabel失败"
+
e
.
getMessage
(),
e
);
}
}
@ParamLog
(
"查用户年级子标签"
)
public
List
<
Long
>
getUserGradeIdByParentId
(
Long
parentId
)
{
List
<
Long
>
list
=
new
ArrayList
<>();
try
{
list
=
ResponseHandleUtil
.
parseList
(
userLabelService
.
getUserGradeIdByParentId
(
parentId
),
Long
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"调用userLabelService.getUserGradeIdByParentId失败"
+
e
.
getMessage
(),
e
);
}
return
list
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/es/biz/impl/ESBookAndAdviserBizImpl.java
View file @
ac20bae8
...
...
@@ -10,7 +10,6 @@ import com.pcloud.book.book.biz.BookBiz;
import
com.pcloud.book.book.constant.BookConstant
;
import
com.pcloud.book.book.dao.BookAdviserDao
;
import
com.pcloud.book.book.dao.BookDao
;
import
com.pcloud.book.book.dto.ErpBookApprovalDTO
;
import
com.pcloud.book.consumer.analysisengine.BrowseRecordConsr
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.consumer.erp.ErpConsr
;
...
...
@@ -19,11 +18,10 @@ import com.pcloud.book.es.biz.ESBookAndAdviserBiz;
import
com.pcloud.book.es.entity.ESBookAndAdviser
;
import
com.pcloud.book.es.repository.BookAndAdviserRepository
;
import
com.pcloud.book.group.biz.BookGroupBiz
;
import
com.pcloud.book.group.biz.ResourcePageBiz
;
import
com.pcloud.book.group.dto.BookServeDTO
;
import
com.pcloud.book.group.enums.JoinGroupTypeEnum
;
import
com.pcloud.book.rightsSetting.biz.RightsSettingBiz
;
import
com.pcloud.book.rightsSetting.constants.RightsSettingConstant
;
import
com.pcloud.book.rightsSetting.dto.RightsSettingDto
;
import
com.pcloud.book.util.common.ThreadPoolUtils
;
import
com.pcloud.book.util.common.YesOrNoEnums
;
import
com.pcloud.book.util.properties.BookProps
;
...
...
@@ -53,8 +51,6 @@ import org.springframework.data.domain.PageRequest;
import
org.springframework.data.domain.Sort
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
redis.clients.jedis.JedisCluster
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
...
...
@@ -87,24 +83,16 @@ public class ESBookAndAdviserBizImpl implements ESBookAndAdviserBiz {
@Autowired
private
BookAndAdviserRepository
bookAndAdviserRepository
;
@Autowired
private
AppletUserBookcaseBiz
appletUserBookcaseBiz
;
@Autowired
private
QrcodeSceneConsr
qrcodeSceneConsr
;
@Autowired
private
BookGroupBiz
bookGroupBiz
;
@Autowired
private
BrowseRecordConsr
browseRecordConsr
;
@Autowired
private
TradeConsr
tradeConsr
;
@Autowired
private
ErpConsr
erpConsr
;
@Autowired
private
RightsSettingBiz
rightsSettingBiz
;
@Autowired
private
BookBiz
bookBiz
;
@Autowired
private
BookAdviserDao
bookAdviserDao
;
@Autowired
private
ResourcePageBiz
resourcePageBiz
;
@Autowired
private
AppletBookIgnorBiz
appletBookIgnorBiz
;
@ParamLog
(
"导入全部book和bookAdviser"
)
...
...
@@ -159,24 +147,12 @@ public class ESBookAndAdviserBizImpl implements ESBookAndAdviserBiz {
sourceAdviserIds
.
add
(
Long
.
valueOf
(
esBookAndAdviser
.
getAdviserId
()));
sourceChannelIds
.
add
(
Long
.
valueOf
(
esBookAndAdviser
.
getChannelId
()));
}
//书刊资源数量(二维码)
Map
<
String
,
Integer
>
resourceCountMap
=
qrcodeSceneConsr
.
mapServeCount4Applet
(
new
ArrayList
<>(
sourceBookIds
));
//书刊资源数量(社群书)
Map
<
String
,
Integer
>
bookGroupResourceCountMap
=
bookGroupBiz
.
mapServeCount4Applet
(
new
ArrayList
<>(
sourceBookIds
));
//书刊扫码量浏览量
Map
<
String
,
BrowseCacheRecordDto
>
bookSvUvPvMap
=
browseRecordConsr
.
getBookSvUvPv
(
new
ArrayList
<>(
adviserIds
),
new
ArrayList
<>(
channelIds
),
new
ArrayList
<>(
searchBookIds
));
// 获取书刊累计收益(销售额)
Map
<
String
,
IncomeBackDto
>
bookIncomeMap
=
tradeConsr
.
getBookIncome
(
bookIncomeQueryVos
,
null
);
for
(
ESBookAndAdviser
bookAndAdviser
:
list
){
String
key
=
bookAndAdviser
.
getBookId
()
+
"-"
+
bookAndAdviser
.
getAdviserId
()
+
"-"
+
bookAndAdviser
.
getChannelId
();
Integer
resourceCount
=
0
;
if
(!
MapUtils
.
isEmpty
(
resourceCountMap
)
&&
resourceCountMap
.
containsKey
(
key
)){
resourceCount
=
resourceCountMap
.
get
(
key
);
}
if
(!
MapUtils
.
isEmpty
(
bookGroupResourceCountMap
)
&&
bookGroupResourceCountMap
.
containsKey
(
key
))
{
resourceCount
=
resourceCount
+
bookGroupResourceCountMap
.
get
(
key
);
}
bookAndAdviser
.
setResourceCount
(
resourceCount
);
//统计基金书数据
BigDecimal
fundBookValue
=
BigDecimal
.
ZERO
;
if
(
bookAndAdviser
.
getIsFundSupport
()==
1
)
{
...
...
@@ -198,22 +174,8 @@ public class ESBookAndAdviserBizImpl implements ESBookAndAdviserBiz {
Long
adviserId
=
Long
.
valueOf
(
bookAndAdviser
.
getAdviserId
());
Long
bookId
=
Long
.
valueOf
(
bookAndAdviser
.
getBookId
());
Long
channelId
=
Long
.
valueOf
(
bookAndAdviser
.
getChannelId
());
//权益
Long
rightsSettingId
=
0L
;
Integer
joinGroupType
=
bookAndAdviser
.
getJoinGroupType
();
if
(
null
!=
joinGroupType
&&
JoinGroupTypeEnum
.
XIAORUI
.
getCode
().
equals
(
joinGroupType
)){
if
(
adviserId
>
0
&&
bookId
>
0
&&
channelId
>
0
){
RightsSettingDto
rightsSettingDto
=
rightsSettingBiz
.
getRightsSettingByBookId4AppletHome
(
bookId
,
adviserId
,
channelId
);
if
(
null
!=
rightsSettingDto
&&
null
!=
rightsSettingDto
.
getId
()){
rightsSettingId
=
rightsSettingDto
.
getId
();
}
else
{
rightsSettingId
=
bookBiz
.
getDefaultRightsSettingId
();
}
}
}
bookAndAdviser
.
setRightsSettingId
(
rightsSettingId
);
//标记是否有答案
List
<
BookServeDTO
>
bookServeVOS
=
bookGroup
Biz
.
getBookAndBookGroupServeIds
(
adviserId
,
bookId
,
channelId
);
List
<
BookServeDTO
>
bookServeVOS
=
resourcePage
Biz
.
getBookAndBookGroupServeIds
(
adviserId
,
bookId
,
channelId
);
bookGroupBiz
.
removeCanNotBuy
(
bookServeVOS
);
bookGroupBiz
.
fillBookServe
(
bookServeVOS
);
Integer
hasAnswer
=
0
;
...
...
@@ -224,6 +186,7 @@ public class ESBookAndAdviserBizImpl implements ESBookAndAdviserBiz {
hasAnswer
=
1
;
}
}
bookAndAdviser
.
setResourceCount
(
bookServeVOS
.
size
());
bookAndAdviser
.
setHasAnswer
(
hasAnswer
);
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/es/facade/ESBookAndAdviserFacade.java
View file @
ac20bae8
...
...
@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.data.domain.Page
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -88,4 +89,11 @@ public class ESBookAndAdviserFacade {
}
return
new
ResponseDto
<>();
}
@ApiOperation
(
"更新es书刊"
)
@PostMapping
(
"updateBookAndAdviserToES"
)
public
ResponseDto
<?>
updateBookAndAdviserToES
(
@RequestBody
List
<
Long
>
bookIds
)
{
esBookAndAdviserBiz
.
updateBookAndAdviserToES
(
bookIds
);
return
new
ResponseDto
<>();
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/BookGroupBiz.java
View file @
ac20bae8
...
...
@@ -836,7 +836,7 @@ public interface BookGroupBiz {
* @param wechatUserId
* @param scene
*/
BookGroupDTO
getByAppletScene
(
Long
wechatUserId
,
String
scene
);
BookGroupDTO
getByAppletScene
(
Long
wechatUserId
,
String
scene
,
Long
officialAccountsId
);
/**
* 获取小睿社群书和现代纸书所配资源
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/ResourcePageBiz.java
View file @
ac20bae8
...
...
@@ -2,15 +2,19 @@ package com.pcloud.book.group.biz;
import
com.pcloud.book.group.dto.AddBookGroupServeDTO
;
import
com.pcloud.book.group.dto.BookGroupServeDTO
;
import
com.pcloud.book.group.dto.BookServeDTO
;
import
com.pcloud.book.group.dto.ResourcePageCourseDTO
;
import
com.pcloud.book.group.entity.BookGroupServe
;
import
com.pcloud.book.group.entity.ResourcePage
;
import
com.pcloud.book.group.entity.ResourcePageCollect
;
import
com.pcloud.book.group.entity.ResourcePageTool
;
import
com.pcloud.book.group.vo.ResourceColumnAndServeVO
;
import
com.pcloud.book.group.vo.ResourcePageItemVO
;
import
com.pcloud.book.group.vo.ResourcePageOneServe
;
import
com.pcloud.book.group.vo.ResourcePageVO
;
import
com.pcloud.book.group.vo.UpdateResourceColumnVO
;
import
com.pcloud.book.group.vo.UpdateResourcePageVO
;
import
com.pcloud.channelcenter.qrcode.dto.BookSceneIdListDTO
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
...
...
@@ -134,12 +138,12 @@ public interface ResourcePageBiz {
*/
List
<
BookGroupServe
>
getServeListByBookGroupId
(
Long
bookGroupId
);
/**
* 批量更新资源
聚合页二维码
* 批量更新资源
页应用作品链接
* @author:zhuyajie
* @date:2021/
4/20
1:14
* @date:2021/
5/27
1:14
* * @param null
*/
void
batchUpdateResource
Qrcode
(
List
<
Long
>
qrcodeIdList
,
String
qrcodeType
);
void
batchUpdateResource
Url
(
List
<
Long
>
sceneIdList
);
/**
...
...
@@ -216,4 +220,105 @@ public interface ResourcePageBiz {
* 获取h5页面配了这个资源的二维码集合
*/
List
<
Long
>
getSceneIdsByResourceId
(
Long
resourceId
);
/**
* 更新书刊id
* @author:zhuyajie
* @date:2021/5/11 18:46
* * @param null
*/
void
batchUpdateBookId
(
List
<
BookSceneIdListDTO
>
requestDto
);
/**
* 书刊下开启小睿的资源页资源
* @author:zhuyajie
* @date:2021/5/11 19:46
* * @param null
*/
List
<
BookServeDTO
>
getBookAndBookGroupServeIds
(
Long
adviserId
,
Long
bookId
,
Long
channelId
);
/**
* 查用户H5资源页工具列表
* @author:zhuyajie
* @date:2021/5/12 17:45
* * @param null
*/
List
<
ResourcePageTool
>
getToolListByUser
(
Long
wechatUserId
,
Long
officialAccountsId
);
/**
* 资源广场模块
* @author:zhuyajie
* @date:2021/5/13 11:26
* * @param null
*/
List
<
Map
<
String
,
Object
>>
getResourceSourceTypeList
(
Long
wechatUserId
,
Long
officialAccountsId
);
/**
* 查用户学龄段
* @author:zhuyajie
* @date:2021/5/13 15:40
* * @param null
*/
Long
getUserGrade
(
Long
wechatUserId
,
Long
officialAccountsId
);
/**
* 添加课程统计数据
* @author:zhuyajie
* @date:2021/5/17 15:11
* * @param null
*/
void
insertCourseStatistic
();
/**
* H5首页-根据用户年级查推荐课程
* @author:zhuyajie
* @date:2021/5/17 17:07
* * @param null
*/
PageBeanNew
<
ResourcePageCourseDTO
>
listCourseByUser
(
Long
wechatUserId
,
Long
officialAccountsId
,
Integer
currentPage
,
Integer
numPerPage
);
/**
* 查年级标签对应的用户年级
* @author:zhuyajie
* @date:2021/5/18 18:58
* * @param null
*/
Long
getGradeByGradeLabelId
(
Long
graLabelId
);
/**
* 查深度标签对应的用户年级
* @author:zhuyajie
* @date:2021/5/18 19:20
* * @param null
*/
Long
getGradeByDepLabelId
(
Long
depLabelId
);
/**
* 书刊是否开启小睿
* @author:zhuyajie
* @date:2021/5/25 11:00
* * @param null
*/
Boolean
isOpenRaysBook
(
Long
bookId
,
Long
channelId
,
Long
adviserId
);
/**
* 获取用户H5新用户状态
* @author:zhuyajie
* @date:2021/5/27 10:39
* * @param null
*/
Map
<
String
,
Object
>
getUserNewState
(
Long
wechatUserId
);
/**
* 添加新用户记录
* @author:zhuyajie
* @date:2021/4/26 15:36
* * @param null
*/
void
addNewUserRecord
(
ResourcePageCollect
resourcePageCollect
);
/**
* 查二维码是否开启小睿
* @author:zhuyajie
* @date:2021/5/27 11:52
* * @param null
*/
Boolean
isOpenRaysScene
(
Long
sceneId
,
Long
bookGroupId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/WeworkTeacherBiz.java
View file @
ac20bae8
...
...
@@ -94,4 +94,20 @@ public interface WeworkTeacherBiz {
* @return
*/
Map
<
Long
,
WxWorkTeacherDTO
>
getWxWorkTeacherByIds
(
List
<
Long
>
teacherIds
);
/**
* 根据id查老师
* @author:zhuyajie
* @date:2021/5/10 15:12
* * @param null
*/
WeworkTeacherVO
getWxworkTeacherById
(
Long
id
);
/**
* H5首页-客服老师
* @author:zhuyajie
* @date:2021/5/11 16:40
* * @param null
*/
PageBeanNew
<
WeworkTeacherVO
>
getTeacherByGradeLabel4ResourcePage
(
Long
gradeLabelId
,
Integer
currentPage
,
Integer
numPerPage
);
}
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/impl/BookGroupBizImpl.java
View file @
ac20bae8
...
...
@@ -5201,7 +5201,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
}
@Override
public
BookGroupDTO
getByAppletScene
(
Long
wechatUserId
,
String
scene
)
{
public
BookGroupDTO
getByAppletScene
(
Long
wechatUserId
,
String
scene
,
Long
officialAccountsId
)
{
BookGroupDTO
dto
=
new
BookGroupDTO
();
BookAppletScene
bookAppletScene
=
bookAppletSceneDao
.
getByAppletId
(
scene
);
if
(
null
==
bookAppletScene
)
{
...
...
@@ -5217,6 +5217,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
appletUserBookcase
.
setAdviserId
(
bookGroupDTO
.
getCreateUser
());
appletUserBookcase
.
setBookId
(
bookGroupDTO
.
getBookId
());
appletUserBookcase
.
setChannelId
(
bookGroupDTO
.
getChannelId
());
appletUserBookcase
.
setOfficialAccountsId
(
officialAccountsId
);
AppletTaskDTO
appletTaskDTO
=
appletUserBookcaseBiz
.
addUserBook
(
appletUserBookcase
);
if
(
null
!=
appletTaskDTO
&&
YesOrNoEnums
.
YES
.
getValue
().
equals
(
appletTaskDTO
.
getIsFinishTask
()))
{
dto
.
setIsFinshTask
(
appletTaskDTO
.
getIsFinishTask
());
...
...
@@ -5248,6 +5249,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
//用户书刊埋点
AppletUserBookcase
appletUserBookcase
=
new
AppletUserBookcase
();
appletUserBookcase
.
setWechatUserId
(
wechatUserId
);
appletUserBookcase
.
setOfficialAccountsId
(
officialAccountsId
);
appletUserBookcase
.
setAdviserId
(
byId
.
getCreatedByUserLogin
());
appletUserBookcase
.
setBookId
(
byId
.
getAdviserBookId
());
appletUserBookcase
.
setChannelId
(
byId
.
getChannelPartyId
());
...
...
@@ -5265,13 +5267,6 @@ public class BookGroupBizImpl implements BookGroupBiz {
appletRecord
.
setAdviserId
(
byId
.
getCreatedByUserLogin
());
appletRecord
.
setChannelId
(
byId
.
getChannelPartyId
());
appletRecordBiz
.
insert
(
appletRecord
);
//现代纸书是否开启小睿流程
BookAdviserDto
bookAdviserDto
=
bookAdviserDao
.
getBase
(
byId
.
getAdviserBookId
(),
byId
.
getChannelPartyId
(),
byId
.
getCreatedByUserLogin
());
if
(
null
!=
bookAdviserDto
&&
YesOrNoEnums
.
YES
.
getValue
().
equals
(
bookAdviserDto
.
getIsOpenRobotProcess
()))
{
dto
.
setOpenWeapp
(
true
);
}
else
{
dto
.
setOpenWeapp
(
false
);
}
}
return
dto
;
}
...
...
@@ -5476,8 +5471,8 @@ public class BookGroupBizImpl implements BookGroupBiz {
}
}
}
//社群书配置资源
List
<
BookGroupServe
>
bookGroupServes
=
bookGroupServeDao
.
getServeListByBook
(
bookId
,
channelId
,
adviserId
);
//社群书配置资源
,(二维码已统一,无需两边查询)
/*
List<BookGroupServe> bookGroupServes = bookGroupServeDao.getServeListByBook(bookId, channelId, adviserId);
if (!ListUtils.isEmpty(bookGroupServes)) {
for (BookGroupServe bookGroupServe : bookGroupServes) {
BookServeDTO bookServeDTO = new BookServeDTO();
...
...
@@ -5496,7 +5491,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
productIds.add(serveId);
}
}
}
}
*/
return
serveDTOList
;
}
...
...
@@ -5597,16 +5592,8 @@ public class BookGroupBizImpl implements BookGroupBiz {
@Override
public
Map
<
String
,
Object
>
getBookBaseInfo4Applet
(
Long
adviserId
,
Long
channelId
,
Long
bookId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
//是否小睿,小睿权益id
BookGroupDTO
bookGroupDTO
=
bookGroupDao
.
getDTOByBookId
(
bookId
,
channelId
,
adviserId
);
Integer
isXIAORUI
=
bookAdviserDao
.
getIsRui
(
adviserId
,
bookId
,
channelId
);
map
.
put
(
"isXIAORUI"
,
YesOrNoEnums
.
YES
.
getValue
().
equals
(
isXIAORUI
)
?
Boolean
.
TRUE
:
Boolean
.
FALSE
);
if
(
YesOrNoEnums
.
YES
.
getValue
().
equals
(
isXIAORUI
))
{
RightsSettingDto
rightsSettingDto
=
rightsSettingBiz
.
getRightsSettingByBookId4AppletHome
(
bookId
,
adviserId
,
channelId
);
if
(
null
!=
rightsSettingDto
)
{
map
.
put
(
"rightsSettingId"
,
rightsSettingDto
.
getId
());
}
}
//是否开启小睿
map
.
put
(
"openRays"
,
resourcePageBiz
.
isOpenRaysBook
(
bookId
,
channelId
,
adviserId
));
//书刊分类对应的小睿分类
BookAdviserDto
adviserDto
=
bookAdviserDao
.
getBase
(
bookId
,
channelId
,
adviserId
);
map
.
put
(
"isK12"
,
Boolean
.
FALSE
);
...
...
@@ -5645,9 +5632,6 @@ public class BookGroupBizImpl implements BookGroupBiz {
map
.
put
(
"publish"
,
bookDto
.
getPublish
());
}
map
.
put
(
"isLibraryBook"
,
bookBiz
.
checkIsLibraryBook
(
adviserId
,
bookId
)
?
1
:
0
);
if
(
Objects
.
isNull
(
map
.
get
(
"rightsSettingId"
)))
{
map
.
put
(
"rightsSettingId"
,
bookBiz
.
getDefaultRightsSettingId
());
}
//资源数量
/* List<BookServeDTO> serveDTOList = this.getBookAndBookGroupServeIds(adviserId, bookId, channelId);
this.removeCanNotBuy(serveDTOList);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/impl/ResourcePageBizImpl.java
View file @
ac20bae8
...
...
@@ -7,25 +7,29 @@ import cn.hutool.http.HttpUtil;
import
cn.hutool.core.collection.CollUtil
;
import
com.pcloud.advertising.advertising.dto.AdvertisingSpaceDTO
;
import
com.pcloud.advertising.advertising.dto.AdvertisingSpaceItemDTO
;
import
com.pcloud.analysisengine.browse.dto.BrowseRecordStatisticDTO
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.book.applet.biz.AppletBooklistBiz
;
import
com.pcloud.book.applet.biz.AppletThirdResourcesBiz
;
import
com.pcloud.book.applet.dto.AppletOuterBooklistDTO
;
import
com.pcloud.book.applet.dto.GroupActivity4AppletDTO
;
import
com.pcloud.book.applet.entity.AppletThirdResources
;
import
com.pcloud.book.applet.enums.AppletRecordTypeEnum
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.biz.BookBiz
;
import
com.pcloud.book.book.dto.BookDto
;
import
com.pcloud.book.book.vo.BookLinkVO
;
import
com.pcloud.book.consumer.advsertising.AdvertisingConsr
;
import
com.pcloud.book.consumer.analysisengine.BrowseRecordConsr
;
import
com.pcloud.book.consumer.app.AppConsr
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.consumer.raystask.AdviserTaskConsr
;
import
com.pcloud.book.consumer.reader.ReaderConsr
;
import
com.pcloud.book.consumer.resource.ProductConsr
;
import
com.pcloud.book.consumer.user.AdviserConsr
;
import
com.pcloud.book.consumer.user.AgentConsr
;
import
com.pcloud.book.consumer.user.ChannelConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.es.biz.ESBookAndAdviserBiz
;
import
com.pcloud.book.group.biz.BookGroupBiz
;
import
com.pcloud.book.group.biz.ResourcePageBiz
;
import
com.pcloud.book.group.constant.ResourcePageConstants
;
...
...
@@ -34,19 +38,25 @@ import com.pcloud.book.group.dao.BookGroupDao;
import
com.pcloud.book.group.dao.BookGroupServeDao
;
import
com.pcloud.book.group.dao.ResourcePageCollectDao
;
import
com.pcloud.book.group.dao.ResourcePageColumnDao
;
import
com.pcloud.book.group.dao.ResourcePageCourseDao
;
import
com.pcloud.book.group.dao.ResourcePageDao
;
import
com.pcloud.book.group.dao.ResourcePageItemDao
;
import
com.pcloud.book.group.dao.ResourcePageToolDao
;
import
com.pcloud.book.group.dto.AddBookGroupServeDTO
;
import
com.pcloud.book.group.dto.BookGroupDTO
;
import
com.pcloud.book.group.dto.BookGroupServeDTO
;
import
com.pcloud.book.group.dto.BookServeDTO
;
import
com.pcloud.book.group.dto.ResourcePageCourseDTO
;
import
com.pcloud.book.group.dto.ResourcePageUrlDTO
;
import
com.pcloud.book.group.entity.BookAppletScene
;
import
com.pcloud.book.group.entity.BookGroup
;
import
com.pcloud.book.group.entity.BookGroupServe
;
import
com.pcloud.book.group.entity.ResourcePage
;
import
com.pcloud.book.group.entity.ResourcePageCollect
;
import
com.pcloud.book.group.entity.ResourcePageColumn
;
import
com.pcloud.book.group.entity.ResourcePageCourse
;
import
com.pcloud.book.group.entity.ResourcePageItem
;
import
com.pcloud.book.group.en
ums.QrcodeJumpType
;
import
com.pcloud.book.group.en
tity.ResourcePageTool
;
import
com.pcloud.book.group.tools.SendWeixinRequestTools
;
import
com.pcloud.book.group.vo.ResourceColumnAndServeVO
;
import
com.pcloud.book.group.vo.ResourcePageItemVO
;
...
...
@@ -54,24 +64,17 @@ import com.pcloud.book.group.vo.ResourcePageOneServe;
import
com.pcloud.book.group.vo.ResourcePageVO
;
import
com.pcloud.book.group.vo.UpdateResourceColumnVO
;
import
com.pcloud.book.group.vo.UpdateResourcePageVO
;
import
com.pcloud.book.rightsSetting.biz.RightsSettingBannerBiz
;
import
com.pcloud.book.rightsSetting.biz.RightsSettingBiz
;
import
com.pcloud.book.rightsSetting.constants.RightsSettingConstant
;
import
com.pcloud.book.rightsSetting.dto.RightsSettingDto
;
import
com.pcloud.book.rightsSetting.dto.RightsSettingQueryDTO
;
import
com.pcloud.book.rightsSetting.entity.RightsNowItem
;
import
com.pcloud.book.rightsSetting.entity.RightsSetting
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingBanner
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingTitle
;
import
com.pcloud.book.skill.biz.PcloudGroupActivityBiz
;
import
com.pcloud.book.util.common.ThreadPoolUtils
;
import
com.pcloud.book.util.common.YesOrNoEnums
;
import
com.pcloud.book.util.properties.BookProps
;
import
com.pcloud.channelcenter.qrcode.dto.BookSceneIdListDTO
;
import
com.pcloud.channelcenter.qrcode.dto.GroupQrcodeVO
;
import
com.pcloud.channelcenter.qrcode.dto.OwnMessageDTO
;
import
com.pcloud.channelcenter.qrcode.dto.QrcodeSceneDto
;
import
com.pcloud.channelcenter.wechat.dto.AccountSettingDto
;
import
com.pcloud.channelcenter.wechat.
dto.MessageDto
;
import
com.pcloud.channelcenter.wechat.
entity.AccountSetting
;
import
com.pcloud.channelcenter.wechat.entity.Message
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.constant.AdviserTaskConstants
;
...
...
@@ -84,8 +87,10 @@ import com.pcloud.common.utils.DateUtils;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.NumberUtil
;
import
com.pcloud.common.utils.QrcodeUtils
;
import
com.pcloud.common.utils.ServeLinkUtils
;
import
com.pcloud.common.utils.UUIDUitl
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.readercenter.userlabel.dto.UserGradeLabelIdDTO
;
import
com.pcloud.message.common.enums.YesNoEnums
;
import
com.pcloud.resourcecenter.product.dto.ProductDto
;
import
com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto
;
...
...
@@ -98,6 +103,7 @@ import org.springframework.transaction.annotation.Transactional;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -147,8 +153,6 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
@Autowired
private
BookBiz
bookBiz
;
@Autowired
private
RightsSettingBannerBiz
rightsSettingBannerBiz
;
@Autowired
private
AgentConsr
agentConsr
;
@Autowired
private
AdviserConsr
adviserConsr
;
...
...
@@ -164,6 +168,18 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
private
AdviserTaskConsr
adviserTaskConsr
;
@Autowired
private
AdvertisingConsr
advertisingConsr
;
@Autowired
private
ESBookAndAdviserBiz
esBookAndAdviserBiz
;
@Autowired
private
ResourcePageToolDao
resourcePageToolDao
;
@Autowired
private
ReaderConsr
readerConsr
;
@Autowired
private
ResourcePageCourseDao
resourcePageCourseDao
;
@Autowired
private
BrowseRecordConsr
browseRecordConsr
;
@Autowired
private
ChannelConsr
channelConsr
;
@Override
public
Long
updateResourcePage
(
UpdateResourcePageVO
updateResourcePageVO
)
{
...
...
@@ -178,6 +194,15 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
return
null
;
}
private
void
checkOpenRays
(
Long
bookId
,
Integer
openRaysState
)
{
if
(
openRaysState
!=
1
)
{
return
;
}
if
(
null
==
bookId
||
bookId
==
0
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"二维码未关联书刊, 不能开启小睿流程"
);
}
}
private
Long
updatePageBySceneId
(
UpdateResourcePageVO
updateResourcePageVO
){
Long
sceneId
=
updateResourcePageVO
.
getSceneId
();
ResourcePage
resourcePage
=
resourcePageDao
.
getBySceneId
(
sceneId
);
...
...
@@ -191,6 +216,10 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
if
(
null
==
resourcePage
.
getBookGroupId
())
{
resourcePage
.
setBookGroupId
(
getBookGroupIdBySceneId
(
sceneId
));
}
resourcePage
.
setBookId
(
null
==
qrcodeSceneDto
?
null
:
qrcodeSceneDto
.
getAdviserBookId
());
resourcePage
.
setChannelId
(
null
==
qrcodeSceneDto
?
null
:
qrcodeSceneDto
.
getChannelPartyId
());
//校验能否开启小睿
this
.
checkOpenRays
(
resourcePage
.
getBookId
(),
updateResourcePageVO
.
getOpenRays
());
resourcePageDao
.
insert
(
resourcePage
);
}
else
{
resourcePage
.
setStyle
(
updateResourcePageVO
.
getStyle
());
...
...
@@ -201,6 +230,8 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
if
(
null
==
resourcePage
.
getBookGroupId
())
{
resourcePage
.
setBookGroupId
(
getBookGroupIdBySceneId
(
sceneId
));
}
//校验能否开启小睿
this
.
checkOpenRays
(
resourcePage
.
getBookId
(),
updateResourcePageVO
.
getOpenRays
());
resourcePageDao
.
update
(
resourcePage
);
}
if
(
updateResourcePageVO
.
getOpenRays
()
==
1
)
{
...
...
@@ -214,14 +245,10 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
bookAppletSceneDao
.
insert
(
bookAppletScene
);
}
//同一本书其他码下关闭小睿流程
List
<
Long
>
sceneIds
=
qrcodeSceneConsr
.
getBookRaysSceneIds
(
sceneId
);
if
(!
ListUtils
.
isEmpty
(
sceneIds
))
{
sceneIds
.
remove
(
sceneId
);
if
(!
ListUtils
.
isEmpty
(
sceneIds
))
{
resourcePageDao
.
setRaysCloseBySceneIds
(
sceneIds
);
}
}
resourcePageDao
.
setOtherPageRaysClose
(
resourcePage
.
getBookId
(),
resourcePage
.
getChannelId
(),
resourcePage
.
getCreateUser
(),
sceneId
,
null
);
}
esBookAndAdviserBiz
.
updateBookAndAdviserToES
(
Collections
.
singletonList
(
resourcePage
.
getBookId
()));
return
resourcePage
.
getId
();
}
...
...
@@ -249,25 +276,21 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
BeanUtils
.
copyProperties
(
updateResourcePageVO
,
resourcePage
);
BookGroupDTO
dto
=
bookGroupDao
.
getDTOById
(
bookGroupId
);
resourcePage
.
setQrcodeUrl
(
null
==
dto
?
null
:
dto
.
getGroupQrcodeUrl
());
resourcePage
.
setBookId
(
null
==
dto
?
null
:
dto
.
getBookId
());
resourcePage
.
setChannelId
(
null
==
dto
?
null
:
dto
.
getChannelId
());
//校验能否开启小睿
this
.
checkOpenRays
(
resourcePage
.
getBookId
(),
updateResourcePageVO
.
getOpenRays
());
resourcePageDao
.
insert
(
resourcePage
);
}
else
{
resourcePage
.
setStyle
(
updateResourcePageVO
.
getStyle
());
resourcePage
.
setOpenRays
(
updateResourcePageVO
.
getOpenRays
());
resourcePage
.
setShowBook
(
updateResourcePageVO
.
getShowBook
());
//校验能否开启小睿
this
.
checkOpenRays
(
resourcePage
.
getBookId
(),
updateResourcePageVO
.
getOpenRays
());
resourcePage
.
setBookCover
(
updateResourcePageVO
.
getBookCover
());
resourcePageDao
.
update
(
resourcePage
);
}
if
(
updateResourcePageVO
.
getOpenRays
()
==
1
)
{
//同一本书其他码下关闭小睿流程
BookGroupDTO
bookGroupDTO
=
bookGroupDao
.
getDTOById
(
bookGroupId
);
if
(
null
!=
bookGroupDTO
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"bookId"
,
bookGroupDTO
.
getBookId
());
paramMap
.
put
(
"adviserId"
,
bookGroupDTO
.
getCreateUser
());
paramMap
.
put
(
"channelId"
,
bookGroupDTO
.
getChannelId
());
paramMap
.
put
(
"bookGroupId"
,
bookGroupId
);
resourcePageDao
.
setRaysCloseByBook
(
paramMap
);
}
//小程序码
BookAppletScene
appletScene
=
bookAppletSceneDao
.
getByBookGroupId
(
bookGroupId
);
if
(
null
==
appletScene
)
{
...
...
@@ -277,7 +300,10 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
bookAppletScene
.
setAccountSettingId
(
BookProps
.
getMiniOfficialAccountsId
());
bookAppletSceneDao
.
insert
(
bookAppletScene
);
}
//同一本书其他码下关闭小睿流程
resourcePageDao
.
setOtherPageRaysClose
(
resourcePage
.
getBookId
(),
resourcePage
.
getChannelId
(),
resourcePage
.
getCreateUser
(),
null
,
bookGroupId
);
}
esBookAndAdviserBiz
.
updateBookAndAdviserToES
(
Collections
.
singletonList
(
resourcePage
.
getBookId
()));
return
resourcePage
.
getId
();
}
...
...
@@ -294,11 +320,15 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
if
(
null
!=
bookGroupId
)
{
BookGroupDTO
dto
=
bookGroupDao
.
getDTOById
(
bookGroupId
);
resourcePage
.
setQrcodeUrl
(
null
==
dto
?
null
:
dto
.
getGroupQrcodeUrl
());
resourcePage
.
setBookId
(
null
==
dto
?
null
:
dto
.
getBookId
());
resourcePage
.
setChannelId
(
null
==
dto
?
null
:
dto
.
getChannelId
());
}
else
if
(
null
!=
sceneId
)
{
QrcodeSceneDto
qrcodeSceneDto
=
qrcodeSceneConsr
.
getById
(
sceneId
);
resourcePage
.
setQrcodeUrl
(
null
==
qrcodeSceneDto
?
null
:
qrcodeSceneDto
.
getQrcodeUrl
());
//同步bookGroupId
resourcePage
.
setBookGroupId
(
getBookGroupIdBySceneId
(
sceneId
));
resourcePage
.
setBookId
(
null
==
qrcodeSceneDto
?
null
:
qrcodeSceneDto
.
getAdviserBookId
());
resourcePage
.
setChannelId
(
null
==
qrcodeSceneDto
?
null
:
qrcodeSceneDto
.
getChannelPartyId
());
}
resourcePageDao
.
insert
(
resourcePage
);
return
resourcePage
;
...
...
@@ -878,13 +908,22 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
if
(
null
!=
resourcePage
)
{
BeanUtils
.
copyProperties
(
resourcePage
,
resourcePageVO
);
}
BookDto
bookDto
=
bookBiz
.
getAdviserBook
(
bookId
,
channelId
,
adviserId
,
null
);
resourcePageVO
.
setBookImg
(
bookDto
.
getCoverImg
());
resourcePageVO
.
setBookName
(
bookDto
.
getBookName
());
BookDto
bookDto
=
bookBiz
.
getBaseById
(
bookId
);
if
(
null
!=
bookDto
)
{
resourcePageVO
.
setBookImg
(
bookDto
.
getCoverImg
());
resourcePageVO
.
setBookName
(
bookDto
.
getBookName
());
}
Map
<
Long
,
AdviserBaseInfoDto
>
agentMap
=
adviserConsr
.
getAdviserId2AdviserInfoDtoMap
(
Arrays
.
asList
(
adviserId
));
if
(!
MapUtils
.
isEmpty
(
agentMap
))
{
resourcePageVO
.
setAgentName
(
agentMap
.
get
(
adviserId
).
getAgentName
());
}
Integer
collectState
=
0
;
if
(
null
!=
resourcePageVO
&&
null
!=
resourcePageVO
.
getId
())
{
//查收藏状态
ResourcePageCollect
collect
=
resourcePageCollectDao
.
getCollectRecordByUser
(
wechatUserId
,
resourcePageVO
.
getId
());
collectState
=
null
==
collect
?
0
:
1
;
}
resourcePageVO
.
setCollectState
(
collectState
);
return
resourcePageVO
;
}
...
...
@@ -1125,87 +1164,43 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
}
@Override
public
void
batchUpdateResource
Qrcode
(
List
<
Long
>
qrcodeIdList
,
String
qrcodeType
)
{
if
(
ListUtils
.
isEmpty
(
qrcod
eIdList
))
{
public
void
batchUpdateResource
Url
(
List
<
Long
>
sceneIdList
)
{
if
(
ListUtils
.
isEmpty
(
scen
eIdList
))
{
return
;
}
if
(
"bookgroup"
.
equals
(
qrcodeType
))
{
for
(
Long
bookGroupId:
qrcodeIdList
)
{
//H5资源页
BookGroupDTO
bookGroupDTO
=
bookGroupDao
.
getDTOById
(
bookGroupId
);
if
(!
QrcodeJumpType
.
H5_RESOURCE
.
getCode
().
equals
(
bookGroupDTO
.
getJumpType
()))
{
continue
;
}
ResourcePage
resourcePage
=
resourcePageDao
.
getByBookGroupId
(
bookGroupId
);
if
(
null
==
resourcePage
)
{
resourcePage
=
this
.
createDefaultResourcePage
(
bookGroupId
,
bookGroupDTO
.
getCreateUser
(),
null
,
0
);
}
else
{
resourcePage
.
setOpenRays
(
0
);
resourcePageDao
.
update
(
resourcePage
);
}
Long
resourcePageId
=
resourcePage
.
getId
();
List
<
BookGroupServe
>
serveList
=
bookGroupServeDao
.
getListByBookGroupId
(
bookGroupId
);
resourcePageColumnDao
.
deleteByPageId
(
resourcePageId
);
resourcePageItemDao
.
deleteByPageId
(
resourcePageId
);
if
(!
ListUtils
.
isEmpty
(
serveList
))
{
//新增栏目资源
UpdateResourceColumnVO
columnVO
=
new
UpdateResourceColumnVO
();
columnVO
.
setColumnFormat
(
1
);
columnVO
.
setColumnType
(
ResourcePageConstants
.
ColumnTypeEnum
.
APP_PRODUCT
.
getCode
());
columnVO
.
setCreateUser
(
bookGroupDTO
.
getCreateUser
());
columnVO
.
setColumnName
(
"本书配套资源服务"
);
List
<
ResourcePageItemVO
>
itemVOList
=
new
ArrayList
<>();
for
(
BookGroupServe
serve
:
serveList
)
{
ResourcePageItemVO
vo
=
new
ResourcePageItemVO
();
vo
.
setLinkUrl
(
serve
.
getServeUrl
());
vo
.
setServeId
(
serve
.
getServeId
());
vo
.
setServeType
(
serve
.
getServeType
());
vo
.
setTypeCode
(
serve
.
getTypeCode
());
vo
.
setSeqNum
(
serveList
.
indexOf
(
serve
));
itemVOList
.
add
(
vo
);
}
columnVO
.
setItemVOList
(
itemVOList
);
columnVO
.
setResourcePageId
(
resourcePage
.
getId
());
columnVO
.
setShowMore
(
false
);
this
.
updateResourceColumn
(
columnVO
);
}
List
<
ResourcePageUrlDTO
>
itemList
=
resourcePageItemDao
.
getServeUrl4Update
(
sceneIdList
);
if
(
ListUtils
.
isEmpty
(
itemList
))
{
return
;
}
List
<
ResourcePageUrlDTO
>
updateList
=
new
ArrayList
<>();
for
(
ResourcePageUrlDTO
dto
:
itemList
)
{
if
(
StringUtil
.
isEmpty
(
dto
.
getLinkUrl
()))
{
continue
;
}
}
else
{
for
(
Long
sceneId
:
qrcodeIdList
)
{
QrcodeSceneDto
qrcodeSceneDto
=
qrcodeSceneConsr
.
getDetail
(
sceneId
);
Long
adviserId
=
qrcodeSceneDto
.
getCreatedByUserLogin
();
//创建资源页
ResourcePage
resourcePage
=
resourcePageDao
.
getBySceneId
(
sceneId
);
if
(
null
==
resourcePage
)
{
resourcePage
=
this
.
createDefaultResourcePage
(
null
,
adviserId
,
sceneId
,
0
);
String
url
=
dto
.
getLinkUrl
();
//sceneId参数不对
if
(
url
.
contains
(
"sceneId"
))
{
String
sceneParam
=
url
.
substring
(
url
.
indexOf
(
"sceneId"
));
if
(
sceneParam
.
contains
(
"&"
))
{
sceneParam
=
sceneParam
.
substring
(
0
,
sceneParam
.
indexOf
(
"&"
));
}
Long
resourcePageId
=
resourcePage
.
getId
();
List
<
MessageDto
>
messages
=
qrcodeSceneDto
.
getMessages
();
resourcePageColumnDao
.
deleteByPageId
(
resourcePageId
);
resourcePageItemDao
.
deleteByPageId
(
resourcePageId
);
if
(!
ListUtils
.
isEmpty
(
messages
))
{
//新增栏目资源
UpdateResourceColumnVO
columnVO
=
new
UpdateResourceColumnVO
();
columnVO
.
setColumnFormat
(
1
);
columnVO
.
setColumnType
(
ResourcePageConstants
.
ColumnTypeEnum
.
APP_PRODUCT
.
getCode
());
columnVO
.
setCreateUser
(
adviserId
);
columnVO
.
setColumnName
(
"本书配套资源服务"
);
List
<
ResourcePageItemVO
>
itemVOList
=
new
ArrayList
<>();
for
(
MessageDto
messageDto
:
messages
)
{
ResourcePageItemVO
vo
=
new
ResourcePageItemVO
();
vo
.
setLinkUrl
(
messageDto
.
getUrl
());
vo
.
setServeId
(
messageDto
.
getFromId
());
vo
.
setServeType
(
messageDto
.
getTypeCode
());
vo
.
setTypeCode
(
messageDto
.
getFromType
());
vo
.
setSeqNum
(
messages
.
indexOf
(
messageDto
));
itemVOList
.
add
(
vo
);
}
columnVO
.
setItemVOList
(
itemVOList
);
columnVO
.
setResourcePageId
(
resourcePage
.
getId
());
columnVO
.
setShowMore
(
false
);
this
.
updateResourceColumn
(
columnVO
);
if
(!
StringUtil
.
isEmpty
(
sceneParam
))
{
String
newParam
=
"sceneId="
+
dto
.
getSceneId
();
url
=
url
.
replace
(
sceneParam
,
newParam
);
}
}
else
{
//不含sceneId
if
(
url
.
contains
(
"?"
))
{
url
=
url
+
"&sceneId="
+
dto
.
getSceneId
();
}
else
{
url
=
url
+
"?sceneId="
+
dto
.
getSceneId
();
}
}
dto
.
setLinkUrl
(
url
);
updateList
.
add
(
dto
);
}
if
(!
ListUtils
.
isEmpty
(
updateList
))
{
resourcePageItemDao
.
batchUpdateServeUrlById
(
updateList
);
}
}
...
...
@@ -1459,4 +1454,202 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
}
return
result
;
}
@Override
public
void
batchUpdateBookId
(
List
<
BookSceneIdListDTO
>
requestDto
)
{
if
(
ListUtils
.
isEmpty
(
requestDto
))
{
return
;
}
List
<
BookSceneIdListDTO
>
sceneIdListDTOS
=
qrcodeSceneConsr
.
listSceneIds4Book
(
requestDto
);
if
(
ListUtils
.
isEmpty
(
sceneIdListDTOS
))
{
return
;
}
for
(
BookSceneIdListDTO
dto
:
sceneIdListDTOS
)
{
List
<
Long
>
sceneIds
=
dto
.
getSceneIds
();
if
(!
ListUtils
.
isEmpty
(
sceneIds
))
{
resourcePageDao
.
updateBookBySceneIds
(
sceneIds
,
dto
.
getBookId
(),
dto
.
getChannelId
());
}
}
}
@Override
public
List
<
BookServeDTO
>
getBookAndBookGroupServeIds
(
Long
adviserId
,
Long
bookId
,
Long
channelId
)
{
ResourcePage
resourcePage
=
resourcePageDao
.
getByBookId
(
bookId
,
channelId
,
adviserId
);
if
(
null
==
resourcePage
)
{
return
new
ArrayList
<>();
}
List
<
BookServeDTO
>
itemVOS
=
resourcePageItemDao
.
getAppServeByPage
(
resourcePage
.
getId
());
return
itemVOS
;
}
@Override
public
List
<
ResourcePageTool
>
getToolListByUser
(
Long
wechatUserId
,
Long
officialAccountsId
)
{
Long
gradeLabel
=
getUserGrade
(
wechatUserId
,
officialAccountsId
);
return
resourcePageToolDao
.
getByUserLabel
(
gradeLabel
);
}
@Override
public
List
<
Map
<
String
,
Object
>>
getResourceSourceTypeList
(
Long
wechatUserId
,
Long
officialAccountsId
)
{
Long
gradeLabel
=
getUserGrade
(
wechatUserId
,
officialAccountsId
);
for
(
ResourcePageConstants
.
CrowdSourceEnum
crowdSourceEnum
:
ResourcePageConstants
.
CrowdSourceEnum
.
values
())
{
List
<
Integer
>
crowdTypes
=
Arrays
.
asList
(
crowdSourceEnum
.
getCrowdTypes
());
if
(
crowdTypes
.
contains
(
gradeLabel
.
intValue
()))
{
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
for
(
ResourcePageConstants
.
ResourceSourceTypeEnum
sourceTypeEnum
:
crowdSourceEnum
.
getSourceTypes
())
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"sourceType"
,
sourceTypeEnum
.
getCode
());
map
.
put
(
"sourceName"
,
sourceTypeEnum
.
getName
());
list
.
add
(
map
);
}
return
list
;
}
}
return
new
ArrayList
<>();
}
@Override
public
Long
getUserGrade
(
Long
wechatUserId
,
Long
officialAccountsId
)
{
UserGradeLabelIdDTO
userGradeLabelIdDTO
=
readerConsr
.
getUserGrade
(
wechatUserId
,
officialAccountsId
);
Long
gradeLabel
=
1L
;
if
(
null
!=
userGradeLabelIdDTO
&&
null
!=
userGradeLabelIdDTO
.
getLabelId
())
{
gradeLabel
=
(
null
==
userGradeLabelIdDTO
.
getParentId
()
||
userGradeLabelIdDTO
.
getParentId
()
==
0
)
?
userGradeLabelIdDTO
.
getLabelId
()
:
userGradeLabelIdDTO
.
getParentId
();
}
return
gradeLabel
;
}
@Override
public
void
insertCourseStatistic
()
{
List
<
String
>
typeCodes
=
Arrays
.
asList
(
"SCHEDUE"
,
"VIDEO_SCHEDULE"
,
"VIDEO"
,
"LIVE_TIMETABLE"
);
List
<
BrowseRecordStatisticDTO
>
statisticDTOS
=
browseRecordConsr
.
getResourceTopIn7Day4H5
(
typeCodes
);
if
(
ListUtils
.
isEmpty
(
statisticDTOS
))
{
return
;
}
resourcePageCourseDao
.
deleteAll
();
List
<
ResourcePageCourse
>
courses
=
new
ArrayList
<>();
for
(
BrowseRecordStatisticDTO
dto:
statisticDTOS
)
{
ResourcePageCourse
course
=
new
ResourcePageCourse
();
course
.
setServeId
(
dto
.
getBrowseId
());
course
.
setServeName
(
dto
.
getBrowseName
());
course
.
setServeType
(
dto
.
getType
());
course
.
setTypeCode
(
dto
.
getTypeCode
());
course
.
setTypeName
(
dto
.
getTypeName
());
course
.
setAgentId
(
dto
.
getAgencyId
());
course
.
setChannelId
(
dto
.
getChannelId
());
course
.
setProLabelId
(
dto
.
getProLableId
());
course
.
setDepLableId
(
dto
.
getDepLableId
());
course
.
setPurLabelId
(
dto
.
getPurLableId
());
course
.
setBrowseCount
(
dto
.
getBrowseCount
());
courses
.
add
(
course
);
}
resourcePageCourseDao
.
insert
(
courses
);
}
@Override
public
PageBeanNew
<
ResourcePageCourseDTO
>
listCourseByUser
(
Long
wechatUserId
,
Long
officialAccountsId
,
Integer
currentPage
,
Integer
numPerPage
)
{
UserGradeLabelIdDTO
userGradeLabelIdDTO
=
readerConsr
.
getUserGrade
(
wechatUserId
,
officialAccountsId
);
Long
gradeLabel
=
null
==
userGradeLabelIdDTO
?
11L
:
userGradeLabelIdDTO
.
getLabelId
();
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"userGradeLabelId"
,
gradeLabel
);
PageBeanNew
<
ResourcePageCourseDTO
>
pageBeanNew
=
resourcePageCourseDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"listCourseByGradeLabelId"
);
if
(
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
()))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
pageBeanNew
.
getTotalCount
(),
new
ArrayList
<>());
}
List
<
ResourcePageCourseDTO
>
dtos
=
pageBeanNew
.
getRecordList
();
List
<
Long
>
appIds
=
new
ArrayList
<>();
List
<
Long
>
productIds
=
new
ArrayList
<>();
for
(
ResourcePageCourseDTO
dto
:
dtos
)
{
Long
serveId
=
dto
.
getServeId
();
if
(
ResourcePageConstants
.
ServeTypeEnum
.
APP
.
getValue
().
equals
(
dto
.
getServeType
())
&&
!
appIds
.
contains
(
serveId
))
{
appIds
.
add
(
serveId
);
}
if
(
ResourcePageConstants
.
ServeTypeEnum
.
PRODUCT
.
getValue
().
equals
(
dto
.
getServeType
())
&&
!
productIds
.
contains
(
serveId
))
{
productIds
.
add
(
serveId
);
}
}
Map
<
Long
,
AppDto
>
appDtoMap
=
appConsr
.
mapBaseByIds
(
appIds
);
Map
<
Long
,
ProductDto
>
productDtoMap
=
productConsr
.
getProBasesByIds
(
productIds
);
Long
accountSettingId
=
BookProps
.
getOperateOfficalId
();
AccountSetting
accountSetting
=
channelConsr
.
getAppInfo
(
accountSettingId
);
for
(
ResourcePageCourseDTO
courseDTO
:
dtos
)
{
Long
serveId
=
courseDTO
.
getServeId
();
String
serveType
=
courseDTO
.
getServeType
();
if
(
ResourcePageConstants
.
ServeTypeEnum
.
APP
.
getValue
().
equals
(
serveType
)
&&
!
MapUtils
.
isEmpty
(
appDtoMap
)
&&
appDtoMap
.
containsKey
(
serveId
))
{
AppDto
appDto
=
appDtoMap
.
get
(
courseDTO
.
getServeId
());
courseDTO
.
setServeName
(
appDto
.
getTitle
());
courseDTO
.
setServePic
(
appDto
.
getSquareImg
());
courseDTO
.
setTransverseImg
(
appDto
.
getTransverseImg
());
//跳转链接
String
turnUrl
=
ServeLinkUtils
.
getCompleteLink
(
"APP"
,
appDto
.
getTypeCode
(),
appDto
.
getAppId
().
toString
(),
appDto
.
getSceneCode
(),
appDto
.
getChannelId
().
toString
(),
appDto
.
getCreatedUser
().
toString
(),
null
,
accountSettingId
.
toString
(),
accountSetting
.
getProtocol
(),
accountSetting
.
getDomain
(),
accountSetting
.
getFirstDomain
(),
null
!=
accountSetting
.
getRandom
()
?
accountSetting
.
getRandom
().
toString
()
:
null
);
courseDTO
.
setResultUrl
(
turnUrl
);
continue
;
}
if
(
ResourcePageConstants
.
ServeTypeEnum
.
PRODUCT
.
getValue
().
equals
(
serveType
)
&&
!
MapUtils
.
isEmpty
(
productDtoMap
)
&&
productDtoMap
.
containsKey
(
serveId
))
{
ProductDto
productDto
=
productDtoMap
.
get
(
courseDTO
.
getServeId
());
courseDTO
.
setServeName
(
productDto
.
getProductName
());
courseDTO
.
setServePic
(
productDto
.
getCoverImg
());
courseDTO
.
setTransverseImg
(
StringUtil
.
isEmpty
(
productDto
.
getPicture1
())?
getDefaultBigPic
(
courseDTO
.
getTypeCode
()):
productDto
.
getPicture1
());
//跳转链接
String
turnUrl
=
ServeLinkUtils
.
getCompleteLink
(
"PRODUCT"
,
courseDTO
.
getTypeCode
(),
productDto
.
getProductId
().
toString
(),
productDto
.
getProductSceneCode
(),
courseDTO
.
getChannelId
().
toString
(),
null
,
null
,
accountSettingId
.
toString
(),
accountSetting
.
getProtocol
(),
accountSetting
.
getDomain
(),
accountSetting
.
getFirstDomain
(),
null
!=
accountSetting
.
getRandom
()
?
accountSetting
.
getRandom
().
toString
()
:
null
);
courseDTO
.
setResultUrl
(
turnUrl
);
continue
;
}
}
return
pageBeanNew
;
}
@Override
public
Long
getGradeByGradeLabelId
(
Long
graLabelId
)
{
return
resourcePageCourseDao
.
getGradeByGradeLabelId
(
graLabelId
);
}
@Override
public
Long
getGradeByDepLabelId
(
Long
depLabelId
)
{
return
resourcePageCourseDao
.
getGradeByDepLabelId
(
depLabelId
);
}
@Override
public
Boolean
isOpenRaysBook
(
Long
bookId
,
Long
channelId
,
Long
adviserId
)
{
return
resourcePageDao
.
isOpenRaysBook
(
bookId
,
channelId
,
adviserId
);
}
@Override
public
Map
<
String
,
Object
>
getUserNewState
(
Long
wechatUserId
)
{
Integer
notNew
=
resourcePageCollectDao
.
getUserIsNotNew
(
wechatUserId
);
Boolean
isNew
=
notNew
>
0
?
false
:
true
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"isNew"
,
isNew
);
return
map
;
}
@Override
public
void
addNewUserRecord
(
ResourcePageCollect
resourcePageCollect
)
{
if
(
null
==
resourcePageCollect
.
getIsNew
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少用户状态"
);
}
resourcePageCollectDao
.
insert
(
resourcePageCollect
);
}
@Override
public
Boolean
isOpenRaysScene
(
Long
sceneId
,
Long
bookGroupId
)
{
ResourcePage
resourcePage
;
if
(
null
!=
sceneId
)
{
resourcePage
=
resourcePageDao
.
getBySceneId
(
sceneId
);
}
else
if
(
null
!=
bookGroupId
)
{
resourcePage
=
resourcePageDao
.
getByBookGroupId
(
bookGroupId
);
}
else
{
return
false
;
}
Integer
openRays
=
null
==
resourcePage
?
0
:
resourcePage
.
getOpenRays
();
return
openRays
>
0
?
true
:
false
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/impl/WeworkTeacherBizImpl.java
View file @
ac20bae8
...
...
@@ -4,6 +4,9 @@ import cn.hutool.core.bean.BeanUtil;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.pcloud.book.applet.biz.AppletResourceApplyBiz
;
import
com.pcloud.book.applet.contants.AppletResourceApplyConstants
;
import
com.pcloud.book.applet.dto.AddResourceApplyDTO
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.group.biz.GroupMaterialAccountBiz
;
import
com.pcloud.book.group.biz.WeworkTeacherBiz
;
...
...
@@ -61,6 +64,8 @@ public class WeworkTeacherBizImpl implements WeworkTeacherBiz {
private
GroupMaterialAccountBiz
groupMaterialAccountBiz
;
@Autowired
private
WeworkTeacherBookBindMapper
weworkTeacherBookBindMapper
;
@Autowired
private
AppletResourceApplyBiz
appletResourceApplyBiz
;
@Override
@ParamLog
(
value
=
"新增客服老师"
)
...
...
@@ -101,9 +106,26 @@ public class WeworkTeacherBizImpl implements WeworkTeacherBiz {
weworkTeacher
.
setMediaId
(
mediaId
);
weworkTeacher
.
setMaterialUrl
(
materialUrl
);
weworkTeacherMapper
.
insert
(
weworkTeacher
);
//设置适用人群
this
.
updateResourceApply
(
weworkTeacher
.
getId
(),
weworkTeacherVO
.
getCrowdTypeList
());
return
weworkTeacher
.
getId
();
}
/**
* 更新适用人群
* @author:zhuyajie
* @date:2021/5/10 16:02
* * @param null
*/
private
void
updateResourceApply
(
Long
id
,
List
<
Integer
>
crowdTypeList
)
{
AddResourceApplyDTO
addResourceApplyDTO
=
new
AddResourceApplyDTO
();
addResourceApplyDTO
.
setTargetId
(
id
);
addResourceApplyDTO
.
setTargetType
(
AppletResourceApplyConstants
.
TargetTypeEnum
.
TEACHER
.
getValue
());
addResourceApplyDTO
.
setCrowdTypeList
(
crowdTypeList
);
appletResourceApplyBiz
.
addResourceApply
(
addResourceApplyDTO
);
}
@Override
@ParamLog
(
value
=
"更新客服老师"
,
isAfterReturn
=
false
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
@@ -141,6 +163,8 @@ public class WeworkTeacherBizImpl implements WeworkTeacherBiz {
throw
new
BookBizException
(
BookBizException
.
ID_NOT_EXIST
,
"更新客服老师,更新素材失败!"
);
}
}
//设置适用人群
this
.
updateResourceApply
(
weworkTeacher
.
getId
(),
weworkTeacherVO
.
getCrowdTypeList
());
return
weworkTeacher
.
getId
();
}
...
...
@@ -252,4 +276,22 @@ public class WeworkTeacherBizImpl implements WeworkTeacherBiz {
return
weworkTeacherMapper
.
getWxWorkTeacherByIds
(
teacherIds
);
}
@Override
public
WeworkTeacherVO
getWxworkTeacherById
(
Long
id
)
{
WeworkTeacherVO
vo
=
weworkTeacherMapper
.
getWxworkTeacherById
(
id
);
vo
.
setCrowdTypeList
(
appletResourceApplyBiz
.
getCrowdTypeList
(
id
,
AppletResourceApplyConstants
.
TargetTypeEnum
.
TEACHER
.
getValue
()));
return
vo
;
}
@Override
public
PageBeanNew
<
WeworkTeacherVO
>
getTeacherByGradeLabel4ResourcePage
(
Long
gradeLabelId
,
Integer
currentPage
,
Integer
numPerPage
)
{
int
offset
=
numPerPage
*
currentPage
;
Integer
count
=
weworkTeacherMapper
.
countTeacherByGradeLabel
(
gradeLabelId
.
intValue
());
if
(
Objects
.
isNull
(
count
)
||
count
<
1
)
{
return
new
PageBeanNew
<>();
}
List
<
WeworkTeacherVO
>
list
=
weworkTeacherMapper
.
getTeacherByGradeLabel
(
gradeLabelId
.
intValue
(),
offset
,
numPerPage
);
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
count
,
list
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/constant/ResourcePageConstants.java
View file @
ac20bae8
package
com
.
pcloud
.
book
.
group
.
constant
;
import
com.pcloud.book.applet.contants.AppletResourceApplyConstants
;
import
com.pcloud.common.constant.CacheConstant
;
/**
* @ClassName com.pcloud.book.group.constant.ResourcePageConstants
* @Author zhuyajie
...
...
@@ -137,4 +140,141 @@ public class ResourcePageConstants {
this
.
desc
=
desc
;
}
}
/**
* H5工具类型
* @author:zhuyajie
* @date:2021/5/12 16:35
* * @param null
*/
public
enum
ToolTypeEnum
{
HELP
(
1
,
"互助"
),
CLOCK
(
2
,
"打卡"
),
ANSWER
(
3
,
"搜答案"
),
RESOURCE
(
4
,
"资源广场"
),
WORD
(
5
,
"背单词"
),
PRETEST
(
6
,
"题库"
),
SUBJECTNOTE
(
7
,
"错题本"
),
TEACHER
(
8
,
"1v1老师"
),
COURSE
(
9
,
"课程"
),
BOOKLIST
(
10
,
"书单"
);
private
Integer
code
;
private
String
name
;
public
Integer
getCode
()
{
return
code
;
}
public
String
getName
()
{
return
name
;
}
ToolTypeEnum
(
Integer
code
,
String
name
)
{
this
.
code
=
code
;
this
.
name
=
name
;
}
}
/**
* 资源广场学龄段对应模块
* @author:zhuyajie
* @date:2021/5/13 11:22
* * @param null
*/
public
enum
CrowdSourceEnum
{
/**
* 学龄前:育儿宝库:
*/
PRESCHOOL
(
new
Integer
[]{
AppletResourceApplyConstants
.
CrowdTypeEnum
.
PRESCHOOL
.
getCode
()},
new
ResourceSourceTypeEnum
[]{
ResourceSourceTypeEnum
.
CHILD
}),
/**
* 小学、初中、高中、大学:搜教辅资料:(答案、试卷、课件/教案、作文、知识点汇总)
*/
SCHOOL
(
new
Integer
[]{
AppletResourceApplyConstants
.
CrowdTypeEnum
.
PRIMARY_SCHOOL
.
getCode
(),
AppletResourceApplyConstants
.
CrowdTypeEnum
.
JUNIOR_HIGH_SCHOOL
.
getCode
(),
AppletResourceApplyConstants
.
CrowdTypeEnum
.
SENIOR_HIGH_SCHOOL
.
getCode
(),
AppletResourceApplyConstants
.
CrowdTypeEnum
.
UNIVERSITY
.
getCode
()},
new
ResourceSourceTypeEnum
[]{
ResourceSourceTypeEnum
.
PAPER
,
ResourceSourceTypeEnum
.
PDF
,
ResourceSourceTypeEnum
.
ARTICLE
,
ResourceSourceTypeEnum
.
KNOWLEDGE
});
private
Integer
[]
crowdTypes
;
private
ResourceSourceTypeEnum
[]
sourceTypes
;
public
Integer
[]
getCrowdTypes
()
{
return
crowdTypes
;
}
public
ResourceSourceTypeEnum
[]
getSourceTypes
()
{
return
sourceTypes
;
}
CrowdSourceEnum
(
Integer
[]
crowdTypes
,
ResourceSourceTypeEnum
[]
sourceTypes
)
{
this
.
crowdTypes
=
crowdTypes
;
this
.
sourceTypes
=
sourceTypes
;
}
}
/**
* 资源广场模块
* @author:zhuyajie
* @date:2021/5/13 11:46
* * @param null
*/
public
enum
ResourceSourceTypeEnum
{
CHILD
(
1
,
"育儿宝库"
,
new
String
[]{
"手抄报"
,
"涂色"
,
"手工"
,
"亲子"
,
"游戏"
,
"简笔画"
,
"启蒙"
,
"早教"
},
new
Integer
[]{
AppletResourceApplyConstants
.
CrowdTypeEnum
.
PRESCHOOL
.
getCode
()}),
PAPER
(
5
,
"试卷"
,
new
String
[]{
"试卷"
},
new
Integer
[]{
AppletResourceApplyConstants
.
CrowdTypeEnum
.
PRIMARY_SCHOOL
.
getCode
(),
AppletResourceApplyConstants
.
CrowdTypeEnum
.
JUNIOR_HIGH_SCHOOL
.
getCode
(),
AppletResourceApplyConstants
.
CrowdTypeEnum
.
SENIOR_HIGH_SCHOOL
.
getCode
(),
AppletResourceApplyConstants
.
CrowdTypeEnum
.
UNIVERSITY
.
getCode
()}),
PDF
(
6
,
"课件/教案"
,
new
String
[]{
"课件"
,
"教案"
},
new
Integer
[]{
AppletResourceApplyConstants
.
CrowdTypeEnum
.
PRIMARY_SCHOOL
.
getCode
(),
AppletResourceApplyConstants
.
CrowdTypeEnum
.
JUNIOR_HIGH_SCHOOL
.
getCode
(),
AppletResourceApplyConstants
.
CrowdTypeEnum
.
SENIOR_HIGH_SCHOOL
.
getCode
(),
AppletResourceApplyConstants
.
CrowdTypeEnum
.
UNIVERSITY
.
getCode
()}),
ARTICLE
(
7
,
"作文"
,
new
String
[]{
"作文"
},
new
Integer
[]{
AppletResourceApplyConstants
.
CrowdTypeEnum
.
PRIMARY_SCHOOL
.
getCode
(),
AppletResourceApplyConstants
.
CrowdTypeEnum
.
JUNIOR_HIGH_SCHOOL
.
getCode
(),
AppletResourceApplyConstants
.
CrowdTypeEnum
.
SENIOR_HIGH_SCHOOL
.
getCode
(),
AppletResourceApplyConstants
.
CrowdTypeEnum
.
UNIVERSITY
.
getCode
()}),
KNOWLEDGE
(
8
,
"知识点汇总"
,
new
String
[]{
"知识点汇总"
},
new
Integer
[]{
AppletResourceApplyConstants
.
CrowdTypeEnum
.
PRIMARY_SCHOOL
.
getCode
(),
AppletResourceApplyConstants
.
CrowdTypeEnum
.
JUNIOR_HIGH_SCHOOL
.
getCode
(),
AppletResourceApplyConstants
.
CrowdTypeEnum
.
SENIOR_HIGH_SCHOOL
.
getCode
(),
AppletResourceApplyConstants
.
CrowdTypeEnum
.
UNIVERSITY
.
getCode
()});
private
Integer
code
;
private
String
name
;
private
String
[]
keywords
;
private
Integer
[]
crowdTypes
;
public
Integer
getCode
()
{
return
code
;
}
public
String
getName
()
{
return
name
;
}
public
String
[]
getKeywords
()
{
return
keywords
;
}
public
Integer
[]
getCrowdTypes
()
{
return
crowdTypes
;
}
ResourceSourceTypeEnum
(
Integer
code
,
String
name
,
String
[]
keywords
,
Integer
[]
crowdTypes
)
{
this
.
code
=
code
;
this
.
name
=
name
;
this
.
keywords
=
keywords
;
this
.
crowdTypes
=
crowdTypes
;
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/ResourcePageCollectDao.java
View file @
ac20bae8
...
...
@@ -19,4 +19,12 @@ public interface ResourcePageCollectDao extends BaseDao<ResourcePageCollect>{
* * @param null
*/
ResourcePageCollect
getCollectRecordByUser
(
Long
wechatUserId
,
Long
resourcePageId
);
/**
* 获取非新用户状态
* @author:zhuyajie
* @date:2021/5/27 10:38
* * @param null
*/
Integer
getUserIsNotNew
(
Long
wechatUserId
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/ResourcePageCourseDao.java
0 → 100644
View file @
ac20bae8
package
com
.
pcloud
.
book
.
group
.
dao
;
import
com.pcloud.book.group.entity.ResourcePageCourse
;
import
com.pcloud.common.core.dao.BaseDao
;
/**
* 7天浏览量高的资源统计(ResourcePageCourse)表数据库访问层
*
* @author makejava
* @since 2021-05-17 14:50:36
*/
public
interface
ResourcePageCourseDao
extends
BaseDao
<
ResourcePageCourse
>{
void
deleteAll
();
Long
getGradeByGradeLabelId
(
Long
graLabelId
);
Long
getGradeByDepLabelId
(
Long
depLabelId
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/ResourcePageDao.java
View file @
ac20bae8
...
...
@@ -35,14 +35,6 @@ public interface ResourcePageDao extends BaseDao<ResourcePage>{
ResourcePage
getByBookId
(
Long
bookId
,
Long
channelId
,
Long
adviserId
);
/**
* 根据书设置小睿关闭
* @author:zhuyajie
* @date:2021/3/31 12:01
* * @param null
*/
void
setRaysCloseByBook
(
Map
<
String
,
Object
>
paramMap
);
/**
* 修改页面更新时间
* @author:zhuyajie
* @date:2021/4/2 15:21
...
...
@@ -72,13 +64,6 @@ public interface ResourcePageDao extends BaseDao<ResourcePage>{
* * @param null
*/
List
<
Long
>
getOpenRaysSceneIds
(
List
<
Long
>
sceneIds
);
/**
* 批量关闭小睿流程
* @author:zhuyajie
* @date:2021/4/30 14:47
* * @param null
*/
void
setRaysCloseBySceneIds
(
List
<
Long
>
sceneIds
);
/**
* 批量更新sceneId
...
...
@@ -97,4 +82,27 @@ public interface ResourcePageDao extends BaseDao<ResourcePage>{
ResourcePage
getPageByColumnId
(
Long
resourcePageColumnId
);
List
<
Long
>
getSceneIdsByResourceId
(
Long
resourceId
);
/**
* 更新书刊id
* @author:zhuyajie
* @date:2021/5/11 18:50
* * @param null
*/
void
updateBookBySceneIds
(
List
<
Long
>
sceneIds
,
Long
bookId
,
Long
channelId
);
/**
*同一本书其他码下关闭小睿流程
* @author:zhuyajie
* @date:2021/5/12 9:59
* * @param null
*/
void
setOtherPageRaysClose
(
Long
bookId
,
Long
channelId
,
Long
createUser
,
Long
sceneId
,
Long
bookGroupId
);
/**
* 书刊是否开启小睿
* @author:zhuyajie
* @date:2021/5/25 11:03
* * @param null
*/
Boolean
isOpenRaysBook
(
Long
bookId
,
Long
channelId
,
Long
adviserId
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/ResourcePageItemDao.java
View file @
ac20bae8
package
com
.
pcloud
.
book
.
group
.
dao
;
import
com.pcloud.book.group.dto.BookGroupServeDTO
;
import
com.pcloud.book.group.dto.BookServeDTO
;
import
com.pcloud.book.group.dto.ResourcePageUrlDTO
;
import
com.pcloud.book.group.entity.BookGroupServe
;
import
com.pcloud.book.group.entity.ResourcePageItem
;
import
com.pcloud.book.group.vo.ResourcePageItemVO
;
...
...
@@ -76,4 +78,16 @@ public interface ResourcePageItemDao extends BaseDao<ResourcePageItem>{
ResourcePageItemVO
checkOneServeItemByPageId
(
Long
resourcePageId
);
void
deleteByServeId
(
Long
resourceId
);
/**
* 查配置的应用作品
* @author:zhuyajie
* @date:2021/5/11 19:53
* * @param null
*/
List
<
BookServeDTO
>
getAppServeByPage
(
Long
resourcePageId
);
List
<
ResourcePageUrlDTO
>
getServeUrl4Update
(
List
<
Long
>
sceneIdList
);
void
batchUpdateServeUrlById
(
List
<
ResourcePageUrlDTO
>
list
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/ResourcePageToolDao.java
0 → 100644
View file @
ac20bae8
package
com
.
pcloud
.
book
.
group
.
dao
;
import
com.pcloud.book.group.entity.ResourcePageTool
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
/**
* H5资源页工具类型(ResourcePageTool)表数据库访问层
*
* @author makejava
* @since 2021-05-12 17:32:24
*/
public
interface
ResourcePageToolDao
extends
BaseDao
<
ResourcePageTool
>{
List
<
ResourcePageTool
>
getByUserLabel
(
Long
userGradeLabelId
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/impl/ResourcePageCollectDaoImpl.java
View file @
ac20bae8
...
...
@@ -26,4 +26,9 @@ public class ResourcePageCollectDaoImpl extends BaseDaoImpl<ResourcePageCollect>
map
.
put
(
"resourcePageId"
,
resourcePageId
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getCollectRecordByUser"
),
map
);
}
@Override
public
Integer
getUserIsNotNew
(
Long
wechatUserId
)
{
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getUserIsNotNew"
),
wechatUserId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/impl/ResourcePageCourseDaoImpl.java
0 → 100644
View file @
ac20bae8
package
com
.
pcloud
.
book
.
group
.
dao
.
impl
;
import
com.pcloud.book.group.dao.ResourcePageCourseDao
;
import
com.pcloud.book.group.entity.ResourcePageCourse
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
/**
* @ClassName com.pcloud.book.group.dao.impl.ResourcePageCourseDaoImpl
* @Author zhuyajie
* @Description 资源统计
* @Date 2021/5/17 14:52
* @Version 1.0
**/
@Component
public
class
ResourcePageCourseDaoImpl
extends
BaseDaoImpl
<
ResourcePageCourse
>
implements
ResourcePageCourseDao
{
@Override
public
void
deleteAll
()
{
getSessionTemplate
().
delete
(
getStatement
(
"deleteAll"
));
}
@Override
public
Long
getGradeByGradeLabelId
(
Long
graLabelId
)
{
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getGradeByGradeLabelId"
),
graLabelId
);
}
@Override
public
Long
getGradeByDepLabelId
(
Long
depLabelId
)
{
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getGradeByDepLabelId"
),
depLabelId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/impl/ResourcePageDaoImpl.java
View file @
ac20bae8
...
...
@@ -35,11 +35,6 @@ public class ResourcePageDaoImpl extends BaseDaoImpl<ResourcePage> implements Re
}
@Override
public
void
setRaysCloseByBook
(
Map
<
String
,
Object
>
paramMap
)
{
getSessionTemplate
().
update
(
getStatement
(
"setRaysCloseByBook"
),
paramMap
);
}
@Override
public
void
updatePageUpdateTime
(
Long
resourcePageId
)
{
getSessionTemplate
().
update
(
getStatement
(
"updatePageUpdateTime"
),
resourcePageId
);
}
...
...
@@ -60,11 +55,6 @@ public class ResourcePageDaoImpl extends BaseDaoImpl<ResourcePage> implements Re
}
@Override
public
void
setRaysCloseBySceneIds
(
List
<
Long
>
sceneIds
)
{
getSessionTemplate
().
update
(
getStatement
(
"setRaysCloseBySceneIds"
),
sceneIds
);
}
@Override
public
void
batchUpdateSceneIdByBookGroup
(
List
<
AddBookGroupServeDTO
>
list
)
{
getSessionTemplate
().
update
(
getStatement
(
"batchUpdateSceneIdByBookGroup"
),
list
);
}
...
...
@@ -78,4 +68,33 @@ public class ResourcePageDaoImpl extends BaseDaoImpl<ResourcePage> implements Re
public
List
<
Long
>
getSceneIdsByResourceId
(
Long
resourceId
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getSceneIdsByResourceId"
),
resourceId
);
}
@Override
public
void
updateBookBySceneIds
(
List
<
Long
>
sceneIds
,
Long
bookId
,
Long
channelId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"sceneIds"
,
sceneIds
);
map
.
put
(
"bookId"
,
bookId
);
map
.
put
(
"channelId"
,
channelId
);
getSessionTemplate
().
update
(
getStatement
(
"updateBookBySceneIds"
),
map
);
}
@Override
public
void
setOtherPageRaysClose
(
Long
bookId
,
Long
channelId
,
Long
createUser
,
Long
sceneId
,
Long
bookGroupId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"bookId"
,
bookId
);
map
.
put
(
"channelId"
,
channelId
);
map
.
put
(
"createUser"
,
createUser
);
map
.
put
(
"bookGroupId"
,
bookGroupId
);
map
.
put
(
"sceneId"
,
sceneId
);
getSessionTemplate
().
update
(
getStatement
(
"setOtherPageRaysClose"
),
map
);
}
@Override
public
Boolean
isOpenRaysBook
(
Long
bookId
,
Long
channelId
,
Long
adviserId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"bookId"
,
bookId
);
map
.
put
(
"channelId"
,
channelId
);
map
.
put
(
"adviserId"
,
adviserId
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"isOpenRaysBook"
),
map
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/impl/ResourcePageItemDaoImpl.java
View file @
ac20bae8
package
com
.
pcloud
.
book
.
group
.
dao
.
impl
;
import
com.pcloud.book.group.dao.ResourcePageItemDao
;
import
com.pcloud.book.group.dto.BookServeDTO
;
import
com.pcloud.book.group.dto.ResourcePageUrlDTO
;
import
com.pcloud.book.group.entity.BookGroupServe
;
import
com.pcloud.book.group.entity.ResourcePageItem
;
import
com.pcloud.book.group.vo.ResourcePageItemVO
;
...
...
@@ -76,4 +78,19 @@ public class ResourcePageItemDaoImpl extends BaseDaoImpl<ResourcePageItem> imple
public
void
deleteByServeId
(
Long
resourceId
)
{
getSessionTemplate
().
delete
(
getStatement
(
"deleteByServeId"
),
resourceId
);
}
@Override
public
List
<
BookServeDTO
>
getAppServeByPage
(
Long
resourcePageId
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getAppServeByPage"
),
resourcePageId
);
}
@Override
public
List
<
ResourcePageUrlDTO
>
getServeUrl4Update
(
List
<
Long
>
sceneIdList
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getServeUrl4Update"
),
sceneIdList
);
}
@Override
public
void
batchUpdateServeUrlById
(
List
<
ResourcePageUrlDTO
>
list
)
{
getSessionTemplate
().
update
(
getStatement
(
"batchUpdateServeUrlById"
),
list
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/impl/ResourcePageToolDaoImpl.java
0 → 100644
View file @
ac20bae8
package
com
.
pcloud
.
book
.
group
.
dao
.
impl
;
import
com.pcloud.book.group.dao.ResourcePageToolDao
;
import
com.pcloud.book.group.entity.ResourcePageTool
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
/**
* @ClassName com.pcloud.book.group.dao.impl.ResourcePageToolDaoImpl
* @Author zhuyajie
* @Description H5工具
* @Date 2021/5/12 17:38
* @Version 1.0
**/
@Component
public
class
ResourcePageToolDaoImpl
extends
BaseDaoImpl
<
ResourcePageTool
>
implements
ResourcePageToolDao
{
@Override
public
List
<
ResourcePageTool
>
getByUserLabel
(
Long
userGradeLabelId
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getByUserLabel"
),
userGradeLabelId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dto/ResourcePageCourseDTO.java
0 → 100644
View file @
ac20bae8
package
com
.
pcloud
.
book
.
group
.
dto
;
import
com.pcloud.common.dto.BaseDto
;
import
lombok.Data
;
/**
* 7天浏览量高的资源统计(ResourcePageCourse)实体类
*
* @author makejava
* @since 2021-05-17 14:50:36
*/
@Data
public
class
ResourcePageCourseDTO
extends
BaseDto
{
private
static
final
long
serialVersionUID
=
-
38057094074172299L
;
/**
* 资源id
*/
private
Long
serveId
;
/**
* 资源名称
*/
private
String
serveName
;
/**
* 资源类型(APP/PRODUCT)
*/
private
String
serveType
;
/**
* 资源类型
*/
private
String
typeCode
;
/**
* 资源类型名称
*/
private
String
typeName
;
/**
* 渠道id
*/
private
Long
channelId
;
private
String
servePic
;
private
String
transverseImg
;
/**
* 跳转结果链接
*/
private
String
resultUrl
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/group/dto/ResourcePageUrlDTO.java
0 → 100644
View file @
ac20bae8
package
com
.
pcloud
.
book
.
group
.
dto
;
import
lombok.Data
;
/**
* @ClassName com.pcloud.book.group.dto.ResourcePageUrlDTO
* @Author zhuyajie
* @Description 资源页资源链接
* @Date 2021/5/27 17:42
* @Version 1.0
**/
@Data
public
class
ResourcePageUrlDTO
{
private
Long
sceneId
;
private
String
linkUrl
;
private
Long
id
;
}
pcloud-service-book/src/main/java/com/pcloud/book/group/entity/ResourcePage.java
View file @
ac20bae8
...
...
@@ -50,4 +50,12 @@ public class ResourcePage extends BaseEntity {
*/
private
String
bookCover
;
/**
* 书刊id
*/
private
Long
bookId
;
/**
* 渠道id
*/
private
Long
channelId
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/group/entity/ResourcePageCollect.java
View file @
ac20bae8
...
...
@@ -29,5 +29,8 @@ public class ResourcePageCollect extends BaseEntity {
* 收藏状态
*/
private
Integer
collectState
;
/**
* 新用户状态
*/
private
Integer
isNew
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/group/entity/ResourcePageCourse.java
0 → 100644
View file @
ac20bae8
package
com
.
pcloud
.
book
.
group
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
java.util.Date
;
import
java.io.Serializable
;
import
lombok.Data
;
/**
* 7天浏览量高的资源统计(ResourcePageCourse)实体类
*
* @author makejava
* @since 2021-05-17 14:50:36
*/
@Data
public
class
ResourcePageCourse
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
-
38057094074172299L
;
/**
* 主键
*/
private
Long
id
;
/**
* 资源id
*/
private
Long
serveId
;
/**
* 资源名称
*/
private
String
serveName
;
/**
* 资源类型(APP/PRODUCT)
*/
private
String
serveType
;
/**
* 资源类型
*/
private
String
typeCode
;
/**
* 资源类型名称
*/
private
String
typeName
;
/**
* 渠道id
*/
private
Long
channelId
;
/**
* 出版社id
*/
private
Long
agentId
;
/**
* 专业标签
*/
private
Long
proLabelId
;
/**
* 深度标签
*/
private
Long
depLableId
;
/**
* 目的标签
*/
private
Long
purLabelId
;
/**
* 浏览量
*/
private
Integer
browseCount
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/group/entity/ResourcePageTool.java
0 → 100644
View file @
ac20bae8
package
com
.
pcloud
.
book
.
group
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
lombok.Data
;
/**
* H5资源页工具类型(ResourcePageTool)实体类
*
* @author makejava
* @since 2021-05-12 17:32:24
*/
@Data
public
class
ResourcePageTool
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
655562186731451576L
;
/**
* 用户年级标签
*/
private
Long
userGradeLabelId
;
/**
* 工具类型
*/
private
Integer
toolType
;
/**
* 工具名称
*/
private
String
toolName
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/group/facade/impl/BookGroupFacadeImpl.java
View file @
ac20bae8
...
...
@@ -1224,7 +1224,8 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"scene不能为空!"
);
}
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
BookGroupDTO
bookGroupDTO
=
bookGroupBiz
.
getByAppletScene
(
wechatUserId
,
scene
);
Long
officialAccountsId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
BookGroupDTO
bookGroupDTO
=
bookGroupBiz
.
getByAppletScene
(
wechatUserId
,
scene
,
officialAccountsId
);
return
new
ResponseDto
<>(
bookGroupDTO
);
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/facade/impl/ResourcePageFacade.java
View file @
ac20bae8
...
...
@@ -4,6 +4,7 @@ import com.pcloud.book.group.biz.ResourcePageBiz;
import
com.pcloud.book.group.entity.ResourcePageCollect
;
import
com.pcloud.book.group.vo.UpdateResourceColumnVO
;
import
com.pcloud.book.group.vo.UpdateResourcePageVO
;
import
com.pcloud.channelcenter.qrcode.dto.BookSceneIdListDTO
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.utils.SessionUtil
;
import
com.pcloud.common.utils.cookie.Cookie
;
...
...
@@ -147,10 +148,10 @@ public class ResourcePageFacade {
return
new
ResponseDto
<>(
resourcePageBiz
.
getResourcePageByBookGroupIdOrSceneId4Wechat
(
bookGroupId
,
wechatUserId
,
sceneId
));
}
@ApiOperation
(
"批量更新资源页
二维码
"
)
@PostMapping
(
"batchUpdateResource
Qrcode
"
)
public
ResponseDto
<?>
batchUpdateResource
Qrcode
(
@RequestBody
List
<
Long
>
qrcodeIdList
,
@RequestParam
(
"qrcodeType"
)
String
qrcodeType
)
{
resourcePageBiz
.
batchUpdateResource
Qrcode
(
qrcodeIdList
,
qrcodeType
);
@ApiOperation
(
"批量更新资源页
应用作品链接
"
)
@PostMapping
(
"batchUpdateResource
Url
"
)
public
ResponseDto
<?>
batchUpdateResource
Url
(
@RequestBody
List
<
Long
>
sceneIdList
)
{
resourcePageBiz
.
batchUpdateResource
Url
(
sceneIdList
);
return
new
ResponseDto
<>();
}
...
...
@@ -171,4 +172,63 @@ public class ResourcePageFacade {
resourcePageBiz
.
addCollectRecord
(
resourcePageCollect
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"更新书刊id"
)
@PostMapping
(
"batchUpdateBookId"
)
public
ResponseDto
<?>
batchUpdateBookId
(
@RequestBody
List
<
BookSceneIdListDTO
>
requestDto
)
{
resourcePageBiz
.
batchUpdateBookId
(
requestDto
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"查H5资源页工具"
)
@GetMapping
(
"getToolListByUser"
)
public
ResponseDto
<?>
getToolListByUser
(
@CookieValue
(
"userInfo"
)
String
userInfo
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Long
officialAccountsId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
return
new
ResponseDto
<>(
resourcePageBiz
.
getToolListByUser
(
wechatUserId
,
officialAccountsId
));
}
@ApiOperation
(
"资源广场模块"
)
@GetMapping
(
"getResourceSourceTypeList"
)
public
ResponseDto
<?>
getResourceSourceTypeList
(
@CookieValue
(
"userInfo"
)
String
userInfo
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Long
officialAccountsId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
return
new
ResponseDto
<>(
resourcePageBiz
.
getResourceSourceTypeList
(
wechatUserId
,
officialAccountsId
));
}
@ApiOperation
(
"添加课程统计数据"
)
@GetMapping
(
"insertCourseStatistic"
)
public
ResponseDto
<?>
insertCourseStatistic
()
{
resourcePageBiz
.
insertCourseStatistic
();
return
new
ResponseDto
<>();
}
@ApiOperation
(
"H5首页-根据用户年级查推荐课程"
)
@GetMapping
(
"listCourseByUser"
)
public
ResponseDto
<?>
listCourseByUser
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
Integer
numPerPage
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Long
officialAccountsId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
return
new
ResponseDto
<>(
resourcePageBiz
.
listCourseByUser
(
wechatUserId
,
officialAccountsId
,
currentPage
,
numPerPage
));
}
@ApiOperation
(
"获取用户H5新用户状态"
)
@GetMapping
(
"getUserNewState"
)
public
ResponseDto
<?>
getUserNewState
(
@CookieValue
(
"userInfo"
)
String
userInfo
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
resourcePageBiz
.
getUserNewState
(
wechatUserId
));
}
@ApiOperation
(
"添加非新用户记录"
)
@PostMapping
(
"addNewUserRecord"
)
public
ResponseDto
<?>
addNewUserRecord
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestBody
ResourcePageCollect
resourcePageCollect
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Long
officialAccountsId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
resourcePageCollect
.
setWechatUserId
(
wechatUserId
);
resourcePageCollect
.
setOfficialAccountsId
(
officialAccountsId
);
resourcePageBiz
.
addNewUserRecord
(
resourcePageCollect
);
return
new
ResponseDto
<>();
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/facade/impl/WeworkTeacherFacadeImpl.java
View file @
ac20bae8
package
com
.
pcloud
.
book
.
group
.
facade
.
impl
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.group.biz.WeworkTeacherBiz
;
import
com.pcloud.book.group.vo.WeworkTeacherBookBindVO
;
import
com.pcloud.book.group.vo.WeworkTeacherVO
;
...
...
@@ -11,6 +12,7 @@ import com.pcloud.common.utils.cookie.Cookie;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -104,4 +106,26 @@ public class WeworkTeacherFacadeImpl {
SessionUtil
.
getInfoToken4Redis
(
token
);
return
new
ResponseDto
<>(
weworkTeacherBiz
.
getBookWxworkTeacherList
(
name
,
currentPage
,
numPerPage
));
}
@ApiOperation
(
"根据id查老师"
)
@GetMapping
(
"getWxworkTeacherById"
)
public
ResponseDto
<?>
getWxworkTeacherById
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"id"
)
Long
id
)
{
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
weworkTeacherBiz
.
getWxworkTeacherById
(
id
));
}
@ApiOperation
(
"H5首页-客服老师"
)
@GetMapping
(
"getTeacherByGradeLabel4ResourcePage"
)
public
ResponseDto
<?>
getTeacherByGradeLabel4ResourcePage
(
@RequestParam
(
"gradeLabelId"
)
Long
gradeLabelId
,
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
Integer
numPerPage
)
{
if
(
null
==
gradeLabelId
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少用户年级标签"
);
}
if
(
null
==
currentPage
||
null
==
numPerPage
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少分页参数"
);
}
return
new
ResponseDto
<>(
weworkTeacherBiz
.
getTeacherByGradeLabel4ResourcePage
(
gradeLabelId
,
currentPage
,
numPerPage
));
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/mapper/WeworkTeacherMapper.java
View file @
ac20bae8
...
...
@@ -42,4 +42,12 @@ public interface WeworkTeacherMapper {
@MapKey
(
"id"
)
Map
<
Long
,
WxWorkTeacherDTO
>
getWxWorkTeacherByIds
(
@Param
(
"ids"
)
List
<
Long
>
teacherIds
);
WeworkTeacherVO
getWxworkTeacherById
(
Long
id
);
List
<
WeworkTeacherVO
>
getTeacherByGradeLabel
(
@Param
(
"crowdType"
)
Integer
crowdType
,
@Param
(
"offset"
)
Integer
offset
,
@Param
(
"limit"
)
Integer
limit
);
Integer
countTeacherByGradeLabel
(
Integer
crowdType
);
}
pcloud-service-book/src/main/java/com/pcloud/book/group/service/impl/BookGroupServiceImpl.java
View file @
ac20bae8
...
...
@@ -476,4 +476,11 @@ public class BookGroupServiceImpl implements BookGroupService {
@RequestParam
(
"numPerPage"
)
Integer
numPerPage
){
return
ResponseHandleUtil
.
toResponse
(
bookGroupBiz
.
getAllRaysScene
(
currentPage
,
numPerPage
));
}
@Override
@GetMapping
(
"isOpenRaysScene"
)
public
ResponseEntity
<
ResponseDto
<
Boolean
>>
isOpenRaysScene
(
@RequestParam
(
value
=
"sceneId"
,
required
=
false
)
Long
sceneId
,
@RequestParam
(
value
=
"bookGroupId"
,
required
=
false
)
Long
bookGroupId
)
{
return
ResponseHandleUtil
.
toResponse
(
resourcePageBiz
.
isOpenRaysScene
(
sceneId
,
bookGroupId
));
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/vo/WeworkTeacherVO.java
View file @
ac20bae8
...
...
@@ -11,6 +11,7 @@ import lombok.Data;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
/**
...
...
@@ -91,6 +92,9 @@ public class WeworkTeacherVO implements Serializable {
@ApiModelProperty
(
"更新时间"
)
private
Date
updateTime
;
@ApiModelProperty
(
"适用人群类型"
)
private
List
<
Integer
>
crowdTypeList
;
private
static
final
long
serialVersionUID
=
3857636238754367824L
;
...
...
pcloud-service-book/src/main/java/com/pcloud/book/mapper/clickhouse/AppletRecordCHMapper.java
View file @
ac20bae8
...
...
@@ -2,9 +2,11 @@ package com.pcloud.book.mapper.clickhouse;
import
com.pcloud.book.applet.dto.AppletRecordDTO
;
import
com.pcloud.book.applet.entity.AppletRecord
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -18,4 +20,5 @@ public interface AppletRecordCHMapper {
void
optimize
();
List
<
AppletRecordDTO
>
getAggrStatis4H5
(
Map
<
String
,
Object
>
paramMap
);
}
pcloud-service-book/src/main/java/com/pcloud/book/util/properties/BookProps.java
View file @
ac20bae8
...
...
@@ -43,6 +43,17 @@ public class BookProps {
*/
private
static
Long
miniOfficialAccountsId
;
private
static
Long
operateOfficalId
;
public
static
Long
getOperateOfficalId
()
{
return
operateOfficalId
;
}
@Value
(
"${operate_official_id}"
)
public
void
setOperateOfficalId
(
Long
operateOfficalId
)
{
BookProps
.
operateOfficalId
=
operateOfficalId
;
}
public
static
String
getJisuAppKey
()
{
return
jisuAppKey
;
}
...
...
pcloud-service-book/src/main/resources/clickhouse/applet/AppletRecordCHMapper.xml
View file @
ac20bae8
...
...
@@ -75,4 +75,42 @@
<update
id=
"optimize"
>
optimize table applet_record
</update>
<select
id=
"getAggrStatis4H5"
resultType=
"com.pcloud.book.applet.dto.AppletRecordDTO"
>
SELECT
record_type recordType,
from_id fromId,
any(from_name) fromName,
any(link_url) linkUrl,
any(type_code) typeCode,
COUNT(id) clickCount,
COUNT(DISTINCT wechat_user_id) userCount
FROM applet_record
WHERE
record_type in (5,6)
<if
test=
"sourceKeywords != null and sourceKeywords.size() > 0"
>
AND
<foreach
collection=
"sourceKeywords"
item=
"sourceKeyword"
separator=
" OR "
open=
"("
close=
")"
>
from_name LIKE concat('%',#{sourceKeyword},'%')
</foreach>
</if>
<if
test=
"beginDate != null"
>
AND create_time >= #{beginDate}
</if>
<if
test=
"endDate != null"
>
AND create_time
<
= #{endDate}
</if>
<if
test=
"fromIdList != null and fromIdList.size() > 0"
>
AND from_id in
<foreach
collection=
"fromIdList"
index=
"index"
separator=
","
open=
"("
close=
")"
item=
"item"
>
#{item}
</foreach>
</if>
GROUP BY record_type, from_id
ORDER BY userCount DESC
<if
test=
"offset != null and limit > 0"
>
LIMIT #{offset}, #{limit}
</if>
</select>
</mapper>
pcloud-service-book/src/main/resources/mapper/applet/AnswerSubscribePopupDao.xml
0 → 100644
View file @
ac20bae8
<?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.applet.dao.impl.AnswerSubscribePopupDaoImpl"
>
<resultMap
type=
"com.pcloud.book.applet.entity.AnswerSubscribePopup"
id=
"AnswerSubscribePopupMap"
>
<result
property=
"id"
column=
"id"
jdbcType=
"INTEGER"
/>
<result
property=
"wechatUserId"
column=
"wechat_user_id"
jdbcType=
"INTEGER"
/>
<result
property=
"accountSettingId"
column=
"account_setting_id"
jdbcType=
"INTEGER"
/>
<result
property=
"bookId"
column=
"book_id"
jdbcType=
"INTEGER"
/>
<result
property=
"channelId"
column=
"channel_id"
jdbcType=
"INTEGER"
/>
<result
property=
"adviserId"
column=
"adviser_id"
jdbcType=
"INTEGER"
/>
<result
property=
"subscribeType"
column=
"subscribe_type"
jdbcType=
"INTEGER"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"updateTime"
column=
"update_time"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<!--查询单个-->
<select
id=
"getById"
resultMap=
"AnswerSubscribePopupMap"
>
select
id, wechat_user_id, account_setting_id, book_id, channel_id, adviser_id, subscribe_type, create_time, update_time
from book.answer_subscribe_popup
where id = #{id}
</select>
<!--新增所有列-->
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into book.answer_subscribe_popup(wechat_user_id, account_setting_id, book_id, channel_id, adviser_id, subscribe_type, create_time, update_time)
values (#{wechatUserId}, #{accountSettingId}, #{bookId}, #{channelId}, #{adviserId}, #{subscribeType}, now(), now())
</insert>
<!--通过主键修改数据-->
<update
id=
"update"
>
update book.answer_subscribe_popup
<set>
<if
test=
"wechatUserId != null"
>
wechat_user_id = #{wechatUserId},
</if>
<if
test=
"accountSettingId != null"
>
account_setting_id = #{accountSettingId},
</if>
<if
test=
"bookId != null"
>
book_id = #{bookId},
</if>
<if
test=
"channelId != null"
>
channel_id = #{channelId},
</if>
<if
test=
"adviserId != null"
>
adviser_id = #{adviserId},
</if>
<if
test=
"subscribeType != null"
>
subscribe_type = #{subscribeType},
</if>
update_time = now(),
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete
id=
"deleteById"
>
delete from book.answer_subscribe_popup where id = #{id}
</delete>
<select
id=
"getLastRecord"
resultMap=
"AnswerSubscribePopupMap"
parameterType=
"long"
>
SELECT
id, wechat_user_id, account_setting_id, book_id, channel_id, adviser_id, subscribe_type
FROM
answer_subscribe_popup
WHERE
wechat_user_id = #{wechatUserId}
ORDER BY
create_time DESC
LIMIT 1
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/applet/AppletBanner.xml
View file @
ac20bae8
...
...
@@ -197,4 +197,29 @@
SELECT IFNULL(MAX(seq),0) FROM applet_banner
WHERE agent_id = #{agentId}
</select>
<select
id=
"listBannerByGrade"
parameterType=
"map"
resultType=
"com.pcloud.book.applet.dto.AppletBannerDTO"
>
SELECT
c.id,
c.banner_pic bannerPic,
c.jump_type jumpType,
c.jump_url jumpUrl,
c.fill_type fillType,
c.serve_id serveId,
c.serve_type serveType
FROM
applet_resource_apply a
LEFT JOIN applet_banner c ON a.target_id = c.id
WHERE
a.crowd_type = #{crowdType}
AND a.target_type = "BANNER"
AND a.target_id > 0
AND c.show_state = 1
GROUP BY
a.target_id
ORDER BY
c.seq ASC
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/applet/AppletLinkClickMapper.xml
View file @
ac20bae8
...
...
@@ -9,12 +9,15 @@
<result
property=
"fromId"
column=
"from_id"
jdbcType=
"INTEGER"
/>
<result
property=
"recordType"
column=
"record_type"
jdbcType=
"INTEGER"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"officialAccountsId"
column=
"official_accounts_id"
jdbcType=
"INTEGER"
/>
<result
property=
"booklistId"
column=
"booklist_id"
jdbcType=
"INTEGER"
/>
</resultMap>
<!--新增所有列-->
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into book.applet_link_click(wechat_user_id, type_id, from_id, record_type, create_time, create_date)
values (#{wechatUserId}, #{typeId}, #{fromId}, #{recordType}, NOW(),NOW())
insert into book.applet_link_click(wechat_user_id, type_id, from_id, record_type, create_time, create_date,
official_accounts_id, booklist_id)
values (#{wechatUserId}, #{typeId}, #{fromId}, #{recordType}, NOW(),NOW(), #{officialAccountsId}, #{booklistId})
</insert>
<select
id=
"getListThirdResourcesAnalysis"
parameterType=
"map"
...
...
pcloud-service-book/src/main/resources/mapper/applet/AppletOuterBooklistDao.xml
View file @
ac20bae8
...
...
@@ -206,4 +206,28 @@
where
id = #{id}
</select>
<select
id=
"listBooklistIdByGradeLabelAndClickCount"
parameterType=
"map"
resultType=
"long"
>
SELECT
a.target_id
FROM
applet_resource_apply a
LEFT JOIN applet_link_click c ON a.target_id = c.booklist_id
AND c.type_id = 5
AND c.create_date >= #{startDate}
LEFT JOIN applet_outer_booklist b ON a.target_id = b.id
WHERE
a.crowd_type = #{crowdType}
AND a.target_type = "BOOKLIST"
AND a.target_id > 0
AND b.is_show_home = 1
AND b.is_delete = 0
GROUP BY
a.target_id
ORDER BY
COUNT(c.id) DESC,
c.create_time DESC,
a.target_id DESC
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/applet/AppletRecordDayServe.Mapper.xml
View file @
ac20bae8
...
...
@@ -158,8 +158,11 @@
`applet_record_day_serve`
WHERE
is_delete = 0
<if
test=
"wechatUserId != null"
>
and wechat_user_id = #{wechatUserId}
<if
test=
"wechatUserIds != null"
>
and wechat_user_id IN
<foreach
collection=
"wechatUserIds"
separator=
","
open=
"("
close=
")"
index=
"index"
item=
"wechatUserId"
>
${wechatUserId}
</foreach>
</if>
<if
test=
"date != null"
>
and create_date = #{date}
...
...
@@ -229,7 +232,10 @@
FROM
applet_record_day_serve
WHERE
wechat_user_id = #{wechatUserId}
wechat_user_id IN
<foreach
collection=
"wechatUserIds"
separator=
","
open=
"("
close=
")"
index=
"index"
item=
"item"
>
#{item}
</foreach>
AND
create_date
>
DATE_SUB(curdate(),INTERVAL 30 day)
AND
...
...
pcloud-service-book/src/main/resources/mapper/applet/AppletRecordServe.Mapper.xml
View file @
ac20bae8
...
...
@@ -159,8 +159,11 @@
`applet_record_serve`
WHERE
is_delete = 0
<if
test=
"wechatUserId != null"
>
and wechat_user_id = #{wechatUserId}
<if
test=
"wechatUserIds != null"
>
and wechat_user_id IN
<foreach
collection=
"wechatUserIds"
separator=
","
open=
"("
close=
")"
index=
"index"
item=
"wechatUserId"
>
${wechatUserId}
</foreach>
</if>
<if
test=
"recordTypes != null"
>
and record_type in
...
...
@@ -228,7 +231,10 @@
FROM
applet_record_serve
WHERE
wechat_user_id = #{wechatUserId}
wechat_user_id IN
<foreach
collection=
"wechatUserIds"
item=
"item"
index=
"index"
close=
")"
open=
"("
separator=
","
>
#{item}
</foreach>
and
CASE
WHEN record_type in (1,5,6) THEN
...
...
pcloud-service-book/src/main/resources/mapper/applet/AppletRecordSevenDayDao.xml
0 → 100644
View file @
ac20bae8
<?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.applet.dao.impl.AppletRecordSevenDayDaoImpl"
>
<resultMap
type=
"com.pcloud.book.applet.entity.AppletRecordSevenDay"
id=
"AppletRecordSevenDayMap"
>
<result
property=
"id"
column=
"id"
jdbcType=
"INTEGER"
/>
<result
property=
"recordType"
column=
"record_type"
jdbcType=
"INTEGER"
/>
<result
property=
"fromId"
column=
"from_id"
jdbcType=
"INTEGER"
/>
<result
property=
"fromName"
column=
"from_name"
jdbcType=
"VARCHAR"
/>
<result
property=
"typeCode"
column=
"type_code"
jdbcType=
"VARCHAR"
/>
<result
property=
"linkUrl"
column=
"link_url"
jdbcType=
"VARCHAR"
/>
<result
property=
"proLabelId"
column=
"pro_label_id"
jdbcType=
"INTEGER"
/>
<result
property=
"depLabelId"
column=
"dep_label_id"
jdbcType=
"INTEGER"
/>
<result
property=
"purLabelId"
column=
"pur_label_id"
jdbcType=
"INTEGER"
/>
<result
property=
"clickCount"
column=
"click_count"
jdbcType=
"INTEGER"
/>
<result
property=
"userCount"
column=
"user_count"
jdbcType=
"INTEGER"
/>
<result
property=
"sourceType"
column=
"source_type"
jdbcType=
"INTEGER"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<!--查询单个-->
<select
id=
"getById"
resultMap=
"AppletRecordSevenDayMap"
>
select
id, record_type, from_id, from_name, type_code, link_url, pro_label_id, dep_label_id, pur_label_id,click_count, user_count, source_type, create_time
from book.applet_record_seven_day
where id = #{id}
</select>
<!--新增所有列-->
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into book.applet_record_seven_day(record_type, from_id, from_name, type_code, link_url, pro_label_id, dep_label_id, pur_label_id, click_count, user_count, source_type, create_time)
values (#{recordType}, #{fromId}, #{fromName}, #{typeCode}, #{linkUrl}, #{proLabelId}, #{depLabelId}, #{purLabelId}, #{clickCount}, #{userCount}, #{sourceType},now())
</insert>
<insert
id=
"batchInsert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into book.applet_record_seven_day(record_type, from_id, from_name,
type_code, link_url, pro_label_id, dep_label_id,
pur_label_id, click_count, user_count, source_type, create_time)
values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(#{item.recordType}, #{item.fromId}, #{item.fromName},
#{item.typeCode}, #{item.linkUrl}, #{item.proLabelId}, #{item.depLabelId},
#{item.purLabelId}, #{item.clickCount}, #{item.userCount}, #{item.sourceType}, now())
</foreach>
</insert>
<!--通过主键修改数据-->
<update
id=
"update"
>
update book.applet_record_seven_day
<set>
<if
test=
"recordType != null"
>
record_type = #{recordType},
</if>
<if
test=
"fromId != null"
>
from_id = #{fromId},
</if>
<if
test=
"fromName != null and fromName != ''"
>
from_name = #{fromName},
</if>
<if
test=
"typeCode != null and typeCode != ''"
>
type_code = #{typeCode},
</if>
<if
test=
"linkUrl != null and linkUrl != ''"
>
link_url = #{linkUrl},
</if>
<if
test=
"proLabelId != null"
>
pro_label_id = #{proLabelId},
</if>
<if
test=
"depLabelId != null"
>
dep_label_id = #{depLabelId},
</if>
<if
test=
"purLabelId != null"
>
pur_label_id = #{purLabelId},
</if>
<if
test=
"userCount != null"
>
user_count = #{userCount},
</if>
<if
test=
"sourceType != null"
>
source_type = #{sourceType},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete
id=
"deleteById"
>
delete from book.applet_record_seven_day where id = #{id}
</delete>
<delete
id=
"deleteBySourceType"
parameterType=
"integer"
>
delete from book.applet_record_seven_day where source_type = #{sourceType}
</delete>
<select
id=
"getResourceByGrade4H5"
parameterType=
"map"
resultType=
"com.pcloud.book.applet.dto.AppletRecordDTO"
>
SELECT
a.record_type recordType,
a.from_id fromId,
a.from_name fromName,
a.link_url linkUrl,
a.type_code typeCode,
a.click_count clickCount,
a.user_count userCount
FROM
applet_record_seven_day a
INNER JOIN resource_page_grade_label g ON a.dep_label_id = g.dep_label_id
WHERE
a.source_type = #{sourceType}
<if
test=
"gradeLabelIds != null and gradeLabelIds.size>0"
>
AND g.user_grade_label_id IN
<foreach
collection=
"gradeLabelIds"
separator=
","
index=
"index"
item=
"item"
close=
")"
open=
"("
>
${item}
</foreach>
</if>
GROUP BY
a.record_type,
a.from_id
ORDER BY
a.click_count DESC
<if
test=
"limit != null"
>
limit #{limit}
</if>
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/applet/AppletResourceApplyDao.xml
0 → 100644
View file @
ac20bae8
<?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.applet.dao.impl.AppletResourceApplyDaoImpl"
>
<resultMap
type=
"com.pcloud.book.applet.entity.AppletResourceApply"
id=
"AppletResourceApplyMap"
>
<result
property=
"id"
column=
"id"
jdbcType=
"INTEGER"
/>
<result
property=
"targetId"
column=
"target_id"
jdbcType=
"INTEGER"
/>
<result
property=
"targetType"
column=
"target_type"
jdbcType=
"VARCHAR"
/>
<result
property=
"crowdType"
column=
"crowd_type"
jdbcType=
"INTEGER"
/>
<result
property=
"contentType"
column=
"content_type"
jdbcType=
"INTEGER"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<!--查询单个-->
<select
id=
"getById"
resultMap=
"AppletResourceApplyMap"
>
select
id, target_id, target_type, crowd_type, content_type, create_time
from book.applet_resource_apply
where id = #{id}
</select>
<!--新增所有列-->
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into book.applet_resource_apply(target_id, target_type, crowd_type, content_type, create_time)
values (#{targetId}, #{targetType}, #{crowdType}, #{contentType}, now())
</insert>
<insert
id=
"batchInsert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into book.applet_resource_apply(target_id, target_type, crowd_type, content_type, create_time)
values
<foreach
collection=
"list"
separator=
","
index=
"index"
item=
"item"
>
(#{item.targetId}, #{item.targetType}, #{item.crowdType}, #{item.contentType}, now())
</foreach>
</insert>
<!--通过主键修改数据-->
<update
id=
"update"
>
update book.applet_resource_apply
<set>
<if
test=
"targetId != null"
>
target_id = #{targetId},
</if>
<if
test=
"targetType != null and targetType != ''"
>
target_type = #{targetType},
</if>
<if
test=
"crowdType != null"
>
crowd_type = #{crowdType},
</if>
<if
test=
"contentType != null"
>
content_type = #{contentType},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete
id=
"deleteById"
>
delete from book.applet_resource_apply where id = #{id}
</delete>
<delete
id=
"deleteCrowdType"
parameterType=
"map"
>
delete from book.applet_resource_apply
where
target_id = #{targetId}
and target_type = #{targetType}
and crowd_type>0
</delete>
<delete
id=
"deleteContentType"
parameterType=
"map"
>
delete from book.applet_resource_apply
where
target_id = #{targetId}
and target_type = #{targetType}
and content_type>0
</delete>
<select
id=
"getCrowdTypeList"
parameterType=
"map"
resultType=
"integer"
>
SELECT DISTINCT
crowd_type
FROM
applet_resource_apply
WHERE
target_id = #{targetId}
AND target_type = #{targetType}
AND crowd_type > 0
</select>
<select
id=
"getContentTypeList"
parameterType=
"map"
resultType=
"integer"
>
SELECT DISTINCT
content_type
FROM
applet_resource_apply
WHERE
target_id = #{targetId}
AND target_type = #{targetType}
AND content_type > 0
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/applet/AppletThirdResources.xml
View file @
ac20bae8
...
...
@@ -303,5 +303,25 @@
delete from applet_third_resources where id=#{id}
</delete>
<select
id=
"listResourceIdByGradeLabelAndClickCount"
parameterType=
"map"
resultType=
"long"
>
SELECT
a.target_id
FROM
applet_resource_apply a
INNER JOIN applet_third_resources r ON a.target_id = r.id
LEFT JOIN applet_thirdresources_click_record c ON a.target_id = c.third_resources_id
AND c.create_time > #{startDate}
WHERE
a.crowd_type = #{crowdType}
AND a.target_type = "THIRD_RESOURCE"
AND a.target_id > 0
GROUP BY
a.target_id
ORDER BY
COUNT(c.id) DESC,
c.create_time DESC,
a.target_id DESC
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/applet/AppletThirdResourcesClickMapper.xml
View file @
ac20bae8
...
...
@@ -11,6 +11,7 @@
<result
property=
"recordType"
column=
"record_type"
jdbcType=
"INTEGER"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"updateTime"
column=
"update_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"officialAccountsId"
column=
"official_accounts_id"
jdbcType=
"INTEGER"
/>
</resultMap>
<!--新增所有列-->
...
...
@@ -29,7 +30,8 @@
page,
rights_setting_classify_id,
news_id,
gift_package_id
gift_package_id,
official_accounts_id
)
values (
#{wechatUserId},
...
...
@@ -45,7 +47,8 @@
#{page},
#{rightsSettingClassifyId},
#{newsId},
#{giftPackageId}
#{giftPackageId},
#{officialAccountsId}
)
</insert>
...
...
pcloud-service-book/src/main/resources/mapper/applet/AppletUserBookcase.xml
View file @
ac20bae8
...
...
@@ -11,10 +11,11 @@
<result
column=
"read_type"
property=
"readType"
jdbcType=
"TINYINT"
/>
<result
column=
"rights_setting_id"
property=
"rightsSettingId"
jdbcType=
"BIGINT"
/>
<result
column=
"book_group_id"
property=
"bookGroupId"
jdbcType=
"BIGINT"
/>
<result
column=
"official_accounts_id"
property=
"officialAccountsId"
jdbcType=
"BIGINT"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, wechat_user_id, book_id, channel_id, adviser_id, create_time,read_type, rights_setting_id
id, wechat_user_id, book_id, channel_id, adviser_id, create_time,read_type, rights_setting_id
, official_accounts_id
</sql>
...
...
@@ -24,10 +25,10 @@
<insert
id=
"insert"
parameterType=
"com.pcloud.book.applet.entity.AppletUserBookcase"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into applet_user_bookcase (
wechat_user_id, book_id, channel_id, adviser_id, create_time, read_type, rights_setting_id
wechat_user_id, book_id, channel_id, adviser_id, create_time, read_type, rights_setting_id
, official_accounts_id
)
values (
#{wechatUserId}, #{bookId}, #{channelId}, #{adviserId}, NOW(), #{readType}, #{rightsSettingId}
#{wechatUserId}, #{bookId}, #{channelId}, #{adviserId}, NOW(), #{readType}, #{rightsSettingId}
, #{officialAccountsId}
)
on duplicate key
update
...
...
@@ -37,12 +38,13 @@
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.applet.entity.AppletUserBookcase"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into applet_user_bookcase (
wechat_user_id, book_id, channel_id, adviser_id, create_time, read_type, rights_setting_id
wechat_user_id, book_id, channel_id, adviser_id, create_time, read_type, rights_setting_id
, official_accounts_id
)
values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(
#{item.wechatUserId}, #{item.bookId}, #{item.channelId}, #{item.adviserId}, NOW(), #{item.readType}, #{item.rightsSettingId}
#{item.wechatUserId}, #{item.bookId}, #{item.channelId}, #{item.adviserId}, NOW(), #{item.readType}, #{item.rightsSettingId},
#{item.officialAccountsId}
)
</foreach>
on duplicate key
...
...
@@ -50,7 +52,7 @@
create_time = now()
</insert>
<select
id=
"listByWechatUserId"
parameterType=
"
long
"
resultType=
"com.pcloud.book.applet.dto.AppletUserBookcaseDTO"
>
<select
id=
"listByWechatUserId"
parameterType=
"
map
"
resultType=
"com.pcloud.book.applet.dto.AppletUserBookcaseDTO"
>
SELECT
c.id id,
c.book_id bookId,
...
...
@@ -59,31 +61,36 @@
b.BOOK_NAME bookName,
b.COVER_IMG coverImg,
c.create_time createTime,
b.AUTHOR author,
b.PUBLISH publish,
a.SECOND_TEMPLET_ID secondTempletId,
a.third_TEMPLET_ID thirdTempletId,
a.TEMPLET_ID templetId,
d.join_group_type joinGroupType,
d.id bookGroupId,
b.ISBN isbn,
a.GRA_LABEL_ID gradeLabelId,
b.AUTHOR author,
b.PUBLISH publish,
a.SECOND_TEMPLET_ID secondTempletId,
a.third_TEMPLET_ID thirdTempletId,
a.TEMPLET_ID templetId,
b.ISBN isbn,
a.GRA_LABEL_ID gradeLabelId,
a.SUB_LABEL_ID subjectLabelId,
a.vol_label_id volLabelId,
a.VER_LABEL_ID verLabelId,
a.AREA_LABEL_ID areaLabelId ,
IF(d.join_group_type=1 OR d.related_book_group_id>0,1,0) hasGroup,
r.id rightsSettingId,
r.count rightsSettingCount
FROM applet_user_bookcase c
LEFT JOIN BOOK_ADVISER a ON c.book_id=a.BOOK_ID AND c.adviser_id=a.ADVISER_ID
AND c.channel_id=a.CHANNEL_ID AND a.IS_DELETE = 0
INNER JOIN BOOK b ON c.BOOK_ID = b.BOOK_ID AND b.IS_DELETE = 0
LEFT JOIN book_group d ON d.BOOK_ID = a.BOOK_ID and d.create_user=c.adviser_id and d.channel_id=c.channel_id AND d.IS_DELETE = 0
LEFT JOIN rights_setting r ON c.rights_setting_id = r.id AND d.join_group_type=4 and r.show_state = 1 and r.rights_setting_type = 2
WHERE c.wechat_user_id=#{wechatUserId}
GROUP BY c.book_id,a.ADVISER_ID,c.channel_id
ORDER BY c.create_time DESC, d.id desc
a.VER_LABEL_ID verLabelId,
a.AREA_LABEL_ID areaLabelId
FROM
applet_user_bookcase c
LEFT JOIN BOOK_ADVISER a ON c.book_id = a.BOOK_ID
AND c.adviser_id = a.ADVISER_ID
AND c.channel_id = a.CHANNEL_ID
AND a.IS_DELETE = 0
INNER JOIN BOOK b ON c.BOOK_ID = b.BOOK_ID
AND b.IS_DELETE = 0
WHERE
c.wechat_user_id IN
<foreach
collection=
"wechatUserIdList"
separator=
","
item=
"item"
close=
")"
open=
"("
index=
"index"
>
${item}
</foreach>
GROUP BY
c.book_id,
a.ADVISER_ID,
c.channel_id
ORDER BY
c.create_time DESC
</select>
<insert
id=
"insertClickRecord"
parameterType=
"com.pcloud.book.applet.entity.AppletUserClickRecord"
>
...
...
@@ -161,18 +168,25 @@
LIMIT 1
</select>
<select
id=
"getUserLastRe"
parameterType=
"l
ong
"
resultType=
"com.pcloud.book.applet.dto.UserLastBookReDTO"
>
<select
id=
"getUserLastRe"
parameterType=
"l
ist
"
resultType=
"com.pcloud.book.applet.dto.UserLastBookReDTO"
>
SELECT
t.book_id bookId,
t.adviser_id adviserId,
t.channel_id channelId,
t.read_type readType
p.open_rays openRays
FROM
applet_user_bookcase t
INNER JOIN resource_page p ON t.book_id = p.book_id
AND p.channel_id = t.channel_id
AND p.create_user = t.adviser_id
WHERE
t.channel_id >= 1
AND t.adviser_id >= 1
AND t.wechat_user_id = #{wechatUserId}
AND p.open_rays = 1
AND t.wechat_user_id IN
<foreach
collection=
"list"
separator=
","
item=
"item"
close=
")"
open=
"("
index=
"index"
>
#{item}
</foreach>
ORDER BY
t.create_time DESC
LIMIT 1
...
...
@@ -204,7 +218,10 @@
from
applet_user_bookcase
where
wechat_user_id=#{wechatUserId}
wechat_user_id IN
<foreach
collection=
"wechatUserIdList"
separator=
","
item=
"item"
close=
")"
open=
"("
index=
"index"
>
${item}
</foreach>
AND book_id=#{bookId}
AND channel_id=#{channelId}
AND adviser_id=#{adviserId}
...
...
@@ -226,10 +243,13 @@
create_time DESC, book_group_id desc
</select>
<select
id=
"getBookcaseIdListByUser"
resultType=
"long"
parameterType=
"l
ong
"
>
<select
id=
"getBookcaseIdListByUser"
resultType=
"long"
parameterType=
"l
ist
"
>
SELECT DISTINCT id
FROM applet_user_bookcase
WHERE wechat_user_id = #{wechatUserId}
WHERE wechat_user_id IN
<foreach
collection=
"list"
item=
"item"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{item}
</foreach>
</select>
<update
id=
"updateRightsSettingId"
parameterType=
"com.pcloud.book.applet.entity.AppletUserBookcase"
>
...
...
pcloud-service-book/src/main/resources/mapper/applet/ServeCollect.Mapper.xml
View file @
ac20bae8
...
...
@@ -52,12 +52,15 @@
WHERE id = #{id}
</select>
<select
id=
"getList"
resultMap=
"BaseResultMap"
>
<select
id=
"getList"
resultMap=
"BaseResultMap"
parameterType=
"map"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM serve_collect
where
wechat_user_id = #{wechatUserId}
wechat_user_id IN
<foreach
collection=
"wechatUserIds"
separator=
","
item=
"item"
open=
"("
close=
")"
index=
"index"
>
${item}
</foreach>
<if
test=
"typeCode != null"
>
and serve_type_code = #{typeCode}
</if>
...
...
@@ -242,7 +245,7 @@
</where>
</select>
<select
id=
"getAllCollect"
parameterType=
"
list
"
resultType=
"long"
>
<select
id=
"getAllCollect"
parameterType=
"
map
"
resultType=
"long"
>
select
id
from
...
...
@@ -253,7 +256,10 @@
and serve_type_code =#{typeCode}
</if>
and
wechat_user_id = #{wechatUserId}
wechat_user_id in
<foreach
collection=
"wechatUserIds"
separator=
","
close=
")"
open=
"("
index=
"index"
item=
"item"
>
#{item}
</foreach>
order by update_time desc
</select>
...
...
@@ -276,7 +282,7 @@
</where>
</select>
<select
id=
"getTypeNameAndCountByWechatId"
parameterType=
"l
ong
"
resultType=
"com.pcloud.book.applet.dto.CollectionTypeNameAndCountDTO"
>
<select
id=
"getTypeNameAndCountByWechatId"
parameterType=
"l
ist
"
resultType=
"com.pcloud.book.applet.dto.CollectionTypeNameAndCountDTO"
>
SELECT
serve_type_code as typeCode ,
serve_type_name as typeName ,
...
...
@@ -284,7 +290,10 @@
from
serve_collect
where
wechat_user_id = #{wechatUserId}
wechat_user_id in
<foreach
collection=
"list"
separator=
","
item=
"item"
open=
"("
close=
")"
index=
"index"
>
#{item}
</foreach>
and
is_delete = 0
group by
...
...
pcloud-service-book/src/main/resources/mapper/book/BookAdviser.Mapper.xml
View file @
ac20bae8
...
...
@@ -125,7 +125,7 @@
BOOK_ADVISER_ID, BOOK_ID, TEMPLET_ID, CHANNEL_ID, ADVISER_ID, IS_DELETE,
TEMPLET_ID,SECOND_TEMPLET_ID,third_templet_id,
GRA_LABEL_ID,SUB_LABEL_ID,VER_LABEL_ID,AREA_LABEL_ID,is_open_robot_process,vol_label_id,
is_open_catalog
is_open_catalog
, pur_label_id, dep_label_id, pro_label_id
FROM
BOOK_ADVISER
WHERE
...
...
pcloud-service-book/src/main/resources/mapper/group/ResourcePageCollectDao.xml
View file @
ac20bae8
...
...
@@ -8,21 +8,22 @@
<result
property=
"wechatUserId"
column=
"wechat_user_id"
jdbcType=
"INTEGER"
/>
<result
property=
"officialAccountsId"
column=
"official_accounts_id"
jdbcType=
"INTEGER"
/>
<result
property=
"collectState"
column=
"collect_state"
jdbcType=
"INTEGER"
/>
<result
property=
"isNew"
column=
"is_new"
jdbcType=
"INTEGER"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<!--查询单个-->
<select
id=
"getById"
resultMap=
"ResourcePageCollectMap"
>
select
id, resource_page_id, wechat_user_id, official_accounts_id, collect_state, create_time
id, resource_page_id, wechat_user_id, official_accounts_id, collect_state,
is_new,
create_time
from book.resource_page_collect
where id = #{id}
</select>
<!--新增所有列-->
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into book.resource_page_collect(resource_page_id, wechat_user_id, official_accounts_id, collect_state, create_time)
values (#{resourcePageId}, #{wechatUserId}, #{officialAccountsId}, #{collectState}, now())
insert into book.resource_page_collect(resource_page_id, wechat_user_id, official_accounts_id, collect_state,
is_new,
create_time)
values (#{resourcePageId}, #{wechatUserId}, #{officialAccountsId}, #{collectState},
#{isNew},
now())
</insert>
<!--通过主键修改数据-->
...
...
@@ -59,5 +60,15 @@
and collect_state = 1
limit 1
</select>
<select
id=
"getUserIsNotNew"
parameterType=
"long"
resultType=
"integer"
>
select
COUNT(1)
from book.resource_page_collect
where
wechat_user_id = #{wechatUserId}
and is_new = 0
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/group/ResourcePageCourseDao.xml
0 → 100644
View file @
ac20bae8
<?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.group.dao.impl.ResourcePageCourseDaoImpl"
>
<resultMap
type=
"com.pcloud.book.group.entity.ResourcePageCourse"
id=
"ResourcePageCourseMap"
>
<result
property=
"id"
column=
"id"
jdbcType=
"INTEGER"
/>
<result
property=
"serveId"
column=
"serve_id"
jdbcType=
"INTEGER"
/>
<result
property=
"serveName"
column=
"serve_name"
jdbcType=
"VARCHAR"
/>
<result
property=
"serveType"
column=
"serve_type"
jdbcType=
"VARCHAR"
/>
<result
property=
"typeCode"
column=
"type_code"
jdbcType=
"VARCHAR"
/>
<result
property=
"typeName"
column=
"type_name"
jdbcType=
"VARCHAR"
/>
<result
property=
"channelId"
column=
"channel_id"
jdbcType=
"INTEGER"
/>
<result
property=
"agentId"
column=
"agent_id"
jdbcType=
"INTEGER"
/>
<result
property=
"proLabelId"
column=
"pro_label_id"
jdbcType=
"INTEGER"
/>
<result
property=
"depLableId"
column=
"dep_lable_id"
jdbcType=
"INTEGER"
/>
<result
property=
"purLabelId"
column=
"pur_label_id"
jdbcType=
"INTEGER"
/>
<result
property=
"browseCount"
column=
"browse_count"
jdbcType=
"INTEGER"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<!--查询单个-->
<select
id=
"getById"
resultMap=
"ResourcePageCourseMap"
>
select
id, serve_id, serve_name, serve_type, type_code,type_name, channel_id, agent_id, pro_label_id, dep_lable_id, pur_label_id, browse_count, create_time
from book.resource_page_course
where id = #{id}
</select>
<!--新增所有列-->
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into book.resource_page_course(serve_id, serve_name, serve_type, type_code, type_name, channel_id,
agent_id, pro_label_id, dep_lable_id, pur_label_id, browse_count, create_time)
values (#{serveId}, #{serveName}, #{serveType}, #{typeCode}, #{typeName}, #{channelId},
#{agentId}, #{proLabelId}, #{depLableId}, #{purLabelId}, #{browseCount}, now())
</insert>
<insert
id=
"batchInsert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into book.resource_page_course(serve_id, serve_name, serve_type, type_code, type_name,
channel_id, agent_id, pro_label_id, dep_lable_id, pur_label_id, browse_count, create_time)
values
<foreach
collection=
"list"
item=
"item"
separator=
","
>
(#{item.serveId}, #{item.serveName}, #{item.serveType}, #{item.typeCode},#{item.typeName},
#{item.channelId}, #{item.agentId}, #{item.proLabelId}, #{item.depLableId}, #{item.purLabelId},
#{item.browseCount}, NOW())
</foreach>
</insert>
<delete
id=
"deleteAll"
>
delete from book.resource_page_course where id >0
</delete>
<!--通过主键修改数据-->
<update
id=
"update"
>
update book.resource_page_course
<set>
<if
test=
"serveId != null"
>
serve_id = #{serveId},
</if>
<if
test=
"serveName != null and serveName != ''"
>
serve_name = #{serveName},
</if>
<if
test=
"serveType != null and serveType != ''"
>
serve_type = #{serveType},
</if>
<if
test=
"typeCode != null and typeCode != ''"
>
type_code = #{typeCode},
</if>
<if
test=
"channelId != null"
>
channel_id = #{channelId},
</if>
<if
test=
"agentId != null"
>
agent_id = #{agentId},
</if>
<if
test=
"proLabelId != null"
>
pro_label_id = #{proLabelId},
</if>
<if
test=
"depLableId != null"
>
dep_lable_id = #{depLableId},
</if>
<if
test=
"purLabelId != null"
>
pur_label_id = #{purLabelId},
</if>
<if
test=
"browseCount != null"
>
browse_count = #{browseCount},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete
id=
"deleteById"
>
delete from book.resource_page_course where id = #{id}
</delete>
<select
id=
"listCourseByGradeLabelId"
resultType=
"com.pcloud.book.group.dto.ResourcePageCourseDTO"
parameterType=
"map"
>
SELECT
c.serve_id serveId,
c.serve_name serveName,
c.serve_type serveType,
c.type_code typeCode,
c.channel_id channelId,
c.type_name typeName
FROM
resource_page_course c
INNER JOIN resource_page_grade_label g ON c.dep_lable_id = g.dep_label_id
WHERE
g.user_grade_label_id = #{userGradeLabelId}
GROUP BY
c.serve_id
ORDER BY
c.browse_count DESC
</select>
<select
id=
"getGradeByGradeLabelId"
resultType=
"long"
parameterType=
"long"
>
SELECT
user_grade_label_id
FROM
resource_page_grade_label
WHERE
gra_label_id = #{graLabelId}
LIMIT 1
</select>
<select
id=
"getGradeByDepLabelId"
parameterType=
"long"
resultType=
"long"
>
SELECT
user_grade_label_id
FROM
resource_page_grade_label
WHERE
dep_label_id = #{depLabelId}
LIMIT 1
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/group/ResourcePageDao.xml
View file @
ac20bae8
...
...
@@ -15,12 +15,18 @@
<result
property=
"sceneId"
column=
"scene_id"
jdbcType=
"INTEGER"
/>
<result
property=
"officialSceneId"
column=
"official_scene_id"
jdbcType=
"INTEGER"
/>
<result
property=
"bookCover"
column=
"book_cover"
jdbcType=
"VARCHAR"
/>
<result
property=
"bookId"
column=
"book_id"
jdbcType=
"INTEGER"
/>
<result
property=
"channelId"
column=
"channel_id"
jdbcType=
"INTEGER"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, book_group_id, style, show_book, open_rays, create_time, update_time, create_user, qrcode_url, scene_id, official_scene_id, book_id, channel_id
</sql>
<!--查询单个-->
<select
id=
"getById"
resultMap=
"ResourcePageMap"
>
select
id, book_group_id, style, show_book, open_rays, create_time, update_time, create_user, qrcode_url, scene_id, official_scene_id, book_cover
id, book_group_id, style, show_book, open_rays, create_time, update_time, create_user, qrcode_url, scene_id, official_scene_id, book_cover
, book_id, channel_id
from book.resource_page
where id = #{id}
</select>
...
...
@@ -29,8 +35,9 @@
<!--新增所有列-->
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into book.resource_page(book_group_id, style, show_book, open_rays, create_time, update_time, create_user,
qrcode_url, scene_id, book_cover)
values (#{bookGroupId}, #{style}, #{showBook}, #{openRays}, now(), now(), #{createUser}, #{qrcodeUrl}, #{sceneId}, #{bookCover})
qrcode_url, scene_id, book_cover, book_id, channel_id)
values (#{bookGroupId}, #{style}, #{showBook}, #{openRays}, now(), now(), #{createUser}, #{qrcodeUrl}, #{sceneId}, #{bookCover},
#{bookId}, #{channelId})
</insert>
<!--通过主键修改数据-->
...
...
@@ -68,55 +75,36 @@
<select
id=
"getByBookGroupId"
parameterType=
"long"
resultMap=
"ResourcePageMap"
>
select
id, book_group_id, style, show_book, open_rays, qrcode_url, official_scene_id, book_cover
from book.resource_page
id, book_group_id, style, show_book, open_rays, qrcode_url, official_scene_id, book_cover, book_id, channel_id, create_user
where book_group_id = #{bookGroupId}
limit 1
</select>
<select
id=
"getByBookId"
parameterType=
"map"
resultMap=
"ResourcePageMap"
>
SELECT
p.id,
p.book_group_id,
p.style,
p.show_book,
p.book_cover,
p.open_rays
p.id,
p.book_group_id,
p.style,
p.show_book,
p.book_cover,
p.open_rays,
p.scene_id
FROM
resource_page p
INNER JOIN book_group g ON p.book_group_id = g.id and g.is_delete = 0
AND g.join_group_type = 4
resource_page p
WHERE
g
.book_id = #{bookId}
<if
test=
"channelId != null"
>
AND g
.channel_id = #{channelId}
</if>
<if
test=
"adviserId != null"
>
AND g
.create_user = #{adviserId}
</if>
p
.book_id = #{bookId}
<if
test=
"channelId != null"
>
AND p
.channel_id = #{channelId}
</if>
<if
test=
"adviserId != null"
>
AND p
.create_user = #{adviserId}
</if>
ORDER BY
p.open_rays DESC, p.book_group_id desc
p.open_rays DESC,
p.create_time DESC
LIMIT 1
</select>
<update
id=
"setRaysCloseByBook"
parameterType=
"map"
>
UPDATE resource_page
SET open_rays = 0
WHERE
book_group_id IN (
SELECT
id
FROM
book_group
WHERE
book_id = #{bookId}
AND create_user = #{adviserId}
AND channel_id = #{channelId}
AND join_group_type = 4
AND id != #{bookGroupId}
)
</update>
<update
id=
"updatePageUpdateTime"
parameterType=
"long"
>
update book.resource_page
SET update_time = NOW()
...
...
@@ -125,7 +113,7 @@
<select
id=
"getBySceneId"
parameterType=
"long"
resultMap=
"ResourcePageMap"
>
select
id, book_group_id, style, show_book, open_rays, qrcode_url, scene_id, official_scene_id, book_cover
id, book_group_id, style, show_book, open_rays, qrcode_url, scene_id, official_scene_id, book_cover
,book_id, channel_id, create_user
from book.resource_page
where scene_id = #{sceneId}
limit 1
...
...
@@ -152,16 +140,6 @@
</foreach>
</select>
<update
id=
"setRaysCloseBySceneIds"
parameterType=
"list"
>
UPDATE
resource_page
SET open_rays = 0
WHERE scene_id IN
<foreach
collection=
"list"
item=
"item"
open=
"("
close=
")"
separator=
","
index=
"index"
>
#{item}
</foreach>
</update>
<update
id=
"batchUpdateSceneIdByBookGroup"
parameterType=
"list"
>
update book.resource_page set scene_id =
<foreach
collection=
"list"
open=
"CASE"
separator=
" "
close=
"END"
item=
"item"
>
...
...
@@ -202,4 +180,41 @@
AND a.serve_id = #{resourceId}
</select>
<update
id=
"updateBookBySceneIds"
parameterType=
"map"
>
UPDATE resource_page
SET book_id = #{bookId},
channel_id = #{channelId}
WHERE
scene_id IN
<foreach
collection=
"sceneIds"
close=
")"
open=
"("
separator=
","
index=
"index"
item=
"item"
>
#{item}
</foreach>
</update>
<update
id=
"setOtherPageRaysClose"
parameterType=
"map"
>
UPDATE resource_page
SET open_rays = 0
WHERE
book_id = #{bookId}
AND channel_id = #{channelId}
AND create_user = #{createUser}
<if
test=
"sceneId != null"
>
AND scene_id != #{sceneId}
</if>
<if
test=
"bookGroupId != null"
>
AND book_group_id != #{bookGroupId}
</if>
</update>
<select
id=
"isOpenRaysBook"
resultType=
"boolean"
parameterType=
"map"
>
SELECT
COUNT(1)
FROM
resource_page
WHERE
book_id = #{bookId}
AND create_user = #{adviserId}
AND channel_id = #{channelId}
AND open_rays = 1
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/group/ResourcePageItemDao.xml
View file @
ac20bae8
...
...
@@ -124,7 +124,8 @@
FROM
resource_page_item
WHERE
resource_page_id = #{resourcePageId}
serve_type IN ("APP", "PRODUCT")
AND resource_page_id = #{resourcePageId}
</select>
<select
id=
"getServeListByBookGroupId"
parameterType=
"long"
resultType=
"com.pcloud.book.group.entity.BookGroupServe"
>
...
...
@@ -215,4 +216,45 @@
<delete
id=
"deleteByServeId"
parameterType=
"long"
>
delete from book.resource_page_item where serve_id = #{resourceId} and serve_type="PRODUCT"
</delete>
<select
id=
"getAppServeByPage"
resultType=
"com.pcloud.book.group.dto.BookServeDTO"
parameterType=
"map"
>
SELECT
i.serve_id serveId,
i.serve_type serveType,
i.link_url url,
i.type_code fromType
FROM
resource_page_item i
WHERE
i.serve_type IN ("APP", "PRODUCT")
AND i.resource_page_id = #{resourcePageId}
</select>
<select
id=
"getServeUrl4Update"
parameterType=
"list"
resultType=
"com.pcloud.book.group.dto.ResourcePageUrlDTO"
>
SELECT
p.scene_id sceneId,
i.link_url linkUrl,
i.id
FROM
resource_page_item i
LEFT JOIN resource_page p ON p.id = i.resource_page_id
WHERE
p.scene_id IN
<foreach
collection=
"list"
item=
"item"
close=
")"
open=
"("
separator=
","
index=
"index"
>
#{item}
</foreach>
AND i.serve_type IN ("APP", "PRODUCT")
AND i.link_url NOT LIKE CONCAT("%", p.scene_id, "%")
</select>
<update
id=
"batchUpdateServeUrlById"
parameterType=
"list"
>
update book.resource_page_item set link_url =
<foreach
collection=
"list"
open=
"CASE"
separator=
" "
close=
"END"
item=
"item"
>
WHEN id = #{item.id} THEN #{item.linkUrl}
</foreach>
where id IN
<foreach
collection=
"list"
item=
"item"
close=
")"
separator=
","
open=
"("
>
${item.id}
</foreach>
</update>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/group/ResourcePageToolDao.xml
0 → 100644
View file @
ac20bae8
<?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.group.dao.impl.ResourcePageToolDaoImpl"
>
<resultMap
type=
"com.pcloud.book.group.entity.ResourcePageTool"
id=
"ResourcePageToolMap"
>
<result
property=
"id"
column=
"id"
jdbcType=
"INTEGER"
/>
<result
property=
"userGradeLabelId"
column=
"user_grade_label_id"
jdbcType=
"INTEGER"
/>
<result
property=
"toolType"
column=
"tool_type"
jdbcType=
"INTEGER"
/>
<result
property=
"toolName"
column=
"tool_name"
jdbcType=
"VARCHAR"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"updateTime"
column=
"update_time"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, user_grade_label_id, tool_type, tool_name
</sql>
<!--查询单个-->
<select
id=
"getById"
resultMap=
"ResourcePageToolMap"
>
select
id, user_grade_label_id, tool_type, tool_name, create_time, update_time
from book.resource_page_tool
where id = #{id}
</select>
<!--新增所有列-->
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into book.resource_page_tool(user_grade_label_id, tool_type, tool_name, create_time, update_time)
values (#{userGradeLabelId}, #{toolType}, #{toolName}, now(), now())
</insert>
<!--通过主键修改数据-->
<update
id=
"update"
>
update book.resource_page_tool
<set>
<if
test=
"userGradeLabelId != null"
>
user_grade_label_id = #{userGradeLabelId},
</if>
<if
test=
"toolType != null"
>
tool_type = #{toolType},
</if>
<if
test=
"toolName != null and toolName != ''"
>
tool_name = #{toolName},
</if>
update_time = now(),
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete
id=
"deleteById"
>
delete from book.resource_page_tool where id = #{id}
</delete>
<select
id=
"getByUserLabel"
parameterType=
"long"
resultMap=
"ResourcePageToolMap"
>
SELECT
id,
user_grade_label_id,
tool_type,
tool_name
FROM
resource_page_tool
WHERE
user_grade_label_id = #{userGradeLabelId}
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/group/WeworkTeacherMapper.xml
View file @
ac20bae8
...
...
@@ -295,4 +295,61 @@
</foreach>
</select>
<select
id=
"getWxworkTeacherById"
parameterType=
"long"
resultType=
"com.pcloud.book.group.vo.WeworkTeacherVO"
>
select
id AS id,
qrcode AS qrcode,
real_name AS realName,
nickname,
avatar,
`desc`,
title AS title,
teacher_type AS teacherType,
is_open AS isOpen,
material_url AS materialUrl,
create_time AS createTime,
update_time AS updateTime
from wework_teacher
WHERE id = #{id}
</select>
<select
id=
"getTeacherByGradeLabel"
parameterType=
"map"
resultType=
"com.pcloud.book.group.vo.WeworkTeacherVO"
>
SELECT
c.id,
c.qrcode,
c.real_name AS realName,
c.nickname,
c.avatar,
c.`desc`,
c.title AS title,
c.material_url AS materialUrl
FROM
applet_resource_apply a
LEFT JOIN wework_teacher c ON a.target_id = c.id
WHERE
a.crowd_type = #{crowdType}
AND a.target_type = "TEACHER"
AND a.target_id > 0
AND c.is_open = 1
GROUP BY
a.target_id
ORDER BY
c.create_time DESC
limit #{offset}, #{limit}
</select>
<select
id=
"countTeacherByGradeLabel"
parameterType=
"integer"
resultType=
"integer"
>
SELECT
COUNT(DISTINCT a.target_id)
FROM
applet_resource_apply a
LEFT JOIN wework_teacher c ON a.target_id = c.id
WHERE
a.crowd_type = #{crowdType}
AND a.target_type = "TEACHER"
AND a.target_id > 0
AND c.is_open = 1
</select>
</mapper>
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