|
|
@@ -255,6 +255,7 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
{
|
|
|
value = DesDecrypt(value);
|
|
|
value = value.Replace("null", "\"\"");
|
|
|
+ // value = "{\"SearchKey\":\"\",\"UserId\":\"216482\",\"Kind\":0,\"ActiveStatus\":0,\"TradeSort\":1,\"DateSort\":1,\"PageNum\":1,\"PageSize\":20,\"IsAct\":0,\"BrandId\":1}";
|
|
|
JsonData data = JsonMapper.ToObject(value);
|
|
|
Dictionary<string, object> Other = new Dictionary<string, object>();
|
|
|
List<Dictionary<string, object>> dataList = MyMerchantDo(value, out Other);
|
|
|
@@ -279,21 +280,21 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
int PageSize = int.Parse(function.CheckInt(data.getItem("PageSize").ToString()));
|
|
|
int PageNum = int.Parse(function.CheckInt(data.getItem("PageNum").ToString()));
|
|
|
List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
|
|
|
- IQueryable<MerchantInfo> query = maindb.MerchantInfo.Where(m => m.UserId == UserId && (m.Status == 2 || m.QueryCount == 2));
|
|
|
+ List<MerchantInfo> query = maindb.MerchantInfo.Where(m => m.UserId == UserId && (m.Status == 2 || m.QueryCount == 2)).ToList();
|
|
|
DateTime today = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(data.getItem("BrandId").ToString()))
|
|
|
{
|
|
|
BrandId = int.Parse(function.CheckInt(data.getItem("BrandId").ToString())); //品牌(0 银联 1 好哒)
|
|
|
}
|
|
|
- query = query.Where(m => m.BrandId == BrandId);
|
|
|
+ query = query.Where(m => m.BrandId == BrandId).ToList();
|
|
|
if (!string.IsNullOrEmpty(SearchKey))
|
|
|
{
|
|
|
- query = query.Where(m => m.Name.Contains(SearchKey));
|
|
|
+ query = query.Where(m => m.Name.Contains(SearchKey)).ToList();
|
|
|
}
|
|
|
if(!string.IsNullOrEmpty(CybMakerCode))
|
|
|
{
|
|
|
- query = query.Where(m => m.CybMakerCode == CybMakerCode);
|
|
|
+ query = query.Where(m => m.CybMakerCode == CybMakerCode).ToList();
|
|
|
}
|
|
|
if (Kind > 0)
|
|
|
{
|
|
|
@@ -302,12 +303,12 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
if (Kind == 2) subjectType = "SUBJECT_TYPE_ENTERPRISE";
|
|
|
if (Kind == 3) subjectType = "SUBJECT_TYPE_SMALL";
|
|
|
List<int> ids = maindb.MerchantAddInfo.Where(m => m.SubjectType == subjectType).ToList().Select(m => m.Id).ToList();
|
|
|
- query = query.Where(m => ids.Contains(m.Id));
|
|
|
+ query = query.Where(m => ids.Contains(m.Id)).ToList();
|
|
|
}
|
|
|
if (ActiveStatus > 0)
|
|
|
{
|
|
|
if (ActiveStatus == 2) ActiveStatus = 0;
|
|
|
- query = query.Where(m => m.ActivationStatus == ActiveStatus);
|
|
|
+ query = query.Where(m => m.ActivationStatus == ActiveStatus).ToList();
|
|
|
}
|
|
|
int TotalCount = query.Count();
|
|
|
int IsActNum = query.Count(m => m.IsAct == 1);
|
|
|
@@ -315,7 +316,7 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
if (IsAct > 0)
|
|
|
{
|
|
|
if (IsAct == 2) IsAct = 0;
|
|
|
- query = query.Where(m => m.IsAct == IsAct);
|
|
|
+ query = query.Where(m => m.IsAct == IsAct).ToList();
|
|
|
}
|
|
|
int ActCount = query.Count(m => m.ActivationDate == today);
|
|
|
int ProductActCount = query.Count(m => m.ActivationStatus == 1);
|
|
|
@@ -325,34 +326,36 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
{
|
|
|
if (DateSort == "1")
|
|
|
{
|
|
|
- query = query.OrderBy(m => m.TotalAmount).ThenBy(m => m.CreateDate);
|
|
|
+ query = query.OrderBy(m => m.TotalAmount).ThenBy(m => m.CreateDate).ToList();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- query = query.OrderBy(m => m.TotalAmount).ThenByDescending(m => m.CreateDate);
|
|
|
+ query = query.OrderBy(m => m.TotalAmount).ThenByDescending(m => m.CreateDate).ToList();
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (DateSort == "1")
|
|
|
{
|
|
|
- query = query.OrderByDescending(m => m.TotalAmount).ThenBy(m => m.CreateDate);
|
|
|
+ query = query.OrderByDescending(m => m.TotalAmount).ThenBy(m => m.CreateDate).ToList();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- query = query.OrderByDescending(m => m.TotalAmount).ThenByDescending(m => m.CreateDate);
|
|
|
+ query = query.OrderByDescending(m => m.TotalAmount).ThenByDescending(m => m.CreateDate).ToList();
|
|
|
}
|
|
|
}
|
|
|
if (PageNum == 1)
|
|
|
{
|
|
|
- query = query.Take(PageSize);
|
|
|
+ query = query.Take(PageSize).ToList();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
int skipNum = PageSize * (PageNum - 1);
|
|
|
- query = query.Skip(skipNum).Take(PageSize);
|
|
|
+ query = query.Skip(skipNum).Take(PageSize).ToList();
|
|
|
}
|
|
|
- foreach (var item in query.ToList())
|
|
|
+ List<int> merchantIds = query.Select(m => m.Id).ToList();
|
|
|
+ List<MerchantAmountSummay> list = maindb.MerchantAmountSummay.Where(m => merchantIds.Contains(m.MerchantId)).ToList();
|
|
|
+ foreach (MerchantInfo item in query)
|
|
|
{
|
|
|
Dictionary<string, object> curData = new Dictionary<string, object>();
|
|
|
curData.Add("MerchantName", item.Name); //商户姓名
|
|
|
@@ -360,9 +363,9 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
curData.Add("Id", item.Id); //Id
|
|
|
curData.Add("BrandId", item.BrandId); //品牌(0 银联 1 好哒)
|
|
|
curData.Add("TotalAmount", item.TotalAmount.ToString("f2")); //交易额
|
|
|
- curData.Add("TodayTrade", MerchantTradeStat.Instance.Amount(item.Id, DateTime.Now.ToString("yyyyMMdd")).ToString("f2")); //今日交易额
|
|
|
+ curData.Add("TodayTrade", MerchantTradeStat.Instance.Amount(list, item.Id, DateTime.Now.ToString("yyyyMMdd")).ToString("f2")); //今日交易额
|
|
|
curData.Add("TradeCount", item.TotalConsumeCount); //交易笔数
|
|
|
- curData.Add("TodayTradeCount", MerchantTradeStat.Instance.Count(item.Id, DateTime.Now.ToString("yyyyMMdd"))); //今日交易笔数
|
|
|
+ curData.Add("TodayTradeCount", MerchantTradeStat.Instance.Count(list, item.Id, DateTime.Now.ToString("yyyyMMdd"))); //今日交易笔数
|
|
|
dataList.Add(curData);
|
|
|
}
|
|
|
Other = new Dictionary<string, object>();
|
|
|
@@ -373,6 +376,7 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
Other.Add("UnActNum", UnActNum); //商户未激活数
|
|
|
return dataList;
|
|
|
}
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
|