TmpService.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. List<string> poslist = new List<string>();
  77. List<int> merids = new List<int>();
  78. List<string> mernos = new List<string>();
  79. //盛付通
  80. poslist = function.ReadInstance("tmpdata/1.txt").Split('\n').ToList();
  81. merids = db.KxsMachine.Where(m => poslist.Contains(m.PosSn) && m.BrandId == 7 && m.MerchantId > 0).ToList().Select(m => m.MerchantId).ToList();
  82. mernos = db.KxsMerchant.Where(m => merids.Contains(m.Id)).ToList().Select(m => m.MerchantNo).ToList();
  83. foreach(string merno in mernos)
  84. {
  85. string result = SetDepositPostService.Instance.SetFeeForSft(merno, "0.6500", "3");
  86. function.WriteLog(merno + "\n" + result + "\n\n", "盛付通临时费率");
  87. Thread.Sleep(500);
  88. }
  89. //来客吧电签
  90. poslist = function.ReadInstance("tmpdata/2.txt").Split('\n').ToList();
  91. merids = db.KxsMachine.Where(m => poslist.Contains(m.PosSn) && m.BrandId == 15 && m.MerchantId > 0).ToList().Select(m => m.MerchantId).ToList();
  92. mernos = db.KxsMerchant.Where(m => merids.Contains(m.Id)).ToList().Select(m => m.MerchantNo).ToList();
  93. foreach(string merno in mernos)
  94. {
  95. List<string> mernoList = new List<string>();
  96. mernoList.Add(merno);
  97. string result = PublicImportDataService.Instance.PospFee(mernoList, "", "");
  98. function.WriteLog(merno + "\n" + result + "\n\n", "来客吧电签临时费率");
  99. Thread.Sleep(500);
  100. }
  101. //联动电签
  102. poslist = function.ReadInstance("tmpdata/3.txt").Split('\n').ToList();
  103. merids = db.KxsMachine.Where(m => poslist.Contains(m.PosSn) && m.BrandId == 10 && m.MerchantId > 0).ToList().Select(m => m.MerchantId).ToList();
  104. mernos = db.KxsMerchant.Where(m => merids.Contains(m.Id)).ToList().Select(m => m.MerchantNo).ToList();
  105. foreach(string merno in mernos)
  106. {
  107. string result = SetDepositPostService.Instance.LDFeeRate(merno, "0.0065", 10, 3);
  108. function.WriteLog(merno + "\n" + result + "\n\n", "联动电签临时费率");
  109. Thread.Sleep(500);
  110. }
  111. //联动大POS
  112. poslist = function.ReadInstance("tmpdata/4.txt").Split('\n').ToList();
  113. merids = db.KxsMachine.Where(m => poslist.Contains(m.PosSn) && m.BrandId == 11 && m.MerchantId > 0).ToList().Select(m => m.MerchantId).ToList();
  114. mernos = db.KxsMerchant.Where(m => merids.Contains(m.Id)).ToList().Select(m => m.MerchantNo).ToList();
  115. foreach(string merno in mernos)
  116. {
  117. string result = SetDepositPostService.Instance.LDFeeRate(merno, "0.0065", 11, 3);
  118. function.WriteLog(merno + "\n" + result + "\n\n", "联动大POS临时费率");
  119. Thread.Sleep(500);
  120. }
  121. db.Dispose();
  122. }
  123. }
  124. }