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
f5eb7a2a
Commit
f5eb7a2a
authored
Sep 21, 2020
by
朱亚洁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:[1003586]订阅答案提醒
parent
6e5c9f7e
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
629 additions
and
9 deletions
+629
-9
AppletService.java
...in/java/com/pcloud/book/applet/service/AppletService.java
+7
-0
AdvertisingSpaceServiceImpl.java
...advertising/service/impl/AdvertisingSpaceServiceImpl.java
+5
-0
AnswerSubscribeBiz.java
...n/java/com/pcloud/book/applet/biz/AnswerSubscribeBiz.java
+39
-0
AnswerSubscribeBizImpl.java
...m/pcloud/book/applet/biz/impl/AnswerSubscribeBizImpl.java
+191
-0
AppletConstants.java
...java/com/pcloud/book/applet/contants/AppletConstants.java
+48
-0
AnswerSubscribeDao.java
...n/java/com/pcloud/book/applet/dao/AnswerSubscribeDao.java
+50
-0
AnswerSubscribeDaoImpl.java
...m/pcloud/book/applet/dao/impl/AnswerSubscribeDaoImpl.java
+40
-0
AnswerSubscribeDTO.java
...n/java/com/pcloud/book/applet/dto/AnswerSubscribeDTO.java
+39
-0
AnswerSubscribe.java
...n/java/com/pcloud/book/applet/entity/AnswerSubscribe.java
+54
-0
AnswerSendStateEnum.java
...ava/com/pcloud/book/applet/enums/AnswerSendStateEnum.java
+26
-0
AppletHomeFacade.java
.../java/com/pcloud/book/applet/facade/AppletHomeFacade.java
+33
-0
AppletServiceImpl.java
...om/pcloud/book/applet/service/impl/AppletServiceImpl.java
+15
-0
TemplateConsr.java
.../java/com/pcloud/book/consumer/message/TemplateConsr.java
+2
-0
RightsSettingBizImpl.java
...oud/book/rightsSetting/biz/impl/RightsSettingBizImpl.java
+9
-9
AnswerSubscribeDao.xml
...k/src/main/resources/mapper/applet/AnswerSubscribeDao.xml
+71
-0
No files found.
pcloud-facade-book/src/main/java/com/pcloud/book/applet/service/AppletService.java
View file @
f5eb7a2a
...
...
@@ -37,4 +37,11 @@ public interface AppletService {
@GetMapping
(
"createBaseClassifysToAgent"
)
void
createBaseClassifysToAgent
(
@RequestParam
(
"agentId"
)
@ApiParam
Long
agentId
);
@ApiOperation
(
"检测订阅的书籍答案有更新"
)
@GetMapping
(
"checkAnswerUpdate"
)
void
checkAnswerUpdate
();
@ApiOperation
(
"定时推送答案订阅提醒"
)
@GetMapping
(
"sendAppletMsg4Answer"
)
void
sendAppletMsg4Answer
();
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/service/impl/AdvertisingSpaceServiceImpl.java
View file @
f5eb7a2a
...
...
@@ -6,6 +6,7 @@ import com.pcloud.book.advertising.biz.GroupTagBiz;
import
com.pcloud.book.advertising.biz.LinkRevertBiz
;
import
com.pcloud.book.advertising.dto.BrandDataDTO4Channel
;
import
com.pcloud.book.advertising.service.AdvertisingSpaceService
;
import
com.pcloud.book.applet.service.AppletService
;
import
com.pcloud.book.es.biz.ESBookAndAdviserBiz
;
import
com.pcloud.book.group.service.BookGroupService
;
import
com.pcloud.common.core.aspect.ParamLog
;
...
...
@@ -52,6 +53,8 @@ public class AdvertisingSpaceServiceImpl implements AdvertisingSpaceService {
private
AdvertisingBrandDataBiz
advertisingBrandDataBiz
;
@Autowired
private
ESBookAndAdviserBiz
esBookAndAdviserBiz
;
@Autowired
private
AppletService
appletService
;
/**
* 每日凌晨计算昨日广告位收益
...
...
@@ -66,6 +69,8 @@ public class AdvertisingSpaceServiceImpl implements AdvertisingSpaceService {
bookGroupService
.
addUserCount4RightsSetting
();
//es书刊数据统计
esBookAndAdviserBiz
.
addAllBookAndAdviserToES
();
//小程序
appletService
.
checkAnswerUpdate
();
}
@ApiOperation
(
"发送广告计划"
)
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/AnswerSubscribeBiz.java
0 → 100644
View file @
f5eb7a2a
package
com
.
pcloud
.
book
.
applet
.
biz
;
import
com.pcloud.book.applet.dto.AnswerSubscribeDTO
;
import
java.util.Map
;
public
interface
AnswerSubscribeBiz
{
/**
* 答案订阅
* @author:zhuyajie
* @date:2020/9/16 16:24
* * @param null
*/
void
answerSubscribe
(
AnswerSubscribeDTO
answerSubscribeDTO
);
/**
* 查询是否订阅
* @author:zhuyajie
* @date:2020/9/16 16:37
* * @param null
*/
Map
<
String
,
Object
>
getSubscribeState
(
AnswerSubscribeDTO
answerSubscribeDTO
);
/**
* 定时推送答案订阅提醒
* @author:zhuyajie
* @date:2020/9/16 16:48
* * @param null
*/
void
sendAppletMsg4Answer
();
/**
* 查订阅的书籍答案有更新
* @author:zhuyajie
* @date:2020/9/18 10:00
* * @param null
*/
void
checkAnswerUpdate
();
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AnswerSubscribeBizImpl.java
0 → 100644
View file @
f5eb7a2a
package
com
.
pcloud
.
book
.
applet
.
biz
.
impl
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.book.applet.biz.AnswerSubscribeBiz
;
import
com.pcloud.book.applet.contants.AppletConstants
;
import
com.pcloud.book.applet.dao.AnswerSubscribeDao
;
import
com.pcloud.book.applet.dto.AnswerSubscribeDTO
;
import
com.pcloud.book.applet.entity.AnswerSubscribe
;
import
com.pcloud.book.applet.enums.AnswerSendStateEnum
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.biz.BookBiz
;
import
com.pcloud.book.book.dto.BookDto
;
import
com.pcloud.book.consumer.app.AppConsr
;
import
com.pcloud.book.consumer.message.TemplateConsr
;
import
com.pcloud.book.group.biz.BookGroupBiz
;
import
com.pcloud.book.group.dto.BookServeDTO
;
import
com.pcloud.book.util.properties.BookProps
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.dto.AppletTemplateMessageDto
;
import
com.pcloud.common.enums.AppTypeEnum
;
import
com.pcloud.common.utils.DateUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
lombok.extern.slf4j.Slf4j
;
/**
* @ClassName com.pcloud.book.applet.biz.impl.AnswerSubscribeBizImpl
* @Author zhuyajie
* @Description 答案订阅
* @Date 2020/9/16 16:23
* @Version 1.0
**/
@Component
@Slf4j
public
class
AnswerSubscribeBizImpl
implements
AnswerSubscribeBiz
{
@Autowired
private
AnswerSubscribeDao
answerSubscribeDao
;
@Autowired
private
TemplateConsr
templateConsr
;
@Autowired
private
BookGroupBiz
bookGroupBiz
;
@Autowired
private
BookBiz
bookBiz
;
@Autowired
private
AppConsr
appConsr
;
@Override
public
void
answerSubscribe
(
AnswerSubscribeDTO
answerSubscribeDTO
)
{
if
(
null
==
answerSubscribeDTO
.
getBookId
()
||
null
==
answerSubscribeDTO
.
getAdviserId
()
||
null
==
answerSubscribeDTO
.
getChannelId
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少书刊参数"
);
}
AnswerSubscribe
answerSubscribe
=
new
AnswerSubscribe
();
BeanUtils
.
copyProperties
(
answerSubscribeDTO
,
answerSubscribe
);
List
<
AnswerSubscribe
>
list
=
answerSubscribeDao
.
getRecordByUserBook
(
answerSubscribe
);
Boolean
hasAnswer
=
hasAnswer
(
answerSubscribe
.
getBookId
(),
answerSubscribe
.
getAdviserId
(),
answerSubscribe
.
getChannelId
());
if
(!
ListUtils
.
isEmpty
(
list
)
||
hasAnswer
)
{
return
;
}
answerSubscribeDao
.
insert
(
answerSubscribe
);
}
@Override
public
Map
<
String
,
Object
>
getSubscribeState
(
AnswerSubscribeDTO
answerSubscribeDTO
)
{
if
(
null
==
answerSubscribeDTO
.
getBookId
()
||
null
==
answerSubscribeDTO
.
getAdviserId
()
||
null
==
answerSubscribeDTO
.
getChannelId
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少书刊参数"
);
}
Boolean
state
=
false
;
AnswerSubscribe
answerSubscribe
=
new
AnswerSubscribe
();
BeanUtils
.
copyProperties
(
answerSubscribeDTO
,
answerSubscribe
);
List
<
AnswerSubscribe
>
list
=
answerSubscribeDao
.
getRecordByUserBook
(
answerSubscribe
);
if
(!
ListUtils
.
isEmpty
(
list
))
{
state
=
true
;
}
Boolean
hasAnswer
=
hasAnswer
(
answerSubscribe
.
getBookId
(),
answerSubscribe
.
getAdviserId
(),
answerSubscribe
.
getChannelId
());
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"subscribeState"
,
state
);
map
.
put
(
"hasAnswer"
,
hasAnswer
);
return
map
;
}
private
Boolean
hasAnswer
(
Long
bookId
,
Long
adviserId
,
Long
channelId
){
//默认有答案
Boolean
hasAnswer
=
true
;
List
<
BookServeDTO
>
bookServeVOS
=
bookGroupBiz
.
getBookAndBookGroupServeIds
(
adviserId
,
bookId
,
channelId
);
List
<
BookServeDTO
>
answerList
=
bookServeVOS
.
stream
().
filter
(
s
->
AppTypeEnum
.
ANSWER
.
value
.
equals
(
s
.
getFromType
())).
collect
(
Collectors
.
toList
());
if
(
ListUtils
.
isEmpty
(
answerList
))
{
if
(
"pro"
.
equals
(
BookProps
.
getSystemEnv
())
&&
AppletConstants
.
NO_ANSWER_BOOK
.
contains
(
bookId
))
{
hasAnswer
=
false
;
}
else
{
hasAnswer
=
false
;
}
}
return
hasAnswer
;
}
@Override
@ParamLog
(
"发送答案订阅小程序模板消息"
)
public
void
sendAppletMsg4Answer
()
{
//待发送消息的书刊
List
<
AnswerSubscribe
>
bookList
=
answerSubscribeDao
.
getBookBySendState
(
AnswerSendStateEnum
.
wait_send
.
code
);
if
(
ListUtils
.
isEmpty
(
bookList
))
{
return
;
}
for
(
AnswerSubscribe
answerSubscribeBook
:
bookList
)
{
if
(
"pro"
.
equals
(
BookProps
.
getSystemEnv
())
&&
!
AppletConstants
.
NO_ANSWER_BOOK
.
contains
(
answerSubscribeBook
.
getBookId
()))
{
continue
;
}
AnswerSubscribe
subscribe
=
new
AnswerSubscribe
();
subscribe
.
setSendState
(
AnswerSendStateEnum
.
wait_send
.
code
);
subscribe
.
setBookId
(
answerSubscribeBook
.
getBookId
());
subscribe
.
setChannelId
(
answerSubscribeBook
.
getChannelId
());
subscribe
.
setAdviserId
(
answerSubscribeBook
.
getAdviserId
());
List
<
AnswerSubscribe
>
userList
=
answerSubscribeDao
.
getBySendStateAndBook
(
subscribe
);
if
(
ListUtils
.
isEmpty
(
userList
))
{
continue
;
}
BookDto
bookDto
=
bookBiz
.
getBaseById
(
answerSubscribeBook
.
getBookId
());
if
(
null
==
bookDto
)
{
continue
;
}
List
<
BookServeDTO
>
bookServeVOS
=
bookGroupBiz
.
getBookAndBookGroupServeIds
(
answerSubscribeBook
.
getAdviserId
(),
answerSubscribeBook
.
getBookId
(),
answerSubscribeBook
.
getChannelId
());
List
<
BookServeDTO
>
answerList
=
bookServeVOS
.
stream
().
filter
(
s
->
AppTypeEnum
.
ANSWER
.
value
.
equals
(
s
.
getFromType
())).
collect
(
Collectors
.
toList
());
if
(
ListUtils
.
isEmpty
(
answerList
))
{
continue
;
}
Long
appId
=
answerList
.
get
(
0
).
getServeId
();
AppDto
appDto
=
appConsr
.
getBaseById
(
appId
);
if
(
null
==
appDto
){
continue
;
}
for
(
AnswerSubscribe
answerSubscribeUser
:
userList
)
{
sendAppletTemplateMsg
(
answerSubscribeUser
.
getWechatUserId
(),
answerSubscribeUser
.
getAccountSettingId
(),
bookDto
.
getBookName
(),
appDto
.
getTitle
());
//更新发送状态
answerSubscribeUser
.
setSendState
(
AnswerSendStateEnum
.
has_send
.
code
);
answerSubscribeDao
.
updateSendState
(
answerSubscribeUser
);
}
}
}
@Override
@ParamLog
(
"检测答案是否有提供"
)
public
void
checkAnswerUpdate
()
{
//已订阅的书
List
<
AnswerSubscribe
>
list
=
answerSubscribeDao
.
getBookBySendState
(
AnswerSendStateEnum
.
subscribe
.
code
);
if
(
ListUtils
.
isEmpty
(
list
)){
return
;
}
for
(
AnswerSubscribe
answerSubscribe:
list
){
Boolean
hasAnswer
=
hasAnswer
(
answerSubscribe
.
getBookId
(),
answerSubscribe
.
getAdviserId
(),
answerSubscribe
.
getChannelId
());
if
(
hasAnswer
){
answerSubscribe
.
setSendState
(
AnswerSendStateEnum
.
wait_send
.
code
);
answerSubscribeDao
.
updateSendState
(
answerSubscribe
);
}
}
}
private
void
sendAppletTemplateMsg
(
Long
wechatUserId
,
Long
accountSettingId
,
String
bookName
,
String
appName
)
{
bookName
=
bookName
.
length
()
>
13
?
bookName
.
substring
(
0
,
13
)
+
"..."
:
bookName
;
appName
=
appName
.
length
()
>
13
?
appName
.
substring
(
0
,
13
)
+
"..."
:
appName
;
AppletTemplateMessageDto
appletTemplateMessage
;
Map
<
String
,
String
>
tempMap
;
appletTemplateMessage
=
new
AppletTemplateMessageDto
();
appletTemplateMessage
.
setAccountSettingId
(
accountSettingId
);
appletTemplateMessage
.
setWechatUserId
(
wechatUserId
);
appletTemplateMessage
.
setTempalteTypeCode
(
"xiaorui_content_update_remind"
);
appletTemplateMessage
.
setPage
(
"pages/customize/index"
);
tempMap
=
new
HashMap
<>();
tempMap
.
put
(
"thing4"
,
"答案上架提醒"
);
tempMap
.
put
(
"thing10"
,
StringUtil
.
addBracket
(
bookName
));
tempMap
.
put
(
"thing9"
,
appName
);
tempMap
.
put
(
"date5"
,
DateUtils
.
formatDate
(
new
Date
(),
DateUtils
.
DATE_FORMAT_DATETIME
));
appletTemplateMessage
.
setData
(
tempMap
);
templateConsr
.
sendAppletMessageQueue
(
appletTemplateMessage
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/contants/AppletConstants.java
View file @
f5eb7a2a
...
...
@@ -2,6 +2,9 @@ package com.pcloud.book.applet.contants;
import
com.pcloud.common.constant.CacheConstant
;
import
java.util.Arrays
;
import
java.util.List
;
/**
* @ClassName com.pcloud.book.applet.contants.AppletConstants
* @Author zhuyajie
...
...
@@ -53,4 +56,49 @@ public class AppletConstants {
* 小睿独立管理端数据统计
*/
public
static
final
String
APPLET_AGENT_STATISTIC
=
CacheConstant
.
BOOK
+
"APPLET:applet_agent_statistic"
;
/**
* 未配置答案的书刊
*/
public
static
final
List
<
Long
>
NO_ANSWER_BOOK
=
Arrays
.
asList
(
//广东教育出版社
5888352L
,
5888356L
,
5888360L
,
5888371L
,
5888388L
,
5888422L
,
5888423L
,
5910614L
,
5918470L
,
//广东教育出版社
5923646L
,
5885692L
,
5885714L
,
5923649L
,
5885735L
,
5885723L
,
5885730L
,
5885733L
,
5885726L
,
5923650L
,
5923651L
,
5923667L
,
5869279L
,
5869241L
,
5869297L
,
5869323L
,
5869302L
,
5869275L
,
5869290L
,
5869265L
,
5869293L
,
5869271L
,
5869321L
,
5869311L
,
5869314L
,
5869319L
,
5869317L
,
5869322L
,
5869306L
,
5869308L
,
5869292L
,
5869289L
,
5869274L
,
5869304L
,
5869282L
,
5869298L
,
5869295L
,
5869278L
,
5869267L
,
5869263L
,
5869246L
,
5869260L
,
5869243L
,
5869326L
,
5869253L
,
5869249L
,
5869237L
,
5869324L
,
5869301L
,
5869257L
,
5869285L
,
5869238L
,
5869325L
,
5869270L
,
5923647L
,
5885630L
,
5885632L
,
5869251L
,
5869240L
,
5869245L
,
5869309L
,
5869262L
,
5869327L
,
5869320L
,
5869247L
,
5869277L
,
5869284L
,
5869312L
,
5869268L
,
5869266L
,
5869256L
,
5869244L
,
5869259L
,
5869273L
,
5869287L
,
5869316L
,
5869315L
,
5869318L
,
5869305L
,
5869313L
,
5869291L
,
5869294L
,
5869283L
,
5869307L
,
5869303L
,
5869288L
,
5869310L
,
5869300L
,
5869286L
,
5869258L
,
5869272L
,
5869276L
,
5869261L
,
5869242L
,
5869269L
,
5869254L
,
5869280L
,
5869264L
,
5869248L
,
5885686L
,
5885655L
,
5885658L
,
5885676L
,
5885680L
,
//广东经济出版社
5911661L
,
5911636L
,
5911643L
,
5911634L
,
5911648L
,
5911646L
,
5911711L
,
5911641L
,
5911638L
,
5915951L
,
5911657L
,
5911642L
,
5911652L
,
5911656L
,
5915952L
,
5911708L
,
5911637L
,
5915950L
,
5911653L
,
5911650L
,
5911660L
,
5911649L
,
5911635L
,
5911709L
,
5911645L
,
5911639L
,
5915953L
,
5918481L
,
5911710L
,
5911632L
,
5911713L
,
5911712L
,
5918482L
,
5911640L
,
5911651L
,
//延边教育出版社
5901369L
,
5901461L
,
5901439L
,
5901465L
,
5901467L
,
5901462L
,
5901398L
,
5901385L
,
5901446L
,
5901471L
,
5901379L
,
5901416L
,
5901448L
,
5901472L
,
5901470L
,
5901444L
,
5901375L
,
5901435L
,
5901460L
,
5901412L
,
5901415L
,
5901372L
,
5901414L
,
5901452L
,
5901442L
,
5901433L
,
5901464L
,
5901469L
,
5901450L
,
5901437L
,
//安徽教育出版社
5909445L
,
5909412L
,
5909452L
,
//辽宁北方期刊出版集团
5897766L
,
5897823L
,
5897816L
,
5897818L
,
5897794L
,
5897790L
,
5897793L
,
5897774L
,
5897772L
,
5897775L
,
5897777L
,
5897776L
,
5897778L
,
5897750L
,
5897759L
,
5897763L
,
5897769L
,
5897764L
,
5897771L
,
5897762L
,
5897768L
,
5897825L
,
5897783L
,
5897760L
,
5897754L
,
5897744L
,
5897781L
,
5897780L
,
5897743L
,
5897737L
,
5897743L
,
5897824L
,
5893416L
,
5897773L
,
5897815L
,
5897786L
,
5893413L
,
5897747L
,
5893412L
,
5897779L
,
5893411L
,
5897813L
,
5897735L
,
5893409L
,
5893410L
,
5897810L
,
5893408L
,
5897811L
,
5897806L
,
5897799L
,
5893414L
,
5897805L
,
5897791L
,
5897812L
,
5897817L
,
5897761L
,
5897798L
,
5897746L
,
5897788L
,
5897749L
,
5897752L
,
5897757L
,
5897738L
,
5897809L
,
5897796L
,
5897814L
,
5897819L
,
5897820L
,
5897801L
,
5897807L
,
5897792L
,
5897797L
,
5897803L
,
5897808L
,
5897795L
,
5897800L
,
5897804L
,
5897740L
,
5897789L
,
5897822L
,
5897736L
,
5897745L
,
5897751L
,
5897742L
,
5897748L
,
5897758L
,
5897756L
,
5893433L
,
5893436L
,
5893435L
,
5893442L
,
5893445L
,
5893443L
,
5893429L
,
5893437L
,
5893439L
,
5893441L
,
5893432L
,
5893434L
,
5893438L
,
5893444L
,
5893446L
,
5893430L
,
5897544L
,
5893447L
,
5897543L
,
5893440L
,
5897545L
,
5893431L
,
5876734L
,
5876736L
,
5876735L
,
5893295L
,
5893299L
,
5893297L
,
5893293L
,
5893278L
,
5893296L
,
5893264L
,
5893262L
,
5893266L
,
5893294L
,
5893291L
,
5893284L
,
5909384L
,
5909385L
,
5909383L
,
5893287L
,
5893285L
,
5893289L
,
5893288L
,
5893282L
,
5893276L
,
5893286L
,
5893274L
,
5893265L
,
5893270L
,
5893301L
,
5893300L
,
5893267L
,
5893273L
,
5893271L
,
5893277L
,
5893275L
,
5893279L
,
5893283L
,
5893292L
,
5893290L
,
5893269L
,
//湖北教育
5906897L
,
5906866L
,
5906870L
,
5906924L
,
5906875L
,
5906873L
,
5906868L
,
5906867L
,
5906937L
,
5906930L
,
5906917L
,
5906903L
,
5906891L
,
5906887L
,
5906880L
,
5906869L
,
5906936L
,
5906940L
,
5906882L
,
5906943L
,
2979867L
,
5923816L
,
5923801L
);
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/AnswerSubscribeDao.java
0 → 100644
View file @
f5eb7a2a
package
com
.
pcloud
.
book
.
applet
.
dao
;
import
com.pcloud.book.applet.entity.AnswerSubscribe
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
/**
* 答案订阅(AnswerSubscribe)表数据库访问层
*
* @author makejava
* @since 2020-09-16 15:55:30
*/
public
interface
AnswerSubscribeDao
extends
BaseDao
<
AnswerSubscribe
>{
/**
* 更新发送状态
* @author:zhuyajie
* @date:2020/9/16 16:21
* * @param null
*/
void
updateSendState
(
AnswerSubscribe
answerSubscribe
);
/**
* 查询订阅记录
* @author:zhuyajie
* @date:2020/9/16 16:35
* * @param null
*/
List
<
AnswerSubscribe
>
getRecordByUserBook
(
AnswerSubscribe
answerSubscribe
);
/**
* 根据发送状态查记录
* @author:zhuyajie
* @date:2020/9/18 10:04
* * @param null
*/
List
<
AnswerSubscribe
>
getBySendStateAndBook
(
AnswerSubscribe
answerSubscribe
);
/**
* 根据发送状态查书刊(去重)
* @author:zhuyajie
* @date:2020/9/18 10:08
* * @param null
*/
List
<
AnswerSubscribe
>
getBookBySendState
(
Integer
sendState
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/impl/AnswerSubscribeDaoImpl.java
0 → 100644
View file @
f5eb7a2a
package
com
.
pcloud
.
book
.
applet
.
dao
.
impl
;
import
com.pcloud.book.applet.dao.AnswerSubscribeDao
;
import
com.pcloud.book.applet.entity.AnswerSubscribe
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
/**
* @ClassName com.pcloud.book.applet.dao.impl.AnswerSubscribeDaoImpl
* @Author zhuyajie
* @Description 答案订阅
* @Date 2020/9/16 16:09
* @Version 1.0
**/
@Component
public
class
AnswerSubscribeDaoImpl
extends
BaseDaoImpl
<
AnswerSubscribe
>
implements
AnswerSubscribeDao
{
@Override
public
void
updateSendState
(
AnswerSubscribe
answerSubscribe
)
{
getSessionTemplate
().
update
(
getStatement
(
"updateSendState"
),
answerSubscribe
);
}
@Override
public
List
<
AnswerSubscribe
>
getRecordByUserBook
(
AnswerSubscribe
answerSubscribe
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getRecordByUserBook"
),
answerSubscribe
);
}
@Override
public
List
<
AnswerSubscribe
>
getBySendStateAndBook
(
AnswerSubscribe
answerSubscribe
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getBySendStateAndBook"
),
answerSubscribe
);
}
@Override
public
List
<
AnswerSubscribe
>
getBookBySendState
(
Integer
sendState
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getBookBySendState"
),
sendState
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dto/AnswerSubscribeDTO.java
0 → 100644
View file @
f5eb7a2a
package
com
.
pcloud
.
book
.
applet
.
dto
;
import
com.pcloud.common.dto.BaseDto
;
import
lombok.Data
;
/**
* 答案订阅(AnswerSubscribe)实体类
*
* @author makejava
* @since 2020-09-16 15:55:30
*/
@Data
public
class
AnswerSubscribeDTO
extends
BaseDto
{
private
static
final
long
serialVersionUID
=
635127925467579831L
;
/**
* 用户id
*/
private
Long
wechatUserId
;
/**
* 书刊id
*/
private
Long
bookId
;
/**
* 渠道id
*/
private
Long
channelId
;
/**
* 编辑id
*/
private
Long
adviserId
;
/**
* 公众号id
*/
private
Long
accountSettingId
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/entity/AnswerSubscribe.java
0 → 100644
View file @
f5eb7a2a
package
com
.
pcloud
.
book
.
applet
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.common.entity.BaseEntity
;
import
java.util.Date
;
import
lombok.Data
;
/**
* 答案订阅(AnswerSubscribe)实体类
*
* @author makejava
* @since 2020-09-16 15:55:30
*/
@Data
public
class
AnswerSubscribe
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
635127925467579831L
;
/**
* 用户id
*/
private
Long
wechatUserId
;
/**
* 书刊id
*/
private
Long
bookId
;
/**
* 渠道id
*/
private
Long
channelId
;
/**
* 编辑id
*/
private
Long
adviserId
;
/**
* 消息发送状态
*/
private
Integer
sendState
;
/**
* 创建时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
/**
* 公众号id
*/
private
Long
accountSettingId
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/enums/AnswerSendStateEnum.java
0 → 100644
View file @
f5eb7a2a
package
com
.
pcloud
.
book
.
applet
.
enums
;
/**
* 答案订阅发送状态
*/
public
enum
AnswerSendStateEnum
{
/**
* 已订阅未发送
*/
subscribe
(
0
),
/**
* 已发送
*/
has_send
(
1
),
/**
* 待发送
*/
wait_send
(
2
);
public
Integer
code
;
AnswerSendStateEnum
(
Integer
code
)
{
this
.
code
=
code
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/facade/AppletHomeFacade.java
View file @
f5eb7a2a
package
com
.
pcloud
.
book
.
applet
.
facade
;
import
com.pcloud.book.applet.biz.AnswerSubscribeBiz
;
import
com.pcloud.book.applet.biz.AppletBannerBiz
;
import
com.pcloud.book.applet.biz.AppletBooklistBiz
;
import
com.pcloud.book.applet.biz.AppletNewsBiz
;
import
com.pcloud.book.applet.biz.AppletStatisticBiz
;
import
com.pcloud.book.applet.biz.AppletUserBookcaseBiz
;
import
com.pcloud.book.applet.dto.AddBookParamDTO
;
import
com.pcloud.book.applet.dto.AnswerSubscribeDTO
;
import
com.pcloud.book.applet.dto.AppletBannerDTO
;
import
com.pcloud.book.applet.dto.AppletBooklistClassifyDTO
;
import
com.pcloud.book.applet.dto.AppletBooklistDTO
;
...
...
@@ -79,6 +81,8 @@ public class AppletHomeFacade {
private
PcloudGroupActivityBiz
pcloudGroupActivityBiz
;
@Autowired
private
AppletStatisticBiz
appletStatisticBiz
;
@Autowired
private
AnswerSubscribeBiz
answerSubscribeBiz
;
@ApiOperation
(
"批量名片上下架"
)
@PostMapping
(
"batchUpdateCardShowState"
)
...
...
@@ -1141,6 +1145,35 @@ public class AppletHomeFacade {
String
url
=
appletUserBookcaseBiz
.
getResources4Books
(
request
);
return
new
ResponseDto
<>(
url
);
}
@ApiOperation
(
"答案订阅"
)
@PostMapping
(
"answerSubscribe"
)
public
ResponseDto
<?>
answerSubscribe
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestBody
@ApiParam
AnswerSubscribeDTO
answerSubscribeDTO
){
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Long
accountSettingId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
if
(
null
==
answerSubscribeDTO
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少参数"
);
}
answerSubscribeDTO
.
setWechatUserId
(
wechatUserId
);
answerSubscribeDTO
.
setAccountSettingId
(
accountSettingId
);
answerSubscribeBiz
.
answerSubscribe
(
answerSubscribeDTO
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"查看答案订阅状态"
)
@PostMapping
(
"getSubscribeState"
)
public
ResponseDto
<?>
getSubscribeState
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestBody
@ApiParam
AnswerSubscribeDTO
answerSubscribeDTO
){
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
answerSubscribeDTO
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少参数"
);
}
answerSubscribeDTO
.
setWechatUserId
(
wechatUserId
);
return
new
ResponseDto
<>(
answerSubscribeBiz
.
getSubscribeState
(
answerSubscribeDTO
));
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/service/impl/AppletServiceImpl.java
View file @
f5eb7a2a
package
com
.
pcloud
.
book
.
applet
.
service
.
impl
;
import
com.pcloud.book.applet.biz.AnswerSubscribeBiz
;
import
com.pcloud.book.applet.biz.AppletBooklistBiz
;
import
com.pcloud.book.applet.biz.AppletBookClassifyBiz
;
import
com.pcloud.book.applet.biz.AppletNewsBiz
;
...
...
@@ -42,6 +43,8 @@ public class AppletServiceImpl implements AppletService {
private
AppletBooklistBiz
appletBooklistBiz
;
@Autowired
private
AppletBookClassifyBiz
appletBookClassifyBiz
;
@Autowired
private
AnswerSubscribeBiz
answerSubscribeBiz
;
@Override
...
...
@@ -70,4 +73,16 @@ public class AppletServiceImpl implements AppletService {
public
void
createBaseClassifysToAgent
(
@RequestParam
(
"agentId"
)
@ApiParam
Long
agentId
){
appletBookClassifyBiz
.
createBaseClassifysToAgent
(
agentId
);
}
@Override
@GetMapping
(
"checkAnswerUpdate"
)
public
void
checkAnswerUpdate
(){
answerSubscribeBiz
.
checkAnswerUpdate
();
}
@Override
@GetMapping
(
"sendAppletMsg4Answer"
)
public
void
sendAppletMsg4Answer
(){
answerSubscribeBiz
.
sendAppletMsg4Answer
();
}
}
pcloud-service-book/src/main/java/com/pcloud/book/consumer/message/TemplateConsr.java
View file @
f5eb7a2a
...
...
@@ -3,6 +3,7 @@
*/
package
com
.
pcloud
.
book
.
consumer
.
message
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.biz.TemplateQueueBiz
;
import
com.pcloud.common.core.constant.WechatCode
;
import
com.pcloud.common.core.dto.AppletTemplateMessageDto
;
...
...
@@ -77,6 +78,7 @@ public class TemplateConsr {
}
}
@ParamLog
(
"发送小程序模板消息"
)
public
void
sendAppletMessageQueue
(
AppletTemplateMessageDto
appletTemplateMessage
)
{
try
{
templateQueueBiz
.
sendAppletMessageQueue
(
appletTemplateMessage
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/biz/impl/RightsSettingBizImpl.java
View file @
f5eb7a2a
...
...
@@ -3012,19 +3012,19 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
}
answerList
=
new
ArrayList
<>();
List
<
BookServeDTO
>
bookServeVOS
=
bookGroupBiz
.
getBookAndBookGroupServeIds
(
adviserId
,
bookId
,
channelId
);
List
<
RightsNowItem
>
items
=
new
ArrayList
<>();
if
(!
ListUtils
.
isEmpty
(
bookServeVOS
))
{
for
(
BookServeDTO
vo
:
bookServeVOS
)
{
RightsNowItem
item
=
new
RightsNowItem
();
item
.
setType
(
RightsNowItemTypeNew
.
SERVES
.
value
);
item
.
setServeId
(
vo
.
getServeId
());
item
.
setServeType
(
vo
.
getTypeCode
());
item
.
setLinkUrl
(
vo
.
getUrl
());
items
.
add
(
item
);
if
(
AppTypeEnum
.
ANSWER
.
value
.
equals
(
vo
.
getFromType
())){
RightsNowItem
item
=
new
RightsNowItem
();
item
.
setType
(
RightsNowItemTypeNew
.
SERVES
.
value
);
item
.
setServeId
(
vo
.
getServeId
());
item
.
setServeType
(
vo
.
getTypeCode
());
item
.
setLinkUrl
(
vo
.
getUrl
());
answerList
.
add
(
item
);
}
}
}
fillProductAndApp
(
items
);
answerList
=
items
.
stream
().
filter
(
s
->
s
.
getServeTypeCode
().
equals
(
AppTypeEnum
.
ANSWER
.
value
)).
collect
(
Collectors
.
toList
());
fillProductAndApp
(
answerList
);
if
(!
ListUtils
.
isEmpty
(
answerList
)
&&
answerList
.
size
()
>
2
)
{
//最多取两个
answerList
=
answerList
.
subList
(
0
,
2
);
...
...
pcloud-service-book/src/main/resources/mapper/applet/AnswerSubscribeDao.xml
0 → 100644
View file @
f5eb7a2a
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.pcloud.book.applet.dao.impl.AnswerSubscribeDaoImpl"
>
<resultMap
type=
"com.pcloud.book.applet.entity.AnswerSubscribe"
id=
"AnswerSubscribeMap"
>
<result
property=
"id"
column=
"id"
jdbcType=
"INTEGER"
/>
<result
property=
"wechatUserId"
column=
"wechat_user_id"
jdbcType=
"INTEGER"
/>
<result
property=
"bookId"
column=
"book_id"
jdbcType=
"INTEGER"
/>
<result
property=
"channelId"
column=
"channel_id"
jdbcType=
"INTEGER"
/>
<result
property=
"adviserId"
column=
"adviser_id"
jdbcType=
"INTEGER"
/>
<result
property=
"sendState"
column=
"send_state"
jdbcType=
"INTEGER"
/>
<result
property=
"accountSettingId"
column=
"account_setting_id"
jdbcType=
"INTEGER"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"updateTime"
column=
"update_time"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, wechat_user_id, book_id, channel_id, adviser_id, send_state, account_setting_id, create_time, update_time
</sql>
<!--新增所有列-->
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into book.answer_subscribe(wechat_user_id, book_id, channel_id, adviser_id, send_state,
account_setting_id, create_time, update_time)
values (#{wechatUserId}, #{bookId}, #{channelId}, #{adviserId}, 0, #{accountSettingId}, NOW(), NOW())
</insert>
<update
id=
"updateSendState"
parameterType=
"com.pcloud.book.applet.entity.AnswerSubscribe"
>
UPDATE book.answer_subscribe
SET send_state = #{sendState},
update_time = NOW()
WHERE
book_id = #{bookId}
and channel_id = #{channelId}
and adviser_id = #{adviserId}
<if
test=
"wechatUserId != null"
>
and wechat_user_id = #{wechatUserId}
</if>
</update>
<select
id=
"getRecordByUserBook"
parameterType=
"com.pcloud.book.applet.entity.AnswerSubscribe"
resultMap=
"AnswerSubscribeMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM book.answer_subscribe
WHERE wechat_user_id = #{wechatUserId}
and book_id = #{bookId}
and channel_id = #{channelId}
and adviser_id = #{adviserId}
</select>
<select
id=
"getBySendStateAndBook"
resultMap=
"AnswerSubscribeMap"
parameterType=
"com.pcloud.book.applet.entity.AnswerSubscribe"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM book.answer_subscribe
WHERE send_state = #{sendState}
and book_id = #{bookId}
and channel_id = #{channelId}
and adviser_id = #{adviserId}
</select>
<select
id=
"getBookBySendState"
resultType=
"com.pcloud.book.applet.entity.AnswerSubscribe"
parameterType=
"integer"
>
SELECT
book_id bookId,
channel_id channelId,
adviser_id adviserId
FROM book.answer_subscribe
WHERE send_state = #{sendState}
group by book_id, channel_id, adviser_id
</select>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment