| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312 |
- using System;
- using System.Collections.Generic;
- using Library;
- using LitJson;
- using System.Linq;
- using System.Data;
- using System.Threading;
- using MySystem.JavaProductModels;
- namespace MySystem
- {
- public class TmpService
- {
- public readonly static TmpService Instance = new TmpService();
- private TmpService()
- { }
- public void Start()
- {
- Thread th = new Thread(poscheck);
- th.IsBackground = true;
- th.Start();
- }
- private void SetLkbDeposit()
- {
- while (true)
- {
- try
- {
- string content = RedisDbconn.Instance.RPop<string>("SetLkbDepositQueue");
- if (!string.IsNullOrEmpty(content))
- {
- string[] data = content.Split('|');
- PublicImportDataService.Instance.LkbSetDeposit(data[0], decimal.Parse(data[1]));
- }
- else
- {
- Thread.Sleep(2000);
- }
- }
- catch (Exception ex)
- {
- Utils.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "商城订单余额支付异常");
- Thread.Sleep(2000);
- }
- }
- }
- public void dosomething()
- {
- string content = function.ReadInstance("jk299.txt");
- string[] SnNos = content.Split('\n');
- int count = SnNos.Length;
- int index = 0;
- foreach(string SnNo in SnNos)
- {
- index += 1;
- PublicImportDataService.Instance.LkbSetDeposit(SnNo, 299);
- function.WritePage("/look/", "progress.txt", index + "/" + count);
- function.WritePage("/look/", "sn.txt", SnNo);
- Thread.Sleep(100);
- }
- content = function.ReadInstance("jk0.txt");
- SnNos = content.Split('\n');
- count = SnNos.Length;
- index = 0;
- foreach(string SnNo in SnNos)
- {
- index += 1;
- PublicImportDataService.Instance.LkbSetDeposit(SnNo, 0);
- function.WritePage("/look/", "progress.txt", index + "/" + count);
- function.WritePage("/look/", "sn.txt", SnNo);
- Thread.Sleep(100);
- }
- }
- public void poscheck()
- {
- if(RedisDbconn.Instance.Get<string>("TmpService_poscheck_flag3") == "1")
- {
- return;
- }
- RedisDbconn.Instance.Set("TmpService_poscheck_flag3", "1");
- WebCMSEntities db = new WebCMSEntities();
- try
- {
- List<string> poslist = new List<string>();
- List<int> merids = new List<int>();
- List<string> mernos = new List<string>();
- //金控
- // poslist = function.ReadInstance("tmpdata/jk.txt").Replace("\r", "").Split('\n').ToList();
- // foreach(string pos in poslist)
- // {
- // string result = PublicImportDataService.Instance.LkbSetFee(pos, 2.99M, 300);
- // function.WriteLog(pos + "\n" + result + "\n\n", "tmp金控临时费率");
- // Thread.Sleep(500);
- // }
- // //盛付通
- // poslist = function.ReadInstance("tmpdata/1.txt").Replace("\r", "").Split('\n').ToList();
- // List<string> without1 = function.ReadInstance("tmpdata/sft1.txt").Replace("\r", "").Split('\n').ToList();
- // List<string> without2 = function.ReadInstance("tmpdata/sft2.txt").Replace("\r", "").Split('\n').ToList();
- // List<string> without3 = function.ReadInstance("tmpdata/11.txt").Replace("\r", "").Split('\n').ToList();
- // function.WriteLog(poslist.Count.ToString(), "tmp盛付通临时费率");
- // merids = db.KxsMachine.Where(m => poslist.Contains(m.PosSn) && !without1.Contains(m.PosSn) && !without2.Contains(m.PosSn) && !without3.Contains(m.PosSn) && m.BrandId == 7 && m.MerchantId > 0).ToList().Select(m => m.MerchantId).ToList();
- // function.WriteLog(merids.Count.ToString(), "tmp盛付通临时费率");
- // mernos = db.KxsMerchant.Where(m => merids.Contains(m.Id)).ToList().Select(m => m.MerchantNo).ToList();
- // function.WriteLog(mernos.Count.ToString(), "tmp盛付通临时费率");
- // foreach(string merno in mernos)
- // {
- // if(int.Parse(DateTime.Now.ToString("HHmm")) < 2100)
- // {
- // string result = SetDepositPostService.Instance.SetFeeForSft(merno, "0.6500", "3");
- // function.WriteLog(merno + "\n" + DateTime.Now.ToString() + "\n" + result + "\n\n", "tmp盛付通临时费率");
- // Thread.Sleep(500);
- // }
- // else
- // {
- // function.WriteLog(merno, "tmp盛付通临时费率POSN");
- // }
- // }
- // List<string> list = function.ReadInstance("tmpdata/sft3.txt").Replace("\r", "").Split('\n').ToList();
- // foreach(string merno in list)
- // {
- // string result = SetDepositPostService.Instance.SetFeeForSft(merno, "0.6500", "3");
- // function.WriteLog(merno + "\n" + DateTime.Now.ToString() + "\n" + result + "\n\n", "tmp盛付通临时费率");
- // Thread.Sleep(500);
- // }
- // poslist = function.ReadInstance("tmpdata/sft1.txt").Replace("\r", "").Split('\n').ToList();
- // function.WriteLog(poslist.Count.ToString(), "tmp盛付通临时费率");
- // merids = db.KxsMachine.Where(m => poslist.Contains(m.PosSn) && m.BrandId == 7 && m.MerchantId > 0).ToList().Select(m => m.MerchantId).ToList();
- // function.WriteLog(merids.Count.ToString(), "tmp盛付通临时费率");
- // mernos = db.KxsMerchant.Where(m => merids.Contains(m.Id)).ToList().Select(m => m.MerchantNo).ToList();
- // function.WriteLog(mernos.Count.ToString(), "tmp盛付通临时费率");
- // foreach(string merno in mernos)
- // {
- // string result = SetDepositPostService.Instance.SetFeeForSft(merno, "0.6300", "0");
- // function.WriteLog(merno + "\n" + result + "\n\n", "tmp盛付通临时费率");
- // Thread.Sleep(500);
- // }
- // poslist = function.ReadInstance("tmpdata/sft2.txt").Replace("\r", "").Split('\n').ToList();
- // function.WriteLog(poslist.Count.ToString(), "tmp盛付通临时费率");
- // merids = db.KxsMachine.Where(m => poslist.Contains(m.PosSn) && m.BrandId == 7 && m.MerchantId > 0).ToList().Select(m => m.MerchantId).ToList();
- // function.WriteLog(merids.Count.ToString(), "tmp盛付通临时费率");
- // mernos = db.KxsMerchant.Where(m => merids.Contains(m.Id)).ToList().Select(m => m.MerchantNo).ToList();
- // function.WriteLog(mernos.Count.ToString(), "tmp盛付通临时费率");
- // foreach(string merno in mernos)
- // {
- // string result = SetDepositPostService.Instance.SetFeeForSft(merno, "0.6000", "0");
- // function.WriteLog(merno + "\n" + result + "\n\n", "tmp盛付通临时费率");
- // Thread.Sleep(500);
- // }
- //来客吧电签
- // poslist = function.ReadInstance("tmpdata/lkbdq.txt").Split('\n').ToList();
- // merids = db.KxsMachine.Where(m => poslist.Contains(m.PosSn) && m.BrandId == 15 && m.MerchantId > 0).ToList().Select(m => m.MerchantId).ToList();
- // mernos = db.KxsMerchant.Where(m => merids.Contains(m.Id)).ToList().Select(m => m.MerchantNo).ToList();
- // foreach(string merno in poslist)
- // {
- // List<string> mernoList = new List<string>();
- // mernoList.Add(merno);
- // string result = PublicImportDataService.Instance.PospFee(mernoList, "LKB_0.65+3", "联客宝0.65+3");
- // function.WriteLog(merno + "\n" + result + "\n\n", "tmp来客吧电签临时费率");
- // Thread.Sleep(500);
- // }
- // poslist = function.ReadInstance("tmpdata/lkbdq0.txt").Split('\n').ToList();
- // merids = db.KxsMachine.Where(m => poslist.Contains(m.PosSn) && m.BrandId == 15 && m.MerchantId > 0).ToList().Select(m => m.MerchantId).ToList();
- // mernos = db.KxsMerchant.Where(m => merids.Contains(m.Id)).ToList().Select(m => m.MerchantNo).ToList();
- // foreach(string merno in poslist)
- // {
- // List<string> mernoList = new List<string>();
- // mernoList.Add(merno);
- // string result = PublicImportDataService.Instance.PospFee(mernoList, "LKB_0.65", "联客宝0.65");
- // function.WriteLog(merno + "\n" + result + "\n\n", "tmp来客吧电签临时费率0");
- // Thread.Sleep(500);
- // }
- // //联动电签
- // poslist = function.ReadInstance("tmpdata/3.txt").Split('\n').ToList();
- // merids = db.KxsMachine.Where(m => poslist.Contains(m.PosSn) && m.BrandId == 10 && m.MerchantId > 0).ToList().Select(m => m.MerchantId).ToList();
- // mernos = db.KxsMerchant.Where(m => merids.Contains(m.Id)).ToList().Select(m => m.MerchantNo).ToList();
- // foreach(string merno in mernos)
- // {
- // string result = SetDepositPostService.Instance.LDFeeRate(merno, "0.0065", 10, 3);
- // function.WriteLog(merno + "\n" + result + "\n\n", "tmp联动电签临时费率");
- // Thread.Sleep(500);
- // }
- // //联动大POS
- // poslist = function.ReadInstance("tmpdata/4.txt").Split('\n').ToList();
- // merids = db.KxsMachine.Where(m => poslist.Contains(m.PosSn) && m.BrandId == 11 && m.MerchantId > 0).ToList().Select(m => m.MerchantId).ToList();
- // mernos = db.KxsMerchant.Where(m => merids.Contains(m.Id)).ToList().Select(m => m.MerchantNo).ToList();
- // foreach(string merno in mernos)
- // {
- // string result = SetDepositPostService.Instance.LDFeeRate(merno, "0.0065", 11, 3);
- // function.WriteLog(merno + "\n" + result + "\n\n", "tmp联动大POS临时费率");
- // Thread.Sleep(500);
- // }
- //立刷微电签
- poslist = function.ReadInstance("tmpdata/lswdq.txt").Split('\n').ToList();
- var poses = db.KxsMachine.Where(m => poslist.Contains(m.PosSn) && m.BrandId == 22 && m.MerchantId > 0).ToList();
- merids = poses.Select(m => m.MerchantId).ToList();
- var mers = db.KxsMerchant.Where(m => merids.Contains(m.Id)).ToList();
- foreach(var pos in poses)
- {
- var mer = mers.FirstOrDefault(m => m.Id == pos.MerchantId);
- if(mer != null)
- {
- // string result = PublicImportDataService.Instance.SetLiSWeFee(pos.PosSn, mer.MerchantNo, "0.63", "300");
- string result = PublicImportDataService.Instance.SetLiSWeFee(pos.PosSn, mer.MerchantNo, "0.63", "0");
- function.WriteLog(pos.PosSn + "\n" + mer.MerchantNo + "\n" + result + "\n\n", "tmp立刷微电签临时费率");
- Thread.Sleep(500);
- }
- }
- //立刷微智能
- poslist = function.ReadInstance("tmpdata/liwzn.txt").Replace("\r", "").Split('\n').ToList();
- foreach(string pos in poslist)
- {
- string[] parts = pos.Split('|');
- string result = PublicImportDataService.Instance.SetLiSWeFee(parts[0], parts[1], "0.63", "0");
- function.WriteLog(parts[0] + "\n" + parts[1] + "\n" + result + "\n\n", "tmp立刷微智能临时费率");
- Thread.Sleep(1500);
- }
- //联动力POS
- // mernos = function.ReadInstance("tmpdata/zzb.txt").Replace("\r", "").Split('\n').ToList();
- // foreach(string merno in mernos)
- // {
- // // string content = SetDepositPostService.Instance.LDZZBFeeRate(merno, 0.68M, 3);
- // string content = SetDepositPostService.Instance.LDZZBFeeRate(merno, 0.68M, 0);
- // if(content.Contains("encryptKey"))
- // {
- // JsonData jsonObj = JsonMapper.ToObject(content);
- // string aesKey = jsonObj["encryptKey"].ToString();
- // aesKey = SetDepositPostService.Instance.LDZZBDecrypt(aesKey);
- // content += SetDepositPostService.Instance.AesDecrypt(jsonObj["data"].ToString(), aesKey);
- // }
- // function.WriteLog(merno + "\n" + content + "\n\n", "tmp联动力POS临时费率");
- // Thread.Sleep(1000);
- // }
- //盒易付
- // mernos = function.ReadInstance("tmpdata/hyf.txt").Replace("\r", "").Split('\n').ToList();
- // foreach(string merno in mernos)
- // {
- // string content = SetDepositPostService.Instance.BoxFee(merno, "0.65");
- // function.WriteLog(merno + "\n" + content + "\n\n", "tmp盒易付临时费率");
- // Thread.Sleep(1000);
- // }
- //批量查询立刷费率
- // poslist = function.ReadInstance("tmpdata/lishua.txt").Split('\n').ToList();
- // foreach(var pos in poslist)
- // {
- // string rateNum = "0";
- // string feeNum = "0";
- // string[] data = pos.Split('|');
- // string content = PublicImportDataService.Instance.QueryLiSDeposit(data[1], "");
- // JsonData jsonObj = JsonMapper.ToObject(content);
- // if(jsonObj["ret_code"].ToString() == "00")
- // {
- // JsonData feeList = jsonObj["feeList"];
- // foreach (JsonData fee in feeList)
- // {
- // string feeCalcType = fee["feeCalcType"].ToString();
- // if(feeCalcType == "M5" || feeCalcType == "T0")
- // {
- // string rate = fee["rate"].ToString();
- // if(feeCalcType == "M5")
- // {
- // rateNum = rate;
- // }
- // else if(feeCalcType == "T0")
- // {
- // feeNum = rate;
- // }
- // }
- // }
- // function.WriteLog("" + data[0] + "|" + data[1] + "|" + rateNum + "|" + feeNum, "tmp立刷费率批量查询");
- // }
- // else
- // {
- // function.WriteLog("" + data[0] + "|" + data[1] + "|" + content, "tmp立刷费率批量查询");
- // }
- // }
- }
- catch(Exception ex)
- {
- function.WriteLog(ex.ToString() + "\n\n", "tmp临时费率异常");
- }
- db.Dispose();
- }
- }
- }
|