|
@@ -1,4 +1,5 @@
|
|
-using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
+using Microsoft.AspNetCore.Http.Metadata;
|
|
|
|
+using Microsoft.AspNetCore.Mvc;
|
|
using Qiniu.Util;
|
|
using Qiniu.Util;
|
|
using System;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
@@ -30,11 +31,13 @@ namespace ZhonTai.Admin.Services.DiTuiAPI
|
|
private ProjectLinkRepository _ProjectLinkRepository;
|
|
private ProjectLinkRepository _ProjectLinkRepository;
|
|
private ProjectRepository _projectRepository;
|
|
private ProjectRepository _projectRepository;
|
|
private ProjectPriceRepository _projectPriceRepository;
|
|
private ProjectPriceRepository _projectPriceRepository;
|
|
- public ProjectsService(ProjectLinkRepository projectLinkRepository,ProjectRepository projectRepository,ProjectPriceRepository projectPriceRepository)
|
|
|
|
|
|
+ private ProjectStatRepository _projectStatRepository;
|
|
|
|
+ public ProjectsService(ProjectLinkRepository projectLinkRepository,ProjectRepository projectRepository,ProjectPriceRepository projectPriceRepository,ProjectStatRepository projectStatRepository)
|
|
{
|
|
{
|
|
_ProjectLinkRepository = projectLinkRepository;
|
|
_ProjectLinkRepository = projectLinkRepository;
|
|
_projectRepository = projectRepository;
|
|
_projectRepository = projectRepository;
|
|
_projectPriceRepository = projectPriceRepository;
|
|
_projectPriceRepository = projectPriceRepository;
|
|
|
|
+ _projectStatRepository = projectStatRepository;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -250,68 +253,45 @@ namespace ZhonTai.Admin.Services.DiTuiAPI
|
|
ProjectId = 0;
|
|
ProjectId = 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if(ProjectId == 0)
|
|
|
|
+ {
|
|
|
|
+ throw ResultOutput.Exception("项目 ID 不可为空");
|
|
|
|
+ }
|
|
|
|
|
|
- //var list = _ProjectLinkRepository.Select.DisableGlobalFilter(FilterNames.Tenant)
|
|
|
|
- // .WhereIf(ProjectId.HasValue && ProjectId.Value > 0, a => a.ProjectId == ProjectId)
|
|
|
|
- // .WhereIf(Salesman.NotNull(), a => a.Salesman.Contains(Salesman))
|
|
|
|
- // .WhereIf(SalesmanPhone.NotNull(), a => a.SalesmanPhone.Contains(SalesmanPhone))
|
|
|
|
- //.Count(out var total)
|
|
|
|
- //.Page(input.CurrentPage, input.PageSize)
|
|
|
|
- //.ToList(m => new ProjectQrcodePageOutput()
|
|
|
|
- //{
|
|
|
|
- // Id = m.Id,
|
|
|
|
- // Salesman = m.Salesman,
|
|
|
|
- // UseTime = m.UseTime,
|
|
|
|
- // QrcodeUrl = m.QrcodeUrl,
|
|
|
|
- // QueryUrl = m.QueryUrl
|
|
|
|
- //});
|
|
|
|
|
|
+ var listStat = _projectStatRepository
|
|
|
|
+ .Select
|
|
|
|
+ .DisableGlobalFilter(FilterNames.Tenant)
|
|
|
|
+ .Where(a => a.ProjectId == ProjectId)
|
|
|
|
+ .WhereIf(Date.NotNull(), a => a.EffectDate.ToString().Contains(Date))
|
|
|
|
+ .GroupBy(a => a.EffectDate)
|
|
|
|
+ .Page(input.CurrentPage, input.PageSize)
|
|
|
|
+ .ToList(m => new { SettleDate = m.Key});
|
|
|
|
|
|
List<ProjectCountPageOutput> list = new List<ProjectCountPageOutput>();
|
|
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元"));
|
|
|
|
-
|
|
|
|
- //settleCounts.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
|
|
|
|
- //settleCounts.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
|
|
|
|
- list.Add(new ProjectCountPageOutput((long)(ProjectId != 0 ? ProjectId : 416237348180038), "2023-05-02","", settleCounts));
|
|
|
|
-
|
|
|
|
- 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)(ProjectId != 0 ? ProjectId : 416237348180038), "2023-05-01","", settleCounts1));
|
|
|
|
-
|
|
|
|
- // 项目日统计数据
|
|
|
|
- List<ProjectCountPageOutput> listDay = new List<ProjectCountPageOutput>();
|
|
|
|
- List<SettleCount> settleCountsDay = new List<SettleCount>();
|
|
|
|
- settleCountsDay.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
|
|
|
|
- settleCountsDay.Add(new SettleCount("电商首购B级", "201/300单", "201元"));
|
|
|
|
- settleCountsDay.Add(new SettleCount("电商首购C级", "202/300单", "202元"));
|
|
|
|
- settleCountsDay.Add(new SettleCount("今日汇总", "603/900单", "603元"));
|
|
|
|
-
|
|
|
|
- //settleCounts.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
|
|
|
|
- //settleCounts.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
|
|
|
|
- listDay.Add(new ProjectCountPageOutput((long)(ProjectId != 0 ? ProjectId : 416237348180038), !string.IsNullOrEmpty(Date)? Date :"2023-05-02", "中捷乐淘", settleCountsDay));
|
|
|
|
-
|
|
|
|
- List<SettleCount> settleCountsDay1 = new List<SettleCount>();
|
|
|
|
- settleCountsDay1.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
|
|
|
|
- settleCountsDay1.Add(new SettleCount("电商首购B级", "199/300单", "199元"));
|
|
|
|
- settleCountsDay1.Add(new SettleCount("电商首购C级", "198/300单", "198元"));
|
|
|
|
- settleCountsDay1.Add(new SettleCount("今日汇总", "597/900单", "597元"));
|
|
|
|
-
|
|
|
|
- //settleCounts.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
|
|
|
|
- //settleCounts.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
|
|
|
|
- listDay.Add(new ProjectCountPageOutput((long)(ProjectId != 0 ? ProjectId : 416237348180038), !string.IsNullOrEmpty(Date) ? Date : "2023-05-02", "suzhou柿集", settleCountsDay1));
|
|
|
|
-
|
|
|
|
- if(!string.IsNullOrEmpty(Date))
|
|
|
|
|
|
+ foreach (var countDate in listStat)
|
|
{
|
|
{
|
|
- list = listDay;
|
|
|
|
|
|
+ //string.Format("{0:yyyy-MM-dd HH:mm:ss}", m.CreatedTime)
|
|
|
|
+ string countDateString = string.Format("{0:yyyy-MM-dd}", countDate.SettleDate);
|
|
|
|
+ //List<SettleCount> settleCounts = new List<SettleCount>();
|
|
|
|
+ var sr = _projectStatRepository.Select.DisableGlobalFilter(FilterNames.Tenant)
|
|
|
|
+ .Where(a => a.ProjectId == ProjectId)
|
|
|
|
+ .Where(a => a.EffectDate.ToString().Contains(countDateString))
|
|
|
|
+ .ToList(m => new SettleRecord(m.Name,m.ValidCount.ToString(),m.ValidCount.ToString()){});
|
|
|
|
+
|
|
|
|
+ List<SettleCount> sc = new List<SettleCount>();
|
|
|
|
+ long validCount = 0;
|
|
|
|
+ long Count = 0;
|
|
|
|
+ long commission = 0;
|
|
|
|
+ foreach(var item in sr)
|
|
|
|
+ {
|
|
|
|
+ validCount += Convert.ToInt16(item.ValidCount);
|
|
|
|
+ Count += Convert.ToInt16( item.Count);
|
|
|
|
+ //commission += Convert.ToInt16(item.Commission);
|
|
|
|
+ sc.Add(new SettleCount(item.SettleStandard, item.ValidCount + "/" + item.ValidCount));
|
|
|
|
+ }
|
|
|
|
+ sc.Add(new SettleCount("汇总", validCount + "/" + Count, "--"));
|
|
|
|
+
|
|
|
|
+ list.Add(new ProjectCountPageOutput((long)ProjectId, countDateString, "", sc));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|