Commit f45d1464 by 裴大威

Merge branch 'fix-pcloudAgentRecord' into 'master'

bug 1020214 解决小睿出版社收录无响应的问题

See merge request rays/pcloud-book!381
parents 7394cd54 de3cc30f
...@@ -547,13 +547,14 @@ public class BookKeywordBizImpl implements BookKeywordBiz { ...@@ -547,13 +547,14 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
//判断是否是平台端配置的小号,如果是,走平台端 //判断是否是平台端配置的小号,如果是,走平台端
PcloudRobot pcloudRobot = pcloudRobotDao.getByWxId(sendTextDTO.getWxId()); PcloudRobot pcloudRobot = pcloudRobotDao.getByWxId(sendTextDTO.getWxId());
if (pcloudRobot!=null){ if (pcloudRobot!=null){
// 小睿对话索要出版社信息
boolean _continue = replySelfKeywordTemplate(sendTextDTO);
// 判断是否需要继续走下去
if(!_continue) { return; }
sendPcloudKeyword(sendTextDTO,pcloudRobot); sendPcloudKeyword(sendTextDTO,pcloudRobot);
return; return;
} }
if (SendMessageTypeEnum.SELF.getCode().equals(sendTextDTO.getCode())) { if (SendMessageTypeEnum.SELF.getCode().equals(sendTextDTO.getCode())) {
// 小睿对话索要出版社信息
boolean _continue = replySelfKeywordTemplate(sendTextDTO);
if(_continue) {
dealBookGroupCipher(sendTextDTO); dealBookGroupCipher(sendTextDTO);
//判断是否为某个群分类名称 //判断是否为某个群分类名称
inviteToGroupByKeyword(sendTextDTO); inviteToGroupByKeyword(sendTextDTO);
...@@ -563,10 +564,10 @@ public class BookKeywordBizImpl implements BookKeywordBiz { ...@@ -563,10 +564,10 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
replySelfKeyword(sendTextDTO); replySelfKeyword(sendTextDTO);
} }
} }
}
@ParamLog("小睿根据书名推送匹配的资源") @ParamLog("小睿根据书名推送匹配的资源")
private boolean replySelfKeywordTemplate(SendTextDTO sendTextDTO) { private boolean replySelfKeywordTemplate(SendTextDTO sendTextDTO) {
try {
String content = sendTextDTO.getTextContent(); String content = sendTextDTO.getTextContent();
String redisKey = "replySelfKeywordTemplate:"+sendTextDTO.getWxId()+":"+sendTextDTO.getWechatUserId(); String redisKey = "replySelfKeywordTemplate:"+sendTextDTO.getWxId()+":"+sendTextDTO.getWechatUserId();
List<SelfRobotKeywordReplyTemplate> replyTemplateList = selfRobotKeywordReplyTemplateDao.getList(); List<SelfRobotKeywordReplyTemplate> replyTemplateList = selfRobotKeywordReplyTemplateDao.getList();
...@@ -584,7 +585,8 @@ public class BookKeywordBizImpl implements BookKeywordBiz { ...@@ -584,7 +585,8 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
return true; return true;
} }
String agentName = content.substring(index + 4); String agentName = content.substring(index + 4);
if(StringUtil.isNotNull(agentName)){ // 如果出版社名称为空,则直接return走非关键逻辑
if(StringUtil.isEmpty(agentName)){ return true; }
// 从redis取出书名 // 从redis取出书名
String bookName = JedisClusterUtils.get(redisKey); String bookName = JedisClusterUtils.get(redisKey);
// 删掉书名 // 删掉书名
...@@ -601,7 +603,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz { ...@@ -601,7 +603,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
} }
Optional<SelfRobotKeywordReplyTemplate> replyTemplate = replyTemplateList.stream().filter(x -> x.getStatus().equals(2)).findFirst(); Optional<SelfRobotKeywordReplyTemplate> replyTemplate = replyTemplateList.stream().filter(x -> x.getStatus().equals(2)).findFirst();
sendText(sendTextDTO, replyTemplate.get().getReplyContentTemplate()); sendText(sendTextDTO, replyTemplate.get().getReplyContentTemplate());
} return false;
} }
String bookName = matcher.group(1).trim(); String bookName = matcher.group(1).trim();
...@@ -614,6 +616,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz { ...@@ -614,6 +616,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
// 呃,小睿刚才仔细的找了下,发现书刊的配套资源我这边还没有呢,要不等小睿看完整理好后再给你吧 // 呃,小睿刚才仔细的找了下,发现书刊的配套资源我这边还没有呢,要不等小睿看完整理好后再给你吧
Optional<SelfRobotKeywordReplyTemplate> replyTemplate = replyTemplateList.stream().filter(x -> x.getStatus().equals(3)).findFirst(); Optional<SelfRobotKeywordReplyTemplate> replyTemplate = replyTemplateList.stream().filter(x -> x.getStatus().equals(3)).findFirst();
sendText(sendTextDTO, replyTemplate.get().getReplyContentTemplate().replace("${bookName}",bookName)); sendText(sendTextDTO, replyTemplate.get().getReplyContentTemplate().replace("${bookName}",bookName));
return false;
} else { } else {
// 根据bookIds查询资源数; // 根据bookIds查询资源数;
Integer totalCount = channelConsr.getMessageCountByBookIds(bookIds); Integer totalCount = channelConsr.getMessageCountByBookIds(bookIds);
...@@ -644,9 +647,13 @@ public class BookKeywordBizImpl implements BookKeywordBiz { ...@@ -644,9 +647,13 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
Optional<SelfRobotKeywordReplyTemplate> replyTemplate = replyTemplateList.stream().filter(x -> x.getStatus().equals(1)).findFirst(); Optional<SelfRobotKeywordReplyTemplate> replyTemplate = replyTemplateList.stream().filter(x -> x.getStatus().equals(1)).findFirst();
sendText(sendTextDTO, replyTemplate.get().getReplyContentTemplate().replace("${bookName}",bookName)); sendText(sendTextDTO, replyTemplate.get().getReplyContentTemplate().replace("${bookName}",bookName));
} }
}
return false; return false;
} }
} catch (Exception e) {
log.info("小睿收集出版社信息异常;异常信息:" + e.getMessage());
return true;
}
}
@ParamLog("发送平台端小号的") @ParamLog("发送平台端小号的")
private void sendPcloudKeyword(SendTextDTO sendTextDTO,PcloudRobot pcloudRobot) { private void sendPcloudKeyword(SendTextDTO sendTextDTO,PcloudRobot pcloudRobot) {
......
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