Commit f4953546 by 裴大威

Merge branch 'feat-1002727' into 'master'

1002727读者输入不同类型书给出不同回复

See merge request rays/pcloud-book!622
parents ddacd0bf c42fdac5
...@@ -310,4 +310,6 @@ public interface BookGroupDao extends BaseDao<BookGroup> { ...@@ -310,4 +310,6 @@ public interface BookGroupDao extends BaseDao<BookGroup> {
void updateGradeByDepLabel(Long depLabelId, Long graLabelId); void updateGradeByDepLabel(Long depLabelId, Long graLabelId);
public Long getBookGroupId4OldData(Long raysBookId); public Long getBookGroupId4OldData(Long raysBookId);
Long getIdByBookNameAndJoinGroupType(String bookName, Integer joinGroupType);
} }
...@@ -367,4 +367,12 @@ public class BookGroupDaoImpl extends BaseDaoImpl<BookGroup> implements BookGrou ...@@ -367,4 +367,12 @@ public class BookGroupDaoImpl extends BaseDaoImpl<BookGroup> implements BookGrou
public Long getBookGroupId4OldData(Long raysBookId) { public Long getBookGroupId4OldData(Long raysBookId) {
return getSessionTemplate().selectOne(getStatement("getBookGroupId4OldData"), raysBookId); return getSessionTemplate().selectOne(getStatement("getBookGroupId4OldData"), raysBookId);
} }
@Override
public Long getIdByBookNameAndJoinGroupType(String bookName, Integer joinGroupType) {
Map<String,Object> map = new HashMap<>();
map.put("bookName", bookName);
map.put("joinGroupType", joinGroupType);
return getSessionTemplate().selectOne(getStatement("getIdByBookNameAndJoinGroupType"),map);
}
} }
...@@ -45,7 +45,7 @@ public class SelfRobotSendTextListener { ...@@ -45,7 +45,7 @@ public class SelfRobotSendTextListener {
LOGGER.info("接收到个人号发送文本消息,处理中:"+sendTextDTO.toString()); LOGGER.info("接收到个人号发送文本消息,处理中:"+sendTextDTO.toString());
//TODO 处理个人号消息 //TODO 处理个人号消息
if (!StringUtil.isEmpty(sendTextDTO.getTextContent()) && sendTextDTO.getTextContent().startsWith(WechatGroupConstant.SELF_ROBOT_CONTENT_KEYWORD)) { if (!StringUtil.isEmpty(sendTextDTO.getTextContent()) && sendTextDTO.getTextContent().startsWith(WechatGroupConstant.SELF_ROBOT_CONTENT_KEYWORD)) {
personalStageJumpBiz.handlePersonalStageJump(sendTextDTO.getWechatGroupId(), sendTextDTO.getWxId(), sendTextDTO.getTextContent(), JumpTypeEnum.ROBOT_TRIGGER); personalStageJumpBiz.handlePersonalStageJump(sendTextDTO.getWechatGroupId(), sendTextDTO.getWxId(), sendTextDTO.getTextContent(), JumpTypeEnum.ROBOT_TRIGGER,null,null);
} }
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("接收用户发送文本消息失败" + e.getMessage(), e); LOGGER.error("接收用户发送文本消息失败" + e.getMessage(), e);
......
...@@ -40,7 +40,7 @@ public interface PersonalStageJumpBiz { ...@@ -40,7 +40,7 @@ public interface PersonalStageJumpBiz {
* @return false:未能跳转到下个阶段,需要后续的其它处理; * @return false:未能跳转到下个阶段,需要后续的其它处理;
* true:命中关键字,已经跳转到下个阶段,无需后续处理; * true:命中关键字,已经跳转到下个阶段,无需后续处理;
*/ */
Boolean handlePersonalStageJump(String userWxId, String robotWxId, String content, JumpTypeEnum jumpTypeEnum); Boolean handlePersonalStageJump(String userWxId, String robotWxId, String content, JumpTypeEnum jumpTypeEnum, String bookGroupUrl,String adviserBookUrl);
/** /**
* 跳转到之前的阶段,清除用户填写需求单记录 * 跳转到之前的阶段,清除用户填写需求单记录
......
...@@ -5,6 +5,9 @@ import com.google.common.collect.Lists; ...@@ -5,6 +5,9 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.constant.BookConstant; import com.pcloud.book.book.constant.BookConstant;
import com.pcloud.book.book.dao.BookDao;
import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.content.ResourceConsr; import com.pcloud.book.consumer.content.ResourceConsr;
import com.pcloud.book.consumer.erp.ErpConsr; import com.pcloud.book.consumer.erp.ErpConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr; import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
...@@ -14,6 +17,8 @@ import com.pcloud.book.custom.mapper.CustomPlanMapper; ...@@ -14,6 +17,8 @@ import com.pcloud.book.custom.mapper.CustomPlanMapper;
import com.pcloud.book.custom.mapper.CustomPlanModuleSuggestionMapper; import com.pcloud.book.custom.mapper.CustomPlanModuleSuggestionMapper;
import com.pcloud.book.custom.vo.AddBookNameVO; import com.pcloud.book.custom.vo.AddBookNameVO;
import com.pcloud.book.custom.vo.UserBookServiceVO; import com.pcloud.book.custom.vo.UserBookServiceVO;
import com.pcloud.book.group.dao.BookGroupDao;
import com.pcloud.book.group.enums.JoinGroupTypeEnum;
import com.pcloud.book.keywords.enums.ReplyTypeEnum; import com.pcloud.book.keywords.enums.ReplyTypeEnum;
import com.pcloud.book.mq.delay.DelayMessageSender; import com.pcloud.book.mq.delay.DelayMessageSender;
import com.pcloud.book.pcloudkeyword.dao.PcloudRobotClassifyDao; import com.pcloud.book.pcloudkeyword.dao.PcloudRobotClassifyDao;
...@@ -53,6 +58,8 @@ import com.pcloud.book.personalstage.vo.request.AddScoreRequestVO; ...@@ -53,6 +58,8 @@ import com.pcloud.book.personalstage.vo.request.AddScoreRequestVO;
import com.pcloud.book.personlstage.dto.UserReplaceCodeDTO; import com.pcloud.book.personlstage.dto.UserReplaceCodeDTO;
import com.pcloud.book.push.dao.PersonalAppletsDao; import com.pcloud.book.push.dao.PersonalAppletsDao;
import com.pcloud.book.push.entity.PersonalApplets; import com.pcloud.book.push.entity.PersonalApplets;
import com.pcloud.channelcenter.wechat.dto.BookServeParamVO;
import com.pcloud.channelcenter.wechat.vo.BookServeVO;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.core.mq.DelayQueueDTO; import com.pcloud.common.core.mq.DelayQueueDTO;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
...@@ -147,6 +154,12 @@ public class PersonalStageBizImpl implements PersonalStageBiz { ...@@ -147,6 +154,12 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
private CustomPlanMapper customPlanMapper; private CustomPlanMapper customPlanMapper;
@Autowired @Autowired
private ErpConsr erpConsr; private ErpConsr erpConsr;
@Autowired
private BookGroupDao bookGroupDao;
@Autowired
private BookDao bookDao;
@Autowired
private QrcodeSceneConsr qrcodeSceneConsr;
@Value("${wechat.group.link.prefix}") @Value("${wechat.group.link.prefix}")
...@@ -392,15 +405,6 @@ public class PersonalStageBizImpl implements PersonalStageBiz { ...@@ -392,15 +405,6 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
PersonalStageUser last = personalStageUserDao.getLast(userWxId, robotId, null); PersonalStageUser last = personalStageUserDao.getLast(userWxId, robotId, null);
PersonalStage personalStage; PersonalStage personalStage;
if (last!=null){ if (last!=null){
//如果之前有书的时候判断这个阶段的跳转方式是否踩中有0级和非0级的跳转关键词
//先判断0级
if (dealZeroBook(userWxId, robotId, content,last,JumpTypeEnum.ZERO_BOOK)){
return;
}
//再判断非0级
if (dealZeroBook(userWxId, robotId, content,last,JumpTypeEnum.NO_ZERO_BOOK)){
return;
}
hasRecord=true; hasRecord=true;
personalStage=personalStageDao.getById(last.getPersonalStageId()); personalStage=personalStageDao.getById(last.getPersonalStageId());
}else { }else {
...@@ -409,6 +413,10 @@ public class PersonalStageBizImpl implements PersonalStageBiz { ...@@ -409,6 +413,10 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
Long robotClassifyId=pcloudRobot.getRobotType().longValue(); Long robotClassifyId=pcloudRobot.getRobotType().longValue();
personalStage = personalStageDao.getFirstStage(robotClassifyId); personalStage = personalStageDao.getFirstStage(robotClassifyId);
} }
//优先走获取书名阶段的0级书判断跳转逻辑
if (dealBookNameStageZeroBook(userWxId, robotId, content,personalStage)){
return;
}
Boolean iskeyword; Boolean iskeyword;
if (StringUtil.isEmpty(content)){ if (StringUtil.isEmpty(content)){
iskeyword=false; iskeyword=false;
...@@ -431,7 +439,7 @@ public class PersonalStageBizImpl implements PersonalStageBiz { ...@@ -431,7 +439,7 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
Thread.sleep(100); Thread.sleep(100);
} }
//调关键词处理逻辑 //调关键词处理逻辑
personalStageJumpBiz.handlePersonalStageJump(userWxId,robotId,content,JumpTypeEnum.READER_TRIGGER); personalStageJumpBiz.handlePersonalStageJump(userWxId,robotId,content,JumpTypeEnum.READER_TRIGGER,null,null);
} catch (Exception e){ } catch (Exception e){
LOGGER.info("缓存加锁失败,userWxId=" + userWxId +" robotId="+robotId); LOGGER.info("缓存加锁失败,userWxId=" + userWxId +" robotId="+robotId);
} finally { } finally {
...@@ -481,34 +489,63 @@ public class PersonalStageBizImpl implements PersonalStageBiz { ...@@ -481,34 +489,63 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
} }
} }
@ParamLog("处理0级书和非0级书") @ParamLog("获取书名阶段的0级书判断跳转逻辑")
private Boolean dealZeroBook(String userWxId, String robotId, String content, PersonalStageUser last,JumpTypeEnum jumpTypeEnum) { private Boolean dealBookNameStageZeroBook(String userWxId, String robotId, String content, PersonalStage personalStage) {
PersonalStageJumpKeywordDto dto=personalStageJumpKeywordDao.getByKeyword(last.getPersonalStageId(),content, jumpTypeEnum.key); if (personalStage.getReplaceCodeId()!=null){
if (dto==null){ ReplaceCode replaceCode = replaceCodeDao.getById(personalStage.getReplaceCodeId());
return false; if (replaceCode!=null&&"${bookName}".equals(replaceCode.getReplaceCode())){
} Long personalStageId=personalStage.getId();
List<ReplaceCode> all = replaceCodeDao.getAll(); String fileId=robotId+"_"+userWxId+"_"+personalStageId;
Long replaceCodeId = null; String lastBookName = JedisClusterUtils.hget(PersonalStageConstant.LAST_NOT_KEYWORD_CONTENT_BEFORE_JUMP_STAGE_CACHE, fileId);
for (ReplaceCode replaceCode:all){ if (StringUtil.isEmpty(lastBookName)){
if ("${bookName}".equals(replaceCode.getReplaceCode())){ return false;
replaceCodeId = replaceCode.getId(); }
break; Integer level = erpConsr.getBookServiceLevel(lastBookName);
//判断0级书跳转且是跳转
PersonalStageJumpKeywordDto zeroBookDto=personalStageJumpKeywordDao.getByKeyword(personalStageId,content, JumpTypeEnum.ZERO_BOOK.key);
if (zeroBookDto!=null&&ServiceLevelEnum.ZERO_BOOK.value.equals(level)){
String bookGroupUrl=null;
Long bookGroupId=bookGroupDao.getIdByBookNameAndJoinGroupType(lastBookName, JoinGroupTypeEnum.GROUP_QRCODE.getCode());
if (bookGroupId!=null){
String link = wechatLinkPrefix +"/group/list?source_type=RAY&book_group_id="+bookGroupId;
bookGroupUrl = UrlUtils.getShortUrl4Own(link);
}
personalStageJumpBiz.handlePersonalStageJump(userWxId,robotId,content,JumpTypeEnum.ZERO_BOOK,bookGroupUrl,null);
return true;
}
//判断非0级书跳转且是跳转
PersonalStageJumpKeywordDto noZeroBookDto=personalStageJumpKeywordDao.getByKeyword(personalStageId,content, JumpTypeEnum.NO_ZERO_BOOK.key);
if (noZeroBookDto!=null&&ServiceLevelEnum.NOT_ZERO_BOOK.value.equals(level)){
personalStageJumpBiz.handlePersonalStageJump(userWxId,robotId,content,JumpTypeEnum.NO_ZERO_BOOK,null,null);
return true;
}
//判断无等级且已收录图书跳转
PersonalStageJumpKeywordDto adviserBookDto=personalStageJumpKeywordDao.getByKeyword(personalStageId,content, JumpTypeEnum.ADVISER_BOOK.key);
if (adviserBookDto!=null){
BookDto bookDto= bookDao.getAdviserBookByName(lastBookName);
if (bookDto!=null){
String adviserBookUrl=null;
//判断这个图书有没有资源
BookServeParamVO bookServeParamVO=new BookServeParamVO();
bookServeParamVO.setAdviserId(bookDto.getAdviserId());
bookServeParamVO.setBookId(bookDto.getBookId());
bookServeParamVO.setChannelId(bookDto.getChannelId());
List<BookServeVO> bookServeVOS = qrcodeSceneConsr.listBookServeIds(bookServeParamVO);
if (!ListUtils.isEmpty(bookServeVOS)){
String link = wechatLinkPrefix +"/dialog/resource?bookId="+bookDto.getBookId()+"&adviserId="+bookDto.getAdviserId()+"&channelId="+bookDto.getChannelId()+"&wxId=" + userWxId +"&robotWxId=" + robotId;
adviserBookUrl = UrlUtils.getShortUrl4Own(link);
}
personalStageJumpBiz.handlePersonalStageJump(userWxId,robotId,content,JumpTypeEnum.ADVISER_BOOK,null,adviserBookUrl);
return true;
}
}
PersonalStageJumpKeywordDto noAdviserBookDto=personalStageJumpKeywordDao.getByKeyword(personalStageId,content, JumpTypeEnum.NO_ADVISER_BOOK.key);
if (noAdviserBookDto!=null){
personalStageJumpBiz.handlePersonalStageJump(userWxId,robotId,content,JumpTypeEnum.NO_ADVISER_BOOK,null,null);
return true;
}
} }
} }
UserReplaceCode record = userReplaceCodeDao.getLastUserReplaceByCodeId(userWxId, robotId, replaceCodeId);
if (record==null){
return false;
}
//查询书名等级,阶段跳转
Integer level = erpConsr.getBookServiceLevel(record.getContent());
if (jumpTypeEnum.key.equals(JumpTypeEnum.ZERO_BOOK.key)&& ServiceLevelEnum.ZERO_BOOK.value.equals(level)){
personalStageJumpBiz.handlePersonalStageJump(userWxId,robotId,content,jumpTypeEnum);
return true;
}
if (jumpTypeEnum.key.equals(JumpTypeEnum.NO_ZERO_BOOK.key)&& ServiceLevelEnum.NOT_ZERO_BOOK.value.equals(level)){
personalStageJumpBiz.handlePersonalStageJump(userWxId,robotId,content,jumpTypeEnum);
return true;
}
return false; return false;
} }
......
...@@ -488,7 +488,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz { ...@@ -488,7 +488,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
@Override @Override
@ParamLog("处理用户阶段跳转逻辑") @ParamLog("处理用户阶段跳转逻辑")
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW) @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public Boolean handlePersonalStageJump(String userWxId, String robotWxId, String content, JumpTypeEnum jumpTypeEnum) { public Boolean handlePersonalStageJump(String userWxId, String robotWxId, String content, JumpTypeEnum jumpTypeEnum, String bookGroupUrl,String adviserBookUrl) {
// 查询用户的当前状态信息 // 查询用户的当前状态信息
PersonalStageUser currentStageUser = personalStageUserDao.getLast(userWxId, robotWxId, null); PersonalStageUser currentStageUser = personalStageUserDao.getLast(userWxId, robotWxId, null);
// 如果用户没有阶段状态,则不处理 // 如果用户没有阶段状态,则不处理
...@@ -519,7 +519,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz { ...@@ -519,7 +519,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
// 将用户置为下个阶段 // 将用户置为下个阶段
PersonalStageUser nextPersonalStageUser = personalStageBiz.nextStageAddStageUserAndWakeupDelay(robotWxId, userWxId, ip, jumpKeywordDto.getAfterPersonalStageId()); PersonalStageUser nextPersonalStageUser = personalStageBiz.nextStageAddStageUserAndWakeupDelay(robotWxId, userWxId, ip, jumpKeywordDto.getAfterPersonalStageId());
// 发送内容衔接语 // 发送内容衔接语
sendJumpLinkups(userWxId, robotWxId, ip, jumpKeywordDto.getPersonalStageJumpId(),nextPersonalStageUser.getId()); sendJumpLinkups(userWxId, robotWxId, ip, jumpKeywordDto.getPersonalStageJumpId(),nextPersonalStageUser.getId(),bookGroupUrl,adviserBookUrl);
// 停止发送引导语 // 停止发送引导语
pcloudGuideBiz.stopPcloudGuidePush(robotWxId, userWxId); pcloudGuideBiz.stopPcloudGuidePush(robotWxId, userWxId);
//存用户跳转之前的最后一次非关键词回复到表 //存用户跳转之前的最后一次非关键词回复到表
...@@ -572,6 +572,14 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz { ...@@ -572,6 +572,14 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
sendTextMessageVO.setIp(linkupDelayDTO.getIp()); sendTextMessageVO.setIp(linkupDelayDTO.getIp());
sendTextMessageVO.setCode(SendMessageTypeEnum.SELF.getCode()); sendTextMessageVO.setCode(SendMessageTypeEnum.SELF.getCode());
fillMessageBaseInfo(sendTextMessageVO, linkupDelayDTO); fillMessageBaseInfo(sendTextMessageVO, linkupDelayDTO);
//加跳转衔接语社群书链接
if (!StringUtil.isEmpty(linkupDelayDTO.getBookGroupUrl())){
sendTextMessageVO.setContent(sendTextMessageVO.getContent()+linkupDelayDTO.getBookGroupUrl());
}
//加跳转衔接语编辑书链接
if (!StringUtil.isEmpty(linkupDelayDTO.getAdviserBookUrl())){
sendTextMessageVO.setContent(sendTextMessageVO.getContent()+linkupDelayDTO.getAdviserBookUrl());
}
wechatGroupConsr.sendMessage(JSON.toJSONString(sendTextMessageVO));; wechatGroupConsr.sendMessage(JSON.toJSONString(sendTextMessageVO));;
} else if(ReplyTypeEnum.IMAGE.value.equals( jumpLinkup.getReplyType())) { } else if(ReplyTypeEnum.IMAGE.value.equals( jumpLinkup.getReplyType())) {
SendPicMessageVO sendPicMessageVO = new SendPicMessageVO(); SendPicMessageVO sendPicMessageVO = new SendPicMessageVO();
...@@ -685,7 +693,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz { ...@@ -685,7 +693,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
// 将用户置为下个阶段 // 将用户置为下个阶段
PersonalStageUser nextPersonalStageUser = personalStageBiz.nextStageAddStageUserAndWakeupDelay(robotWxId, userWxId, ip, paperJump.getAfterPersonalStageId()); PersonalStageUser nextPersonalStageUser = personalStageBiz.nextStageAddStageUserAndWakeupDelay(robotWxId, userWxId, ip, paperJump.getAfterPersonalStageId());
// 发送内容衔接语 // 发送内容衔接语
sendJumpLinkups(userWxId, robotWxId, ip, paperJump.getId(), nextPersonalStageUser.getId()); sendJumpLinkups(userWxId, robotWxId, ip, paperJump.getId(), nextPersonalStageUser.getId(), null, null);
// 停止发送引导语 // 停止发送引导语
pcloudGuideBiz.stopPcloudGuidePush(robotWxId, userWxId); pcloudGuideBiz.stopPcloudGuidePush(robotWxId, userWxId);
return true; return true;
...@@ -793,7 +801,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz { ...@@ -793,7 +801,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
// 将用户置为下个阶段 // 将用户置为下个阶段
PersonalStageUser nextPersonalStageUser = personalStageBiz.nextStageAddStageUserAndWakeupDelay(robotId, wxId, ip, afterStageId); PersonalStageUser nextPersonalStageUser = personalStageBiz.nextStageAddStageUserAndWakeupDelay(robotId, wxId, ip, afterStageId);
// 发送内容衔接语 // 发送内容衔接语
sendJumpLinkups(wxId, robotId, ip, stageJumpId, nextPersonalStageUser.getId()); sendJumpLinkups(wxId, robotId, ip, stageJumpId, nextPersonalStageUser.getId(),null,null);
// 停止发送引导语 // 停止发送引导语
pcloudGuideBiz.stopPcloudGuidePush(robotId, wxId); pcloudGuideBiz.stopPcloudGuidePush(robotId, wxId);
} }
...@@ -853,7 +861,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz { ...@@ -853,7 +861,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
// 将用户置为下个阶段 // 将用户置为下个阶段
PersonalStageUser nextPersonalStageUser = personalStageBiz.nextStageAddStageUserAndWakeupDelay(robotId, wxId, ip, afterStageId); PersonalStageUser nextPersonalStageUser = personalStageBiz.nextStageAddStageUserAndWakeupDelay(robotId, wxId, ip, afterStageId);
// 发送内容衔接语 // 发送内容衔接语
sendJumpLinkups(wxId, robotId, ip, stageJumpId, nextPersonalStageUser.getId()); sendJumpLinkups(wxId, robotId, ip, stageJumpId, nextPersonalStageUser.getId(),null,null);
// 停止发送引导语 // 停止发送引导语
pcloudGuideBiz.stopPcloudGuidePush(robotId, wxId); pcloudGuideBiz.stopPcloudGuidePush(robotId, wxId);
} }
...@@ -949,7 +957,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz { ...@@ -949,7 +957,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
// 将用户置为下个阶段 // 将用户置为下个阶段
PersonalStageUser nextPersonalStageUser = personalStageBiz.nextStageAddStageUserAndWakeupDelay(robotId, wxId, ip, afterStageId); PersonalStageUser nextPersonalStageUser = personalStageBiz.nextStageAddStageUserAndWakeupDelay(robotId, wxId, ip, afterStageId);
// 发送内容衔接语 // 发送内容衔接语
sendJumpLinkups(wxId, robotId, ip, stageJumpId, nextPersonalStageUser.getId()); sendJumpLinkups(wxId, robotId, ip, stageJumpId, nextPersonalStageUser.getId(),null,null);
// 停止发送引导语 // 停止发送引导语
pcloudGuideBiz.stopPcloudGuidePush(robotId, wxId); pcloudGuideBiz.stopPcloudGuidePush(robotId, wxId);
} }
...@@ -1026,7 +1034,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz { ...@@ -1026,7 +1034,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
} }
@ParamLog("发送内容衔接语") @ParamLog("发送内容衔接语")
private void sendJumpLinkups(String userWxId, String robotWxId, String ip, Long jumpId, Long personalStageUserId) { private void sendJumpLinkups(String userWxId, String robotWxId, String ip, Long jumpId, Long personalStageUserId, String bookGroupUrl,String adviserBookUrl) {
List<PersonalStageJumpLinkup> linkups = personalStageJumpLinkupDao.getByJumpId(jumpId); List<PersonalStageJumpLinkup> linkups = personalStageJumpLinkupDao.getByJumpId(jumpId);
if(ListUtils.isEmpty(linkups)){ if(ListUtils.isEmpty(linkups)){
return; return;
...@@ -1047,6 +1055,10 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz { ...@@ -1047,6 +1055,10 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
linkupDelayDTO.setMessageGroupId(messageGroupId); linkupDelayDTO.setMessageGroupId(messageGroupId);
linkupDelayDTO.setIndex(i); linkupDelayDTO.setIndex(i);
linkupDelayDTO.setCounts(count); linkupDelayDTO.setCounts(count);
if (i==0&&ReplyTypeEnum.TEXT.value.equals( jumpLinkup.getReplyType())){
linkupDelayDTO.setBookGroupUrl(bookGroupUrl);
linkupDelayDTO.setAdviserBookUrl(adviserBookUrl);
}
DelayQueueDTO delayQueueDTO = DelayQueueDTO.builder().key(userWxId).type(PersonalStageConstant.PERSONALSTAGE_DELAY_LINKUP).msg(linkupDelayDTO).timeout(jumpLinkup.getToStageStartTime()*1000).build(); DelayQueueDTO delayQueueDTO = DelayQueueDTO.builder().key(userWxId).type(PersonalStageConstant.PERSONALSTAGE_DELAY_LINKUP).msg(linkupDelayDTO).timeout(jumpLinkup.getToStageStartTime()*1000).build();
delayMessageSender.send(delayQueueDTO); delayMessageSender.send(delayQueueDTO);
LOGGER.info("增加跳转衔接语延时"+delayQueueDTO.toString()); LOGGER.info("增加跳转衔接语延时"+delayQueueDTO.toString());
...@@ -1054,6 +1066,16 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz { ...@@ -1054,6 +1066,16 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
if(ReplyTypeEnum.TEXT.value.equals( jumpLinkup.getReplyType())){ if(ReplyTypeEnum.TEXT.value.equals( jumpLinkup.getReplyType())){
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO(); SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
sendTextMessageVO.setContent(personalStageBiz.replaceProjectProgressUrl(jumpLinkup.getLinkupContent(),robotWxId,userWxId,personalStageUserId,ip)); sendTextMessageVO.setContent(personalStageBiz.replaceProjectProgressUrl(jumpLinkup.getLinkupContent(),robotWxId,userWxId,personalStageUserId,ip));
if (i==0){
//加跳转衔接语社群书链接
if (!StringUtil.isEmpty(bookGroupUrl)){
sendTextMessageVO.setContent(sendTextMessageVO.getContent()+bookGroupUrl);
}
//加跳转衔接语编辑书链接
if (!StringUtil.isEmpty(adviserBookUrl)){
sendTextMessageVO.setContent(sendTextMessageVO.getContent()+adviserBookUrl);
}
}
sendTextMessageVO.setAltId(robotWxId); sendTextMessageVO.setAltId(robotWxId);
sendTextMessageVO.setWxGroupId(userWxId); sendTextMessageVO.setWxGroupId(userWxId);
sendTextMessageVO.setIp(ip); sendTextMessageVO.setIp(ip);
......
...@@ -20,4 +20,8 @@ public class LinkupDelayDTO extends BaseDelayDTO { ...@@ -20,4 +20,8 @@ public class LinkupDelayDTO extends BaseDelayDTO {
private String ip; private String ip;
@ApiModelProperty("用户阶段记录id") @ApiModelProperty("用户阶段记录id")
private Long personalStageUserId; private Long personalStageUserId;
@ApiModelProperty("跳转衔接语社群书链接")
private String bookGroupUrl;
@ApiModelProperty("跳转衔接语编辑书链接")
private String adviserBookUrl;
} }
...@@ -10,7 +10,9 @@ public enum JumpTypeEnum { ...@@ -10,7 +10,9 @@ public enum JumpTypeEnum {
PLAN_TRIGGER(6,"方案定制单触发"), PLAN_TRIGGER(6,"方案定制单触发"),
TIME_TRIGGER(7,"定时跳转"), TIME_TRIGGER(7,"定时跳转"),
ZERO_BOOK(8,"0级书跳转"), ZERO_BOOK(8,"0级书跳转"),
NO_ZERO_BOOK(9,"非0级书跳转"); NO_ZERO_BOOK(9,"非0级书跳转"),
ADVISER_BOOK(10,"无等级且已收录图书跳转"),
NO_ADVISER_BOOK(11,"无等级且未收录图书跳转");
public final Integer key; public final Integer key;
public final String desc; public final String desc;
......
...@@ -947,4 +947,17 @@ ...@@ -947,4 +947,17 @@
SELECT book_group_id FROM book_group_old_data WHERE rays_book_id = #{raysBookId} SELECT book_group_id FROM book_group_old_data WHERE rays_book_id = #{raysBookId}
</select> </select>
<select id="getIdByBookNameAndJoinGroupType" resultType="long" parameterType="map">
select
t.id
from book_group t
inner join book t1
on t.book_id=t1.book_id
where t.is_delete = 0
and t.join_group_type=#{joinGroupType}
and t1.is_delete = 0
and t1.book_name=#{bookName}
limit 1
</select>
</mapper> </mapper>
\ No newline at end of file
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