MerchantAmountSummayUtil.cs 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using MySystem.MainModels;
  2. using Library;
  3. using MySystem.Service.Main;
  4. using System.Collections.Generic;
  5. using System;
  6. namespace MySystem
  7. {
  8. /// <summary>
  9. /// 商户业绩统计工具类
  10. /// </summary>
  11. public class MerchantAmountSummayUtil
  12. {
  13. #region 已激活商户-达标信息列表
  14. /// <summary>
  15. /// 已激活商户-达标信息列表
  16. /// </summary>
  17. /// <param name="MerchantId">商户Id</param>
  18. /// <param name="PageSize">条数</param>
  19. /// <param name="PageNum">页数</param>
  20. /// <returns></returns>
  21. public static List<Dictionary<string, object>> ListDo(int MerchantId, int PageSize, int PageNum)
  22. {
  23. List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
  24. var query = new MerchantDepositOrderService().QueryByMerchantId(MerchantId);
  25. if (query.Id > 0)
  26. {
  27. var month = DateTime.Parse(query.UpdateDate.Value.ToString("yyyy-MM-dd HH:mm:ss"));
  28. var TradeMonth = "";
  29. var TradeTime = "";
  30. Dictionary<string, string> dic = new Dictionary<string, string>();
  31. for (int i = 0; i < 10; i++)
  32. {
  33. var Status = 0;//活动交易状态
  34. decimal TradeAmount = 0.00M;
  35. TradeMonth = month.AddMonths(i + 1).ToString("yyyy-MM");
  36. TradeTime = month.AddMonths(i + 1).ToString("yyyyMM");
  37. //测试指定激活时间
  38. // TradeMonth = (int.Parse("202307") + i + 1).ToString();
  39. // TradeTime = (int.Parse("202307") + i + 1).ToString();
  40. var check = new MerchantAmountSummayService().QueryAmount("TradeAmount", " and IsAct=1 and TradeMonth='" + TradeTime + "' and MerchantId=" + MerchantId + "");
  41. if (check.Count > 0)
  42. {
  43. dic = new MerchantAmountSummayService().Sum("TradeAmount", " and IsAct=1 and TradeMonth='" + TradeTime + "' and MerchantId=" + MerchantId + "");
  44. TradeAmount = decimal.Parse(dic["TradeAmount"].ToString());
  45. }
  46. //待考核
  47. if (int.Parse(DateTime.Now.ToString("yyyyMM")) < int.Parse(TradeTime))
  48. // if (int.Parse("202310") < int.Parse(TradeTime))//测试指定当前时间
  49. {
  50. Status = 0;
  51. }
  52. else
  53. {
  54. //考核中
  55. if (DateTime.Now.ToString("yyyyMM") == TradeTime)
  56. {
  57. Status = 1;
  58. }
  59. else
  60. {
  61. //已通过
  62. if (TradeAmount >= 10000 && check.Count > 0) Status = 2;
  63. //未通过
  64. if (TradeAmount < 10000 && check.Count >= 0) Status = -1;
  65. }
  66. }
  67. Dictionary<string, object> curData = new Dictionary<string, object>();
  68. curData.Add("TradeMonth", TradeMonth); //月份
  69. curData.Add("TradeAmount", TradeAmount); //订单金额
  70. curData.Add("Status", Status); //状态(-1 未通过 0 待考核 1 考核中 2 已通过 3 未参与)
  71. dataList.Add(curData);
  72. }
  73. }
  74. return dataList;
  75. }
  76. #endregion
  77. }
  78. }