Commit 25a35cd6 by 王祖波

互动记录多商品类型

parent 6fc22b45
......@@ -16,6 +16,7 @@ import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordBO;
import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordExtendInfoBO;
import com.gic.haoban.manage.service.pojo.bo.content.PotentialCustomerBO;
import com.gic.haoban.manage.service.pojo.bo.content.context.InteractRecordMessageContext;
import com.gic.haoban.manage.service.pojo.bo.content.message.InteractRecordMessageBO;
import com.gic.store.goods.dto.goods.GoodsInfoSimpleDTO;
import com.gic.store.goods.dto.goods.GoodsSpuInfoDTO;
import com.gic.store.goods.service.GoodsInfoOutApiService;
......@@ -284,6 +285,22 @@ public class InteractRecordBuilder {
return map;
}
public Integer getGoodsCount(InteractRecordMessageBO interactRecordMessageBO, Map<String, List<List<String>>> multipleMap) {
Integer goodsCount = 1;
if (StringUtils.isBlank(interactRecordMessageBO.getWxaLinkId())) {
return goodsCount;
}
if (MapUtil.isEmpty(multipleMap)) {
return goodsCount;
}
List<List<String>> groupGoodsIds = multipleMap.get(interactRecordMessageBO.getWxaLinkId());
if (CollectionUtils.isNotEmpty(groupGoodsIds)) {
goodsCount = groupGoodsIds.stream().mapToInt(List::size).sum();
log.info("多商品分享页面goodsCount:{}", goodsCount);
}
return goodsCount;
}
public Map<String,InteractRecordExtendInfoBO> buildGroupGoodsByWxaLinkId(String enterpriseId,List<String> wxaLinkIds) {
Map<String, InteractRecordExtendInfoBO> extendInfoBOMap = new HashMap<>();
Map<String, List<List<String>>> map = getGroupGoodsIdByWxaLinkIds(wxaLinkIds);
......
......@@ -57,26 +57,21 @@ public class InteractRecordMessageService {
*/
public void dealRecord(InteractRecordMessageBO interactRecordMessageBO) {
log.info("【dealRecord】处理埋点事件 >> {}", JSON.toJSONString(interactRecordMessageBO));
InteractRecordMessageContext context = InteractRecordMessageContext.create(interactRecordMessageBO);
// 参数是否完整
// 根据businessId clerkId memberId materialId 构建唯一标识key
String recordKey = context.buildRecordKey();
RedisUtil.lock(recordKey, 3L, TimeUnit.SECONDS, 2L);
// 查询多商品页面数据
Map<String, List<List<String>>> multipleMap = null;
if (StringUtils.isNotBlank(interactRecordMessageBO.getWxaLinkId())) {
multipleMap = interactRecordBuilder.getGroupGoodsIdByWxaLinkIds(Lists.newArrayList(interactRecordMessageBO.getWxaLinkId()));
if (MapUtil.isNotEmpty(multipleMap)) {
List<List<String>> groupGoodsIds = multipleMap.get(interactRecordMessageBO.getWxaLinkId());
if (CollectionUtils.isNotEmpty(groupGoodsIds)) {
Integer goodsCount = groupGoodsIds.stream().mapToInt(List::size).sum();
log.info("多商品分享页面goodsCount:{}", goodsCount);
interactRecordMessageBO.setGoodsCount(goodsCount);
}
}
Integer goodsCount = interactRecordBuilder.getGoodsCount(interactRecordMessageBO, multipleMap);
interactRecordMessageBO.setGoodsCount(goodsCount);
}
InteractRecordMessageContext context = InteractRecordMessageContext.create(interactRecordMessageBO);
// 参数是否完整
// 根据businessId clerkId memberId materialId 构建唯一标识key
String recordKey = context.buildRecordKey();
RedisUtil.lock(recordKey, 3L, TimeUnit.SECONDS, 2L);
// 根据key 查询是否存在记录
InteractRecordBO interactRecordBO = null;
if (MaterialInteractRecordEventType.ORDER.getCode().equals(interactRecordMessageBO.getEventType())) {
......
......@@ -251,6 +251,7 @@
<dubbo:reference interface="com.gic.content.api.service.ContentMaterialApiService" id="contentMaterialApiService" timeout="10000" retries="0" check="false" />
<dubbo:reference interface="com.gic.content.api.service.ContentSettingApiService" id="contentSettingApiService" timeout="10000" retries="0" check="false" />
<dubbo:reference interface="com.gic.content.api.service.ContentMemberBuryPointApiService" id="contentMemberBuryPointApiService" timeout="10000" retries="0" check="false" />
<dubbo:reference interface="com.gic.content.api.service.analysis.GoodsAnalysisMemberBuryPointApiService" id="goodsAnalysisMemberBuryPointApiService" timeout="10000" retries="0" check="false" />
<dubbo:reference interface="com.gic.clerk.api.service.MenuApiService" id="menuApiService" timeout="10000" retries="0" check="false" />
<dubbo:reference interface="com.gic.member.ext.api.service.MemberGrowthWriteApiService" id="memberGrowthWriteApiService" timeout="10000" retries="0" check="false" />
<dubbo:reference interface="com.gic.member.api.service.integral.IntegralWriteApiService" id="integralWriteApiService" timeout="10000" retries="0" check="false"/>
......
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