|
@@ -130,12 +130,10 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
public List<Dictionary<string, object>> MyMerchantDo(string value, out Dictionary<string, object> Other)
|
|
|
{
|
|
|
JsonData data = JsonMapper.ToObject(value);
|
|
|
+ string SearchKey = data["SearchKey"].ToString(); //搜索关键词
|
|
|
int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
|
|
|
- int ProductType = int.Parse(function.CheckInt(data["ProductType"].ToString())); //产品类型
|
|
|
int ActiveStatus = int.Parse(function.CheckInt(data["ActiveStatus"].ToString())); //商户激活状态
|
|
|
- decimal MinTrade = decimal.Parse(function.CheckNum(data["MinTrade"].ToString())); //本月交易额最低值
|
|
|
- decimal MaxTrade = decimal.Parse(function.CheckNum(data["MaxTrade"].ToString())); //本月交易额最高值
|
|
|
- string ActTime = data["ActTime"].ToString(); //激活时间
|
|
|
+ int Kind = int.Parse(function.CheckInt(data["Kind"].ToString()));
|
|
|
string Sort = data["Sort"].ToString(); //排序
|
|
|
int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
|
|
|
int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
|
|
@@ -147,36 +145,15 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
int ProductCount = query.Count();
|
|
|
int ProductActCount = query.Count(m => m.ActivationStatus == 1);
|
|
|
int ProductUnActCount = ProductCount - ProductActCount;
|
|
|
- // if (ProductType > 0)
|
|
|
- // {
|
|
|
- // if (ProductType == 1)
|
|
|
- // {
|
|
|
- // query = query.Where(m => m.QueryCount > 0).ToList();
|
|
|
- // }
|
|
|
- // else if (ProductType == 2)
|
|
|
- // {
|
|
|
- // query = query.Where(m => m.Status > 0).ToList();
|
|
|
- // }
|
|
|
- // }
|
|
|
+ if (!string.IsNullOrEmpty(SearchKey))
|
|
|
+ {
|
|
|
+ query = query.Where(m => m.Name.Contains(SearchKey));
|
|
|
+ }
|
|
|
if (ActiveStatus > 0)
|
|
|
{
|
|
|
if (ActiveStatus == 2) ActiveStatus = 0;
|
|
|
query = query.Where(m => m.ActivationStatus == ActiveStatus);
|
|
|
}
|
|
|
- if (MinTrade > 0)
|
|
|
- {
|
|
|
- query = query.Where(m => m.TotalAmount >= MinTrade);
|
|
|
- }
|
|
|
- if (MaxTrade > 0)
|
|
|
- {
|
|
|
- query = query.Where(m => m.TotalAmount <= MaxTrade);
|
|
|
- }
|
|
|
- if (!string.IsNullOrEmpty(ActTime))
|
|
|
- {
|
|
|
- DateTime Start = DateTime.Parse(ActTime + "-01-01 00:00:00");
|
|
|
- DateTime End = Start.AddYears(1);
|
|
|
- query = query.Where(m => m.ActivationDate >= Start && m.ActivationDate < End);
|
|
|
- }
|
|
|
if (Sort == "trade")
|
|
|
{
|
|
|
query = query.OrderByDescending(m => m.TotalAmount);
|
|
@@ -196,20 +173,20 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
}
|
|
|
foreach (var item in query.ToList())
|
|
|
{
|
|
|
- MerchantInfo subdata = MerchantInfoDbconn.Instance.Get(item.Id) ?? new MerchantInfo();
|
|
|
Dictionary<string, object> curData = new Dictionary<string, object>();
|
|
|
- curData.Add("MerchantName", subdata.Name); //商户姓名
|
|
|
- curData.Add("KqRegTime", subdata.CreateDate == null ? "" : subdata.CreateDate.Value.ToString("yyyy-MM-dd")); //渠道注册时间
|
|
|
+ curData.Add("MerchantName", item.Name); //商户姓名
|
|
|
+ curData.Add("KqRegTime", item.CreateDate == null ? "" : item.CreateDate.Value.ToString("yyyy-MM-dd")); //渠道注册时间
|
|
|
curData.Add("Id", item.Id); //Id
|
|
|
- curData.Add("ThisMonthTrade", item.TotalAmount); //当月交易额
|
|
|
+ curData.Add("TotalAmount", item.TotalAmount); //交易额
|
|
|
+ curData.Add("TodayTrade", 0); //今日交易额
|
|
|
+ curData.Add("TradeCount", 0); //交易笔数
|
|
|
+ curData.Add("TodayTradeCount", 0); //今日交易笔数
|
|
|
dataList.Add(curData);
|
|
|
}
|
|
|
Other = new Dictionary<string, object>();
|
|
|
Other.Add("TotalCount", TotalCount); //商户数
|
|
|
- Other.Add("ActCount", ActCount); //商户激活数
|
|
|
- Other.Add("ProductCount", ProductCount); //当前产品商户总数
|
|
|
- Other.Add("ProductActCount", ProductActCount); //当前产品已激活数
|
|
|
- Other.Add("ProductUnActCount", ProductUnActCount); //当前产品未激活数
|
|
|
+ Other.Add("ActCount", ActCount); //商户达标数
|
|
|
+ Other.Add("UnActCount", ProductUnActCount); //未达标数
|
|
|
return dataList;
|
|
|
}
|
|
|
#endregion
|
|
@@ -232,22 +209,102 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
int Id = int.Parse(function.CheckInt(data["Id"].ToString()));
|
|
|
MerchantInfo merchant = MerchantInfoDbconn.Instance.Get(Id) ?? new MerchantInfo();
|
|
|
MerchantAddInfo addinfo = MerchantAddInfoDbconn.Instance.Get(Id) ?? new MerchantAddInfo();
|
|
|
- // MerchantAddInfoController controller = new MerchantAddInfoController(_accessor, _logger, _setting);
|
|
|
Obj.Add("MerchantName", merchant.Name); //商户名称
|
|
|
- // Obj.Add("MainType", controller.GetSubjects()[addinfo.SubjectType]); //主体类型
|
|
|
Obj.Add("LegalName", addinfo.CertLegalPerson); //企业法人
|
|
|
- // Obj.Add("MerchantShortName", addinfo.MerchantShortname); //企业简称
|
|
|
- // Obj.Add("SettleRule", addinfo.SettlementId); //结算规则
|
|
|
- // Obj.Add("CreditCode", addinfo.BusinessCode); //商户信用代码
|
|
|
Obj.Add("MerchantMobile", addinfo.MobilePhone); //商户手机号
|
|
|
- Obj.Add("MerchantMobile", DefaultPic(merchant.Logo));
|
|
|
- // Obj.Add("Areas", merchant.Areas); //省份
|
|
|
+ Obj.Add("SubjectType", addinfo.SubjectType); //主体类型
|
|
|
+ Obj.Add("CreateDate", merchant.CreateDate == null ? "" : merchant.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //注册时间
|
|
|
+ Obj.Add("ActivationDate", merchant.ActivationDate == null ? "" : merchant.ActivationDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //达标时间
|
|
|
+ Obj.Add("TotalAmount", merchant.TotalAmount); //总交易额
|
|
|
return Obj;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
+ #region 创客-首页-我的商户-商户详情-交易统计
|
|
|
+ [Authorize]
|
|
|
+ public JsonResult MerchantTradeList(string value)
|
|
|
+ {
|
|
|
+ value = DesDecrypt(value);
|
|
|
+ JsonData data = JsonMapper.ToObject(value);
|
|
|
+ List<Dictionary<string, object>> dataList = MerchantTradeListDo(value);
|
|
|
+ return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
|
|
|
+ }
|
|
|
+ public List<Dictionary<string, object>> MerchantTradeListDo(string value)
|
|
|
+ {
|
|
|
+ JsonData data = JsonMapper.ToObject(value);
|
|
|
+ string TradeMonth = data["TradeMonth"].ToString(); //交易月
|
|
|
+ int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户Id
|
|
|
+ int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
|
|
|
+ int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
|
|
|
+ List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
|
|
|
+ IQueryable<PosMerchantTradeSummay> query = maindb.PosMerchantTradeSummay.Where(m => m.MerchantId == MerchantId && m.TradeMonth == TradeMonth).OrderByDescending(m => m.TradeDate);
|
|
|
+ if (PageNum == 1)
|
|
|
+ {
|
|
|
+ query = query.Take(PageSize);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ int skipNum = PageSize * (PageNum - 1);
|
|
|
+ query = query.Skip(skipNum).Take(PageSize);
|
|
|
+ }
|
|
|
+ foreach (PosMerchantTradeSummay item in query)
|
|
|
+ {
|
|
|
+ Dictionary<string, object> curData = new Dictionary<string, object>();
|
|
|
+ curData.Add("TradeDate", item.TradeDate); //交易日
|
|
|
+ curData.Add("TradeAmt", item.TradeAmount); //交易金额
|
|
|
+ curData.Add("ActTradeAmt", 0); //活动交易金额
|
|
|
+ curData.Add("UnActTradeAmt", 0); //非活动交易金额
|
|
|
+ curData.Add("TradeCount", 0); //交易笔数
|
|
|
+ dataList.Add(curData);
|
|
|
+ }
|
|
|
+ return dataList;
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+
|
|
|
+ #region 创客-首页-我的商户-商户详情-码牌
|
|
|
+ [Authorize]
|
|
|
+ public JsonResult QrCodeList(string value)
|
|
|
+ {
|
|
|
+ value = DesDecrypt(value);
|
|
|
+ JsonData data = JsonMapper.ToObject(value);
|
|
|
+ List<Dictionary<string, object>> dataList = QrCodeListDo(value);
|
|
|
+ return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
|
|
|
+ }
|
|
|
+ public List<Dictionary<string, object>> QrCodeListDo(string value)
|
|
|
+ {
|
|
|
+ JsonData data = JsonMapper.ToObject(value);
|
|
|
+ int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户Id
|
|
|
+ int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
|
|
|
+ int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
|
|
|
+ List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
|
|
|
+ IQueryable<MerchantQrCode> query = maindb.MerchantQrCode.Where(m => m.MerchantId == MerchantId).OrderByDescending(m => m.Id);
|
|
|
+ if (PageNum == 1)
|
|
|
+ {
|
|
|
+ query = query.Take(PageSize);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ int skipNum = PageSize * (PageNum - 1);
|
|
|
+ query = query.Skip(skipNum).Take(PageSize);
|
|
|
+ }
|
|
|
+ foreach (MerchantQrCode item in query)
|
|
|
+ {
|
|
|
+ Dictionary<string, object> curData = new Dictionary<string, object>();
|
|
|
+ curData.Add("SnNo", item.SnNo); //sn
|
|
|
+ curData.Add("TradeAmount", 0);
|
|
|
+ dataList.Add(curData);
|
|
|
+ }
|
|
|
+ return dataList;
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
#region 首页-我的商户-商户搜索
|
|
|
[Authorize]
|
|
|
public JsonResult MerchantSearch(string value)
|