|
@@ -276,8 +276,16 @@ public class MarketingCampaignServiceImpl
|
|
|
|
|
|
|
|
// 4. 计算达成率统计(从 market_emails 表取实际数据)
|
|
// 4. 计算达成率统计(从 market_emails 表取实际数据)
|
|
|
CampaignStatsVO stats = new CampaignStatsVO();
|
|
CampaignStatsVO stats = new CampaignStatsVO();
|
|
|
- Integer sendVolume = campaign.getSendVolume();
|
|
|
|
|
- stats.setSendVolume(sendVolume);
|
|
|
|
|
|
|
+// Integer sendVolume = campaign.getSendVolume();
|
|
|
|
|
+// stats.setSendVolume(sendVolume);
|
|
|
|
|
+
|
|
|
|
|
+ Integer emailCountLong = marketEmailsService.lambdaQuery()
|
|
|
|
|
+ .eq(MarketEmailsEntity::getMarketingCampaignId, id)
|
|
|
|
|
+ .eq(MarketEmailsEntity::getIsDelete, CommonConstant.DEL_FLAG_0)
|
|
|
|
|
+// .eq(MarketEmailsEntity::getStatus, 1)
|
|
|
|
|
+ .count();
|
|
|
|
|
+ Integer emailCount = emailCountLong == null ? 0 : emailCountLong.intValue();
|
|
|
|
|
+ stats.setEmailCount(emailCount);
|
|
|
|
|
|
|
|
Integer sentCountLong = marketEmailsService.lambdaQuery()
|
|
Integer sentCountLong = marketEmailsService.lambdaQuery()
|
|
|
.eq(MarketEmailsEntity::getMarketingCampaignId, id)
|
|
.eq(MarketEmailsEntity::getMarketingCampaignId, id)
|
|
@@ -287,6 +295,8 @@ public class MarketingCampaignServiceImpl
|
|
|
Integer sentCount = sentCountLong == null ? 0 : sentCountLong.intValue();
|
|
Integer sentCount = sentCountLong == null ? 0 : sentCountLong.intValue();
|
|
|
stats.setSentCount(sentCount);
|
|
stats.setSentCount(sentCount);
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
Integer openCountLong = marketEmailsService.lambdaQuery()
|
|
Integer openCountLong = marketEmailsService.lambdaQuery()
|
|
|
.eq(MarketEmailsEntity::getMarketingCampaignId, id)
|
|
.eq(MarketEmailsEntity::getMarketingCampaignId, id)
|
|
|
.eq(MarketEmailsEntity::getIsDelete, CommonConstant.DEL_FLAG_0)
|
|
.eq(MarketEmailsEntity::getIsDelete, CommonConstant.DEL_FLAG_0)
|
|
@@ -307,10 +317,8 @@ public class MarketingCampaignServiceImpl
|
|
|
stats.setOpenRate(sentCount > 0 ? Math.round(openCount * 100f / sentCount) : 0);
|
|
stats.setOpenRate(sentCount > 0 ? Math.round(openCount * 100f / sentCount) : 0);
|
|
|
// 回复率 = replyCount / sentCount
|
|
// 回复率 = replyCount / sentCount
|
|
|
stats.setReplyRate(sentCount > 0 ? Math.round(replyCount * 100f / sentCount) : 0);
|
|
stats.setReplyRate(sentCount > 0 ? Math.round(replyCount * 100f / sentCount) : 0);
|
|
|
- // 达成率 = sentCount / sendVolume
|
|
|
|
|
- stats.setAchievementRate(sendVolume != null && sendVolume > 0
|
|
|
|
|
- ? Math.min(Math.round(sentCount * 100f / sendVolume), 100)
|
|
|
|
|
- : 0);
|
|
|
|
|
|
|
+ // 达成率 = sentCount / emailCount
|
|
|
|
|
+ stats.setAchievementRate(sentCount > 0 ? Math.round(sentCount * 100f / emailCount) : 0);
|
|
|
|
|
|
|
|
detailVO.setStats(stats);
|
|
detailVO.setStats(stats);
|
|
|
|
|
|