|
|
@ -85,7 +85,10 @@ namespace SBF.Business |
|
|
|
/// 查询托管任务
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="request"></param>
|
|
|
|
/// <param name="startDateDiffDays"></param>
|
|
|
|
/// <param name="isContainPopularizeProfit"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <exception cref="BusinessException"></exception>
|
|
|
|
public ListResponse<TrusteeshipTaskResponse> QueryTrusteeship(QueryTrusteeshipRequest request) |
|
|
|
{ |
|
|
|
if (request.ShopId == null || request.ShopId == 0) |
|
|
@ -116,8 +119,8 @@ namespace SBF.Business |
|
|
|
AdId = t.AdId, |
|
|
|
AdName = t.AdName, |
|
|
|
BidPrice = t.BidPrice, |
|
|
|
OldBudget = t.OldBudget, |
|
|
|
NewBudget = t.NewBudget, |
|
|
|
AnchorBudget = t.AnchorBudget, |
|
|
|
ActualBudget = t.ActualBudget, |
|
|
|
BusinessType = t.BusinessType, |
|
|
|
CampaginName = t.CampaginName, |
|
|
|
CampaignId = t.CampaignId, |
|
|
@ -152,7 +155,6 @@ namespace SBF.Business |
|
|
|
var skuIdList = list.Select(x => x.SkuId).Distinct().ToList(); |
|
|
|
//var spuIdList = list.Select(x => x.SpuId).Distinct().ToList();
|
|
|
|
|
|
|
|
|
|
|
|
#region 推广花费
|
|
|
|
var costList = fsql.Select<AggregationJDPopularizeAdSkuDaily>() |
|
|
|
.Where(x => x.ShopId == request.ShopId && |
|
|
@ -168,7 +170,7 @@ namespace SBF.Business |
|
|
|
}); |
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 商品营业额
|
|
|
|
#region SKU商品营业额
|
|
|
|
var actualAmountList = fsql.Select<AggregationJDPopularizeSkuDaily>() |
|
|
|
.Where(x => x.ShopId == request.ShopId && |
|
|
|
x.Date >= startDate && x.Date <= endDate && |
|
|
@ -243,8 +245,8 @@ namespace SBF.Business |
|
|
|
AdId = x.AdId, |
|
|
|
AdName = x.AdName, |
|
|
|
BidPrice = 0M, |
|
|
|
OldBudget = 0M, |
|
|
|
NewBudget = 0M, |
|
|
|
AnchorBudget = 0M, |
|
|
|
ActualBudget = 0M, |
|
|
|
BusinessType = x.BusinessType, |
|
|
|
CampaginName = x.CampaignName, |
|
|
|
CampaignId = x.CampaignId, |
|
|
@ -277,5 +279,134 @@ namespace SBF.Business |
|
|
|
.Set(t => t.EndTime, DateTime.Now) |
|
|
|
.ExecuteAffrows(); |
|
|
|
} |
|
|
|
|
|
|
|
public TrusteeshipTaskResponse GetTrusteeshipTaskCurveResponse(long Id) |
|
|
|
{ |
|
|
|
|
|
|
|
var task = fsql.Select<Sbf_TrusteeshipTask, Product, ProductSku>() |
|
|
|
.InnerJoin((t, p, ps) => t.SpuId == p.Id) |
|
|
|
.InnerJoin((t, p, ps) => t.SkuId == ps.Id) |
|
|
|
.Where((t, p, ps) => t.Id == Id) |
|
|
|
.OrderByDescending((t, p, ps) => t.CreateTime) |
|
|
|
.ToOne((t, p, ps) => new Sbf_TrusteeshipTask() |
|
|
|
{ |
|
|
|
Id = t.Id, |
|
|
|
ShopId = t.ShopId, |
|
|
|
SpuId = t.SpuId, |
|
|
|
SkuId = t.SkuId, |
|
|
|
ActualAmountInTrusteeship = t.ActualAmountInTrusteeship, |
|
|
|
AdGroupId = t.AdGroupId, |
|
|
|
AdGroupName = t.AdGroupName, |
|
|
|
AdId = t.AdId, |
|
|
|
AdName = t.AdName, |
|
|
|
BidPrice = t.BidPrice, |
|
|
|
AnchorBudget = t.AnchorBudget, |
|
|
|
ActualBudget = t.ActualBudget, |
|
|
|
BusinessType = t.BusinessType, |
|
|
|
CampaginName = t.CampaginName, |
|
|
|
CampaignId = t.CampaignId, |
|
|
|
CostInTrusteeship = t.CostInTrusteeship, |
|
|
|
CreateTime = t.CreateTime, |
|
|
|
EndTime = t.EndTime, |
|
|
|
IsEnd = t.IsEnd, |
|
|
|
StartTrusteeshipDate = t.StartTrusteeshipDate, |
|
|
|
PolicyType = t.PolicyType, |
|
|
|
|
|
|
|
Logo = ps.Logo, |
|
|
|
Price = ps.Price, |
|
|
|
SkuTitle = ps.Title, |
|
|
|
SkuState = ps.State, |
|
|
|
SkuCreateTime = ps.CreateTime, |
|
|
|
CategoryId = ps.CategoryId, |
|
|
|
CategoryName = ps.CategoryName, |
|
|
|
|
|
|
|
MainSkuId = p.MainSkuId, |
|
|
|
ProductCreateTime = p.CreateTime, |
|
|
|
ProductItemNum = p.ProductItemNum, |
|
|
|
ProductState = p.State, |
|
|
|
ProductTitle = p.Title, |
|
|
|
Stage = p.Stage, |
|
|
|
Platform = p.Platform |
|
|
|
}) |
|
|
|
.Map<TrusteeshipTaskResponse>(); |
|
|
|
|
|
|
|
var startDate = DateTime.Now.Date.AddDays(-30); |
|
|
|
var endDate = DateTime.Now.Date.AddDays(-1); |
|
|
|
|
|
|
|
//var spuIdList = list.Select(x => x.SpuId).Distinct().ToList();
|
|
|
|
|
|
|
|
#region 推广花费/推广盈利
|
|
|
|
var costList = fsql.Select<AggregationJDPopularizeAdSkuDaily>() |
|
|
|
.Where(x => x.ShopId == task.ShopId && |
|
|
|
x.Date >= startDate && x.Date <= endDate && |
|
|
|
x.BusinessType == task.BusinessType && |
|
|
|
x.CampaignId == task.CampaignId && |
|
|
|
x.SkuId == task.SkuId) |
|
|
|
.ToList(x => new |
|
|
|
{ |
|
|
|
x.Date, |
|
|
|
x.SkuId, |
|
|
|
x.CampaignId, |
|
|
|
x.BusinessType, |
|
|
|
x.Cost, |
|
|
|
x.PopularizeLevelProfit |
|
|
|
}); |
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region SKU商品营业额
|
|
|
|
var actualAmountList = fsql.Select<AggregationJDPopularizeSkuDaily>() |
|
|
|
.Where(x => x.ShopId == task.ShopId && |
|
|
|
x.Date >= startDate && x.Date <= endDate && |
|
|
|
x.SkuId == task.SkuId) |
|
|
|
.ToList(x => new |
|
|
|
{ |
|
|
|
x.Date, |
|
|
|
x.SkuId, |
|
|
|
x.Cost, |
|
|
|
x.ActualAmount |
|
|
|
}); |
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 免费访客量
|
|
|
|
var shopIdStr = task.ShopId.ToString(); |
|
|
|
var uvList = _freeSqlMultiDBManager.XXfsql.Select<Newskus>().Where(s => s.ShopId == shopIdStr && |
|
|
|
s.CreateTime >= startDate && |
|
|
|
s.CreateTime <= endDate && |
|
|
|
s.Sku == task.SkuId) |
|
|
|
.ToList(s => new { s.Uv, s.Sku, Date = s.CreateTime }); |
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
task.CostByDateList = costList.OrderBy(x => x.Date) |
|
|
|
.Select(x => new NumberByDate() |
|
|
|
{ |
|
|
|
Date = x.Date, |
|
|
|
Value = x.Cost |
|
|
|
}).ToList(); |
|
|
|
|
|
|
|
task.PopluarizeProfitByDateList = costList.OrderBy(x => x.Date) |
|
|
|
.Select(x => new NumberByDate() |
|
|
|
{ |
|
|
|
Date = x.Date, |
|
|
|
Value = x.PopularizeLevelProfit - x.Cost |
|
|
|
}).ToList(); |
|
|
|
|
|
|
|
task.ActualAmountByDateList = actualAmountList.OrderBy(x => x.Date) |
|
|
|
.Select(x => new NumberByDate() |
|
|
|
{ |
|
|
|
Date = x.Date, |
|
|
|
Value = x.ActualAmount |
|
|
|
}).ToList(); |
|
|
|
|
|
|
|
task.UVByDateList = uvList.OrderBy(x => x.Date) |
|
|
|
.Select(x => new NumberByDate() |
|
|
|
{ |
|
|
|
Date = x.Date, |
|
|
|
Value = x.Uv |
|
|
|
}).ToList(); |
|
|
|
|
|
|
|
return task; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|