jobServiceBLL.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. using Business.Util;
  2. using Common;
  3. using Models;
  4. using Models.Entity.LotteryNumDB;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. namespace Business.KJH
  11. {
  12. public class jobServiceBLL
  13. {
  14. public List<LotteryData> GetLotteryListAsync(List<LotteryCode> TypeList)
  15. {
  16. try
  17. {
  18. if (TypeList==null)
  19. {
  20. return new List<LotteryData>();
  21. }
  22. List<LotteryData> list = new List<LotteryData>(200);
  23. lock (list)
  24. {
  25. Parallel.For(0, TypeList.Count, new ParallelOptions() { MaxDegreeOfParallelism = 20 }, item =>
  26. {
  27. SCCLottery em = (SCCLottery)Enum.Parse(typeof(SCCLottery), TypeList[item].lotteryCode);
  28. string menuname = "";
  29. if (TypeList[item].lotteryCode.Contains("QG"))
  30. {
  31. menuname = "qgc";
  32. }
  33. else if (TypeList[item].lotteryCode.Contains("DF"))
  34. {
  35. menuname = "dfc";
  36. }
  37. else if (TypeList[item].lotteryCode.Contains("11x5"))
  38. {
  39. menuname = "c11x5";
  40. }
  41. else if (TypeList[item].lotteryCode.Contains("KL10F"))
  42. {
  43. menuname = "klsf";
  44. }
  45. else if (TypeList[item].lotteryCode.Contains("SSC")|| TypeList[item].lotteryCode.Contains("SSL"))
  46. {
  47. menuname = "ssc";
  48. }
  49. else if (TypeList[item].lotteryCode.Contains("KL12"))
  50. {
  51. menuname = "kl12";
  52. }
  53. else if (em == SCCLottery.GP_KLPK3_ShanDong)
  54. {
  55. menuname = "qt";
  56. }
  57. else if (em == SCCLottery.GP_QYH_ShanDong)
  58. {
  59. menuname = "klsf";
  60. }
  61. else if (TypeList[item].lotteryCode.Contains("K3"))
  62. {
  63. menuname = "k3";
  64. }
  65. else
  66. {
  67. menuname = "qt";
  68. }
  69. var data = KJBLL.GetLastItem<OpenCode21Model>(em);
  70. if (data==null)
  71. {
  72. }
  73. else
  74. {
  75. var ary = Array.ConvertAll<string, int>(data.GetCodeStr().Split(',').ToArray(), s => int.Parse(s));
  76. var tmp = LottryDataHandle.GetLotteryData(TypeList[item].lotteryCode, int.Parse(data.Term.ToString()), data.OpenTime, data.ID, ary, data.Spare, menuname, data.KaiJiHao == null ? "" : data.KaiJiHao == null ? "" : data.KaiJiHao, data.ShiJiHao);
  77. if (tmp!=null)
  78. {
  79. list.Add(tmp);
  80. }
  81. }
  82. });
  83. }
  84. for (int i = 0; i < list.Count; i++)
  85. {
  86. var lottery = Enum.Parse(typeof(SCCLottery), list[i].LotteryType);
  87. if (ZSlotterType.TypeOfNameDict.Keys.Contains(list[i].LotteryType))
  88. {
  89. list[i].HasLotteryZS = true;
  90. }
  91. list[i].LotteryText = EnumHelper.GetLotteryText((SCCLottery)lottery);
  92. }
  93. return list;
  94. }
  95. catch (Exception ee)
  96. {
  97. LogHelper.Error(typeof(jobServiceBLL), ee.Message + "GetLotteryListAsync");
  98. return null;
  99. }
  100. }
  101. }
  102. }