Commit a8a935c3 by zhuyajie

多条引导语

parent c327e35a
...@@ -36,4 +36,6 @@ public interface SelfRobotKeywordBiz { ...@@ -36,4 +36,6 @@ public interface SelfRobotKeywordBiz {
String joinGroup(Integer id, String robotId, String wxUserId); String joinGroup(Integer id, String robotId, String wxUserId);
void sendWhenNoReply(Integer id, String robotId, String wxUserId); void sendWhenNoReply(Integer id, String robotId, String wxUserId);
List<SelfRobotKeyword> getListByBookGroupId(Long bookGroupId);
} }
...@@ -27,6 +27,7 @@ import com.pcloud.book.group.tools.SendWeixinRequestTools; ...@@ -27,6 +27,7 @@ import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO; import com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO;
import com.pcloud.book.keywords.biz.BookGuideBiz; import com.pcloud.book.keywords.biz.BookGuideBiz;
import com.pcloud.book.keywords.biz.BookKeywordBiz; import com.pcloud.book.keywords.biz.BookKeywordBiz;
import com.pcloud.book.keywords.biz.SelfRobotKeywordBiz;
import com.pcloud.book.keywords.dao.*; import com.pcloud.book.keywords.dao.*;
import com.pcloud.book.keywords.dto.GuideDTO; import com.pcloud.book.keywords.dto.GuideDTO;
import com.pcloud.book.keywords.dto.KeywordDTO; import com.pcloud.book.keywords.dto.KeywordDTO;
...@@ -122,6 +123,8 @@ public class BookGuideBizImpl implements BookGuideBiz { ...@@ -122,6 +123,8 @@ public class BookGuideBizImpl implements BookGuideBiz {
private BookGroupFriendGuideDao bookGroupFriendGuideDao; private BookGroupFriendGuideDao bookGroupFriendGuideDao;
@Autowired @Autowired
private ResourceConsr resourceConsr; private ResourceConsr resourceConsr;
@Autowired
private SelfRobotKeywordBiz selfRobotKeywordBiz;
@Value("${system.env}") @Value("${system.env}")
private String envStr; private String envStr;
...@@ -169,8 +172,8 @@ public class BookGuideBizImpl implements BookGuideBiz { ...@@ -169,8 +172,8 @@ public class BookGuideBizImpl implements BookGuideBiz {
if (envStr.toUpperCase().equals("TEST") && agreeAddUserDTO.getRobotWxId().equals("wxid_zus32xb5ukjn22") if (envStr.toUpperCase().equals("TEST") && agreeAddUserDTO.getRobotWxId().equals("wxid_zus32xb5ukjn22")
|| envStr.toUpperCase().equals("UAT") && agreeAddUserDTO.getRobotWxId().equals("wxid_p7gywuxkk89112") || envStr.toUpperCase().equals("UAT") && agreeAddUserDTO.getRobotWxId().equals("wxid_p7gywuxkk89112")
|| envStr.toUpperCase().equals("PRO") && agreeAddUserDTO.getRobotWxId().equals("wxid_x8i897ryabo722")) { || envStr.toUpperCase().equals("PRO") && agreeAddUserDTO.getRobotWxId().equals("wxid_x8i897ryabo722")) {
List<SelfRobotKeyword> selfRobotKeywords = selfRobotKeywordDao.getListByBookGroupId(bookGroupId); List<SelfRobotKeyword> selfRobotKeywords = selfRobotKeywordBiz.getListByBookGroupId(bookGroupId);
List<SelfRobotKeyword> hasGuideKeywords=selfRobotKeywords.stream().filter(s->s.getGuide()!=null&&s.getDelayTime()!=null).collect(Collectors.toList()); List<SelfRobotKeyword> hasGuideKeywords=selfRobotKeywords.stream().filter(s->!ListUtils.isEmpty(s.getGuideList())&&s.getDelayTime()!=null).collect(Collectors.toList());
int time = hasGuideKeywords.get(0).getDelayTime(); int time = hasGuideKeywords.get(0).getDelayTime();
BookGuideDelayDto delayDto = new BookGuideDelayDto(agreeAddUserDTO.getUserWxId(), DateUtils.addSecond(new Date(), time), hasGuideKeywords.get(0).getKeyword(), agreeAddUserDTO.getIp()); BookGuideDelayDto delayDto = new BookGuideDelayDto(agreeAddUserDTO.getUserWxId(), DateUtils.addSecond(new Date(), time), hasGuideKeywords.get(0).getKeyword(), agreeAddUserDTO.getIp());
log.info("[向缓存中写入相关信息 延迟推送时间]:{}",JSONObject.toJSONString(delayDto)); log.info("[向缓存中写入相关信息 延迟推送时间]:{}",JSONObject.toJSONString(delayDto));
......
...@@ -598,10 +598,13 @@ public class BookKeywordBizImpl implements BookKeywordBiz { ...@@ -598,10 +598,13 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
} }
} }
}else { }else {
BookGroup bookGroup = bookGroupDao.getByShortBookName(content);
if (bookGroup == null) {
sendText(sendTextDTO, "抱歉呀!小睿不太明白你在说什么。嘿嘿!你的语言太高级了,待小睿深度解析一下,我还在不断学习呢!或者你看看,是不是关键词输错了呢?麻烦你再输一遍正确的关键词?比如回复我背单词。"); sendText(sendTextDTO, "抱歉呀!小睿不太明白你在说什么。嘿嘿!你的语言太高级了,待小睿深度解析一下,我还在不断学习呢!或者你看看,是不是关键词输错了呢?麻烦你再输一遍正确的关键词?比如回复我背单词。");
} }
} }
} }
}
@ParamLog("推送新版关键词回复消息") @ParamLog("推送新版关键词回复消息")
private void sendSelfKeyword(SelfRobotKeyword selfRobotKeyword, SendTextDTO sendTextDTO) { private void sendSelfKeyword(SelfRobotKeyword selfRobotKeyword, SendTextDTO sendTextDTO) {
...@@ -800,11 +803,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz { ...@@ -800,11 +803,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
SelfRobotKeyword selfRobotKeyword = selfRobotKeywords.get(i); SelfRobotKeyword selfRobotKeyword = selfRobotKeywords.get(i);
String toAddIn; String toAddIn;
if (!StringUtil.isEmpty(selfRobotKeyword.getGuide())){ // if (!StringUtil.isEmpty(selfRobotKeyword.getGuide())){//改为多个引导语了1002267
toAddIn = selfRobotKeyword.getGuide() + ",请回复“" + selfRobotKeyword.getKeyword() + "”\n"; // toAddIn = selfRobotKeyword.getGuide() + ",请回复“" + selfRobotKeyword.getKeyword() + "”\n";
}else { // }else {
toAddIn = "请回复“" + selfRobotKeyword.getKeyword() + "”\n"; toAddIn = "请回复“" + selfRobotKeyword.getKeyword() + "”\n";
} // }
//最后一个 //最后一个
if (i + 1 == size) { if (i + 1 == size) {
// 拼接反馈链接 // 拼接反馈链接
......
...@@ -15,11 +15,13 @@ import com.pcloud.book.group.entity.WeixinQrcodeGeneration; ...@@ -15,11 +15,13 @@ import com.pcloud.book.group.entity.WeixinQrcodeGeneration;
import com.pcloud.book.group.enums.AppAndProductTypeEnum; import com.pcloud.book.group.enums.AppAndProductTypeEnum;
import com.pcloud.book.group.tools.SendWeixinRequestTools; import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.keywords.biz.SelfRobotKeywordBiz; import com.pcloud.book.keywords.biz.SelfRobotKeywordBiz;
import com.pcloud.book.keywords.dao.SelfRobotGuideDao;
import com.pcloud.book.keywords.dao.SelfRobotKeywordDao; import com.pcloud.book.keywords.dao.SelfRobotKeywordDao;
import com.pcloud.book.keywords.dao.SelfRobotKeywordReplyDao; 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.mapper.TempRobotSkillDao; import com.pcloud.book.keywords.mapper.TempRobotSkillDao;
import com.pcloud.book.keywords.dto.MaxSeqNAndBGDTO; import com.pcloud.book.keywords.dto.MaxSeqNAndBGDTO;
import com.pcloud.book.keywords.entity.SelfRobotKeyword;
import com.pcloud.book.keywords.entity.SelfRobotKeywordReply; import com.pcloud.book.keywords.entity.SelfRobotKeywordReply;
import com.pcloud.book.keywords.entity.TempRobotSkill; import com.pcloud.book.keywords.entity.TempRobotSkill;
import com.pcloud.book.keywords.enums.ReplyTypeEnum; import com.pcloud.book.keywords.enums.ReplyTypeEnum;
...@@ -87,6 +89,8 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz { ...@@ -87,6 +89,8 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
private WechatGroupConsr wechatGroupConsr; private WechatGroupConsr wechatGroupConsr;
@Autowired @Autowired
private WeixinQrcodeGenerationDao weixinQrcodeGenerationDao; private WeixinQrcodeGenerationDao weixinQrcodeGenerationDao;
@Autowired
private SelfRobotGuideDao selfRobotGuideDao;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ParamLog("批量新增个人号关键词") @ParamLog("批量新增个人号关键词")
...@@ -126,6 +130,14 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz { ...@@ -126,6 +130,14 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
selfRobotKeywordReply.setCreateUser(partyId); selfRobotKeywordReply.setCreateUser(partyId);
}); });
selfRobotKeywordReplyDao.insert(replyList); selfRobotKeywordReplyDao.insert(replyList);
List<SelfRobotGuide> guides = selfRobotKeyword.getGuideList();
if (!ListUtils.isEmpty(guides)){
guides.forEach(selfRobotGuide -> {
selfRobotGuide.setKeywordId(keywordId);
selfRobotGuide.setCreateUser(partyId);
});
}
selfRobotGuideDao.insert(guides);
} }
//将作品应用关键词加到社群书应用 //将作品应用关键词加到社群书应用
bookGroupAppBiz.addSelfKeywordToBookGroupApp(selfRobotKeywords); bookGroupAppBiz.addSelfKeywordToBookGroupApp(selfRobotKeywords);
...@@ -164,6 +176,15 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz { ...@@ -164,6 +176,15 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
selfRobotKeywordReply.setCreateUser(partyId); selfRobotKeywordReply.setCreateUser(partyId);
}); });
selfRobotKeywordReplyDao.insert(replyList); selfRobotKeywordReplyDao.insert(replyList);
selfRobotGuideDao.deleteByKeywordId(selfRobotKeyword.getId());
List<SelfRobotGuide> guides = selfRobotKeyword.getGuideList();
if (!ListUtils.isEmpty(guides)){
guides.forEach(selfRobotGuide -> {
selfRobotGuide.setKeywordId(selfRobotKeyword.getId());
selfRobotGuide.setCreateUser(partyId);
});
}
selfRobotGuideDao.insert(guides);
for (SelfRobotKeywordReply selfRobotKeywordReply:replyList){ for (SelfRobotKeywordReply selfRobotKeywordReply:replyList){
if (ReplyTypeEnum.APP.value.equals(selfRobotKeywordReply.getType()) if (ReplyTypeEnum.APP.value.equals(selfRobotKeywordReply.getType())
&& AppAndProductTypeEnum.PRODUCT.value.equals(selfRobotKeywordReply.getServeType())) { && AppAndProductTypeEnum.PRODUCT.value.equals(selfRobotKeywordReply.getServeType())) {
...@@ -179,6 +200,7 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz { ...@@ -179,6 +200,7 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
public void deleteSelfRobotKeyword(Long id) { public void deleteSelfRobotKeyword(Long id) {
selfRobotKeywordDao.deleteById(id); selfRobotKeywordDao.deleteById(id);
selfRobotKeywordReplyDao.deleteByKeywordId(id); selfRobotKeywordReplyDao.deleteByKeywordId(id);
selfRobotGuideDao.deleteByKeywordId(id);
} }
@ParamLog("获取个人号关键词列表") @ParamLog("获取个人号关键词列表")
...@@ -490,6 +512,20 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz { ...@@ -490,6 +512,20 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
} }
} }
@Override
public List<SelfRobotKeyword> getListByBookGroupId(Long bookGroupId) {
List<SelfRobotKeyword> list = selfRobotKeywordDao.getListByBookGroupId(bookGroupId);
if (!ListUtils.isEmpty(list)){
for (SelfRobotKeyword keyword : list){
List<SelfRobotGuide> guides = selfRobotGuideDao.getListByKeywordId(keyword.getId());
if (!ListUtils.isEmpty(guides)){
keyword.setGuideList(guides);
}
}
}
return list;
}
@ParamLog("填充列表") @ParamLog("填充列表")
private void fillSelfRobotKeyword(List<SelfRobotKeyword> selfRobotKeywords) { private void fillSelfRobotKeyword(List<SelfRobotKeyword> selfRobotKeywords) {
if (ListUtils.isEmpty(selfRobotKeywords)){ if (ListUtils.isEmpty(selfRobotKeywords)){
...@@ -499,6 +535,10 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz { ...@@ -499,6 +535,10 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
List<Long> productIds=new ArrayList<>(); List<Long> productIds=new ArrayList<>();
List<Long> resourceIds=new ArrayList<>(); List<Long> resourceIds=new ArrayList<>();
for (SelfRobotKeyword selfRobotKeyword : selfRobotKeywords){ for (SelfRobotKeyword selfRobotKeyword : selfRobotKeywords){
List<SelfRobotGuide> guides = selfRobotGuideDao.getListByKeywordId(selfRobotKeyword.getId());
if (!ListUtils.isEmpty(guides)){
selfRobotKeyword.setGuideList(guides);
}
List<SelfRobotKeywordReply> replyList = selfRobotKeywordReplyDao.getListByKeywordId(selfRobotKeyword.getId()); List<SelfRobotKeywordReply> replyList = selfRobotKeywordReplyDao.getListByKeywordId(selfRobotKeyword.getId());
if (ListUtils.isEmpty(replyList)){ if (ListUtils.isEmpty(replyList)){
continue; continue;
......
package com.pcloud.book.keywords.dao;
import com.pcloud.book.keywords.entity.SelfRobotGuide;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* 个人号关键词引导语
*/
public interface SelfRobotGuideDao extends BaseDao<SelfRobotGuide> {
void deleteByKeywordId(Long keywordId);
public List<SelfRobotGuide> getListByKeywordId(Long keywordId);
}
package com.pcloud.book.keywords.dao; package com.pcloud.book.keywords.dao;
import com.pcloud.book.keywords.dto.MaxSeqNAndBGDTO;
import com.pcloud.book.keywords.entity.SelfRobotKeyword;
import com.pcloud.book.keywords.entity.SelfRobotKeywordReply; import com.pcloud.book.keywords.entity.SelfRobotKeywordReply;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
......
package com.pcloud.book.keywords.dao.impl;
import com.pcloud.book.keywords.dao.SelfRobotGuideDao;
import com.pcloud.book.keywords.entity.SelfRobotGuide;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* 个人号关键词引导语
*/
@Component("selfRobotGuideDao")
public class SelfRobotGuideDaoImpl extends BaseDaoImpl<SelfRobotGuide> implements SelfRobotGuideDao {
@Override
public void deleteByKeywordId(Long keywordId) {
getSessionTemplate().delete(getStatement("deleteByKeywordId"), keywordId);
}
@Override
public List<SelfRobotGuide> getListByKeywordId(Long keywordId) {
return getSessionTemplate().selectList(getStatement("getListByKeywordId"), keywordId);
}
}
package com.pcloud.book.keywords.dao.impl; package com.pcloud.book.keywords.dao.impl;
import com.pcloud.book.keywords.dao.SelfRobotKeywordDao;
import com.pcloud.book.keywords.dao.SelfRobotKeywordReplyDao; import com.pcloud.book.keywords.dao.SelfRobotKeywordReplyDao;
import com.pcloud.book.keywords.dto.MaxSeqNAndBGDTO;
import com.pcloud.book.keywords.entity.SelfRobotKeyword;
import com.pcloud.book.keywords.entity.SelfRobotKeywordReply; import com.pcloud.book.keywords.entity.SelfRobotKeywordReply;
import com.pcloud.common.core.dao.BaseDaoImpl; import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @Description * @Description
......
package com.pcloud.book.keywords.entity;
import com.pcloud.common.entity.BaseEntity;
import com.pcloud.contentcenter.resource.dto.ResourceOfficeItemDTO;
import com.pcloud.contentcenter.resource.dto.ResourcePdfItemDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @Description
* @Author zhuyajie
* @Date 2020/02/05 13:39
**/
@Data
@ApiModel("个人号关键词引导语")
public class SelfRobotGuide extends BaseEntity {
@ApiModelProperty("关键词id")
private Long keywordId;
@ApiModelProperty("类型 1 文字 2 图片 3 链接 4应用 5素材")
private Integer type;
@ApiModelProperty("内容")
private String content;
@ApiModelProperty("图片地址")
private String picUrl;
@ApiModelProperty("排序值")
private Integer seqNum;
@ApiModelProperty("创建人")
private Long createUser;
}
...@@ -21,7 +21,7 @@ public class SelfRobotKeyword extends BaseEntity { ...@@ -21,7 +21,7 @@ public class SelfRobotKeyword extends BaseEntity {
@ApiModelProperty("社群码id") @ApiModelProperty("社群码id")
private Long bookGroupId; private Long bookGroupId;
@ApiModelProperty("引导语") // @ApiModelProperty("引导语")
private String guide; private String guide;
@ApiModelProperty("关键词") @ApiModelProperty("关键词")
...@@ -38,4 +38,7 @@ public class SelfRobotKeyword extends BaseEntity { ...@@ -38,4 +38,7 @@ public class SelfRobotKeyword extends BaseEntity {
@ApiModelProperty("关键词回复列表") @ApiModelProperty("关键词回复列表")
private List<SelfRobotKeywordReply> keywordReplyList; private List<SelfRobotKeywordReply> keywordReplyList;
@ApiModelProperty("引导语列表")
private List<SelfRobotGuide> guideList;
} }
...@@ -22,7 +22,6 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -22,7 +22,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
......
...@@ -4,8 +4,10 @@ import com.alibaba.fastjson.JSONObject; ...@@ -4,8 +4,10 @@ import com.alibaba.fastjson.JSONObject;
import com.pcloud.book.book.dto.BookGuideDelayDto; import com.pcloud.book.book.dto.BookGuideDelayDto;
import com.pcloud.book.consumer.content.ResourceConsr; import com.pcloud.book.consumer.content.ResourceConsr;
import com.pcloud.book.keywords.biz.BookKeywordBiz; 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.SelfRobotKeywordDao;
import com.pcloud.book.keywords.dao.SelfRobotKeywordReplyDao; 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.SelfRobotKeyword;
import com.pcloud.book.keywords.entity.SelfRobotKeywordReply; import com.pcloud.book.keywords.entity.SelfRobotKeywordReply;
import com.pcloud.book.keywords.enums.ReplyTypeEnum; import com.pcloud.book.keywords.enums.ReplyTypeEnum;
...@@ -13,11 +15,7 @@ import com.pcloud.common.utils.DateUtils; ...@@ -13,11 +15,7 @@ import com.pcloud.common.utils.DateUtils;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.cache.redis.JedisClusterUtils; import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import com.pcloud.contentcenter.resource.dto.ResourceDTO; import com.pcloud.contentcenter.resource.dto.ResourceDTO;
import com.sdk.wxgroup.SendFileVO; import com.sdk.wxgroup.*;
import com.sdk.wxgroup.SendGroupInviteVO;
import com.sdk.wxgroup.SendMessageTypeEnum;
import com.sdk.wxgroup.SendTextMessageVO;
import com.sdk.wxgroup.WxGroupSDK;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -55,6 +53,8 @@ public class KeyWordDelayRunner implements ApplicationRunner { ...@@ -55,6 +53,8 @@ public class KeyWordDelayRunner implements ApplicationRunner {
@Autowired @Autowired
private SelfRobotKeywordReplyDao selfRobotKeywordReplyDao; private SelfRobotKeywordReplyDao selfRobotKeywordReplyDao;
@Autowired
private SelfRobotGuideDao selfRobotGuideDao;
@Override @Override
...@@ -103,15 +103,33 @@ public class KeyWordDelayRunner implements ApplicationRunner { ...@@ -103,15 +103,33 @@ public class KeyWordDelayRunner implements ApplicationRunner {
// 查询当前关键词 // 查询当前关键词
SelfRobotKeyword currentKeyword=selfRobotKeywordDao.getByBookGroupIdAndKeyword(finalBookGroupId,bookGuideDelayDto.getKeyword()); 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(); SendTextMessageVO vo = new SendTextMessageVO();
vo.setContent(currentKeyword.getGuide()); vo.setContent(selfRobotGuide.getContent());
vo.setCode(SendMessageTypeEnum.SELF.getCode()); vo.setCode(SendMessageTypeEnum.SELF.getCode());
vo.setWxId(bookGuideDelayDto.getUserWxId()); vo.setWxId(bookGuideDelayDto.getUserWxId());
vo.setAltId(finalWxid); vo.setAltId(finalWxid);
vo.setWxGroupId(bookGuideDelayDto.getUserWxId()); vo.setWxGroupId(bookGuideDelayDto.getUserWxId());
vo.setIp(bookGuideDelayDto.getIp()); vo.setIp(bookGuideDelayDto.getIp());
WxGroupSDK.sendTextMessage(vo); WxGroupSDK.sendTextMessage(vo);
log.info("[发送当前关键词]:{}", JSONObject.toJSONString(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()) if ("学前".equals(currentKeyword.getKeyword())
&& envStr.toUpperCase().equals("PRO") && finalWxid.equals("wxid_x8i897ryabo722")) { && envStr.toUpperCase().equals("PRO") && finalWxid.equals("wxid_x8i897ryabo722")) {
SendGroupInviteVO sendGroupInviteVO = new SendGroupInviteVO(); SendGroupInviteVO sendGroupInviteVO = new SendGroupInviteVO();
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.keywords.dao.impl.SelfRobotGuideDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.keywords.entity.SelfRobotGuide">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="keyword_id" property="keywordId" jdbcType="BIGINT"/>
<result column="type" property="type" jdbcType="INTEGER"/>
<result column="content" property="content" jdbcType="VARCHAR"/>
<result column="pic_url" property="picUrl" jdbcType="VARCHAR"/>
<result column="seq_num" property="seqNum" jdbcType="INTEGER"/>
<result column="create_user" property="createUser" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, keyword_id, type, content, pic_url, seq_num, create_user, create_time
</sql>
<insert id="insert" parameterType="com.pcloud.book.keywords.entity.SelfRobotGuide" useGeneratedKeys="true"
keyProperty="id">
insert into self_robot_guide
<trim prefix="(" suffix=")" suffixOverrides=",">
keyword_id,
type,
content,
pic_url,
seq_num,
create_user,
create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{keywordId,jdbcType=BIGINT},
#{type,jdbcType=INTEGER},
#{content,jdbcType=VARCHAR},
#{picUrl,jdbcType=VARCHAR},
#{seqNum,jdbcType=INTEGER},
#{createUser,jdbcType=BIGINT},
NOW()
</trim>
</insert>
<!--批量插入-->
<insert id="batchInsert" parameterType="com.pcloud.book.keywords.entity.SelfRobotGuide" useGeneratedKeys="true" keyProperty="id">
insert into self_robot_guide (
keyword_id,
type,
content,
pic_url,
seq_num,
create_user,
create_time
) values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.keywordId,jdbcType=BIGINT},
#{item.type,jdbcType=INTEGER},
#{item.content,jdbcType=VARCHAR},
#{item.picUrl,jdbcType=VARCHAR},
#{item.seqNum,jdbcType=INTEGER},
#{item.createUser,jdbcType=BIGINT},
NOW()
)
</foreach>
</insert>
<delete id="deleteByKeywordId" parameterType="map">
delete from self_robot_guide
where keyword_id = #{keywordId}
</delete>
<select id="getListByKeywordId" parameterType="long" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from self_robot_guide
where keyword_id = #{keywordId}
order by seq_num, id
</select>
</mapper>
\ No newline at end of file
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
<resultMap id="BaseResultMap" type="com.pcloud.book.keywords.entity.SelfRobotKeyword"> <resultMap id="BaseResultMap" type="com.pcloud.book.keywords.entity.SelfRobotKeyword">
<id column="id" property="id" jdbcType="BIGINT"/> <id column="id" property="id" jdbcType="BIGINT"/>
<result column="book_group_id" property="bookGroupId" jdbcType="BIGINT"/> <result column="book_group_id" property="bookGroupId" jdbcType="BIGINT"/>
<result column="guide" property="guide" jdbcType="VARCHAR"/>
<result column="keyword" property="keyword" jdbcType="VARCHAR"/> <result column="keyword" property="keyword" jdbcType="VARCHAR"/>
<result column="seq_num" property="seqNum" jdbcType="INTEGER"/> <result column="seq_num" property="seqNum" jdbcType="INTEGER"/>
<result column="delay_time" property="delayTime" jdbcType="INTEGER"/> <result column="delay_time" property="delayTime" jdbcType="INTEGER"/>
...@@ -14,7 +13,7 @@ ...@@ -14,7 +13,7 @@
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, book_group_id, guide, keyword, seq_num, delay_time, create_user, create_time id, book_group_id, keyword, seq_num, delay_time, create_user, create_time
</sql> </sql>
<insert id="insert" parameterType="com.pcloud.book.keywords.entity.SelfRobotKeyword" useGeneratedKeys="true" <insert id="insert" parameterType="com.pcloud.book.keywords.entity.SelfRobotKeyword" useGeneratedKeys="true"
...@@ -22,7 +21,6 @@ ...@@ -22,7 +21,6 @@
insert into self_robot_keyword insert into self_robot_keyword
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
book_group_id, book_group_id,
guide,
keyword, keyword,
seq_num, seq_num,
delay_time, delay_time,
...@@ -31,7 +29,6 @@ ...@@ -31,7 +29,6 @@
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
#{bookGroupId,jdbcType=BIGINT}, #{bookGroupId,jdbcType=BIGINT},
#{guide,jdbcType=VARCHAR},
#{keyword,jdbcType=VARCHAR}, #{keyword,jdbcType=VARCHAR},
#{seqNum,jdbcType=INTEGER}, #{seqNum,jdbcType=INTEGER},
#{delayTime,jdbcType=INTEGER}, #{delayTime,jdbcType=INTEGER},
...@@ -44,7 +41,6 @@ ...@@ -44,7 +41,6 @@
<insert id="batchInsert" parameterType="com.pcloud.book.keywords.entity.SelfRobotKeyword" useGeneratedKeys="true" keyProperty="id"> <insert id="batchInsert" parameterType="com.pcloud.book.keywords.entity.SelfRobotKeyword" useGeneratedKeys="true" keyProperty="id">
insert into self_robot_keyword ( insert into self_robot_keyword (
book_group_id, book_group_id,
guide,
keyword, keyword,
seq_num, seq_num,
delay_time, delay_time,
...@@ -54,7 +50,6 @@ ...@@ -54,7 +50,6 @@
<foreach collection="list" item="item" index="index" separator=","> <foreach collection="list" item="item" index="index" separator=",">
( (
#{item.bookGroupId,jdbcType=BIGINT}, #{item.bookGroupId,jdbcType=BIGINT},
#{item.guide,jdbcType=VARCHAR},
#{item.keyword,jdbcType=VARCHAR}, #{item.keyword,jdbcType=VARCHAR},
#{item.seqNum,jdbcType=INTEGER}, #{item.seqNum,jdbcType=INTEGER},
#{item.delayTime,jdbcType=INTEGER}, #{item.delayTime,jdbcType=INTEGER},
...@@ -68,7 +63,6 @@ ...@@ -68,7 +63,6 @@
update self_robot_keyword update self_robot_keyword
<set> <set>
book_group_id = #{bookGroupId,jdbcType=BIGINT}, book_group_id = #{bookGroupId,jdbcType=BIGINT},
guide = #{guide,jdbcType=VARCHAR},
keyword = #{keyword,jdbcType=VARCHAR}, keyword = #{keyword,jdbcType=VARCHAR},
seq_num = #{seqNum,jdbcType=INTEGER}, seq_num = #{seqNum,jdbcType=INTEGER},
delay_time = #{delayTime,jdbcType=INTEGER} delay_time = #{delayTime,jdbcType=INTEGER}
...@@ -100,12 +94,18 @@ ...@@ -100,12 +94,18 @@
</select> </select>
<select id="getNextKeyWord" parameterType="map" resultMap="BaseResultMap"> <select id="getNextKeyWord" parameterType="map" resultMap="BaseResultMap">
SELECT * FROM self_robot_keyword SELECT
WHERE book_group_id=#{bookGroupId} k.id, k.book_group_id, k.keyword, k.seq_num, k.delay_time, k.create_user, k.create_time
AND seq_num > (SELECT seq_num FROM self_robot_keyword WHERE keyword = #{keyword} AND book_group_id=#{bookGroupId} LIMIT 1) FROM
and delay_time is not null self_robot_keyword k
and guide is not null LEFT JOIN self_robot_guide g ON k.id = g.keyword_id
ORDER BY seq_num WHERE
k.book_group_id = #{bookGroupId}
AND k.seq_num > (SELECT seq_num FROM self_robot_keyword WHERE keyword = #{keyword} AND book_group_id=#{bookGroupId} LIMIT 1)
AND k.delay_time IS NOT NULL
AND g.id > 0
ORDER BY
k.seq_num
LIMIT 1 LIMIT 1
</select> </select>
......
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