提交 9c9aa953 作者: 沈振路

去重复

上级 0e3325e3
...@@ -136,13 +136,20 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -136,13 +136,20 @@ public class CustomerServiceCommonAsyncComponent {
@Async("myExecutor") @Async("myExecutor")
public void obtainLink(Long materialId, CustomerGraphics customerGraphics, List<ReferralEntity> referralEntityList) { public void obtainLink(Long materialId, CustomerGraphics customerGraphics, List<ReferralEntity> referralEntityList) {
for (ReferralEntity referralEntity : referralEntityList) { // 获取符合人群包条件的用户所属的公众号列表
List<CrowdPackageUserVO> userListFromPackage = conditionMatchService.getUserListFromPackage(customerGraphics.getPackId(), null);
Map<String, List<CrowdPackageUserVO>> storeGroupMap = userListFromPackage.stream().collect(Collectors.groupingBy(CrowdPackageUserVO::getStoreType));
LOCAL_LOG.info("当前包含书城: {} 个", storeGroupMap.size());
// 删除之前设置人群包的时候获取链接生成的数据 // 删除之前设置人群包的时候获取链接生成的数据
referralEntityService.ultimateDeleteReferrals(materialId, "and account_id is not null"); referralEntityService.ultimateDeleteReferrals(materialId, "and account_id is not null");
for (ReferralEntity referralEntity : referralEntityList) {
// 获取链接 // 获取链接
if (CustomerCommonConstant.REPLACE_LINK_NEWS_TYPE_LIST.contains(referralEntity.getNewsType())) { if (CustomerCommonConstant.REPLACE_LINK_NEWS_TYPE_LIST.contains(referralEntity.getNewsType())) {
LOCAL_LOG.info("异步获取图文客服链接"); LOCAL_LOG.info("异步获取图文客服链接");
getAuthListLink(customerGraphics, referralEntity); getAuthListLink(storeGroupMap, customerGraphics, referralEntity);
} else { } else {
LOCAL_LOG.info("newsType: {}, 不需要获取链接", referralEntity.getNewsType()); LOCAL_LOG.info("newsType: {}, 不需要获取链接", referralEntity.getNewsType());
} }
...@@ -164,15 +171,10 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -164,15 +171,10 @@ public class CustomerServiceCommonAsyncComponent {
return userEntityList; return userEntityList;
} }
private void getAuthListLink(CustomerGraphics customerMain, ReferralEntity customerReferral) { private void getAuthListLink(Map<String, List<CrowdPackageUserVO>> storeGroupMap, CustomerGraphics customerMain, ReferralEntity customerReferral) {
Long packId = customerMain.getPackId(); Long packId = customerMain.getPackId();
LOCAL_LOG.info("开始异步处理客服链接, 客服标题: {}, 人群包主键: {}", customerMain.getName(), packId); LOCAL_LOG.info("开始异步处理客服链接, 客服标题: {}, 人群包主键: {}", customerMain.getName(), packId);
// 获取符合人群包条件的用户所属的公众号列表
List<CrowdPackageUserVO> userListFromPackage = conditionMatchService.getUserListFromPackage(packId, null);
Map<String, List<CrowdPackageUserVO>> storeGroupMap = userListFromPackage.stream().collect(Collectors.groupingBy(CrowdPackageUserVO::getStoreType));
LOCAL_LOG.info("当前包含书城: {} 个", storeGroupMap.size());
// 遍历处理书城 // 遍历处理书城
Integer newsType = customerReferral.getNewsType(); Integer newsType = customerReferral.getNewsType();
// 一个书城一个书城地处理 // 一个书城一个书城地处理
...@@ -235,6 +237,7 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -235,6 +237,7 @@ public class CustomerServiceCommonAsyncComponent {
storeGroupMap.forEach((storeType, userVoList) -> { storeGroupMap.forEach((storeType, userVoList) -> {
LOCAL_LOG.info("当前处理书城: {}", storeType); LOCAL_LOG.info("当前处理书城: {}", storeType);
boolean isLegal = true; boolean isLegal = true;
String configId = null;
// 阳光、掌中云 需要获取configId // 阳光、掌中云 需要获取configId
if (storeType.equals(CustomerCommonConstant.STORE_NAME_YANG_GUANG) || storeType.equals(CustomerCommonConstant.STORE_NAME_ZHANG_ZHONG_YUN)) { if (storeType.equals(CustomerCommonConstant.STORE_NAME_YANG_GUANG) || storeType.equals(CustomerCommonConstant.STORE_NAME_ZHANG_ZHONG_YUN)) {
R activityConfig = referralFeignClient.getActivityConfig(customerReferral.getRechargeAmount().stripTrailingZeros().toPlainString(), storeType, null); R activityConfig = referralFeignClient.getActivityConfig(customerReferral.getRechargeAmount().stripTrailingZeros().toPlainString(), storeType, null);
...@@ -247,9 +250,8 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -247,9 +250,8 @@ public class CustomerServiceCommonAsyncComponent {
if (!CollectionUtil.isEmpty(activityConfigList)) { if (!CollectionUtil.isEmpty(activityConfigList)) {
// 转换config // 转换config
Map<String, String> configMap = activityConfigList.stream().collect(Collectors.toMap(key -> key.getLabel().replaceAll("[^(0-9.送)]", ""), CommonOptionResponseVO::getValue, (o1, o2) -> o2)); Map<String, String> configMap = activityConfigList.stream().collect(Collectors.toMap(key -> key.getLabel().replaceAll("[^(0-9.送)]", ""), CommonOptionResponseVO::getValue, (o1, o2) -> o2));
String configId = configMap.get(activityContent); configId = configMap.get(activityContent);
LOCAL_LOG.info("活动内容: {} 获取到configId: {}", activityContent, configId); LOCAL_LOG.info("活动内容: {} 获取到configId: {}", activityContent, configId);
customerReferral.setConfigId(configId);
if (ObjectUtil.isNull(configId)) { if (ObjectUtil.isNull(configId)) {
isLegal = false; isLegal = false;
} }
...@@ -258,6 +260,8 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -258,6 +260,8 @@ public class CustomerServiceCommonAsyncComponent {
LOCAL_LOG.info("无法获取资源配置, 中断当前循环"); LOCAL_LOG.info("无法获取资源配置, 中断当前循环");
} }
} }
customerReferral.setConfigId(configId);
String tempId = CustomerStoreTemplateEnum.getTempId(storeType); String tempId = CustomerStoreTemplateEnum.getTempId(storeType);
customerReferral.setTemplateId(tempId); customerReferral.setTemplateId(tempId);
...@@ -287,6 +291,7 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -287,6 +291,7 @@ public class CustomerServiceCommonAsyncComponent {
} }
// 批量新增 // 批量新增
LOCAL_LOG.info("保存书城: {} 的链接实体, 数量:{}条", storeType, referralEntityList.size());
referralEntityService.saveBatch(referralEntityList); referralEntityService.saveBatch(referralEntityList);
} }
}); });
......
...@@ -39,6 +39,7 @@ public class CustomerCommonConstant { ...@@ -39,6 +39,7 @@ public class CustomerCommonConstant {
public final static String CUSTOMER_TEXT_URL_PLACEHOLDER = "{url}-"; public final static String CUSTOMER_TEXT_URL_PLACEHOLDER = "{url}-";
public final static String CUSTOMER_TEXT_CONTENT_PLACEHOLDER = "{content}"; public final static String CUSTOMER_TEXT_CONTENT_PLACEHOLDER = "{content}";
public final static String H5_STYLE_CODE = " style='color: blue'";
public final static Integer USUAL_LINK_NEWS_TYPE = 3; public final static Integer USUAL_LINK_NEWS_TYPE = 3;
public final static String USUAL_LINK_NEWS_TYPE_NAME = "常用"; public final static String USUAL_LINK_NEWS_TYPE_NAME = "常用";
......
...@@ -140,7 +140,7 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic ...@@ -140,7 +140,7 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic
} }
idx += 1; idx += 1;
} }
customerGraphics.setContent(mainH5Content.toString()); customerGraphics.setContent(mainH5Content.toString().replace(CustomerCommonConstant.H5_STYLE_CODE, ""));
customerGraphics.setReferralSize(replaceLinkTypeNum); customerGraphics.setReferralSize(replaceLinkTypeNum);
detailVO.setContentList(contentList); detailVO.setContentList(contentList);
// 更新连接表 // 更新连接表
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
select select
cg.id, cg.id,
cg.pack_id as packId,
cg.name, cg.name,
cg.type, cg.type,
cg.post_time as postTime, cg.post_time as postTime,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论