Commit 6e6ebce5 by 阮思源

修改截取规则

parent 4d78f867
......@@ -645,66 +645,68 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
if (i == 1 || i == 2) {
text = text + "🔥";
}
text = text + i + "." + bookGroupServe.getServeName() + bookGroupServe.getShortUrl() + "\n";
String content = text + i + "." + bookGroupServe.getServeName() + bookGroupServe.getShortUrl() + "\n";
if (content.length() > LE) {
sendText(sendTextDTO, text);
text = "";
} else {
text = content;
}
i = i + 1;
}
} else {
text = text + "《" + bookName + "》" + "还没有配置资源服务,敬请期待。\n";
}
//获取配套关键词。先去掉,后面可能需要再加上
// List<KeywordDTO> keywordDTOS = getListByBookGroupId(bookGroupId);
// if (!ListUtils.isEmpty(keywordDTOS)) {
// text = text + "回复括号内关键词领取本书配套资源学习资料:\n";
// for (KeywordDTO keywordDTO : keywordDTOS) {
// if (!StringUtil.isEmpty(keywordDTO.getKeywords())) {
// text = text + "【" + keywordDTO.getKeywords() + "】";
// }
// }
// text = text + "\n";
// }
//邀请进群
if (isInviteGroup != null && isInviteGroup) {
//获取社群码下的分类
List<ListClassifyVO> listClassifyVOS = bookGroupClassifyBiz.listAllClassify(bookGroupId);
if (!ListUtils.isEmpty(listClassifyVOS)) {
text = text + "======================\n";
String content = text + "======================\n";
if (content.length() > LE) {
sendText(sendTextDTO, text);
text = "";
} else {
text = content;
}
if (listClassifyVOS.size() == 1) {
ListClassifyVO listClassifyVO = listClassifyVOS.get(0);
//如果只有一个分类
text = text + "☕本书还配有交流群“" + listClassifyVO.getClassify() + "”," + listClassifyVO.getClassifyIntroduce() + ",点击下方邀请链接,即可进群";
//发送欢迎语
if (text.length() > LE) {
sendTextBatch(sendTextDTO, text, LE);
} else {
String contents = text + "☕本书还配有交流群“" + listClassifyVO.getClassify() + "”," + listClassifyVO.getClassifyIntroduce() + ",点击下方邀请链接,即可进群";
if (contents.length() > LE) {
sendText(sendTextDTO, text);
text = "";
} else {
text = contents;
}
sendText(sendTextDTO, text);
dealGroupInvite(sendTextDTO, listClassifyVO.getId(), listClassifyVO.getChangeNumber());
} else {
text = text + "☕本书还配有以下交流群,选择你想加入的微信群,回复群名称,我会拉你入群!\n";
for (ListClassifyVO listClassifyVO : listClassifyVOS) {
text = text + "☑" + listClassifyVO.getClassify() + ":" + listClassifyVO.getClassifyIntroduce() + "\n";
}
//发送欢迎语
if (text.length() > LE) {
sendTextBatch(sendTextDTO, text, LE);
} else {
sendText(sendTextDTO, text);
String contents = text + "☑" + listClassifyVO.getClassify() + ":" + listClassifyVO.getClassifyIntroduce() + "\n";
if (contents.length() > LE) {
sendText(sendTextDTO, text);
text = "";
} else {
text = contents;
}
}
sendText(sendTextDTO, text);
}
return;
}
}
//发送配置的资源服务和关键词
if (text.length() > LE) {
sendTextBatch(sendTextDTO, text, LE);
} else {
sendText(sendTextDTO, text);
}
//发送配置的资源服务
sendText(sendTextDTO, text);
}
@ParamLog("发送收到暗号后的本书介绍")
private void sendText(SendTextDTO sendTextDTO, String content) {
if (StringUtil.isEmpty(content)){
return;
}
String userWxId = sendTextDTO.getWechatUserId();
String ip = sendTextDTO.getIp();
Integer code = sendTextDTO.getCode();
......@@ -720,21 +722,6 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
log.info("发送收到暗号后的本书介绍 : {}", vo);
}
@ParamLog("发送收到暗号后的本书介绍")
private void sendTextBatch(SendTextDTO sendTextDTO, String content, Integer le) {
List<String> contents = new ArrayList<>();
String s = content;
while (s.length() > le) {
contents.add(s.substring(0, le));
s = s.substring(le, s.length());
}
contents.add(s);
for (String sin : contents) {
sendText(sendTextDTO, sin);
}
}
@ParamLog("分类群发送邀请入群链接")
private void dealGroupInvite(SendTextDTO sendTextDTO, Long classifyId, Integer changeNumber) {
//获取分类基本信息
......
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