Commit f4f8d325 by zhangzhendong

修改开关

parent 32f14a6f
......@@ -18,6 +18,7 @@ import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.message.NoticeMessageHandler;
import com.gic.haoban.manage.service.service.notify.NoticeMessageService;
import com.gic.haoban.manage.service.util.ApolloUtils;
import com.gic.message.center.api.subscribe.model.NoticeMessageForm;
import com.gic.wechat.api.dto.qywx.ItemDTO;
import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO;
......@@ -195,11 +196,15 @@ public class PotentialCustomerNotifyBuilder {
log.info("企业信息不存在 {}", staffClerkRelation.getWxEnterpriseId());
continue;
}
/* 消息中心修改此处
if (!ApolloUtils.useMessageCenter()){
log.info("消息中心-走老版消息通知");
/* 消息中心修改此处*/
QywxXcxSendMessageDTO messageDTO = this.buildApplicationMessage(staffClerkRelation, wxEnterpriseQwDTO,
customerStaticsBOMap.get(staffClerkRelation.getClerkId()).getNum(), context.buildExtendParams(staffClerkRelation.getStoreId(), staffClerkRelation.getClerkId()));
boolean sendMessage = qywxSuiteApiService.sendMessage(wxEnterpriseQwDTO.getThirdCorpid(), wxEnterpriseQwDTO.getSelf3thSecret(), messageDTO,wxEnterpriseQwDTO.isSelf(),wxEnterpriseQwDTO.getUrlHost());
log.info("发送销售线索应用消息结果 {}", sendMessage);*/
log.info("发送销售线索应用消息结果 {}", sendMessage);
} else {
Map<String, String> variableMap = new HashMap<>();
variableMap.put("memberNum", customerStaticsBOMap.get(staffClerkRelation.getClerkId()).getNum().toString());
variableMap.put("page", NoticeMessageUtil.buildMiniAppUrl(NoticeMessageTypeEnum.POTENTIAL_CUSTOMER_NOTIFY, context.buildExtendParams(staffClerkRelation.getStoreId(), staffClerkRelation.getClerkId())));
......@@ -213,6 +218,8 @@ public class PotentialCustomerNotifyBuilder {
.userIdList(Collections.singletonList(staffClerkRelation.getClerkId()))
.variableMap(variableMap).build());
}
}
}
public QywxXcxSendMessageDTO buildApplicationMessage(StaffClerkRelationDTO staffClerkRelation, WxEnterpriseQwDTO wxEnterpriseQwDTO, int count, String extendParams) {
......
......@@ -105,15 +105,21 @@ public class MaterialReportServiceImpl implements MaterialReportService {
materialReportBuilder.buildMaterialReportData(context);
// 保存小程序消息
List<NoticeMessageBO> noticeMessageBos = context.buildNotifyMessageBos();
/*消息中心修改此处
if (CollectionUtils.isNotEmpty(noticeMessageBos)) {
noticeMessageService.addNoticeMessageBatch(noticeMessageBos);
}*/
}
if (StringUtils.isBlank(context.getClerkId())) {
log.info("成员{}在企业{}中不存在主门店, 不推送企微应用消息", staffId, enterpriseId);
return;
}
if (!ApolloUtils.useMessageCenter()){
log.info("消息中心-走老版消息通知");
/*消息中心修改此处*/
if (CollectionUtils.isNotEmpty(noticeMessageBos)) {
noticeMessageService.addNoticeMessageBatch(noticeMessageBos);
}
}
// 发送企微消息
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(staffInfo.getWxEnterpriseId());
QywxNewsSendMessageDTO newsSendMessageDTO = materialReportBuilder.buildQywxNewsMessage(context, qwDTO);
......@@ -123,16 +129,13 @@ public class MaterialReportServiceImpl implements MaterialReportService {
}
log.info("发送企业图文消息参数{}", JSON.toJSONString(newsSendMessageDTO));
/*消息中心修改此处*/
if (!ApolloUtils.useMessageCenter()){
log.info("消息中心-走老版消息通知");
/*消息中心修改此处*/
if (CollectionUtils.isNotEmpty(noticeMessageBos)) {
noticeMessageService.addNoticeMessageBatch(noticeMessageBos);
}
}
boolean result = qywxSuiteApiService.sendMessage(qwDTO.getThirdCorpid(), config.getWxSuiteid(), newsSendMessageDTO);
boolean result = qywxSuiteApiService.sendMessage(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), newsSendMessageDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
log.info("成员{}发送素材企微使用报告结果 {}", staffId, result);
return;
} else {
Map<String, String> variableMap = new HashMap<>();
QywxNewsArticleMessageDTO qywxNewsArticleMessageDTO = newsSendMessageDTO.getArticleMessages().get(0);
variableMap.put("image", qywxNewsArticleMessageDTO.getPicurl());
......@@ -160,8 +163,11 @@ public class MaterialReportServiceImpl implements MaterialReportService {
.uniqueKey(UniqueIdUtils.uniqueLongHex())
.userIdList(context.getClerkId() == null ? new ArrayList<>() : Collections.singletonList(context.getClerkId()))
.variableMap(variableMap).build());
}
boolean result = qywxSuiteApiService.sendMessage(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), newsSendMessageDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
log.info("成员{}发送素材企微使用报告结果 {}", staffId, result);
/*boolean result = qywxSuiteApiService.sendMessage(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), newsSendMessageDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
log.info("成员{}发送素材企微使用报告结果 {}", staffId, result);*/
}
}
......@@ -21,6 +21,7 @@ import com.gic.haoban.manage.service.service.content.InteractRecordService;
import com.gic.haoban.manage.service.service.content.PotentialCustomerService;
import com.gic.haoban.manage.service.service.content.adaptor.InteractRecordMessageBuilder;
import com.gic.haoban.manage.service.service.content.adaptor.PotentialCustomerNotifyBuilder;
import com.gic.haoban.manage.service.util.ApolloUtils;
import com.gic.member.api.dto.es.MemberDataDTO;
import com.gic.member.api.service.MemberOutApiService;
import com.gic.search.engine.api.constant.MemberDataEnum;
......@@ -263,8 +264,13 @@ public class PotentialCustomerServiceImpl implements PotentialCustomerService {
// 区经 忽略
potentialCustomerNotifyBuilder.filterAreaManage(context);
// 构建应用内消息
/*消息中心修改此处
potentialCustomerNotifyBuilder.sendHaoBanNotifyMessage(context);*/
/*消息中心修改此处*/
if (!ApolloUtils.useMessageCenter()){
log.info("消息中心-走老版消息通知");
/*消息中心修改此处*/
potentialCustomerNotifyBuilder.sendHaoBanNotifyMessage(context);
}
// 如果该导购id是成员在主门店时的导购id 发送应用消息
// 如果本批数据中无成员主门店数据 则不发送
potentialCustomerNotifyBuilder.sendApplicationMessage(context);
......
......@@ -26,6 +26,7 @@ import com.gic.haoban.manage.api.util.notify.NoticeMessageUtil;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.service.WxEnterpriseRelatedService;
import com.gic.haoban.manage.service.service.message.NoticeMessageHandler;
import com.gic.haoban.manage.service.util.ApolloUtils;
import com.gic.message.center.api.subscribe.model.NoticeMessageForm;
import com.gic.wechat.api.dto.qywx.QywxTemplateCardSendMessageDTO;
import org.apache.commons.collections.CollectionUtils;
......@@ -102,8 +103,8 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
private NoticeMessageHandler noticeMessageHandler;
/*消息中心修改此处
@Override
public void noticeMessageMq(String json) {
@Override*/
public void noticeMessageMq_old(String json) {
logger.info("通知消息:{}", json);
NoticeMessageQDTO messageQDTO = JSONObject.parseObject(json, NoticeMessageQDTO.class);
NoticeMessageTypeEnum messageTypeEnum = NoticeMessageTypeEnum.getByType(messageQDTO.getMessageType());
......@@ -154,11 +155,16 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
noticeMessageService.addOrCreateNoticeMessage(noticeMessageBO);
//发送企业微信
sendMessage(contentList, wxEnterpriseId, staffId, messageTypeEnum, noticeMessageBO.getMessageContent(),messageQDTO.getTitle());
}*/
}
@Override
public void noticeMessageMq(String json) {
if (!ApolloUtils.useMessageCenter()){
logger.info("消息中心-走老版消息通知");
this.noticeMessageMq_old(json);
return;
}
NoticeMessageQDTO messageQDTO = JSONObject.parseObject(json, NoticeMessageQDTO.class);
logger.info("messageType:{},消息中心测试通知消息:{}", messageQDTO.getMessageType(), json);
String staffId = null;
......@@ -214,12 +220,17 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
@Override
public void noticeMessageBatchMq(String json) {
NotifyMessageBatchQDTO notifyMessageBatchQDTO = JSONObject.parseObject(json, NotifyMessageBatchQDTO.class);
if (!ApolloUtils.useMessageCenter()){
logger.info("消息中心-走老版消息通知");
this.batchSendMessage_old(notifyMessageBatchQDTO);
return;
}
batchSendMessage(notifyMessageBatchQDTO);
}
/*消息中心修改此处
@Override
public ServiceResponse<Void> batchSendMessage(NotifyMessageBatchQDTO notifyMessageBatchQDTO) {
@Override*/
public ServiceResponse<Void> batchSendMessage_old(NotifyMessageBatchQDTO notifyMessageBatchQDTO) {
String enterpriseId = notifyMessageBatchQDTO.getEnterpriseId();
List<String> storeIdList = notifyMessageBatchQDTO.getStoreIdList();
if (CollectionUtils.isEmpty(storeIdList)) {
......@@ -268,7 +279,7 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
}
});
return ServiceResponse.success();
}*/
}
@Override
......
package com.gic.haoban.manage.service.util;
import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.ConfigService;
public class ApolloUtils {
/**
* 旧的调用发送,是否采用新的消息中心开关1:是 0:否
* @return
*/
public static boolean useMessageCenter() {
Config config = ConfigService.getConfig("COMMON.gic-properties");
String messageCenterSwitch = config.getProperty("messageCenterSwitch", "0");
return "1".equals(messageCenterSwitch);
}
}
......@@ -116,8 +116,8 @@ public class GroupMessageServiceTest {
qywxMomentInfoQDTO.setEndTime(1681906519L);
qywxMomentInfoQDTO.setCreatorId("wo59NLDQAAbjSBA575NouC1pUYQgCOtw");
qywxMomentInfoQDTO.setPageSize(20);
ServiceResponse<QywxMomentRespDTO> serviceResponse = qywxSuiteApiService.queryQywxMomentList(qywxMomentInfoQDTO);
System.out.println(JSON.toJSONString(serviceResponse));
//ServiceResponse<QywxMomentRespDTO> serviceResponse = qywxSuiteApiService.queryQywxMomentList(qywxMomentInfoQDTO);
//System.out.println(JSON.toJSONString(serviceResponse));
}
@Test
......
......@@ -124,8 +124,8 @@ public class NotityTest {
articleInfo.setPicurl("https://platform-1251519181.cos.ap-shanghai.myqcloud.com/image/newdmwltest/enterprise_common-e1e8b3d46fdb4486ad545aae6cba67a1.png");
messageDTO.setArticleMessages(Arrays.asList(articleInfo));
boolean b = qywxSuiteApiService.sendMessage(corpid, config.getWxSuiteid(), messageDTO);
System.out.println(b);
/*boolean b = qywxSuiteApiService.sendMessage(corpid, config.getWxSuiteid(), messageDTO);
System.out.println(b);*/
}
@Test
......@@ -138,7 +138,7 @@ public class NotityTest {
search.setSuiteid(config.getWxSuiteid());
search.setChatType("single");
Date date = DateUtils.addDays(new Date(), -1);
ServiceResponse<QywxGroupMsgResp> serviceResponse = qywxSuiteApiService.queryQywxGroupMessageList(search);
//ServiceResponse<QywxGroupMsgResp> serviceResponse = qywxSuiteApiService.queryQywxGroupMessageList(search);
}
......
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