From 2fc941279a96b01bd503c62ff66ae4cce5f9cdf8 Mon Sep 17 00:00:00 2001 From: xxe Date: Thu, 13 Oct 2022 16:37:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HKLib/Dto/ReportCountDto.cs | 49 ++++++++++++++++++++ HKLib/Dto/ReportDto.cs | 8 +--- HKLib/Interfaces/HKLibHelper.cs | 79 ++++++++++++++++++++++++--------- 3 files changed, 108 insertions(+), 28 deletions(-) create mode 100644 HKLib/Dto/ReportCountDto.cs diff --git a/HKLib/Dto/ReportCountDto.cs b/HKLib/Dto/ReportCountDto.cs new file mode 100644 index 0000000..880f234 --- /dev/null +++ b/HKLib/Dto/ReportCountDto.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace HKLib.Dto +{ + /// + /// 表统计 + /// + public class ReportCountDto + { + /// + /// 姓名 + /// + public string Name { get; set; } + /// + /// 手机 + /// + public string Phone { get; set; } + /// + /// 时间 + /// + public string Date { get; set; } + /// + /// 机构 + /// + public string Tag { get; set; } + + /// + /// 早 + /// + public decimal AMCount { get; set; } + + /// + /// 中 + /// + public decimal PMCount { get; set; } + + /// + /// 晚 + /// + public decimal ATCount { get; set; } + + /// + /// 总计 + /// + public decimal TotalCount { get; set; } + } +} diff --git a/HKLib/Dto/ReportDto.cs b/HKLib/Dto/ReportDto.cs index 1d88b1c..ebada0b 100644 --- a/HKLib/Dto/ReportDto.cs +++ b/HKLib/Dto/ReportDto.cs @@ -9,14 +9,10 @@ namespace HKLib.Dto /// /// 开始时间 /// - public DateTime STime { get; set; } + public DateTime StartTime { get; set; } /// /// 结束时间 /// - public DateTime ETime { get; set; } - /// - /// 姓名 - /// - public string Name { get; set; } + public DateTime EndTime { get; set; } } } diff --git a/HKLib/Interfaces/HKLibHelper.cs b/HKLib/Interfaces/HKLibHelper.cs index ce5f24a..586c125 100644 --- a/HKLib/Interfaces/HKLibHelper.cs +++ b/HKLib/Interfaces/HKLibHelper.cs @@ -64,12 +64,12 @@ namespace HKLib.Interfaces /// public static List GetUserList(string keyword) { - return IHttpMultiClient.HttpMulti.AddHeader(t => t.Headers = Header).AddNode(t => - { - t.NodePath = $"{Configer.SaasRoute}api/one-card/staff-list"; - t.ReqType = MultiType.POST; - t.JsonParam = (new { realName = keyword }).ToJson(); - }).Build().RunStringFirst().ToModel()["data"]["data"].ToJson().ToModel>(); + return IHttpMultiClient.HttpMulti.AddHeader(t => t.Headers = Header).AddNode(t => + { + t.NodePath = $"{Configer.SaasRoute}api/one-card/staff-list"; + t.ReqType = MultiType.POST; + t.JsonParam = (new { realName = keyword }).ToJson(); + }).Build().RunStringFirst().ToModel()["data"]["data"].ToJson().ToModel>(); } /// /// 添加用户并绑卡 @@ -82,7 +82,7 @@ namespace HKLib.Interfaces { t.NodePath = $"{Configer.SaasRoute}api/one-card/mmenber-card"; t.ReqType = MultiType.POST; - t.JsonParam = (new { tagId = input.OrgId, realName = input.Name, phone = input.Phone, cardNum=input.CardNo }).ToJson(); + t.JsonParam = (new { tagId = input.OrgId, realName = input.Name, phone = input.Phone, cardNum = input.CardNo }).ToJson(); }).Build().RunStringFirst().ToModel()["data"]["isSuccess"].ToString().AsBool(); } @@ -105,14 +105,14 @@ namespace HKLib.Interfaces /// public static bool CardStutasChange(CardStutasDto input) { - input.CardNo = GetUserList(input.keywrod).FirstOrDefault(t=>t.Name.Equals(input.keywrod)).Cards.FirstOrDefault(t=>t.State==1).CardNum; + input.CardNo = GetUserList(input.keywrod).FirstOrDefault(t => t.Name.Equals(input.keywrod)).Cards.FirstOrDefault(t => t.State == 1).CardNum; - var x = IHttpMultiClient.HttpMulti.AddHeader(t => t.Headers = Header).AddNode(t => - { - t.NodePath = $"{Configer.SaasRoute}api/one-card/mmenber-card-state"; - t.ReqType = MultiType.PUT; - t.JsonParam = (new { CardNum = input.CardNo, State = input.Stutas }).ToJson(); - }).Build().RunStringFirst().ToModel()["data"]["isSuccess"].ToString().AsBool(); + var x = IHttpMultiClient.HttpMulti.AddHeader(t => t.Headers = Header).AddNode(t => + { + t.NodePath = $"{Configer.SaasRoute}api/one-card/mmenber-card-state"; + t.ReqType = MultiType.PUT; + t.JsonParam = (new { CardNum = input.CardNo, State = input.Stutas }).ToJson(); + }).Build().RunStringFirst().ToModel()["data"]["isSuccess"].ToString().AsBool(); if (x) { ServiceQueryPush.QueryPush.PushMQ(input, "CardStutasChanged", MQEnum.Top); @@ -121,18 +121,53 @@ namespace HKLib.Interfaces return false; } /// - /// 报表数据 + /// 报表数据 + /// type=1 数据参考 + /// + /// { + ///"name": "张三", + /// "phone": "18208263734", + /// "date": "2022-09-24", + /// "tag": null, + /// "amCount": 3, + /// "pmCount": 0, + /// "atCount": 0, + /// "totalCount": 3 + /// } + /// + /// type=2 数据参考 + /// + /// { + ///"name": null, + ///"phone": null, + ///"date": "2022-09-13", + ///"tag": null, + ///"amCount": 3, + ///"pmCount": 1, + ///"atCount": 0, + ///"totalCount": 4 + ///} + /// + /// /// /// /// 1 计次就餐天消费表(每人),2每月餐段消费报表,3月餐段汇总表 - public static void Report(ReportDto input, int type = 1) + public static List Report(ReportDto input, int type = 1) { - IHttpMultiClient.HttpMulti.AddHeader(t => t.Headers = Header).AddNode(t => - { - t.NodePath = $"{Configer.SaasRoute}"; - t.ReqType = MultiType.POST; - t.JsonParam = input.ToJson(); - }).Build().RunStringFirst(); + var Route = Configer.SaasRoute; + if (type == 1) + Route += "api/one-card/day-consume-info"; + if (type == 2) + Route += "api/one-card/consume-info"; + if (type == 3) + Route += "api/one-card/time-interval-consume-info"; + var data = IHttpMultiClient.HttpMulti.AddHeader(t => t.Headers = Header).AddNode(t => + { + t.NodePath = Route; + t.ReqType = MultiType.POST; + t.JsonParam = input.ToJson(); + }).Build().RunStringFirst().ToModel()["data"]["data"].ToJson().ToModel>(); + return data; } } }