Commit 345ec360 authored by 吴春's avatar 吴春

提交数据概况

parent f76c7972
......@@ -88,5 +88,11 @@ namespace Mall.Model.Entity.User
/// 备注
/// </summary>
public string Remarks { get; set; }
/// <summary>
/// 平台类型
/// </summary>
public UserSourceEnum? PlatformType { get; set; }
}
}
......@@ -29,6 +29,12 @@ namespace Mall.Model.Extend.Product
/// 商品名称
/// </summary>
public string GoodsName { get; set; }
/// <summary>
/// 订单对应的总件数
/// </summary>
public int GoodsTotalNum { get; set; }
/// <summary>
/// 货号
/// </summary>
......
......@@ -39,7 +39,5 @@ namespace Mall.Model.Extend.User
/// 下载枚举
/// </summary>
public List<int> ExcelEnumIds { get; set; }
public UserSourceEnum? PlatformType { get; set; }
}
}
using Mall.Common.AOP;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Query
{
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class DataStatistics_Query
{
public int TenantId { get; set; }
public int MallBaseId { get; set; }
public int PlatformType { get; set; }
/// <summary>
/// 开始时间【查询使用】
/// </summary>
public string StartDate { get; set; }
/// <summary>
/// 结束时间【查询使用】
/// </summary>
public string EndDate { get; set; }
/// <summary>
/// 会员数
/// </summary>
public int MemberNum { get; set; }
/// <summary>
/// 商品数
/// </summary>
public int GoodsNum { get; set; }
/// <summary>
/// 商品名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 订单数
/// </summary>
public int OrderNum { get; set; }
/// <summary>
/// 代发货数
/// </summary>
public int NotDeliverNum { get; set; }
/// <summary>
/// 售后数
/// </summary>
public int AfterSale { get; set; }
/// <summary>
/// 支付订单数
/// </summary>
public int OrderPay { get; set; }
/// <summary>
/// 支付金额
/// </summary>
public decimal PayMoney { get; set; }
/// <summary>
/// 支付人数
/// </summary>
public int PayMemerNum { get; set; }
/// <summary>
/// 支付件数
/// </summary>
public int BuyNum { get; set; }
/// <summary>
/// 折线图统计
/// </summary>
public List<OrderLine> OrderLineList { get; set; }
/// <summary>
/// 是否是昨日(主要是销售情况,分昨日和近7天)
/// </summary>
public int IsYesterday { get; set; }
public string CreateDate { get; set; }
/// <summary>
/// 订单状态0-全部,1-未完成,2-已完成,3-已取消,4-售后中,5-已完成售后
/// </summary>
public int OrderStatus { get; set; }
/// <summary>
/// 订单类型
/// </summary>
public int OrderType { get; set; }
}
public class OrderLine
{
/// <summary>
/// 时间
/// </summary>
public string DateStr { get; set; }
/// <summary>
/// 支付订单数
/// </summary>
public int OrderPay { get; set; }
/// <summary>
/// 支付金额
/// </summary>
public decimal PayMoney { get; set; }
/// <summary>
/// 支付人数
/// </summary>
public int PayMemerNum { get; set; }
/// <summary>
/// 支付件数
/// </summary>
public int BuyNum { get; set; }
}
}
......@@ -273,7 +273,7 @@ namespace Mall.Module.MarketingCenter
OperatorEnum=OperatorEnum.Equal
}
};
flag = productRepository.Update(cols, wheres);
productRepository.Update(cols, wheres);
discountCouponRepository.DBSession.Commit();
......
using Mall.Model.Extend.Product;
using Mall.Model.Query;
using Mall.Repository.Product;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Mall.Module.MarketingCenter
{
public class StatisticsModule
{
private RB_Goods_OrderRepository orderRepository = new RB_Goods_OrderRepository();
#region 数据统计-数据概况
/// <summary>
/// 数据概况
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<DataStatistics_Query> GetOrdertSatistics(DataStatistics_Query dmodel)
{
return orderRepository.GetOrdertSatistics(dmodel);
}
/// <summary>
/// 获取近一周的数据
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public DataStatistics_Query GetWeeklyOrder(DataStatistics_Query dmodel)
{
if (dmodel.IsYesterday == 1)
{
dmodel.StartDate = dmodel.EndDate = System.DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
}
else
{
dmodel.StartDate = System.DateTime.Now.ToString("yyyy-MM-dd");
dmodel.EndDate = System.DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd");
}
var List = orderRepository.GetWeeklyOrder(dmodel);
DataStatistics_Query model = new DataStatistics_Query();
if (List != null && List.Any())
{
model.OrderPay = List.Count();
model.PayMoney = List.Sum(x => x.Income ?? 0);
model.PayMemerNum = List.GroupBy(x => x.UserId).Count();
model.BuyNum = List.Sum(x => x.GoodsTotalNum);
model.OrderLineList = new List<OrderLine>();
if (dmodel.IsYesterday == 1)//同一天
{
for (int i = 1; i < 24; i++)
{
OrderLine modelOrderLine = new OrderLine();
modelOrderLine.OrderPay = List.Where(x => x.CreateDate.Value.ToString("dd") == ((i > 9) ? ("0" + i) : i.ToString())).Count();
modelOrderLine.PayMoney = List.Where(x => x.CreateDate.Value.ToString("dd") == ((i > 9) ? ("0" + i) : i.ToString())).Sum(x => x.Income ?? 0);
modelOrderLine.PayMemerNum = List.Where(x => x.CreateDate.Value.ToString("dd") == ((i > 9) ? ("0" + i) : i.ToString())).GroupBy(x => x.UserId).Count();
modelOrderLine.BuyNum = List.Where(x => x.CreateDate.Value.ToString("dd") == ((i > 9) ? ("0" + i) : i.ToString())).Sum(x => x.GoodsTotalNum);
modelOrderLine.DateStr = (i > 9) ? ("0" + i) : i.ToString();
model.OrderLineList.Add(modelOrderLine);
}
}
else
{
for (int i = 0; i < 7; i++)
{
OrderLine modelOrderLine = new OrderLine();
modelOrderLine.OrderPay = List.Where(x => x.CreateDate.Value.ToString("yyyy-MM-dd") == System.DateTime.Now.AddDays(i).ToString("yyyy-MM-dd")).Count();
modelOrderLine.PayMoney = List.Where(x => x.CreateDate.Value.ToString("yyyy-MM-dd") == System.DateTime.Now.AddDays(i).ToString("yyyy-MM-dd")).Sum(x => x.Income ?? 0);
modelOrderLine.PayMemerNum = List.Where(x => x.CreateDate.Value.ToString("yyyy-MM-dd") == System.DateTime.Now.AddDays(i).ToString("yyyy-MM-dd")).GroupBy(x => x.UserId).Count();
modelOrderLine.BuyNum = List.Where(x => x.CreateDate.Value.ToString("yyyy-MM-dd") == System.DateTime.Now.AddDays(i).ToString("yyyy-MM-dd")).Sum(x => x.GoodsTotalNum);
modelOrderLine.DateStr = System.DateTime.Now.AddDays(i).ToString("yyyy-MM-dd");
model.OrderLineList.Add(modelOrderLine);
}
}
}
return model;
}
/// <summary>
/// 商品购买力TOP排行
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<DataStatistics_Query> GetGoosTop(DataStatistics_Query dmodel)
{
return orderRepository.GetGoosTop(dmodel);
}
/// <summary>
/// 用户购买力TOP排行
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<DataStatistics_Query> GetMemberTop(DataStatistics_Query dmodel)
{
return orderRepository.GetMemberTop(dmodel);
}
#endregion
#region 销售报表
/// <summary>
/// 销售统计
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<DataStatistics_Query> GetSellPageList(int pageIndex, int pageSize, out long count, DataStatistics_Query dmodel)
{
return orderRepository.GetSellPageList(pageIndex, pageSize, out count, dmodel);
}
/// <summary>
/// 总成交
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public DataStatistics_Query GetSellOrder(DataStatistics_Query dmodel)
{
var List = orderRepository.GetWeeklyOrder(dmodel);
DataStatistics_Query model = new DataStatistics_Query();
if (List != null && List.Any())
{
model.OrderNum = List.Count();
model.PayMoney = List.Sum(x => x.Income ?? 0);
model.PayMemerNum = List.GroupBy(x => x.UserId).Count();
model.GoodsNum = List.Sum(x => x.GoodsTotalNum);
}
return model;
}
/// <summary>
/// 销售统计导出
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<DataStatistics_Query> GetSellExcel(DataStatistics_Query dmodel)
{
return orderRepository.GetSellExcel(dmodel);
}
#endregion
}
}
......@@ -115,7 +115,7 @@ namespace Mall.Repository.User
}
if (query.PlatformType > 0)
{
builder.Append($" AND b.{nameof(RB_Member_Balance_Extend.PlatformType)}={query.PlatformType}");
builder.Append($" AND a.{nameof(RB_Member_Balance_Extend.PlatformType)}={(int)query.PlatformType}");
}
if (!string.IsNullOrWhiteSpace(query.MemberName))
{
......
......@@ -196,10 +196,10 @@ namespace Mall.WebApi.Controllers.MarketingCenter
x.DiscountsPrice,
UseTypeStr = Mall.Common.Plugin.EnumHelper.GetEnumName(x.UseType),
x.CouponType,
x.StartDate,
StartDate = x.StartDate.HasValue ? x.StartDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
x.IndateType,
x.IndateDay,
x.EndDate,
EndDate=x.EndDate.HasValue ? x.EndDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
x.TotalNum,
ResidueNum = x.TotalNum - x.ReceiveNum,
x.PickupCenter
......@@ -227,7 +227,7 @@ namespace Mall.WebApi.Controllers.MarketingCenter
}
if (!string.IsNullOrWhiteSpace(oldLogisticsModel.MemberLevel))
{
oldLogisticsModel.MemberLevelList =JsonConvert.DeserializeObject<List<int>>(oldLogisticsModel.MemberLevel).ToArray();
oldLogisticsModel.MemberLevelList = JsonConvert.DeserializeObject<List<int>>(oldLogisticsModel.MemberLevel).ToArray();
}
return ApiResult.Success("", oldLogisticsModel);
}
......@@ -267,7 +267,7 @@ namespace Mall.WebApi.Controllers.MarketingCenter
{
return ApiResult.Failed("开始日期或结束日期必填");
}
if (query.StartDate < query.EndDate)
if (query.StartDate > query.EndDate)
{
return ApiResult.Failed("开始日期必须小于结束日期");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment