Commit 907a6790 by 阮思源

Merge branch 'master' of http://begitlab.chubanyun.me/rays/pcloud-book into feat-1001733

parents 9559320d 7add7d77
......@@ -760,18 +760,22 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
* @return
*/
private List<String> getLinkList(String title, Boolean isNew) {
//标题正则表达式
Pattern pa;
List<String> list = new ArrayList<>();
if (isNew) {
title = title.replaceAll("&nbsp;"," ");
pa = Pattern.compile(UrlConstant.OWN_SHORT_URL + "[0-9A-Za-z]+\\s");
String regex = "(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]";
Matcher matcher = Pattern.compile(regex, Pattern.DOTALL).matcher(title);
while (matcher.find()) {
String url = matcher.group();
if (url.startsWith(UrlConstant.OWN_SHORT_URL)) {
list.add(matcher.group());
}
}
} else {
pa = Pattern.compile("<link>.*?</link>");
}
List<String> list = new ArrayList<>();
Matcher ma = pa.matcher(title);
while (ma.find()) {
list.add(ma.group());
Pattern pa = Pattern.compile("<link>.*?</link>");
Matcher ma = pa.matcher(title);
while (ma.find()) {
list.add(ma.group());
}
}
return list;
}
......@@ -3195,27 +3199,38 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
@Override
public void dealOldCPAContent() {
List<AdvertisingSpace> spaceList = advertisingSpaceDao.getCPASpaceList();
if (ListUtils.isEmpty(spaceList)) {
return;
}
for (AdvertisingSpace space : spaceList) {
Long adId = space.getId();
AdvertisingCpa cpa = new AdvertisingCpa();
cpa.setDetailMode(space.getAdDetailMode());
cpa.setDetailName(space.getAdName());
cpa.setCoverPic(space.getAdDetailCoverPic());
cpa.setWelfarePic(space.getAdDetailWelfarePic());
cpa.setDetailInfo(space.getAdDetailInfo());
cpa.setFormMobileCheck(space.getAdFormMobileCheck());
cpa.setFormRemark(space.getAdFormRemark());
cpa.setFormButton(space.getAdFormButton());
cpa.setFormLink(space.getAdFormLink());
advertisingCpaDao.insert(cpa);
Long cpaId = cpa.getId();
//更新到广告位、报名信息、广告详情
advertisingSpaceDao.updateCPAId(adId, cpaId);
bmOptionDao.updateCPAId(adId, cpaId);
detailFileDao.updateCPAId(adId, cpaId);
if (!ListUtils.isEmpty(spaceList)) {
for (AdvertisingSpace space : spaceList) {
Long adId = space.getId();
AdvertisingCpa cpa = new AdvertisingCpa();
cpa.setDetailMode(space.getAdDetailMode());
cpa.setDetailName(space.getAdName());
cpa.setCoverPic(space.getAdDetailCoverPic());
cpa.setWelfarePic(space.getAdDetailWelfarePic());
cpa.setDetailInfo(space.getAdDetailInfo());
cpa.setFormMobileCheck(space.getAdFormMobileCheck());
cpa.setFormRemark(space.getAdFormRemark());
cpa.setFormButton(space.getAdFormButton());
cpa.setFormLink(space.getAdFormLink());
advertisingCpaDao.insert(cpa);
Long cpaId = cpa.getId();
//更新到广告位、报名信息、广告详情
advertisingSpaceDao.updateCPAId(adId, cpaId);
bmOptionDao.updateCPAId(adId, cpaId);
detailFileDao.updateCPAId(adId, cpaId);
}
}
List<Long> linkCpaIds = advertisingCpaDao.getNoPreviewLinkCPAList();
if (!ListUtils.isEmpty(linkCpaIds)) {
for (Long cpaId : linkCpaIds) {
//预览链接
String previewLink = wechatGroupLinkPrefix + "/ad?cpa_id=" + cpaId;
previewLink = UrlUtils.getShortUrl4Own(wechatGroupLinkPrefix + "/link?url=" + URLEncoder.encode(previewLink));
AdvertisingCpa cpaUpdate = new AdvertisingCpa();
cpaUpdate.setId(cpaId);
cpaUpdate.setPreviewLink(previewLink);
advertisingCpaDao.update(cpaUpdate);
}
}
}
......
......@@ -3,6 +3,8 @@ package com.pcloud.book.advertising.dao;
import com.pcloud.book.advertising.entity.AdvertisingCpa;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* @描述:cpa内容
* @作者:zhuyajie
......@@ -10,4 +12,9 @@ import com.pcloud.common.core.dao.BaseDao;
* @版本:1.0
*/
public interface AdvertisingCpaDao extends BaseDao<AdvertisingCpa> {
/**
* 要更新预览链接的cpa
* @return
*/
List<Long> getNoPreviewLinkCPAList();
}
......@@ -6,6 +6,8 @@ import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @描述:cpa内容
* @作者:zhuyajie
......@@ -14,4 +16,8 @@ import org.springframework.stereotype.Component;
*/
@Component("advertisingCpaDao")
public class AdvertisingCpaDaoImpl extends BaseDaoImpl<AdvertisingCpa> implements AdvertisingCpaDao {
@Override
public List<Long> getNoPreviewLinkCPAList() {
return getSessionTemplate().selectList(getStatement("getNoPreviewLinkCPAList"));
}
}
......@@ -1450,14 +1450,18 @@ public class BookBizImpl implements BookBiz {
// 书籍总数缓存加1
bookCache.incrObject(BookConstant.BOOK_CACHE + "PLATFORM_BOOK_COUNT");
} else {
checkIsUpdateCoverImgAndSendTopic(bookDto, book.getCoverImg());
checkIsUpdateBookNameAndSendTopic(bookDto, book.getBookName());
// 修改图书基本信息
bookDao.updateByAdviser(book);
// 周任务书刊埋点
mainLineConsr.sendAddBookTask(bookDto.getBookId(), book.getCreatedUser());
// 清除redis中数据
bookCache.clearRedisByBook(book.getBookId(), book.getIsbn(), book.getSerialNumber());
// 主编辑才能修改书刊信息
Long mainAdviserId = bookAdviserBiz.getMainAdviserId(book.getBookId(), book.getChannelId());
if (book.getCreatedUser().equals(mainAdviserId)) {
checkIsUpdateCoverImgAndSendTopic(bookDto, book.getCoverImg());
checkIsUpdateBookNameAndSendTopic(bookDto, book.getBookName());
// 修改图书基本信息
bookDao.updateByAdviser(book);
// 周任务书刊埋点
mainLineConsr.sendAddBookTask(bookDto.getBookId(), book.getCreatedUser());
// 清除redis中数据
bookCache.clearRedisByBook(book.getBookId(), book.getIsbn(), book.getSerialNumber());
}
}
bookDto = bookDao.getByIsbnAndSnum(book.getIsbn(), book.getSerialNumber());
bookDto.setChannelId(book.getChannelId());
......
......@@ -312,14 +312,6 @@ public class SendWeixinRequestTools {
WxGroupSDK.sendTextMessage(sendTextMessageVO);
}
public static void main(String[] args) {
// SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
// sendTextMessageVO.setContent("关键词1:a" + "\n" + "换行换行换行" + "\n");
// sendTextMessageVO.setAltId("wxid_qj200bf0key022");
// sendTextMessageVO.setWxGroupId("14108963419@chatroom");
// WxGroupSDK.sendTextMessage(sendTextMessageVO);
}
/**
* 发送默认欢迎语
*/
......@@ -355,7 +347,7 @@ public class SendWeixinRequestTools {
isOld = false;
sb.append("\n\n本群配有以下资源服务,戳链接立即获取:\n");
for (KeywordDTO keyword : keywords) {
if (sb.length() + (keyword.getKeywords() + "\n").length() >= 830) {
if (sb.length() + (keyword.getKeywords() + "\n").length() >= 730) {
break;
}
sb.append("【").append(keyword.getKeywords()).append("】\n");
......@@ -367,7 +359,7 @@ public class SendWeixinRequestTools {
} else {
sb.append("\n\n在群内回复以下关键词,领取任务或资源:\n");
for (KeywordDTO keyword : keywords) {
if ((content.length() + sb.length()) >= 1000 && (sb.length() + (keyword.getKeywords() + "\n").length()) >= 922) {
if ((content.length() + sb.length()) >= 1000 && (sb.length() + (keyword.getKeywords() + "\n").length()) >= 892) {
break;
}
sb.append("【").append(keyword.getKeywords()).append("】");
......@@ -379,6 +371,12 @@ public class SendWeixinRequestTools {
if (haveKeyword && !isOld) {
groupKeyword.append("后续也可以回复【】里的关键词,再次领取");
}
// 拼接反馈链接
AccountSettingDto accountSettingDto = dto.getAccountSettingDto();
String feedbackUrl = "*common/C"+classifyQrcodeInfo.getChannelId()+"/A0/feedback/suggest?groupQrcodeId=" + classifyQrcodeInfo.getGroupQrcodeId();
String url = splitUrl(accountSettingDto, feedbackUrl);
LOGGER.info("发送欢迎语反馈链接feedbackUrl:{}, url:{}", feedbackUrl, url);
groupKeyword.append("\n\n群资源与书上介绍不符?点这里反馈\n->").append(UrlUtils.getShortUrl4Own(url));
// 1001692 自定义欢迎语+关键词文案,如果超过300字,关键词拆分出来发
if ((content.length() + sb.length()) >= 1000) {
sendTextMessage(content.toString(), robotId, weixinGroupId, ip);
......@@ -388,6 +386,7 @@ public class SendWeixinRequestTools {
}
}
@ParamLog("发送欢迎语消息")
public static void sendGuideMessage(SendGuideMessageDTO dto) {
if (Objects.isNull(dto) || CollectionUtils.isEmpty(dto.getReplyMessages())) {
......@@ -424,7 +423,7 @@ public class SendWeixinRequestTools {
isOld = false;
sb.append("\n\n本群配有以下资源服务,戳链接立即获取:\n");
for (KeywordDTO keyword : keywords) {
if (sb.length() + (keyword.getKeywords() + "\n").length() >= 850) {
if (sb.length() + (keyword.getKeywords() + "\n").length() >= 730) {
break;
}
sb.append("【").append(keyword.getKeywords()).append("】\n");
......@@ -436,7 +435,7 @@ public class SendWeixinRequestTools {
} else {
sb.append("\n\n在群内回复以下关键词,领取任务或资源:\n");
for (KeywordDTO keyword : keywords) {
if ((s.length() + sb.length()) >= 1000 && (sb.length() + (keyword.getKeywords() + "\n").length()) >= 922) {
if ((s.length() + sb.length()) >= 1000 && (sb.length() + (keyword.getKeywords() + "\n").length()) >= 892) {
break;
}
sb.append("【").append(keyword.getKeywords()).append("】");
......@@ -447,6 +446,12 @@ public class SendWeixinRequestTools {
if (haveKeyword && !isOld) {
groupKeyword.append("后续也可以回复【】里的关键词,再次领取");
}
// 拼接反馈链接
AccountSettingDto accountSettingDto = dto.getAccountSettingDto();
String feedbackUrl = "*common/C"+classifyQrcodeInfo.getChannelId()+"/A0/feedback/suggest?groupQrcodeId=" + classifyQrcodeInfo.getGroupQrcodeId();
String url = splitUrl(accountSettingDto, feedbackUrl);
LOGGER.info("发送欢迎语反馈链接feedbackUrl:{}, url:{}", feedbackUrl, url);
groupKeyword.append("\n\n群资源与书上介绍不符?点这里反馈\n->").append(UrlUtils.getShortUrl4Own(url));
// 1001692 自定义欢迎语+关键词文案,如果超过300字,关键词拆分出来发
if (s.length() + groupKeyword.length() >= 1000) {
sendMessageDTO.setContent(s);
......
......@@ -115,4 +115,14 @@
update_time DESC
</select>
<select id="getNoPreviewLinkCPAList" resultType="long">
SELECT
id
FROM
advertising_cpa
WHERE
preview_link IS NULL
AND detail_mode IS NOT NULL
</select>
</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