123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Http;
- using Microsoft.Extensions.Logging;
- using Microsoft.Extensions.Options;
- using Microsoft.AspNetCore.Authorization;
- using System.Web;
- using MySystem.MainModels;
- using LitJson;
- using Library;
- using System.Data;
- namespace MySystem.Areas.Api.Controllers.v1
- {
- [Area("Api")]
- [Route("/v1/[controller]/[action]")]
- public class BusinessController : BaseController
- {
- public BusinessController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
- {
- }
- #region 经营数据-经营数据记录(月)
- // [Authorize]
- public JsonResult BussinessRecordForMonth(string value)
- {
- value = DesDecrypt(value);
- JsonData data = JsonMapper.ToObject(value);
- List<Dictionary<string, object>> dataList = BussinessRecordForMonthDo(value);
- return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
- }
- private List<Dictionary<string, object>> BussinessRecordForMonthDo(string value)
- {
- JsonData data = JsonMapper.ToObject(value);
- int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户Id
- string TradeMonth = data["TradeMonth"].ToString(); //月份
- int pageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
- int pageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
- var dataList = BusinessUtil.BussinessRecordForMonth(MerchantId, TradeMonth, pageSize, pageNum);
- return dataList;
- }
- #endregion
- #region 经营数据-经营数据记录(半年)
- // [Authorize]
- public JsonResult BussinessRecordForHalfYear(string value)
- {
- value = DesDecrypt(value);
- JsonData data = JsonMapper.ToObject(value);
- List<Dictionary<string, object>> dataList = BussinessRecordForHalfYearDo(value);
- return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
- }
- private List<Dictionary<string, object>> BussinessRecordForHalfYearDo(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()));
- var dataList = BusinessUtil.BussinessRecordForHalfYear(MerchantId, pageSize, pageNum);
- return dataList;
- }
- #endregion
- #region 经营数据-经营数据记录-经营详情列表
- // [Authorize]
- public JsonResult DayDetailList(string value)
- {
- value = DesDecrypt(value);
- JsonData data = JsonMapper.ToObject(value);
- List<Dictionary<string, object>> dataList = DayDetailListDo(value);
- return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
- }
- private List<Dictionary<string, object>> DayDetailListDo(string value)
- {
- JsonData data = JsonMapper.ToObject(value);
- int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户Id
- string TradeDate = data["TradeDate"].ToString(); //日期
- int pageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
- int pageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
- string condition = " and Status>=1";
- if (!string.IsNullOrEmpty(data["MerchantId"].ToString()))
- {
- condition += " and MerchantId=" + MerchantId;
- }
- if (!string.IsNullOrEmpty(data["TradeDate"].ToString()))
- {
- var start = TradeDate.Substring(0, 4) + "-" + TradeDate.Substring(4, 2) + "-" + TradeDate.Substring(6, 2) + " 00:00:00";
- var end = TradeDate.Substring(0, 4) + "-" + TradeDate.Substring(4, 2) + "-" + TradeDate.Substring(6, 2) + " 23:59:59";
- condition += " and CreateDate>='" + start + "' and CreateDate<='" + end + "'";
- }
- var dataList = BusinessUtil.DayDetailList(condition, pageSize, pageNum);
- return dataList;
- }
- #endregion
- #region 经营数据-经营数据记录-交易详情
- // [Authorize]
- public JsonResult OrderDetail(string value)
- {
- value = DesDecrypt(value);
- JsonData data = JsonMapper.ToObject(value);
- Dictionary<string, object> dataList = OrderDetailDo(value);
- return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
- }
- public Dictionary<string, object> OrderDetailDo(string value)
- {
- JsonData data = JsonMapper.ToObject(value);
- int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户Id
- int OrderId = int.Parse(function.CheckInt(data["OrderId"].ToString())); //订单Id
- string condition = " and Status>=1";
- if (!string.IsNullOrEmpty(data["OrderId"].ToString()))
- {
- condition += " and Id=" + OrderId;
- }
- if (!string.IsNullOrEmpty(data["MerchantId"].ToString()))
- {
- condition += " and MerchantId=" + MerchantId;
- }
- var obj = BusinessUtil.OrderDetail(condition);
- return obj;
- }
- #endregion
- }
- }
|