|
@ -312,9 +312,18 @@ namespace SiNan.Business |
|
|
var jstCampaignSourceList = popularizeAdSkuSourceList.Where(x => x.BusinessType == 134217728).ToList(); |
|
|
var jstCampaignSourceList = popularizeAdSkuSourceList.Where(x => x.BusinessType == 134217728).ToList(); |
|
|
|
|
|
|
|
|
var allCampaignIdList = popularizeAdSkuSourceList.Select(x => x.CampaignId).Distinct().ToList(); |
|
|
var allCampaignIdList = popularizeAdSkuSourceList.Select(x => x.CampaignId).Distinct().ToList(); |
|
|
|
|
|
|
|
|
var kuaicheCampaignIdList = kuaicheCampaignSourceList.Select(x => x.CampaignId).Distinct().ToList(); |
|
|
var kuaicheCampaignIdList = kuaicheCampaignSourceList.Select(x => x.CampaignId).Distinct().ToList(); |
|
|
var jstCampaignIdList = jstCampaignSourceList.Select(x => x.CampaignId).Distinct().ToList(); |
|
|
var jstCampaignIdList = jstCampaignSourceList.Select(x => x.CampaignId).Distinct().ToList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 查询所有计划名称
|
|
|
|
|
|
var allCampaignNameList = fsql.Select<JDPopularizeCampaign>() |
|
|
|
|
|
.Where(x => x.ShopId == request.ShopId && allCampaignIdList.Contains(x.CampaignId)) |
|
|
|
|
|
.GroupBy(x => new { x.CampaignId, x.CampaignName }) |
|
|
|
|
|
.ToList(g => new { g.Value.CampaignId, g.Value.CampaignName }); |
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 处理所有计划的GOI
|
|
|
#region 处理所有计划的GOI
|
|
|
var recent7DayCampaignGOIList = CalculationCampaignLevelGOI(allCampaignIdList, startDate_Recent7day, endDate_Recent7day); |
|
|
var recent7DayCampaignGOIList = CalculationCampaignLevelGOI(allCampaignIdList, startDate_Recent7day, endDate_Recent7day); |
|
|
var recent30DayCampaignGOIList = CalculationCampaignLevelGOI(allCampaignIdList, startDate_Recent30day, endDate_Recent30day); |
|
|
var recent30DayCampaignGOIList = CalculationCampaignLevelGOI(allCampaignIdList, startDate_Recent30day, endDate_Recent30day); |
|
@ -330,7 +339,8 @@ namespace SiNan.Business |
|
|
CampaignId = campaignId.Value, |
|
|
CampaignId = campaignId.Value, |
|
|
BusinessType = 2, |
|
|
BusinessType = 2, |
|
|
CampaignGOI_Recent7Day = recent7DayCampaignGOIList.FirstOrDefault(x => x.LevelId == campaignId), |
|
|
CampaignGOI_Recent7Day = recent7DayCampaignGOIList.FirstOrDefault(x => x.LevelId == campaignId), |
|
|
CampaignGOI_Recent30Day = recent30DayCampaignGOIList.FirstOrDefault(x => x.LevelId == campaignId) |
|
|
CampaignGOI_Recent30Day = recent30DayCampaignGOIList.FirstOrDefault(x => x.LevelId == campaignId), |
|
|
|
|
|
CampaignName = allCampaignNameList.FirstOrDefault(x => x.CampaignId == campaignId)?.CampaignName |
|
|
}; |
|
|
}; |
|
|
list.Add(campaign); |
|
|
list.Add(campaign); |
|
|
} |
|
|
} |
|
@ -347,6 +357,11 @@ namespace SiNan.Business |
|
|
var adGroupIdList = adGroupStatisticsList.Select(x => x.Key).ToList(); |
|
|
var adGroupIdList = adGroupStatisticsList.Select(x => x.Key).ToList(); |
|
|
var allAdGroupList = new List<Product360PopularizeAnalysisAdGroupResponse>(); |
|
|
var allAdGroupList = new List<Product360PopularizeAnalysisAdGroupResponse>(); |
|
|
|
|
|
|
|
|
|
|
|
var allAdGroupNameList = fsql.Select<JDPopularizeAdGroup>() |
|
|
|
|
|
.Where(x => x.ShopId == request.ShopId && adGroupIdList.Contains(x.AdGroupId)) |
|
|
|
|
|
.GroupBy(x => new { x.AdGroupId, x.AdGroupName }) |
|
|
|
|
|
.ToList(g => new { g.Value.AdGroupId, g.Value.AdGroupName }); |
|
|
|
|
|
|
|
|
foreach (var adGroupStatistics in adGroupStatisticsList) |
|
|
foreach (var adGroupStatistics in adGroupStatisticsList) |
|
|
{ |
|
|
{ |
|
|
var adGroupId = adGroupStatistics.Key; |
|
|
var adGroupId = adGroupStatistics.Key; |
|
@ -354,7 +369,7 @@ namespace SiNan.Business |
|
|
var adGroup = new Product360PopularizeAnalysisAdGroupResponse() |
|
|
var adGroup = new Product360PopularizeAnalysisAdGroupResponse() |
|
|
{ |
|
|
{ |
|
|
AdGroupId = adGroupId.Value, |
|
|
AdGroupId = adGroupId.Value, |
|
|
AdGroupName = string.Empty, |
|
|
AdGroupName = allAdGroupNameList.FirstOrDefault(x => x.AdGroupId == adGroupId)?.AdGroupName, |
|
|
BusinessType = 2, |
|
|
BusinessType = 2, |
|
|
CampaignId = adGroupStatistics.FirstOrDefault()?.CampaignId ?? 0, |
|
|
CampaignId = adGroupStatistics.FirstOrDefault()?.CampaignId ?? 0, |
|
|
Clicks = adGroupStatistics.Sum(x => x.Clicks), |
|
|
Clicks = adGroupStatistics.Sum(x => x.Clicks), |
|
@ -383,6 +398,7 @@ namespace SiNan.Business |
|
|
var jstCampaign = new Product360PopularizeAnalysisCampaginRepsonse() |
|
|
var jstCampaign = new Product360PopularizeAnalysisCampaginRepsonse() |
|
|
{ |
|
|
{ |
|
|
CampaignId = campaignId.Value, |
|
|
CampaignId = campaignId.Value, |
|
|
|
|
|
CampaignName = allCampaignNameList.FirstOrDefault(x => x.CampaignId == campaignId)?.CampaignName, |
|
|
BusinessType = 134217728, |
|
|
BusinessType = 134217728, |
|
|
CampaignGOI_Recent7Day = recent7DayCampaignGOIList.FirstOrDefault(x => x.LevelId == campaignId), |
|
|
CampaignGOI_Recent7Day = recent7DayCampaignGOIList.FirstOrDefault(x => x.LevelId == campaignId), |
|
|
CampaignGOI_Recent30Day = recent30DayCampaignGOIList.FirstOrDefault(x => x.LevelId == campaignId), |
|
|
CampaignGOI_Recent30Day = recent30DayCampaignGOIList.FirstOrDefault(x => x.LevelId == campaignId), |
|
|