2025-04-24 18:31:27 +08:00

599 lines
22 KiB
C#

using MyCode.Project.Domain.Message.Request.Million;
using MyCode.Project.Domain.Message.Request.Report;
using MyCode.Project.Domain.Message.Request.Report40;
using MyCode.Project.Domain.Message.Response.Report;
using MyCode.Project.Domain.Message.Response.Report40;
using MyCode.Project.Domain.Message.Response.Shop;
using MyCode.Project.Domain.Message.Response.User;
using MyCode.Project.Infrastructure.Common;
using MyCode.Project.Infrastructure.Enumeration;
using MyCode.Project.Infrastructure.Extensions;
using MyCode.Project.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
namespace MyCode.Project.WebApi.Areas.Wechat.Controllers
{
/// <summary>
/// 4.0的数据看板明细列表的报表
/// </summary>
public class ReportPageList40Controller : BaseWechatController
{
private IReportPageList40Service _reportPageList40Service;
private IReport40Service _report40Service;
/// <summary>
/// 初始化一个<see cref="GoodsController"/>类型的实例
/// </summary>
public ReportPageList40Controller(IReportPageList40Service reportPageList40Service
, IReport40Service report40Service)
{
_reportPageList40Service = reportPageList40Service;
_report40Service = report40Service;
}
#region GetFuGouList()
/// <summary>
/// 获取复购的明细列表
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
public List<MemberMoneyResp> GetFuGouList(ReportDetail40Query req)
{
if (this.CurrentLogin.RoleType == LoginRoleType.Clerk)
{
req.Clerkid = this.CurrentLogin.ClerkId;
}
return _reportPageList40Service.GetFuGouDetail(req);
}
#endregion
#region GetFuGouDetail()
/// <summary>
/// 获取今日业绩、首单、复购、拳头项目、老客激活订单的明细列表
/// </summary>
/// <param name="id">订单主键ID</param>
/// <returns></returns>
[HttpGet]
public List<OrderDetailResp> GetFuGouOrderDetail(Guid id)
{
return _reportPageList40Service.GetFuGouOrderDetail(id);
}
#endregion
#region GetHeXiaoList()
/// <summary>
/// 获取核销的明细列表
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
public List<HeXiaoListResp> GetHeXiaoList(ReportDetail40Query req)
{
if (this.CurrentLogin.RoleType == LoginRoleType.Clerk)
{
req.Clerkid = this.CurrentLogin.ClerkId;
}
return _reportPageList40Service.GetHeXiaoList(req);
}
#endregion
#region GetJinRiHuLiList()
/// <summary>
/// 获取今日护理的明细列表
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
public List<JinRiHuLiListResp> GetJinRiHuLiList(ReportDetail40Query req)
{
if (this.CurrentLogin.RoleType == LoginRoleType.Clerk)
{
req.Clerkid = this.CurrentLogin.ClerkId;
}
return _reportPageList40Service.GetJinRiHuLiList(req);
}
#endregion
#region GetJinRiYeJiList()
/// <summary>
/// 获取今日业绩列表
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
public List<MemberMoneyResp> GetJinRiYeJiList(ReportDetail40Query req)
{
if (this.CurrentLogin.RoleType == LoginRoleType.Clerk)
{
req.Clerkid = this.CurrentLogin.ClerkId;
}
return _reportPageList40Service.GetJinRiYeJiList(req);
}
#endregion
#region GetLieBianList()
/// <summary>
/// 获取裂变列表
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
public List<LieBianListResp> GetLieBianList(ReportDetail40Query req)
{
if (this.CurrentLogin.RoleType == LoginRoleType.Clerk)
{
req.Clerkid = this.CurrentLogin.ClerkId;
}
return _reportPageList40Service.GetLieBianList(req);
}
#endregion
#region GetNaXinList()
/// <summary>
/// 获取纳新列表
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
public List<LieBianListResp> GetNaXinList(ReportDetail40Query req)
{
if (this.CurrentLogin.RoleType == LoginRoleType.Clerk)
{
req.Clerkid = this.CurrentLogin.ClerkId;
}
return _reportPageList40Service.GetNaXinList(req);
}
#endregion
#region GetQuanTouXiangMuList()
/// <summary>
/// 获取拳头项目的明细列表
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
public List<MemberMoneyResp> GetQuanTouXiangMuList(ReportDetail40Query req)
{
if (this.CurrentLogin.RoleType == LoginRoleType.Clerk)
{
req.Clerkid = this.CurrentLogin.ClerkId;
}
return _reportPageList40Service.GetQuanTouXiangMuList(req);
}
#endregion
#region GetShouDanList()
/// <summary>
/// 获取首单列表
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
public List<MemberMoneyResp> GetShouDanList(ReportDetail40Query req)
{
if (this.CurrentLogin.RoleType == LoginRoleType.Clerk)
{
req.Clerkid = this.CurrentLogin.ClerkId;
}
return _reportPageList40Service.GetShouDanList(req);
}
#endregion
#region GetTiYanList()
/// <summary>
/// 获取体验列表
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
public List<JinRiHuLiListResp> GetTiYanList(ReportDetail40Query req)
{
if (this.CurrentLogin.RoleType == LoginRoleType.Clerk)
{
req.Clerkid = this.CurrentLogin.ClerkId;
}
return _reportPageList40Service.GetTiYanList(req);
}
#endregion
#region GetLaoKeJiHuoList()
/// <summary>
/// 获取老客激活列表
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
public List<MemberMoneyResp> GetLaoKeJiHuoList(ReportDetail40Query req)
{
if (this.CurrentLogin.RoleType == LoginRoleType.Clerk)
{
req.Clerkid = this.CurrentLogin.ClerkId;
}
return _reportPageList40Service.GetLaoKeJiHuoList(req);
}
#endregion
#region GetTaoCanRenShuList()
/// <summary>
/// 获取套餐人数列表
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
public List<TaoCanRenShuListResp> GetTaoCanRenShuList(ReportDetail40Query req)
{
if (this.CurrentLogin.RoleType == LoginRoleType.Clerk)
{
req.Clerkid = this.CurrentLogin.ClerkId;
}
return _reportPageList40Service.GetTaoCanRenShuList(req);
}
#endregion
#region GetJinRiYeJi(--)
/// <summary>
/// 顶部--今日业绩
/// </summary>
/// <param name="act"></param>
/// <returns></returns>
[HttpPost]
public JinRiYeJiResp GetJinRiYeJi(ReportDetail40Query act)
{
JinRiYeJiResp result = new JinRiYeJiResp();
JinRiYeJiObject list = new JinRiYeJiObject(); ;
ShopSalesPerformancReq req = new ShopSalesPerformancReq();
Guid? clerkId = act.Clerkid;
if (this.CurrentLogin.RoleType == LoginRoleType.Clerk)
{
clerkId = this.CurrentLogin.ClerkId;
}
req.Date = act.Date;
req.ShopId = act.Shopid;
list = _report40Service.GetJinRiYeJi(req, clerkId);
result.Title = list.Title;
result.ValueText =decimal.Parse(list.ValueText);
result.Items = new List<ItemDetail>();
result.ChongZhi=decimal.Parse( list.ChongZhi.ValueText.ToString());
result.Items.Add(list.CaiZhuang);
result.Items.Add(list.FaShi);
result.Items.Add(list.HuFu);
result.Items.Add(list.QiTa);
return result;
}
#endregion
#region GetFuGou(--)
/// <summary>
/// 顶部--复购
/// </summary>
/// <param name="act"></param>
/// <returns></returns>
[HttpPost]
public FuGouResp GetFuGou(ReportDetail40Query act)
{
FuGouResp result = new FuGouResp();
ShopSalesPerformancReq req = new ShopSalesPerformancReq();
Guid? clerkId = act.Clerkid;
if (this.CurrentLogin.RoleType == LoginRoleType.Clerk)
{
clerkId = this.CurrentLogin.ClerkId;
}
req.Date = act.Date;
req.ShopId = act.Shopid;
var list = _report40Service.GetFuGou(req, clerkId);
result.Jinrirenshu =(int) list.ValueText;
result.Yuezongfugou = (int) list.Items[0].ValueText;
result.Yuedudingdanshu = (int)list.Items[1].ValueText;
result.Yuedujundanjine = (decimal)list.Items[2].ValueText;
return result;
}
#endregion
#region GetHeXiao(--)
/// <summary>
/// 顶部--获取核销
/// </summary>
/// <param name="act"></param>
/// <returns></returns>
[HttpPost]
public HeXiaoResp GetHeXiao(ReportDetail40Query act)
{
HeXiaoResp result = new HeXiaoResp();
ShopSalesPerformancReq req = new ShopSalesPerformancReq();
Guid? clerkId = act.Clerkid;
if (this.CurrentLogin.RoleType == LoginRoleType.Clerk)
{
clerkId = this.CurrentLogin.ClerkId;
}
req.Date = act.Date;
req.ShopId = act.Shopid;
var list = _report40Service.GetHeXiao(req, clerkId);
result.Jinrihexiao =int.Parse(list.ValueText.ToString());
result.Yuehexiaoshu = int.Parse(list.YueZong.ValueText.ToString());
result.Yuemubiaoshu = int.Parse(list.LeiJi.ValueText.ToString());
result.Mubiaodachenglv = decimal.Parse(list.HeXiaoLv.ValueText.ToString().Replace("%",""));
return result;
}
#endregion
#region GetJinRiHuLi(--)
/// <summary>
/// 顶部--获取今日护理
/// </summary>
/// <param name="act"></param>
/// <returns></returns>
[HttpPost]
public HuLiResp GetJinRiHuLi(ReportDetail40Query act)
{
HuLiResp result = new HuLiResp();
ShopSalesPerformancReq req = new ShopSalesPerformancReq();
Guid? clerkId = act.Clerkid;
if (this.CurrentLogin.RoleType == LoginRoleType.Clerk)
{
clerkId = this.CurrentLogin.ClerkId;
}
req.Date = act.Date;
req.ShopId = act.Shopid;
var list = _report40Service.GetJinRiHuLi(req, clerkId);
result.Jinrihuli = int.Parse(list.ValueText.ToString());
result.Taocanrenshu = int.Parse(list.Items[0].ValueText.ToString());
result.Tiyanrenshu = int.Parse(list.Items[1].ValueText.ToString());
return result;
}
#endregion
#region GetJinRiHuLi(--)
/// <summary>
/// 顶部--老客激活
/// </summary>
/// <param name="act"></param>
/// <returns></returns>
[HttpPost]
public LaoKeJiHuoResp GetLaoKeJiHuo(ReportDetail40Query act)
{
LaoKeJiHuoResp result = new LaoKeJiHuoResp();
ShopSalesPerformancReq req = new ShopSalesPerformancReq();
Guid? clerkId = act.Clerkid;
if (this.CurrentLogin.RoleType == LoginRoleType.Clerk)
{
clerkId = this.CurrentLogin.ClerkId;
}
req.Date = act.Date;
req.ShopId = act.Shopid;
var list = _report40Service.GetLaoKeJiHuo(req, clerkId);
result.Jinrijihuo = int.Parse(list.ValueText.ToString());
result.Yuedujihuo = int.Parse(list.Items[0].ValueText.ToString());
result.Hulishu = int.Parse(list.Items[1].ValueText.ToString());
result.Huoyueshu = int.Parse(list.Items[2].ValueText.ToString());
result.Chenshuishu = int.Parse(list.Items[3].ValueText.ToString());
return result;
}
#endregion
#region GetLieBian(--)
/// <summary>
/// 顶部--获取裂变
/// </summary>
/// <param name="act"></param>
/// <returns></returns>
[HttpPost]
public LieBianResp GetLieBian(ReportDetail40Query act)
{
LieBianResp result = new LieBianResp();
ShopSalesPerformancReq req = new ShopSalesPerformancReq();
Guid? clerkId = act.Clerkid;
if (this.CurrentLogin.RoleType == LoginRoleType.Clerk)
{
clerkId = this.CurrentLogin.ClerkId;
}
req.Date = act.Date;
req.ShopId = act.Shopid;
var list = _report40Service.GetLieBian(req, clerkId);
result.Jinriliebian = int.Parse(list.ValueText.ToString());
result.Yueleiji = int.Parse(list.Items[0].ValueText.ToString());
result.Yuemubiao = int.Parse(list.Items[1].ValueText.ToString());
result.Bafenbi = decimal.Parse(list.Items[2].ValueText.ToString().Replace("%", ""));
return result;
}
#endregion
#region GetNaXin(--)
/// <summary>
/// 顶部--获取纳新
/// </summary>
/// <param name="act"></param>
/// <returns></returns>
[HttpPost]
public NaXinResp GetNaXin(ReportDetail40Query act)
{
NaXinResp result = new NaXinResp();
ShopSalesPerformancReq req = new ShopSalesPerformancReq();
Guid? clerkId = act.Clerkid;
if (this.CurrentLogin.RoleType == LoginRoleType.Clerk)
{
clerkId = this.CurrentLogin.ClerkId;
}
req.Date = act.Date;
req.ShopId = act.Shopid;
var kpi = _report40Service.GetMonthKpi(req, clerkId);
var list = _report40Service.GetNaXin(req, kpi, clerkId);
result.Jinri = int.Parse(list.ValueText.ToString());
result.Yueleiji = int.Parse(list.Items[0].ValueText.ToString());
result.Yuemubiao = int.Parse(list.Items[1].ValueText.ToString());
result.Bafenbi = decimal.Parse(list.Items[2].ValueText.ToString().Replace("%", ""));
return result;
}
#endregion
#region GetQuanTouXiangMu(--)
/// <summary>
/// 顶部--拳头项目
/// </summary>
/// <param name="act"></param>
/// <returns></returns>
[HttpPost]
public QuanTouXiangMuResp GetQuanTouXiangMu(ReportDetail40Query act)
{
QuanTouXiangMuResp result = new QuanTouXiangMuResp();
ShopSalesPerformancReq req = new ShopSalesPerformancReq();
Guid? clerkId = act.Clerkid;
req.Date = act.Date;
req.ShopId = act.Shopid;
if (this.CurrentLogin.RoleType == LoginRoleType.Clerk)
{
clerkId = this.CurrentLogin.ClerkId;
}
var list = _report40Service.GetQuanTouXiangMu(req, clerkId);
result.Jinriyeji = decimal.Parse(list.ValueText.ToString());
result.Jinrirenshu = int.Parse(list.Items[2].ValueText.ToString());
return result;
}
#endregion
#region GetShouDan(--)
/// <summary>
/// 顶部--获取首单
/// </summary>
/// <param name="act"></param>
/// <returns></returns>
[HttpPost]
public ShouDanResp GetShouDan(ReportDetail40Query act)
{
ShouDanResp result = new ShouDanResp();
ShopSalesPerformancReq req = new ShopSalesPerformancReq();
Guid? clerkId = act.Clerkid;
req.Date = act.Date;
req.ShopId = act.Shopid;
if (this.CurrentLogin.RoleType == LoginRoleType.Clerk)
{
clerkId = this.CurrentLogin.ClerkId;
}
var list = _report40Service.GetShouDan(req, clerkId);
result.Jinrishoudan = int.Parse(list.ValueText.ToString());
result.Xinkejundan = decimal.Parse(list.Items[0].ValueText.ToString());
result.Yueleiji = int.Parse(list.Items[1].ValueText.ToString());
result.Bafenbi = list.BaiFenBi;
return result;
}
#endregion
#region GetTaoCanRenShu(--)
/// <summary>
/// 顶部--获取套餐人数
/// </summary>
/// <param name="act"></param>
/// <returns></returns>
[HttpPost]
public TaoCanResp GetTaoCanRenShu(ReportDetail40Query act)
{
TaoCanResp result = new TaoCanResp();
ShopSalesPerformancReq req = new ShopSalesPerformancReq();
Guid? clerkId = act.Clerkid;
req.Date = act.Date;
req.ShopId = act.Shopid;
if (this.CurrentLogin.RoleType == LoginRoleType.Clerk)
{
clerkId = this.CurrentLogin.ClerkId;
}
var list = _report40Service.GetTaoCanZongLiang(req, clerkId);
result.Taocanrenshu = int.Parse(list.ValueText.ToString());
result.Taocanshuliang = int.Parse(list.ZongShu.ValueText.ToString());
result.Huoyue = int.Parse(list.HuoYue.ValueText.ToString());
result.Yiban = int.Parse(list.YiBan.ValueText.ToString());
result.Ouer = int.Parse(list.OuEr.ValueText.ToString());
result.Chenshui = int.Parse(list.ChenShui.ValueText.ToString());
return result;
}
#endregion
#region GetTiYan(--)
/// <summary>
/// 顶部--获取体验
/// </summary>
/// <param name="act"></param>
/// <returns></returns>
[HttpPost]
public TiYanResp GetTiYan(ReportDetail40Query act)
{
TiYanResp result = new TiYanResp();
ShopSalesPerformancReq req = new ShopSalesPerformancReq();
Guid? clerkId = act.Clerkid;
if (this.CurrentLogin.RoleType == LoginRoleType.Clerk)
{
clerkId = this.CurrentLogin.ClerkId;
}
req.Date = act.Date;
req.ShopId = act.Shopid;
var list = _report40Service.GetTiYan(req, clerkId);
result.Tiyan = int.Parse(list.ValueText.ToString());
result.Dancitiyan = int.Parse(list.DanCiTiYan.ValueText1.ToString());
result.Dancizongshu = int.Parse(list.DanCiTiYan.ValueText2.ToString());
result.Diyitiyan = int.Parse(list.Items[0].ValueText1.ToString());
result.Diyishengyu = int.Parse(list.Items[0].ValueText2.ToString());
result.Diertiyan = int.Parse(list.Items[1].ValueText1.ToString());
result.Diershengyu = int.Parse(list.Items[1].ValueText2.ToString());
result.Disantiyan = int.Parse(list.Items[2].ValueText1.ToString());
result.Disanshengyu = int.Parse(list.Items[2].ValueText2.ToString());
result.Bafenbi = list.BaiFenBi;
return result;
}
#endregion
#region GetClerkList ,"全部"
/// <summary>
/// 获取店员列表,根据角色返回"全部"选项
/// </summary>
/// <param name="shopid">店铺主键ShopID</param>
/// <returns></returns>
[HttpGet]
public List<ClerkListResp> GetClerkList(Guid shopid)
{
return _reportPageList40Service.GetClerkList(shopid, this.CurrentLogin);
}
#endregion
#region GetShouGongFeiResp()
/// <summary>
/// 顶部--获取手工费顶部
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
public ShouGongFeiResp GetShouGongFeiResp(ReportShouGongFeiQuery req)
{
if (this.CurrentLogin.RoleType == LoginRoleType.Clerk)
{
req.ClerkId = this.CurrentLogin.ClerkId;
}
return _reportPageList40Service.GetShouGongFeiResp(req);
}
#endregion
#region GetShouGonFeiDetailsList()
/// <summary>
/// 获取手续费明细列表
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
public List<ShouGonFeiListResp> GetShouGonFeiList(ReportShouGongFeiQuery req)
{
if (this.CurrentLogin.RoleType == LoginRoleType.Clerk)
{
req.ClerkId = this.CurrentLogin.ClerkId;
}
return _reportPageList40Service.GetShouGonFeiList(req);
}
#endregion
}
}