|
|
@@ -131,6 +131,8 @@ public class CorpEventActionServiceImpl implements CorpEventActionService {
|
|
|
|
|
|
private final OrderDonPostService orderDonPostService;
|
|
|
|
|
|
+ private final CorpWelcomeTemplateMapper corpWelcomeTemplateMapper;
|
|
|
+
|
|
|
private static final String DEFAULT_MSG = "您好,欢迎加入银河录像局";
|
|
|
|
|
|
/**
|
|
|
@@ -186,8 +188,8 @@ public class CorpEventActionServiceImpl implements CorpEventActionService {
|
|
|
});
|
|
|
|
|
|
//如果是该客服添加用户,代表通过巨量平台 添加用户.执行广告回传.
|
|
|
- if(userId.equals("yami")){
|
|
|
- THREAD_POOL.execute(()->{
|
|
|
+ if (userId != null && userId.equals("yami")) {
|
|
|
+ THREAD_POOL.execute(() -> {
|
|
|
oceanengineService.monitorAddCorpPost();
|
|
|
});
|
|
|
}
|
|
|
@@ -684,22 +686,16 @@ public class CorpEventActionServiceImpl implements CorpEventActionService {
|
|
|
if (corpUser.getId() == null) {
|
|
|
corpUser.setAcId(acId);
|
|
|
}
|
|
|
- String welcomeContent = corpFollowActiveCode.getText();
|
|
|
- String attachmentsStr = corpFollowActiveCode.getAttachmentsStr();
|
|
|
- //发送对应欢迎语
|
|
|
- if (StrUtil.isNotBlank(welcomeContent) && StrUtil.isNotBlank(attachmentsStr)) {
|
|
|
- THREAD_POOL.execute(() -> {
|
|
|
- sendCorpFollowActiveCode(message, welcomeContent, attachmentsStr);
|
|
|
- });
|
|
|
+ //欢迎语模板id
|
|
|
+ Long msgId = corpFollowActiveCode.getMsgId();
|
|
|
+ sendWelcomeMsg(msgId, message);
|
|
|
+ try {
|
|
|
+ //对客户进行标记
|
|
|
+ markAddUserTag(corpFollowActiveCode.getMarkTag(), message);
|
|
|
+ state = corpFollowActiveCode.getMarkTag();
|
|
|
+ } catch (Exception e) {
|
|
|
}
|
|
|
}
|
|
|
- try {
|
|
|
- //对客户进行标记
|
|
|
- markAddUserTag(corpFollowActiveCode.getMarkTag(), message);
|
|
|
- state = corpFollowActiveCode.getMarkTag();
|
|
|
- } catch (Exception e) {
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -707,7 +703,7 @@ public class CorpEventActionServiceImpl implements CorpEventActionService {
|
|
|
if(StrUtil.isNotBlank(message.getState()) && message.getState().contains(Constant.ACQUISTION_LINK_STATE_KEY)){
|
|
|
String customer = message.getState().replaceAll("customer_", "");
|
|
|
THREAD_POOL.execute(()->{
|
|
|
- saveAcqusitionCallback(customer, corpUser, message.getExternalUserId(), message.getUserId());
|
|
|
+ saveAcqusitionCallback(customer, corpUser, message);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@@ -793,6 +789,17 @@ public class CorpEventActionServiceImpl implements CorpEventActionService {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ //若没找到规则的欢迎语 发送默认欢迎语
|
|
|
+ if (StrUtil.isNotEmpty(message.getWelcomeCode())) {
|
|
|
+ CorpWelcomeTemplate corpWelcomeTemplate = corpWelcomeTemplateMapper.selectOne(Wrappers.lambdaQuery(CorpWelcomeTemplate.class)
|
|
|
+ .eq(CorpWelcomeTemplate::getType, 0)
|
|
|
+ .eq(CorpWelcomeTemplate::getDeleted, 1)
|
|
|
+ .last("limit 1"));
|
|
|
+ if (corpWelcomeTemplate != null) {
|
|
|
+ senCorpWelcomeMsg(message, corpWelcomeTemplate.getText(), corpWelcomeTemplate.getAttachmentsStr());
|
|
|
+ }
|
|
|
+ }
|
|
|
return corpUser;
|
|
|
}
|
|
|
|
|
|
@@ -830,9 +837,9 @@ public class CorpEventActionServiceImpl implements CorpEventActionService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 发送添加活动活码客服 发送欢迎语
|
|
|
+ * 发送欢迎语
|
|
|
*/
|
|
|
- public void sendCorpFollowActiveCode(CorpXmlMessage message, String content, String attachmentsStr) {
|
|
|
+ public void senCorpWelcomeMsg(CorpXmlMessage message, String content, String attachmentsStr) {
|
|
|
try {
|
|
|
String welcomeCode = message.getWelcomeCode();
|
|
|
String followId = message.getUserId();
|
|
|
@@ -980,7 +987,9 @@ public class CorpEventActionServiceImpl implements CorpEventActionService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void saveAcqusitionCallback(String customer, CorpUser corpUser,String externalUserid ,String userId) {
|
|
|
+ private void saveAcqusitionCallback(String customer, CorpUser corpUser,CorpXmlMessage message) {
|
|
|
+ String externalUserid = message.getExternalUserId() ;
|
|
|
+ String userId = message.getUserId();
|
|
|
//获客链接
|
|
|
Long linkId = customerAcquisitionSaveClickId(customer, corpUser.getUnionid());
|
|
|
CorpCustomerAcquisitionLink customerAcquisitionLink = corpCustomerAcquisitionLinkMapper.getByLinkPopularizeId(linkId);
|
|
|
@@ -998,6 +1007,9 @@ public class CorpEventActionServiceImpl implements CorpEventActionService {
|
|
|
wxCorpOps.markTag(externalUserid, userId, tagList.stream().map(CorpTag::getTagId).toArray(String[]::new), null);
|
|
|
}
|
|
|
}
|
|
|
+ //发送欢迎语
|
|
|
+ Long msgId = customerAcquisitionLink.getMsgId();
|
|
|
+ sendWelcomeMsg(msgId, message);
|
|
|
} catch (Exception e) {
|
|
|
log.error("处理获客链接解析标签id出错了,内容{},获客链接id: {}", customerAcquisitionLink.getTags(), customerAcquisitionLink.getId());
|
|
|
}
|
|
|
@@ -1049,4 +1061,28 @@ public class CorpEventActionServiceImpl implements CorpEventActionService {
|
|
|
throw BusinessRuntimeException.getInstance("加粉回传出错. error:" + StringUtil.getErrorText(e));
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 发送欢迎语
|
|
|
+ * @param msgId 模板id
|
|
|
+ * @param message
|
|
|
+ */
|
|
|
+ public void sendWelcomeMsg(Long msgId, CorpXmlMessage message) {
|
|
|
+ if (StrUtil.isEmpty(message.getWelcomeCode())) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ CorpWelcomeTemplate corpWelcomeTemplate = corpWelcomeTemplateMapper.selectById(msgId);
|
|
|
+ if (corpWelcomeTemplate != null) {
|
|
|
+ String welcomeContent = corpWelcomeTemplate.getText();
|
|
|
+ String attachmentsStr = corpWelcomeTemplate.getAttachmentsStr();
|
|
|
+ //发送对应欢迎语
|
|
|
+ if (StrUtil.isNotBlank(welcomeContent) && StrUtil.isNotBlank(attachmentsStr)) {
|
|
|
+ THREAD_POOL.execute(() -> {
|
|
|
+ message.setWelcomeCode(null);
|
|
|
+ senCorpWelcomeMsg(message, welcomeContent, attachmentsStr);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|