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
24fee56a
Commit
24fee56a
authored
Nov 25, 2020
by
田超
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/1003871' into 'master'
feat:[1003871] 小程序站内信 See merge request rays/pcloud-book!1051
parents
f1862198
783ae2a0
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
277 additions
and
18 deletions
+277
-18
SearchRecordDao.java
...c/main/java/com/pcloud/book/book/dao/SearchRecordDao.java
+1
-1
SearchRecordDaoImpl.java
...va/com/pcloud/book/book/dao/impl/SearchRecordDaoImpl.java
+2
-2
ReaderConsr.java
...ain/java/com/pcloud/book/consumer/reader/ReaderConsr.java
+37
-0
CultivateNotifyBizImpl.java
...cloud/book/cultivate/biz/impl/CultivateNotifyBizImpl.java
+158
-4
NotifyParamCheck.java
...ava/com/pcloud/book/cultivate/check/NotifyParamCheck.java
+1
-1
CultivateNotifyDTO.java
...ava/com/pcloud/book/cultivate/dto/CultivateNotifyDTO.java
+14
-1
CultivateNotifyPageDTO.java
...com/pcloud/book/cultivate/dto/CultivateNotifyPageDTO.java
+1
-1
SearchSendUserDTO.java
...java/com/pcloud/book/cultivate/dto/SearchSendUserDTO.java
+2
-0
CultivateNotifyItem.java
...com/pcloud/book/cultivate/entity/CultivateNotifyItem.java
+29
-1
NotifySendTypeEnum.java
...a/com/pcloud/book/cultivate/enums/NotifySendTypeEnum.java
+5
-1
CultivateNotifyFacade.java
...m/pcloud/book/cultivate/facade/CultivateNotifyFacade.java
+2
-2
SearchRecord.xml
...vice-book/src/main/resources/mapper/book/SearchRecord.xml
+6
-1
CultivateNotifyItem.xml
...c/main/resources/mapper/cultivate/CultivateNotifyItem.xml
+19
-3
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/book/dao/SearchRecordDao.java
View file @
24fee56a
...
...
@@ -22,5 +22,5 @@ public interface SearchRecordDao extends BaseDao<SearchRecord> {
List
<
AdviserBookInfoDTO
>
getBookSearchIds
(
String
keyword
,
Integer
currentPage
,
Integer
numPerPage
);
List
<
Long
>
getWechatUserIds
(
L
ong
bookId
);
List
<
Long
>
getWechatUserIds
(
L
ist
<
Long
>
bookIds
);
}
pcloud-service-book/src/main/java/com/pcloud/book/book/dao/impl/SearchRecordDaoImpl.java
View file @
24fee56a
...
...
@@ -64,9 +64,9 @@ public class SearchRecordDaoImpl extends BaseDaoImpl<SearchRecord> implements Se
}
@Override
public
List
<
Long
>
getWechatUserIds
(
L
ong
bookId
)
{
public
List
<
Long
>
getWechatUserIds
(
L
ist
<
Long
>
bookIds
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"bookId
"
,
bookId
);
map
.
put
(
"bookId
s"
,
bookIds
);
return
super
.
getSqlSession
().
selectList
(
super
.
getStatement
(
"getWechatUserIds"
),
map
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/consumer/reader/ReaderConsr.java
View file @
24fee56a
...
...
@@ -5,6 +5,7 @@ import com.pcloud.book.applet.dto.SpecialBookDTO;
import
com.pcloud.channelcenter.base.exceptions.ChannelBizException
;
import
com.pcloud.readercenter.wechat.dto.NickNameAndOpenIdDto
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -271,6 +272,42 @@ public class ReaderConsr {
}
return
wechatUserIds
;
}
public
List
<
Long
>
getWechatUserIdsByUserProfile
(
String
cityCode
,
String
startTime
,
String
endTime
)
{
LOGGER
.
info
(
"根据名称或id获取用户id"
);
List
<
Long
>
wechatUserIds
=
new
ArrayList
<>();
try
{
wechatUserIds
=
ResponseHandleUtil
.
parseList
(
wechatUserService
.
getWechatUserIdsByUserProfile
(
cityCode
,
startTime
,
endTime
),
Long
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"根据用户画像获取用户id.[getWechatUserByNameOrId]失败"
+
e
.
getMessage
(),
e
);
}
return
wechatUserIds
;
}
public
List
<
MiniUserDto
>
getSendUserInfo
(
List
<
Long
>
wechatUserIds
)
{
if
(
ListUtils
.
isEmpty
(
wechatUserIds
)){
return
new
ArrayList
<>();
}
List
<
MiniUserDto
>
result
=
new
ArrayList
<>();
try
{
ResponseEntity
<
ResponseDto
<
List
<
MiniUserDto
>>>
sendUserRobotInfo
=
wechatUserService
.
getSendUserInfo
(
wechatUserIds
);
result
=
ResponseHandleUtil
.
parseList
(
sendUserRobotInfo
,
MiniUserDto
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"获取小程序和小睿关系失败:"
+
e
.
getMessage
(),
e
);
}
return
result
;
}
public
List
<
Long
>
getMiniUsersByBookIds
(
List
<
Long
>
bookIds
)
{
LOGGER
.
info
(
"根据名称或id获取用户id"
);
List
<
Long
>
wechatUserIds
=
new
ArrayList
<>();
try
{
wechatUserIds
=
ResponseHandleUtil
.
parseList
(
wechatUserService
.
getMiniUsersByBookIds
(
bookIds
),
Long
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"根据用户画像获取用户id.[getWechatUserByNameOrId]失败"
+
e
.
getMessage
(),
e
);
}
return
wechatUserIds
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/biz/impl/CultivateNotifyBizImpl.java
View file @
24fee56a
package
com
.
pcloud
.
book
.
cultivate
.
biz
.
impl
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.google.common.collect.Maps
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.book.applet.biz.AppletNewsBiz
;
import
com.pcloud.book.applet.dto.AppletBannerDTO
;
import
com.pcloud.book.applet.dto.AppletNewsDTO
;
import
com.pcloud.book.applet.dto.ServeItemInfoDTO
;
import
com.pcloud.book.applet.enums.AppletRecordTypeEnum
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.dao.BookDao
;
import
com.pcloud.book.book.dao.SearchRecordDao
;
import
com.pcloud.book.book.dto.AdviserBookInfoDTO
;
import
com.pcloud.book.consumer.app.AppConsr
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.consumer.content.ResourceConsr
;
import
com.pcloud.book.consumer.message.TemplateConsr
;
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.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.cultivate.biz.CultivateNotifyBiz
;
...
...
@@ -26,17 +36,22 @@ import com.pcloud.book.cultivate.entity.CultivateNotify;
import
com.pcloud.book.cultivate.entity.CultivateNotifyItem
;
import
com.pcloud.book.cultivate.entity.CultivateNotifySend
;
import
com.pcloud.book.cultivate.enums.NotifySendTypeEnum
;
import
com.pcloud.book.group.tools.SendWeixinRequestTools
;
import
com.pcloud.book.util.common.ThreadPoolUtils
;
import
com.pcloud.channelcenter.wechat.dto.AccountSettingDto
;
import
com.pcloud.common.core.dto.AppletTemplateMessageDto
;
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.ServeLinkUtils
;
import
com.pcloud.contentcenter.resource.dto.ResourceDTO
;
import
com.pcloud.readercenter.wechat.dto.MiniUserDto
;
import
com.pcloud.readercenter.wechat.dto.ReaderMessageDto
;
import
com.pcloud.resourcecenter.product.dto.ProductDto
;
import
com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto
;
import
com.pcloud.wechatgroup.selfrobot.dto.SendMessageDTO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.MapUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
@@ -49,9 +64,12 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.ExecutionException
;
import
java.util.stream.Collectors
;
@Component
(
"cultivateNotifyBiz"
)
@Slf4j
public
class
CultivateNotifyBizImpl
implements
CultivateNotifyBiz
{
@Autowired
...
...
@@ -81,6 +99,12 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
private
QrcodeSceneConsr
qrcodeSceneConsr
;
private
final
Integer
SEND_BATCH_NUM
=
100
;
@Autowired
private
AppletNewsBiz
appletNewsBiz
;
@Autowired
private
AppConsr
appConsr
;
@Autowired
private
ProductConsr
productConsr
;
@Override
...
...
@@ -109,6 +133,7 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
CultivateNotifyDTO
notifyDTO
=
new
CultivateNotifyDTO
();
List
<
CultivateNotifyItem
>
list
=
cultivateNotifyItemDao
.
getNotifyItemsByMessageId
(
messageId
);
fillResource
(
list
);
fillAppOrProduct4Notify
(
list
);
notifyDTO
.
setCultivateNotifyItems
(
list
);
CultivateNotify
byId
=
cultivateNotifyDao
.
getById
(
messageId
);
notifyDTO
.
setMessageType
(
byId
.
getMessageType
());
...
...
@@ -130,11 +155,12 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
map
.
put
(
"wechatUserId"
,
wechatUserId
);
map
.
put
(
"messageType"
,
messageType
);
PageBeanNew
<
CultivateNotifyDTO
>
pageBeanNew
=
cultivateNotifySendDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
map
,
"getNotifyListByType"
);
List
<
CultivateNotifyItem
>
cultivateNotifyItemList
=
new
ArrayList
<>();
for
(
CultivateNotifyDTO
cultivateNotifyDTO:
pageBeanNew
.
getRecordList
())
{
List
<
CultivateNotifyItem
>
list1
=
cultivateNotifyItemDao
.
getNotifyItemsByMessageId
(
cultivateNotifyDTO
.
getMessageId
());
fillResource
(
list1
);
cultivateNotifyDTO
.
setCultivateNotifyItems
(
list1
);
cultivateNotifyItemList
.
addAll
(
list1
);
}
//批量更新消息已读未读
List
<
CultivateNotifySend
>
notifySends
=
cultivateNotifySendDao
.
getNotifySendsByType
(
wechatUserId
,
messageType
);
...
...
@@ -144,7 +170,8 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
notifySend
.
setUpdateTime
(
new
Date
());
cultivateNotifySendDao
.
update
(
notifySend
);
}
//填充资讯应用作品
fillAppOrProduct4Notify
(
cultivateNotifyItemList
);
return
pageBeanNew
;
}
...
...
@@ -210,7 +237,7 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
}
//书刊发送
if
(
NotifySendTypeEnum
.
BOOK_USER
.
value
.
equals
(
cultivateNotifyDTO
.
getSendType
())){
List
<
Long
>
wechatUserIds
=
searchRecordDao
.
getWechatUserIds
(
cultivateNotifyDTO
.
getBookId
());
List
<
Long
>
wechatUserIds
=
readerConsr
.
getMiniUsersByBookIds
(
cultivateNotifyDTO
.
getBookIds
());
if
(
ListUtils
.
isEmpty
(
wechatUserIds
)){
return
;
}
...
...
@@ -246,6 +273,34 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
readerMessageDto
.
setOfficialAccountsId
(
accountSettingId
);
readerConsr
.
sendNotifyMiniUser
(
readerMessageDto
);
}
//用户画像发送
if
(
NotifySendTypeEnum
.
USER_PROFILE
.
value
.
equals
(
cultivateNotifyDTO
.
getSendType
()))
{
List
<
Long
>
wechatUserIds
=
readerConsr
.
getWechatUserIdsByUserProfile
(
cultivateNotifyDTO
.
getCityCode
(),
cultivateNotifyDTO
.
getStartTime
(),
cultivateNotifyDTO
.
getEndTime
());
if
(
ListUtils
.
isEmpty
(
wechatUserIds
)){
return
;
}
for
(
int
i
=
0
;
i
<=
wechatUserIds
.
size
()
/
SEND_BATCH_NUM
;
i
++)
{
int
beginIndex
=
i
*
SEND_BATCH_NUM
;
int
endIndex
=
beginIndex
+
SEND_BATCH_NUM
;
if
(
i
==
(
wechatUserIds
.
size
()
-
1
)/
SEND_BATCH_NUM
){
endIndex
=
wechatUserIds
.
size
();
}
List
<
Long
>
subList
=
wechatUserIds
.
subList
(
beginIndex
,
endIndex
);
List
<
CultivateNotifySend
>
cultivateNotifySendList
=
new
ArrayList
<>();
if
(!
ListUtils
.
isEmpty
(
subList
)){
for
(
Long
wechatUserId
:
subList
)
{
CultivateNotifySend
cultivateNotifySend
=
new
CultivateNotifySend
();
cultivateNotifySend
.
setMessageId
(
cultivateNotify
.
getMessageId
());
cultivateNotifySend
.
setMessageType
(
cultivateNotifyDTO
.
getMessageType
());
cultivateNotifySend
.
setSendType
(
cultivateNotifyDTO
.
getSendType
());
cultivateNotifySend
.
setWechatUserId
(
wechatUserId
);
cultivateNotifySendList
.
add
(
cultivateNotifySend
);
}
cultivateNotifySendDao
.
insert
(
cultivateNotifySendList
);
sendAppletTemplateMessage
(
cultivateNotifySendList
,
cultivateNotify
.
getAgentId
());
}
}
}
}
/**
...
...
@@ -302,6 +357,7 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
List
<
CultivateNotifyItem
>
cultivateNotifyItems
=
cultivateNotifyItemDao
.
getByMessageIds
(
messageIds
);
itemMap
=
cultivateNotifyItems
.
stream
().
collect
(
Collectors
.
groupingBy
(
a
->
a
.
getMessageId
()));
}
List
<
CultivateNotifyItem
>
cultivateNotifyItems
=
new
ArrayList
<>();
for
(
CultivateNotifyPageDTO
cultivateNotifyPageDTO
:
list
)
{
/* if(MapUtils.isNotEmpty(titleMap) && titleMap.containsKey(cultivateNotifyPageDTO.getMessageId())){
cultivateNotifyPageDTO.setTitle(titleMap.get(cultivateNotifyPageDTO.getMessageId()));
...
...
@@ -311,6 +367,104 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
}
if
(!
ListUtils
.
isEmpty
(
cultivateNotifyPageDTO
.
getCultivateNotifyItems
())){
fillResource
(
cultivateNotifyPageDTO
.
getCultivateNotifyItems
());
cultivateNotifyItems
.
addAll
(
cultivateNotifyPageDTO
.
getCultivateNotifyItems
());
}
}
//填充资讯应用作品
fillAppOrProduct4Notify
(
cultivateNotifyItems
);
}
private
void
fillAppOrProduct4Notify
(
List
<
CultivateNotifyItem
>
cultivateNotifyItems
)
{
if
(
ListUtils
.
isEmpty
(
cultivateNotifyItems
))
{
return
;
}
// 获取资讯信息
Map
<
Long
,
AppletNewsDTO
>
newsDTOMap
=
new
HashMap
<>();
CompletableFuture
<
List
<
Long
>>
newsBannerFuture
=
CompletableFuture
.
supplyAsync
(()
->
cultivateNotifyItems
.
stream
()
.
filter
(
x
->
Objects
.
nonNull
(
x
)
&&
Objects
.
equals
(
x
.
getJumpType
(),
3
))
.
map
(
CultivateNotifyItem:
:
getServeId
).
filter
(
Objects:
:
nonNull
).
distinct
()
.
collect
(
Collectors
.
toList
())).
whenComplete
((
list
,
throwable
)
->
{
if
(
Objects
.
nonNull
(
throwable
))
{
log
.
error
(
"[fillServeInfo] banner 图填充资讯信息失败,err:{}"
,
throwable
.
getMessage
(),
throwable
);
}
else
{
if
(
CollUtil
.
isEmpty
(
list
)){
return
;
}
Map
<
Long
,
AppletNewsDTO
>
dtoMap
=
appletNewsBiz
.
getByIds
(
list
);
newsDTOMap
.
putAll
(
Objects
.
nonNull
(
dtoMap
)
?
dtoMap
:
new
HashMap
<>());
}
});
// 获取应用信息
Map
<
Long
,
AppDto
>
appDtoMap
=
new
HashMap
<>();
CompletableFuture
<
List
<
Long
>>
appBannerFuture
=
CompletableFuture
.
supplyAsync
(()
->
cultivateNotifyItems
.
stream
()
.
filter
(
x
->
Objects
.
nonNull
(
x
)
&&
Objects
.
equals
(
x
.
getServeType
(),
AppletRecordTypeEnum
.
APP
.
value
))
.
map
(
CultivateNotifyItem:
:
getServeId
).
collect
(
Collectors
.
toList
())).
whenComplete
((
list
,
throwable
)
->
{
if
(
Objects
.
nonNull
(
throwable
))
{
log
.
error
(
"[fillServeInfo] banner 图填充应用信息失败,err:{}"
,
throwable
.
getMessage
(),
throwable
);
}
else
{
Map
<
Long
,
AppDto
>
dtoMap
=
!
ListUtils
.
isEmpty
(
list
)
?
appConsr
.
mapByIds4AuditPass
(
list
)
:
new
HashMap
<>();
appDtoMap
.
putAll
(
dtoMap
);
}
});
// 获取作品信息
Map
<
Long
,
ProductDto
>
productDtoMap
=
new
HashMap
<>();
CompletableFuture
<
List
<
Long
>>
productBannerFuture
=
CompletableFuture
.
supplyAsync
(()
->
cultivateNotifyItems
.
stream
()
.
filter
(
x
->
Objects
.
nonNull
(
x
)
&&
Objects
.
equals
(
x
.
getServeType
(),
AppletRecordTypeEnum
.
PRODUCT
.
value
))
.
map
(
CultivateNotifyItem:
:
getServeId
).
collect
(
Collectors
.
toList
())).
whenComplete
((
list
,
throwable
)
->
{
if
(
Objects
.
nonNull
(
throwable
))
{
log
.
error
(
"[fillServeInfo] banner 图填充作品信息失败,err:{}"
,
throwable
.
getMessage
(),
throwable
);
}
else
{
Map
<
Long
,
ProductDto
>
dtoMap
=
!
ListUtils
.
isEmpty
(
list
)
?
productConsr
.
getProBasesByIds
(
list
)
:
new
HashMap
<>();
productDtoMap
.
putAll
(
dtoMap
);
}
});
try
{
CompletableFuture
.
allOf
(
newsBannerFuture
,
appBannerFuture
,
productBannerFuture
).
get
();
}
catch
(
InterruptedException
|
ExecutionException
e
)
{
log
.
error
(
"[fillServeInfo] banner 填充信息失败,err:{}"
,
e
.
getMessage
(),
e
);
}
// 填充信息
for
(
CultivateNotifyItem
banner
:
cultivateNotifyItems
)
{
if
(
Objects
.
nonNull
(
banner
)
&&
Objects
.
nonNull
(
banner
.
getServeId
())
&&
Objects
.
nonNull
(
banner
.
getServeType
()))
{
Integer
serveType
=
banner
.
getServeType
();
if
(
Objects
.
equals
(
banner
.
getJumpType
(),
3
)
&&
Objects
.
nonNull
(
newsDTOMap
.
get
(
banner
.
getServeId
())))
{
banner
.
setNewsItem
(
newsDTOMap
.
get
(
banner
.
getServeId
()));
}
else
if
(
Objects
.
equals
(
serveType
,
AppletRecordTypeEnum
.
APP
.
value
)
&&
Objects
.
nonNull
(
appDtoMap
.
get
(
banner
.
getServeId
())))
{
AppDto
appDto
=
appDtoMap
.
get
(
banner
.
getServeId
());
String
resultLinkUrl
=
null
;
if
(
Objects
.
nonNull
(
appDto
.
getChannelId
()))
{
AccountSettingDto
accountSettingDto
=
qrcodeSceneConsr
.
getWechatInfo
(
appDto
.
getChannelId
());
// 根据 APP 拼接 linkUrl
String
linkUrl
=
ServeLinkUtils
.
getServeLink
(
"APP"
,
appDto
.
getTypeCode
(),
appDto
.
getAppId
().
toString
(),
appDto
.
getSceneCode
(),
appDto
.
getChannelId
().
toString
(),
appDto
.
getCreatedUser
().
toString
(),
null
);
if
(
Objects
.
nonNull
(
accountSettingDto
))
{
resultLinkUrl
=
SendWeixinRequestTools
.
splitUrl
(
accountSettingDto
,
linkUrl
);
}
}
ServeItemInfoDTO
build
=
ServeItemInfoDTO
.
builder
().
serveId
(
appDto
.
getAppId
()).
serveType
(
serveType
)
.
serveName
(
appDto
.
getTitle
()).
servePic
(
appDto
.
getSquareImg
()).
transverseImg
(
appDto
.
getTransverseImg
())
.
resultUrl
(
resultLinkUrl
).
hasThirdLink
(
StrUtil
.
isNotBlank
(
appDto
.
getTurnUrl
()))
.
serveTypeName
(
appDto
.
getTypeName
()).
build
();
banner
.
setAppItem
(
build
);
}
else
if
(
Objects
.
equals
(
serveType
,
AppletRecordTypeEnum
.
PRODUCT
.
value
)
&&
Objects
.
nonNull
(
productDtoMap
.
get
(
banner
.
getServeId
())))
{
ProductDto
productDto
=
productDtoMap
.
get
(
banner
.
getServeId
());
String
resultLinkUrl
=
null
;
if
(
Objects
.
nonNull
(
productDto
.
getChannelId
()))
{
AccountSettingDto
accountSettingDto
=
qrcodeSceneConsr
.
getWechatInfo
(
productDto
.
getChannelId
());
if
(
null
!=
accountSettingDto
)
{
resultLinkUrl
=
SendWeixinRequestTools
.
splitUrl
(
accountSettingDto
,
productDto
.
getTurnUrl
());
}
}
ServeItemInfoDTO
build
=
ServeItemInfoDTO
.
builder
().
serveId
(
productDto
.
getProductId
()).
serveType
(
serveType
)
.
serveName
(
productDto
.
getProductName
()).
servePic
(
productDto
.
getCoverImg
()).
transverseImg
(
productDto
.
getPicture1
())
.
resultUrl
(
resultLinkUrl
).
hasThirdLink
(
StrUtil
.
isNotBlank
(
productDto
.
getSkipUrl
()))
.
serveTypeName
(
productDto
.
getShortName
()).
build
();
banner
.
setAppItem
(
build
);
}
}
}
}
...
...
@@ -325,7 +479,7 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
return
new
PageBeanNew
<>(
searchSendUserDTO
.
getCurrentPage
(),
searchSendUserDTO
.
getNumPerPage
(),
new
ArrayList
<>());
}
List
<
Long
>
sendUserIds
=
cultivateNotifySendDao
.
getSendUserIds
(
searchSendUserDTO
.
getMessageId
(),
searchSendUserDTO
.
getCurrentPage
(),
searchSendUserDTO
.
getNumPerPage
());
List
<
MiniUserDto
>
list
=
readerConsr
.
getSendUser
Robot
Info
(
sendUserIds
);
List
<
MiniUserDto
>
list
=
readerConsr
.
getSendUserInfo
(
sendUserIds
);
return
new
PageBeanNew
<>(
searchSendUserDTO
.
getCurrentPage
(),
searchSendUserDTO
.
getNumPerPage
(),
count
,
list
);
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/check/NotifyParamCheck.java
View file @
24fee56a
...
...
@@ -40,7 +40,7 @@ public class NotifyParamCheck {
}
}
if
(
NotifySendTypeEnum
.
BOOK_USER
.
value
.
equals
(
cultivateNotifyDTO
.
getSendType
()))
{
if
(
null
==
cultivateNotifyDTO
.
getBookId
(
))
{
if
(
ListUtils
.
isEmpty
(
cultivateNotifyDTO
.
getBookIds
()
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"bookId缺失!"
);
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/dto/CultivateNotifyDTO.java
View file @
24fee56a
...
...
@@ -28,7 +28,10 @@ public class CultivateNotifyDTO {
@ApiModelProperty
(
"bookId"
)
private
Long
bookId
;
@ApiModelProperty
(
"发送类型(1-指定用户,2-分类用户,3-按书籍查询,4-全局公告消息)"
)
@ApiModelProperty
(
"bookIds"
)
private
List
<
Long
>
bookIds
;
@ApiModelProperty
(
"发送类型(1-指定用户,2-分类用户,3-按书籍查询,4-全局公告消息 5- 用户画像)"
)
private
Integer
sendType
;
@JsonFormat
(
...
...
@@ -45,4 +48,14 @@ public class CultivateNotifyDTO {
@ApiModelProperty
(
"出版社id"
)
private
Long
agentId
;
@ApiModelProperty
(
"城市编码"
)
private
String
cityCode
;
@ApiModelProperty
(
"注册开始时间"
)
private
String
startTime
;
@ApiModelProperty
(
"注册结束时间"
)
private
String
endTime
;
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/dto/CultivateNotifyPageDTO.java
View file @
24fee56a
...
...
@@ -27,7 +27,7 @@ public class CultivateNotifyPageDTO {
private
List
<
CultivateNotifyItem
>
cultivateNotifyItems
;
@ApiModelProperty
(
"发送时间"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd
HH:mm:ss
"
,
timezone
=
"GMT+8"
)
private
Date
sendTime
;
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/dto/SearchSendUserDTO.java
View file @
24fee56a
...
...
@@ -12,4 +12,6 @@ public class SearchSendUserDTO{
private
Integer
numPerPage
;
private
String
keyword
;
private
Long
agentId
;
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/entity/CultivateNotifyItem.java
View file @
24fee56a
package
com
.
pcloud
.
book
.
cultivate
.
entity
;
import
com.pcloud.book.applet.dto.AppletBannerDTO
;
import
com.pcloud.book.applet.dto.AppletNewsDTO
;
import
com.pcloud.book.applet.dto.ServeItemInfoDTO
;
import
com.pcloud.common.entity.BaseEntity
;
import
com.pcloud.contentcenter.resource.dto.ResourceOfficeItemDTO
;
import
com.pcloud.contentcenter.resource.dto.ResourcePdfItemDTO
;
...
...
@@ -18,7 +21,7 @@ public class CultivateNotifyItem extends BaseEntity {
@ApiModelProperty
(
"消息id"
)
private
Long
messageId
;
@ApiModelProperty
(
"发送内容(1-文本,2-图片,3-音频)"
)
@ApiModelProperty
(
"发送内容(1-文本,2-图片,3-音频
, 4-链接
)"
)
private
Integer
contentType
;
@ApiModelProperty
(
"文字内容"
)
...
...
@@ -60,4 +63,29 @@ public class CultivateNotifyItem extends BaseEntity {
@ApiModelProperty
(
"音频时长"
)
private
BigDecimal
duration
;
@ApiModelProperty
(
"站内信发送选择活动类型时的资源"
)
private
AppletBannerDTO
sendServe
;
@ApiModelProperty
(
"跳转类型 1指定页面, 2web页面, 3资讯, 4应用作品"
)
private
Integer
jumpType
;
@ApiModelProperty
(
"跳转地址"
)
private
String
jumpUrl
;
@ApiModelProperty
(
"作品/应用/咨询的ID"
)
private
Long
serveId
;
@ApiModelProperty
(
"作品5/应用6/咨询的类型1"
)
private
Integer
serveType
;
@ApiModelProperty
(
"咨询具体信息"
)
private
AppletNewsDTO
newsItem
;
@ApiModelProperty
(
"咨询具体信息"
)
private
ServeItemInfoDTO
appItem
;
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/enums/NotifySendTypeEnum.java
View file @
24fee56a
...
...
@@ -17,7 +17,11 @@ public enum NotifySendTypeEnum {
/**
* 全局公告消息
*/
ALL_USER
(
4
);
ALL_USER
(
4
),
/**
*用户画像
*/
USER_PROFILE
(
5
);
public
final
Integer
value
;
...
...
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/facade/CultivateNotifyFacade.java
View file @
24fee56a
...
...
@@ -79,9 +79,9 @@ public class CultivateNotifyFacade {
@ApiOperation
(
"首条未读消息详情"
)
@GetMapping
(
"/getFirstNoReadNotify"
)
public
ResponseDto
<?>
getFirstNoReadNotify
(
@CookieValue
(
value
=
"userInfo"
,
required
=
false
)
String
userInfo
)
{
public
ResponseDto
<?>
getFirstNoReadNotify
(
@CookieValue
(
value
=
"userInfo"
,
required
=
false
)
String
userInfo
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(!
NumberUtil
.
isNumber
(
wechatUserId
))
{
if
(!
NumberUtil
.
isNumber
(
wechatUserId
))
{
throw
new
BizException
(
BizException
.
PARAM_IS_NULL
.
getCode
(),
"wechatUserId 不能为空"
);
}
return
new
ResponseDto
<>(
cultivateNotifyBiz
.
getFirstNoReadNotify
(
wechatUserId
));
...
...
pcloud-service-book/src/main/resources/mapper/book/SearchRecord.xml
View file @
24fee56a
...
...
@@ -155,7 +155,11 @@
<select
id=
"getWechatUserIds"
parameterType=
"map"
resultType=
"Long"
>
select distinct wechat_user_id
from search_record
where book_id=#{bookId}
where
book_id in
<foreach
collection=
"bookIds"
open=
"("
close=
")"
index=
"index"
item=
"item"
separator=
","
>
#{item}
</foreach>
and wechat_user_id>0
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/cultivate/CultivateNotifyItem.xml
View file @
24fee56a
...
...
@@ -10,10 +10,18 @@
<result
column=
"resource_id"
property=
"resourceId"
jdbcType=
"BIGINT"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"serve_id"
jdbcType=
"BIGINT"
property=
"serveId"
/>
<result
column=
"serve_type"
jdbcType=
"TINYINT"
property=
"serveType"
/>
<result
column=
"jump_type"
jdbcType=
"INTEGER"
property=
"jumpType"
/>
<result
column=
"jump_url"
jdbcType=
"VARCHAR"
property=
"jumpUrl"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id,message_id, content_type, content,pic_url,resource_id, create_time,update_time
id,message_id, content_type, content,pic_url,resource_id, create_time,update_time,
jump_type,
jump_url,
serve_id,
serve_type
</sql>
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.cultivate.entity.CultivateNotifyItem"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
...
...
@@ -25,7 +33,11 @@
pic_url,
resource_id,
create_time,
update_time
update_time,
jump_type,
jump_url,
serve_id,
serve_type
)
values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
...
...
@@ -36,7 +48,11 @@
#{item.picUrl},
#{item.resourceId},
NOW(),
NOW()
NOW(),
#{item.jumpType},
#{item.jumpUrl},
#{item.serveId},
#{item.serveType}
)
</foreach>
</insert>
...
...
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