Commit a39836b0 by 裴大威

Merge branch 'fix-text300to1000' into 'master'

feat Text 1001742 300 to 1000

See merge request rays/pcloud-book!157
parents f4bb1317 6bfa1cdc
......@@ -442,7 +442,7 @@ public class AdNewsBizImpl implements AdNewsBiz {
int i = 1;
for (AdNews adNews : adNewsList) {
String temp = content + i + "." + adNews.getTitle() + adNews.getShortUrl() + "\n";
if (temp.length() >= 300) {
if (temp.length() >= 1000) {
// 如果本次拼接后的长度大于 300,那么将之前拼接的内容存入数组
contents.add(content);
// 重置 content 的内容
......
......@@ -383,7 +383,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
}
}
int length = linkLength + adTitle.length();
if (length > 300) {
if (length > 1000) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "文本长度超过300!");
}
}
......
......@@ -155,7 +155,7 @@ public class SendWeixinRequestTools {
sb.append("\n\n在群内回复以下关键词,领取任务或资源:\n");
for (KeywordDTO keyword : keywords) {
// 关键词长度和欢迎语长度之和超过300会拆分成两条,若拆分之后关键词长度还是大于300则只发300以内的部分
if ((s.length() + sb.length()) >= 300 && (sb.length() + (keyword.getKeywords() + "\n").length()) >= 277) {
if ((s.length() + sb.length()) >= 1000 && (sb.length() + (keyword.getKeywords() + "\n").length()) >= 977) {
break;
}
sb.append("【").append(keyword.getKeywords()).append("】");
......@@ -163,7 +163,7 @@ public class SendWeixinRequestTools {
}
StringBuilder groupKeyword = getGroupKeyword(dto, sb);
// 1001692 自定义欢迎语+关键词文案,如果超过300字,关键词拆分出来发
if (s.length() + groupKeyword.length() >= 300) {
if (s.length() + groupKeyword.length() >= 1000) {
sendMessageDTO.setContent(s);
sendMessage(sendMessageDTO, robotId, weixinGroupId, ip, code);
sendMessageDTO.setContent(groupKeyword.toString().replaceFirst("\n\n", ""));
......@@ -330,7 +330,7 @@ public class SendWeixinRequestTools {
for (int i = 0; i < keywords.size(); i++) {
KeywordDTO keywordDTO = keywords.get(i);
String keyword = "关键词【" + keywordDTO.getKeywords() + "】\n" + " "+keywordDTO.getGuide();
if (content.length() + keyword.length() > 300) {
if (content.length() + keyword.length() > 1000) {
sendTextMessageToSelf(content.toString(), robotId, toWxId, ip);
content = new StringBuilder(keyword);
}else{
......@@ -385,7 +385,7 @@ public class SendWeixinRequestTools {
if (!CollectionUtils.isEmpty(keywords) && isGroupRobot) {
sb.append("\n\n在群内回复以下关键词,领取任务或资源:\n");
for (KeywordDTO keyword : keywords) {
if ((content.length() + sb.length()) >= 300 && (sb.length() + (keyword.getKeywords() + "\n").length()) >= 277) {
if ((content.length() + sb.length()) >= 1000 && (sb.length() + (keyword.getKeywords() + "\n").length()) >= 977) {
break;
}
sb.append("【").append(keyword.getKeywords()).append("】");
......@@ -393,7 +393,7 @@ public class SendWeixinRequestTools {
}
StringBuilder groupKeyword = getGroupKeyword(dto, sb);
// 1001692 自定义欢迎语+关键词文案,如果超过300字,关键词拆分出来发
if ((content.length() + sb.length()) >= 300) {
if ((content.length() + sb.length()) >= 1000) {
sendTextMessage(content.toString(), robotId, weixinGroupId, ip);
sendTextMessage(groupKeyword.toString().replaceFirst("\n\n", ""), robotId, weixinGroupId, ip);
} else {
......@@ -455,7 +455,7 @@ public class SendWeixinRequestTools {
for (int i = 0; i < keywords.size(); i++) {
BookClockKeywordDTO bookClockKeywordDTO = keywords.get(i);
String keyword = "关键词【" + bookClockKeywordDTO.getKeyword() + "】\n" + " " + bookClockKeywordDTO.getGuide();
if (content.length() + keyword.length() > 300) {
if (content.length() + keyword.length() > 1000) {
sendTextMessageVO.setContent(content);
WxGroupSDK.sendTextMessage(sendTextMessageVO);
content = keyword;
......
package com.pcloud.book.push.biz.impl;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.pcloud.appcenter.app.dto.AppDto;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.consumer.app.AppConsr;
......@@ -25,9 +24,28 @@ import com.pcloud.book.group.enums.TouchTypeEnum;
import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.push.biz.PushBiz;
import com.pcloud.book.push.check.PushCheck;
import com.pcloud.book.push.dao.*;
import com.pcloud.book.push.dto.*;
import com.pcloud.book.push.entity.*;
import com.pcloud.book.push.dao.MorningEveningNewsDao;
import com.pcloud.book.push.dao.PushDao;
import com.pcloud.book.push.dao.PushGroupDao;
import com.pcloud.book.push.dao.PushGroupRecordDao;
import com.pcloud.book.push.dao.PushItemDao;
import com.pcloud.book.push.dao.PushNewsRecordDao;
import com.pcloud.book.push.dao.PushPlanDao;
import com.pcloud.book.push.dao.PushRecordDao;
import com.pcloud.book.push.dto.PlanClassifyDTO;
import com.pcloud.book.push.dto.PushDTO;
import com.pcloud.book.push.dto.PushGroupDTO;
import com.pcloud.book.push.dto.PushPlanDTO;
import com.pcloud.book.push.dto.PushPlanItemDTO;
import com.pcloud.book.push.dto.PushRecordDTO;
import com.pcloud.book.push.entity.MorningEveningNews;
import com.pcloud.book.push.entity.Push;
import com.pcloud.book.push.entity.PushGroup;
import com.pcloud.book.push.entity.PushGroupRecord;
import com.pcloud.book.push.entity.PushItem;
import com.pcloud.book.push.entity.PushNewsRecord;
import com.pcloud.book.push.entity.PushPlan;
import com.pcloud.book.push.entity.PushRecord;
import com.pcloud.book.push.enums.ItemTypeEnum;
import com.pcloud.book.push.enums.PushStatusEnum;
import com.pcloud.book.push.enums.PushTypeEnum;
......@@ -48,14 +66,21 @@ import com.sdk.wxgroup.SendArticleMessageVO;
import com.sdk.wxgroup.SendPicMessageVO;
import com.sdk.wxgroup.SendTextMessageVO;
import com.sdk.wxgroup.WxGroupSDK;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.concurrent.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
/**
......@@ -969,7 +994,7 @@ public class PushBizImpl implements PushBiz {
int i = 1;
for (ESNews esNews : esNewsList) {
String contentL = content + i + "." + esNews.getTitle() + esNews.getShortUrl() + "\n";
if (contentL.length() >= 300) {
if (contentL.length() >= 1000) {
contents.add(content);
content = i + "." + esNews.getTitle() + esNews.getShortUrl() + "\n";
} else {
......
......@@ -149,7 +149,7 @@
AND
k.is_delete = 0
AND classify_id = #{classifyId}
AND book_group_id = #{bookGroupId} order by bk.rank, bk.id desc limit 40
AND book_group_id = #{bookGroupId} order by bk.rank, bk.id desc
</select>
<select id="getKeywordId" resultType="ReplyKeywordDTO" parameterType="map">
......
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