|
|
@@ -2288,6 +2288,56 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
|
|
|
|
|
|
QwExternalContact contact=qwExternalContact;
|
|
|
QwUser qwUser = qwUserMapper.selectQwUserByCorpIdAndUserId(corpId, userID);
|
|
|
+ // 渠道活码里有欢迎语 有的话 欢迎语优先
|
|
|
+ logger.info("渠道活码的参数---:"+state);
|
|
|
+ if (state != null && state != "") {
|
|
|
+ String s = "way:" + corpId + ":";
|
|
|
+ if (state.contains(s)) {
|
|
|
+ if (welcomeCode != null && welcomeCode != "") {
|
|
|
+ String substring = state.substring(state.indexOf(s) + s.length());
|
|
|
+ QwContactWay qwContactWay = qwContactWayMapper.selectQwContactWayById(Long.parseLong(substring));
|
|
|
+ logger.info("qwContactWay:"+qwContactWay);
|
|
|
+ if (qwContactWay != null) {
|
|
|
+ isWay = true;
|
|
|
+ wayId = qwContactWay;
|
|
|
+ if (qwContactWay.getIsWelcome() != null && qwContactWay.getIsWelcome() == 1) {
|
|
|
+ Boolean isClose = true;
|
|
|
+ if (wayId.getIsSpanWelcome() == 1) {
|
|
|
+ ExternalContact externalContact = externalContactResult.getExternal_contact();
|
|
|
+ String name = externalContact.getName();
|
|
|
+ String closeWelcomeWord = wayId.getCloseWelcomeWord();
|
|
|
+ if (closeWelcomeWord != null && closeWelcomeWord.length() > 0) {
|
|
|
+ List<String> strings = JSON.parseArray(closeWelcomeWord, String.class);
|
|
|
+ for (String string : strings) {
|
|
|
+ if (name.contains(string)) {
|
|
|
+ isClose = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (qwContactWay.getIsSpanWelcome() == 1 && isClose) {
|
|
|
+ isSend = qwContactWayService.sendWelcomeMsg(qwContactWay, corpId, welcomeCode,qwUser,contact.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (qwContactWay.getUserType() == 1 && qwContactWay.getIsUserLimit() == 1) {
|
|
|
+ QwContactWayUser qwContactWayUser = qwContactWayUserMapper.selectQwContactWayUserByUserIdAndCompanyId(userID, corpId);
|
|
|
+ if (qwContactWayUser != null) {
|
|
|
+ qwContactWayUser.setDayCount(qwContactWayUser.getDayCount() - 1);
|
|
|
+ qwContactWayUserMapper.updateQwContactWayUser(qwContactWayUser);
|
|
|
+ if (qwContactWayUser.getDayCount() <= 0) {
|
|
|
+ //超过限制
|
|
|
+ qwContactWayService.updateQwContactWayBYLimit(qwContactWayUser.getWayId());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ // 欢迎语优先
|
|
|
log.error("欢迎语====>isSend:{},welcomeCode:{}",isSend,welcomeCode);
|
|
|
if (isSend && welcomeCode != null && welcomeCode != "") {
|
|
|
if (qwUser != null) {
|
|
|
@@ -2386,57 +2436,10 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- logger.info("渠道活码的参数---:"+state);
|
|
|
-
|
|
|
+ // 这里获客链接 没有欢迎语,延后
|
|
|
if (state != null && state != "") {
|
|
|
- String s = "way:" + corpId + ":";
|
|
|
String userPhone = "up:";
|
|
|
String linkState = "link:";
|
|
|
- if (state.contains(s)) {
|
|
|
- if (welcomeCode != null && welcomeCode != "") {
|
|
|
- String substring = state.substring(state.indexOf(s) + s.length());
|
|
|
- QwContactWay qwContactWay = qwContactWayMapper.selectQwContactWayById(Long.parseLong(substring));
|
|
|
- logger.info("qwContactWay:"+qwContactWay);
|
|
|
- if (qwContactWay != null) {
|
|
|
- isWay = true;
|
|
|
- wayId = qwContactWay;
|
|
|
- if (qwContactWay.getIsWelcome() != null && qwContactWay.getIsWelcome() == 1) {
|
|
|
- Boolean isClose = true;
|
|
|
- if (wayId.getIsSpanWelcome() == 1) {
|
|
|
- ExternalContact externalContact = externalContactResult.getExternal_contact();
|
|
|
- String name = externalContact.getName();
|
|
|
- String closeWelcomeWord = wayId.getCloseWelcomeWord();
|
|
|
- if (closeWelcomeWord != null && closeWelcomeWord.length() > 0) {
|
|
|
- List<String> strings = JSON.parseArray(closeWelcomeWord, String.class);
|
|
|
- for (String string : strings) {
|
|
|
- if (name.contains(string)) {
|
|
|
- isClose = false;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (qwContactWay.getIsSpanWelcome() == 1 && isClose) {
|
|
|
- isSend = qwContactWayService.sendWelcomeMsg(qwContactWay, corpId, welcomeCode,qwUser,contact.getId());
|
|
|
- }
|
|
|
- }
|
|
|
- if (qwContactWay.getUserType() == 1 && qwContactWay.getIsUserLimit() == 1) {
|
|
|
- QwContactWayUser qwContactWayUser = qwContactWayUserMapper.selectQwContactWayUserByUserIdAndCompanyId(userID, corpId);
|
|
|
- if (qwContactWayUser != null) {
|
|
|
- qwContactWayUser.setDayCount(qwContactWayUser.getDayCount() - 1);
|
|
|
- qwContactWayUserMapper.updateQwContactWayUser(qwContactWayUser);
|
|
|
- if (qwContactWayUser.getDayCount() <= 0) {
|
|
|
- //超过限制
|
|
|
- qwContactWayService.updateQwContactWayBYLimit(qwContactWayUser.getWayId());
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
if (state.contains(userPhone)) {
|
|
|
log.error("获客链接添加外部联系人小程序用户手机号");
|
|
|
try {
|
|
|
@@ -2549,8 +2552,6 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
|
|
|
|
|
|
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
ExternalContact externalContact = externalContactResult.getExternal_contact();
|