Commit 7ade37dc by 王祖波

销售线索多商品类型判断

parent 64ea9f67
......@@ -16,6 +16,7 @@ import org.springframework.beans.BeanUtils;
import java.util.Date;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Function;
/**
* @Author MUSI
......@@ -52,7 +53,7 @@ public class InteractRecordMessageContext {
&& NumberUtils.isDigits(interactRecordMessageBO.getMaterialId())) {
return ShareBizType.MATERIAL.getCode();
} else if (StringUtils.isNotBlank(interactRecordMessageBO.getWxaLinkId()) &&
Objects.equals(interactRecordMessageBO.getEventCode(), MessageConvertHelper.MULTIPLE_GOODS_EVENT_CODE)) {
interactRecordMessageBO.getGoodsCount() > 1) {
return ShareBizType.MULTIPLE_GOODS.getCode();
}
return ShareBizType.GOODS.getCode();
......
......@@ -138,4 +138,9 @@ public class InteractRecordMessageBO implements Serializable {
* 商品类型 微盟、达摩
*/
private String goodsChannel;
/**
* 商品数量
*/
private Integer goodsCount = 1;
}
......@@ -62,6 +62,21 @@ public class InteractRecordMessageService {
// 根据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);
}
}
}
// 根据key 查询是否存在记录
InteractRecordBO interactRecordBO = null;
if (MaterialInteractRecordEventType.ORDER.getCode().equals(interactRecordMessageBO.getEventType())) {
......@@ -120,7 +135,7 @@ public class InteractRecordMessageService {
}
// 冗余分享的商品组信息
saveGroupGoodsId(interactRecordMessageBO, interactRecordBO);
saveGroupGoodsId(interactRecordMessageBO, interactRecordBO,multipleMap);
// 组装扩展信息
if (MaterialInteractRecordEventType.VISIT_PRODUCT.getCode()
......@@ -193,11 +208,10 @@ public class InteractRecordMessageService {
}
}
private void saveGroupGoodsId(InteractRecordMessageBO interactRecordMessageBO, InteractRecordBO interactRecordBO) {
private void saveGroupGoodsId(InteractRecordMessageBO interactRecordMessageBO, InteractRecordBO interactRecordBO,Map<String, List<List<String>>> map) {
if (interactRecordBO.getExtendInfo() != null && CollectionUtils.isNotEmpty(interactRecordBO.getExtendInfo().getGroupGoodsIds())) {
return;
}
Map<String, List<List<String>>> map = interactRecordBuilder.getGroupGoodsIdByWxaLinkIds(Lists.newArrayList(interactRecordMessageBO.getWxaLinkId()));
if (MapUtil.isEmpty(map)) {
return;
}
......
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