|
|
@@ -1,15 +1,16 @@
|
|
|
package com.fs.qw.service.impl;
|
|
|
|
|
|
+import java.util.Collections;
|
|
|
import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
import java.util.Set;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.core.redis.RedisCache;
|
|
|
import com.fs.common.exception.CustomException;
|
|
|
import com.fs.common.service.ISmsService;
|
|
|
+import com.fs.common.utils.DateUtils;
|
|
|
import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.company.domain.CompanySmsTemp;
|
|
|
import com.fs.company.service.ICompanySmsTempService;
|
|
|
@@ -87,7 +88,16 @@ public class QwAcquisitionLinkInfoServiceImpl implements IQwAcquisitionLinkInfoS
|
|
|
@Override
|
|
|
public List<QwAcquisitionLinkInfo> selectQwAcquisitionLinkInfoList(QwAcquisitionLinkInfo qwAcquisitionLinkInfo)
|
|
|
{
|
|
|
- return qwAcquisitionLinkInfoMapper.selectQwAcquisitionLinkInfoList(qwAcquisitionLinkInfo);
|
|
|
+ List<QwAcquisitionLinkInfo> resultList = qwAcquisitionLinkInfoMapper.selectQwAcquisitionLinkInfoList(qwAcquisitionLinkInfo);
|
|
|
+ if (CollectionUtils.isEmpty(resultList)){
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+ for (QwAcquisitionLinkInfo item : resultList) {
|
|
|
+ if (item.getPhone() != null) {
|
|
|
+ item.setPhone(item.getPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return resultList;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -111,6 +121,7 @@ public class QwAcquisitionLinkInfoServiceImpl implements IQwAcquisitionLinkInfoS
|
|
|
@Override
|
|
|
public int updateQwAcquisitionLinkInfo(QwAcquisitionLinkInfo qwAcquisitionLinkInfo)
|
|
|
{
|
|
|
+ //TODO 如果放开编辑就需要更新缓存
|
|
|
return qwAcquisitionLinkInfoMapper.updateQwAcquisitionLinkInfo(qwAcquisitionLinkInfo);
|
|
|
}
|
|
|
|
|
|
@@ -204,7 +215,7 @@ public class QwAcquisitionLinkInfoServiceImpl implements IQwAcquisitionLinkInfoS
|
|
|
if (r != null && "200".equals(String.valueOf(r.get("code")))) {
|
|
|
|
|
|
//新增号码-链接生成记录
|
|
|
- addAcquisitionLinkInfo(acquisitionAssistant.getId(), phone, acquisitionAssistant.getUrl(),randomStr);
|
|
|
+ addAcquisitionLinkInfo(acquisitionAssistant.getId(), phone, acquisitionAssistant.getUrl(),randomStr,sendMsgLogBo.getCompanyUserId());
|
|
|
|
|
|
return new SendResultDetailDTO(true, null, null);
|
|
|
} else {
|
|
|
@@ -220,7 +231,6 @@ public class QwAcquisitionLinkInfoServiceImpl implements IQwAcquisitionLinkInfoS
|
|
|
|
|
|
@Override
|
|
|
public String selectQwAcquisitionUrlByRandomStr(String randomStr) {
|
|
|
- log.error("-------------------------------------进入selectQwAcquisitionUrlByRandomStr-----------------------------------");
|
|
|
String key = QW_FRIEND_LINK_URL_KEY + randomStr;
|
|
|
String fullLink = null;
|
|
|
|
|
|
@@ -249,8 +259,8 @@ public class QwAcquisitionLinkInfoServiceImpl implements IQwAcquisitionLinkInfoS
|
|
|
log.info("完整获客链接URL不存在,缓存空值10秒, randomStr:{}", randomStr);
|
|
|
return null;
|
|
|
} else {
|
|
|
- // 正常值仍缓存10天
|
|
|
- Integer cacheExpire = 10;
|
|
|
+ // 正常值仍缓存2天
|
|
|
+ Integer cacheExpire = 2;
|
|
|
redisCache.setCacheObject(key, fullLink, cacheExpire, TimeUnit.DAYS);
|
|
|
log.info("完整获客链接URL缓存成功, randomStr:{}", randomStr);
|
|
|
}
|
|
|
@@ -268,7 +278,7 @@ public class QwAcquisitionLinkInfoServiceImpl implements IQwAcquisitionLinkInfoS
|
|
|
try {
|
|
|
//新增号码-链接生成记录
|
|
|
String randomStr = generateUniqueRandomStr();
|
|
|
- int addResult = addAcquisitionLinkInfo(qwAcquisitionAssistantId, phone, qwAcquisitionAssistantUrl, randomStr);
|
|
|
+ int addResult = addAcquisitionLinkInfo(qwAcquisitionAssistantId, phone, qwAcquisitionAssistantUrl, randomStr,batchAddAcquisitionLinkDTO.getCreateBy());
|
|
|
result += addResult;
|
|
|
// 可以在这里根据 addResult 判断单次是否成功,并记录日志
|
|
|
if (addResult > 0) {
|
|
|
@@ -287,10 +297,12 @@ public class QwAcquisitionLinkInfoServiceImpl implements IQwAcquisitionLinkInfoS
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String extractLink(Long qwAcquisitionAssistantId, String originalPhone, String originalLink) {
|
|
|
+ public String extractLink(Long qwAcquisitionAssistantId, String originalPhone, String originalLink,Long createBy) {
|
|
|
String randomStr = generateUniqueRandomStr();
|
|
|
QwAcquisitionLinkInfo qwAcquisitionLinkInfo=new QwAcquisitionLinkInfo();
|
|
|
qwAcquisitionLinkInfo.setQwAcquisitionAssistantId(qwAcquisitionAssistantId);
|
|
|
+ qwAcquisitionLinkInfo.setCreateBy(createBy);
|
|
|
+ qwAcquisitionLinkInfo.setCreateTime(DateUtils.getTime());
|
|
|
qwAcquisitionLinkInfo.setPhone(originalPhone);//这里存储原始手机号
|
|
|
//加密手机号
|
|
|
String phonePlus = encryptPhone(originalPhone);
|
|
|
@@ -301,7 +313,7 @@ public class QwAcquisitionLinkInfoServiceImpl implements IQwAcquisitionLinkInfoS
|
|
|
// ========== 缓存URL,便于后续通过randomStr访问 ==========
|
|
|
try {
|
|
|
String cacheKey = QW_FRIEND_LINK_URL_KEY + randomStr;
|
|
|
- Integer cacheExpire = 10; // 默认缓存10天
|
|
|
+ Integer cacheExpire = 2; // 默认缓存2天
|
|
|
redisCache.setCacheObject(cacheKey, linkPlus, cacheExpire, TimeUnit.DAYS);
|
|
|
log.info("获客链接URL缓存成功, pageParam: {}, url: {}", randomStr, linkPlus);
|
|
|
} catch (Exception e) {
|
|
|
@@ -315,9 +327,11 @@ public class QwAcquisitionLinkInfoServiceImpl implements IQwAcquisitionLinkInfoS
|
|
|
/**
|
|
|
* 添加链接生成记录
|
|
|
* */
|
|
|
- public int addAcquisitionLinkInfo(Long qwAcquisitionAssistantId,String originalPhone,String originalLink,String randomStr){
|
|
|
+ public int addAcquisitionLinkInfo(Long qwAcquisitionAssistantId,String originalPhone,String originalLink,String randomStr,Long createBy){
|
|
|
QwAcquisitionLinkInfo qwAcquisitionLinkInfo=new QwAcquisitionLinkInfo();
|
|
|
qwAcquisitionLinkInfo.setQwAcquisitionAssistantId(qwAcquisitionAssistantId);
|
|
|
+ qwAcquisitionLinkInfo.setCreateBy(createBy);
|
|
|
+ qwAcquisitionLinkInfo.setCreateTime(DateUtils.getTime());
|
|
|
qwAcquisitionLinkInfo.setPhone(originalPhone);//这里存储原始手机号
|
|
|
//加密手机号
|
|
|
String phonePlus = encryptPhone(originalPhone);
|
|
|
@@ -328,7 +342,7 @@ public class QwAcquisitionLinkInfoServiceImpl implements IQwAcquisitionLinkInfoS
|
|
|
// ========== 缓存URL,便于后续通过randomStr访问 ==========
|
|
|
try {
|
|
|
String cacheKey = QW_FRIEND_LINK_URL_KEY + randomStr;
|
|
|
- Integer cacheExpire = 10; // 默认缓存10天
|
|
|
+ Integer cacheExpire = 2; // 默认缓存2天
|
|
|
redisCache.setCacheObject(cacheKey, linkPlus, cacheExpire, TimeUnit.DAYS);
|
|
|
log.info("获客链接URL缓存成功, pageParam: {}, url: {}", randomStr, linkPlus);
|
|
|
} catch (Exception e) {
|