diff --git a/HKCardOUT/Bootstrapper.cs b/HKCardOUT/Bootstrapper.cs
index 037364b..0215748 100644
--- a/HKCardOUT/Bootstrapper.cs
+++ b/HKCardOUT/Bootstrapper.cs
@@ -63,6 +63,7 @@ namespace HKCardOUT
DataBus.SaasRoute = configer["SaasRoute"];
DataBus.StoreId = configer["StoreId"];
DataBus.COM = configer["COM"];
+ DataBus.TenantId = configer["TenantId"];
DataBus.StartDevice = configer["StartDevice"].AsBool();
DataBus.Cancel = configer["Cancel"].AsBool();
DataBus.Count = configer["Count"].AsInt();
diff --git a/HKCardOUT/Helper/DataBus.cs b/HKCardOUT/Helper/DataBus.cs
index cf27c96..dd8585c 100644
--- a/HKCardOUT/Helper/DataBus.cs
+++ b/HKCardOUT/Helper/DataBus.cs
@@ -30,6 +30,7 @@ namespace HKCardOUT.Helper
public static bool StartDevice { get; set; }
public static bool Cancel { get; set; }
public static string StoreId { get; set; }
+ public static string TenantId { get; set; }
public static string COM { get; set; }
public static string SaasRoute { get; set; }
public static int Count { get; set; }
@@ -40,9 +41,9 @@ namespace HKCardOUT.Helper
public class ApiRoute
{
///
- /// 检查卡的状态
+ /// 获取所有卡
///
- public static string CheckCardStatus = DataBus.SaasRoute + "api/member-helper/membercardinfo";
+ public static string CheckCardStatus = DataBus.SaasRoute + "api/one-card/card-list";
///
/// 同步消费记录
///
diff --git a/HKCardOUT/Logic/RemoteService.cs b/HKCardOUT/Logic/RemoteService.cs
index 9e72c73..6b613ad 100644
--- a/HKCardOUT/Logic/RemoteService.cs
+++ b/HKCardOUT/Logic/RemoteService.cs
@@ -30,10 +30,11 @@ namespace HKCardOUT.Logic
{
t.NodePath = ApiRoute.CheckCardStatus;
t.ReqType = MultiType.GET;
- }).Build().RunStringFirst().ToModel()["data"]["cardState"];
- HKCore.AddCard(new CardStutas
- {
-
+ }).Build().RunStringFirst().ToModel()["data"]["data"].ToJson().ToModel();
+ HKCore.AddCard(new CardStutas
+ {
+ CardNo = data.CardNum,
+ Stutas = data.State
});
return data != null ? data.ToString().AsInt() : 0;
}
@@ -46,7 +47,8 @@ namespace HKCardOUT.Logic
{
t.NodePath = ApiRoute.CheckCardStatus;
t.ReqType = MultiType.GET;
- }).Build().RunStringFirst().ToModel()["data"];
+ }).Build().RunStringFirst().ToModel()["data"]["data"];
+
}
///
diff --git a/HKCardOUT/Logic/Service/HKCore.cs b/HKCardOUT/Logic/Service/HKCore.cs
index db8575f..d8f9cbd 100644
--- a/HKCardOUT/Logic/Service/HKCore.cs
+++ b/HKCardOUT/Logic/Service/HKCore.cs
@@ -52,10 +52,7 @@ namespace HKCardOUT.Logic.Service
if(!GetCardStutas(input.CardNo)) return false;
var Old = Commom(input);
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.Month == DateTime.Now.Month)
.Where(t => t.CreateTime.Day == DateTime.Now.Day)
@@ -115,10 +112,7 @@ namespace HKCardOUT.Logic.Service
if (!GetCardStutas(input.CardNo)) return false;
var Old = Commom(input);
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.Month == DateTime.Now.Month)
.Where(t => t.CreateTime.Day == DateTime.Now.Day)
@@ -176,10 +170,7 @@ namespace HKCardOUT.Logic.Service
if (!GetCardStutas(input.CardNo)) return false;
var Old = Commom(input);
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 t.CreateTime >= DataBus.Times.ATStartTime && t.CreateTime < DataBus.Times.ATEndTime)
.Where(t => t.CreateTime.Year == DateTime.Now.Year)
.Where(t => t.CreateTime.Month == DateTime.Now.Month)
.Where(t => t.CreateTime.Day == DateTime.Now.Day)
diff --git a/HKCardOUT/ViewModels/RootViewModel.cs b/HKCardOUT/ViewModels/RootViewModel.cs
index 9ef01da..c33b38d 100644
--- a/HKCardOUT/ViewModels/RootViewModel.cs
+++ b/HKCardOUT/ViewModels/RootViewModel.cs
@@ -199,10 +199,8 @@ namespace HKCardOUT.ViewModels
lock (locker)
{
var Core = Container.Get();
- 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
{
@@ -211,7 +209,7 @@ namespace HKCardOUT.ViewModels
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
{
@@ -220,7 +218,7 @@ namespace HKCardOUT.ViewModels
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
{
diff --git a/HKCardOUT/options.json b/HKCardOUT/options.json
index 2f620dd..7d81fc9 100644
--- a/HKCardOUT/options.json
+++ b/HKCardOUT/options.json
@@ -9,6 +9,8 @@
"Cron": "0/15 * * * * ? ",
//店铺ID
"StoreId": "a19535e8-119f-4b10-a011-6288fd3ddb37",
+ //加盟商Id
+ "TenantId": "68d4de9c-a277-4d7a-a192-e9fa91327d41",
//本地数据库
"ConnectionStrings": {
"Sqlite": "HKSQL.db3"
diff --git a/HKLib/Configer.cs b/HKLib/Configer.cs
index 150c400..8acf10f 100644
--- a/HKLib/Configer.cs
+++ b/HKLib/Configer.cs
@@ -8,5 +8,6 @@ namespace HKLib
{
public static string MqAddress { get; set; }
public static string SaasRoute { get; set; }
+ public static string TenantId { get; set; }
}
}
diff --git a/HKLib/Dto/UserDto.cs b/HKLib/Dto/UserDto.cs
index 21d4df9..2ecde26 100644
--- a/HKLib/Dto/UserDto.cs
+++ b/HKLib/Dto/UserDto.cs
@@ -1,4 +1,5 @@
-using System;
+using Newtonsoft.Json;
+using System;
using System.Collections.Generic;
using System.Text;
@@ -9,7 +10,7 @@ namespace HKLib.Dto
///
/// 机构
///
- public string Org { get; set; }
+ public string OrgId { get; set; }
///
/// 姓名
///
@@ -22,9 +23,48 @@ namespace HKLib.Dto
/// 卡号
///
public string CardNo { get; set; }
+ }
+ public class UserListDto
+ {
+ [JsonProperty("realName")]
+ public string Name { get; set; }
+ ///
+ /// 手机号
+ ///
+ [JsonProperty("phone")]
+ public string Phone { get; set; }
+ ///
+ /// 机构信息
+ ///
+ [JsonProperty("memberTagInfo")]
+ public List OrgInfo { get; set; }
+ ///
+ /// 卡集合
+ ///
+ [JsonProperty("memberCardInfo")]
+ public List Cards { get; set; }
+ }
+ public class MemberTagInfoDto
+ {
+ [JsonProperty("id")]
+ public string Id { get; set; }
+ ///
+ /// 机构名称
+ ///
+ [JsonProperty("name")]
+ public string Name { get; set; }
+ }
+ public class CardInfo
+ {
+ ///
+ /// 卡号
+ ///
+ [JsonProperty("cardNum")]
+ public string CardNum { get; set; }
///
- /// 身份证号
+ /// 卡状态 0.禁用 1.正常 2.挂失 3.作废
///
- public string IdCard { get; set; }
+ [JsonProperty("state")]
+ public int State { get; set; }
}
}
diff --git a/HKLib/Interfaces/HKLibHelper.cs b/HKLib/Interfaces/HKLibHelper.cs
index 87b5917..2f395cb 100644
--- a/HKLib/Interfaces/HKLibHelper.cs
+++ b/HKLib/Interfaces/HKLibHelper.cs
@@ -2,6 +2,8 @@
using HKLib.RabbitMQ.Config;
using HKLib.RabbitMQ.Publisher;
using Newtonsoft.Json.Linq;
+using System.Collections.Generic;
+using System.Linq;
using XExten.Advance.HttpFramework.MultiCommon;
using XExten.Advance.HttpFramework.MultiFactory;
using XExten.Advance.LinqFramework;
@@ -10,12 +12,17 @@ namespace HKLib.Interfaces
{
public class HKLibHelper
{
+ static Dictionary Header = new Dictionary {
+ {"TenantId",Configer.TenantId }
+ };
///
/// 设置刷卡时间端
///
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.JsonParam = input.ToJson();
@@ -28,12 +35,14 @@ namespace HKLib.Interfaces
///
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.JsonParam = (new { Name = input }).ToJson();
- }).Build().RunStringFirst().ToModel()["data"]["id"].ToString();
+ }).Build().RunStringFirst().ToModel()["data"]["data"]["id"].ToString();
}
///
@@ -41,55 +50,60 @@ namespace HKLib.Interfaces
///
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.JsonParam = (new { Name = input, Id = Sid }).ToJson();
- }).Build().RunStringFirst().ToModel()["isSuccess"].ToString().AsBool();
+ }).Build().RunStringFirst().ToModel()["data"]["isSuccess"].ToString().AsBool();
}
///
/// 根据用户命获取下拉用户列表
///
///
- public static string GetUserList(string keyword)
+ public static List 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()["data"]["data"].ToJson().ToModel>();
}
///
/// 添加用户
///
///
- 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()["data"]["isSuccess"].ToString().AsBool();
}
///
/// 变更卡状态 销户
///
///
- 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()["data"]["isSuccess"].ToString().AsBool();
+ if (x)
+ {
+ ServiceQueryPush.QueryPush.PushMQ(input, "CardStutasChanged", MQEnum.Top);
+ return x;
+ }
+ return false;
}
///
/// 报表数据
@@ -98,7 +112,7 @@ namespace HKLib.Interfaces
/// 1 计次就餐天消费表(每人),2每月餐段消费报表,3月餐段汇总表
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.ReqType = MultiType.POST;