Commit b92a5491 by 宋祥

Merge branch 'mymaster' into 'master'

加ip,早晚报的,群发的,修改群名称的,学习报告的,广告位的,群公告的

See merge request rays/pcloud-book!73
parents c8025a4b c3070480
......@@ -313,6 +313,7 @@ public class AdNewsBizImpl implements AdNewsBiz {
sendTextMessageVO.setContent(content);
sendTextMessageVO.setAltId(robotId);
sendTextMessageVO.setGroupId(weixinGroupId);
sendTextMessageVO.setIp(findIp(weixinGroupId));
WxGroupSDK.sendTextMessage(sendTextMessageVO);
LOGGER.info("发送编辑端早晚报" + sendTextMessageVO.toString());
}
......@@ -335,4 +336,11 @@ public class AdNewsBizImpl implements AdNewsBiz {
adNewsGroup.setUpdateUser(partyId);
}
}
@ParamLog("获取ip")
private String findIp(String wechatGroupId) {
Map<String, BookWxQrcodeDTO> groupVersion = weixinQrcodeBiz.getGroupVersion(Collections.singletonList(wechatGroupId));
String ip = Optional.ofNullable(groupVersion.get(wechatGroupId)).orElse(new BookWxQrcodeDTO()).getWechatGroupIp();
return ip;
}
}
......@@ -24,11 +24,13 @@ import com.pcloud.book.consumer.user.AdviserConsr;
import com.pcloud.book.consumer.user.AgentConsr;
import com.pcloud.book.consumer.user.ChannelConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.group.biz.WeixinQrcodeBiz;
import com.pcloud.book.group.dao.BookGroupClassifyDao;
import com.pcloud.book.group.dao.BookGroupDao;
import com.pcloud.book.group.dao.GroupQrcodeDao;
import com.pcloud.book.group.dto.AdGroupQrcodeDTO;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.BookWxQrcodeDTO;
import com.pcloud.book.group.dto.ClassifyDTO;
import com.pcloud.book.group.dto.GroupQrcodeInfoDTO;
import com.pcloud.book.group.entity.BookGroup;
......@@ -165,6 +167,8 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
@Autowired
private AdvertisingBrowseRecordDao advertisingBrowseRecordDao;
@Autowired
private WeixinQrcodeBiz weixinQrcodeBiz;
@Autowired
private AdvertisingDistributionBookDao distributionBookDao;
......@@ -695,6 +699,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
sendTextMessageVO.setGroupId(groupId);
sendTextMessageVO.setAltId(altId);
sendTextMessageVO.setContent(adTitle);
sendTextMessageVO.setIp(findIp(groupId));
LOGGER.info("发送微信消息-文字链接" + sendTextMessageVO.toString());
WxGroupSDK.sendTextMessage(sendTextMessageVO);
} else if (AdPositionModeEnum.NEWS_SHARE.modeCode.equals(advertisingSpace.getAdPositionMode())) {
......@@ -718,6 +723,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
}
sendArticleMessageVO.setLinkUrl(adLink);
sendArticleMessageVO.setPicUrl(advertisingSpace.getAdPic());
sendArticleMessageVO.setIp(findIp(groupId));
LOGGER.info("发送微信消息-图文分享" + sendArticleMessageVO.toString());
WxGroupSDK.sendArticleMessage(sendArticleMessageVO);
} else if (AdPositionModeEnum.JUST_PIC.modeCode.equals(advertisingSpace.getAdPositionMode())) {
......@@ -725,6 +731,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
sendPicMessageVO.setAltId(altId);
sendPicMessageVO.setGroupId(groupId);
sendPicMessageVO.setPicUrl(advertisingSpace.getAdPic());
sendPicMessageVO.setIp(findIp(groupId));
LOGGER.info("发送微信消息-纯图片" + sendPicMessageVO.toString());
WxGroupSDK.sendPicMessage(sendPicMessageVO);
}
......@@ -2982,4 +2989,11 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
advertisingExposureRecordDao.updateExposureByQrcode(qrcodeId, peopleCounts);
}
@ParamLog("获取ip")
private String findIp(String wechatGroupId) {
Map<String, BookWxQrcodeDTO> groupVersion = weixinQrcodeBiz.getGroupVersion(Collections.singletonList(wechatGroupId));
String ip = Optional.ofNullable(groupVersion.get(wechatGroupId)).orElse(new BookWxQrcodeDTO()).getWechatGroupIp();
return ip;
}
}
......@@ -3,9 +3,11 @@ package com.pcloud.book.group.biz.impl;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.group.biz.GroupAnnouncementBiz;
import com.pcloud.book.group.biz.WeixinQrcodeBiz;
import com.pcloud.book.group.dao.GroupAnnouncementDao;
import com.pcloud.book.group.dao.GroupQrcodeDao;
import com.pcloud.book.group.dao.WeixinQrcodeDao;
import com.pcloud.book.group.dto.BookWxQrcodeDTO;
import com.pcloud.book.group.entity.GroupAnnouncement;
import com.pcloud.book.group.entity.WeixinQrcode;
import com.pcloud.common.core.aspect.ParamLog;
......@@ -20,8 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.*;
/**
* @Description
......@@ -41,6 +42,8 @@ public class GroupAnnouncementBizImpl implements GroupAnnouncementBiz {
private WechatGroupConsr wechatGroupConsr;
@Autowired
private WeixinQrcodeDao weixinQrcodeDao;
@Autowired
private WeixinQrcodeBiz weixinQrcodeBiz;
@ParamLog("新增群公告")
@Transactional(rollbackFor = Exception.class)
......@@ -188,6 +191,7 @@ public class GroupAnnouncementBizImpl implements GroupAnnouncementBiz {
continue;
}
modifyNoticeVO.setMasterId(masterId);
modifyNoticeVO.setIp(findIp(wechatGroupId));
//设置群公告
LOGGER.info("设置群公告开始"+modifyNoticeVO.toString());
WxGroupSDK.modifyNotice(modifyNoticeVO);
......@@ -196,4 +200,11 @@ public class GroupAnnouncementBizImpl implements GroupAnnouncementBiz {
}
}
@ParamLog("获取ip")
private String findIp(String wechatGroupId) {
Map<String, BookWxQrcodeDTO> groupVersion = weixinQrcodeBiz.getGroupVersion(Collections.singletonList(wechatGroupId));
String ip = Optional.ofNullable(groupVersion.get(wechatGroupId)).orElse(new BookWxQrcodeDTO()).getWechatGroupIp();
return ip;
}
}
......@@ -284,7 +284,7 @@ public class BookGuideBizImpl implements BookGuideBiz {
//获取关键词信息(改成10个了)
SendWeixinRequestTools.sendKeywordsInfo(keywords, robotId, weixinGroupId);
//如果设置了群学习报告,加一个群学习报告的关键词
pushLearningReport(classifyQrcodeInfo,robotId, weixinGroupId);
pushLearningReport(classifyQrcodeInfo,robotId, weixinGroupId, pushAddUserMessageDTO.getIp());
if (bookGuide != null && bookGuide.getIsRecommend() != null && bookGuide.getIsRecommend() == 1) {
//推送公众号消息
SendWeixinRequestTools.sendAccountMessage(weixinGroupId, bookGuide.getRecommendLanguage(), robotId, wechatInfo);
......@@ -317,9 +317,9 @@ public class BookGuideBizImpl implements BookGuideBiz {
}
@ParamLog("推关学习报告键词消息")
private void pushLearningReport(GroupClassifyQrcodeDTO classifyQrcodeInfo, String robotId, String weixinGroupId) {
private void pushLearningReport(GroupClassifyQrcodeDTO classifyQrcodeInfo, String robotId, String weixinGroupId, String ip) {
if (classifyQrcodeInfo.getHasOpenLearningReport() != null && classifyQrcodeInfo.getHasOpenLearningReport()) {
SendWeixinRequestTools.sendTextMessage("关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值", robotId, weixinGroupId);
SendWeixinRequestTools.sendTextMessage("关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值", robotId, weixinGroupId, ip);
}
}
......
package com.pcloud.book.mq.topic;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.group.biz.WeixinQrcodeBiz;
import com.pcloud.book.group.dao.GroupQrcodeDao;
import com.pcloud.book.group.dto.BookWxQrcodeDTO;
import com.pcloud.book.group.entity.GroupQrcode;
import com.pcloud.book.mq.config.MQTopicConumer;
import com.pcloud.common.core.aspect.ParamLog;
......@@ -17,6 +19,10 @@ import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Collections;
import java.util.Map;
import java.util.Optional;
@Component
@RabbitListener(queues = MQTopicConumer.UPDATE_WXGROUP_NAME)
public class UpdateWXGroupNameListener {
......@@ -27,6 +33,8 @@ public class UpdateWXGroupNameListener {
private GroupQrcodeDao groupQrcodeDao;
@Autowired
private WechatGroupConsr wechatGroupConsr;
@Autowired
private WeixinQrcodeBiz weixinQrcodeBiz;
@ParamLog("接收修改群名称topic")
@RabbitHandler
......@@ -53,6 +61,7 @@ public class UpdateWXGroupNameListener {
changeNameVO.setWxGroupId(wechatGroupId);
String altId = groupNameDTO.getWxId();
changeNameVO.setAltId(altId);
changeNameVO.setIp(groupNameDTO.getIp());
LOGGER.info("修改群名称" + changeNameVO.toString());
WxGroupSDK.changeGroupName(changeNameVO);
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
......@@ -60,10 +69,18 @@ public class UpdateWXGroupNameListener {
sendTextMessageVO.setAltId(altId);
sendTextMessageVO.setGroupId(wechatGroupId);
LOGGER.info("发送警告文本消息"+sendTextMessageVO.toString());
sendTextMessageVO.setIp(findIp(wechatGroupId));
WxGroupSDK.sendTextMessage(sendTextMessageVO);
}
} catch (Exception e) {
LOGGER.error("接收修改群名称失败" + e.getMessage(), e);
}
}
@ParamLog("获取ip")
private String findIp(String wechatGroupId) {
Map<String, BookWxQrcodeDTO> groupVersion = weixinQrcodeBiz.getGroupVersion(Collections.singletonList(wechatGroupId));
String ip = Optional.ofNullable(groupVersion.get(wechatGroupId)).orElse(new BookWxQrcodeDTO()).getWechatGroupIp();
return ip;
}
}
......@@ -107,6 +107,7 @@ public class WXGroupLearningReportListener {
sendTextMessageVO.setGroupId(wechatGroupId);
sendTextMessageVO.setAltId(alt);
sendTextMessageVO.setContent("个人专属学习报告,及群成员元气排行榜。点击获取" + resultUrl);
sendTextMessageVO.setIp(findIp(wechatGroupId));
LOGGER.info("发送文字消息开始"+sendTextMessageVO.toString());
WxGroupSDK.sendTextMessage(sendTextMessageVO);
LOGGER.info("发送文字消息结束"+sendTextMessageVO.toString());
......@@ -114,6 +115,7 @@ public class WXGroupLearningReportListener {
sendPicMessageVO.setPicUrl(imageUrl);
sendPicMessageVO.setGroupId(wechatGroupId);
sendPicMessageVO.setAltId(alt);
sendPicMessageVO.setIp(findIp(wechatGroupId));
LOGGER.info("发送分享图消息开始"+sendTextMessageVO.toString());
WxGroupSDK.sendPicMessage(sendPicMessageVO);
LOGGER.info("发送分享图消息开始"+sendTextMessageVO.toString());
......@@ -122,6 +124,13 @@ public class WXGroupLearningReportListener {
}
}
@ParamLog("获取ip")
private String findIp(String wechatGroupId) {
Map<String, BookWxQrcodeDTO> groupVersion = weixinQrcodeBiz.getGroupVersion(Collections.singletonList(wechatGroupId));
String ip = Optional.ofNullable(groupVersion.get(wechatGroupId)).orElse(new BookWxQrcodeDTO()).getWechatGroupIp();
return ip;
}
@ParamLog("获取图片")
private String getPic(List<LearningScoreDTO> learningScoreDTOS, String qrcodeUrl) {
String list="";
......
......@@ -10,11 +10,13 @@ import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.es.biz.ESNewsBiz;
import com.pcloud.book.es.entity.ESNews;
import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.biz.WeixinQrcodeBiz;
import com.pcloud.book.group.dao.AppTouchRecordDao;
import com.pcloud.book.group.dao.BookGroupClassifyDao;
import com.pcloud.book.group.dao.BookGroupDao;
import com.pcloud.book.group.dao.GroupQrcodeDao;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.BookWxQrcodeDTO;
import com.pcloud.book.group.dto.ClassifyDTO;
import com.pcloud.book.group.dto.GroupClassifyQrcodeDTO;
import com.pcloud.book.group.entity.AppTouchRecord;
......@@ -106,6 +108,8 @@ public class PushBizImpl implements PushBiz {
private PushPlanDao pushPlanDao;
@Autowired
private BookGroupDao bookGroupDao;
@Autowired
private WeixinQrcodeBiz weixinQrcodeBiz;
private static final String PUSH_SCHEDULE_PRE="BOOK_GROUP_PUSH_";
......@@ -320,6 +324,7 @@ public class PushBizImpl implements PushBiz {
sendTextMessageVO.setAltId(altId);
sendTextMessageVO.setContent(pushItem.getTextContent());
sendTextMessageVO.setPushGroupRecordId(pushGroupRecordId);
sendTextMessageVO.setIp(findIp(groupId));
WxGroupSDK.sendTextMessage(sendTextMessageVO);
}
if (ItemTypeEnum.LINK.value.equals(itemType)) {
......@@ -337,6 +342,7 @@ public class PushBizImpl implements PushBiz {
sendArticleMessageVO.setPicUrl(pushItem.getLinkImageUrl());
sendArticleMessageVO.setTitle(pushItem.getLinkTitle());
sendArticleMessageVO.setPushGroupRecordId(pushGroupRecordId);
sendArticleMessageVO.setIp(findIp(groupId));
WxGroupSDK.sendArticleMessage(sendArticleMessageVO);
}
if (ItemTypeEnum.APP.value.equals(itemType)) {
......@@ -361,6 +367,7 @@ public class PushBizImpl implements PushBiz {
sendArticleMessageVO.setPicUrl(appDto.getSquareImg());
sendArticleMessageVO.setTitle(appDto.getTitle());
sendArticleMessageVO.setPushGroupRecordId(pushGroupRecordId);
sendArticleMessageVO.setIp(findIp(groupId));
WxGroupSDK.sendArticleMessage(sendArticleMessageVO);
//新增群发应用作品触发记录
addPushAppTouchRecord(pushItem, groupId, classifyDTO.getId(), classifyDTO.getBookGroupId());
......@@ -382,6 +389,7 @@ public class PushBizImpl implements PushBiz {
sendArticleMessageVO.setPicUrl(productDto.getCoverImg());
sendArticleMessageVO.setTitle(productDto.getProductName());
sendArticleMessageVO.setPushGroupRecordId(pushGroupRecordId);
sendArticleMessageVO.setIp(findIp(groupId));
WxGroupSDK.sendArticleMessage(sendArticleMessageVO);
//新增群发应用作品触发记录
addPushAppTouchRecord(pushItem, groupId, classifyDTO.getId(), classifyDTO.getBookGroupId());
......@@ -394,6 +402,7 @@ public class PushBizImpl implements PushBiz {
sendPicMessageVO.setGroupId(groupId);
sendPicMessageVO.setPicUrl(pushItem.getImageUrl());
sendPicMessageVO.setPushGroupRecordId(pushGroupRecordId);
sendPicMessageVO.setIp(findIp(groupId));
WxGroupSDK.sendPicMessage(sendPicMessageVO);
}
}
......@@ -914,6 +923,7 @@ public class PushBizImpl implements PushBiz {
sendTextMessageVO.setContent(content);
sendTextMessageVO.setAltId(robotId);
sendTextMessageVO.setGroupId(weixinGroupId);
sendTextMessageVO.setIp(findIp(weixinGroupId));
WxGroupSDK.sendTextMessage(sendTextMessageVO);
LOGGER.info("发送早晚报" + sendTextMessageVO.toString());
}
......@@ -1605,4 +1615,11 @@ public class PushBizImpl implements PushBiz {
pushGroup.setPushId(push.getId());
}
}
@ParamLog("获取ip")
private String findIp(String wechatGroupId) {
Map<String, BookWxQrcodeDTO> groupVersion = weixinQrcodeBiz.getGroupVersion(Collections.singletonList(wechatGroupId));
String ip = Optional.ofNullable(groupVersion.get(wechatGroupId)).orElse(new BookWxQrcodeDTO()).getWechatGroupIp();
return ip;
}
}
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