|
@@ -0,0 +1,208 @@
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using Library;
|
|
|
+using MySystem.SpModels;
|
|
|
+
|
|
|
+namespace MySystem
|
|
|
+{
|
|
|
+ public class PosPushDataNewHelper
|
|
|
+ {
|
|
|
+ public readonly static PosPushDataNewHelper Instance = new PosPushDataNewHelper();
|
|
|
+ private PosPushDataNewHelper()
|
|
|
+ { }
|
|
|
+
|
|
|
+ //绑定数据
|
|
|
+ public static void Bind(Merchants mer)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Dictionary<string, object> dataContent = new Dictionary<string, object>();
|
|
|
+ dataContent.Add("pos_sn", mer.SnNo); //机具sn
|
|
|
+ dataContent.Add("mer_no", mer.MerNo); //商户号
|
|
|
+ dataContent.Add("id_card", mer.SeoKeyword); //商户身份证
|
|
|
+ dataContent.Add("mer_name", mer.MerName); //商户姓名
|
|
|
+ dataContent.Add("mer_mobile", mer.MerMobile); //商户手机号
|
|
|
+ dataContent.Add("request_id", mer.CreateTime.Value.ToString("yyyyMMddHHmmssfff") + function.get_Random(8)); //流水号
|
|
|
+ dataContent.Add("bind_time", mer.CreateTime.Value.ToString("yyyy-MM-dd HH:mm:ss")); //绑定时间
|
|
|
+ dataContent.Add("brand", mer.ProductType); //品牌
|
|
|
+ Push("bind", dataContent);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString() + "\n\n", "推送绑定数据异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public static void Bind(MerchantRecord mer)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Dictionary<string, object> dataContent = new Dictionary<string, object>();
|
|
|
+ dataContent.Add("pos_sn", mer.MerSnNo); //机具sn
|
|
|
+ dataContent.Add("mer_no", mer.MerNo); //商户号
|
|
|
+ dataContent.Add("id_card", mer.LegalIdCard); //商户身份证
|
|
|
+ dataContent.Add("mer_name", mer.MerName); //商户姓名
|
|
|
+ dataContent.Add("mer_mobile", ""); //商户手机号
|
|
|
+ dataContent.Add("request_id", mer.CreateTime.Value.ToString("yyyyMMddHHmmssfff") + function.get_Random(8)); //流水号
|
|
|
+ dataContent.Add("bind_time", mer.CreateTime.Value.ToString("yyyy-MM-dd HH:mm:ss")); //绑定时间
|
|
|
+ dataContent.Add("brand", mer.ProductType); //品牌
|
|
|
+ Push("bind", dataContent);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString() + "\n\n", "推送绑定数据异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //解绑数据
|
|
|
+ public static void UnBind(UnBindRecord mer)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Dictionary<string, object> dataContent = new Dictionary<string, object>();
|
|
|
+ dataContent.Add("pos_sn", mer.MerSnNo); //机具sn
|
|
|
+ dataContent.Add("mer_no", mer.MerNo); //商户号
|
|
|
+ dataContent.Add("request_id", DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8)); //流水号
|
|
|
+ dataContent.Add("un_bind_time", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); //绑定时间
|
|
|
+ dataContent.Add("brand", mer.ProductType); //品牌
|
|
|
+ Push("un_bind", dataContent);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString() + "\n\n", "推送解绑数据异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //换绑数据
|
|
|
+ public static void ChangeBind(ChangeBindRecord mer)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Dictionary<string, object> dataContent = new Dictionary<string, object>();
|
|
|
+ dataContent.Add("request_id", DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8)); //流水号
|
|
|
+ dataContent.Add("mer_no", mer.MerNo); //商户号
|
|
|
+ dataContent.Add("source_pos_sn", mer.MerSnNo); //来源机具sn
|
|
|
+ dataContent.Add("source_brand", mer.ProductType); //来源品牌
|
|
|
+ dataContent.Add("to_pos_sn", mer.MerNewSnNo); //兑换机具sn
|
|
|
+ dataContent.Add("to_brand", mer.ProductType); //兑换品牌
|
|
|
+ dataContent.Add("change_bind_time", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); //换绑时间
|
|
|
+ Push("change_bind", dataContent);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString() + "\n\n", "推送换绑数据异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //押金数据
|
|
|
+ public static void Deposit(ActivateRecord act)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Dictionary<string, object> dataContent = new Dictionary<string, object>();
|
|
|
+ dataContent.Add("pos_sn", act.SnNo); //机具sn
|
|
|
+ dataContent.Add("mer_no", act.MerNo); //商户号
|
|
|
+ dataContent.Add("request_id", DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8)); //流水号
|
|
|
+ dataContent.Add("deposit_amount", act.SeoTitle); //押金金额
|
|
|
+ dataContent.Add("trade_time", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); //交易时间
|
|
|
+ dataContent.Add("brand", act.ProductType); //品牌
|
|
|
+ Push("deposit", dataContent);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString() + "\n\n", "推送押金数据异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public static void Deposit(TradeRecord trade)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Dictionary<string, object> dataContent = new Dictionary<string, object>();
|
|
|
+ dataContent.Add("pos_sn", trade.TradeSnNo); //机具sn
|
|
|
+ dataContent.Add("mer_no", trade.MerNo); //商户号
|
|
|
+ dataContent.Add("request_id", DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8)); //流水号
|
|
|
+ dataContent.Add("deposit_amount", trade.TradeAmount); //押金金额
|
|
|
+ dataContent.Add("trade_time", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); //交易时间
|
|
|
+ dataContent.Add("brand", trade.ProductType); //品牌
|
|
|
+ Push("deposit", dataContent);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString() + "\n\n", "推送押金数据异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //激活数据
|
|
|
+ public static void Active(ActivateRecord act)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Dictionary<string, object> dataContent = new Dictionary<string, object>();
|
|
|
+ dataContent.Add("pos_sn", act.SnNo); //机具sn
|
|
|
+ dataContent.Add("mobile", act.MerMobile); //商户号
|
|
|
+ dataContent.Add("request_id", DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8)); //流水号
|
|
|
+ dataContent.Add("activation_time", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); //激活时间
|
|
|
+ dataContent.Add("brand", act.ProductType); //品牌
|
|
|
+ Push("active", dataContent);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString() + "\n\n", "推送激活数据异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //交易数据
|
|
|
+ public static void Trade(TradeRecord trade)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ int QrPayFlag = 0;
|
|
|
+ if (trade.ProductType == "1")
|
|
|
+ {
|
|
|
+ if (trade.TradeType == "02") QrPayFlag = 1;
|
|
|
+ }
|
|
|
+ else if (trade.ProductType == "2")
|
|
|
+ {
|
|
|
+ if (trade.TradeType == "CLOUD_PAY") QrPayFlag = 1;
|
|
|
+ }
|
|
|
+ else if (trade.ProductType == "4")
|
|
|
+ {
|
|
|
+ if (trade.TradeType == "200") QrPayFlag = 1;
|
|
|
+ }
|
|
|
+ else if (trade.ProductType == "8" || trade.ProductType == "9")
|
|
|
+ {
|
|
|
+ if (trade.TradeType == "200") QrPayFlag = 1;
|
|
|
+ }
|
|
|
+ else if (trade.ProductType == "10" || trade.ProductType == "11")
|
|
|
+ {
|
|
|
+ if (trade.TradeType == "F010") QrPayFlag = 1;
|
|
|
+ }
|
|
|
+ else if (trade.ProductType == "12") //盒易付
|
|
|
+ {
|
|
|
+ if (trade.Field3 == "1") QrPayFlag = 1;
|
|
|
+ }
|
|
|
+ Dictionary<string, object> dataContent = new Dictionary<string, object>();
|
|
|
+ dataContent.Add("pos_sn", trade.TradeSnNo); //机具sn
|
|
|
+ dataContent.Add("mer_no", trade.MerNo); //商户号
|
|
|
+ dataContent.Add("request_id", trade.TradeSerialNo); //流水号
|
|
|
+ dataContent.Add("trade_amount", trade.TradeAmount); //交易金额
|
|
|
+ dataContent.Add("trade_time", trade.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //交易时间
|
|
|
+ dataContent.Add("brand", trade.ProductType); //品牌
|
|
|
+ dataContent.Add("card_type", trade.BankCardType); //卡类型
|
|
|
+ dataContent.Add("qr_pay_flag", QrPayFlag); //云闪付标记
|
|
|
+ Push("trade", dataContent);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString() + "\n\n", "推送交易数据异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void Push(string dataType, Dictionary<string, object> dataContent)
|
|
|
+ {
|
|
|
+ Dictionary<string, object> data = new Dictionary<string, object>();
|
|
|
+ data.Add("data_type", dataType);
|
|
|
+ data.Add("data_content", dataContent);
|
|
|
+ RedisDbconn.Instance.AddList("KxsPosDataQueue", Newtonsoft.Json.JsonConvert.SerializeObject(data));
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|