MerchantAmountSummayUtil.cs 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. var Status = 0;//活动交易状态
  26. if (query.Id > 0)
  27. {
  28. var month = DateTime.Parse(query.UpdateDate.Value.ToString("yyyy-MM-dd HH:mm:ss"));
  29. var TradeMonth = "";
  30. decimal TradeAmount = 0.00M;
  31. Dictionary<string, string> dic = new Dictionary<string, string>();
  32. for (int i = 0; i < 10; i++)
  33. {
  34. TradeMonth = month.AddMonths(i + 1).ToString("yyyy-MM");
  35. var check = new MerchantAmountSummayService().QueryAmount("TradeAmount", " and IsAct=1 and TradeMonth='" + TradeMonth + "' and MerchantId=" + MerchantId + "");
  36. if (check.Count > 0)
  37. {
  38. dic = new MerchantAmountSummayService().Sum("TradeAmount", " and IsAct=1 and TradeMonth='" + TradeMonth + "'");
  39. TradeAmount = decimal.Parse(dic["TradeAmount"].ToString());
  40. }
  41. else
  42. {
  43. //考核中
  44. if (DateTime.Now.ToString("yyyy-MM") == TradeMonth) Status = 1;
  45. //待考核
  46. if (int.Parse(DateTime.Now.ToString("yyyyMM")) < int.Parse(month.ToString("yyyyMM"))) Status = 0;
  47. //已通过
  48. if (TradeAmount >= 10000 && check.Count > 0) Status = 2;
  49. //未通过
  50. if (TradeAmount < 10000 && check.Count > 0) Status = -1;
  51. Dictionary<string, object> curData = new Dictionary<string, object>();
  52. curData.Add("TradeMonth", TradeMonth); //月份
  53. curData.Add("TradeAmount", TradeAmount); //订单金额
  54. curData.Add("Status", Status); //状态(-1 未通过 0 待考核 1 考核中 2 已通过 3 未参与)
  55. dataList.Add(curData);
  56. }
  57. }
  58. }
  59. return dataList;
  60. }
  61. #endregion
  62. }
  63. }