|
@@ -13,6 +13,7 @@ using ZhonTai.Admin.Core.Consts;
|
|
|
using ZhonTai.Admin.Core.Dto;
|
|
|
using ZhonTai.Admin.Domain.KuaKe;
|
|
|
using ZhonTai.Admin.Domain.Project;
|
|
|
+using ZhonTai.Admin.Domain.ProjectLink;
|
|
|
using ZhonTai.Admin.Domain.User;
|
|
|
using ZhonTai.Admin.Repositories.KuaKe;
|
|
|
using ZhonTai.Admin.Repositories.Project;
|
|
@@ -21,6 +22,7 @@ using ZhonTai.Admin.Services.DiTuiAPI.Dto;
|
|
|
using ZhonTai.Admin.Services.Notice.Dto;
|
|
|
using ZhonTai.Admin.Services.Project;
|
|
|
using ZhonTai.Admin.Services.ProjectLink.Dto;
|
|
|
+using ZhonTai.Admin.Services.ProjectStat.Dto;
|
|
|
using ZhonTai.DynamicApi;
|
|
|
using ZhonTai.DynamicApi.Attributes;
|
|
|
|
|
@@ -598,9 +600,9 @@ namespace ZhonTai.Admin.Services.DiTuiAPI
|
|
|
public async Task<PageOutput<ProjectCountPageOutput>> QrcodeCountPageAsync(PageInput<QrcodeCountPageInput> input)
|
|
|
{
|
|
|
var Id = input.Filter?.Id;
|
|
|
- if (Id == null)
|
|
|
+ if (Id == null || Id == 0)
|
|
|
{
|
|
|
- Id = 0;
|
|
|
+ throw ResultOutput.Exception($"无效参数");
|
|
|
}
|
|
|
|
|
|
|
|
@@ -618,35 +620,67 @@ namespace ZhonTai.Admin.Services.DiTuiAPI
|
|
|
// QrcodeUrl = m.QrcodeUrl,
|
|
|
// QueryUrl = m.QueryUrl
|
|
|
//});
|
|
|
+ List<StatOutput> result = await _projectStatRepository.Select.DisableGlobalFilter(FilterNames.Tenant).From<ProjectLinkEntity>((s, l) => s
|
|
|
+ .InnerJoin(a => a.Num == l.Num && a.ProjectId == l.ProjectId))
|
|
|
+ .Where((a, b) => b.Id == Id && a.IsSettle == 1)
|
|
|
+ .ToListAsync((a, b) => new StatOutput
|
|
|
+ {
|
|
|
+ Num = a.Num,
|
|
|
+ Date = a.EffectDate.ToString("yyyy-MM-dd"),
|
|
|
+ ProjectPriceId = a.ProjectPriceId.ToString(),
|
|
|
+ ProjectPriceName = a.Name,
|
|
|
+ ValidCount = a.ValidCount,
|
|
|
+ CommissionPrice = a.CommissionPrice
|
|
|
+ });
|
|
|
|
|
|
- List<ProjectCountPageOutput> list = new List<ProjectCountPageOutput>();
|
|
|
- List<SettleCount> settleCounts = new List<SettleCount>();
|
|
|
- settleCounts.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
|
|
|
- settleCounts.Add(new SettleCount("电商首购B级", "201/300单", "201元"));
|
|
|
- settleCounts.Add(new SettleCount("电商首购C级", "202/300单", "202元"));
|
|
|
- settleCounts.Add(new SettleCount("今日汇总", "603/900单", "603元"));
|
|
|
+ List<ProjectCountPageOutput> list2 = new List<ProjectCountPageOutput>();
|
|
|
+ var groupR = result.GroupBy(a => a.Date);
|
|
|
+ foreach (var item in groupR)
|
|
|
+ {
|
|
|
+ List<SettleCount> settleCountsTemp = new List<SettleCount>();
|
|
|
+ long totalValidCount = 0;
|
|
|
+ long totalCount = 0;
|
|
|
+ decimal totalCommission = 0;
|
|
|
+ foreach (var settleItem in item)
|
|
|
+ {
|
|
|
+ settleCountsTemp.Add(new SettleCount(settleItem.ProjectPriceName, settleItem.ValidCount + "/" + settleItem.ValidCount + "单", settleItem.CommissionPrice.ToString()));
|
|
|
+ totalValidCount += settleItem.ValidCount;
|
|
|
+ totalCount += settleItem.ValidCount;
|
|
|
+ totalCommission += settleItem.CommissionPrice;
|
|
|
+ }
|
|
|
+ settleCountsTemp.Add(new SettleCount("当日汇总", totalValidCount + "/" + totalCount + "单", totalCommission.ToString()));
|
|
|
+ list2.Add(new ProjectCountPageOutput((long)Id, item.Key, "", settleCountsTemp));
|
|
|
+ }
|
|
|
|
|
|
+ #region moke数据
|
|
|
+ //List<ProjectCountPageOutput> list = new List<ProjectCountPageOutput>();
|
|
|
+ //List<SettleCount> settleCounts = new List<SettleCount>();
|
|
|
//settleCounts.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
|
|
|
- //settleCounts.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
|
|
|
- list.Add(new ProjectCountPageOutput((long)(Id != 0 ? Id : 416237348180038), "2023-05-02", "", settleCounts));
|
|
|
+ //settleCounts.Add(new SettleCount("电商首购B级", "201/300单", "201元"));
|
|
|
+ //settleCounts.Add(new SettleCount("电商首购C级", "202/300单", "202元"));
|
|
|
+ //settleCounts.Add(new SettleCount("今日汇总", "603/900单", "603元"));
|
|
|
|
|
|
- List<SettleCount> settleCounts1 = new List<SettleCount>();
|
|
|
- settleCounts1.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
|
|
|
- settleCounts1.Add(new SettleCount("电商首购B级", "199/300单", "199元"));
|
|
|
- settleCounts1.Add(new SettleCount("电商首购C级", "198/300单", "198元"));
|
|
|
- settleCounts1.Add(new SettleCount("今日汇总", "597/900单", "597元"));
|
|
|
+ ////settleCounts.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
|
|
|
+ ////settleCounts.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
|
|
|
+ //list.Add(new ProjectCountPageOutput((long)(Id != 0 ? Id : 416237348180038), "2023-05-02", "", settleCounts));
|
|
|
|
|
|
- //settleCounts.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
|
|
|
- //settleCounts.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
|
|
|
- list.Add(new ProjectCountPageOutput((long)(Id != 0 ? Id : 416237348180038), "2023-05-01", "", settleCounts1));
|
|
|
+ //List<SettleCount> settleCounts1 = new List<SettleCount>();
|
|
|
+ //settleCounts1.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
|
|
|
+ //settleCounts1.Add(new SettleCount("电商首购B级", "199/300单", "199元"));
|
|
|
+ //settleCounts1.Add(new SettleCount("电商首购C级", "198/300单", "198元"));
|
|
|
+ //settleCounts1.Add(new SettleCount("今日汇总", "597/900单", "597元"));
|
|
|
|
|
|
- var total = list.Count;
|
|
|
+ ////settleCounts.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
|
|
|
+ ////settleCounts.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
|
|
|
+ //list.Add(new ProjectCountPageOutput((long)(Id != 0 ? Id : 416237348180038), "2023-05-01", "", settleCounts1));
|
|
|
|
|
|
+ //var total = list.Count;
|
|
|
+#endregion
|
|
|
|
|
|
var data = new PageOutput<ProjectCountPageOutput>()
|
|
|
{
|
|
|
- List = list,
|
|
|
- Total = total
|
|
|
+ List = list2,
|
|
|
+ Total = list2.Count
|
|
|
};
|
|
|
|
|
|
return data;
|