@@ -63,6 +63,7 @@ namespace HKCardOUT | |||||
DataBus.SaasRoute = configer["SaasRoute"]; | DataBus.SaasRoute = configer["SaasRoute"]; | ||||
DataBus.StoreId = configer["StoreId"]; | DataBus.StoreId = configer["StoreId"]; | ||||
DataBus.COM = configer["COM"]; | DataBus.COM = configer["COM"]; | ||||
DataBus.TenantId = configer["TenantId"]; | |||||
DataBus.StartDevice = configer["StartDevice"].AsBool(); | DataBus.StartDevice = configer["StartDevice"].AsBool(); | ||||
DataBus.Cancel = configer["Cancel"].AsBool(); | DataBus.Cancel = configer["Cancel"].AsBool(); | ||||
DataBus.Count = configer["Count"].AsInt(); | DataBus.Count = configer["Count"].AsInt(); | ||||
@@ -30,6 +30,7 @@ namespace HKCardOUT.Helper | |||||
public static bool StartDevice { get; set; } | public static bool StartDevice { get; set; } | ||||
public static bool Cancel { get; set; } | public static bool Cancel { get; set; } | ||||
public static string StoreId { get; set; } | public static string StoreId { get; set; } | ||||
public static string TenantId { get; set; } | |||||
public static string COM { get; set; } | public static string COM { get; set; } | ||||
public static string SaasRoute { get; set; } | public static string SaasRoute { get; set; } | ||||
public static int Count { get; set; } | public static int Count { get; set; } | ||||
@@ -40,9 +41,9 @@ namespace HKCardOUT.Helper | |||||
public class ApiRoute | public class ApiRoute | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 检查卡的状态 | |||||
/// 获取所有卡 | |||||
/// </summary> | /// </summary> | ||||
public static string CheckCardStatus = DataBus.SaasRoute + "api/member-helper/membercardinfo"; | |||||
public static string CheckCardStatus = DataBus.SaasRoute + "api/one-card/card-list"; | |||||
/// <summary> | /// <summary> | ||||
/// 同步消费记录 | /// 同步消费记录 | ||||
/// </summary> | /// </summary> | ||||
@@ -30,10 +30,11 @@ namespace HKCardOUT.Logic | |||||
{ | { | ||||
t.NodePath = ApiRoute.CheckCardStatus; | t.NodePath = ApiRoute.CheckCardStatus; | ||||
t.ReqType = MultiType.GET; | t.ReqType = MultiType.GET; | ||||
}).Build().RunStringFirst().ToModel<JObject>()["data"]["cardState"]; | |||||
HKCore.AddCard(new CardStutas | |||||
{ | |||||
}).Build().RunStringFirst().ToModel<JObject>()["data"]["data"].ToJson().ToModel<HKLib.Dto.CardInfo>(); | |||||
HKCore.AddCard(new CardStutas | |||||
{ | |||||
CardNo = data.CardNum, | |||||
Stutas = data.State | |||||
}); | }); | ||||
return data != null ? data.ToString().AsInt() : 0; | return data != null ? data.ToString().AsInt() : 0; | ||||
} | } | ||||
@@ -46,7 +47,8 @@ namespace HKCardOUT.Logic | |||||
{ | { | ||||
t.NodePath = ApiRoute.CheckCardStatus; | t.NodePath = ApiRoute.CheckCardStatus; | ||||
t.ReqType = MultiType.GET; | t.ReqType = MultiType.GET; | ||||
}).Build().RunStringFirst().ToModel<JObject>()["data"]; | |||||
}).Build().RunStringFirst().ToModel<JObject>()["data"]["data"]; | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -52,10 +52,7 @@ namespace HKCardOUT.Logic.Service | |||||
if(!GetCardStutas(input.CardNo)) return false; | if(!GetCardStutas(input.CardNo)) return false; | ||||
var Old = Commom(input); | var Old = Commom(input); | ||||
if (Old == null) return false; | if (Old == null) return false; | ||||
var AM = DataBus.Times.AM.Split(","); | |||||
var S = DateTime.Parse(AM[0]); | |||||
var E = DateTime.Parse(AM[1]); | |||||
var AMDay = Old.Where(t => t.CreateTime >=S && t.CreateTime < E) | |||||
var AMDay = Old.Where(t => t.CreateTime >= DataBus.Times.ATStartTime && t.CreateTime < DataBus.Times.AMEndTime) | |||||
.Where(t => t.CreateTime.Year == DateTime.Now.Year) | .Where(t => t.CreateTime.Year == DateTime.Now.Year) | ||||
.Where(t => t.CreateTime.Month == DateTime.Now.Month) | .Where(t => t.CreateTime.Month == DateTime.Now.Month) | ||||
.Where(t => t.CreateTime.Day == DateTime.Now.Day) | .Where(t => t.CreateTime.Day == DateTime.Now.Day) | ||||
@@ -115,10 +112,7 @@ namespace HKCardOUT.Logic.Service | |||||
if (!GetCardStutas(input.CardNo)) return false; | if (!GetCardStutas(input.CardNo)) return false; | ||||
var Old = Commom(input); | var Old = Commom(input); | ||||
if (Old == null) return false; | if (Old == null) return false; | ||||
var PM = DataBus.Times.PM.Split(","); | |||||
var S = DateTime.Parse(PM[0]); | |||||
var E = DateTime.Parse(PM[1]); | |||||
var PMDay = Old.Where(t => t.CreateTime >= S && t.CreateTime < E). | |||||
var PMDay = Old.Where(t => t.CreateTime >= DataBus.Times.PMStartTime && t.CreateTime < DataBus.Times.PMEndTime). | |||||
Where(t => t.CreateTime.Year == DateTime.Now.Year) | Where(t => t.CreateTime.Year == DateTime.Now.Year) | ||||
.Where(t => t.CreateTime.Month == DateTime.Now.Month) | .Where(t => t.CreateTime.Month == DateTime.Now.Month) | ||||
.Where(t => t.CreateTime.Day == DateTime.Now.Day) | .Where(t => t.CreateTime.Day == DateTime.Now.Day) | ||||
@@ -176,10 +170,7 @@ namespace HKCardOUT.Logic.Service | |||||
if (!GetCardStutas(input.CardNo)) return false; | if (!GetCardStutas(input.CardNo)) return false; | ||||
var Old = Commom(input); | var Old = Commom(input); | ||||
if (Old == null) return false; | if (Old == null) return false; | ||||
var AT = DataBus.Times.AT.Split(","); | |||||
var S = DateTime.Parse(AT[0]); | |||||
var E = DateTime.Parse(AT[1]); | |||||
var ATDay = Old.Where(t => t.CreateTime >= S && t.CreateTime <E) | |||||
var ATDay = Old.Where(t => t.CreateTime >= DataBus.Times.ATStartTime && t.CreateTime < DataBus.Times.ATEndTime) | |||||
.Where(t => t.CreateTime.Year == DateTime.Now.Year) | .Where(t => t.CreateTime.Year == DateTime.Now.Year) | ||||
.Where(t => t.CreateTime.Month == DateTime.Now.Month) | .Where(t => t.CreateTime.Month == DateTime.Now.Month) | ||||
.Where(t => t.CreateTime.Day == DateTime.Now.Day) | .Where(t => t.CreateTime.Day == DateTime.Now.Day) | ||||
@@ -199,10 +199,8 @@ namespace HKCardOUT.ViewModels | |||||
lock (locker) | lock (locker) | ||||
{ | { | ||||
var Core = Container.Get<HKCore>(); | var Core = Container.Get<HKCore>(); | ||||
var AM = DataBus.Times.AM.Split(","); | |||||
var PM = DataBus.Times.PM.Split(","); | |||||
var AT = DataBus.Times.AT.Split(","); | |||||
if (DateTime.Now >= DateTime.Parse(AM[0]) && DateTime.Now < DateTime.Parse(AM[1])) | |||||
if (DateTime.Now >= DataBus.Times.AMStartTime&& DateTime.Now < DataBus.Times.AMEndTime) | |||||
{ | { | ||||
Core.DeviceSaleAM(new SaleLog | Core.DeviceSaleAM(new SaleLog | ||||
{ | { | ||||
@@ -211,7 +209,7 @@ namespace HKCardOUT.ViewModels | |||||
IsSync = false | IsSync = false | ||||
}); | }); | ||||
} | } | ||||
if (DateTime.Now >= DateTime.Parse(PM[0]) && DateTime.Now < DateTime.Parse(PM[1])) | |||||
if (DateTime.Now >= DataBus.Times.PMStartTime && DateTime.Now < DataBus.Times.PMEndTime) | |||||
{ | { | ||||
Core.DeviceSalePM(new SaleLog | Core.DeviceSalePM(new SaleLog | ||||
{ | { | ||||
@@ -220,7 +218,7 @@ namespace HKCardOUT.ViewModels | |||||
IsSync = false | IsSync = false | ||||
}); | }); | ||||
} | } | ||||
if (DateTime.Now >= DateTime.Parse(AT[0]) && DateTime.Now < DateTime.Parse(AT[1])) | |||||
if (DateTime.Now >= DataBus.Times.ATStartTime && DateTime.Now < DataBus.Times.ATEndTime) | |||||
{ | { | ||||
Core.DeviceSaleAT(new SaleLog | Core.DeviceSaleAT(new SaleLog | ||||
{ | { | ||||
@@ -9,6 +9,8 @@ | |||||
"Cron": "0/15 * * * * ? ", | "Cron": "0/15 * * * * ? ", | ||||
//店铺ID | //店铺ID | ||||
"StoreId": "a19535e8-119f-4b10-a011-6288fd3ddb37", | "StoreId": "a19535e8-119f-4b10-a011-6288fd3ddb37", | ||||
//加盟商Id | |||||
"TenantId": "68d4de9c-a277-4d7a-a192-e9fa91327d41", | |||||
//本地数据库 | //本地数据库 | ||||
"ConnectionStrings": { | "ConnectionStrings": { | ||||
"Sqlite": "HKSQL.db3" | "Sqlite": "HKSQL.db3" | ||||
@@ -8,5 +8,6 @@ namespace HKLib | |||||
{ | { | ||||
public static string MqAddress { get; set; } | public static string MqAddress { get; set; } | ||||
public static string SaasRoute { get; set; } | public static string SaasRoute { get; set; } | ||||
public static string TenantId { get; set; } | |||||
} | } | ||||
} | } |
@@ -1,4 +1,5 @@ | |||||
using System; | |||||
using Newtonsoft.Json; | |||||
using System; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text; | using System.Text; | ||||
@@ -9,7 +10,7 @@ namespace HKLib.Dto | |||||
/// <summary> | /// <summary> | ||||
/// 机构 | /// 机构 | ||||
/// </summary> | /// </summary> | ||||
public string Org { get; set; } | |||||
public string OrgId { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 姓名 | /// 姓名 | ||||
/// </summary> | /// </summary> | ||||
@@ -22,9 +23,48 @@ namespace HKLib.Dto | |||||
/// 卡号 | /// 卡号 | ||||
/// </summary> | /// </summary> | ||||
public string CardNo { get; set; } | public string CardNo { get; set; } | ||||
} | |||||
public class UserListDto | |||||
{ | |||||
[JsonProperty("realName")] | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 手机号 | |||||
/// </summary> | |||||
[JsonProperty("phone")] | |||||
public string Phone { get; set; } | |||||
/// <summary> | |||||
/// 机构信息 | |||||
/// </summary> | |||||
[JsonProperty("memberTagInfo")] | |||||
public List<MemberTagInfoDto> OrgInfo { get; set; } | |||||
/// <summary> | |||||
/// 卡集合 | |||||
/// </summary> | |||||
[JsonProperty("memberCardInfo")] | |||||
public List<CardInfo> Cards { get; set; } | |||||
} | |||||
public class MemberTagInfoDto | |||||
{ | |||||
[JsonProperty("id")] | |||||
public string Id { get; set; } | |||||
/// <summary> | |||||
/// 机构名称 | |||||
/// </summary> | |||||
[JsonProperty("name")] | |||||
public string Name { get; set; } | |||||
} | |||||
public class CardInfo | |||||
{ | |||||
/// <summary> | |||||
/// 卡号 | |||||
/// </summary> | |||||
[JsonProperty("cardNum")] | |||||
public string CardNum { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 身份证号 | |||||
/// 卡状态 0.禁用 1.正常 2.挂失 3.作废 | |||||
/// </summary> | /// </summary> | ||||
public string IdCard { get; set; } | |||||
[JsonProperty("state")] | |||||
public int State { get; set; } | |||||
} | } | ||||
} | } |
@@ -2,6 +2,8 @@ | |||||
using HKLib.RabbitMQ.Config; | using HKLib.RabbitMQ.Config; | ||||
using HKLib.RabbitMQ.Publisher; | using HKLib.RabbitMQ.Publisher; | ||||
using Newtonsoft.Json.Linq; | using Newtonsoft.Json.Linq; | ||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using XExten.Advance.HttpFramework.MultiCommon; | using XExten.Advance.HttpFramework.MultiCommon; | ||||
using XExten.Advance.HttpFramework.MultiFactory; | using XExten.Advance.HttpFramework.MultiFactory; | ||||
using XExten.Advance.LinqFramework; | using XExten.Advance.LinqFramework; | ||||
@@ -10,12 +12,17 @@ namespace HKLib.Interfaces | |||||
{ | { | ||||
public class HKLibHelper | public class HKLibHelper | ||||
{ | { | ||||
static Dictionary<string, string> Header = new Dictionary<string, string> { | |||||
{"TenantId",Configer.TenantId } | |||||
}; | |||||
/// <summary> | /// <summary> | ||||
/// 设置刷卡时间端 | /// 设置刷卡时间端 | ||||
/// </summary> | /// </summary> | ||||
public static bool SetTime(TimeSpilte input) | public static bool SetTime(TimeSpilte input) | ||||
{ | { | ||||
return IHttpMultiClient.HttpMulti.AddNode(t => | |||||
return IHttpMultiClient.HttpMulti | |||||
.AddHeader(t => t.Headers = Header) | |||||
.AddNode(t => | |||||
{ | { | ||||
t.NodePath = $"{Configer.SaasRoute}"; | t.NodePath = $"{Configer.SaasRoute}"; | ||||
t.JsonParam = input.ToJson(); | t.JsonParam = input.ToJson(); | ||||
@@ -28,12 +35,14 @@ namespace HKLib.Interfaces | |||||
/// </summary> | /// </summary> | ||||
public static string SetOrg(string input) | public static string SetOrg(string input) | ||||
{ | { | ||||
return IHttpMultiClient.HttpMulti.AddNode(t => | |||||
return IHttpMultiClient.HttpMulti | |||||
.AddHeader(t => t.Headers = Header) | |||||
.AddNode(t => | |||||
{ | { | ||||
t.NodePath = $"{Configer.SaasRoute}/api/one-card/member-tag"; | |||||
t.NodePath = $"{Configer.SaasRoute}api/one-card/member-tag"; | |||||
t.ReqType = MultiType.POST; | t.ReqType = MultiType.POST; | ||||
t.JsonParam = (new { Name = input }).ToJson(); | t.JsonParam = (new { Name = input }).ToJson(); | ||||
}).Build().RunStringFirst().ToModel<JObject>()["data"]["id"].ToString(); | |||||
}).Build().RunStringFirst().ToModel<JObject>()["data"]["data"]["id"].ToString(); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -41,55 +50,60 @@ namespace HKLib.Interfaces | |||||
/// </summary> | /// </summary> | ||||
public static bool AlterOrg(string input, string Sid) | public static bool AlterOrg(string input, string Sid) | ||||
{ | { | ||||
return IHttpMultiClient.HttpMulti.AddNode(t => | |||||
return IHttpMultiClient.HttpMulti.AddHeader(t => t.Headers = Header).AddNode(t => | |||||
{ | { | ||||
t.NodePath = $"{Configer.SaasRoute}/api/one-card/member-tag"; | |||||
t.NodePath = $"{Configer.SaasRoute}api/one-card/member-tag"; | |||||
t.ReqType = MultiType.PUT; | t.ReqType = MultiType.PUT; | ||||
t.JsonParam = (new { Name = input, Id = Sid }).ToJson(); | t.JsonParam = (new { Name = input, Id = Sid }).ToJson(); | ||||
}).Build().RunStringFirst().ToModel<JObject>()["isSuccess"].ToString().AsBool(); | |||||
}).Build().RunStringFirst().ToModel<JObject>()["data"]["isSuccess"].ToString().AsBool(); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 根据用户命获取下拉用户列表 | /// 根据用户命获取下拉用户列表 | ||||
/// </summary> | /// </summary> | ||||
/// <param name="keyword"></param> | /// <param name="keyword"></param> | ||||
public static string GetUserList(string keyword) | |||||
public static List<UserListDto> GetUserList(string keyword) | |||||
{ | { | ||||
IHttpMultiClient.HttpMulti.AddNode(t => | |||||
return IHttpMultiClient.HttpMulti.AddHeader(t => t.Headers = Header).AddNode(t => | |||||
{ | { | ||||
t.NodePath = $"{Configer.SaasRoute}/{keyword}"; | |||||
t.ReqType = MultiType.GET; | |||||
}).Build().RunStringFirst(); | |||||
return ""; | |||||
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> | ||||
/// 添加用户 | /// 添加用户 | ||||
/// </summary> | /// </summary> | ||||
/// <param name="input"></param> | /// <param name="input"></param> | ||||
public static void AddUser(UserDto input) | |||||
public static bool AddUser(UserDto input) | |||||
{ | { | ||||
IHttpMultiClient.HttpMulti.AddNode(t => | |||||
{ | |||||
t.NodePath = $"{Configer.SaasRoute}"; | |||||
t.ReqType = MultiType.POST; | |||||
t.JsonParam = input.ToJson(); | |||||
}).Build().RunStringFirst(); | |||||
return IHttpMultiClient.HttpMulti.AddHeader(t => t.Headers = Header).AddNode(t => | |||||
{ | |||||
t.NodePath = $"{Configer.SaasRoute}api/one-card/staff"; | |||||
t.ReqType = MultiType.POST; | |||||
t.JsonParam = (new { tagId = input.OrgId, realName = input.Name, phone = input.Phone }).ToJson(); | |||||
}).Build().RunStringFirst().ToModel<JObject>()["data"]["isSuccess"].ToString().AsBool(); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 变更卡状态 销户 | /// 变更卡状态 销户 | ||||
/// </summary> | /// </summary> | ||||
/// <param name="input"></param> | /// <param name="input"></param> | ||||
public static void CardStutasChange(CardStutasDto input) | |||||
public static bool CardStutasChange(CardStutasDto input) | |||||
{ | { | ||||
input.CardNo = GetUserList(input.keywrod); | |||||
input.CardNo = GetUserList(input.keywrod).FirstOrDefault(t=>t.Name.Equals(input.keywrod)).Cards.FirstOrDefault(t=>t.State==1).CardNum; | |||||
IHttpMultiClient.HttpMulti.AddNode(t => | |||||
var x = IHttpMultiClient.HttpMulti.AddHeader(t => t.Headers = Header).AddNode(t => | |||||
{ | { | ||||
t.NodePath = $"{Configer.SaasRoute}"; | |||||
t.ReqType = MultiType.POST; | |||||
t.JsonParam = input.ToJson(); | |||||
}).Build().RunStringFirst(); | |||||
ServiceQueryPush.QueryPush.PushMQ(input, "CardStutasChanged", MQEnum.Top); | |||||
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) | |||||
{ | |||||
ServiceQueryPush.QueryPush.PushMQ(input, "CardStutasChanged", MQEnum.Top); | |||||
return x; | |||||
} | |||||
return false; | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 报表数据 | /// 报表数据 | ||||
@@ -98,7 +112,7 @@ namespace HKLib.Interfaces | |||||
/// <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 void Report(ReportDto input, int type = 1) | ||||
{ | { | ||||
IHttpMultiClient.HttpMulti.AddNode(t => | |||||
IHttpMultiClient.HttpMulti.AddHeader(t => t.Headers = Header).AddNode(t => | |||||
{ | { | ||||
t.NodePath = $"{Configer.SaasRoute}"; | t.NodePath = $"{Configer.SaasRoute}"; | ||||
t.ReqType = MultiType.POST; | t.ReqType = MultiType.POST; | ||||