Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
a0c692fe
Commit
a0c692fe
authored
Jul 02, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
专场商品列表查询新是否订阅专场
parent
529e7684
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
2191 additions
and
52 deletions
+2191
-52
ch-core/src/main/java/com/wwdz/ch/core/entity/SupplierItemVo.java
...src/main/java/com/wwdz/ch/core/entity/SupplierItemVo.java
+5
-0
ch-core/src/main/java/com/wwdz/ch/core/impl/SendMsgServiceImpl.java
...c/main/java/com/wwdz/ch/core/impl/SendMsgServiceImpl.java
+6
-6
ch-core/src/main/java/com/wwdz/ch/core/service/SendMsgService.java
...rc/main/java/com/wwdz/ch/core/service/SendMsgService.java
+7
-0
ch-dao/src/main/java/com/wwdz/ch/db/dao/DisposableSubscribeRecordDao.java
...java/com/wwdz/ch/db/dao/DisposableSubscribeRecordDao.java
+8
-0
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/SpecialPerformanceItemFollow.java
.../db/domain/distribution/SpecialPerformanceItemFollow.java
+293
-0
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/SpecialPerformanceItemFollowExample.java
...ain/distribution/SpecialPerformanceItemFollowExample.java
+1359
-0
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/distribution/SpecialPerformanceRequestDto.java
...to/request/distribution/SpecialPerformanceRequestDto.java
+2
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/DisposableSubscribeRecordDaoImpl.java
...b/impl/distribution/DisposableSubscribeRecordDaoImpl.java
+35
-0
ch-dao/src/main/java/com/wwdz/ch/db/mapper/distribution/SpecialPerformanceItemFollowMapper.java
...pper/distribution/SpecialPerformanceItemFollowMapper.java
+69
-0
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/distribution/SpecialPerformanceItemFollowMapper.xml
...apper/distribution/SpecialPerformanceItemFollowMapper.xml
+356
-0
ch-dao/src/main/resources/generatorConfig_new.xml
ch-dao/src/main/resources/generatorConfig_new.xml
+1
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/SpecialPerformanceServiceImpl.java
...h/wx/impl/distribution/SpecialPerformanceServiceImpl.java
+10
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/job/SpecialPerformanceNoticeJob.java
.../java/com/wwdz/ch/wx/job/SpecialPerformanceNoticeJob.java
+40
-45
No files found.
ch-core/src/main/java/com/wwdz/ch/core/entity/SupplierItemVo.java
View file @
a0c692fe
...
...
@@ -319,4 +319,9 @@ public class SupplierItemVo implements Entity {
*/
private
String
shareTip
;
/**
* 商品在专场中是否被关注
*/
private
Boolean
isFollowed
;
}
ch-core/src/main/java/com/wwdz/ch/core/impl/SendMsgServiceImpl.java
View file @
a0c692fe
...
...
@@ -612,7 +612,7 @@ public class SendMsgServiceImpl implements SendMsgService {
* @param auctionOfferNoticeMsg
* @return
*/
public
boolean
sendSpecialPerformanceStartMsg
(
AuctionOfferNoticeMsg
auctionOfferNoticeMsg
)
{
public
Result
sendSpecialPerformanceStartMsg
(
AuctionOfferNoticeMsg
auctionOfferNoticeMsg
)
{
String
openId
=
auctionOfferNoticeMsg
.
getOpenId
();
String
token
=
officialAccountApi
.
getAccessToken
();
String
url
=
SEND_SUBSCRIBE_MSG_URL
+
"?access_token="
+
token
;
...
...
@@ -643,10 +643,10 @@ public class SendMsgServiceImpl implements SendMsgService {
String
errmsg
=
JsonUtils
.
getValueByPath
(
responseStr
,
"errmsg"
);
if
(!
"0"
.
equals
(
errorCode
))
{
logger
.
error
(
"openid : {}, 发送专场即将开始订阅消息, errorCode : {}, errmsg : {} "
,
openId
,
errorCode
,
errmsg
);
return
false
;
return
Result
.
failed
(
responseStr
)
;
}
logger
.
info
(
"============= 发送专场即将开始订阅消息成功 ==========="
);
return
true
;
return
Result
.
success
()
;
}
...
...
@@ -655,7 +655,7 @@ public class SendMsgServiceImpl implements SendMsgService {
* @param auctionOfferNoticeMsg
* @return
*/
public
boolean
sendSpecialPerformanceEndMsg
(
AuctionOfferNoticeMsg
auctionOfferNoticeMsg
)
{
public
Result
sendSpecialPerformanceEndMsg
(
AuctionOfferNoticeMsg
auctionOfferNoticeMsg
)
{
String
openId
=
auctionOfferNoticeMsg
.
getOpenId
();
String
token
=
officialAccountApi
.
getAccessToken
();
String
url
=
SEND_SUBSCRIBE_MSG_URL
+
"?access_token="
+
token
;
...
...
@@ -691,10 +691,10 @@ public class SendMsgServiceImpl implements SendMsgService {
String
errmsg
=
JsonUtils
.
getValueByPath
(
responseStr
,
"errmsg"
);
if
(!
"0"
.
equals
(
errorCode
))
{
logger
.
error
(
"openid : {}, 发送专场即将结束订阅消息, errorCode : {}, errmsg : {} "
,
openId
,
errorCode
,
errmsg
);
return
false
;
return
Result
.
failed
(
responseStr
)
;
}
logger
.
info
(
"============= 发送专场即将结束订阅消息成功 ==========="
);
return
true
;
return
Result
.
success
()
;
}
...
...
ch-core/src/main/java/com/wwdz/ch/core/service/SendMsgService.java
View file @
a0c692fe
...
...
@@ -81,4 +81,11 @@ public interface SendMsgService {
String
getOpenIdByUserId
(
long
userId
);
Result
sendSpecialPerformanceStartMsg
(
AuctionOfferNoticeMsg
auctionOfferNoticeMsg
);
Result
sendSpecialPerformanceEndMsg
(
AuctionOfferNoticeMsg
auctionOfferNoticeMsg
);
}
ch-dao/src/main/java/com/wwdz/ch/db/dao/DisposableSubscribeRecordDao.java
View file @
a0c692fe
...
...
@@ -11,6 +11,8 @@ public interface DisposableSubscribeRecordDao {
boolean
update
(
DisposableSubscribeRecord
disposableSubscribeRecord
);
boolean
updateInvalid
(
String
openid
,
long
targetId
,
String
templateId
);
/**
* 是否存在
* @param openid
...
...
@@ -27,5 +29,11 @@ public interface DisposableSubscribeRecordDao {
*/
boolean
isSubscribed
(
String
openid
,
long
targetId
,
String
templateId
);
boolean
isSubscribed
(
long
userId
,
long
targetId
,
int
type
);
List
<
DisposableSubscribeRecord
>
findList
(
DisposableSubscribeRecordRequestDto
dto
);
List
<
DisposableSubscribeRecord
>
findValid
(
long
userId
);
}
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/SpecialPerformanceItemFollow.java
0 → 100644
View file @
a0c692fe
This diff is collapsed.
Click to expand it.
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/SpecialPerformanceItemFollowExample.java
0 → 100644
View file @
a0c692fe
This diff is collapsed.
Click to expand it.
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/distribution/SpecialPerformanceRequestDto.java
View file @
a0c692fe
...
...
@@ -10,6 +10,8 @@ import java.util.List;
@Data
public
class
SpecialPerformanceRequestDto
extends
BaseRequestDto
implements
Entity
{
private
Long
userId
;
private
Integer
id
;
/**
...
...
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/DisposableSubscribeRecordDaoImpl.java
View file @
a0c692fe
...
...
@@ -37,6 +37,20 @@ public class DisposableSubscribeRecordDaoImpl implements DisposableSubscribeReco
return
disposableSubscribeRecordMapper
.
updateByExampleSelective
(
disposableSubscribeRecord
,
example
)
>
0
;
}
@Override
public
boolean
updateInvalid
(
String
openid
,
long
targetId
,
String
templateId
)
{
DisposableSubscribeRecordExample
example
=
new
DisposableSubscribeRecordExample
();
DisposableSubscribeRecordExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andOpenidEqualTo
(
openid
);
criteria
.
andTargetIdEqualTo
(
targetId
);
criteria
.
andTemplateIdEqualTo
(
templateId
);
DisposableSubscribeRecord
disposableSubscribeRecord
=
new
DisposableSubscribeRecord
();
disposableSubscribeRecord
.
setIsValid
(
false
);
disposableSubscribeRecord
.
setUpdateTime
(
new
Date
());
return
disposableSubscribeRecordMapper
.
updateByExampleSelective
(
disposableSubscribeRecord
,
example
)
>
0
;
}
@Override
public
boolean
isExisted
(
String
openid
,
long
targetId
,
String
templateId
)
{
DisposableSubscribeRecordExample
example
=
new
DisposableSubscribeRecordExample
();
...
...
@@ -58,6 +72,17 @@ public class DisposableSubscribeRecordDaoImpl implements DisposableSubscribeReco
return
disposableSubscribeRecordMapper
.
countByExample
(
example
)
>
0
;
}
@Override
public
boolean
isSubscribed
(
long
userId
,
long
targetId
,
int
type
)
{
DisposableSubscribeRecordExample
example
=
new
DisposableSubscribeRecordExample
();
DisposableSubscribeRecordExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andUserIdEqualTo
(
userId
);
criteria
.
andTargetIdEqualTo
(
targetId
);
criteria
.
andTypeEqualTo
(
type
);
criteria
.
andIsValidEqualTo
(
true
);
return
disposableSubscribeRecordMapper
.
countByExample
(
example
)
>
0
;
}
@Override
public
List
<
DisposableSubscribeRecord
>
findList
(
DisposableSubscribeRecordRequestDto
dto
)
{
DisposableSubscribeRecordExample
example
=
new
DisposableSubscribeRecordExample
();
...
...
@@ -71,4 +96,14 @@ public class DisposableSubscribeRecordDaoImpl implements DisposableSubscribeReco
PageHelper
.
startPage
(
dto
.
getPage
(),
dto
.
getLimit
());
return
disposableSubscribeRecordMapper
.
selectByExample
(
example
);
}
@Override
public
List
<
DisposableSubscribeRecord
>
findValid
(
long
userId
)
{
DisposableSubscribeRecordExample
example
=
new
DisposableSubscribeRecordExample
();
DisposableSubscribeRecordExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andUserIdEqualTo
(
userId
);
criteria
.
andIsValidEqualTo
(
true
);
return
disposableSubscribeRecordMapper
.
selectByExample
(
example
);
}
}
ch-dao/src/main/java/com/wwdz/ch/db/mapper/distribution/SpecialPerformanceItemFollowMapper.java
0 → 100644
View file @
a0c692fe
package
com.wwdz.ch.db.mapper.distribution
;
import
com.wwdz.ch.db.domain.distribution.SpecialPerformanceItemFollow
;
import
com.wwdz.ch.db.domain.distribution.SpecialPerformanceItemFollowExample
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
@Mapper
public
interface
SpecialPerformanceItemFollowMapper
{
long
countByExample
(
SpecialPerformanceItemFollowExample
example
);
int
deleteByExample
(
SpecialPerformanceItemFollowExample
example
);
int
deleteByPrimaryKey
(
Long
id
);
int
insert
(
SpecialPerformanceItemFollow
record
);
int
insertSelective
(
SpecialPerformanceItemFollow
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table special_performance_item_follow
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
SpecialPerformanceItemFollow
selectOneByExample
(
SpecialPerformanceItemFollowExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table special_performance_item_follow
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
SpecialPerformanceItemFollow
selectOneByExampleSelective
(
@Param
(
"example"
)
SpecialPerformanceItemFollowExample
example
,
@Param
(
"selective"
)
SpecialPerformanceItemFollow
.
Column
...
selective
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table special_performance_item_follow
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List
<
SpecialPerformanceItemFollow
>
selectByExampleSelective
(
@Param
(
"example"
)
SpecialPerformanceItemFollowExample
example
,
@Param
(
"selective"
)
SpecialPerformanceItemFollow
.
Column
...
selective
);
List
<
SpecialPerformanceItemFollow
>
selectByExample
(
SpecialPerformanceItemFollowExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table special_performance_item_follow
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
SpecialPerformanceItemFollow
selectByPrimaryKeySelective
(
@Param
(
"id"
)
Long
id
,
@Param
(
"selective"
)
SpecialPerformanceItemFollow
.
Column
...
selective
);
SpecialPerformanceItemFollow
selectByPrimaryKey
(
Long
id
);
int
updateByExampleSelective
(
@Param
(
"record"
)
SpecialPerformanceItemFollow
record
,
@Param
(
"example"
)
SpecialPerformanceItemFollowExample
example
);
int
updateByExample
(
@Param
(
"record"
)
SpecialPerformanceItemFollow
record
,
@Param
(
"example"
)
SpecialPerformanceItemFollowExample
example
);
int
updateByPrimaryKeySelective
(
SpecialPerformanceItemFollow
record
);
int
updateByPrimaryKey
(
SpecialPerformanceItemFollow
record
);
}
\ No newline at end of file
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/distribution/SpecialPerformanceItemFollowMapper.xml
0 → 100644
View file @
a0c692fe
This diff is collapsed.
Click to expand it.
ch-dao/src/main/resources/generatorConfig_new.xml
View file @
a0c692fe
...
...
@@ -72,7 +72,7 @@
<javaClientGenerator
type=
"XMLMAPPER"
targetPackage=
"com.wwdz.ch.db.mapper.distribution"
targetProject=
"ch-dao/src/main/java"
/>
<table
tableName=
"
disposable_subscribe_record
"
enableCountByExample=
"true"
enableUpdateByExample=
"true"
enableDeleteByExample=
"true"
enableSelectByExample=
"true"
selectByExampleQueryId=
"true"
>
<table
tableName=
"
special_performance_item_follow
"
enableCountByExample=
"true"
enableUpdateByExample=
"true"
enableDeleteByExample=
"true"
enableSelectByExample=
"true"
selectByExampleQueryId=
"true"
>
<generatedKey
column=
"id"
sqlStatement=
"Mysql"
identity=
"true"
/>
</table>
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/SpecialPerformanceServiceImpl.java
View file @
a0c692fe
...
...
@@ -3,6 +3,7 @@ package com.wwdz.ch.wx.impl.distribution;
import
com.github.pagehelper.PageInfo
;
import
com.wwdz.ch.core.api.WxAppletApi
;
import
com.wwdz.ch.core.consts.AuctionEnum
;
import
com.wwdz.ch.core.consts.DisposableSubscribeRecordEnum
;
import
com.wwdz.ch.core.consts.DistributionEnum
;
import
com.wwdz.ch.core.consts.SpecialPerformanceEnum
;
import
com.wwdz.ch.core.entity.SupplierItemVo
;
...
...
@@ -12,6 +13,7 @@ import com.wwdz.ch.core.type.Result;
import
com.wwdz.ch.core.util.MediaUtil
;
import
com.wwdz.ch.core.util.PriceUtil
;
import
com.wwdz.ch.core.util.RedisUtils
;
import
com.wwdz.ch.db.dao.DisposableSubscribeRecordDao
;
import
com.wwdz.ch.db.dao.UserDao
;
import
com.wwdz.ch.db.dao.distribution.*
;
import
com.wwdz.ch.db.domain.User
;
...
...
@@ -70,6 +72,9 @@ public class SpecialPerformanceServiceImpl implements SpecialPerformanceService
@Autowired
RedisUtils
redisUtils
;
@Autowired
DisposableSubscribeRecordDao
disposableSubscribeRecordDao
;
private
final
static
String
SPECIAL_PERFORMANCE_URL
=
"/pages/saleSpecialList/index"
;
private
final
static
String
SPECIAL_PERFORMANCE_PROGRESS_SEND_MSG_KEY
=
"SPECIAL_PERFORMANCE_PROGRESS_SEND_MSG_KEY:"
;
...
...
@@ -389,6 +394,11 @@ public class SpecialPerformanceServiceImpl implements SpecialPerformanceService
resultMap
.
put
(
"endTime"
,
specialPerformance
.
getEndTime
());
resultMap
.
put
(
"title"
,
specialPerformance
.
getTitle
());
resultMap
.
put
(
"specialPerformanceId"
,
specialPerformance
.
getId
());
//判断用户是否订阅过消息
resultMap
.
put
(
"subscribeStart"
,
disposableSubscribeRecordDao
.
isSubscribed
(
dto
.
getUserId
(),
specialPerformance
.
getId
(),
DisposableSubscribeRecordEnum
.
TypeEnum
.
PRE_START
.
getType
()));
resultMap
.
put
(
"subscribeEnd"
,
disposableSubscribeRecordDao
.
isSubscribed
(
dto
.
getUserId
(),
specialPerformance
.
getId
(),
DisposableSubscribeRecordEnum
.
TypeEnum
.
PRE_END
.
getType
()));
//当前时间大于专场结束时间则修改专场的状态
if
(
now
.
after
(
specialPerformance
.
getEndTime
()))
{
SpecialPerformance
updateDto
=
new
SpecialPerformance
();
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/job/SpecialPerformanceNoticeJob.java
View file @
a0c692fe
...
...
@@ -3,6 +3,7 @@ package com.wwdz.ch.wx.job;
import
com.github.pagehelper.PageInfo
;
import
com.wwdz.ch.core.api.WxAppletApi
;
import
com.wwdz.ch.core.consts.AuctionEnum
;
import
com.wwdz.ch.core.consts.DisposableSubscribeRecordEnum
;
import
com.wwdz.ch.core.consts.DistributionEnum
;
import
com.wwdz.ch.core.consts.SpecialPerformanceEnum
;
import
com.wwdz.ch.core.entity.AuctionOfferNoticeMsg
;
...
...
@@ -12,6 +13,7 @@ import com.wwdz.ch.core.type.Result;
import
com.wwdz.ch.core.util.PriceUtil
;
import
com.wwdz.ch.core.util.RedisUtils
;
import
com.wwdz.ch.core.util.StringUtil
;
import
com.wwdz.ch.db.dao.DisposableSubscribeRecordDao
;
import
com.wwdz.ch.db.dao.FollowFansRecordDao
;
import
com.wwdz.ch.db.dao.UserDao
;
import
com.wwdz.ch.db.dao.distribution.*
;
...
...
@@ -20,10 +22,12 @@ import com.wwdz.ch.db.domain.User;
import
com.wwdz.ch.db.domain.distribution.*
;
import
com.wwdz.ch.db.dto.request.FollowFansRecordRequestDto
;
import
com.wwdz.ch.db.dto.request.UserRequestDto
;
import
com.wwdz.ch.db.dto.request.distribution.DisposableSubscribeRecordRequestDto
;
import
com.wwdz.ch.db.dto.request.distribution.SpecialPerformanceConfigRequestDto
;
import
com.wwdz.ch.db.dto.request.distribution.SpecialPerformanceRequestDto
;
import
com.wwdz.ch.wx.service.distribution.DistributionOrderService
;
import
com.xxdxxs.utils.DateUtils
;
import
com.xxdxxs.utils.JsonUtils
;
import
com.xxdxxs.utils.StringUtils
;
import
org.redisson.api.RLock
;
import
org.redisson.api.RedissonClient
;
...
...
@@ -85,6 +89,10 @@ public class SpecialPerformanceNoticeJob {
@Autowired
FollowFansRecordDao
followFansRecordDao
;
@Autowired
DisposableSubscribeRecordDao
disposableSubscribeRecordDao
;
@Value
(
"${spring.profiles.active}"
)
private
String
env
;
...
...
@@ -124,64 +132,51 @@ public class SpecialPerformanceNoticeJob {
logger
.
info
(
">>>>>>>>>>>>>>>>>>>>>>> dev环境, 不执行专场即将开始通知任务<<<<<<<<<<<<<<<<<<<<<"
);
return
;
}
//正式环境测试, 不发送消息
/* if (true) {
logger.info(">>>>>>>>>>>>>>>>>>>>>>> 正式环境测试, 不执行专场即将开始通知任务<<<<<<<<<<<<<<<<<<<<<");
return;
}*/
logger
.
info
(
"当前即将开始的专场id:{}, 名称为 {} "
,
specialPerformance
.
getId
(),
specialPerformance
.
getTitle
());
//查询专场的商品所属藏家
Long
creatorId
=
null
;
SpecialPerformanceConfigRequestDto
specialPerformanceConfigRequestDto
=
new
SpecialPerformanceConfigRequestDto
();
specialPerformanceConfigRequestDto
.
setSpecialPerformanceId
(
specialPerformance
.
getId
());
List
<
SpecialPerformanceConfig
>
specialPerformanceConfigList
=
specialPerformanceConfigDao
.
findList
(
specialPerformanceConfigRequestDto
);
if
(!
CollectionUtils
.
isEmpty
(
specialPerformanceConfigList
))
{
SpecialPerformanceConfig
specialPerformanceConfig
=
specialPerformanceConfigList
.
get
(
0
);
long
itemId
=
specialPerformanceConfig
.
getItemId
();
AuctionConfig
auctionConfig
=
auctionConfigDao
.
findByItemId
(
itemId
);
if
(
auctionConfig
==
null
)
{
return
;
}
creatorId
=
auctionConfig
.
getCreatorId
();
//查询该用户的粉丝列表
}
if
(
creatorId
==
null
)
{
logger
.
error
(
"================ 专场商品所属藏家id为空,不发送通知 ================ "
);
return
;
}
//发送短信通知
String
url
=
wxAppletApi
.
getUrlLink
(
SPECIAL_PERFORMANCE_URL
,
"specialId="
+
specialPerformance
.
getId
());
String
msg
=
specialPerformance
.
getTitle
()
+
"将在"
+
DateUtils
.
toString
(
specialPerformance
.
getStartTime
())
+
"开始,请前往"
+
url
+
"查看"
;
//发送专场开始订阅通知
DisposableSubscribeRecordRequestDto
disposableSubscribeRecordRequestDto
=
new
DisposableSubscribeRecordRequestDto
();
disposableSubscribeRecordRequestDto
.
setTargetId
(
Long
.
valueOf
(
specialPerformance
.
getId
()));
disposableSubscribeRecordRequestDto
.
setType
(
DisposableSubscribeRecordEnum
.
TypeEnum
.
PRE_START
.
getType
());
boolean
hasNextPage
=
true
;
int
page
=
1
;
FollowFansRecordRequestDto
followFansRecordRequestDto
=
new
FollowFansRecordRequestDto
(
);
followFansRecordRequestDto
.
setFollowerId
(
creatorId
)
;
String
url
=
wxAppletApi
.
getUrlLink
(
SPECIAL_PERFORMANCE_URL
,
"specialId="
+
specialPerformance
.
getId
()
);
String
msg
=
specialPerformance
.
getTitle
()
+
"将在"
+
DateUtils
.
toString
(
specialPerformance
.
getStartTime
())
+
"开始,请前往"
+
url
+
"查看"
;
while
(
hasNextPage
)
{
List
<
FollowFansRecord
>
followFansRecordList
=
followFansRecordDao
.
findList
(
followFansRecordRequestDto
);
PageInfo
pageInfo
=
new
PageInfo
(
followFansRecordList
);
for
(
FollowFansRecord
followFansRecord
:
followFansRecordList
)
{
long
userId
=
followFansRecord
.
getFansId
();
aliSmsSender
.
sendSms
(
userId
,
msg
);
List
<
DisposableSubscribeRecord
>
disposableSubscribeRecordList
=
disposableSubscribeRecordDao
.
findList
(
disposableSubscribeRecordRequestDto
);
PageInfo
pageInfo
=
new
PageInfo
(
disposableSubscribeRecordList
);
for
(
DisposableSubscribeRecord
disposableSubscribeRecord
:
disposableSubscribeRecordList
)
{
AuctionOfferNoticeMsg
auctionOfferNoticeMsg
=
new
AuctionOfferNoticeMsg
();
auctionOfferNoticeMsg
.
setSpecialPerformanceTitle
(
specialPerformance
.
getTitle
());
auctionOfferNoticeMsg
.
setSpecialPerformanceStartTime
(
DateUtils
.
toString
(
specialPerformance
.
getStartTime
()));
auctionOfferNoticeMsg
.
setOpenId
(
disposableSubscribeRecord
.
getOpenid
());
Result
result
=
sendMsgService
.
sendSpecialPerformanceStartMsg
(
auctionOfferNoticeMsg
);
if
(!
result
.
getSuccess
())
{
String
errorCode
=
JsonUtils
.
getValueByPath
(
result
.
getData
().
toString
(),
"errcode"
);
//用户为订阅消息,43101用户未订阅消息;43108并发下发消息给同一个粉丝,这两种情况表示用户不需要被通知
if
(!
"43101"
.
equals
(
errorCode
)
&&
!
"43108"
.
equals
(
errorCode
))
{
//发订阅消息送失败发短信
long
userId
=
disposableSubscribeRecord
.
getUserId
();
aliSmsSender
.
sendSms
(
userId
,
msg
);
}
}
else
{
//发送成功后订阅状态改为无效
disposableSubscribeRecordDao
.
updateInvalid
(
disposableSubscribeRecord
.
getOpenid
(),
disposableSubscribeRecord
.
getTargetId
(),
disposableSubscribeRecord
.
getTemplateId
());
}
}
if
(
pageInfo
.
isHasNextPage
())
{
page
=
page
+
1
;
followFans
RecordRequestDto
.
setPage
(
page
);
logger
.
info
(
"要发送
短信通知
的用户数据总页数为 : {}, 当前为 : {}"
,
pageInfo
.
getPages
(),
page
);
disposableSubscribe
RecordRequestDto
.
setPage
(
page
);
logger
.
info
(
"要发送
专场开始订阅消息
的用户数据总页数为 : {}, 当前为 : {}"
,
pageInfo
.
getPages
(),
page
);
}
else
{
hasNextPage
=
false
;
logger
.
info
(
"============= 发送专场开始短信循环结束 ============="
);
}
if
(
page
>
500
)
{
hasNextPage
=
false
;
logger
.
info
(
"============= 发送专场开始短信超出上限,停止发送 ============="
);
logger
.
info
(
"============= 发送专场开始订阅消息循环结束 ============="
);
break
;
}
}
logger
.
info
(
"================专场id: {}, 即将开始通知
任务,提醒短信
发送成功 =============="
,
specialPerformance
.
getId
());
logger
.
info
(
"================专场id: {}, 即将开始通知
消息全部
发送成功 =============="
,
specialPerformance
.
getId
());
redisUtils
.
set
(
abortStartKey
,
specialPerformance
.
getId
(),
3600
*
24
);
}
else
{
logger
.
info
(
"================专场id: {}, 通知任务已经完成,无需重复发送 =============="
,
specialPerformance
.
getId
());
logger
.
info
(
"================专场id: {},
即将开始
通知任务已经完成,无需重复发送 =============="
,
specialPerformance
.
getId
());
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"专场即将开始通知任务 error {}"
,
e
);
...
...
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