Commit 49a51b8b by 阮思源

【ID1002326】demo的数据处理

parent f45588b8
......@@ -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);
}
}
}
......
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