TmpService.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. using System;
  2. using System.Collections.Generic;
  3. using Library;
  4. using LitJson;
  5. using System.Linq;
  6. using System.Data;
  7. using System.Threading;
  8. using MySystem.JavaProductModels;
  9. namespace MySystem
  10. {
  11. public class TmpService
  12. {
  13. public readonly static TmpService Instance = new TmpService();
  14. private TmpService()
  15. { }
  16. public void Start()
  17. {
  18. Thread th = new Thread(poscheck);
  19. th.IsBackground = true;
  20. th.Start();
  21. }
  22. private void SetLkbDeposit()
  23. {
  24. while (true)
  25. {
  26. try
  27. {
  28. string content = RedisDbconn.Instance.RPop<string>("SetLkbDepositQueue");
  29. if (!string.IsNullOrEmpty(content))
  30. {
  31. string[] data = content.Split('|');
  32. PublicImportDataService.Instance.LkbSetDeposit(data[0], decimal.Parse(data[1]));
  33. }
  34. else
  35. {
  36. Thread.Sleep(2000);
  37. }
  38. }
  39. catch (Exception ex)
  40. {
  41. Utils.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "商城订单余额支付异常");
  42. Thread.Sleep(2000);
  43. }
  44. }
  45. }
  46. public void dosomething()
  47. {
  48. string content = function.ReadInstance("jk299.txt");
  49. string[] SnNos = content.Split('\n');
  50. int count = SnNos.Length;
  51. int index = 0;
  52. foreach(string SnNo in SnNos)
  53. {
  54. index += 1;
  55. PublicImportDataService.Instance.LkbSetDeposit(SnNo, 299);
  56. function.WritePage("/look/", "progress.txt", index + "/" + count);
  57. function.WritePage("/look/", "sn.txt", SnNo);
  58. Thread.Sleep(100);
  59. }
  60. content = function.ReadInstance("jk0.txt");
  61. SnNos = content.Split('\n');
  62. count = SnNos.Length;
  63. index = 0;
  64. foreach(string SnNo in SnNos)
  65. {
  66. index += 1;
  67. PublicImportDataService.Instance.LkbSetDeposit(SnNo, 0);
  68. function.WritePage("/look/", "progress.txt", index + "/" + count);
  69. function.WritePage("/look/", "sn.txt", SnNo);
  70. Thread.Sleep(100);
  71. }
  72. }
  73. public void poscheck()
  74. {
  75. WebCMSEntities db = new WebCMSEntities();
  76. try
  77. {
  78. List<string> poslist = new List<string>();
  79. List<int> merids = new List<int>();
  80. List<string> mernos = new List<string>();
  81. //盛付通
  82. poslist = function.ReadInstance("tmpdata/11.txt").Replace("\r", "").Split('\n').ToList();
  83. function.WriteLog(poslist.Count.ToString(), "tmp盛付通临时费率");
  84. merids = db.KxsMachine.Where(m => poslist.Contains(m.PosSn) && m.BrandId == 7 && m.MerchantId > 0).ToList().Select(m => m.MerchantId).ToList();
  85. function.WriteLog(merids.Count.ToString(), "tmp盛付通临时费率");
  86. mernos = db.KxsMerchant.Where(m => merids.Contains(m.Id)).ToList().Select(m => m.MerchantNo).ToList();
  87. function.WriteLog(mernos.Count.ToString(), "tmp盛付通临时费率");
  88. foreach(string merno in mernos)
  89. {
  90. string result = SetDepositPostService.Instance.SetFeeForSft(merno, "0.6500", "3");
  91. function.WriteLog(merno + "\n" + result + "\n\n", "tmp盛付通临时费率");
  92. Thread.Sleep(500);
  93. }
  94. // //来客吧电签
  95. // poslist = function.ReadInstance("tmpdata/2.txt").Split('\n').ToList();
  96. // merids = db.KxsMachine.Where(m => poslist.Contains(m.PosSn) && m.BrandId == 15 && m.MerchantId > 0).ToList().Select(m => m.MerchantId).ToList();
  97. // mernos = db.KxsMerchant.Where(m => merids.Contains(m.Id)).ToList().Select(m => m.MerchantNo).ToList();
  98. // foreach(string merno in mernos)
  99. // {
  100. // List<string> mernoList = new List<string>();
  101. // mernoList.Add(merno);
  102. // string result = PublicImportDataService.Instance.PospFee(mernoList, "LKB_0.68+3", "联客宝0.68+3");
  103. // function.WriteLog(merno + "\n" + result + "\n\n", "tmp来客吧电签临时费率");
  104. // Thread.Sleep(500);
  105. // }
  106. // //联动电签
  107. // poslist = function.ReadInstance("tmpdata/3.txt").Split('\n').ToList();
  108. // merids = db.KxsMachine.Where(m => poslist.Contains(m.PosSn) && m.BrandId == 10 && m.MerchantId > 0).ToList().Select(m => m.MerchantId).ToList();
  109. // mernos = db.KxsMerchant.Where(m => merids.Contains(m.Id)).ToList().Select(m => m.MerchantNo).ToList();
  110. // foreach(string merno in mernos)
  111. // {
  112. // string result = SetDepositPostService.Instance.LDFeeRate(merno, "0.0065", 10, 3);
  113. // function.WriteLog(merno + "\n" + result + "\n\n", "tmp联动电签临时费率");
  114. // Thread.Sleep(500);
  115. // }
  116. // //联动大POS
  117. // poslist = function.ReadInstance("tmpdata/4.txt").Split('\n').ToList();
  118. // merids = db.KxsMachine.Where(m => poslist.Contains(m.PosSn) && m.BrandId == 11 && m.MerchantId > 0).ToList().Select(m => m.MerchantId).ToList();
  119. // mernos = db.KxsMerchant.Where(m => merids.Contains(m.Id)).ToList().Select(m => m.MerchantNo).ToList();
  120. // foreach(string merno in mernos)
  121. // {
  122. // string result = SetDepositPostService.Instance.LDFeeRate(merno, "0.0065", 11, 3);
  123. // function.WriteLog(merno + "\n" + result + "\n\n", "tmp联动大POS临时费率");
  124. // Thread.Sleep(500);
  125. // }
  126. }
  127. catch(Exception ex)
  128. {
  129. function.WriteLog(ex.ToString() + "\n\n", "tmp临时费率异常");
  130. }
  131. db.Dispose();
  132. }
  133. }
  134. }