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
f015ce05
Commit
f015ce05
authored
Aug 19, 2021
by
吴博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: [1005109] 小程序消息优化
parent
90f59724
Show whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
1306 additions
and
70 deletions
+1306
-70
SubscribeRecordTypeEnum.java
...com/pcloud/book/applet/enums/SubscribeRecordTypeEnum.java
+18
-0
AppletService.java
...in/java/com/pcloud/book/applet/service/AppletService.java
+5
-0
CultivateNotifySend.java
...com/pcloud/book/cultivate/entity/CultivateNotifySend.java
+7
-15
NotifyMessageType.java
...va/com/pcloud/book/cultivate/enums/NotifyMessageType.java
+5
-4
NotifySendTypeEnum.java
...a/com/pcloud/book/cultivate/enums/NotifySendTypeEnum.java
+7
-2
AppletSubscribeCountBiz.java
...a/com/pcloud/book/applet/biz/AppletSubscribeCountBiz.java
+73
-0
AppletSubscribeRecordBiz.java
.../com/pcloud/book/applet/biz/AppletSubscribeRecordBiz.java
+58
-0
AppletSubscribeCountBizImpl.java
...oud/book/applet/biz/impl/AppletSubscribeCountBizImpl.java
+93
-0
AppletSubscribeRecordBizImpl.java
...ud/book/applet/biz/impl/AppletSubscribeRecordBizImpl.java
+107
-0
AppletSubscribeCountDao.java
...a/com/pcloud/book/applet/dao/AppletSubscribeCountDao.java
+25
-0
AppletSubscribeRecordDao.java
.../com/pcloud/book/applet/dao/AppletSubscribeRecordDao.java
+15
-0
AppletSubscribeCountDaoImpl.java
...oud/book/applet/dao/impl/AppletSubscribeCountDaoImpl.java
+40
-0
AppletSubscribeRecordDaoImpl.java
...ud/book/applet/dao/impl/AppletSubscribeRecordDaoImpl.java
+21
-0
AppletSubscribeCount.java
...a/com/pcloud/book/applet/entity/AppletSubscribeCount.java
+42
-0
AppletSubscribeRecord.java
.../com/pcloud/book/applet/entity/AppletSubscribeRecord.java
+42
-0
SubscribeCountTypeEnum.java
.../com/pcloud/book/applet/enums/SubscribeCountTypeEnum.java
+31
-0
AppletSubscribeCountFacade.java
...pcloud/book/applet/facade/AppletSubscribeCountFacade.java
+114
-0
AppletSubscribeRecordFacade.java
...cloud/book/applet/facade/AppletSubscribeRecordFacade.java
+98
-0
AppletServiceImpl.java
...om/pcloud/book/applet/service/impl/AppletServiceImpl.java
+16
-0
TemplateConsr.java
.../java/com/pcloud/book/consumer/message/TemplateConsr.java
+61
-0
ReaderConsr.java
...ain/java/com/pcloud/book/consumer/reader/ReaderConsr.java
+40
-0
CultivateNotifyBiz.java
...ava/com/pcloud/book/cultivate/biz/CultivateNotifyBiz.java
+3
-2
CultivateNotifyBizImpl.java
...cloud/book/cultivate/biz/impl/CultivateNotifyBizImpl.java
+83
-9
CultivateRaysBizImpl.java
.../pcloud/book/cultivate/biz/impl/CultivateRaysBizImpl.java
+5
-0
CultivateNotifySendDao.java
...com/pcloud/book/cultivate/dao/CultivateNotifySendDao.java
+4
-0
CultivateNotifySendDaoImpl.java
...d/book/cultivate/dao/impl/CultivateNotifySendDaoImpl.java
+13
-0
CultivateNotifyDTO.java
...ava/com/pcloud/book/cultivate/dto/CultivateNotifyDTO.java
+6
-0
CultivateNotifyPageDTO.java
...com/pcloud/book/cultivate/dto/CultivateNotifyPageDTO.java
+3
-0
CultivateNotify.java
...ava/com/pcloud/book/cultivate/entity/CultivateNotify.java
+3
-0
NotifySendTypeEnum.java
...a/com/pcloud/book/cultivate/enums/NotifySendTypeEnum.java
+0
-32
CultivateNotifyFacade.java
...m/pcloud/book/cultivate/facade/CultivateNotifyFacade.java
+10
-0
AppletSubscribeCount.Mapper.xml
...n/resources/mapper/applet/AppletSubscribeCount.Mapper.xml
+120
-0
AppletSubscribeRecord.Mapper.xml
.../resources/mapper/applet/AppletSubscribeRecord.Mapper.xml
+101
-0
CultivateNotify.xml
...k/src/main/resources/mapper/cultivate/CultivateNotify.xml
+6
-3
CultivateNotifySend.xml
...c/main/resources/mapper/cultivate/CultivateNotifySend.xml
+31
-3
No files found.
pcloud-facade-book/src/main/java/com/pcloud/book/applet/enums/SubscribeRecordTypeEnum.java
0 → 100644
View file @
f015ce05
package
com
.
pcloud
.
book
.
applet
.
enums
;
public
enum
SubscribeRecordTypeEnum
{
ADD_SUBSCRIBE
(
1
,
"消息未读提醒"
),
SUB_SUBSCRIBE
(
2
,
"主人召回提醒"
);
public
Integer
value
;
public
String
desc
;
SubscribeRecordTypeEnum
(
Integer
value
,
String
desc
)
{
this
.
value
=
value
;
this
.
desc
=
desc
;
}
}
pcloud-facade-book/src/main/java/com/pcloud/book/applet/service/AppletService.java
View file @
f015ce05
...
@@ -154,4 +154,9 @@ public interface AppletService {
...
@@ -154,4 +154,9 @@ public interface AppletService {
@GetMapping
(
"getLatest10Books4Clock"
)
@GetMapping
(
"getLatest10Books4Clock"
)
ResponseEntity
<
ResponseDto
<
List
<
BookDto
>>>
getLatest10Books4Clock
(
@RequestParam
(
"wechatUserId"
)
Long
wechatUserId
,
ResponseEntity
<
ResponseDto
<
List
<
BookDto
>>>
getLatest10Books4Clock
(
@RequestParam
(
"wechatUserId"
)
Long
wechatUserId
,
@RequestParam
(
"officialAccountsId"
)
Long
officialAccountsId
);
@RequestParam
(
"officialAccountsId"
)
Long
officialAccountsId
);
@ApiOperation
(
"小程序订阅消息次数更新"
)
@GetMapping
(
"subAppletSubscribeCount"
)
void
subAppletSubscribeCount
(
@RequestParam
(
"wechatUserId"
)
Long
wechatUserId
,
@RequestParam
(
"recordType"
)
Integer
recordType
);
}
}
pcloud-facade-book/src/main/java/com/pcloud/book/cultivate/entity/CultivateNotifySend.java
View file @
f015ce05
...
@@ -33,26 +33,18 @@ public class CultivateNotifySend extends BaseEntity {
...
@@ -33,26 +33,18 @@ public class CultivateNotifySend extends BaseEntity {
@ApiModelProperty
(
"是否已读1-是,0-否"
)
@ApiModelProperty
(
"是否已读1-是,0-否"
)
private
Boolean
isRead
;
private
Boolean
isRead
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@ApiModelProperty
(
"阅读时间"
)
@ApiModelProperty
(
"阅读时间"
)
private
Date
readTime
;
private
Date
readTime
;
@ApiModelProperty
(
"标题"
)
@ApiModelProperty
(
"标题"
)
private
String
title
;
private
String
title
;
@JSONField
(
@ApiModelProperty
(
"是否首页展示"
)
format
=
"yyyy-MM-dd HH:mm:ss"
private
Integer
showHome
;
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@XmlElement
public
Date
getReadTime
()
{
return
this
.
createTime
;
}
public
void
setReadTime
(
Date
readTime
)
{
this
.
readTime
=
readTime
;
}
}
}
pcloud-facade-book/src/main/java/com/pcloud/book/cultivate/enums/NotifyMessageType.java
View file @
f015ce05
...
@@ -3,12 +3,13 @@ package com.pcloud.book.cultivate.enums;
...
@@ -3,12 +3,13 @@ package com.pcloud.book.cultivate.enums;
public
enum
NotifyMessageType
{
public
enum
NotifyMessageType
{
//消息类型(1-系统消息,2-通知消息,3-提醒消息,4-活动消息
//消息类型(1-系统消息,2-通知消息,3-提醒消息,4-活动消息
SYSTEM
(
1
,
"
系统消息
"
),
SYSTEM
(
1
,
"
小睿新鲜事
"
),
NOTICE
(
2
,
"
通知消息
"
),
NOTICE
(
2
,
"
互动提醒
"
),
REMEMBER
(
3
,
"
提醒
消息"
),
REMEMBER
(
3
,
"
系统
消息"
),
ACTIVITY
(
4
,
"
活动消息
"
),
ACTIVITY
(
4
,
"
优惠活动
"
),
MORE
(
5
,
"更多消息"
);
MORE
(
5
,
"更多消息"
);
public
Integer
code
;
public
Integer
code
;
public
String
desc
;
public
String
desc
;
...
...
pcloud-facade-book/src/main/java/com/pcloud/book/cultivate/enums/NotifySendTypeEnum.java
View file @
f015ce05
...
@@ -5,6 +5,10 @@ public enum NotifySendTypeEnum {
...
@@ -5,6 +5,10 @@ public enum NotifySendTypeEnum {
/**
/**
* 指定用户
* 指定用户
*/
*/
OTHER
(
0
),
/**
* 指定用户
*/
APPOINT_USER
(
1
),
APPOINT_USER
(
1
),
/**
/**
* 分类用户
* 分类用户
...
@@ -24,9 +28,10 @@ public enum NotifySendTypeEnum {
...
@@ -24,9 +28,10 @@ public enum NotifySendTypeEnum {
USER_PROFILE
(
5
),
USER_PROFILE
(
5
),
/**
/**
*
提出问题
*
用户学龄段
*/
*/
RAISE_QUESTIOIN
(
6
);
USER_GRADE
(
6
),
RAISE_QUESTIOIN
(
7
);
public
final
Integer
value
;
public
final
Integer
value
;
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/AppletSubscribeCountBiz.java
0 → 100644
View file @
f015ce05
package
com
.
pcloud
.
book
.
applet
.
biz
;
import
com.pcloud.book.applet.entity.AppletSubscribeCount
;
import
com.pcloud.common.page.PageBeanNew
;
/**
* (AppletSubscribeCount)表服务接口
*
* @author wubo
* @since 2021-08-03 09:37:45
*/
public
interface
AppletSubscribeCountBiz
{
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
AppletSubscribeCount
getById
(
Long
id
);
/**
* 分页查询
*/
PageBeanNew
getList
(
Integer
currentPage
,
Integer
numPerPage
);
/**
* 新增数据
*
* @param appletSubscribeCount 实例对象
* @return 主键
*/
Long
insert
(
AppletSubscribeCount
appletSubscribeCount
);
/**
* 修改数据
*
* @param appletSubscribeCount 实例对象
*/
void
update
(
AppletSubscribeCount
appletSubscribeCount
);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
void
deleteById
(
Long
id
);
/**
* 通过主键软删除数据
*
* @param id 主键
* @return 是否成功
*/
void
softDeleteById
(
Long
id
);
/**
* 获取用户订阅次数
* @param wechatUserId
* @param recordType
* @return
*/
AppletSubscribeCount
getByUserId
(
Long
wechatUserId
,
Integer
recordType
);
/**
* 清除用户次数
* @param wechatUserId
* @param recordType
*/
void
clearSubscribeCount
(
Long
wechatUserId
,
Integer
recordType
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/AppletSubscribeRecordBiz.java
0 → 100644
View file @
f015ce05
package
com
.
pcloud
.
book
.
applet
.
biz
;
import
com.pcloud.book.applet.entity.AppletSubscribeRecord
;
import
com.pcloud.common.page.PageBeanNew
;
/**
* (AppletSubscribeRecord)表服务接口
*
* @author wubo
* @since 2021-08-03 09:37:00
*/
public
interface
AppletSubscribeRecordBiz
{
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
AppletSubscribeRecord
getById
(
Long
id
);
/**
* 分页查询
*/
PageBeanNew
getList
(
Integer
currentPage
,
Integer
numPerPage
);
/**
* 新增数据
*
* @param appletSubscribeRecord 实例对象
* @return 主键
*/
Long
insert
(
AppletSubscribeRecord
appletSubscribeRecord
);
/**
* 修改数据
*
* @param appletSubscribeRecord 实例对象
*/
void
update
(
AppletSubscribeRecord
appletSubscribeRecord
);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
void
deleteById
(
Long
id
);
/**
* 通过主键软删除数据
*
* @param id 主键
* @return 是否成功
*/
void
softDeleteById
(
Long
id
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletSubscribeCountBizImpl.java
0 → 100644
View file @
f015ce05
package
com
.
pcloud
.
book
.
applet
.
biz
.
impl
;
import
com.pcloud.book.applet.biz.AppletSubscribeCountBiz
;
import
com.pcloud.book.applet.dao.AppletSubscribeCountDao
;
import
com.pcloud.book.applet.entity.AppletSubscribeCount
;
import
com.pcloud.book.applet.enums.SubscribeCountTypeEnum
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.NumberUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* (AppletSubscribeCount)表服务实现类
*
* @author wubo
* @since 2021-08-03 09:37:45
*/
@Service
(
"appletSubscribeCountBiz"
)
public
class
AppletSubscribeCountBizImpl
implements
AppletSubscribeCountBiz
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
AppletSubscribeCountBizImpl
.
class
);
@Autowired
private
AppletSubscribeCountDao
appletSubscribeCountDao
;
@Override
@ParamLog
(
"通过ID查询单条数据"
)
public
AppletSubscribeCount
getById
(
Long
id
)
{
return
appletSubscribeCountDao
.
getById
(
id
);
}
@Override
@ParamLog
(
"查询多条数据"
)
public
PageBeanNew
getList
(
Integer
currentPage
,
Integer
numPerPage
)
{
PageBeanNew
pageBeanNew
=
appletSubscribeCountDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
null
,
"getList"
);
List
recordList
=
pageBeanNew
.
getRecordList
();
if
(
ListUtils
.
isEmpty
(
recordList
))
{
return
pageBeanNew
;
}
// 加载其它数据
return
pageBeanNew
;
}
@Override
@ParamLog
(
"新增"
)
public
Long
insert
(
AppletSubscribeCount
appletSubscribeCount
)
{
appletSubscribeCountDao
.
insert
(
appletSubscribeCount
);
return
appletSubscribeCount
.
getId
();
}
@Override
@ParamLog
(
"修改"
)
public
void
update
(
AppletSubscribeCount
appletSubscribeCount
)
{
if
(
appletSubscribeCount
==
null
||
!
NumberUtil
.
isNumber
(
appletSubscribeCount
.
getId
()))
{
throw
BizException
.
PARAM_IS_NULL
;
}
appletSubscribeCountDao
.
update
(
appletSubscribeCount
);
}
@Override
@ParamLog
(
"删除"
)
public
void
deleteById
(
Long
id
)
{
appletSubscribeCountDao
.
deleteById
(
id
);
}
@Override
@ParamLog
(
"软删除"
)
public
void
softDeleteById
(
Long
id
)
{
appletSubscribeCountDao
.
softDeleteById
(
id
);
}
@Override
@ParamLog
(
"获取用户订阅次数"
)
public
AppletSubscribeCount
getByUserId
(
Long
wechatUserId
,
Integer
recordType
)
{
return
appletSubscribeCountDao
.
getByUserId
(
wechatUserId
,
recordType
);
}
@Override
@ParamLog
(
"清零用户次数"
)
public
void
clearSubscribeCount
(
Long
wechatUserId
,
Integer
recordType
)
{
appletSubscribeCountDao
.
clearSubscribeCount
(
wechatUserId
,
recordType
);
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletSubscribeRecordBizImpl.java
0 → 100644
View file @
f015ce05
package
com
.
pcloud
.
book
.
applet
.
biz
.
impl
;
import
com.pcloud.book.applet.biz.AppletSubscribeCountBiz
;
import
com.pcloud.book.applet.biz.AppletSubscribeRecordBiz
;
import
com.pcloud.book.applet.dao.AppletSubscribeRecordDao
;
import
com.pcloud.book.applet.entity.AppletSubscribeCount
;
import
com.pcloud.book.applet.entity.AppletSubscribeRecord
;
import
com.pcloud.book.applet.enums.SubscribeCountTypeEnum
;
import
com.pcloud.book.util.common.YesOrNoEnums
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.NumberUtil
;
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.util.List
;
/**
* (AppletSubscribeRecord)表服务实现类
*
* @author wubo
* @since 2021-08-03 09:37:01
*/
@Service
(
"appletSubscribeRecordBiz"
)
public
class
AppletSubscribeRecordBizImpl
implements
AppletSubscribeRecordBiz
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
AppletSubscribeRecordBizImpl
.
class
);
@Autowired
private
AppletSubscribeRecordDao
appletSubscribeRecordDao
;
@Autowired
private
AppletSubscribeCountBiz
appletSubscribeCountBiz
;
@Override
@ParamLog
(
"通过ID查询单条数据"
)
public
AppletSubscribeRecord
getById
(
Long
id
)
{
return
appletSubscribeRecordDao
.
getById
(
id
);
}
@Override
@ParamLog
(
"查询多条数据"
)
public
PageBeanNew
getList
(
Integer
currentPage
,
Integer
numPerPage
)
{
PageBeanNew
pageBeanNew
=
appletSubscribeRecordDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
null
,
"getList"
);
List
recordList
=
pageBeanNew
.
getRecordList
();
if
(
ListUtils
.
isEmpty
(
recordList
))
{
return
pageBeanNew
;
}
// 加载其它数据
return
pageBeanNew
;
}
@Override
@ParamLog
(
"新增"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Long
insert
(
AppletSubscribeRecord
appletSubscribeRecord
)
{
if
(
null
==
appletSubscribeRecord
||
null
==
appletSubscribeRecord
.
getRecordType
())
{
throw
new
BizException
(
BizException
.
PARAM_IS_NULL
.
getCode
(),
"新增消息授权失败"
);
}
appletSubscribeRecordDao
.
insert
(
appletSubscribeRecord
);
//查询用户订阅次数
Integer
subscribeRecordCount
=
SubscribeCountTypeEnum
.
getCountByValue
(
appletSubscribeRecord
.
getCountType
());
AppletSubscribeCount
subscribeCount
=
appletSubscribeCountBiz
.
getByUserId
(
appletSubscribeRecord
.
getWechatUserId
(),
appletSubscribeRecord
.
getRecordType
());
if
(
null
==
subscribeCount
&&
subscribeRecordCount
>
0
)
{
subscribeCount
=
new
AppletSubscribeCount
();
subscribeCount
.
setWechatUserId
(
appletSubscribeRecord
.
getWechatUserId
());
subscribeCount
.
setValidCount
(
YesOrNoEnums
.
YES
.
getValue
());
subscribeCount
.
setRecordType
(
appletSubscribeRecord
.
getRecordType
());
appletSubscribeCountBiz
.
insert
(
subscribeCount
);
}
else
if
(
null
!=
subscribeCount
){
subscribeCount
.
setValidCount
(
subscribeCount
.
getValidCount
()
+
subscribeRecordCount
);
if
(
subscribeCount
.
getValidCount
()
<
0
)
{
subscribeCount
.
setValidCount
(
0
);
}
appletSubscribeCountBiz
.
update
(
subscribeCount
);
}
return
appletSubscribeRecord
.
getId
();
}
@Override
@ParamLog
(
"修改"
)
public
void
update
(
AppletSubscribeRecord
appletSubscribeRecord
)
{
if
(
appletSubscribeRecord
==
null
||
!
NumberUtil
.
isNumber
(
appletSubscribeRecord
.
getId
()))
{
throw
BizException
.
PARAM_IS_NULL
;
}
appletSubscribeRecordDao
.
update
(
appletSubscribeRecord
);
}
@Override
@ParamLog
(
"删除"
)
public
void
deleteById
(
Long
id
)
{
appletSubscribeRecordDao
.
deleteById
(
id
);
}
@Override
@ParamLog
(
"软删除"
)
public
void
softDeleteById
(
Long
id
)
{
appletSubscribeRecordDao
.
softDeleteById
(
id
);
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/AppletSubscribeCountDao.java
0 → 100644
View file @
f015ce05
package
com
.
pcloud
.
book
.
applet
.
dao
;
import
com.pcloud.book.applet.entity.AppletSubscribeCount
;
import
com.pcloud.common.core.dao.BaseDao
;
/**
* (AppletSubscribeCount)表数据库访问层
*
* @author wubo
* @since 2021-08-03 09:37:45
*/
public
interface
AppletSubscribeCountDao
extends
BaseDao
<
AppletSubscribeCount
>
{
int
softDeleteById
(
Long
id
);
/**
* 获取用户订阅次数
* @param wechatUserId
* @param recordType
* @return
*/
AppletSubscribeCount
getByUserId
(
Long
wechatUserId
,
Integer
recordType
);
void
clearSubscribeCount
(
Long
wechatUserId
,
Integer
recordType
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/AppletSubscribeRecordDao.java
0 → 100644
View file @
f015ce05
package
com
.
pcloud
.
book
.
applet
.
dao
;
import
com.pcloud.book.applet.entity.AppletSubscribeRecord
;
import
com.pcloud.common.core.dao.BaseDao
;
/**
* (AppletSubscribeRecord)表数据库访问层
*
* @author wubo
* @since 2021-08-03 09:37:00
*/
public
interface
AppletSubscribeRecordDao
extends
BaseDao
<
AppletSubscribeRecord
>
{
int
softDeleteById
(
Long
id
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/impl/AppletSubscribeCountDaoImpl.java
0 → 100644
View file @
f015ce05
package
com
.
pcloud
.
book
.
applet
.
dao
.
impl
;
import
com.pcloud.book.applet.dao.AppletSubscribeCountDao
;
import
com.pcloud.book.applet.entity.AppletSubscribeCount
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Repository
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* (AppletSubscribeCount)表数据库访问层
*
* @author wubo
* @since 2021-08-03 09:37:45
*/
@Repository
(
"appletSubscribeCountDaoImpl"
)
public
class
AppletSubscribeCountDaoImpl
extends
BaseDaoImpl
<
AppletSubscribeCount
>
implements
AppletSubscribeCountDao
{
public
int
softDeleteById
(
Long
id
)
{
return
getSessionTemplate
().
update
(
getStatement
(
"softDeleteById"
),
id
);
}
@Override
public
AppletSubscribeCount
getByUserId
(
Long
wechatUserId
,
Integer
recordType
)
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"wechatUserId"
,
wechatUserId
);
params
.
put
(
"recordType"
,
recordType
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getByUserId"
),
params
);
}
@Override
public
void
clearSubscribeCount
(
Long
wechatUserId
,
Integer
recordType
)
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"wechatUserId"
,
wechatUserId
);
params
.
put
(
"recordType"
,
recordType
);
getSessionTemplate
().
update
(
getStatement
(
"clearSubscribeCount"
),
params
);
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/impl/AppletSubscribeRecordDaoImpl.java
0 → 100644
View file @
f015ce05
package
com
.
pcloud
.
book
.
applet
.
dao
.
impl
;
import
com.pcloud.book.applet.dao.AppletSubscribeRecordDao
;
import
com.pcloud.book.applet.entity.AppletSubscribeRecord
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Repository
;
/**
* (AppletSubscribeRecord)表数据库访问层
*
* @author wubo
* @since 2021-08-03 09:37:00
*/
@Repository
(
"appletSubscribeRecordDaoImpl"
)
public
class
AppletSubscribeRecordDaoImpl
extends
BaseDaoImpl
<
AppletSubscribeRecord
>
implements
AppletSubscribeRecordDao
{
public
int
softDeleteById
(
Long
id
)
{
return
getSessionTemplate
().
update
(
getStatement
(
"softDeleteById"
),
id
);
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/entity/AppletSubscribeCount.java
0 → 100644
View file @
f015ce05
package
com
.
pcloud
.
book
.
applet
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
/**
* (AppletSubscribeCount)实体类
*
* @author wubo
* @since 2021-08-09 10:54:38
*/
@Data
public
class
AppletSubscribeCount
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
-
91920484989934172L
;
@ApiModelProperty
(
"主键id"
)
private
Long
id
;
@ApiModelProperty
(
"用户id"
)
private
Long
wechatUserId
;
@ApiModelProperty
(
"记录类型 1 消息未读提醒 2 主人召回提醒"
)
private
Integer
recordType
;
@ApiModelProperty
(
"可用次数"
)
private
Integer
validCount
;
@ApiModelProperty
(
"创建时间"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
@ApiModelProperty
(
"更新时间"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
updateTime
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/entity/AppletSubscribeRecord.java
0 → 100644
View file @
f015ce05
package
com
.
pcloud
.
book
.
applet
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
/**
* (AppletSubscribeRecord)实体类
*
* @author wubo
* @since 2021-08-09 10:51:15
*/
@Data
public
class
AppletSubscribeRecord
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
190586377697572581L
;
@ApiModelProperty
(
"主键id"
)
private
Long
id
;
@ApiModelProperty
(
"用户id"
)
private
Long
wechatUserId
;
@ApiModelProperty
(
"记录类型 1 消息未读提醒 2 主人召回提醒"
)
private
Integer
recordType
;
@ApiModelProperty
(
"记录类型 1 小程序服务消息+1 2 小程序服务消息-1 "
)
private
Integer
countType
;
@ApiModelProperty
(
"创建时间"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
@ApiModelProperty
(
"更新时间"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
updateTime
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/enums/SubscribeCountTypeEnum.java
0 → 100644
View file @
f015ce05
package
com
.
pcloud
.
book
.
applet
.
enums
;
public
enum
SubscribeCountTypeEnum
{
ADD_SUBSCRIBE
(
1
,
"增加订阅次数"
,
1
),
SUB_SUBSCRIBE
(
2
,
"减少订阅次数"
,
-
1
);
public
Integer
value
;
public
String
desc
;
public
Integer
subscribeCount
;
SubscribeCountTypeEnum
(
Integer
value
,
String
desc
,
Integer
subscribeCount
)
{
this
.
value
=
value
;
this
.
desc
=
desc
;
this
.
subscribeCount
=
subscribeCount
;
}
public
static
Integer
getCountByValue
(
Integer
value
){
SubscribeCountTypeEnum
[]
subscribeRecordTypeEnums
=
values
();
for
(
int
i
=
0
;
i
<
subscribeRecordTypeEnums
.
length
;
i
++)
{
SubscribeCountTypeEnum
subscribeRecordTypeEnum
=
subscribeRecordTypeEnums
[
i
];
if
(
subscribeRecordTypeEnum
.
value
.
equals
(
value
)){
return
subscribeRecordTypeEnum
.
subscribeCount
;
}
}
return
null
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/facade/AppletSubscribeCountFacade.java
0 → 100644
View file @
f015ce05
package
com
.
pcloud
.
book
.
applet
.
facade
;
import
com.pcloud.book.applet.biz.AppletSubscribeCountBiz
;
import
com.pcloud.book.applet.entity.AppletSubscribeCount
;
import
com.pcloud.book.applet.entity.AppletSubscribeRecord
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.utils.cookie.Cookie
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* (AppletSubscribeCount)表控制层
*
* @author wubo
* @since 2021-08-03 09:37:46
*/
@RestController
(
"appletSubscribeCountFacade"
)
@RequestMapping
(
"appletSubscribeCount"
)
public
class
AppletSubscribeCountFacade
{
@Autowired
private
AppletSubscribeCountBiz
appletSubscribeCountBiz
;
@ApiOperation
(
"通过主键查询单条数据"
)
@GetMapping
(
"getById"
)
public
ResponseDto
<?>
getById
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
Long
id
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
appletSubscribeCountBiz
.
getById
(
id
));
}
@ApiOperation
(
"分页查询"
)
@GetMapping
(
"getList"
)
public
ResponseDto
<?>
getList
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
value
=
"currentPage"
,
defaultValue
=
"0"
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
defaultValue
=
"10"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
appletSubscribeCountBiz
.
getList
(
currentPage
,
numPerPage
));
}
@ApiOperation
(
"新增"
)
@PostMapping
(
"insert"
)
public
ResponseDto
<?>
insert
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestBody
AppletSubscribeCount
appletSubscribeCount
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
appletSubscribeCountBiz
.
insert
(
appletSubscribeCount
));
}
@ApiOperation
(
"更新"
)
@PostMapping
(
"update"
)
public
ResponseDto
<?>
update
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestBody
AppletSubscribeCount
appletSubscribeCount
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
appletSubscribeCountBiz
.
update
(
appletSubscribeCount
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"删除"
)
@GetMapping
(
"deleteById"
)
public
ResponseDto
<?>
deleteById
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
Long
id
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
id
)
{
throw
BizException
.
PARAM_DELETION
;
}
appletSubscribeCountBiz
.
deleteById
(
id
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"软删除"
)
@GetMapping
(
"softDeleteById"
)
public
ResponseDto
<?>
softDeleteById
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
Long
id
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
id
)
{
throw
BizException
.
PARAM_DELETION
;
}
appletSubscribeCountBiz
.
softDeleteById
(
id
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"通过用户id查询单条数据"
)
@GetMapping
(
"getByUserId"
)
public
ResponseDto
<?>
getByUserId
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
value
=
"recordType"
,
required
=
false
)
Integer
recordType
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
AppletSubscribeCount
byUserId
=
appletSubscribeCountBiz
.
getByUserId
(
wechatUserId
,
recordType
);
return
new
ResponseDto
<>(
null
==
byUserId
?
0L
:
byUserId
.
getValidCount
());
}
@ApiOperation
(
"清零用户次数"
)
@GetMapping
(
"clearSubsribeCount"
)
public
ResponseDto
<?>
clearSubscribeCount
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
value
=
"recordType"
,
required
=
false
)
Integer
recordType
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
appletSubscribeCountBiz
.
clearSubscribeCount
(
wechatUserId
,
recordType
);
return
new
ResponseDto
<>();
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/facade/AppletSubscribeRecordFacade.java
0 → 100644
View file @
f015ce05
package
com
.
pcloud
.
book
.
applet
.
facade
;
import
com.pcloud.book.applet.biz.AppletSubscribeRecordBiz
;
import
com.pcloud.book.applet.entity.AppletSubscribeRecord
;
import
com.pcloud.book.applet.enums.SubscribeCountTypeEnum
;
import
com.pcloud.book.applet.enums.SubscribeRecordTypeEnum
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.utils.cookie.Cookie
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* (AppletSubscribeRecord)表控制层
*
* @author wubo
* @since 2021-08-03 09:37:01
*/
@RestController
(
"appletSubscribeRecordFacade"
)
@RequestMapping
(
"appletSubscribeRecord"
)
public
class
AppletSubscribeRecordFacade
{
@Autowired
private
AppletSubscribeRecordBiz
appletSubscribeRecordBiz
;
@ApiOperation
(
"通过主键查询单条数据"
)
@GetMapping
(
"getById"
)
public
ResponseDto
<?>
getById
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
Long
id
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
appletSubscribeRecordBiz
.
getById
(
id
));
}
@ApiOperation
(
"分页查询"
)
@GetMapping
(
"getList"
)
public
ResponseDto
<?>
getList
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
value
=
"currentPage"
,
defaultValue
=
"0"
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
defaultValue
=
"10"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
appletSubscribeRecordBiz
.
getList
(
currentPage
,
numPerPage
));
}
@ApiOperation
(
"新增"
)
@PostMapping
(
"insert"
)
public
ResponseDto
<?>
insert
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestBody
AppletSubscribeRecord
appletSubscribeRecord
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
appletSubscribeRecord
.
setWechatUserId
(
wechatUserId
);
appletSubscribeRecord
.
setCountType
(
SubscribeCountTypeEnum
.
ADD_SUBSCRIBE
.
value
);
return
new
ResponseDto
<>(
appletSubscribeRecordBiz
.
insert
(
appletSubscribeRecord
));
}
@ApiOperation
(
"更新"
)
@PostMapping
(
"update"
)
public
ResponseDto
<?>
update
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestBody
AppletSubscribeRecord
appletSubscribeRecord
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
appletSubscribeRecordBiz
.
update
(
appletSubscribeRecord
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"删除"
)
@GetMapping
(
"deleteById"
)
public
ResponseDto
<?>
deleteById
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
Long
id
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
id
)
{
throw
BizException
.
PARAM_DELETION
;
}
appletSubscribeRecordBiz
.
deleteById
(
id
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"软删除"
)
@GetMapping
(
"softDeleteById"
)
public
ResponseDto
<?>
softDeleteById
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
Long
id
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
id
)
{
throw
BizException
.
PARAM_DELETION
;
}
appletSubscribeRecordBiz
.
softDeleteById
(
id
);
return
new
ResponseDto
<>();
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/service/impl/AppletServiceImpl.java
View file @
f015ce05
...
@@ -8,6 +8,7 @@ import com.pcloud.book.applet.biz.AppletNewsBiz;
...
@@ -8,6 +8,7 @@ import com.pcloud.book.applet.biz.AppletNewsBiz;
import
com.pcloud.book.applet.biz.AppletRecordBiz
;
import
com.pcloud.book.applet.biz.AppletRecordBiz
;
import
com.pcloud.book.applet.biz.AppletRecordStatisBiz
;
import
com.pcloud.book.applet.biz.AppletRecordStatisBiz
;
import
com.pcloud.book.applet.biz.AppletRecordAggrStatisBiz
;
import
com.pcloud.book.applet.biz.AppletRecordAggrStatisBiz
;
import
com.pcloud.book.applet.biz.AppletSubscribeRecordBiz
;
import
com.pcloud.book.applet.biz.AppletThirdResourcesStaticBiz
;
import
com.pcloud.book.applet.biz.AppletThirdResourcesStaticBiz
;
import
com.pcloud.book.applet.biz.AppletUserBookcaseBiz
;
import
com.pcloud.book.applet.biz.AppletUserBookcaseBiz
;
import
com.pcloud.book.applet.biz.ReadBookRecordBiz
;
import
com.pcloud.book.applet.biz.ReadBookRecordBiz
;
...
@@ -22,7 +23,9 @@ import com.pcloud.book.applet.dto.AppletThirdResourcesDTO;
...
@@ -22,7 +23,9 @@ import com.pcloud.book.applet.dto.AppletThirdResourcesDTO;
import
com.pcloud.book.applet.dto.BaseTempletClassifyDTO
;
import
com.pcloud.book.applet.dto.BaseTempletClassifyDTO
;
import
com.pcloud.book.applet.dto.PcloudGroupActivityDTO
;
import
com.pcloud.book.applet.dto.PcloudGroupActivityDTO
;
import
com.pcloud.book.applet.dto.ServeCollectDTO
;
import
com.pcloud.book.applet.dto.ServeCollectDTO
;
import
com.pcloud.book.applet.entity.AppletSubscribeRecord
;
import
com.pcloud.book.applet.entity.ServeCollect
;
import
com.pcloud.book.applet.entity.ServeCollect
;
import
com.pcloud.book.applet.enums.SubscribeCountTypeEnum
;
import
com.pcloud.book.applet.service.AppletService
;
import
com.pcloud.book.applet.service.AppletService
;
import
com.pcloud.book.book.dto.BookDto
;
import
com.pcloud.book.book.dto.BookDto
;
import
com.pcloud.book.group.biz.ResourcePageBiz
;
import
com.pcloud.book.group.biz.ResourcePageBiz
;
...
@@ -94,6 +97,8 @@ public class AppletServiceImpl implements AppletService {
...
@@ -94,6 +97,8 @@ public class AppletServiceImpl implements AppletService {
private
AppletUserBookcaseBiz
appletUserBookcaseBiz
;
private
AppletUserBookcaseBiz
appletUserBookcaseBiz
;
@Autowired
@Autowired
private
ResourcePageBiz
resourcePageBiz
;
private
ResourcePageBiz
resourcePageBiz
;
@Autowired
private
AppletSubscribeRecordBiz
subscribeRecordBiz
;
@Override
@Override
...
@@ -278,4 +283,15 @@ public class AppletServiceImpl implements AppletService {
...
@@ -278,4 +283,15 @@ public class AppletServiceImpl implements AppletService {
@RequestParam
(
"officialAccountsId"
)
Long
officialAccountsId
)
{
@RequestParam
(
"officialAccountsId"
)
Long
officialAccountsId
)
{
return
ResponseHandleUtil
.
toResponse
(
appletUserBookcaseBiz
.
getLatest10Books4Clock
(
wechatUserId
,
officialAccountsId
));
return
ResponseHandleUtil
.
toResponse
(
appletUserBookcaseBiz
.
getLatest10Books4Clock
(
wechatUserId
,
officialAccountsId
));
}
}
@Override
@GetMapping
({
"subAppletSubscribeCount"
})
public
void
subAppletSubscribeCount
(
@RequestParam
(
"wechatUserId"
)
Long
wechatUserId
,
@RequestParam
(
"recordType"
)
Integer
recordType
)
{
AppletSubscribeRecord
record
=
new
AppletSubscribeRecord
();
record
.
setWechatUserId
(
wechatUserId
);
record
.
setRecordType
(
recordType
);
record
.
setCountType
(
SubscribeCountTypeEnum
.
SUB_SUBSCRIBE
.
value
);
subscribeRecordBiz
.
insert
(
record
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/consumer/message/TemplateConsr.java
View file @
f015ce05
...
@@ -3,19 +3,33 @@
...
@@ -3,19 +3,33 @@
*/
*/
package
com
.
pcloud
.
book
.
consumer
.
message
;
package
com
.
pcloud
.
book
.
consumer
.
message
;
import
com.pcloud.book.book.constant.BookConstant
;
import
com.pcloud.book.consumer.reader.ReaderConsr
;
import
com.pcloud.book.consumer.user.ChannelConsr
;
import
com.pcloud.channelcenter.wechat.entity.AccountSetting
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.biz.TemplateQueueBiz
;
import
com.pcloud.common.core.biz.TemplateQueueBiz
;
import
com.pcloud.common.core.constant.SceneCode
;
import
com.pcloud.common.core.constant.SendType
;
import
com.pcloud.common.core.constant.WechatCode
;
import
com.pcloud.common.core.constant.WechatCode
;
import
com.pcloud.common.core.dto.AppletTemplateMessageDto
;
import
com.pcloud.common.core.dto.AppletTemplateMessageDto
;
import
com.pcloud.common.core.dto.TemplateMessageDto
;
import
com.pcloud.common.core.dto.TemplateMessageDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.readercenter.common.utils.ReaderConstants
;
import
com.pcloud.readercenter.wechat.entity.WechatUserOfficialAccounts
;
import
org.apache.commons.collections.MapUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
/**
* @描述:发送模板消息
* @描述:发送模板消息
...
@@ -33,6 +47,12 @@ public class TemplateConsr {
...
@@ -33,6 +47,12 @@ public class TemplateConsr {
@Autowired
@Autowired
private
TemplateQueueBiz
templateQueueBiz
;
private
TemplateQueueBiz
templateQueueBiz
;
@Autowired
private
ReaderConsr
readerConsr
;
@Value
(
"${operate_official_id}"
)
private
Long
operateOfficalId
;
@Autowired
private
ChannelConsr
channelConsr
;
/**
/**
* 发送模板消息topic(管理公众号)
* 发送模板消息topic(管理公众号)
...
@@ -86,4 +106,45 @@ public class TemplateConsr {
...
@@ -86,4 +106,45 @@ public class TemplateConsr {
LOGGER
.
error
(
"【小程序模板消息(消)】发送小程序模板消息topic,<ERROR>.[sendAppletMessageQueue]:"
+
e
.
getMessage
(),
e
);
LOGGER
.
error
(
"【小程序模板消息(消)】发送小程序模板消息topic,<ERROR>.[sendAppletMessageQueue]:"
+
e
.
getMessage
(),
e
);
}
}
}
}
public
void
sendTempletMessage4Project
(
String
keyword1
,
String
keyword2
,
Long
wechatUserId
,
String
pagepath
)
{
LOGGER
.
info
(
"小睿宠物发送模板消息业务进度提醒keyword1:{},keyword2:{}, wechatUserId:{},pagepath:{},"
,
keyword1
,
keyword2
,
wechatUserId
,
pagepath
);
Map
<
String
,
String
>
temParam
=
new
HashMap
<>();
temParam
.
put
(
"first"
,
"主人召回提醒"
);
temParam
.
put
(
"keyword1"
,
keyword1
);
temParam
.
put
(
"keyword2"
,
keyword2
);
temParam
.
put
(
"remark"
,
"点击查看详情"
);
List
<
Long
>
allUserIds
=
readerConsr
.
getAllUserIds
(
wechatUserId
);
if
(
ListUtils
.
isEmpty
(
allUserIds
))
{
return
;
}
Map
<
Long
,
WechatUserOfficialAccounts
>
userOfficalAccountMap
=
readerConsr
.
getUserOfficalAccountMap
(
allUserIds
);
if
(
MapUtils
.
isEmpty
(
userOfficalAccountMap
))
{
return
;
}
List
<
WechatUserOfficialAccounts
>
wechatUserOfficialAccounts
=
userOfficalAccountMap
.
values
().
stream
().
filter
(
e
->
operateOfficalId
.
equals
(
e
.
getOfficialAccountsId
())).
collect
(
Collectors
.
toList
());
if
(
ListUtils
.
isEmpty
(
wechatUserOfficialAccounts
))
{
return
;
}
//公众号用户id
wechatUserId
=
wechatUserOfficialAccounts
.
get
(
0
).
getWechatUserId
();
// 组装参数对象
TemplateMessageDto
templateMessageDto
=
new
TemplateMessageDto
();
templateMessageDto
.
setSceneCode
(
SceneCode
.
PROJECT_TASK_SCENE
.
value
);
templateMessageDto
.
setAccountSettingId
(
operateOfficalId
);
AccountSetting
officialAccountsInfo
=
channelConsr
.
getAppInfo
(
ReaderConstants
.
MINI_OFFICIAL_ID
);
templateMessageDto
.
setMiniprogramAppid
(
officialAccountsInfo
.
getDeveloperAppId
());
templateMessageDto
.
setMiniprogramPagepath
(
pagepath
);
templateMessageDto
.
setTemParam
(
temParam
);
templateMessageDto
.
setSendType
(
SendType
.
SEND_BY_WECHAT
.
value
);
templateMessageDto
.
setWechatUserId
(
wechatUserId
);
templateMessageDto
.
setIsApp
(
false
);
try
{
templateQueueBiz
.
sendMessageQueue
(
templateMessageDto
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"【模板消息(消)】发送模板消息-业务进度提醒小睿宠物发送模板消息,<ERROR>.[sendMessageQueue]:"
+
e
.
getMessage
(),
e
);
}
LOGGER
.
info
(
"小小睿宠物发送模板消息业务进度提醒[END]"
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/consumer/reader/ReaderConsr.java
View file @
f015ce05
...
@@ -477,6 +477,46 @@ public class ReaderConsr {
...
@@ -477,6 +477,46 @@ public class ReaderConsr {
}
}
return
null
;
return
null
;
}
}
public
List
<
Long
>
getWechatUserIdsByGradeIds
(
List
<
Long
>
userGradeLabelIds
)
{
LOGGER
.
info
(
"根据年级标签获取小程序用户id"
);
List
<
Long
>
list
=
new
ArrayList
<>();
if
(
ListUtils
.
isEmpty
(
userGradeLabelIds
))
{
return
list
;
}
try
{
list
=
ResponseHandleUtil
.
parseList
(
userLabelService
.
getWechatUserIdsByGradeIds
(
userGradeLabelIds
),
Long
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"调用wechatUserService.getWechatUserIdsByGradeIds失败"
+
e
.
getMessage
(),
e
);
}
return
list
;
}
public
List
<
Long
>
getAllUserIds
(
Long
wechatUserId
)
{
List
<
Long
>
allUserIds
=
new
ArrayList
<>();
try
{
allUserIds
=
ResponseHandleUtil
.
parseList
(
raysUnionUserService
.
getAllUnionUser
(
wechatUserId
),
Long
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"raysUnionUserService.getAllUserIds"
+
e
.
getMessage
(),
e
);
}
return
allUserIds
;
}
public
Map
<
Long
,
WechatUserOfficialAccounts
>
getUserOfficalAccountMap
(
List
<
Long
>
allUserIds
)
{
if
(
ListUtils
.
isEmpty
(
allUserIds
))
{
return
null
;
}
LOGGER
.
info
(
"【微信用户(消)】批量获取用户公众号 ,<START>.[wechatUserIds]="
+
allUserIds
);
Map
<
Long
,
WechatUserOfficialAccounts
>
wechatUserOfficialAccountsMap
=
null
;
try
{
wechatUserOfficialAccountsMap
=
ResponseHandleUtil
.
parseMap
(
wechatUserService
.
getUserOfficalAccountMap
(
allUserIds
),
Long
.
class
,
WechatUserOfficialAccounts
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"【微信用户(消)】批量获取用户公众号.[getUserOfficalAccountMap]:"
+
e
.
getMessage
(),
e
);
}
LOGGER
.
info
(
"【微信用户(消)】批量获取用户公众号,<END>"
);
return
wechatUserOfficialAccountsMap
;
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/biz/CultivateNotifyBiz.java
View file @
f015ce05
...
@@ -6,7 +6,6 @@ import com.pcloud.book.cultivate.dto.CultivateNotifyPageDTO;
...
@@ -6,7 +6,6 @@ import com.pcloud.book.cultivate.dto.CultivateNotifyPageDTO;
import
com.pcloud.book.cultivate.dto.NotifySendDTO
;
import
com.pcloud.book.cultivate.dto.NotifySendDTO
;
import
com.pcloud.book.cultivate.dto.SearchNotifyDTO
;
import
com.pcloud.book.cultivate.dto.SearchNotifyDTO
;
import
com.pcloud.book.cultivate.dto.SearchSendUserDTO
;
import
com.pcloud.book.cultivate.dto.SearchSendUserDTO
;
import
com.pcloud.book.cultivate.dto.SendUserDetailDto
;
import
com.pcloud.book.cultivate.entity.AppletNotifySendDTO
;
import
com.pcloud.book.cultivate.entity.AppletNotifySendDTO
;
import
com.pcloud.book.cultivate.entity.CultivateNotifySend
;
import
com.pcloud.book.cultivate.entity.CultivateNotifySend
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageBeanNew
;
...
@@ -20,7 +19,7 @@ public interface CultivateNotifyBiz {
...
@@ -20,7 +19,7 @@ public interface CultivateNotifyBiz {
void
createNotify
(
CultivateNotifyDTO
cultivateNotifyDTO
);
void
createNotify
(
CultivateNotifyDTO
cultivateNotifyDTO
);
void
sendAppletTemplateMessage
(
List
<
CultivateNotifySend
>
list
,
Long
ag
net
Id
);
void
sendAppletTemplateMessage
(
List
<
CultivateNotifySend
>
list
,
Long
ag
entId
,
Long
miniOfficialAccounts
Id
);
PageBeanNew
<
CultivateNotifyPageDTO
>
listPage4CultivateNotify
(
SearchNotifyDTO
searchNotifyDTO
);
PageBeanNew
<
CultivateNotifyPageDTO
>
listPage4CultivateNotify
(
SearchNotifyDTO
searchNotifyDTO
);
...
@@ -47,4 +46,6 @@ public interface CultivateNotifyBiz {
...
@@ -47,4 +46,6 @@ public interface CultivateNotifyBiz {
void
clearExpireNotifies
();
void
clearExpireNotifies
();
Long
sendNotifyToUser
(
NotifySendDTO
notifySendDTO
);
Long
sendNotifyToUser
(
NotifySendDTO
notifySendDTO
);
List
<
CultivateNotifyDTO
>
getLastNoReadNotify
(
Long
wechatUserId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/biz/impl/CultivateNotifyBizImpl.java
View file @
f015ce05
...
@@ -6,7 +6,6 @@ import com.google.common.collect.Lists;
...
@@ -6,7 +6,6 @@ import com.google.common.collect.Lists;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.book.applet.biz.AppletNewsBiz
;
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.AppletNewsDTO
;
import
com.pcloud.book.applet.dto.ServeItemInfoDTO
;
import
com.pcloud.book.applet.dto.ServeItemInfoDTO
;
import
com.pcloud.book.applet.enums.AppletRecordTypeEnum
;
import
com.pcloud.book.applet.enums.AppletRecordTypeEnum
;
...
@@ -42,6 +41,7 @@ import com.pcloud.book.cultivate.entity.CultivateNotifySend;
...
@@ -42,6 +41,7 @@ import com.pcloud.book.cultivate.entity.CultivateNotifySend;
import
com.pcloud.book.cultivate.enums.NotifySendTypeEnum
;
import
com.pcloud.book.cultivate.enums.NotifySendTypeEnum
;
import
com.pcloud.book.group.tools.SendWeixinRequestTools
;
import
com.pcloud.book.group.tools.SendWeixinRequestTools
;
import
com.pcloud.book.util.common.ThreadPoolUtils
;
import
com.pcloud.book.util.common.ThreadPoolUtils
;
import
com.pcloud.book.util.properties.BookProps
;
import
com.pcloud.channelcenter.wechat.dto.AccountSettingDto
;
import
com.pcloud.channelcenter.wechat.dto.AccountSettingDto
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.dto.AppletTemplateMessageDto
;
import
com.pcloud.common.core.dto.AppletTemplateMessageDto
;
...
@@ -61,9 +61,7 @@ import com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto;
...
@@ -61,9 +61,7 @@ import com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto;
import
com.pcloud.wechatgroup.selfrobot.dto.SendMessageDTO
;
import
com.pcloud.wechatgroup.selfrobot.dto.SendMessageDTO
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -124,6 +122,7 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
...
@@ -124,6 +122,7 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
cultivateNotify
.
setMessageType
(
cultivateNotifyDTO
.
getMessageType
());
cultivateNotify
.
setMessageType
(
cultivateNotifyDTO
.
getMessageType
());
cultivateNotify
.
setTitle
(
cultivateNotifyDTO
.
getTitle
());
cultivateNotify
.
setTitle
(
cultivateNotifyDTO
.
getTitle
());
cultivateNotify
.
setSendType
(
cultivateNotifyDTO
.
getSendType
());
cultivateNotify
.
setSendType
(
cultivateNotifyDTO
.
getSendType
());
cultivateNotify
.
setShowHome
(
cultivateNotifyDTO
.
getShowHome
());
cultivateNotify
.
setAgentId
(
null
==
cultivateNotifyDTO
.
getAgentId
()?
0L
:
cultivateNotifyDTO
.
getAgentId
());
cultivateNotify
.
setAgentId
(
null
==
cultivateNotifyDTO
.
getAgentId
()?
0L
:
cultivateNotifyDTO
.
getAgentId
());
cultivateNotifyDao
.
insert
(
cultivateNotify
);
cultivateNotifyDao
.
insert
(
cultivateNotify
);
cultivateNotifyDTO
.
getCultivateNotifyItems
().
forEach
(
a
->
a
.
setMessageId
(
cultivateNotify
.
getMessageId
()));
cultivateNotifyDTO
.
getCultivateNotifyItems
().
forEach
(
a
->
a
.
setMessageId
(
cultivateNotify
.
getMessageId
()));
...
@@ -230,11 +229,12 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
...
@@ -230,11 +229,12 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
cultivateNotifySend
.
setSendType
(
cultivateNotifyDTO
.
getSendType
());
cultivateNotifySend
.
setSendType
(
cultivateNotifyDTO
.
getSendType
());
cultivateNotifySend
.
setWxUserId
(
wechatUserDTO
.
getWxUserId
());
cultivateNotifySend
.
setWxUserId
(
wechatUserDTO
.
getWxUserId
());
cultivateNotifySend
.
setWechatUserId
(
wechatUserDTO
.
getWechatUserId
());
cultivateNotifySend
.
setWechatUserId
(
wechatUserDTO
.
getWechatUserId
());
cultivateNotifySend
.
setShowHome
(
cultivateNotifyDTO
.
getShowHome
());
cultivateNotifySend
.
setTitle
(
cultivateNotify
.
getTitle
());
cultivateNotifySend
.
setTitle
(
cultivateNotify
.
getTitle
());
list
.
add
(
cultivateNotifySend
);
list
.
add
(
cultivateNotifySend
);
}
}
cultivateNotifySendDao
.
insert
(
list
);
cultivateNotifySendDao
.
insert
(
list
);
sendAppletTemplateMessage
(
list
,
cultivateNotify
.
getAgentId
());
sendAppletTemplateMessage
(
list
,
cultivateNotify
.
getAgentId
()
,
null
);
}
}
//分类用户发送
//分类用户发送
if
(
NotifySendTypeEnum
.
CLASSIFY_USER
.
value
.
equals
(
cultivateNotifyDTO
.
getSendType
()))
{
if
(
NotifySendTypeEnum
.
CLASSIFY_USER
.
value
.
equals
(
cultivateNotifyDTO
.
getSendType
()))
{
...
@@ -267,10 +267,11 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
...
@@ -267,10 +267,11 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
cultivateNotifySend
.
setMessageType
(
cultivateNotifyDTO
.
getMessageType
());
cultivateNotifySend
.
setMessageType
(
cultivateNotifyDTO
.
getMessageType
());
cultivateNotifySend
.
setSendType
(
cultivateNotifyDTO
.
getSendType
());
cultivateNotifySend
.
setSendType
(
cultivateNotifyDTO
.
getSendType
());
cultivateNotifySend
.
setWechatUserId
(
wechatUserId
);
cultivateNotifySend
.
setWechatUserId
(
wechatUserId
);
cultivateNotifySend
.
setShowHome
(
cultivateNotifyDTO
.
getShowHome
());
cultivateNotifySendList
.
add
(
cultivateNotifySend
);
cultivateNotifySendList
.
add
(
cultivateNotifySend
);
}
}
cultivateNotifySendDao
.
insert
(
cultivateNotifySendList
);
cultivateNotifySendDao
.
insert
(
cultivateNotifySendList
);
sendAppletTemplateMessage
(
cultivateNotifySendList
,
cultivateNotify
.
getAgentId
());
sendAppletTemplateMessage
(
cultivateNotifySendList
,
cultivateNotify
.
getAgentId
()
,
null
);
}
}
}
}
}
}
...
@@ -305,10 +306,40 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
...
@@ -305,10 +306,40 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
cultivateNotifySend
.
setMessageType
(
cultivateNotifyDTO
.
getMessageType
());
cultivateNotifySend
.
setMessageType
(
cultivateNotifyDTO
.
getMessageType
());
cultivateNotifySend
.
setSendType
(
cultivateNotifyDTO
.
getSendType
());
cultivateNotifySend
.
setSendType
(
cultivateNotifyDTO
.
getSendType
());
cultivateNotifySend
.
setWechatUserId
(
wechatUserId
);
cultivateNotifySend
.
setWechatUserId
(
wechatUserId
);
cultivateNotifySend
.
setShowHome
(
cultivateNotifyDTO
.
getShowHome
());
cultivateNotifySendList
.
add
(
cultivateNotifySend
);
cultivateNotifySendList
.
add
(
cultivateNotifySend
);
}
}
cultivateNotifySendDao
.
insert
(
cultivateNotifySendList
);
cultivateNotifySendDao
.
insert
(
cultivateNotifySendList
);
sendAppletTemplateMessage
(
cultivateNotifySendList
,
cultivateNotify
.
getAgentId
());
sendAppletTemplateMessage
(
cultivateNotifySendList
,
cultivateNotify
.
getAgentId
(),
null
);
}
}
}
// 按用户学龄段发送
if
(
NotifySendTypeEnum
.
USER_GRADE
.
value
.
equals
(
cultivateNotifyDTO
.
getSendType
()))
{
List
<
Long
>
wechatUserIds
=
readerConsr
.
getWechatUserIdsByGradeIds
(
cultivateNotifyDTO
.
getUserGradeLabelIds
());
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
);
cultivateNotifySend
.
setShowHome
(
cultivateNotifyDTO
.
getShowHome
());
cultivateNotifySendList
.
add
(
cultivateNotifySend
);
}
cultivateNotifySendDao
.
insert
(
cultivateNotifySendList
);
sendAppletTemplateMessage
(
cultivateNotifySendList
,
cultivateNotify
.
getAgentId
(),
null
);
}
}
}
}
}
}
...
@@ -317,12 +348,16 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
...
@@ -317,12 +348,16 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
/**
/**
* 发送小程序模板消息
* 发送小程序模板消息
* @param list
* @param list
* @param agentId
* @param accountSettingId
*/
*/
@Override
@Override
public
void
sendAppletTemplateMessage
(
List
<
CultivateNotifySend
>
list
,
Long
agentId
)
{
public
void
sendAppletTemplateMessage
(
List
<
CultivateNotifySend
>
list
,
Long
agentId
,
Long
accountSettingId
)
{
AppletTemplateMessageDto
appletTemplateMessage
;
AppletTemplateMessageDto
appletTemplateMessage
;
Map
<
String
,
String
>
tempMap
;
Map
<
String
,
String
>
tempMap
;
Long
accountSettingId
=
qrcodeSceneConsr
.
getAccountSettingIdByAgentId
(
agentId
);
if
(
null
!=
agentId
)
{
accountSettingId
=
qrcodeSceneConsr
.
getAccountSettingIdByAgentId
(
agentId
);
}
for
(
CultivateNotifySend
cultivateNotifySend
:
list
)
{
for
(
CultivateNotifySend
cultivateNotifySend
:
list
)
{
if
(
cultivateNotifySend
.
getMessageType
()
==
1
){
continue
;}
if
(
cultivateNotifySend
.
getMessageType
()
==
1
){
continue
;}
appletTemplateMessage
=
new
AppletTemplateMessageDto
();
appletTemplateMessage
=
new
AppletTemplateMessageDto
();
...
@@ -546,7 +581,7 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
...
@@ -546,7 +581,7 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
if
(
null
==
cultivateNotify
){
if
(
null
==
cultivateNotify
){
return
;
return
;
}
}
this
.
sendAppletTemplateMessage
(
list
,
cultivateNotify
.
getAgentId
());
this
.
sendAppletTemplateMessage
(
list
,
cultivateNotify
.
getAgentId
()
,
null
);
}
}
@Override
@Override
...
@@ -555,6 +590,8 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
...
@@ -555,6 +590,8 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
return
;
return
;
}
}
cultivateNotifySendDao
.
insert
(
list
);
cultivateNotifySendDao
.
insert
(
list
);
//发送模板消息
sendAppletTemplateMessage
(
list
,
null
,
BookProps
.
getMiniOfficialAccountsId
());
}
}
@Override
@Override
...
@@ -597,6 +634,13 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
...
@@ -597,6 +634,13 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
}
}
//填充资讯应用作品问题
//填充资讯应用作品问题
fillAppOrProduct4Notify
(
cultivateNotifyItemList
);
fillAppOrProduct4Notify
(
cultivateNotifyItemList
);
ThreadPoolUtils
.
OTHER_THREAD_POOL
.
execute
(()
->
{
//批量更新消息已读未读
if
(
null
!=
pageBeanNew
&&
!
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
()))
{
List
<
Long
>
messageIds
=
pageBeanNew
.
getRecordList
().
stream
().
map
(
e
->
e
.
getMessageId
()).
collect
(
Collectors
.
toList
());
cultivateNotifySendDao
.
updateIsRead
(
wechatUserId
,
messageIds
);
}
});
return
pageBeanNew
;
return
pageBeanNew
;
}
}
...
@@ -657,4 +701,34 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
...
@@ -657,4 +701,34 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
cultivateNotifySendDao
.
insert
(
notifySend
);
cultivateNotifySendDao
.
insert
(
notifySend
);
return
messageId
;
return
messageId
;
}
}
@Override
@ParamLog
(
"最近三条未读首页弹窗消息"
)
public
List
<
CultivateNotifyDTO
>
getLastNoReadNotify
(
Long
wechatUserId
)
{
List
<
Long
>
messageIds
=
cultivateNotifySendDao
.
getLastNoReadNotify
(
wechatUserId
);
if
(
ListUtils
.
isEmpty
(
messageIds
)){
return
new
ArrayList
<>();
}
List
<
CultivateNotifyItem
>
list
=
cultivateNotifyItemDao
.
getByMessageIds
(
messageIds
);
fillResource
(
list
);
fillAppOrProduct4Notify
(
list
);
Map
<
Long
,
List
<
CultivateNotifyItem
>>
cultivateNotifyItemMap
=
list
.
stream
().
collect
(
Collectors
.
groupingBy
(
CultivateNotifyItem:
:
getMessageId
));
List
<
CultivateNotify
>
cultivateNotifyList
=
cultivateNotifyDao
.
getByIds
(
messageIds
);
List
<
CultivateNotifyDTO
>
cultivateNotifyDTOList
=
new
ArrayList
<>();
cultivateNotifyList
.
stream
().
forEach
(
e
->
{
CultivateNotifyDTO
notifyDTO
=
new
CultivateNotifyDTO
();
BeanUtils
.
copyProperties
(
e
,
notifyDTO
);
notifyDTO
.
setCultivateNotifyItems
(
cultivateNotifyItemMap
.
get
(
e
.
getMessageId
()));
cultivateNotifyDTOList
.
add
(
notifyDTO
);
});
ThreadPoolUtils
.
OTHER_THREAD_POOL
.
execute
(()
->
{
//批量更新消息已读未读
cultivateNotifySendDao
.
updateIsRead
(
wechatUserId
,
messageIds
);
// 更新之前的所有未读消息都不显示到主页
cultivateNotifySendDao
.
updateShowHome
(
wechatUserId
);
});
return
cultivateNotifyDTOList
;
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/biz/impl/CultivateRaysBizImpl.java
View file @
f015ce05
...
@@ -250,7 +250,10 @@ public class CultivateRaysBizImpl implements CultivateRaysBiz {
...
@@ -250,7 +250,10 @@ public class CultivateRaysBizImpl implements CultivateRaysBiz {
tempMap
.
put
(
"thing3"
,
text2
);
tempMap
.
put
(
"thing3"
,
text2
);
}
}
appletTemplateMessage
.
setData
(
tempMap
);
appletTemplateMessage
.
setData
(
tempMap
);
//发送小程序服务消息
templateConsr
.
sendAppletMessageQueue
(
appletTemplateMessage
);
templateConsr
.
sendAppletMessageQueue
(
appletTemplateMessage
);
//发送公众号模板消息
templateConsr
.
sendTempletMessage4Project
(
text1
,
text2
,
wechatUserId
,
appletTemplateMessage
.
getPage
());
}
}
/**
/**
...
@@ -260,6 +263,8 @@ public class CultivateRaysBizImpl implements CultivateRaysBiz {
...
@@ -260,6 +263,8 @@ public class CultivateRaysBizImpl implements CultivateRaysBiz {
* @date:2021/7/16 18:39 * @param null
* @date:2021/7/16 18:39 * @param null
*/
*/
private
void
addDelayEnergyConsumption
(
Long
cultivateId
,
Long
wechatUserId
,
Integer
times
)
{
private
void
addDelayEnergyConsumption
(
Long
cultivateId
,
Long
wechatUserId
,
Integer
times
)
{
//todo 测试环境延时队列改为30秒
times
=
30
*
1000
;
CultivateRaysDelayDTO
cultivateRaysDelayDTO
=
new
CultivateRaysDelayDTO
();
CultivateRaysDelayDTO
cultivateRaysDelayDTO
=
new
CultivateRaysDelayDTO
();
cultivateRaysDelayDTO
.
setCultivateId
(
cultivateId
);
cultivateRaysDelayDTO
.
setCultivateId
(
cultivateId
);
DelayQueueDTO
delayQueueDTONew
=
DelayQueueDTO
.
builder
().
key
(
wechatUserId
.
toString
()).
type
(
CultivateRaysConstants
.
HOURS_CONSUMPTION_DELAY
).
msg
(
cultivateRaysDelayDTO
).
timeout
(
times
).
build
();
DelayQueueDTO
delayQueueDTONew
=
DelayQueueDTO
.
builder
().
key
(
wechatUserId
.
toString
()).
type
(
CultivateRaysConstants
.
HOURS_CONSUMPTION_DELAY
).
msg
(
cultivateRaysDelayDTO
).
timeout
(
times
).
build
();
...
...
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/dao/CultivateNotifySendDao.java
View file @
f015ce05
...
@@ -26,4 +26,8 @@ public interface CultivateNotifySendDao extends BaseDao<CultivateNotifySend> {
...
@@ -26,4 +26,8 @@ public interface CultivateNotifySendDao extends BaseDao<CultivateNotifySend> {
Integer
getSendUserCount
(
Long
messageId
);
Integer
getSendUserCount
(
Long
messageId
);
void
clearExpireNotifies
();
void
clearExpireNotifies
();
List
<
Long
>
getLastNoReadNotify
(
Long
wechatUserId
);
void
updateIsRead
(
Long
wechatUserId
,
List
<
Long
>
messageIds
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/dao/impl/CultivateNotifySendDaoImpl.java
View file @
f015ce05
...
@@ -76,4 +76,17 @@ public class CultivateNotifySendDaoImpl extends BaseDaoImpl<CultivateNotifySend>
...
@@ -76,4 +76,17 @@ public class CultivateNotifySendDaoImpl extends BaseDaoImpl<CultivateNotifySend>
public
void
clearExpireNotifies
()
{
public
void
clearExpireNotifies
()
{
getSessionTemplate
().
delete
(
getStatement
(
"clearExpireNotifies"
));
getSessionTemplate
().
delete
(
getStatement
(
"clearExpireNotifies"
));
}
}
@Override
public
List
<
Long
>
getLastNoReadNotify
(
Long
wechatUserId
)
{
return
super
.
getSessionTemplate
().
selectList
(
getStatement
(
"getLastNoReadNotify"
),
wechatUserId
);
}
@Override
public
void
updateIsRead
(
Long
wechatUserId
,
List
<
Long
>
messageIds
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"wechatUserId"
,
wechatUserId
);
map
.
put
(
"messageIds"
,
messageIds
);
super
.
getSessionTemplate
().
update
(
getStatement
(
"batchUpdateIsRead"
),
map
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/dto/CultivateNotifyDTO.java
View file @
f015ce05
...
@@ -58,4 +58,10 @@ public class CultivateNotifyDTO {
...
@@ -58,4 +58,10 @@ public class CultivateNotifyDTO {
@ApiModelProperty
(
"注册结束时间"
)
@ApiModelProperty
(
"注册结束时间"
)
private
String
endTime
;
private
String
endTime
;
@ApiModelProperty
(
"用户学龄段标签id"
)
private
List
<
Long
>
userGradeLabelIds
;
@ApiModelProperty
(
"是否首页弹窗"
)
private
Integer
showHome
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/dto/CultivateNotifyPageDTO.java
View file @
f015ce05
...
@@ -30,4 +30,7 @@ public class CultivateNotifyPageDTO {
...
@@ -30,4 +30,7 @@ public class CultivateNotifyPageDTO {
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
sendTime
;
private
Date
sendTime
;
@ApiModelProperty
(
"是否首页弹窗"
)
private
Integer
showHome
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/entity/CultivateNotify.java
View file @
f015ce05
...
@@ -24,4 +24,7 @@ public class CultivateNotify extends BaseEntity {
...
@@ -24,4 +24,7 @@ public class CultivateNotify extends BaseEntity {
@ApiModelProperty
(
"出版社id"
)
@ApiModelProperty
(
"出版社id"
)
private
Long
agentId
;
private
Long
agentId
;
@ApiModelProperty
(
"是否首页弹窗"
)
private
Integer
showHome
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/enums/NotifySendTypeEnum.java
deleted
100644 → 0
View file @
90f59724
package
com
.
pcloud
.
book
.
cultivate
.
enums
;
public
enum
NotifySendTypeEnum
{
/**
* 指定用户
*/
APPOINT_USER
(
1
),
/**
* 分类用户
*/
CLASSIFY_USER
(
2
),
/**
* 书籍查询
*/
BOOK_USER
(
3
),
/**
* 全局公告消息
*/
ALL_USER
(
4
),
/**
*用户画像
*/
USER_PROFILE
(
5
);
public
final
Integer
value
;
NotifySendTypeEnum
(
Integer
value
)
{
this
.
value
=
value
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/facade/CultivateNotifyFacade.java
View file @
f015ce05
...
@@ -121,6 +121,16 @@ public class CultivateNotifyFacade {
...
@@ -121,6 +121,16 @@ public class CultivateNotifyFacade {
return
new
ResponseDto
<>(
cultivateNotifyBiz
.
getLatestNotifyList
(
wechatUserId
,
currentPage
,
numPerPage
));
return
new
ResponseDto
<>(
cultivateNotifyBiz
.
getLatestNotifyList
(
wechatUserId
,
currentPage
,
numPerPage
));
}
}
@ApiOperation
(
"最近三条未读首页弹窗消息"
)
@GetMapping
(
"/getLastNoReadNotify"
)
public
ResponseDto
<?>
getLastNoReadNotify
(
@CookieValue
(
value
=
"userInfo"
)
String
userInfo
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(!
NumberUtil
.
isNumber
(
wechatUserId
))
{
throw
new
BizException
(
BizException
.
PARAM_IS_NULL
.
getCode
(),
"wechatUserId 不能为空"
);
}
return
new
ResponseDto
<>(
cultivateNotifyBiz
.
getLastNoReadNotify
(
wechatUserId
));
}
...
...
pcloud-service-book/src/main/resources/mapper/applet/AppletSubscribeCount.Mapper.xml
0 → 100644
View file @
f015ce05
<?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.AppletSubscribeCountDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.applet.entity.AppletSubscribeCount"
>
<id
column=
"id"
property=
"id"
jdbcType=
"OTHER"
/>
<result
column=
"wechat_user_id"
property=
"wechatUserId"
jdbcType=
"OTHER"
/>
<result
column=
"record_type"
property=
"recordType"
jdbcType=
"OTHER"
/>
<result
column=
"valid_count"
property=
"validCount"
jdbcType=
"OTHER"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"OTHER"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"OTHER"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, wechat_user_id, record_type, valid_count, create_time, update_time
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM applet_subscribe_count
WHERE id = #{id}
</select>
<select
id=
"getList"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM applet_subscribe_count
</select>
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
INSERT INTO applet_subscribe_count(
wechat_user_id,
record_type,
valid_count,
create_time,
update_time
) VALUES (
#{wechatUserId, jdbcType=OTHER},
#{recordType, jdbcType=OTHER},
#{validCount, jdbcType=OTHER},
now(),
now()
)
</insert>
<insert
id=
"batchInsert"
>
INSERT INTO applet_subscribe_count (
wechat_user_id,
record_type,
valid_count,
create_time,
update_time
) VALUES
<foreach
collection=
"list"
item=
"item"
separator=
","
>
(
#{item.wechatUserId, jdbcType=OTHER},
#{item.recordType, jdbcType=OTHER},
#{item.validCount, jdbcType=OTHER},
#{item.createTime, jdbcType=OTHER},
#{item.updateTime, jdbcType=OTHER}
)
</foreach>
</insert>
<!--通过主键修改数据-->
<update
id=
"update"
>
UPDATE applet_subscribe_count
<set>
<if
test=
"wechatUserId != null"
>
wechat_user_id = #{wechatUserId},
</if>
<if
test=
"recordType != null"
>
record_type = #{recordType},
</if>
<if
test=
"validCount != null"
>
valid_count = #{validCount},
</if>
update_time = now()
</set>
WHERE id = #{id}
</update>
<!--通过主键删除-->
<delete
id=
"deleteById"
>
DELETE FROM applet_subscribe_count where id = #{id}
</delete>
<!--通过主键软删除-->
<delete
id=
"softDeleteById"
>
update applet_subscribe_count set is_delete = 1, update_time = now() where id = #{id}
</delete>
<select
id=
"getByUserId"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from
applet_subscribe_count
where
wechat_user_id = #{wechatUserId}
<if
test=
"recordType != null"
>
and record_type = #{recordType}
</if>
</select>
<select
id=
"clearSubscribeCount"
parameterType=
"map"
>
update
applet_subscribe_count
set
valid_count = 0,
update_time = now()
where
wechat_user_id = #{wechatUserId}
<if
test=
"recordType != null"
>
and record_type = #{recordType}
</if>
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/applet/AppletSubscribeRecord.Mapper.xml
0 → 100644
View file @
f015ce05
<?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.AppletSubscribeRecordDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.applet.entity.AppletSubscribeRecord"
>
<id
column=
"id"
property=
"id"
jdbcType=
"OTHER"
/>
<result
column=
"wechat_user_id"
property=
"wechatUserId"
jdbcType=
"OTHER"
/>
<result
column=
"record_type"
property=
"recordType"
jdbcType=
"OTHER"
/>
<result
column=
"count_type"
property=
"countType"
jdbcType=
"OTHER"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"OTHER"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"OTHER"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, wechat_user_id, record_type, count_type, create_time, update_time
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM applet_subscribe_record
WHERE id = #{id}
</select>
<select
id=
"getList"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM applet_subscribe_record
</select>
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
INSERT INTO applet_subscribe_record(
wechat_user_id,
record_type,
count_type,
create_time,
update_time
) VALUES (
#{wechatUserId, jdbcType=OTHER},
#{recordType, jdbcType=OTHER},
#{countType, jdbcType=OTHER},
now(),
now()
)
</insert>
<insert
id=
"batchInsert"
>
INSERT INTO applet_subscribe_record (
wechat_user_id,
record_type,
count_type,
create_time,
update_time
) VALUES
<foreach
collection=
"list"
item=
"item"
separator=
","
>
(
#{item.wechatUserId, jdbcType=OTHER},
#{item.recordType, jdbcType=OTHER},
#{item.countType, jdbcType=OTHER},
#{item.createTime, jdbcType=OTHER},
#{item.updateTime, jdbcType=OTHER}
)
</foreach>
</insert>
<!--通过主键修改数据-->
<update
id=
"update"
>
UPDATE applet_subscribe_record
<set>
<if
test=
"wechatUserId != null"
>
wechat_user_id = #{wechatUserId},
</if>
<if
test=
"recordType != null"
>
record_type = #{recordType},
</if>
<if
test=
"countType != null"
>
count_type = #{countType},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
</set>
WHERE id = #{id}
</update>
<!--通过主键删除-->
<delete
id=
"deleteById"
>
DELETE FROM applet_subscribe_record where id = #{id}
</delete>
<!--通过主键软删除-->
<delete
id=
"softDeleteById"
>
update applet_subscribe_record set is_delete = 1, update_time = now() where id = #{id}
</delete>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/cultivate/CultivateNotify.xml
View file @
f015ce05
...
@@ -9,10 +9,11 @@
...
@@ -9,10 +9,11 @@
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"send_type"
property=
"sendType"
jdbcType=
"INTEGER"
/>
<result
column=
"send_type"
property=
"sendType"
jdbcType=
"INTEGER"
/>
<result
column=
"agent_id"
property=
"agentId"
jdbcType=
"BIGINT"
/>
<result
column=
"agent_id"
property=
"agentId"
jdbcType=
"BIGINT"
/>
<result
column=
"show_home"
property=
"showHome"
jdbcType=
"TINYINT"
/>
</resultMap>
</resultMap>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
message_id, message_type, title, create_time,update_time,send_type,agent_id
message_id, message_type, title, create_time,update_time,send_type,agent_id
, show_home
</sql>
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.cultivate.entity.CultivateNotify"
useGeneratedKeys=
"true"
keyProperty=
"messageId"
>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.cultivate.entity.CultivateNotify"
useGeneratedKeys=
"true"
keyProperty=
"messageId"
>
...
@@ -23,7 +24,8 @@
...
@@ -23,7 +24,8 @@
create_time,
create_time,
update_time,
update_time,
send_type,
send_type,
agent_id
agent_id,
show_home
)
)
values (
values (
#{messageType},
#{messageType},
...
@@ -31,7 +33,8 @@
...
@@ -31,7 +33,8 @@
NOW(),
NOW(),
NOW(),
NOW(),
#{sendType},
#{sendType},
#{agentId}
#{agentId},
#{showHome}
)
)
</insert>
</insert>
...
...
pcloud-service-book/src/main/resources/mapper/cultivate/CultivateNotifySend.xml
View file @
f015ce05
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
#{messageId},
#{messageId},
#{messageType},
#{messageType},
0,
0,
1
,
#{showHome}
,
NOW(),
NOW(),
NOW()
NOW()
)
)
...
@@ -66,7 +66,7 @@
...
@@ -66,7 +66,7 @@
#{item.messageId},
#{item.messageId},
#{item.messageType},
#{item.messageType},
0,
0,
1
,
#{item.showHome}
,
NOW(),
NOW(),
NOW()
NOW()
)
)
...
@@ -142,7 +142,8 @@
...
@@ -142,7 +142,8 @@
a.create_time createTime,
a.create_time createTime,
a.message_id messageId,
a.message_id messageId,
a.create_time sendTime,
a.create_time sendTime,
a.title title
a.title title,
a.show_home showHome
from cultivate_notify a
from cultivate_notify a
<if
test=
"keyword !=null"
>
<if
test=
"keyword !=null"
>
LEFT JOIN cultivate_notify_item b on a.message_id=b.message_id
LEFT JOIN cultivate_notify_item b on a.message_id=b.message_id
...
@@ -192,4 +193,30 @@
...
@@ -192,4 +193,30 @@
AND DATE( create_time )
<
DATE(SUBDATE( NOW(), INTERVAL 1 MONTH ))
AND DATE( create_time )
<
DATE(SUBDATE( NOW(), INTERVAL 1 MONTH ))
</delete>
</delete>
<select
id=
"getLastNoReadNotify"
parameterType=
"long"
resultType=
"long"
>
SELECT
message_id
FROM
cultivate_notify_send
WHERE
wechat_user_id = #{wechatUserId}
AND is_read = 0
AND show_home = 1
ORDER BY
create_time DESC
LIMIT 3
</select>
<update
id=
"batchUpdateIsRead"
parameterType=
"map"
>
UPDATE cultivate_notify_send
SET is_read = 1,
read_time = now(),
update_time = now()
WHERE
wechat_user_id = #{wechatUserId}
AND message_id in
<foreach
collection=
"messageIds"
index=
"index"
item=
"item"
open=
"("
close=
")"
separator=
","
>
#{item}
</foreach>
</update>
</mapper>
</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