pry 2 years ago
parent
commit
13abe31ddd
3 changed files with 108 additions and 28 deletions
  1. +49
    -0
      HKLib/Dto/ReportCountDto.cs
  2. +2
    -6
      HKLib/Dto/ReportDto.cs
  3. +57
    -22
      HKLib/Interfaces/HKLibHelper.cs

+ 49
- 0
HKLib/Dto/ReportCountDto.cs View File

@@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace HKLib.Dto
{
/// <summary>
/// 表统计
/// </summary>
public class ReportCountDto
{
/// <summary>
/// 姓名
/// </summary>
public string Name { get; set; }
/// <summary>
/// 手机
/// </summary>
public string Phone { get; set; }
/// <summary>
/// 时间
/// </summary>
public string Date { get; set; }
/// <summary>
/// 机构
/// </summary>
public string Tag { get; set; }

/// <summary>
/// 早
/// </summary>
public decimal AMCount { get; set; }

/// <summary>
/// 中
/// </summary>
public decimal PMCount { get; set; }

/// <summary>
/// 晚
/// </summary>
public decimal ATCount { get; set; }

/// <summary>
/// 总计
/// </summary>
public decimal TotalCount { get; set; }
}
}

+ 2
- 6
HKLib/Dto/ReportDto.cs View File

@@ -9,14 +9,10 @@ namespace HKLib.Dto
/// <summary> /// <summary>
/// 开始时间 /// 开始时间
/// </summary> /// </summary>
public DateTime STime { get; set; }
public DateTime StartTime { get; set; }
/// <summary> /// <summary>
/// 结束时间 /// 结束时间
/// </summary> /// </summary>
public DateTime ETime { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string Name { get; set; }
public DateTime EndTime { get; set; }
} }
} }

+ 57
- 22
HKLib/Interfaces/HKLibHelper.cs View File

@@ -64,12 +64,12 @@ namespace HKLib.Interfaces
/// <param name="keyword"></param> /// <param name="keyword"></param>
public static List<UserListDto> GetUserList(string keyword) public static List<UserListDto> 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<JObject>()["data"]["data"].ToJson().ToModel<List<UserListDto>>();
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<JObject>()["data"]["data"].ToJson().ToModel<List<UserListDto>>();
} }
/// <summary> /// <summary>
/// 添加用户并绑卡 /// 添加用户并绑卡
@@ -82,7 +82,7 @@ namespace HKLib.Interfaces
{ {
t.NodePath = $"{Configer.SaasRoute}api/one-card/mmenber-card"; t.NodePath = $"{Configer.SaasRoute}api/one-card/mmenber-card";
t.ReqType = MultiType.POST; 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<JObject>()["data"]["isSuccess"].ToString().AsBool(); }).Build().RunStringFirst().ToModel<JObject>()["data"]["isSuccess"].ToString().AsBool();
} }


@@ -105,14 +105,14 @@ namespace HKLib.Interfaces
/// <param name="input"></param> /// <param name="input"></param>
public static bool CardStutasChange(CardStutasDto input) 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<JObject>()["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<JObject>()["data"]["isSuccess"].ToString().AsBool();
if (x) if (x)
{ {
ServiceQueryPush.QueryPush.PushMQ(input, "CardStutasChanged", MQEnum.Top); ServiceQueryPush.QueryPush.PushMQ(input, "CardStutasChanged", MQEnum.Top);
@@ -121,18 +121,53 @@ namespace HKLib.Interfaces
return false; return false;
} }
/// <summary> /// <summary>
/// 报表数据
/// 报表数据
/// 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
///}
///
///
/// </summary> /// </summary>
/// <param name="input"></param> /// <param name="input"></param>
/// <param name="type">1 计次就餐天消费表(每人),2每月餐段消费报表,3月餐段汇总表</param> /// <param name="type">1 计次就餐天消费表(每人),2每月餐段消费报表,3月餐段汇总表</param>
public static void Report(ReportDto input, int type = 1)
public static List<ReportCountDto> 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<JObject>()["data"]["data"].ToJson().ToModel<List<ReportCountDto>>();
return data;
} }
} }
} }

Loading…
Cancel
Save