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
2daed7f2
Commit
2daed7f2
authored
Mar 18, 2022
by
田超
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
ssh://begitlab.chubanyun.me:12122/rays/pcloud-book
into feature/110
parents
7249061b
a58ba714
Hide whitespace changes
Inline
Side-by-side
Showing
38 changed files
with
767 additions
and
168 deletions
+767
-168
BookConstant.java
...main/java/com/pcloud/book/book/constant/BookConstant.java
+12
-0
BookService.java
...c/main/java/com/pcloud/book/book/service/BookService.java
+5
-0
AppletRecordBiz.java
...main/java/com/pcloud/book/applet/biz/AppletRecordBiz.java
+1
-1
AppletRecordAggrStatisBizImpl.java
...d/book/applet/biz/impl/AppletRecordAggrStatisBizImpl.java
+3
-3
AppletRecordBizImpl.java
.../com/pcloud/book/applet/biz/impl/AppletRecordBizImpl.java
+32
-11
BookAdviserBiz.java
...rc/main/java/com/pcloud/book/book/biz/BookAdviserBiz.java
+2
-0
BookBiz.java
...-book/src/main/java/com/pcloud/book/book/biz/BookBiz.java
+7
-0
BookAdviserBizImpl.java
...ava/com/pcloud/book/book/biz/impl/BookAdviserBizImpl.java
+6
-0
BookBizImpl.java
.../main/java/com/pcloud/book/book/biz/impl/BookBizImpl.java
+12
-5
BookCache.java
...k/src/main/java/com/pcloud/book/book/cache/BookCache.java
+19
-1
BookAdviserDao.java
...rc/main/java/com/pcloud/book/book/dao/BookAdviserDao.java
+2
-0
BookAdviserDaoImpl.java
...ava/com/pcloud/book/book/dao/impl/BookAdviserDaoImpl.java
+9
-0
BookAdviserServiceImpl.java
...pcloud/book/book/service/impl/BookAdviserServiceImpl.java
+1
-5
BookServiceImpl.java
...va/com/pcloud/book/book/service/impl/BookServiceImpl.java
+8
-0
AppConsr.java
.../src/main/java/com/pcloud/book/consumer/app/AppConsr.java
+12
-0
ProductConsr.java
.../java/com/pcloud/book/consumer/resource/ProductConsr.java
+46
-0
TradeConsr.java
.../main/java/com/pcloud/book/consumer/trade/TradeConsr.java
+36
-0
BookAuthUserBizImpl.java
...m/pcloud/book/copyright/biz/impl/BookAuthUserBizImpl.java
+7
-27
ResourcePageBiz.java
.../main/java/com/pcloud/book/group/biz/ResourcePageBiz.java
+8
-1
ResourcePageBizImpl.java
...a/com/pcloud/book/group/biz/impl/ResourcePageBizImpl.java
+342
-110
ResourcePageBookstoreBizImpl.java
...oud/book/group/biz/impl/ResourcePageBookstoreBizImpl.java
+3
-0
BookAppletSceneDao.java
...in/java/com/pcloud/book/group/dao/BookAppletSceneDao.java
+4
-0
ResourcePageCollectDao.java
...ava/com/pcloud/book/group/dao/ResourcePageCollectDao.java
+3
-0
ResourcePageColumnDao.java
...java/com/pcloud/book/group/dao/ResourcePageColumnDao.java
+3
-1
ResourcePageDao.java
.../main/java/com/pcloud/book/group/dao/ResourcePageDao.java
+4
-0
BookAppletSceneDaoImpl.java
...om/pcloud/book/group/dao/impl/BookAppletSceneDaoImpl.java
+10
-0
ResourcePageCollectDaoImpl.java
...cloud/book/group/dao/impl/ResourcePageCollectDaoImpl.java
+8
-0
ResourcePageColumnDaoImpl.java
...pcloud/book/group/dao/impl/ResourcePageColumnDaoImpl.java
+10
-1
ResourcePageDaoImpl.java
...a/com/pcloud/book/group/dao/impl/ResourcePageDaoImpl.java
+10
-0
ResourcePageFacade.java
...com/pcloud/book/group/facade/impl/ResourcePageFacade.java
+34
-1
CommonUtils.java
...rc/main/java/com/pcloud/book/util/common/CommonUtils.java
+19
-0
ThreadPoolUtils.java
...ain/java/com/pcloud/book/util/common/ThreadPoolUtils.java
+2
-1
BookProps.java
.../main/java/com/pcloud/book/util/properties/BookProps.java
+12
-0
BookAdviser.Mapper.xml
...ook/src/main/resources/mapper/book/BookAdviser.Mapper.xml
+14
-0
BookAppletScene.xml
...-book/src/main/resources/mapper/group/BookAppletScene.xml
+19
-0
ResourcePageCollectDao.xml
...rc/main/resources/mapper/group/ResourcePageCollectDao.xml
+11
-0
ResourcePageColumnDao.xml
...src/main/resources/mapper/group/ResourcePageColumnDao.xml
+15
-0
ResourcePageDao.xml
...-book/src/main/resources/mapper/group/ResourcePageDao.xml
+16
-0
No files found.
pcloud-facade-book/src/main/java/com/pcloud/book/book/constant/BookConstant.java
View file @
2daed7f2
...
...
@@ -474,4 +474,16 @@ public class BookConstant {
* 手机号授权
*/
public
static
final
String
BOOK_PHONE_AUTH_CACHE_KEY
=
CacheConstant
.
BOOK
+
"getBookPhoneAuth:"
;
/**
* 编辑默认渠道缓存
*/
public
static
final
String
ADVISER_DEFAULT_CHANNEL_ID_CACHE
=
CacheConstant
.
BOOK
+
"adviserDefaultChannelIdCache"
;
/**
* 关注公众号临时二维码
*/
public
static
final
String
PAGE_ID_TEMP_CODE_CACHE
=
CacheConstant
.
BOOK
+
"TEMPCODE"
;
public
static
final
String
PAGE_ID_CODE_CACHE
=
CacheConstant
.
BOOK
+
"PAGECODE"
;
public
static
final
String
PAGE_ID_LOGOURL_CACHE
=
CacheConstant
.
BOOK
+
"LOGOURL"
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/book/service/BookService.java
View file @
2daed7f2
...
...
@@ -317,4 +317,9 @@ public interface BookService {
@ApiOperation
(
"更新昨日修改过的书刊的标签"
)
@GetMapping
(
"updateYesterdayBookNewLabel"
)
void
updateYesterdayBookNewLabel
();
@GetMapping
(
"getBookFromRedis"
)
ResponseEntity
<
ResponseDto
<
BookDto
>>
getBookFromRedis
(
@RequestParam
(
value
=
"bookId"
)
Long
bookId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/AppletRecordBiz.java
View file @
2daed7f2
...
...
@@ -77,7 +77,7 @@ public interface AppletRecordBiz {
*/
Map
<
Long
,
AppletAppOrProductDTO
>
getAppOrProductBrowseCount
(
Integer
recordType
,
List
<
Long
>
serveIds
);
void
fillAppletRecord
(
List
<
AppletRecordDTO
>
recordList
,
Integer
bookType
);
void
fillAppletRecord
(
List
<
AppletRecordDTO
>
recordList
,
Integer
bookType
,
Long
wechatUserId
);
Object
handleAppletRecordTypeCode
(
Long
lastAppletRecordId
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletRecordAggrStatisBizImpl.java
View file @
2daed7f2
...
...
@@ -148,7 +148,7 @@ public class AppletRecordAggrStatisBizImpl implements AppletRecordAggrStatisBiz
aggrStatis
=
appletRecordCHMapper
.
getAggrStatis
(
paramMap
);
}
// 加载其它数据
appletRecordBiz
.
fillAppletRecord
(
aggrStatis
,
YesOrNoNumEnum
.
NO
.
getValue
());
appletRecordBiz
.
fillAppletRecord
(
aggrStatis
,
YesOrNoNumEnum
.
NO
.
getValue
()
,
null
);
// 删除部分不存在的数据
aggrStatis
=
aggrStatis
.
stream
().
filter
(
x
->
x
.
getSourceDelete
()
==
0
).
collect
(
Collectors
.
toList
());
// 设置缓存
...
...
@@ -354,7 +354,7 @@ public class AppletRecordAggrStatisBizImpl implements AppletRecordAggrStatisBiz
//7天内扫码量高的资源的总扫码量
List
<
AppletRecordDTO
>
sourceAggrStatis
=
appletRecordCHMapper
.
getAggrStatis4H5
(
map
);
appletRecordBiz
.
fillAppletRecord
(
sourceAggrStatis
,
YesOrNoNumEnum
.
NO
.
getValue
());
appletRecordBiz
.
fillAppletRecord
(
sourceAggrStatis
,
YesOrNoNumEnum
.
NO
.
getValue
()
,
null
);
sourceAggrStatis
=
sourceAggrStatis
.
stream
().
filter
(
x
->
x
.
getSourceDelete
()
==
0
).
collect
(
Collectors
.
toList
());
if
(
ListUtils
.
isEmpty
(
sourceAggrStatis
))
{
continue
;
...
...
@@ -423,7 +423,7 @@ public class AppletRecordAggrStatisBizImpl implements AppletRecordAggrStatisBiz
if
(
ListUtils
.
isEmpty
(
countList
))
{
return
new
PageBeanNew
(
currentPage
,
numPerPage
,
0
,
Lists
.
newArrayList
());
}
appletRecordBiz
.
fillAppletRecord
(
countList
,
YesOrNoNumEnum
.
NO
.
getValue
());
appletRecordBiz
.
fillAppletRecord
(
countList
,
YesOrNoNumEnum
.
NO
.
getValue
()
,
wechatUserId
);
countList
=
countList
.
stream
().
filter
(
x
->
x
.
getSourceDelete
()
==
0
).
collect
(
Collectors
.
toList
());
dealServeNamePic
(
countList
,
isDefaultList
,
sourceFrom
);
if
(
ListUtils
.
isEmpty
(
countList
))
{
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletRecordBizImpl.java
View file @
2daed7f2
...
...
@@ -50,11 +50,12 @@ import com.pcloud.book.group.tools.SendWeixinRequestTools;
import
com.pcloud.book.rightsSetting.biz.RightsSettingBiz
;
import
com.pcloud.book.skill.biz.PcloudGroupActivityBiz
;
import
com.pcloud.book.applet.dto.GroupActivity4AppletDTO
;
import
com.pcloud.book.
skill.remind.RedisTool
;
import
com.pcloud.book.
util.common.CommonUtils
;
import
com.pcloud.book.util.common.ThreadPoolUtils
;
import
com.pcloud.book.util.properties.BookProps
;
import
com.pcloud.channelcenter.wechat.dto.AccountSettingDto
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.
core.mybatis.cache.redis.RedisCache
;
import
com.pcloud.common.
enums.AppTypeEnum
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
...
...
@@ -62,7 +63,6 @@ import com.pcloud.common.utils.BeanUtils;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.NumberUtil
;
import
com.pcloud.common.utils.cache.redis.JedisClusterUtils
;
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
;
...
...
@@ -73,8 +73,8 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
...
...
@@ -137,6 +137,8 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
private
AppletTrackMapper
appletTrackMapper
;
@Autowired
private
ReaderConsr
readerConsr
;
@Autowired
private
BookProps
bookProps
;
@Override
@ParamLog
(
"通过ID查询单条数据"
)
...
...
@@ -267,7 +269,7 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
}
recordList
=
listAppletRecord
.
getRecordList
();
fillAppletRecord
(
recordList
,
bookType
);
fillAppletRecord
(
recordList
,
bookType
,
wechatUserId
);
return
listAppletRecord
;
}
...
...
@@ -440,7 +442,7 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
}
private
void
fillTypeCode
(
List
<
AppletRecordDTO
>
recordList
)
{
fillAppletRecord
(
recordList
,
YesOrNoNumEnum
.
YES
.
getValue
());
fillAppletRecord
(
recordList
,
YesOrNoNumEnum
.
YES
.
getValue
()
,
null
);
recordList
.
stream
().
forEach
(
appletRecordDTO
->
{
if
(
Objects
.
equals
(
AppletRecordTypeEnum
.
NEWS
.
value
,
appletRecordDTO
.
getRecordType
())
&&
null
!=
appletRecordDTO
.
getAppletNewsDTO
())
{
//填充资讯信息
...
...
@@ -458,7 +460,7 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
}
@Override
public
void
fillAppletRecord
(
List
<
AppletRecordDTO
>
recordList
,
Integer
bookType
)
{
public
void
fillAppletRecord
(
List
<
AppletRecordDTO
>
recordList
,
Integer
bookType
,
Long
wechatUserId
)
{
if
(
ListUtils
.
isEmpty
(
recordList
))
{
return
;
}
...
...
@@ -587,7 +589,7 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
appletRecordDTO
.
setCoverImg
(
Optional
.
ofNullable
(
bookDtoMap
.
get
(
appletRecordDTO
.
getBookId
())).
map
(
BookDto:
:
getCoverImg
).
orElse
(
""
));
}
//填充应用信息
fillApp4Record
(
appDtoMap
,
appDtoMappFuture
,
appletRecordDTO
);
fillApp4Record
(
appDtoMap
,
appDtoMappFuture
,
appletRecordDTO
,
wechatUserId
);
}
else
if
(
Objects
.
equals
(
AppletRecordTypeEnum
.
BOOK
.
value
,
appletRecordDTO
.
getRecordType
()))
{
//填充书籍信息
fillBook4Record
(
appletUserBookcaseDTOMap
,
appletUserBookcaseDTOMapFuture
,
appletRecordDTO
);
...
...
@@ -722,7 +724,7 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
appletRecordDTO
.
setIsDelete
(
appletNewsDTO
.
getIsDelete
());
}
private
void
fillApp4Record
(
Map
<
Long
,
AppDto
>
appDtoMap
,
Future
<
Map
<
Long
,
AppDto
>>
appDtoMappFuture
,
AppletRecordDTO
appletRecordDTO
)
{
private
void
fillApp4Record
(
Map
<
Long
,
AppDto
>
appDtoMap
,
Future
<
Map
<
Long
,
AppDto
>>
appDtoMappFuture
,
AppletRecordDTO
appletRecordDTO
,
Long
wechatUserId
)
{
try
{
appDtoMap
=
appDtoMappFuture
.
get
();
}
catch
(
InterruptedException
|
ExecutionException
e
)
{
...
...
@@ -764,6 +766,25 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
}
appletAppOrProductDTO
.
setServeType
(
AppAndProductTypeEnum
.
APP
.
value
);
appletAppOrProductDTO
.
setServeId
(
appletRecordDTO
.
getFromId
());
//优化跳转
if
(
AppTypeEnum
.
ARTICLE
.
value
.
equals
(
appletAppOrProductDTO
.
getServeTypeCode
()))
{
if
(
appDto
!=
null
&&
!
StringUtil
.
isEmpty
(
appDto
.
getTurnUrl
()))
{
if
(
appDto
.
getTurnUrl
().
contains
(
"5rs.me/"
)
||
appDto
.
getTurnUrl
().
contains
(
"raysgo.com/"
)
||
appDto
.
getTurnUrl
().
contains
(
"raysyun.com/"
)
||
null
==
wechatUserId
)
{
appletAppOrProductDTO
.
setResultUrl
(
appDto
.
getTurnUrl
());
}
else
{
Long
sceneId
=
CommonUtils
.
getSceneId
(
appletAppOrProductDTO
.
getResultUrl
());
if
(
null
!=
sceneId
)
{
//外链跳转到指定中间页
String
jumpUrl
=
BookProps
.
getProductDomain
()
+
"transfer?offId"
+
accountSettingDto
.
getAccountSettingId
()
+
"&appId="
+
appDto
.
getAppId
()
+
"&url="
+
URLEncoder
.
encode
(
appDto
.
getTurnUrl
())
+
"&sceneId="
+
sceneId
+
"&wechatUserId="
+
wechatUserId
;
appletAppOrProductDTO
.
setResultUrl
(
jumpUrl
);
}
}
}
}
appletRecordDTO
.
setAppletAppOrProductDTO
(
appletAppOrProductDTO
);
}
...
...
@@ -880,7 +901,7 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
}
private
void
fillTypeCode4List
(
List
<
AppletRecordDTO
>
recordList
)
{
fillAppletRecord
(
recordList
,
YesOrNoNumEnum
.
YES
.
getValue
());
fillAppletRecord
(
recordList
,
YesOrNoNumEnum
.
YES
.
getValue
()
,
null
);
recordList
.
stream
().
forEach
(
appletRecordDTO
->
{
if
(
Objects
.
equals
(
AppletRecordTypeEnum
.
PRODUCT
.
value
,
appletRecordDTO
.
getRecordType
())
&&
null
!=
appletRecordDTO
.
getAppletAppOrProductDTO
())
{
// 填充作品信息
...
...
@@ -909,7 +930,7 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
if
(
ListUtils
.
isEmpty
(
recordList
))
{
return
new
AppletRecordDTO
();
}
fillAppletRecord
(
recordList
,
YesOrNoNumEnum
.
NO
.
getValue
());
fillAppletRecord
(
recordList
,
YesOrNoNumEnum
.
NO
.
getValue
()
,
wechatUserId
);
recordList
=
recordList
.
stream
().
filter
(
x
->
x
.
getSourceDelete
()
==
0
).
collect
(
Collectors
.
toList
());
if
(
ListUtils
.
isEmpty
(
recordList
))
{
return
new
AppletRecordDTO
();
...
...
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/BookAdviserBiz.java
View file @
2daed7f2
...
...
@@ -503,4 +503,6 @@ public interface BookAdviserBiz {
* 获取编辑的立项书数量和非立项书数量
*/
Map
<
Long
,
AdviserBookStatisDto
>
getAdviserBookStatis
(
AdviserBookStatisRequestDto
requestDto
);
Integer
getBookIsOpenCatalog
(
Long
bookId
,
Long
channelId
,
Long
adviserId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/BookBiz.java
View file @
2daed7f2
...
...
@@ -826,4 +826,11 @@ public interface BookBiz {
* 通过isbn,书名等信息去es库里面匹配图书封面
*/
List
<
String
>
listBookCover
(
String
isbn
,
String
bookName
,
String
author
,
String
publish
);
/**
* 从缓存中获取基本信息
* @param bookId
* @return
*/
BookDto
getBookFromRedis
(
Long
bookId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/impl/BookAdviserBizImpl.java
View file @
2daed7f2
...
...
@@ -3544,4 +3544,10 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
}
return
adviserBookStatisList
.
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getAdviserId
(),
Function
.
identity
(),
(
v1
,
v2
)->
v1
));
}
@Override
public
Integer
getBookIsOpenCatalog
(
Long
bookId
,
Long
channelId
,
Long
adviserId
)
{
Integer
isOpenCatalog
=
bookAdviserDao
.
getBookIsOpenCatalog
(
bookId
,
channelId
,
adviserId
);
return
null
==
isOpenCatalog
?
0
:
isOpenCatalog
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/impl/BookBizImpl.java
View file @
2daed7f2
...
...
@@ -2613,11 +2613,6 @@ public class BookBizImpl implements BookBiz {
if
(
bookDto
==
null
)
{
return
new
BookDto
();
}
Integer
joinGroupType
=
bookGroupDao
.
getJoinGroupType
(
paramMap
);
if
(
JoinGroupTypeEnum
.
XIAORUI
.
getCode
().
equals
(
joinGroupType
))
{
Long
classifyId
=
bookRaysClassifyDao
.
getClassifyIdByBookTemplateId
(
bookDto
.
getTempletId
());
bookDto
.
setClassifyId
(
null
!=
classifyId
?
classifyId
.
intValue
()
:
null
);
}
// 填充分类
CompletableFuture
<
Void
>
fillClassifyFuture
=
CompletableFuture
.
runAsync
(()
->
{
...
...
@@ -4668,4 +4663,16 @@ public class BookBizImpl implements BookBiz {
dto
.
setPublish
(
publish
);
return
bookElasticSearchConsr
.
searchBookExtendImg
(
dto
);
}
@Override
public
BookDto
getBookFromRedis
(
Long
bookId
)
{
BookDto
bookDto
=
bookCache
.
getBookFromRedis
(
bookId
);
if
(
null
==
bookDto
)
{
bookDto
=
bookDao
.
getBaseById
(
bookId
);
if
(
null
!=
bookDto
)
{
bookCache
.
setBookInfoToRedis
(
bookDto
);
}
}
return
bookDto
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/book/cache/BookCache.java
View file @
2daed7f2
...
...
@@ -17,6 +17,8 @@ import java.util.Objects;
@Component
(
"bookCache"
)
public
class
BookCache
{
private
static
String
BOOK_BASE_INFO_CACHE
=
"book:baseinfo:cache"
;
public
void
clearCache4BookBaseInfo
(
Long
bookId
){
if
(
Objects
.
nonNull
(
bookId
)){
StringBuffer
key
=
new
StringBuffer
(
BookConstant
.
BOOK_CACHE
);
...
...
@@ -92,6 +94,7 @@ public class BookCache {
}
JedisClusterUtils
.
del
(
key
.
toString
());
JedisClusterUtils
.
del
(
isbnKey
.
toString
());
JedisClusterUtils
.
hdel
(
BOOK_BASE_INFO_CACHE
,
bookId
.
toString
());
}
/**
...
...
@@ -144,5 +147,20 @@ public class BookCache {
return
JedisClusterUtils
.
decr
(
key
);
}
public
BookDto
getBookFromRedis
(
Long
bookId
)
{
if
(
null
==
bookId
)
{
return
null
;
}
BookDto
bookDto
=
JedisClusterUtils
.
hgetJson2Class
(
BOOK_BASE_INFO_CACHE
,
bookId
.
toString
(),
BookDto
.
class
);
return
bookDto
;
}
public
void
setBookInfoToRedis
(
BookDto
bookDto
)
{
if
(
null
==
bookDto
||
null
==
bookDto
.
getBookId
())
{
return
;
}
JedisClusterUtils
.
hset2Json
(
BOOK_BASE_INFO_CACHE
,
bookDto
.
getBookId
().
toString
(),
bookDto
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/book/dao/BookAdviserDao.java
View file @
2daed7f2
...
...
@@ -357,4 +357,6 @@ public interface BookAdviserDao extends BaseDao<BookAdviser> {
void
batchUpdateIsPrint
(
List
<
BookRequestVO
>
bookRequestVOS
);
List
<
AdviserBookStatisDto
>
getAdviserBookStatis
(
AdviserBookStatisRequestDto
requestDto
);
Integer
getBookIsOpenCatalog
(
Long
bookId
,
Long
channelId
,
Long
adviserId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/book/dao/impl/BookAdviserDaoImpl.java
View file @
2daed7f2
...
...
@@ -547,4 +547,13 @@ public class BookAdviserDaoImpl extends BaseDaoImpl<BookAdviser> implements Book
public
List
<
AdviserBookStatisDto
>
getAdviserBookStatis
(
AdviserBookStatisRequestDto
requestDto
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getAdviserBookStatis"
),
requestDto
);
}
@Override
public
Integer
getBookIsOpenCatalog
(
Long
bookId
,
Long
channelId
,
Long
adviserId
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"bookId"
,
bookId
);
paramMap
.
put
(
"channelId"
,
channelId
);
paramMap
.
put
(
"adviserId"
,
adviserId
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getBookIsOpenCatalog"
),
paramMap
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/book/service/impl/BookAdviserServiceImpl.java
View file @
2daed7f2
...
...
@@ -230,11 +230,7 @@ public class BookAdviserServiceImpl implements BookAdviserService {
public
ResponseEntity
<
ResponseDto
<
Integer
>>
getBookIsOpenCatalog
(
@RequestParam
(
"bookId"
)
Long
bookId
,
@RequestParam
(
"channelId"
)
Long
channelId
,
@RequestParam
(
"adviserId"
)
Long
adviserId
)
throws
BizException
{
Integer
isOpenCatalog
=
0
;
BookAdviserDto
base
=
bookAdviserBiz
.
getBase
(
bookId
,
channelId
,
adviserId
);
if
(
null
!=
base
)
{
isOpenCatalog
=
base
.
getIsOpenCatalog
();
}
Integer
isOpenCatalog
=
bookAdviserBiz
.
getBookIsOpenCatalog
(
bookId
,
channelId
,
adviserId
);
return
ResponseHandleUtil
.
toResponse
(
isOpenCatalog
);
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/book/service/impl/BookServiceImpl.java
View file @
2daed7f2
...
...
@@ -297,4 +297,12 @@ public class BookServiceImpl implements BookService {
public
void
updateYesterdayBookNewLabel
()
{
ThreadPoolUtils
.
OTHER_THREAD_POOL
.
execute
(()->
bookLabelBiz
.
updateYesterdayBookNewLabel
());
}
@Override
@GetMapping
(
"getBookFromRedis"
)
public
ResponseEntity
<
ResponseDto
<
BookDto
>>
getBookFromRedis
(
@RequestParam
(
"bookId"
)
Long
bookId
)
{
return
ResponseHandleUtil
.
toResponse
(
bookBiz
.
getBookFromRedis
(
bookId
));
}
}
pcloud-service-book/src/main/java/com/pcloud/book/consumer/app/AppConsr.java
View file @
2daed7f2
...
...
@@ -306,4 +306,16 @@ public class AppConsr {
}
return
null
;
}
@ParamLog
(
description
=
"获取应用基本信息与价格"
,
isAfterReturn
=
false
)
public
Map
<
Long
,
AppDto
>
mapBaseWithPriceByIds
(
List
<
Long
>
appIds
){
if
(
ListUtils
.
isEmpty
(
appIds
))
return
null
;
try
{
Map
<
Long
,
AppDto
>
appBaseStatus
=
ResponseHandleUtil
.
parseMap
(
appService
.
mapBaseWithPriceByIds
(
appIds
),
Long
.
class
,
AppDto
.
class
);
return
appBaseStatus
;
}
catch
(
Exception
e
){
LOGGER
.
error
(
"获取应用基本信息与价格失败"
+
e
.
getMessage
(),
e
);
}
return
null
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/consumer/resource/ProductConsr.java
View file @
2daed7f2
...
...
@@ -186,6 +186,52 @@ public class ProductConsr {
}
/**
* 资源中心拉取商品最基本信息
*/
public
Map
<
Long
,
ProductDto
>
getProductBasesByIds4Book
(
List
<
Long
>
productIds
)
throws
BizException
{
LOGGER
.
info
(
"【资源中心(消)】获取商品最最基本信息4Book,<START>.[productIds]="
+
productIds
+
"]"
);
if
(
productIds
==
null
||
productIds
.
isEmpty
())
{
return
null
;
}
Map
<
Long
,
ProductDto
>
productDtoMap
=
new
HashMap
<>();
productIds
=
productIds
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
Integer
size
=
productIds
.
size
();
if
(
productIds
.
size
()
>
1000
)
{
Integer
[]
queryCountArray
=
{
0
,
1
,
2
,
3
};
Integer
queryCount
=
4
;
//并发查询
List
<
Long
>
finalProductIds
=
productIds
;
Map
<
Long
,
ProductDto
>
finalProductDtoMap
=
productDtoMap
;
CompletableFuture
[]
completableFutures
=
Arrays
.
stream
(
queryCountArray
).
map
(
x
->
CompletableFuture
.
supplyAsync
(()
->
{
Integer
startIndex
=
size
/
queryCount
*
x
;
Integer
endIndex
=
size
/
queryCount
*
(
x
+
1
);
List
<
Long
>
queryList
=
finalProductIds
.
subList
(
startIndex
,
endIndex
);
Map
<
Long
,
ProductDto
>
productMap
=
ResponseHandleUtil
.
parseMapResponse
(
productService
.
getProductBasesByIds4Book
(
queryList
),
Long
.
class
,
ProductDto
.
class
);
return
productMap
;
},
ThreadPoolUtils
.
EXPORT_THREAD_POOL
).
whenComplete
(((
productMap
,
throwable
)
->
{
finalProductDtoMap
.
putAll
(
productMap
);
}))).
toArray
(
CompletableFuture
[]::
new
);
try
{
CompletableFuture
.
allOf
(
completableFutures
).
get
();
}
catch
(
InterruptedException
|
ExecutionException
e
)
{
LOGGER
.
warn
(
"[getProductBasesByIds4Book] 填充信息失败,err:{}"
,
e
.
getMessage
(),
e
);
}
return
finalProductDtoMap
;
}
else
{
try
{
productDtoMap
=
ResponseHandleUtil
.
parseMapResponse
(
productService
.
getProductBasesByIds4Book
(
productIds
),
Long
.
class
,
ProductDto
.
class
);
}
catch
(
BizException
e
)
{
LOGGER
.
warn
(
"调用:productService.getProductBasesByIds4Book报错"
,
e
.
getMessage
(),
e
);
}
return
productDtoMap
;
}
}
/**
* 资源中心拉取商品基本信息
*/
...
...
pcloud-service-book/src/main/java/com/pcloud/book/consumer/trade/TradeConsr.java
View file @
2daed7f2
...
...
@@ -371,4 +371,40 @@ public class TradeConsr {
}
return
null
;
}
/**
* 应用作品购买状态
*/
public
Map
<
String
,
Boolean
>
mapAppProductBuyStateOpt
(
Long
wechatUserId
,
List
<
Long
>
appIds
,
List
<
Long
>
productIds
)
{
if
(
null
==
wechatUserId
||
(
ListUtils
.
isEmpty
(
appIds
)
&&
ListUtils
.
isEmpty
(
productIds
)))
{
return
new
HashMap
<>();
}
OrderSearchDto
orderSearchDto
=
new
OrderSearchDto
();
orderSearchDto
.
setAppIds
(
appIds
);
orderSearchDto
.
setProductIds
(
productIds
);
orderSearchDto
.
setWechatUserId
(
wechatUserId
);
try
{
return
ResponseHandleUtil
.
parseMap
(
orderFormService
.
mapAppProductBuyStateOpt
(
orderSearchDto
),
String
.
class
,
Boolean
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"调用orderFormService.mapAppProductBuyStateOpt失败"
+
e
.
getMessage
(),
e
);
}
return
null
;
}
/**
* 课程单节课购买状态
*/
public
Map
<
Long
,
Boolean
>
mapCourseProductBuyStateOpt
(
Long
wechatUserId
,
List
<
Long
>
productIds
)
{
if
(
null
==
wechatUserId
||
ListUtils
.
isEmpty
(
productIds
))
{
return
new
HashMap
<>();
}
OrderSearchDto
orderSearchDto
=
new
OrderSearchDto
();
orderSearchDto
.
setProductIds
(
productIds
);
orderSearchDto
.
setWechatUserId
(
wechatUserId
);
try
{
return
ResponseHandleUtil
.
parseMap
(
orderFormService
.
mapCourseProductBuyStateOpt
(
orderSearchDto
),
Long
.
class
,
Boolean
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"调用orderFormService.mapCourseProductBuyStateOpt失败"
+
e
.
getMessage
(),
e
);
}
return
null
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/copyright/biz/impl/BookAuthUserBizImpl.java
View file @
2daed7f2
...
...
@@ -2,7 +2,6 @@ package com.pcloud.book.copyright.biz.impl;
import
cn.hutool.core.collection.CollUtil
;
import
com.google.common.collect.Lists
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.consumer.live.LiveCons
;
...
...
@@ -32,10 +31,8 @@ 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.cookie.Cookie
;
import
com.pcloud.readercenter.wechat.entity.WechatUser
;
import
com.pcloud.resourcecenter.base.constants.ResourceRedisCons
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.MapUtils
;
import
org.slf4j.Logger
;
...
...
@@ -191,41 +188,24 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz {
@Override
public
Boolean
checkIsHaveAuthWithServer
(
String
userInfo
,
Long
serverId
,
String
serverType
)
{
// 如果包含超级作者资源, 则直接返回
long
t1
=
System
.
currentTimeMillis
();
if
(
checkIsSuperProduct
(
serverId
)){
long
t2
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"第0阶段耗时="
+
(
t2
-
t1
));
if
(
checkIsSuperProduct
(
serverId
))
{
return
false
;
}
long
t2
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"第1阶段耗时="
+
(
t2
-
t1
));
// 否则查询授权关系
Long
bookId
=
qrcodeSceneConsr
.
getBookId4SceneId
(
Cookie
.
getId
(
userInfo
,
Cookie
.
_SCENE_ID
));
long
t3
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"第2阶段耗时="
+
(
t3
-
t2
));
Long
bookId
=
qrcodeSceneConsr
.
getBookId4SceneId
(
Cookie
.
getId
(
userInfo
,
Cookie
.
_SCENE_ID
));
Long
channelId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_CHANNEL_ID
);
Long
adviserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_ADVISER_ID
);
Long
wecharUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Long
adviserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_ADVISER_ID
);
Long
wecharUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
"live"
.
equalsIgnoreCase
(
serverType
))
{
if
(
"live"
.
equalsIgnoreCase
(
serverType
))
{
List
<
Long
>
id
=
new
ArrayList
<>(
1
);
id
.
add
(
serverId
);
Map
<
Long
,
Boolean
>
map
=
liveCons
.
checkIsSuperMerchant
(
id
);
if
(
map
!=
null
&&
Boolean
.
TRUE
.
equals
(
map
.
get
(
serverId
)))
{
if
(
map
!=
null
&&
Boolean
.
TRUE
.
equals
(
map
.
get
(
serverId
)))
{
return
false
;
}
else
{
return
checkIsHaveAuthWithServer
(
bookId
,
channelId
,
adviserId
,
wecharUserId
,
serverId
);
}
}
else
{
Boolean
aBoolean
=
checkIsHaveAuthWithServer
(
bookId
,
channelId
,
adviserId
,
wecharUserId
,
serverId
);
long
t4
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"第3阶段耗时="
+
(
t4
-
t3
));
return
aBoolean
;
}
return
checkIsHaveAuthWithServer
(
bookId
,
channelId
,
adviserId
,
wecharUserId
,
serverId
);
}
private
Boolean
checkIsHaveAuthWithServer
(
Long
bookId
,
Long
channelId
,
Long
adviserId
,
Long
wecharUserId
,
Long
serverId
)
{
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/ResourcePageBiz.java
View file @
2daed7f2
...
...
@@ -531,9 +531,16 @@ public interface ResourcePageBiz {
* @param channelId
* @param enableAdverting
* @param navigationId
* @param officialAccountsId
* @return
*/
List
<
ResourceColumnAndServeVO
>
getColumnAndServeListByPageId4Wechat
(
Long
resourcePageId
,
Long
wechatUserId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
,
Integer
enableAdverting
,
Long
navigationId
);
List
<
ResourceColumnAndServeVO
>
getColumnAndServeListByPageId4Wechat
(
Long
resourcePageId
,
Long
wechatUserId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
,
Integer
enableAdverting
,
Long
navigationId
,
Long
officialAccountsId
);
List
<
Integer
>
getColumnTypeByPageId4Wechat
(
Long
resourcePageId
,
Long
wechatUserId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
,
Integer
enableAdverting
,
Long
navigationId
);
//优化 此处把模块分开调接口 columnType
List
<
ResourceColumnAndServeVO
>
getColumnAndServeListByPageId4WechatV2
(
Long
resourcePageId
,
Long
wechatUserId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
,
Integer
enableAdverting
,
Long
navigationId
,
Integer
columnType
,
Long
officialAccountsId
);
/**
* 保存分享配置
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/impl/ResourcePageBizImpl.java
View file @
2daed7f2
...
...
@@ -8,7 +8,6 @@ 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.appcenter.app.dto.app.MapBaseStatusDTO
;
import
com.pcloud.book.applet.biz.AppletBooklistBiz
;
import
com.pcloud.book.applet.biz.AppletGroupSearchRecordBiz
;
import
com.pcloud.book.applet.biz.AppletRecordAggrStatisBiz
;
...
...
@@ -129,6 +128,7 @@ import com.pcloud.common.core.constant.AdviserTaskConstants;
import
com.pcloud.common.core.constant.MQTopicProducer
;
import
com.pcloud.common.core.constant.ProductTypeConstant
;
import
com.pcloud.common.core.constant.SystemCode
;
import
com.pcloud.common.enums.AppTypeEnum
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
...
...
@@ -163,6 +163,7 @@ import org.springframework.transaction.annotation.Transactional;
import
java.io.File
;
import
java.math.BigDecimal
;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
...
...
@@ -174,13 +175,13 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.ExecutionException
;
import
java.util.concurrent.Future
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeoutException
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.io.FileUtil
;
...
...
@@ -1026,10 +1027,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
resourcePageId = pageId;
navigationId = naviId;
}*/
long
t1
=
System
.
currentTimeMillis
();
List
<
ResourceColumnAndServeVO
>
serveVOS
=
resourcePageColumnDao
.
getColumnListByPageId
(
resourcePageId
,
navigationId
);
long
t2
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"第一步耗时="
+(
t2
-
t1
));
List
<
ResourceColumnAndServeVO
>
serveVOS
=
resourcePageColumnDao
.
getColumnListByPageId
(
resourcePageId
,
navigationId
,
null
);
if
(
CollUtil
.
isNotEmpty
(
serveVOS
))
{
List
<
ResourcePageItemVO
>
itemVOList
;
if
(
null
!=
wechatUserId
)
{
...
...
@@ -1037,13 +1035,9 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
}
else
{
itemVOList
=
resourcePageItemDao
.
getResourcePageItemByPageId
(
resourcePageId
,
null
);
}
long
t3
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"第二步耗时="
+(
t3
-
t2
));
if
(
CollUtil
.
isNotEmpty
(
itemVOList
))
{
//二维码类型
fillQrcodeType
(
resourcePageId
,
itemVOList
);
long
t4
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"第三步耗时="
+(
t4
-
t3
));
Map
<
String
,
List
<
ResourcePageItemVO
>>
listMap
=
itemVOList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ResourcePageItemVO:
:
getServeType
));
itemVOList
=
new
ArrayList
<>();
//应用和作品提出来一起查
...
...
@@ -1057,14 +1051,10 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
this
.
fillResourceByType
(
entry
.
getValue
(),
wechatUserId
,
entry
.
getKey
());
itemVOList
.
addAll
(
entry
.
getValue
());
}
long
t6
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"第四步-1耗时="
+(
t6
-
t4
));
if
(
CollUtil
.
isNotEmpty
(
itemAppAndProductVOList
)){
fillAppProductServe
(
itemAppAndProductVOList
,
wechatUserId
);
itemVOList
.
addAll
(
itemAppAndProductVOList
);
}
long
t5
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"第四步-2耗时="
+(
t5
-
t6
));
itemVOList
.
sort
(
Comparator
.
comparing
(
ResourcePageItemVO:
:
getId
));
Map
<
Long
,
List
<
ResourcePageItemVO
>>
columnMap
=
itemVOList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ResourcePageItemVO:
:
getResourcePageColumnId
));
List
<
ResourceColumnAndServeVO
>
removeColumns
=
new
ArrayList
<>();
...
...
@@ -1086,8 +1076,6 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
columnAndServeVO
.
setLogoUrl
(
itemVOS
.
get
(
0
).
getLogoUrl
());
}
}
long
t7
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"第五步耗时="
+(
t7
-
t5
));
if
(!
ListUtils
.
isEmpty
(
removeColumns
))
{
serveVOS
.
removeAll
(
removeColumns
);
}
...
...
@@ -1097,10 +1085,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
serveVOS
=
CollUtil
.
toList
();
}
// 填充广告
long
t8
=
System
.
currentTimeMillis
();
this
.
fillAdvertising
(
serveVOS
,
bookId
,
adviserId
,
channelId
,
enableAdverting
);
long
t9
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"第六步耗时="
+(
t9
-
t8
));
return
serveVOS
;
}
...
...
@@ -1393,22 +1378,22 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
long
t1
=
System
.
currentTimeMillis
();
Map
<
Long
,
AppDto
>
appDtoMap
=
new
HashMap
<>();
Map
<
Long
,
ProductDto
>
productDtoMap
=
new
HashMap
<>();
Map
<
Long
,
MapBaseStatusDTO
>
appPriceMap
=
new
HashMap
<>();
//
Map<Long, MapBaseStatusDTO> appPriceMap = new HashMap<>();
Future
<
Map
<
Long
,
AppDto
>>
appMapSubmit
=
ThreadPoolUtils
.
RESOURCE_POOL
.
submit
(()
->{
return
appConsr
.
mapBaseByIds
(
appIds
);
return
appConsr
.
mapBase
WithPrice
ByIds
(
appIds
);
});
Future
<
Map
<
Long
,
ProductDto
>>
productMapSubmit
=
ThreadPoolUtils
.
RESOURCE_POOL
.
submit
(()
->{
return
productConsr
.
getProductBasesByIds
(
productIds
);
return
productConsr
.
getProductBasesByIds
4Book
(
productIds
);
});
Future
<
Map
<
Long
,
MapBaseStatusDTO
>>
appPriceMapSubmit
=
ThreadPoolUtils
.
RESOURCE_POOL
.
submit
(()
->{
/*
Future<Map<Long, MapBaseStatusDTO>> appPriceMapSubmit = ThreadPoolUtils.RESOURCE_POOL.submit(() ->{
return appConsr.mapBaseStatusById(appIds);
});
});
*/
Map
<
Long
,
AccountSettingDto
>
channelAccountSettingDtoMap
=
new
HashMap
<>();
Map
<
Long
,
AccountSetting
>
accountSettingMap
=
new
HashMap
<>();
//应用配置公众号工具
Map
<
Long
,
Long
>
appOfficialAccountToolMap
=
new
HashMap
<>();
//是否购买
Map
<
Lo
ng
,
Boolean
>
buyStateMap
=
new
HashMap
<>();
Map
<
Stri
ng
,
Boolean
>
buyStateMap
=
new
HashMap
<>();
//课程是否购买(单节/整套)
Map
<
Long
,
Boolean
>
courseBuyStateMap
=
new
HashMap
<>();
if
(
null
!=
wechatUserId
)
{
...
...
@@ -1419,11 +1404,11 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
Future
<
Map
<
Long
,
AccountSettingDto
>>
channelAccountSettingDtoSubmit
=
ThreadPoolUtils
.
RESOURCE_POOL
.
submit
(()
->{
return
channelConsr
.
listWechatAccountInfo
(
channelIds
);
});
Future
<
Map
<
Lo
ng
,
Boolean
>>
buyStateSubmit
=
ThreadPoolUtils
.
RESOURCE_POOL
.
submit
(()
->{
return
tradeConsr
.
mapAppProductBuyState
(
wechatUserId
,
appIds
,
nonCourseProductIds
);
Future
<
Map
<
Stri
ng
,
Boolean
>>
buyStateSubmit
=
ThreadPoolUtils
.
RESOURCE_POOL
.
submit
(()
->{
return
tradeConsr
.
mapAppProductBuyState
Opt
(
wechatUserId
,
appIds
,
nonCourseProductIds
);
});
Future
<
Map
<
Long
,
Boolean
>>
courseBuyStateSubmit
=
ThreadPoolUtils
.
RESOURCE_POOL
.
submit
(()
->{
return
tradeConsr
.
mapCourseProductBuyState
(
wechatUserId
,
courseProductIds
);
return
tradeConsr
.
mapCourseProductBuyState
Opt
(
wechatUserId
,
courseProductIds
);
});
try
{
appOfficialAccountToolMap
=
appOfficialAccountToolSubmit
.
get
(
ThreadPoolUtils
.
REMOTE_TIME_OUT
,
TimeUnit
.
SECONDS
);
...
...
@@ -1456,13 +1441,12 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
}
catch
(
InterruptedException
|
ExecutionException
|
TimeoutException
e
)
{
log
.
warn
(
"调用资源中心获取商品信息错误:"
+
e
.
getMessage
(),
e
);
}
try
{
/*
try {
appPriceMap = appPriceMapSubmit.get(ThreadPoolUtils.REMOTE_TIME_OUT, TimeUnit.SECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
log.error("调用应用中心获取应用价格信息错误:"+e.getMessage(), e);
}
long
t2
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"第四-2-1步耗时="
+(
t2
-
t1
));
}*/
Map
<
Long
,
Long
>
defaultChannelIdMap
=
new
HashMap
<>();
for
(
ResourcePageItemVO
itemVO
:
itemVOS
)
{
Long
serveId
=
itemVO
.
getServeId
();
String
serveType
=
itemVO
.
getServeType
();
...
...
@@ -1474,12 +1458,12 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
itemVO
.
setTypeCode
(
appDto
.
getTypeCode
());
itemVO
.
setTypeName
(
appDto
.
getTypeName
());
itemVO
.
setTransverseImg
(
appDto
.
getTransverseImg
());
itemVO
.
setPrice
(
appDto
.
getPric
e
());
itemVO
.
setPrice
(
null
==
appDto
.
getRetailPrice
()
?
Double
.
valueOf
(
0
d
)
:
appDto
.
getRetailPrice
().
doubleValu
e
());
itemVO
.
setHasThirdLink
(!
StringUtil
.
isEmpty
(
appDto
.
getTurnUrl
())?
true
:
false
);
if
(!
MapUtils
.
isEmpty
(
appPriceMap
)
&&
appPriceMap
.
containsKey
(
serveId
))
{
/*
if (!MapUtils.isEmpty(appPriceMap) && appPriceMap.containsKey(serveId)) {
BigDecimal price = appPriceMap.get(serveId).getRetailPrice();
itemVO.setPrice(null == price?Double.valueOf(0d):price.doubleValue());
}
}
*/
//标记应用共享状态
itemVO
.
setAppCreateUser
(
appDto
.
getCreatedUser
());
itemVO
.
setShareState
(
appDto
.
getShareState
());
...
...
@@ -1507,14 +1491,34 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
Long
channelId
=
getChannelIdFromUrl
(
itemVO
.
getLinkUrl
());
if
(
null
==
channelId
)
{
log
.
info
(
itemVO
.
getServeName
()
+
"无运营平台, serveId="
+
itemVO
.
getServeId
());
channelId
=
adviserConsr
.
getDefaultChannel
(
adviserId
);
if
(
defaultChannelIdMap
.
containsKey
(
adviserId
)){
channelId
=
defaultChannelIdMap
.
get
(
adviserId
);
if
(
null
!=
channelId
){
channelId
=
adviserConsr
.
getDefaultChannel
(
adviserId
);
}
}
else
{
channelId
=
adviserConsr
.
getDefaultChannel
(
adviserId
);
if
(
null
!=
channelId
)
{
defaultChannelIdMap
.
put
(
adviserId
,
channelId
);
}
}
}
itemVO
.
setChannelId
(
channelId
);
if
(
null
!=
wechatUserId
)
{
setResourceLink4Wechat
(
itemVO
,
channelAccountSettingDtoMap
,
appOfficialAccountToolMap
,
accountSettingMap
);
itemVO
.
setBuyState
(
false
);
if
(!
MapUtils
.
isEmpty
(
buyStateMap
)
&&
buyStateMap
.
containsKey
(
serveId
))
{
itemVO
.
setBuyState
(
buyStateMap
.
get
(
serveId
));
if
(!
MapUtils
.
isEmpty
(
buyStateMap
))
{
if
(
ResourcePageConstants
.
ServeTypeEnum
.
PRODUCT
.
getValue
().
equals
(
serveType
)){
String
key
=
"PRODUCT"
+
serveId
;
if
(
buyStateMap
.
containsKey
(
key
)){
itemVO
.
setBuyState
(
buyStateMap
.
get
(
key
));
}
}
else
if
(
ResourcePageConstants
.
ServeTypeEnum
.
APP
.
getValue
().
equals
(
serveType
)){
String
key
=
"APP"
+
serveId
;
if
(
buyStateMap
.
containsKey
(
key
)){
itemVO
.
setBuyState
(
buyStateMap
.
get
(
key
));
}
}
}
if
(!
MapUtils
.
isEmpty
(
courseBuyStateMap
)
&&
courseBuyStateMap
.
containsKey
(
serveId
)
&&
ResourcePageConstants
.
ServeTypeEnum
.
PRODUCT
.
getValue
().
equals
(
itemVO
.
getServeType
()))
{
...
...
@@ -1522,8 +1526,6 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
}
}
}
long
t3
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"第四-2-2步耗时="
+(
t3
-
t2
));
}
/**
...
...
@@ -1944,45 +1946,67 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
if
(
null
==
bookGroupId
&&
null
==
sceneId
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数缺失"
);
}
ResourcePage
byScene
Id
=
null
;
Long
book
Id
=
null
;
if
(
null
!=
bookGroupId
)
{
b
ySceneId
=
resourcePageDao
.
get
ByBookGroupId
(
bookGroupId
);
b
ookId
=
resourcePageDao
.
getBookId
ByBookGroupId
(
bookGroupId
);
}
else
if
(
null
!=
sceneId
)
{
b
ySceneId
=
resourcePageDao
.
get
BySceneId
(
sceneId
);
b
ookId
=
resourcePageDao
.
getBookId
BySceneId
(
sceneId
);
}
//上邮临时处理方案
if
(
null
!=
b
ySceneId
&&
null
!=
bySceneId
.
getBookId
()
&&
null
!=
JedisClusterUtils
.
hget
(
nftReleaseLockKey
,
bySceneId
.
getBookId
()
.
toString
()))
{
if
(
null
!=
b
ookId
&&
null
!=
JedisClusterUtils
.
hget
(
nftReleaseLockKey
,
bookId
.
toString
()))
{
if
(
null
!=
bookGroupId
)
{
bookGroupId
=
JedisClusterUtils
.
hgetJson2Class
(
nftReleaseLockKey
,
b
ySceneId
.
getBookId
()
.
toString
(),
NftBookState
.
class
).
getNftBookGroupId
();
bookGroupId
=
JedisClusterUtils
.
hgetJson2Class
(
nftReleaseLockKey
,
b
ookId
.
toString
(),
NftBookState
.
class
).
getNftBookGroupId
();
}
else
if
(
null
!=
sceneId
)
{
sceneId
=
JedisClusterUtils
.
hgetJson2Class
(
nftReleaseLockKey
,
b
ySceneId
.
getBookId
()
.
toString
(),
NftBookState
.
class
).
getNftSceneId
();;
sceneId
=
JedisClusterUtils
.
hgetJson2Class
(
nftReleaseLockKey
,
b
ookId
.
toString
(),
NftBookState
.
class
).
getNftSceneId
();;
}
}
ResourcePageVO
resourceP
ageVO
=
new
ResourcePageVO
();
ResourcePageVO
p
ageVO
=
new
ResourcePageVO
();
if
(
null
!=
bookGroupId
)
{
resourceP
ageVO
=
getResourcePageByBookGroupId4Wechat
(
bookGroupId
,
wechatUserId
);
p
ageVO
=
getResourcePageByBookGroupId4Wechat
(
bookGroupId
,
wechatUserId
);
}
else
if
(
null
!=
sceneId
)
{
resourceP
ageVO
=
getResourcePageBySceneId4Wechat
(
sceneId
);
p
ageVO
=
getResourcePageBySceneId4Wechat
(
sceneId
);
}
ResourcePageVO
resourcePageVO
=
pageVO
;
if
(
null
!=
resourcePageVO
.
getId
())
{
//查收藏状态
ResourcePageCollect
collect
=
resourcePageCollectDao
.
getCollectRecordByUser
(
wechatUserId
,
resourcePageVO
.
getId
());
resourcePageVO
.
setCollectState
(
null
==
collect
?
0
:
1
);
// 实体店铺
resourcePageVO
.
setResourcePageBookstoreList
(
resourcePageBookstoreBiz
.
getByResourcePageId
(
resourcePageVO
.
getId
(),
resourcePageVO
.
getChannelId
(),
wechatUserId
,
ResourcePageFixtureTypeEnum
.
BOOKSTORE
));
// 优惠券
resourcePageVO
.
setResourcePageCouponList
(
resourcePageBookstoreBiz
.
getByResourcePageId
(
resourcePageVO
.
getId
(),
resourcePageVO
.
getChannelId
(),
wechatUserId
,
ResourcePageFixtureTypeEnum
.
COUPONS
));
}
else
{
resourcePageVO
.
setResourcePageBookstoreList
(
CollUtil
.
toList
());
resourcePageVO
.
setResourcePageCouponList
(
CollUtil
.
toList
());
}
if
(
null
!=
resourcePageVO
.
getAdviserId
())
{
resourcePageVO
.
setPushTextOpenStatus
(
qrcodeSceneConsr
.
getPushTextOpenStatus
(
resourcePageVO
.
getAdviserId
()));
Integer
collectState
=
resourcePageCollectDao
.
getCollectStateByUser
(
wechatUserId
,
resourcePageVO
.
getId
());
resourcePageVO
.
setCollectState
(
null
==
collectState
?
0
:
1
);
}
// 实体店铺
CompletableFuture
<
List
<
ResourcePageBookstoreVO
>>
storeFuture
=
CompletableFuture
.
supplyAsync
(()
->
{
return
resourcePageBookstoreBiz
.
getByResourcePageId
(
resourcePageVO
.
getId
(),
resourcePageVO
.
getChannelId
(),
wechatUserId
,
ResourcePageFixtureTypeEnum
.
BOOKSTORE
);
});
// 优惠券
CompletableFuture
<
List
<
ResourcePageBookstoreVO
>>
couponFuture
=
CompletableFuture
.
supplyAsync
(()
->
{
return
resourcePageBookstoreBiz
.
getByResourcePageId
(
resourcePageVO
.
getId
(),
resourcePageVO
.
getChannelId
(),
wechatUserId
,
ResourcePageFixtureTypeEnum
.
COUPONS
);
});
//加载导航
this
.
fillNavigation
(
resourcePageVO
,
wechatUserId
);
CompletableFuture
<
Void
>
navigationFuture
=
CompletableFuture
.
runAsync
(()
->
{
this
.
fillNavigation
(
resourcePageVO
,
wechatUserId
);
});
//加载企业微信落地页信息
this
.
fillWxworkPage
(
resourcePageVO
);
CompletableFuture
<
Void
>
wxworkPageFuture
=
CompletableFuture
.
runAsync
(()
->
{
this
.
fillWxworkPage
(
resourcePageVO
);
});
//扫码推送二维码名称权限状态
CompletableFuture
<
Integer
>
pushTextFuture
=
CompletableFuture
.
supplyAsync
(()
->
{
return
qrcodeSceneConsr
.
getPushTextOpenStatus
(
resourcePageVO
.
getAdviserId
());
});
CompletableFuture
.
allOf
(
storeFuture
,
couponFuture
,
navigationFuture
,
wxworkPageFuture
,
pushTextFuture
).
join
();
List
<
ResourcePageBookstoreVO
>
bookstoreVOS
=
new
ArrayList
<>();
List
<
ResourcePageBookstoreVO
>
couponVOS
=
new
ArrayList
<>();
Integer
pushTextPermission
=
0
;
try
{
bookstoreVOS
=
storeFuture
.
get
(
ThreadPoolUtils
.
REMOTE_TIME_OUT
,
TimeUnit
.
SECONDS
);
couponVOS
=
couponFuture
.
get
(
ThreadPoolUtils
.
REMOTE_TIME_OUT
,
TimeUnit
.
SECONDS
);
pushTextPermission
=
pushTextFuture
.
get
(
ThreadPoolUtils
.
REMOTE_TIME_OUT
,
TimeUnit
.
SECONDS
);
}
catch
(
InterruptedException
|
ExecutionException
|
TimeoutException
e
)
{
log
.
error
(
"查询实体店铺/优惠券失败"
+
e
.
getMessage
(),
e
);
}
resourcePageVO
.
setResourcePageBookstoreList
(
bookstoreVOS
);
resourcePageVO
.
setResourcePageCouponList
(
couponVOS
);
resourcePageVO
.
setPushTextOpenStatus
(
pushTextPermission
);
return
resourcePageVO
;
}
...
...
@@ -2016,8 +2040,8 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
}
resourcePageVO
.
setLastReadTime
(
DateUtils
.
formatDate
(
new
Date
()));
//小程序
BookAppletScene
bookAppletScene
=
bookAppletSceneDao
.
get
ByBookGroupId
(
bookGroupId
);
resourcePageVO
.
setAppletId
(
null
==
bookAppletScene
?
null
:
bookAppletScene
.
getAppletId
()
);
String
appletId
=
bookAppletSceneDao
.
getAppletId
ByBookGroupId
(
bookGroupId
);
resourcePageVO
.
setAppletId
(
appletId
);
ResourcePage
resourcePage
=
resourcePageDao
.
getByBookGroupId
(
bookGroupId
);
if
(
null
!=
resourcePage
)
{
resourcePageVO
.
setShowBook
(
resourcePage
.
getShowBook
());
...
...
@@ -2043,35 +2067,9 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
private
ResourcePageVO
getResourcePageBySceneId4Wechat
(
Long
sceneId
)
{
ResourcePageVO
resourcePageVO
=
new
ResourcePageVO
();
resourcePageVO
.
setSceneId
(
sceneId
);
Map
<
Long
,
QrcodeSceneDto
>
qrcodeSceneDtoMap
=
qrcodeSceneConsr
.
listBaseInfoByIds
(
Arrays
.
asList
(
sceneId
));
if
(!
MapUtils
.
isEmpty
(
qrcodeSceneDtoMap
)
&&
qrcodeSceneDtoMap
.
containsKey
(
sceneId
))
{
QrcodeSceneDto
qrcodeSceneDto
=
qrcodeSceneDtoMap
.
get
(
sceneId
);
Long
bookId
=
qrcodeSceneDto
.
getAdviserBookId
();
Long
adviserId
=
qrcodeSceneDto
.
getCreatedByUserLogin
();
Long
channelId
=
qrcodeSceneDto
.
getChannelPartyId
();
resourcePageVO
.
setBookId
(
bookId
);
resourcePageVO
.
setAdviserId
(
adviserId
);
resourcePageVO
.
setChannelId
(
channelId
);
resourcePageVO
.
setQrcodeName
(
qrcodeSceneDto
.
getSceneName
());
if
(
null
!=
bookId
)
{
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
(
Optional
.
ofNullable
(
agentMap
.
get
(
adviserId
)).
orElseGet
(
AdviserBaseInfoDto:
:
new
).
getAgentName
());
}
AccountSettingDto
accountSettingDto
=
qrcodeSceneConsr
.
getWechatInfo
(
channelId
);
if
(
accountSettingDto
!=
null
){
resourcePageVO
.
setAccountSettingId
(
accountSettingDto
.
getAccountSettingId
());
}
}
//小程序
BookAppletScene
bookAppletScene
=
bookAppletSceneDao
.
getBySceneId
(
sceneId
);
resourcePageVO
.
setAppletId
(
null
==
bookAppletScene
?
null
:
bookAppletScene
.
getAppletId
());
Future
<
Map
<
Long
,
QrcodeSceneDto
>>
qrcodeFuture
=
ThreadPoolUtils
.
RESOURCE_POOL
.
submit
(()->{
return
qrcodeSceneConsr
.
listBaseInfoByIds
(
Arrays
.
asList
(
sceneId
));
});
ResourcePage
resourcePage
=
resourcePageDao
.
getBySceneId
(
sceneId
);
if
(
null
!=
resourcePage
)
{
resourcePageVO
.
setShowBook
(
resourcePage
.
getShowBook
());
...
...
@@ -2092,6 +2090,54 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
resourcePageVO
.
setNavigationJumpType
(
resourcePage
.
getNavigationJumpType
());
resourcePageVO
.
setIsShowPrice
(
resourcePage
.
getIsShowPrice
());
}
//小程序
resourcePageVO
.
setAppletId
(
bookAppletSceneDao
.
getAppletIdBySceneId
(
sceneId
));
Map
<
Long
,
QrcodeSceneDto
>
qrcodeSceneDtoMap
=
new
HashMap
<>();
try
{
qrcodeSceneDtoMap
=
qrcodeFuture
.
get
(
ThreadPoolUtils
.
REMOTE_TIME_OUT
,
TimeUnit
.
SECONDS
);
}
catch
(
Exception
e
)
{
log
.
error
(
"查二维码失败"
+
e
.
getMessage
(),
e
);
}
if
(!
MapUtils
.
isEmpty
(
qrcodeSceneDtoMap
)
&&
qrcodeSceneDtoMap
.
containsKey
(
sceneId
))
{
QrcodeSceneDto
qrcodeSceneDto
=
qrcodeSceneDtoMap
.
get
(
sceneId
);
Long
bookId
=
qrcodeSceneDto
.
getAdviserBookId
();
resourcePageVO
.
setBookId
(
bookId
);
resourcePageVO
.
setAdviserId
(
qrcodeSceneDto
.
getCreatedByUserLogin
());
resourcePageVO
.
setChannelId
(
qrcodeSceneDto
.
getChannelPartyId
());
resourcePageVO
.
setQrcodeName
(
qrcodeSceneDto
.
getSceneName
());
if
(
null
!=
bookId
)
{
BookDto
bookDto
=
bookBiz
.
getBaseById
(
bookId
);
if
(
null
!=
bookDto
)
{
resourcePageVO
.
setBookImg
(
bookDto
.
getCoverImg
());
resourcePageVO
.
setBookName
(
bookDto
.
getBookName
());
}
}
}
Long
adviserId
=
resourcePageVO
.
getAdviserId
();
CompletableFuture
<
Map
<
Long
,
AdviserBaseInfoDto
>>
agentFuture
=
CompletableFuture
.
supplyAsync
(()
->
{
return
adviserConsr
.
getAdviserId2AdviserInfoDtoMap
(
null
==
adviserId
?
new
ArrayList
<>():
Arrays
.
asList
(
adviserId
));
});
CompletableFuture
<
AccountSettingDto
>
accountSettingFuture
=
CompletableFuture
.
supplyAsync
(()
->
{
return
qrcodeSceneConsr
.
getWechatInfo
(
resourcePageVO
.
getChannelId
());
});
CompletableFuture
.
allOf
(
agentFuture
,
accountSettingFuture
).
join
();
Map
<
Long
,
AdviserBaseInfoDto
>
agentMap
=
new
HashMap
<>();
AccountSettingDto
accountSettingDto
=
new
AccountSettingDto
();
try
{
agentMap
=
agentFuture
.
get
(
ThreadPoolUtils
.
REMOTE_TIME_OUT
,
TimeUnit
.
SECONDS
);
accountSettingDto
=
accountSettingFuture
.
get
(
ThreadPoolUtils
.
REMOTE_TIME_OUT
,
TimeUnit
.
SECONDS
);
}
catch
(
InterruptedException
|
ExecutionException
|
TimeoutException
e
)
{
log
.
error
(
"查询出版社/公众号失败"
+
e
.
getMessage
(),
e
);
}
if
(!
MapUtils
.
isEmpty
(
agentMap
))
{
resourcePageVO
.
setAgentName
(
Optional
.
ofNullable
(
agentMap
.
get
(
adviserId
)).
orElseGet
(
AdviserBaseInfoDto:
:
new
).
getAgentName
());
}
if
(
accountSettingDto
!=
null
){
resourcePageVO
.
setAccountSettingId
(
accountSettingDto
.
getAccountSettingId
());
}
return
resourcePageVO
;
}
...
...
@@ -2102,7 +2148,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
* * @param null
*/
private
void
updateSeq4Batch
(
Long
resourcePageId
,
Long
navigationId
)
{
List
<
ResourceColumnAndServeVO
>
serveVOS
=
resourcePageColumnDao
.
getColumnListByPageId
(
resourcePageId
,
navigationId
);
List
<
ResourceColumnAndServeVO
>
serveVOS
=
resourcePageColumnDao
.
getColumnListByPageId
(
resourcePageId
,
navigationId
,
null
);
if
(
ListUtils
.
isEmpty
(
serveVOS
))
{
return
;
}
...
...
@@ -3167,22 +3213,54 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
qrcodeTemp
.
setAccountSettingId
(
accountSettingId
);
qrcodeTemp
.
setCreatedUser
(
wechatUserId
);
qrcodeTemp
.
setPageId
(
resourcePageId
);
String
qrcodeUrl
=
qrcodeSceneConsr
.
createTempQrcode4H5
(
qrcodeTemp
);
String
qrcodeUrl
=
null
;
try
{
qrcodeUrl
=
qrcodeSceneConsr
.
createTempQrcode4H5
(
qrcodeTemp
);
}
catch
(
Exception
e
)
{
log
.
warn
(
"H5生成临时二维码失败"
+
e
.
getMessage
());
pageItemVO
=
new
ResourcePageItemVO
();
pageItemVO
.
setPopupState
(
popupState
);
return
pageItemVO
;
}
//todo 每个人生成的码都缓存下来。如果公众号id。或者logoUrl变了。要删缓存。临时二维码有效期30天
String
tempKey
=
BookConstant
.
PAGE_ID_TEMP_CODE_CACHE
+
resourcePageId
+
"-"
+
accountSettingId
+
"-"
+
wechatUserId
;
String
logoUrlKey
=
BookConstant
.
PAGE_ID_LOGOURL_CACHE
+
resourcePageId
+
"-"
+
accountSettingId
+
"-"
+
wechatUserId
;
String
pageKey
=
BookConstant
.
PAGE_ID_CODE_CACHE
+
resourcePageId
+
"-"
+
accountSettingId
+
"-"
+
wechatUserId
;
if
(!
StringUtil
.
isEmpty
(
qrcodeUrl
)
&&
!
StringUtil
.
isEmpty
(
logoUrl
))
{
//添加Logo
String
url
=
""
;
String
tmpDirPath
=
FileUtil
.
getTmpDirPath
();
if
(!
tmpDirPath
.
endsWith
(
File
.
separator
))
{
tmpDirPath
=
tmpDirPath
+
File
.
separator
;
String
cacheQrcodeUrl
=
JedisClusterUtils
.
get
(
tempKey
);
String
cacheLogoUrl
=
JedisClusterUtils
.
get
(
logoUrlKey
);
//qrcodeUrl 变了要重新生成
if
(
StrUtil
.
isBlank
(
cacheQrcodeUrl
)){
JedisClusterUtils
.
set
(
tempKey
,
qrcodeUrl
,
60
*
60
*
24
*
30
);
}
else
{
//如果缓存里面有值。然后就从缓存里面拿的和新拿到的qrcodeUrl比较。如果不同。说明原来的临时二维码到期了。重新生成了。那么都要重新生成一次
if
(!
cacheQrcodeUrl
.
equalsIgnoreCase
(
qrcodeUrl
)){
//重新生成
JedisClusterUtils
.
set
(
tempKey
,
qrcodeUrl
,
60
*
60
*
24
*
30
);
qrcodeUrl
=
getQrcodeUrl
(
logoUrl
,
qrcodeUrl
);
JedisClusterUtils
.
set
(
pageKey
,
qrcodeUrl
,
60
*
60
*
24
*
30
);
}
}
File
file
=
FileUtil
.
touch
(
tmpDirPath
+
UUIDUitl
.
generateShort
()
+
".png"
);
HttpUtil
.
downloadFile
(
qrcodeUrl
,
file
);
try
{
url
=
QrCodeUtil
.
decode
(
file
);
}
catch
(
QrCodeException
e
){
log
.
info
(
"解析二维码图片失败,qrcodeUrl:{}"
,
qrcodeUrl
);
//logoUrl 变了也要重新生成
if
(
StrUtil
.
isBlank
(
cacheLogoUrl
)){
JedisClusterUtils
.
set
(
logoUrlKey
,
qrcodeUrl
,
60
*
60
*
24
*
30
);
}
else
{
//如果缓存里面有值。然后就从缓存里面拿的和新拿到的logoUrl比较。如果不同。说明变了logoUrl了。那么都要重新生成一次
if
(!
cacheLogoUrl
.
equalsIgnoreCase
(
logoUrl
)){
//重新生成
JedisClusterUtils
.
set
(
logoUrlKey
,
logoUrl
,
60
*
60
*
24
*
30
);
qrcodeUrl
=
getQrcodeUrl
(
logoUrl
,
qrcodeUrl
);
JedisClusterUtils
.
set
(
pageKey
,
qrcodeUrl
,
60
*
60
*
24
*
30
);
}
}
String
cachePageUrl
=
JedisClusterUtils
.
get
(
pageKey
);
if
(
StrUtil
.
isNotBlank
(
cachePageUrl
)){
qrcodeUrl
=
cachePageUrl
;
}
else
{
//添加Logo
qrcodeUrl
=
getQrcodeUrl
(
logoUrl
,
qrcodeUrl
);
JedisClusterUtils
.
set
(
pageKey
,
qrcodeUrl
,
60
*
60
*
24
*
30
);
}
qrcodeUrl
=
this
.
getLogoQrcode
(
url
,
logoUrl
,
qrcodeUrl
);
}
pageItemVO
.
setResultUrl
(
qrcodeUrl
);
if
(!
StringUtil
.
isEmpty
(
qrcodeUrl
))
{
...
...
@@ -3193,6 +3271,23 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
return
pageItemVO
;
}
private
String
getQrcodeUrl
(
String
logoUrl
,
String
qrcodeUrl
)
{
String
url
=
""
;
String
tmpDirPath
=
FileUtil
.
getTmpDirPath
();
if
(!
tmpDirPath
.
endsWith
(
File
.
separator
))
{
tmpDirPath
=
tmpDirPath
+
File
.
separator
;
}
File
file
=
FileUtil
.
touch
(
tmpDirPath
+
UUIDUitl
.
generateShort
()
+
".png"
);
HttpUtil
.
downloadFile
(
qrcodeUrl
,
file
);
try
{
url
=
QrCodeUtil
.
decode
(
file
);
}
catch
(
QrCodeException
e
){
log
.
info
(
"解析二维码图片失败,qrcodeUrl:{}"
,
qrcodeUrl
);
}
qrcodeUrl
=
this
.
getLogoQrcode
(
url
,
logoUrl
,
qrcodeUrl
);
return
qrcodeUrl
;
}
@Override
public
ResourcePageDTO
getResourcePageById
(
Long
resourcePageId
)
{
ResourcePageDTO
resourcePageDTO
=
new
ResourcePageDTO
();
...
...
@@ -3577,8 +3672,11 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
}
@Override
public
List
<
ResourceColumnAndServeVO
>
getColumnAndServeListByPageId4Wechat
(
Long
resourcePageId
,
Long
wechatUserId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
,
Integer
enableAdverting
,
Long
navigationId
)
{
List
<
ResourceColumnAndServeVO
>
resourceColumnAndServeVOS
=
this
.
getColumnAndServeListByPageId
(
resourcePageId
,
wechatUserId
,
bookId
,
adviserId
,
channelId
,
enableAdverting
,
navigationId
);
public
List
<
ResourceColumnAndServeVO
>
getColumnAndServeListByPageId4Wechat
(
Long
resourcePageId
,
Long
wechatUserId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
,
Integer
enableAdverting
,
Long
navigationId
,
Long
officialAccountsId
)
{
List
<
ResourceColumnAndServeVO
>
resourceColumnAndServeVOS
=
this
.
getColumnAndServeListByPageId
(
resourcePageId
,
wechatUserId
,
bookId
,
adviserId
,
channelId
,
enableAdverting
,
navigationId
);
//填充自定义图片
if
(
ListUtils
.
isEmpty
(
resourceColumnAndServeVOS
))
{
return
new
ArrayList
<>();
...
...
@@ -3593,9 +3691,143 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
return
new
ArrayList
<>();
}
fillSelfPic
(
resourcePageItemVOList
);
//填充跳转地址
try
{
fillJumpUrl
(
resourcePageItemVOList
,
wechatUserId
,
resourcePageId
,
officialAccountsId
);
}
catch
(
Exception
e
)
{
log
.
error
(
"book.fillJumpUrl失败"
);
}
return
resourceColumnAndServeVOS
;
}
private
void
fillJumpUrl
(
List
<
ResourcePageItemVO
>
resourcePageItemVOList
,
Long
wechatUserId
,
Long
resourcePageId
,
Long
officialAccountsId
)
{
if
(
CollUtil
.
isEmpty
(
resourcePageItemVOList
))
{
return
;
}
List
<
ResourcePageItemVO
>
resourcePageItemVOS
=
resourcePageItemVOList
.
stream
().
filter
(
e
->
AppTypeEnum
.
ARTICLE
.
value
.
equals
(
e
.
getTypeCode
())).
collect
(
Collectors
.
toList
());
if
(
CollUtil
.
isNotEmpty
(
resourcePageItemVOS
))
{
ResourcePage
byId
=
resourcePageDao
.
getById
(
resourcePageId
);
if
(
null
==
byId
||
null
==
byId
.
getSceneId
())
{
return
;
}
List
<
Long
>
appIds
=
resourcePageItemVOS
.
stream
().
map
(
e
->
e
.
getServeId
()).
collect
(
Collectors
.
toList
());
Map
<
Long
,
AppDto
>
appDtoMap
=
appConsr
.
mapByIds
(
appIds
);
resourcePageItemVOS
.
stream
().
forEach
(
e
->
{
if
(
AppTypeEnum
.
ARTICLE
.
value
.
equals
(
e
.
getTypeCode
())
&&
CollUtil
.
isNotEmpty
(
appDtoMap
)
&&
null
!=
appDtoMap
.
get
(
e
.
getServeId
()))
{
AppDto
appDto
=
appDtoMap
.
get
(
e
.
getServeId
());
if
(
appDto
!=
null
&&
!
StringUtil
.
isEmpty
(
appDto
.
getTurnUrl
()))
{
if
(
appDto
.
getTurnUrl
().
contains
(
"5rs.me/"
)
||
appDto
.
getTurnUrl
().
contains
(
"raysgo.com/"
)
||
appDto
.
getTurnUrl
().
contains
(
"raysyun.com/"
)
||
null
==
wechatUserId
)
{
e
.
setResultUrl
(
appDto
.
getTurnUrl
());
}
else
{
//外链跳转到指定中间页
String
jumpUrl
=
BookProps
.
getProductDomain
()
+
"transfer?offId"
+
officialAccountsId
+
"&appId="
+
appDto
.
getAppId
()
+
"&url="
+
URLEncoder
.
encode
(
appDto
.
getTurnUrl
())
+
"&sceneId="
+
byId
.
getSceneId
()
+
"&wechatUserId="
+
wechatUserId
;
e
.
setResultUrl
(
jumpUrl
);
}
}
}
});
}
}
@Override
public
List
<
Integer
>
getColumnTypeByPageId4Wechat
(
Long
resourcePageId
,
Long
wechatUserId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
,
Integer
enableAdverting
,
Long
navigationId
)
{
List
<
Integer
>
columnIdList
=
resourcePageColumnDao
.
getColumnIdListByPageId
(
resourcePageId
,
navigationId
);
if
(
CollUtil
.
isEmpty
(
columnIdList
)){
columnIdList
=
new
ArrayList
<>();
}
columnIdList
.
add
(
0
);
return
columnIdList
;
}
//优化 此处把模块分开调接口 通过columnType
@Override
public
List
<
ResourceColumnAndServeVO
>
getColumnAndServeListByPageId4WechatV2
(
Long
resourcePageId
,
Long
wechatUserId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
,
Integer
enableAdverting
,
Long
navigationId
,
Integer
columnType
,
Long
officialAccountsId
)
{
List
<
ResourceColumnAndServeVO
>
serveVOS
=
new
ArrayList
<>();
if
(
null
!=
columnType
&&
columnType
!=
0
)
{
serveVOS
=
resourcePageColumnDao
.
getColumnListByPageId
(
resourcePageId
,
navigationId
,
columnType
);
if
(
CollUtil
.
isNotEmpty
(
serveVOS
))
{
List
<
ResourcePageItemVO
>
itemVOList
;
if
(
null
!=
wechatUserId
)
{
itemVOList
=
resourcePageItemDao
.
getResourcePageItemByPageId
(
resourcePageId
,
true
);
}
else
{
itemVOList
=
resourcePageItemDao
.
getResourcePageItemByPageId
(
resourcePageId
,
null
);
}
if
(
CollUtil
.
isNotEmpty
(
itemVOList
))
{
//二维码类型
fillQrcodeType
(
resourcePageId
,
itemVOList
);
Map
<
String
,
List
<
ResourcePageItemVO
>>
listMap
=
itemVOList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ResourcePageItemVO:
:
getServeType
));
itemVOList
=
new
ArrayList
<>();
//应用和作品提出来一起查
List
<
ResourcePageItemVO
>
itemAppAndProductVOList
=
new
ArrayList
<>();
//过滤一些资源,重新排序
for
(
Map
.
Entry
<
String
,
List
<
ResourcePageItemVO
>>
entry
:
listMap
.
entrySet
())
{
if
(
ResourcePageConstants
.
ServeTypeEnum
.
APP
.
getValue
().
equals
(
entry
.
getKey
())
||
ServeTypeEnum
.
PRODUCT
.
getValue
().
equals
(
entry
.
getKey
()))
{
itemAppAndProductVOList
.
addAll
(
entry
.
getValue
());
continue
;
}
this
.
fillResourceByType
(
entry
.
getValue
(),
wechatUserId
,
entry
.
getKey
());
itemVOList
.
addAll
(
entry
.
getValue
());
}
if
(
CollUtil
.
isNotEmpty
(
itemAppAndProductVOList
))
{
fillAppProductServe
(
itemAppAndProductVOList
,
wechatUserId
);
itemVOList
.
addAll
(
itemAppAndProductVOList
);
}
itemVOList
.
sort
(
Comparator
.
comparing
(
ResourcePageItemVO:
:
getId
));
Map
<
Long
,
List
<
ResourcePageItemVO
>>
columnMap
=
itemVOList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ResourcePageItemVO:
:
getResourcePageColumnId
));
List
<
ResourceColumnAndServeVO
>
removeColumns
=
new
ArrayList
<>();
for
(
ResourceColumnAndServeVO
columnAndServeVO
:
serveVOS
)
{
List
<
ResourcePageItemVO
>
itemVOS
=
columnMap
.
get
(
columnAndServeVO
.
getResourcePageColumnId
());
if
(
ListUtils
.
isEmpty
(
itemVOS
))
{
removeColumns
.
add
(
columnAndServeVO
);
continue
;
}
columnAndServeVO
.
setItemVOList
(
itemVOS
);
String
serveType
=
itemVOS
.
get
(
0
).
getServeType
();
if
(
ResourcePageConstants
.
ServeTypeEnum
.
APP
.
getValue
().
equals
(
serveType
)
||
(
ResourcePageConstants
.
ServeTypeEnum
.
PRODUCT
.
getValue
().
equals
(
serveType
)))
{
serveType
=
"APP/PRODUCT"
;
}
columnAndServeVO
.
setServeType
(
serveType
);
//图片位
if
(
ResourcePageConstants
.
ColumnTypeEnum
.
PICTURE
.
getCode
().
equals
(
columnAndServeVO
.
getColumnType
()))
{
columnAndServeVO
.
setLogoUrl
(
itemVOS
.
get
(
0
).
getLogoUrl
());
}
}
if
(!
ListUtils
.
isEmpty
(
removeColumns
))
{
serveVOS
.
removeAll
(
removeColumns
);
}
}
}
if
(
CollUtil
.
isEmpty
(
serveVOS
))
{
serveVOS
=
CollUtil
.
toList
();
}
}
else
{
this
.
fillAdvertising
(
serveVOS
,
bookId
,
adviserId
,
channelId
,
enableAdverting
);
}
//填充自定义图片
if
(
ListUtils
.
isEmpty
(
serveVOS
))
{
return
new
ArrayList
<>();
}
List
<
ResourcePageItemVO
>
resourcePageItemVOList
=
new
ArrayList
<>();
serveVOS
.
stream
().
forEach
(
e
->
{
if
(!
ListUtils
.
isEmpty
(
e
.
getItemVOList
()))
{
resourcePageItemVOList
.
addAll
(
e
.
getItemVOList
());
}
});
if
(
ListUtils
.
isEmpty
(
resourcePageItemVOList
))
{
return
new
ArrayList
<>();
}
fillSelfPic
(
resourcePageItemVOList
);
//填充跳转地址
fillJumpUrl
(
resourcePageItemVOList
,
wechatUserId
,
resourcePageId
,
officialAccountsId
);
return
serveVOS
;
}
@Override
public
Integer
saveShareConfig
(
ResourcePageShareParam
param
)
{
checkShareParam
(
param
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/impl/ResourcePageBookstoreBizImpl.java
View file @
2daed7f2
...
...
@@ -99,6 +99,9 @@ public class ResourcePageBookstoreBizImpl implements ResourcePageBookstoreBiz {
@Override
public
List
<
ResourcePageBookstoreVO
>
getByResourcePageId
(
Long
resourcePageId
,
Long
channelId
,
Long
wechatUserId
,
ResourcePageFixtureTypeEnum
fixtureTypeEnum
)
{
if
(
null
==
resourcePageId
)
{
return
CollUtil
.
toList
();
}
List
<
ResourcePageBookstoreVO
>
list
=
resourcePageBookstoreDao
.
getByResourcePageId
(
resourcePageId
,
fixtureTypeEnum
.
fixtureType
);
if
(
CollUtil
.
isEmpty
(
list
)){
return
CollUtil
.
toList
();
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/BookAppletSceneDao.java
View file @
2daed7f2
...
...
@@ -55,4 +55,8 @@ public interface BookAppletSceneDao extends BaseDao<BookAppletScene> {
* @return
*/
BookAppletSceneDTO
getBookAppletByBookId
(
Long
bookId
,
Long
channelId
,
Long
adviserId
);
String
getAppletIdByBookGroupId
(
Long
bookGroupId
);
String
getAppletIdBySceneId
(
Long
sceneId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/ResourcePageCollectDao.java
View file @
2daed7f2
...
...
@@ -27,4 +27,6 @@ public interface ResourcePageCollectDao extends BaseDao<ResourcePageCollect>{
* * @param null
*/
Integer
getUserIsNotNew
(
Long
wechatUserId
);
Integer
getCollectStateByUser
(
Long
wechatUserId
,
Long
resourcePageId
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/ResourcePageColumnDao.java
View file @
2daed7f2
...
...
@@ -29,7 +29,9 @@ public interface ResourcePageColumnDao extends BaseDao<ResourcePageColumn> {
* @date:2021/3/29 13:45
* * @param null
*/
List
<
ResourceColumnAndServeVO
>
getColumnListByPageId
(
Long
resourcePageId
,
Long
navigationId
);
List
<
ResourceColumnAndServeVO
>
getColumnListByPageId
(
Long
resourcePageId
,
Long
navigationId
,
Integer
columnType
);
List
<
Integer
>
getColumnIdListByPageId
(
Long
resourcePageId
,
Long
navigationId
);
/**
* 根据类型查询
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/ResourcePageDao.java
View file @
2daed7f2
...
...
@@ -125,4 +125,8 @@ public interface ResourcePageDao extends BaseDao<ResourcePage>{
* * @param null
*/
void
updateNavigationFormat
(
Long
resourcePageId
,
Integer
navigationColor
,
Integer
navigationFormat
,
Integer
navigationJumpType
);
Long
getBookIdByBookGroupId
(
Long
bookGroupId
);
Long
getBookIdBySceneId
(
Long
sceneId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/impl/BookAppletSceneDaoImpl.java
View file @
2daed7f2
...
...
@@ -56,4 +56,14 @@ public class BookAppletSceneDaoImpl extends BaseDaoImpl<BookAppletScene> impleme
map
.
put
(
"adviserId"
,
adviserId
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getBookAppletByBookId"
),
map
);
}
@Override
public
String
getAppletIdByBookGroupId
(
Long
bookGroupId
)
{
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getAppletIdByBookGroupId"
),
bookGroupId
);
}
@Override
public
String
getAppletIdBySceneId
(
Long
sceneId
)
{
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getAppletIdBySceneId"
),
sceneId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/impl/ResourcePageCollectDaoImpl.java
View file @
2daed7f2
...
...
@@ -31,4 +31,12 @@ public class ResourcePageCollectDaoImpl extends BaseDaoImpl<ResourcePageCollect>
public
Integer
getUserIsNotNew
(
Long
wechatUserId
)
{
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getUserIsNotNew"
),
wechatUserId
);
}
@Override
public
Integer
getCollectStateByUser
(
Long
wechatUserId
,
Long
resourcePageId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"wechatUserId"
,
wechatUserId
);
map
.
put
(
"resourcePageId"
,
resourcePageId
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getCollectStateByUser"
),
map
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/impl/ResourcePageColumnDaoImpl.java
View file @
2daed7f2
...
...
@@ -30,14 +30,23 @@ public class ResourcePageColumnDaoImpl extends BaseDaoImpl<ResourcePageColumn> i
}
@Override
public
List
<
ResourceColumnAndServeVO
>
getColumnListByPageId
(
Long
resourcePageId
,
Long
navigationId
)
{
public
List
<
ResourceColumnAndServeVO
>
getColumnListByPageId
(
Long
resourcePageId
,
Long
navigationId
,
Integer
columnType
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"navigationId"
,
navigationId
);
map
.
put
(
"resourcePageId"
,
resourcePageId
);
map
.
put
(
"columnType"
,
columnType
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getColumnListByPageId"
),
map
);
}
@Override
public
List
<
Integer
>
getColumnIdListByPageId
(
Long
resourcePageId
,
Long
navigationId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"navigationId"
,
navigationId
);
map
.
put
(
"resourcePageId"
,
resourcePageId
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getColumnIdListByPageId"
),
map
);
}
@Override
public
List
<
ResourcePageColumn
>
getByColumnTypeAndPage
(
Long
resourcePageId
,
Integer
columnType
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"resourcePageId"
,
resourcePageId
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/impl/ResourcePageDaoImpl.java
View file @
2daed7f2
...
...
@@ -166,4 +166,14 @@ public class ResourcePageDaoImpl extends BaseDaoImpl<ResourcePage> implements Re
map
.
put
(
"navigationJumpType"
,
navigationJumpType
);
getSessionTemplate
().
update
(
getStatement
(
"updateNavigationFormat"
),
map
);
}
@Override
public
Long
getBookIdByBookGroupId
(
Long
bookGroupId
)
{
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getBookIdByBookGroupId"
),
bookGroupId
);
}
@Override
public
Long
getBookIdBySceneId
(
Long
sceneId
)
{
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getBookIdBySceneId"
),
sceneId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/facade/impl/ResourcePageFacade.java
View file @
2daed7f2
...
...
@@ -108,7 +108,40 @@ public class ResourcePageFacade {
@RequestParam
(
value
=
"enableAdverting"
,
required
=
false
)
Integer
enableAdverting
,
@RequestParam
(
value
=
"navigationId"
,
required
=
false
)
Long
navigationId
){
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
resourcePageBiz
.
getColumnAndServeListByPageId4Wechat
(
resourcePageId
,
wechatUserId
,
bookId
,
adviserId
,
channelId
,
enableAdverting
,
navigationId
));
Long
officialAccountsId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
return
new
ResponseDto
<>(
resourcePageBiz
.
getColumnAndServeListByPageId4Wechat
(
resourcePageId
,
wechatUserId
,
bookId
,
adviserId
,
channelId
,
enableAdverting
,
navigationId
,
officialAccountsId
));
}
//优化 此处把模块分开调接口
@ApiOperation
(
"客户端-根据页面id查资源页栏目分类"
)
@GetMapping
(
"getColumnTypeByPageId4Wechat"
)
public
ResponseDto
<?>
getColumnTypeByPageId4Wechat
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"resourcePageId"
)
Long
resourcePageId
,
@RequestParam
(
value
=
"bookId"
,
required
=
false
)
Long
bookId
,
@RequestParam
(
value
=
"adviserId"
,
required
=
false
)
Long
adviserId
,
@RequestParam
(
value
=
"channelId"
,
required
=
false
)
Long
channelId
,
@RequestParam
(
value
=
"enableAdverting"
,
required
=
false
)
Integer
enableAdverting
,
@RequestParam
(
value
=
"navigationId"
,
required
=
false
)
Long
navigationId
){
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
resourcePageBiz
.
getColumnTypeByPageId4Wechat
(
resourcePageId
,
wechatUserId
,
bookId
,
adviserId
,
channelId
,
enableAdverting
,
navigationId
));
}
//优化 此处把模块分开调接口 columnType
@ApiOperation
(
"客户端-根据页面id查资源页栏目及资源"
)
@GetMapping
(
"getColumnAndServeListByPageId4WechatV2"
)
public
ResponseDto
<?>
getColumnAndServeListByPageId4WechatV2
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"resourcePageId"
)
Long
resourcePageId
,
@RequestParam
(
value
=
"bookId"
,
required
=
false
)
Long
bookId
,
@RequestParam
(
value
=
"adviserId"
,
required
=
false
)
Long
adviserId
,
@RequestParam
(
value
=
"channelId"
,
required
=
false
)
Long
channelId
,
@RequestParam
(
value
=
"enableAdverting"
,
required
=
false
)
Integer
enableAdverting
,
@RequestParam
(
value
=
"navigationId"
,
required
=
false
)
Long
navigationId
,
@RequestParam
(
value
=
"columnType"
,
required
=
false
)
Integer
columnType
){
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Long
officialAccountsId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
return
new
ResponseDto
<>(
resourcePageBiz
.
getColumnAndServeListByPageId4WechatV2
(
resourcePageId
,
wechatUserId
,
bookId
,
adviserId
,
channelId
,
enableAdverting
,
navigationId
,
columnType
,
officialAccountsId
));
}
@ApiOperation
(
"客户端分页查栏目资源"
)
...
...
pcloud-service-book/src/main/java/com/pcloud/book/util/common/CommonUtils.java
View file @
2daed7f2
...
...
@@ -2,6 +2,7 @@ package com.pcloud.book.util.common;
import
java.util.*
;
import
cn.hutool.core.util.StrUtil
;
import
com.pcloud.common.utils.DateNewUtils
;
import
com.pcloud.common.utils.ListUtils
;
...
...
@@ -166,4 +167,22 @@ public class CommonUtils {
calendar
.
set
(
14
,
0
);
return
calendar
.
getTime
();
}
public
static
Long
getSceneId
(
String
url
)
{
if
(
StrUtil
.
isEmpty
(
url
)
||
!
url
.
contains
(
"sceneId"
))
{
return
null
;
}
String
sceneIdStr
=
null
;
Long
sceneId
=
null
;
try
{
sceneIdStr
=
url
.
substring
(
url
.
indexOf
(
"sceneId"
)
+
8
,
url
.
indexOf
(
"&"
,
url
.
indexOf
(
"sceneId"
)));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
if
(
StrUtil
.
isNotEmpty
(
sceneIdStr
))
{
sceneId
=
Long
.
valueOf
(
sceneIdStr
);
}
return
sceneId
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/util/common/ThreadPoolUtils.java
View file @
2daed7f2
...
...
@@ -106,8 +106,9 @@ public class ThreadPoolUtils {
/**
* 远程调用线程池
* maximumPoolSize设置大一些,避免阻塞
*/
public
static
final
ThreadPoolExecutor
REMOTE_CALL_POOL
=
new
ThreadPoolExecutor
(
8
,
8
,
0
,
TimeUnit
.
SECONDS
,
public
static
final
ThreadPoolExecutor
REMOTE_CALL_POOL
=
new
ThreadPoolExecutor
(
8
,
12
8
,
0
,
TimeUnit
.
SECONDS
,
new
LinkedBlockingQueue
<>(),
new
ThreadFactoryBuilder
().
setNameFormat
(
"remote-call-pool-%d"
).
build
(),
new
ThreadPoolExecutor
.
CallerRunsPolicy
());
/**
* 书刊记录埋点线程池
...
...
pcloud-service-book/src/main/java/com/pcloud/book/util/properties/BookProps.java
View file @
2daed7f2
...
...
@@ -161,4 +161,16 @@ public class BookProps {
public
void
setMiniOfficialAccountsId
(
Long
miniOfficialAccountsId
)
{
BookProps
.
miniOfficialAccountsId
=
miniOfficialAccountsId
;
}
private
static
String
productDomain
;
public
static
String
getProductDomain
()
{
return
productDomain
;
}
@Value
(
"${PRODUCT_DOMAIN}"
)
public
void
setProductDomain
(
String
productDomain
)
{
BookProps
.
productDomain
=
productDomain
;
}
}
pcloud-service-book/src/main/resources/mapper/book/BookAdviser.Mapper.xml
View file @
2daed7f2
...
...
@@ -1406,4 +1406,18 @@
HAVING bookCount >= #{bookCount}
</if>
</select>
<select
id=
"getBookIsOpenCatalog"
resultType=
"integer"
parameterType=
"map"
>
SELECT
IFNULL(is_open_catalog,0)
FROM
BOOK_ADVISER
WHERE
BOOK_ID = #{bookId}
AND
CHANNEL_ID = #{channelId}
AND
ADVISER_ID = #{adviserId}
</select>
</mapper>
pcloud-service-book/src/main/resources/mapper/group/BookAppletScene.xml
View file @
2daed7f2
...
...
@@ -141,4 +141,22 @@
limit 1
</select>
<select
id=
"getAppletIdByBookGroupId"
parameterType=
"long"
resultType=
"string"
>
SELECT
applet_id
FROM book_applet_scene
WHERE book_group_id=#{bookGroupId}
AND is_delete = 0
limit 1
</select>
<select
id=
"getAppletIdBySceneId"
parameterType=
"long"
resultType=
"string"
>
SELECT
applet_id
FROM book_applet_scene
WHERE scene_id=#{sceneId}
AND is_delete = 0
limit 1
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/group/ResourcePageCollectDao.xml
View file @
2daed7f2
...
...
@@ -71,4 +71,14 @@
and is_new = 0
</select>
<select
id=
"getCollectStateByUser"
parameterType=
"map"
resultType=
"integer"
>
select
collect_state
from resource_page_collect
where resource_page_id = #{resourcePageId}
and wechat_user_id = #{wechatUserId}
and collect_state = 1
limit 1
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/group/ResourcePageColumnDao.xml
View file @
2daed7f2
...
...
@@ -125,11 +125,26 @@
<if
test=
"navigationId != null"
>
and navigation_id = #{navigationId}
</if>
<if
test=
"columnType!=null"
>
and column_type = #{columnType}
</if>
ORDER BY
column_seq ASC,
id ASC
</select>
<select
id=
"getColumnIdListByPageId"
resultType=
"Integer"
parameterType=
"map"
>
SELECT
DISTINCT column_type
FROM
resource_page_column
WHERE
resource_page_id = #{resourcePageId}
<if
test=
"navigationId != null"
>
and navigation_id = #{navigationId}
</if>
</select>
<select
id=
"getByColumnTypeAndPage"
parameterType=
"map"
resultMap=
"ResourcePageColumnMap"
>
select
id, resource_page_id, column_type, column_name, column_format, column_seq, show_more, show_count, create_time, navigation_id, background_type, background_url
...
...
pcloud-service-book/src/main/resources/mapper/group/ResourcePageDao.xml
View file @
2daed7f2
...
...
@@ -355,4 +355,20 @@
where id = #{id}
</select>
<select
id=
"getBookIdByBookGroupId"
parameterType=
"long"
resultType=
"long"
>
select
book_id
from resource_page
where book_group_id = #{bookGroupId}
limit 1
</select>
<select
id=
"getBookIdBySceneId"
parameterType=
"long"
resultType=
"long"
>
select
book_id
from resource_page
where scene_id = #{sceneId}
limit 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