Commit 8ff1a004 by 阮思源

Merge branch 'feat-1002326' into 'master'

【ID1002326】demo的数据处理

See merge request rays/pcloud-book!385
parents f45588b8 49a51b8b
......@@ -3,7 +3,6 @@ package com.pcloud.book.keywords.biz.impl;
import com.alibaba.fastjson.JSONObject;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.constant.BookConstant;
import com.pcloud.book.book.dto.BookGuideDelayDto;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.content.ResourceConsr;
import com.pcloud.book.consumer.resource.ProductConsr;
......@@ -12,7 +11,6 @@ import com.pcloud.book.group.biz.BookGroupAppBiz;
import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.biz.GroupQrcodeBiz;
import com.pcloud.book.group.dao.AppTouchRecordDao;
import com.pcloud.book.group.dao.BookGroupCipherUserDao;
import com.pcloud.book.group.dao.BookGroupClassifyDao;
import com.pcloud.book.group.dao.BookGroupDao;
import com.pcloud.book.group.dao.BookGroupFriendGuideDao;
......@@ -26,7 +24,6 @@ import com.pcloud.book.group.dto.PushAddUserMessageDTO;
import com.pcloud.book.group.dto.SendDefaultGuideMessageDTO;
import com.pcloud.book.group.dto.SendGuideMessageDTO;
import com.pcloud.book.group.entity.AppTouchRecord;
import com.pcloud.book.group.entity.BookGroupCipherUser;
import com.pcloud.book.group.entity.BookGroupFriendGuide;
import com.pcloud.book.group.entity.GroupQrcode;
import com.pcloud.book.group.entity.JoinGroupCipher;
......@@ -38,16 +35,12 @@ import com.pcloud.book.guide.dto.PcloudGuideDelayDto;
import com.pcloud.book.guide.entity.PcloudGuide;
import com.pcloud.book.guide.mapper.PcloudGuideMapper;
import com.pcloud.book.guide.mapper.PcloudGuideMessageMapper;
import com.pcloud.book.guide.mapper.PcloudRobotSilenceMapper;
import com.pcloud.book.guide.vo.PcloudGuideMessageVO;
import com.pcloud.book.keywords.biz.BookGuideBiz;
import com.pcloud.book.keywords.biz.BookKeywordBiz;
import com.pcloud.book.keywords.biz.SelfRobotKeywordBiz;
import com.pcloud.book.keywords.dao.BookGuideDao;
import com.pcloud.book.keywords.dao.BookGuideReplyDao;
import com.pcloud.book.keywords.dao.KeywordDao;
import com.pcloud.book.keywords.dao.SelfRobotKeywordDao;
import com.pcloud.book.keywords.dao.SelfRobotKeywordReplyDao;
import com.pcloud.book.keywords.dto.GuideDTO;
import com.pcloud.book.keywords.dto.KeywordDTO;
import com.pcloud.book.keywords.dto.KeywordStatusDTO;
......@@ -55,7 +48,6 @@ import com.pcloud.book.keywords.dto.ReplyKeywordDTO;
import com.pcloud.book.keywords.entity.BookGuide;
import com.pcloud.book.keywords.entity.BookGuideReply;
import com.pcloud.book.keywords.entity.Keyword;
import com.pcloud.book.keywords.entity.SelfRobotKeyword;
import com.pcloud.book.keywords.enums.ReplyTypeEnum;
import com.pcloud.book.keywords.vo.GuideVO;
import com.pcloud.book.keywords.vo.ReplyMessageVO;
......@@ -68,7 +60,6 @@ import com.pcloud.book.weixinclock.dao.WeixinClockGroupClassifyDao;
import com.pcloud.book.weixinclock.dto.WeixinClockDto;
import com.pcloud.channelcenter.wechat.dto.AccountSettingDto;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.utils.DateUtils;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import com.pcloud.common.utils.httpclient.UrlUtils;
......@@ -83,7 +74,6 @@ import com.sdk.wxgroup.SendPicMessageVO;
import com.sdk.wxgroup.SendTextMessageVO;
import com.sdk.wxgroup.WxGroupSDK;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -97,7 +87,6 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
......@@ -143,16 +132,10 @@ public class BookGuideBizImpl implements BookGuideBiz {
@Autowired
private BookGroupAppBiz bookGroupAppBiz;
@Autowired
private BookGroupCipherUserDao bookGroupCipherUserDao;
@Autowired
private SelfRobotKeywordDao selfRobotKeywordDao;
@Autowired
private BookGroupFriendGuideDao bookGroupFriendGuideDao;
@Autowired
private ResourceConsr resourceConsr;
@Autowired
private SelfRobotKeywordBiz selfRobotKeywordBiz;
@Autowired
private PcloudRobotBiz pcloudRobotBiz;
@Autowired
private PcloudGuideMessageMapper pcloudGuideMessageMapper;
......@@ -160,13 +143,7 @@ public class BookGuideBizImpl implements BookGuideBiz {
private PcloudRobotDao pcloudRobotDao;
@Autowired
private PcloudGuideMapper pcloudGuideMapper;
@Autowired
private PcloudRobotSilenceMapper pcloudRobotSilenceMapper;
@Value("${system.env}")
private String envStr;
@Autowired
private SelfRobotKeywordReplyDao selfRobotKeywordReplyDao;
@Value("${wechat.group.link.prefix}")
private String wechatGroupLinkPrefix;
......@@ -180,46 +157,11 @@ public class BookGuideBizImpl implements BookGuideBiz {
String cipher = agreeAddUserDTO.getCipher();
//如果暗号为空,表示直接加好友,需要发送统一欢迎语
if (cipher == null) {
//临时演示用,后面要删掉
BookGroupDTO dto=null;
if (envStr.toUpperCase().equals("TEST")&&agreeAddUserDTO.getRobotWxId().equals("wxid_zus32xb5ukjn22")){
dto = bookGroupDao.getDTOById(1621L);
}
if (envStr.toUpperCase().equals("UAT")&&agreeAddUserDTO.getRobotWxId().equals("wxid_p7gywuxkk89112")){
dto = bookGroupDao.getDTOById(449L);
}
if (envStr.toUpperCase().equals("PRO")&&agreeAddUserDTO.getRobotWxId().equals("wxid_x8i897ryabo722")){
dto = bookGroupDao.getDTOById(23735L);
}
if (dto!=null){
Long bookGroupId=dto.getId();
BookGroupCipherUser bookGroupCipherUser = new BookGroupCipherUser();
bookGroupCipherUser.setBookGroupCipher(dto.getBookGroupCipher());
bookGroupCipherUser.setShortBookName(dto.getShortBookName());
bookGroupCipherUser.setBookGroupId(bookGroupId);
bookGroupCipherUser.setWxUserId(agreeAddUserDTO.getUserWxId());
bookGroupCipherUser.setAltId(agreeAddUserDTO.getRobotWxId());
//新增暗号对应记录
bookGroupCipherUserDao.insert(bookGroupCipherUser);
//发送配置欢迎语 create by lihao 2020.2.7
//发送配置欢迎语 create by lihao 2020.2.7
//判断是否是平台端小号
PcloudRobot pcloudRobot = pcloudRobotDao.getByWxId(agreeAddUserDTO.getRobotWxId());
if (pcloudRobot!=null){
pcloudRobotBiz.sendWelcomeReply(agreeAddUserDTO.getRobotWxId(), agreeAddUserDTO.getUserWxId(), agreeAddUserDTO.getIp());
//好友引导语
sendFriendGuide(bookGroupId, agreeAddUserDTO);
// TODO 引导语发送后 查询等待时间
// 向缓存中写入相关信息 延迟推送时间
if (envStr.toUpperCase().equals("TEST") && agreeAddUserDTO.getRobotWxId().equals("wxid_zus32xb5ukjn22")
|| envStr.toUpperCase().equals("UAT") && agreeAddUserDTO.getRobotWxId().equals("wxid_p7gywuxkk89112")
|| envStr.toUpperCase().equals("PRO") && agreeAddUserDTO.getRobotWxId().equals("wxid_x8i897ryabo722")) {
List<SelfRobotKeyword> selfRobotKeywords = selfRobotKeywordBiz.getListByBookGroupId(bookGroupId);
List<SelfRobotKeyword> hasGuideKeywords=selfRobotKeywords.stream().filter(s->!ListUtils.isEmpty(s.getGuideList())&&s.getDelayTime()!=null).collect(Collectors.toList());
int time = hasGuideKeywords.get(0).getDelayTime();
BookGuideDelayDto delayDto = new BookGuideDelayDto(agreeAddUserDTO.getUserWxId(), DateUtils.addSecond(new Date(), time), hasGuideKeywords.get(0).getKeyword(), agreeAddUserDTO.getIp());
log.info("[向缓存中写入相关信息 延迟推送时间]:{}",JSONObject.toJSONString(delayDto));
// 加好友 清除历史
JedisClusterUtils.hdel(agreeAddUserDTO.getRobotWxId()+"_DELAY_PUSH", agreeAddUserDTO.getUserWxId());
JedisClusterUtils.hset(agreeAddUserDTO.getRobotWxId()+"_DELAY_PUSH", agreeAddUserDTO.getUserWxId(), JSONObject.toJSONString(delayDto));
}
return;
}
SendTextMessageVO vo = new SendTextMessageVO();
......
......@@ -6,7 +6,6 @@ import com.pcloud.appcenter.app.dto.AppDto;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.biz.BookKeywordWarehouseBiz;
import com.pcloud.book.book.dao.BookDao;
import com.pcloud.book.book.dto.BookGuideDelayDto;
import com.pcloud.book.consumer.app.AppConsr;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.content.ResourceConsr;
......@@ -24,7 +23,6 @@ import com.pcloud.book.group.dao.BookGroupCipherUserDao;
import com.pcloud.book.group.dao.BookGroupClassifyDao;
import com.pcloud.book.group.dao.BookGroupDao;
import com.pcloud.book.group.dao.GroupQrcodeDao;
import com.pcloud.book.group.dao.JoinGroupCipherDao;
import com.pcloud.book.group.dao.WxUserWechatRelevanceDao;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.BookWxQrcodeDTO;
......@@ -168,8 +166,6 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
@Autowired
private GroupQrcodeBiz groupQrcodeBiz;
@Autowired
private JoinGroupCipherDao joinGroupCipherDao;
@Autowired
private LiveCons liveCons;
@Autowired
private BookGroupCipherUserDao bookGroupCipherUserDao;
......@@ -794,80 +790,18 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
SelfRobotKeyword selfRobotKeyword = selfRobotKeywordDao.getByBookGroupIdAndKeyword(bookGroupCipherUser.getBookGroupId(), content);
if (selfRobotKeyword != null) {
sendSelfKeyword(selfRobotKeyword, sendTextDTO);
//临时,后面要删
String robotId = sendTextDTO.getWxId();
if ("一对一".equals(content)){
Boolean pushIdCard=false;
if (envStr.toUpperCase().equals("TEST")&&robotId.equals("wxid_zus32xb5ukjn22")
&&new Long(1621L).equals(bookGroupCipherUser.getBookGroupId())){
pushIdCard=true;
}
if (envStr.toUpperCase().equals("UAT")&&(robotId.equals("wxid_51ff9f099l9a22")||robotId.equals("wxid_fadtd2q58njx12"))
&&new Long(449L).equals(bookGroupCipherUser.getBookGroupId())){
pushIdCard=true;
}
if (envStr.toUpperCase().equals("PRO")&&robotId.equals("wxid_x8i897ryabo722")
&&new Long(23735L).equals(bookGroupCipherUser.getBookGroupId())){
pushIdCard=true;
}
if (pushIdCard){
SendPicMessageVO sendPicMessageVO = new SendPicMessageVO();
sendPicMessageVO.setWxGroupId(sendTextDTO.getWechatUserId());
sendPicMessageVO.setAltId(robotId);
sendPicMessageVO.setPicUrl("https://oss.5rs.me/oss/uploadfe/jpg/ed67ad219eab128dcd404844ee966483.jpg");
sendPicMessageVO.setIp(sendTextDTO.getIp());
sendPicMessageVO.setCode(sendTextDTO.getCode());
sendPicMessageVO.setWxId(sendTextDTO.getWechatUserId());
WxGroupSDK.sendPicMessage(sendPicMessageVO);
log.info("发送特殊名片"+sendPicMessageVO.toString());
}
}
if ("学前".equals(content)){
String wxGroupId="";
if (envStr.toUpperCase().equals("TEST")&&robotId.equals("wxid_zus32xb5ukjn22")
&&new Long(1621L).equals(bookGroupCipherUser.getBookGroupId())){
wxGroupId="19066199642@chatroom";
}
if (envStr.toUpperCase().equals("UAT")&&(robotId.equals("wxid_51ff9f099l9a22")||robotId.equals("wxid_fadtd2q58njx12"))
&&new Long(449L).equals(bookGroupCipherUser.getBookGroupId())){
wxGroupId="";
}
if (envStr.toUpperCase().equals("PRO")&&robotId.equals("wxid_x8i897ryabo722")
&&new Long(23735L).equals(bookGroupCipherUser.getBookGroupId())){
wxGroupId="23084048866@chatroom";
}
if (!StringUtil.isEmpty(wxGroupId)){
SendGroupInviteVO sendGroupInviteVO = new SendGroupInviteVO();
sendGroupInviteVO.setAltId(sendTextDTO.getWxId());
sendGroupInviteVO.setWxId(sendTextDTO.getWechatUserId());
sendGroupInviteVO.setWxGroupId(wxGroupId);
sendGroupInviteVO.setIp(sendTextDTO.getIp());
WxGroupSDK.sendGroupInvite(sendGroupInviteVO);
log.info("临时发送入群连接 sendGroupInviteVO:{}", sendGroupInviteVO);
}
}
} else {
if (!((envStr.toUpperCase().equals("TEST") && sendTextDTO.getWxId().equals("wxid_zus32xb5ukjn22") && new Long(1621L).equals(bookGroupCipherUser.getBookGroupId()))
|| (envStr.toUpperCase().equals("UAT") && (sendTextDTO.getWxId().equals("wxid_51ff9f099l9a22")||sendTextDTO.getWxId().equals("wxid_fadtd2q58njx12")) && new Long(449L).equals(bookGroupCipherUser.getBookGroupId()))
|| (envStr.toUpperCase().equals("PRO") && sendTextDTO.getWxId().equals("wxid_x8i897ryabo722") && new Long(23735L).equals(bookGroupCipherUser.getBookGroupId())))){
BookGroup bookGroup = bookGroupDao.getByShortBookName(content);
Boolean isActivityKeyword = readingActivityBiz.isKeyWord(sendTextDTO);
if (bookGroup == null && !isActivityKeyword) {
//既不是关键词也不是识别码
String altIdAndWxId = sendTextDTO.getWxId() + "_" + sendTextDTO.getWechatUserId();
Integer send = JedisClusterUtils.hgetJson2Class(REPLY_GUIDE_CACHE, altIdAndWxId, Integer.class);
if (send == null) {
sendText(sendTextDTO, "请按以上指引回复准确的内容以便获取对应服务,谢谢!");
JedisClusterUtils.hset2Json(REPLY_GUIDE_CACHE, altIdAndWxId, 1);
//1小时缓存
JedisClusterUtils.expire(REPLY_GUIDE_CACHE, 60 * 60 * 1);
}
}
}else {
BookGroup bookGroup = bookGroupDao.getByShortBookName(content);
Boolean isActivityKeyword = readingActivityBiz.isKeyWord(sendTextDTO);
if (bookGroup == null && !isActivityKeyword) {
sendNotKeywords(sendTextDTO);
BookGroup bookGroup = bookGroupDao.getByShortBookName(content);
Boolean isActivityKeyword = readingActivityBiz.isKeyWord(sendTextDTO);
if (bookGroup == null && !isActivityKeyword) {
//既不是关键词也不是识别码
String altIdAndWxId = sendTextDTO.getWxId() + "_" + sendTextDTO.getWechatUserId();
Integer send = JedisClusterUtils.hgetJson2Class(REPLY_GUIDE_CACHE, altIdAndWxId, Integer.class);
if (send == null) {
sendText(sendTextDTO, "请按以上指引回复准确的内容以便获取对应服务,谢谢!");
JedisClusterUtils.hset2Json(REPLY_GUIDE_CACHE, altIdAndWxId, 1);
//1小时缓存
JedisClusterUtils.expire(REPLY_GUIDE_CACHE, 60 * 60 * 1);
}
}
}
......
package com.pcloud.book.keywords.runner;
import com.alibaba.fastjson.JSONObject;
import com.pcloud.book.book.dto.BookGuideDelayDto;
import com.pcloud.book.consumer.content.ResourceConsr;
import com.pcloud.book.keywords.biz.BookKeywordBiz;
import com.pcloud.book.keywords.dao.SelfRobotGuideDao;
import com.pcloud.book.keywords.dao.SelfRobotKeywordDao;
import com.pcloud.book.keywords.dao.SelfRobotKeywordReplyDao;
import com.pcloud.book.keywords.entity.SelfRobotGuide;
import com.pcloud.book.keywords.entity.SelfRobotKeyword;
import com.pcloud.book.keywords.entity.SelfRobotKeywordReply;
import com.pcloud.book.keywords.enums.ReplyTypeEnum;
import com.pcloud.common.utils.DateUtils;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import com.pcloud.contentcenter.resource.dto.ResourceDTO;
import com.sdk.wxgroup.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 项目启动制行的任务
*
* @author Gui_q
* @since 2020年2月3日 12点14分
*/
@Component
@Slf4j
public class KeyWordDelayRunner implements ApplicationRunner {
@Value("${system.env}")
private String envStr;
@Autowired
private SelfRobotKeywordDao selfRobotKeywordDao;
@Autowired
private BookKeywordBiz bookKeywordBiz;
@Autowired
private ResourceConsr resourceConsr;
@Autowired
private SelfRobotKeywordReplyDao selfRobotKeywordReplyDao;
@Autowired
private SelfRobotGuideDao selfRobotGuideDao;
@Override
public void run(ApplicationArguments applicationArguments) throws Exception {
log.info("[项目启动后 定时检查用户情况]");
if(!JedisClusterUtils.setnx("KEYWORDDELAYRUNNER_LOCK","KEYWORDDELAYRUNNER_LOCK")){
JedisClusterUtils.expire("KEYWORDDELAYRUNNER_LOCK",15*60);
return;
}
Long bookGroupId = 0L;
String wxid = "";
switch (envStr.toUpperCase()) {
case "TEST":
wxid = "wxid_zus32xb5ukjn22";
bookGroupId = 1621L;
break;
case "UAT":
wxid = "wxid_51ff9f099l9a22";
bookGroupId = 449L;
break;
case "PRO":
wxid = "wxid_x8i897ryabo722";
bookGroupId = 23735L;
break;
}
String finalWxid = wxid;
Long finalBookGroupId = bookGroupId;
new Thread(() -> {
while (true) {
try {
Thread.sleep(1000);
Map<String, String> friends = JedisClusterUtils.hgetAll(finalWxid+"_DELAY_PUSH");
if (friends==null){
continue;
}
Set<String> userSet = friends.keySet();
for (String userId : userSet) {
try {
BookGuideDelayDto bookGuideDelayDto = JSONObject.parseObject(friends.get(userId), BookGuideDelayDto.class);
if (bookGuideDelayDto.getExpireTime().before(new Date())) {
// 查询当前关键词
SelfRobotKeyword currentKeyword=selfRobotKeywordDao.getByBookGroupIdAndKeyword(finalBookGroupId,bookGuideDelayDto.getKeyword());
// 发送当前关键词引导语
List<SelfRobotGuide> guides = selfRobotGuideDao.getListByKeywordId(currentKeyword.getId());
if (!ListUtils.isEmpty(guides)){
for (SelfRobotGuide selfRobotGuide: guides){
if (ReplyTypeEnum.TEXT.value.equals(selfRobotGuide.getType())){
SendTextMessageVO vo = new SendTextMessageVO();
vo.setContent(selfRobotGuide.getContent());
vo.setCode(SendMessageTypeEnum.SELF.getCode());
vo.setWxId(bookGuideDelayDto.getUserWxId());
vo.setAltId(finalWxid);
vo.setWxGroupId(bookGuideDelayDto.getUserWxId());
vo.setIp(bookGuideDelayDto.getIp());
WxGroupSDK.sendTextMessage(vo);
log.info("[发送当前关键词引导语]:{}", JSONObject.toJSONString(vo));
}
if (ReplyTypeEnum.IMAGE.value.equals(selfRobotGuide.getType())){
SendPicMessageVO sendPicMessageVO = new SendPicMessageVO();
sendPicMessageVO.setWxGroupId(bookGuideDelayDto.getUserWxId());
sendPicMessageVO.setWxId(bookGuideDelayDto.getUserWxId());
sendPicMessageVO.setAltId(finalWxid);
sendPicMessageVO.setPicUrl(selfRobotGuide.getPicUrl());
sendPicMessageVO.setIp(bookGuideDelayDto.getIp());
sendPicMessageVO.setCode(SendMessageTypeEnum.SELF.getCode());
WxGroupSDK.sendPicMessage(sendPicMessageVO);
log.info("[发送当前关键词引导语]:{}", JSONObject.toJSONString(sendPicMessageVO));
}
}
}
if ("学前".equals(currentKeyword.getKeyword())
&& envStr.toUpperCase().equals("PRO") && finalWxid.equals("wxid_x8i897ryabo722")) {
SendGroupInviteVO sendGroupInviteVO = new SendGroupInviteVO();
sendGroupInviteVO.setAltId(finalWxid);
sendGroupInviteVO.setWxId(bookGuideDelayDto.getUserWxId());
sendGroupInviteVO.setWxGroupId("23084048866@chatroom");
sendGroupInviteVO.setIp(bookGuideDelayDto.getIp());
WxGroupSDK.sendGroupInvite(sendGroupInviteVO);
log.info("临时发送入群连接 sendGroupInviteVO:{}", sendGroupInviteVO);
}
if ("教辅书单".equals(currentKeyword.getKeyword())) {
List<SelfRobotKeywordReply> replyList = selfRobotKeywordReplyDao.getListByKeywordId(currentKeyword.getId());
if (!ListUtils.isEmpty(replyList)) {
for (SelfRobotKeywordReply keywordReply : replyList) {
if (ReplyTypeEnum.RESOURCE.value.equals(keywordReply.getType())) {
SendFileVO sendFileVO = new SendFileVO();
Map<Long, ResourceDTO> map = resourceConsr.mapByIds(Arrays.asList(keywordReply.getResourceId()));
ResourceDTO resourceDTO = map.get(keywordReply.getResourceId());
if (resourceDTO != null) {
sendFileVO.setFileUrl(resourceDTO.getFileUrl());
sendFileVO.setFileName(resourceDTO.getResourceName());
}
sendFileVO.setIp(bookGuideDelayDto.getIp());
sendFileVO.setAltId(finalWxid);
sendFileVO.setWxId(bookGuideDelayDto.getUserWxId());
WxGroupSDK.sendFile(sendFileVO);
}
}
}
}
SelfRobotKeyword nextKeyWord = selfRobotKeywordDao.getNextKeyWord(finalBookGroupId, bookGuideDelayDto.getKeyword());
if (nextKeyWord==null){
JedisClusterUtils.hdel(finalWxid+"_DELAY_PUSH",userId);
continue;
}
int time = nextKeyWord.getDelayTime();
// 更新缓存中的关键词
BookGuideDelayDto delayDto = BookGuideDelayDto.builder().userWxId(bookGuideDelayDto.getUserWxId())
.expireTime(DateUtils.addSecond(new Date(), time))
.keyword(nextKeyWord.getKeyword())
.ip(bookGuideDelayDto.getIp()).build();
JedisClusterUtils.hset(finalWxid + "_DELAY_PUSH", bookGuideDelayDto.getUserWxId(), JSONObject.toJSONString(delayDto));
}
}catch (Exception e){
continue;
}
}
} catch (Exception e) {
// log.info("[KeyWordDelayRunner] 关键词超时推送 失败",e);
}
}
}).start();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment