|
@@ -333,6 +333,25 @@ public class MarketingCampaignServiceImpl
|
|
|
// 达成率 = openCountLong / emailCount
|
|
// 达成率 = openCountLong / emailCount
|
|
|
stats.setAchievementRate(sentCount > 0 ? Math.round(sentCount * 100f / emailCount) : 0);
|
|
stats.setAchievementRate(sentCount > 0 ? Math.round(sentCount * 100f / emailCount) : 0);
|
|
|
|
|
|
|
|
|
|
+ // 已打开邮件的客户数(distinct customer_id where hasReader=1)
|
|
|
|
|
+ List<MarketEmailsEntity> openedEmailList = marketEmailsService.lambdaQuery()
|
|
|
|
|
+ .eq(MarketEmailsEntity::getMarketingCampaignId, id)
|
|
|
|
|
+ .eq(MarketEmailsEntity::getIsDelete, CommonConstant.DEL_FLAG_0)
|
|
|
|
|
+ .eq(MarketEmailsEntity::getHasReader, 1)
|
|
|
|
|
+ .isNotNull(MarketEmailsEntity::getCustomerId)
|
|
|
|
|
+ .select(MarketEmailsEntity::getCustomerId)
|
|
|
|
|
+ .list();
|
|
|
|
|
+ int openCustomerCount = (int) openedEmailList.stream()
|
|
|
|
|
+ .map(MarketEmailsEntity::getCustomerId)
|
|
|
|
|
+ .filter(java.util.Objects::nonNull)
|
|
|
|
|
+ .distinct()
|
|
|
|
|
+ .count();
|
|
|
|
|
+ stats.setOpenCustomerCount(openCustomerCount);
|
|
|
|
|
+ // 未打开邮件的客户数 = 总客户数(customer_base) - 已打开邮件的客户数
|
|
|
|
|
+ int totalCustomerCount = customerIdList.size();
|
|
|
|
|
+ int notOpenCustomerCount = Math.max(0, totalCustomerCount - openCustomerCount);
|
|
|
|
|
+ stats.setNotOpenCustomerCount(notOpenCustomerCount);
|
|
|
|
|
+
|
|
|
detailVO.setStats(stats);
|
|
detailVO.setStats(stats);
|
|
|
|
|
|
|
|
return Result.result(detailVO);
|
|
return Result.result(detailVO);
|