2382 lines
124 KiB
C#
2382 lines
124 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Web.Http;
|
||
using System.Web.Http.Description;
|
||
using ESCG = CommercialApi.GeneralMethod;
|
||
using ESCM = CommercialApi.Model;
|
||
using Newtonsoft.Json.Linq;
|
||
using Newtonsoft.Json;
|
||
using HZQR.Common;
|
||
|
||
namespace CommercialApi.Controllers
|
||
{
|
||
/// <summary>
|
||
/// 营收相关接口
|
||
/// </summary>
|
||
public class RevenueController : BaseController
|
||
{
|
||
#region 获取营收推送数据表列表
|
||
/// <summary>
|
||
/// 获取营收推送数据表列表
|
||
/// </summary>
|
||
/// <param name="pushProvinceCode">推送省份</param>
|
||
/// <param name="Statistics_Date">统计日期</param>
|
||
/// <param name="Serverpart_ID">服务区内码</param>
|
||
/// <param name="SPRegionType_ID">区域内码</param>
|
||
/// <param name="Revenue_Include">是否纳入营收【每日营收推送中是否展示该门店的营收数据】(0:否;1:是)</param>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetRevenuePushList")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.RevenuePushModel>>))]
|
||
public IHttpActionResult GetRevenuePushList(string pushProvinceCode, string Statistics_Date,
|
||
int? Serverpart_ID = null, int? SPRegionType_ID = null, int? Revenue_Include = null)
|
||
{
|
||
string Parameter = "入参信息:推送省份【" + pushProvinceCode + "】,统计日期【" + Statistics_Date + "】," +
|
||
"服务区内码【" + Serverpart_ID + "】,区域内码【" + SPRegionType_ID + "】,统计营收【" + Revenue_Include + "】";
|
||
try
|
||
{
|
||
string TransmitUrl = "TransmitUrl";
|
||
if (CommonHelper.IsFromNewServer(pushProvinceCode, ref TransmitUrl))
|
||
{
|
||
string result = ESCG.HttpUtil.HttpUrlGet(TransmitUrl +
|
||
"Revenue/GetRevenuePushList?pushProvinceCode=" + pushProvinceCode +
|
||
"&Statistics_Date=" + Statistics_Date + "&Serverpart_ID=" + Serverpart_ID +
|
||
"&SPRegionType_ID=" + SPRegionType_ID + "&Revenue_Include=" + Revenue_Include);
|
||
try
|
||
{
|
||
JObject keyValuePairs = JObject.Parse(result);
|
||
if (keyValuePairs["Result_Code"].ToString() == "100")
|
||
{
|
||
//获取服务区门店信息
|
||
Models.JsonList<ESCM.RevenuePushModel> jsonList = JsonConvert.DeserializeObject<
|
||
Models.JsonList<ESCM.RevenuePushModel>>(keyValuePairs["Result_Data"].ToString());
|
||
return Ok(Models.JsonMsg<Models.JsonList<ESCM.RevenuePushModel>>.Success(jsonList, 100, "查询成功"));
|
||
}
|
||
else
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(keyValuePairs["Result_Code"].TryParseToInt(),
|
||
keyValuePairs["Result_Desc"].ToString()));
|
||
}
|
||
}
|
||
catch (Exception _Exception)
|
||
{
|
||
LogUtil.WriteLog(null, "查询失败!" + Parameter + ",失败原因:" + _Exception.Message,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetRevenuePushList");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + _Exception.Message));
|
||
}
|
||
}
|
||
else
|
||
{
|
||
int TotalCount = 0;
|
||
//获取营收推送数据表列表
|
||
List<ESCM.RevenuePushModel> REVENUEPUSHList = ESCG.RevenuePushHelper.GetRevenuePushList(transaction, ref TotalCount,
|
||
pushProvinceCode, Statistics_Date, Statistics_Date, Serverpart_ID, SPRegionType_ID, Revenue_Include);
|
||
|
||
//转化json形式
|
||
Models.JsonList<ESCM.RevenuePushModel> jsonList = Models.JsonList<ESCM.RevenuePushModel>.Success(
|
||
REVENUEPUSHList, TotalCount, 1, TotalCount);
|
||
|
||
return Ok(Models.JsonMsg<Models.JsonList<ESCM.RevenuePushModel>>.Success(jsonList, 100, "查询成功"));
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetRevenuePushList");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取营收推送汇总数据
|
||
/// <summary>
|
||
/// 获取营收推送汇总数据
|
||
/// </summary>
|
||
/// <param name="pushProvinceCode">推送省份</param>
|
||
/// <param name="Statistics_StartDate">统计开始日期</param>
|
||
/// <param name="Statistics_Date">统计结束日期</param>
|
||
/// <param name="Serverpart_ID">服务区内码</param>
|
||
/// <param name="SPRegionType_ID">区域内码</param>
|
||
/// <param name="Revenue_Include">是否纳入营收【每日营收推送中是否展示该门店的营收数据】(0:否;1:是)</param>
|
||
/// <param name="ShowCompareRate">是否计算增长率</param>
|
||
/// <param name="ShowYearRevenue">是否显示年度营收额</param>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetSummaryRevenue")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.SummaryRevenueModel>))]
|
||
public IHttpActionResult GetSummaryRevenue(string pushProvinceCode, string Statistics_StartDate = "",
|
||
string Statistics_Date = "", int? Serverpart_ID = null, int? SPRegionType_ID = null,
|
||
int? Revenue_Include = null, bool ShowCompareRate = false, bool ShowYearRevenue = false)
|
||
{
|
||
string Parameter = "入参信息:推送省份【" + pushProvinceCode + "】,统计开始日期【" + Statistics_StartDate + "】," +
|
||
"统计日期【" + Statistics_Date + "】,服务区内码【" + Serverpart_ID + "】,区域内码【" + SPRegionType_ID + "】," +
|
||
"统计营收【" + Revenue_Include + "】,是否计算增长率【" + ShowCompareRate + "】";
|
||
try
|
||
{
|
||
if (string.IsNullOrWhiteSpace(Statistics_StartDate))
|
||
{
|
||
Statistics_StartDate = Statistics_Date;
|
||
}
|
||
|
||
//获取营收推送数据表列表
|
||
ESCM.SummaryRevenueModel summaryRevenueModel = ESCG.RevenuePushHelper.GetSummaryRevenue(transaction,
|
||
pushProvinceCode, Statistics_StartDate, Statistics_Date, Serverpart_ID,
|
||
SPRegionType_ID, Revenue_Include, ShowCompareRate, ShowYearRevenue);
|
||
if (summaryRevenueModel == null)
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(200, "查询失败,无数据返回!"));
|
||
}
|
||
|
||
return Ok(Models.JsonMsg<ESCM.SummaryRevenueModel>.Success(summaryRevenueModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetSummaryRevenue");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取月度营收推送汇总数据
|
||
/// <summary>
|
||
/// 获取月度营收推送汇总数据
|
||
/// </summary>
|
||
/// <param name="pushProvinceCode">推送省份</param>
|
||
/// <param name="StatisticsMonth">统计月份</param>
|
||
/// <param name="StatisticsDate">统计日期,如果传入了时间要显示当天的营收数据</param>
|
||
/// <param name="SolidType">是否执行固化操作</param>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetSummaryRevenueMonth")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.SummaryRevenueMonthModel>))]
|
||
public IHttpActionResult GetSummaryRevenueMonth(string pushProvinceCode,
|
||
string StatisticsMonth, string StatisticsDate = "", bool SolidType = false)
|
||
{
|
||
string Parameter = "入参信息:推送省份【" + pushProvinceCode + "】," +
|
||
"统计月份【" + StatisticsMonth + "】,统计日期【" + StatisticsDate + "】";
|
||
try
|
||
{
|
||
//获取营收推送数据表列表
|
||
ESCM.SummaryRevenueMonthModel summaryRevenueModel = ESCG.RevenuePushHelper.GetSummaryRevenueMonth(transaction,
|
||
pushProvinceCode, StatisticsMonth, StatisticsDate, SolidType);
|
||
if (summaryRevenueModel == null)
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(200, "查询失败,无数据返回!"));
|
||
}
|
||
|
||
return Ok(Models.JsonMsg<ESCM.SummaryRevenueMonthModel>.Success(summaryRevenueModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetSummaryRevenue");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取营收推送单品销售排行【甘肃营收推送】
|
||
/// <summary>
|
||
/// 获取营收推送单品销售排行【甘肃营收推送】
|
||
/// </summary>
|
||
/// <param name="pushProvinceCode">推送省份编码</param>
|
||
/// <param name="Statistics_Date">统计日期</param>
|
||
/// <param name="RankNum">显示单品行数,默认100</param>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetWechatPushSalesList")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.WechatPushSalesModel>>))]
|
||
public IHttpActionResult GetWechatPushSalesList(string pushProvinceCode, string Statistics_Date, int RankNum = 100)
|
||
{
|
||
string Parameter = "入参信息:推送省份【" + pushProvinceCode + "】," +
|
||
"统计日期【" + Statistics_Date + "】,显示单品行数【" + RankNum + "】";
|
||
try
|
||
{
|
||
//获取营收推送数据表列表
|
||
List<ESCM.WechatPushSalesModel> REVENUEPUSHList = ESCG.RevenuePushHelper.GetWechatPushSalesList(
|
||
transaction, pushProvinceCode, Statistics_Date, RankNum);
|
||
|
||
//转化json形式
|
||
Models.JsonList<ESCM.WechatPushSalesModel> jsonList = Models.JsonList<ESCM.WechatPushSalesModel>.Success(
|
||
REVENUEPUSHList, REVENUEPUSHList.Count, 1, REVENUEPUSHList.Count);
|
||
|
||
return Ok(Models.JsonMsg<Models.JsonList<ESCM.WechatPushSalesModel>>.Success(jsonList, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetWechatPushSalesList");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 查询服务区未上传结账信息的门店列表
|
||
/// <summary>
|
||
/// 查询服务区未上传结账信息的门店列表
|
||
/// </summary>
|
||
/// <param name="pushProvinceCode">推送省份</param>
|
||
/// <param name="Statistics_Date">统计日期</param>
|
||
/// <param name="Serverpart_ID">服务区内码</param>
|
||
/// <param name="SPRegionType_ID">区域内码</param>
|
||
/// <param name="Revenue_Include">是否纳入营收【每日营收推送中是否展示该门店的营收数据】(0:否;1:是)</param>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetUnUpLoadShops")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.RevenuePushModel>>))]
|
||
public IHttpActionResult GetUnUpLoadShops(string pushProvinceCode, string Statistics_Date,
|
||
int? Serverpart_ID = null, int? SPRegionType_ID = null, int? Revenue_Include = null)
|
||
{
|
||
string Parameter = "入参信息:推送省份【" + pushProvinceCode + "】,统计日期【" + Statistics_Date + "】," +
|
||
"服务区内码【" + Serverpart_ID + "】,区域内码【" + SPRegionType_ID + "】,统计营收【" + Revenue_Include + "】";
|
||
try
|
||
{
|
||
//获取营收推送数据表列表
|
||
List<ESCM.UnUpLoadShopModel> REVENUEPUSHList = ESCG.RevenuePushHelper.GetUnUpLoadShops(transaction,
|
||
pushProvinceCode, Statistics_Date, Serverpart_ID, SPRegionType_ID, Revenue_Include);
|
||
|
||
//转化json形式
|
||
Models.JsonList<ESCM.UnUpLoadShopModel> jsonList = Models.JsonList<ESCM.UnUpLoadShopModel>.Success(
|
||
REVENUEPUSHList, REVENUEPUSHList.Count, 1, REVENUEPUSHList.Count);
|
||
|
||
return Ok(Models.JsonMsg<Models.JsonList<ESCM.UnUpLoadShopModel>>.Success(jsonList, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetUnUpLoadShops");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取服务区品牌营收
|
||
/// <summary>
|
||
/// 获取服务区品牌营收
|
||
/// </summary>
|
||
/// <param name="Serverpart_Id">服务区内码</param>
|
||
/// <param name="statictics_Time">统计时间</param>
|
||
/// <param name="pushProvinceCode">省份编号</param>
|
||
/// <returns></returns>
|
||
[AcceptVerbs("GET")]
|
||
[Route("Revenue/GetServerpartBrand")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.ServerpartBrandModel>))]
|
||
public IHttpActionResult GetServerpartBrand(string pushProvinceCode, int? Serverpart_Id, DateTime? statictics_Time)
|
||
{
|
||
try
|
||
{
|
||
//获取品牌详情列表
|
||
ESCM.ServerpartBrandModel serverpartBrandModel = ESCG.RevenuePushHelper.GetServerpartBrand(
|
||
transaction, pushProvinceCode, Serverpart_Id, statictics_Time);
|
||
//生成返回值返回
|
||
return Ok(Models.JsonMsg<ESCM.ServerpartBrandModel>.Success(serverpartBrandModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SuperMap.RealEstate.Utility.ErrorLogHelper.Write(ex, "接口【GetServerPartBrand】", "");
|
||
transaction.Rollback();
|
||
string msg = "查询失败" + ex.Message;
|
||
return Ok(ESCG.Common.ReturnJson(999, msg));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 查询服务区结账数据列表
|
||
/// <summary>
|
||
/// 查询服务区结账数据列表
|
||
/// </summary>
|
||
/// <param name="pushProvinceCode">推送省份</param>
|
||
/// <param name="Serverpart_ID">服务区内码</param>
|
||
/// <param name="Statistics_Date">统计日期</param>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetServerpartEndAccountList")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.ServerpartEndaccountModel>))]
|
||
public IHttpActionResult GetServerpartEndAccountList(string pushProvinceCode, string Statistics_Date, int Serverpart_ID)
|
||
{
|
||
string Parameter = "入参信息:推送省份【" + pushProvinceCode + "】," +
|
||
"统计日期【" + Statistics_Date + "】,服务区内码【" + Serverpart_ID + "】";
|
||
try
|
||
{
|
||
//获取营收推送数据表列表
|
||
ESCM.ServerpartEndaccountModel serverpartEndaccountModel = ESCG.RevenuePushHelper.GetServerpartEndAccountList(
|
||
transaction, pushProvinceCode, Serverpart_ID, Statistics_Date);
|
||
|
||
return Ok(Models.JsonMsg<ESCM.ServerpartEndaccountModel>.Success(serverpartEndaccountModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetServerpartEndAccountList");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 查询门店结账数据列表
|
||
/// <summary>
|
||
/// 查询门店结账数据列表
|
||
/// </summary>
|
||
/// <param name="pushProvinceCode">推送省份</param>
|
||
/// <param name="Serverpart_ID">服务区内码</param>
|
||
/// <param name="ServerpartShop_Ids">门店内码集合</param>
|
||
/// <param name="Statistics_Date">统计日期</param>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetShopEndAccountList")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.ShopBrandModel>))]
|
||
public IHttpActionResult GetShopEndAccountList(string pushProvinceCode, string Statistics_Date,
|
||
int Serverpart_ID, string ServerpartShop_Ids = "")
|
||
{
|
||
string Parameter = "入参信息:推送省份【" + pushProvinceCode + "】,统计日期【" + Statistics_Date + "】," +
|
||
"服务区内码【" + Serverpart_ID + "】,门店内码集合【" + ServerpartShop_Ids + "】";
|
||
try
|
||
{
|
||
//获取营收推送数据表列表
|
||
ESCM.ShopBrandModel shopBrandModel = ESCG.RevenuePushHelper.GetShopEndAccountList(transaction,
|
||
pushProvinceCode, Serverpart_ID, ServerpartShop_Ids, Statistics_Date);
|
||
|
||
return Ok(Models.JsonMsg<ESCM.ShopBrandModel>.Success(shopBrandModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetShopEndAccountList");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取预算费用表列表(POST)
|
||
/// <summary>
|
||
/// 获取预算费用表列表(POST)
|
||
/// </summary>
|
||
/// <param name="searchModel">查询条件对象</param>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetBudgetExpenseList")]
|
||
[AcceptVerbs("POST")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.BUDGETEXPENSEModel>>))]
|
||
public IHttpActionResult GetBudgetExpenseList(ESCM.SearchModel<ESCM.BUDGETEXPENSEModel> searchModel)
|
||
{
|
||
string Parameter = "入参信息:查询方式【" + searchModel.QueryType + "】查询页码【" + searchModel.PageIndex + "】," +
|
||
"每页显示数量【" + searchModel.PageSize + "】,排序条件【" + searchModel.SortStr + "】";
|
||
try
|
||
{
|
||
int TotalCount = 0;
|
||
//获取预算费用表列表
|
||
List<ESCM.BUDGETEXPENSEModel> BUDGETEXPENSEList = ESCG.BUDGETEXPENSEHelper.GetBUDGETEXPENSEList(
|
||
transaction, ref TotalCount, searchModel);
|
||
|
||
//转化json形式
|
||
Models.JsonList<ESCM.BUDGETEXPENSEModel> jsonList = Models.JsonList<ESCM.BUDGETEXPENSEModel>.Success(
|
||
BUDGETEXPENSEList, TotalCount, searchModel.PageIndex, searchModel.PageSize);
|
||
|
||
return Ok(Models.JsonMsg<Models.JsonList<ESCM.BUDGETEXPENSEModel>>.Success(jsonList, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetBudgetExpenseList");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取预算费用表列表(GET)
|
||
/// <summary>
|
||
/// 获取预算费用表列表(GET)
|
||
/// </summary>
|
||
/// <param name="Province_Code">推送省份</param>
|
||
/// <param name="Statistics_Month">统计日期</param>
|
||
/// <param name="Serverpart_ID">服务区内码</param>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetBudgetExpenseList")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.BUDGETEXPENSEModel>>))]
|
||
public IHttpActionResult GetBudgetExpenseList(string Statistics_Month, string Province_Code, int? Serverpart_ID = null)
|
||
{
|
||
string Parameter = "入参信息:统计月份【" + Statistics_Month + "】," +
|
||
"省份编码【" + Province_Code + "】,服务区内码【" + Serverpart_ID + "】";
|
||
try
|
||
{
|
||
int TotalCount = 0;
|
||
//获取预算费用表列表
|
||
List<ESCM.BUDGETEXPENSEModel> BUDGETEXPENSEList = ESCG.BUDGETEXPENSEHelper.GetBUDGETEXPENSEList(
|
||
transaction, ref TotalCount, Statistics_Month, Province_Code, Serverpart_ID);
|
||
|
||
//转化json形式
|
||
Models.JsonList<ESCM.BUDGETEXPENSEModel> jsonList = Models.JsonList<ESCM.BUDGETEXPENSEModel>.Success(
|
||
BUDGETEXPENSEList, TotalCount, 1, TotalCount);
|
||
|
||
return Ok(Models.JsonMsg<Models.JsonList<ESCM.BUDGETEXPENSEModel>>.Success(jsonList, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetBudgetExpenseList");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取计划营收数据
|
||
/// <summary>
|
||
/// 获取计划营收数据
|
||
/// </summary>
|
||
/// <param name="Statistics_Date">统计日期</param>
|
||
/// <param name="Province_Code">推送省份</param>
|
||
/// <param name="Serverpart_ID">服务区内码</param>
|
||
/// <param name="SPRegionType_ID">区域内码</param>
|
||
/// <param name="Revenue_Include">是否纳入营收【每日营收推送中是否展示该门店的营收数据】(0:否;1:是)</param>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetRevenueBudget")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.RevenueBudgetModel>))]
|
||
public IHttpActionResult GetRevenueBudget(string Province_Code, string Statistics_Date = "",
|
||
int? Serverpart_ID = null, int? SPRegionType_ID = null, int? Revenue_Include = null)
|
||
{
|
||
string Parameter = "入参信息:省份编码【" + Province_Code + "】,统计日期【" + Statistics_Date + "】," +
|
||
"服务区内码【" + Serverpart_ID + "】,片区内码【" + SPRegionType_ID + "】,是否纳入营收【" + Revenue_Include + "】";
|
||
try
|
||
{
|
||
//获取预算费用表列表
|
||
ESCM.RevenueBudgetModel revenueBudgetModel = ESCG.BUDGETEXPENSEHelper.GetRevenueBudget(
|
||
transaction, Statistics_Date, Province_Code, Serverpart_ID, SPRegionType_ID, Revenue_Include);
|
||
|
||
if (revenueBudgetModel == null)
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(101, "查询失败,未录入预算数据!"));
|
||
}
|
||
|
||
return Ok(Models.JsonMsg<ESCM.RevenueBudgetModel>.Success(revenueBudgetModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetRevenueBudget");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取全省计划营收分析
|
||
/// <summary>
|
||
/// 获取全省计划营收分析
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// 接口应用描述:<br/>
|
||
/// 业务逻辑描述:<br/>
|
||
/// 4、按片区统计:<br/>
|
||
/// 1)从【预算费用表】和【服务区表】联合查询片区的计划营收数据<br/>
|
||
/// 2)从【安徽财务预算表】和【安徽财务预算明细表】查询当前片区下服务区的自营营业额数据,其中STATISTICS_TYPE=1000代表服务区<br/>
|
||
/// 3)从【服务区营收日度报表】和【服务区表】查询当前片区下服务区的营业额,片区营业额=服务区的累计
|
||
/// </remarks>
|
||
/// <param name="ProvinceCode">省份编码</param>
|
||
/// <param name="StatisticsDate">统计日期</param>
|
||
/// <param name="StatisticsType">
|
||
/// 统计类型:<br/>
|
||
/// 1:按月度统计,子列表是片区<br/>
|
||
/// 2:按年度统计,子列表是月份<br/>
|
||
/// 3:按年度统计,子列表是片区<br/>
|
||
/// 4:按片区统计,子项列表是服务区<br/>
|
||
/// </param>
|
||
/// <param name="SPRegionTypeID">片区内码</param>
|
||
/// <param name="ServerpartID">服务区内码</param>
|
||
/// <param name="ShowWholeYear">是否显示全年的计划营收</param>
|
||
/// <remarks>
|
||
/// 涉及到的数据表:
|
||
/// 1、预算费用表:HIGHWAY_STORAGE.T_BUDGETEXPENSE<br/>
|
||
/// 2、服务区表:HIGHWAY_STORAGE.T_SERVERPART<br/>
|
||
/// 3、安徽财务预算表:FINANCE_STORAGE.T_BUDGETPROJECT_AH<br/>
|
||
/// 4、安徽财务预算明细表:FINANCE_STORAGE.T_BUDGETDETAIL_AH<br/>
|
||
/// 5、服务区营收日度报表:PLATFORM_DASHBOARD.T_REVENUEDAILY
|
||
/// </remarks>
|
||
/// <example>
|
||
/// <!--
|
||
/// 入参样例:
|
||
/// 返回结果样例:
|
||
/// -->
|
||
/// </example>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetProvinceRevenueBudget")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.ProvinceBudgetModel>))]
|
||
public IHttpActionResult GetProvinceRevenueBudget(string StatisticsDate, string ProvinceCode,
|
||
int StatisticsType, int? SPRegionTypeID = null, int? ServerpartID = null, bool ShowWholeYear = false)
|
||
{
|
||
string Parameter = "入参信息:省份编码【" + ProvinceCode + "】," +
|
||
"统计日期【" + StatisticsDate + "】,统计类型【" + StatisticsType + "】," +
|
||
"片区内码【" + SPRegionTypeID + "】,服务区内码【" + ServerpartID + "】";
|
||
try
|
||
{
|
||
//获取月度车流量汇总数据
|
||
ESCM.ProvinceBudgetModel provinceBudgetModel = ESCG.BUDGETEXPENSEHelper.GetProvinceRevenueBudget(
|
||
transaction, StatisticsDate, ProvinceCode, StatisticsType, SPRegionTypeID, ServerpartID, ShowWholeYear);
|
||
|
||
if (provinceBudgetModel == null)
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(101, "查询失败,无数据返回!"));
|
||
}
|
||
|
||
return Ok(Models.JsonMsg<ESCM.ProvinceBudgetModel>.Success(provinceBudgetModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetProvinceRevenueBudget");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取移动支付分账数据
|
||
/// <summary>
|
||
/// 获取移动支付分账数据
|
||
/// </summary>
|
||
/// <param name="Province_Code">推送省份</param>
|
||
/// <param name="Statistics_Date">统计日期</param>
|
||
/// <param name="StatisticsStartDate">统计开始日期</param>
|
||
/// <param name="StatisticsEndDate">统计结束日期</param>
|
||
/// <param name="Serverpart_ID">服务区内码</param>
|
||
/// <param name="SPRegionType_ID">片区内码</param>
|
||
/// <param name="ShowCompareRate">是否计算增长率</param>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetMobileShare")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.MobileShareModel>))]
|
||
public IHttpActionResult GetMobileShare(string Province_Code, string Statistics_Date = "",
|
||
string StatisticsStartDate = "", string StatisticsEndDate = "", int? Serverpart_ID = null,
|
||
int? SPRegionType_ID = null, bool ShowCompareRate = false)
|
||
{
|
||
string Parameter = "入参信息:省份编码【" + Province_Code + "】,统计日期【" + Statistics_Date + "】," +
|
||
"统计开始日期【" + StatisticsStartDate + "】,统计结束日期【" + StatisticsEndDate + "】," +
|
||
"服务区内码【" + Serverpart_ID + "】,片区内码【" + SPRegionType_ID + "】,是否计算增长率【" + ShowCompareRate + "】";
|
||
try
|
||
{
|
||
//如果只传入了统计日期,则开始和结束日期都按统计日期计算
|
||
if (!string.IsNullOrWhiteSpace(Statistics_Date))
|
||
{
|
||
if (string.IsNullOrWhiteSpace(StatisticsStartDate))
|
||
{
|
||
StatisticsStartDate = Statistics_Date;
|
||
}
|
||
if (string.IsNullOrWhiteSpace(StatisticsEndDate))
|
||
{
|
||
StatisticsEndDate = Statistics_Date;
|
||
}
|
||
}
|
||
|
||
//获取预算费用表列表
|
||
ESCM.MobileShareModel mobileShareModel = ESCG.RevenuePushHelper.GetMobileShare(transaction,
|
||
Province_Code, StatisticsStartDate, StatisticsEndDate, Serverpart_ID, SPRegionType_ID, ShowCompareRate);
|
||
|
||
return Ok(Models.JsonMsg<ESCM.MobileShareModel>.Success(mobileShareModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetMobileShare");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取商城配送数据
|
||
/// <summary>
|
||
/// 获取商城配送数据
|
||
/// </summary>
|
||
/// <param name="Province_Code">推送省份</param>
|
||
/// <param name="Statistics_Date">统计日期</param>
|
||
/// <param name="StatisticsStartDate">统计开始日期</param>
|
||
/// <param name="StatisticsEndDate">统计结束日期</param>
|
||
/// <param name="ShowCompareRate">是否计算增长率</param>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetMallDeliver")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.MallDeliverModel>))]
|
||
public IHttpActionResult GetMallDeliver(string Province_Code, string Statistics_Date = "",
|
||
string StatisticsStartDate = "", string StatisticsEndDate = "", bool ShowCompareRate = false)
|
||
{
|
||
string Parameter = "入参信息:省份编码【" + Province_Code + "】,统计日期【" + Statistics_Date + "】," +
|
||
"统计开始日期【" + StatisticsStartDate + "】,统计结束日期【" + StatisticsEndDate + "】," +
|
||
"是否计算增长率【" + ShowCompareRate + "】";
|
||
try
|
||
{
|
||
//如果只传入了统计日期,则开始和结束日期都按统计日期计算
|
||
if (!string.IsNullOrWhiteSpace(Statistics_Date))
|
||
{
|
||
if (string.IsNullOrWhiteSpace(StatisticsStartDate))
|
||
{
|
||
StatisticsStartDate = Statistics_Date;
|
||
}
|
||
if (string.IsNullOrWhiteSpace(StatisticsEndDate))
|
||
{
|
||
StatisticsEndDate = Statistics_Date;
|
||
}
|
||
}
|
||
|
||
//获取预算费用表列表
|
||
ESCM.MallDeliverModel mallDeliverModel = ESCG.RevenuePushHelper.GetMallDeliver(
|
||
transaction, Province_Code, StatisticsStartDate, StatisticsEndDate, ShowCompareRate);
|
||
|
||
return Ok(Models.JsonMsg<ESCM.MallDeliverModel>.Success(mallDeliverModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetMobileShare");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取服务区客单交易分析
|
||
/// <summary>
|
||
/// 获取服务区客单交易分析
|
||
/// </summary>
|
||
/// <param name="Province_Code">省份编码</param>
|
||
/// <param name="Statistics_Date">统计日期</param>
|
||
/// <param name="Serverpart_ID">服务区内码</param>
|
||
/// <param name="ShowConsumptionLevel">是否显示消费水平占比</param>
|
||
/// <param name="ShowConvertRate">是否显示消费转化率</param>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetTransactionAnalysis")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.TransactionAnalysisModel>))]
|
||
public IHttpActionResult GetTransactionAnalysis(string Province_Code, string Statistics_Date,
|
||
int? Serverpart_ID = null, bool ShowConsumptionLevel = false, bool ShowConvertRate = false)
|
||
{
|
||
string Parameter = "入参信息:省份编码【" + Province_Code + "】,统计日期【" + Statistics_Date + "】," +
|
||
"服务区内码【" + Serverpart_ID + "】,是否显示消费水平占比【" + ShowConsumptionLevel + "】," +
|
||
"是否显示消费转化率【" + ShowConvertRate + "】";
|
||
try
|
||
{
|
||
//获取预算费用表列表
|
||
ESCM.TransactionAnalysisModel transactionAnalysisModel = ESCG.TransactionHelper.GetTransactionAnalysis(
|
||
transaction, Province_Code, Statistics_Date, Serverpart_ID, ShowConsumptionLevel, ShowConvertRate);
|
||
|
||
return Ok(Models.JsonMsg<ESCM.TransactionAnalysisModel>.Success(transactionAnalysisModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetTransactionAnalysis");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取服务区时段消费分析
|
||
/// <summary>
|
||
/// 获取服务区时段消费分析
|
||
/// </summary>
|
||
/// <param name="Province_Code">省份编码</param>
|
||
/// <param name="Statistics_Date">统计日期</param>
|
||
/// <param name="Serverpart_ID">服务区内码</param>
|
||
/// <param name="SPRegionType_ID">片区内码</param>
|
||
/// <param name="TimeSpan">时间间隔,默认4h</param>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetTransactionTimeAnalysis")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.CommonScatterModel>))]
|
||
public IHttpActionResult GetTransactionTimeAnalysis(string Province_Code, string Statistics_Date,
|
||
string Serverpart_ID = "", string SPRegionType_ID = "", int TimeSpan = 4)
|
||
{
|
||
string Parameter = "入参信息:省份编码【" + Province_Code + "】,统计日期【" + Statistics_Date + "】," +
|
||
"服务区内码【" + Serverpart_ID + "】,片区内码【" + SPRegionType_ID + "】,时间间隔【" + TimeSpan + "】";
|
||
try
|
||
{
|
||
//获取预算费用表列表
|
||
ESCM.CommonScatterModel transactionAnalysisModel = ESCG.TransactionHelper.GetTransactionTimeAnalysis(
|
||
transaction, Province_Code, Statistics_Date, Serverpart_ID, SPRegionType_ID, TimeSpan);
|
||
|
||
if (transactionAnalysisModel == null)
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(101, "查询失败,无数据返回!"));
|
||
}
|
||
|
||
return Ok(Models.JsonMsg<ESCM.CommonScatterModel>.Success(transactionAnalysisModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetTransactionTimeAnalysis");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取消费转化对比分析
|
||
/// <summary>
|
||
/// 获取消费转化对比分析
|
||
/// </summary>
|
||
/// <param name="Province_Code">省份编码</param>
|
||
/// <param name="Statistics_Date">统计日期</param>
|
||
/// <param name="Serverpart_ID">服务区内码</param>
|
||
/// <param name="SPRegionType_ID">片区内码</param>
|
||
/// <param name="TimeSpan">时间间隔,默认4h</param>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetTransactionConvert")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.TransactionConvertModel>))]
|
||
public IHttpActionResult GetTransactionConvert(string Province_Code, string Statistics_Date,
|
||
string Serverpart_ID = "", string SPRegionType_ID = "", int TimeSpan = 4)
|
||
{
|
||
string Parameter = "入参信息:省份编码【" + Province_Code + "】,统计日期【" + Statistics_Date + "】," +
|
||
"服务区内码【" + Serverpart_ID + "】,片区内码【" + SPRegionType_ID + "】,时间间隔【" + TimeSpan + "】";
|
||
try
|
||
{
|
||
//获取预算费用表列表
|
||
ESCM.TransactionConvertModel transactionConvertModel = ESCG.TransactionHelper.GetTransactionConvert(
|
||
transaction, Province_Code, Statistics_Date, Serverpart_ID, SPRegionType_ID, TimeSpan);
|
||
|
||
if (transactionConvertModel == null)
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(101, "查询失败,无数据返回!"));
|
||
}
|
||
|
||
return Ok(Models.JsonMsg<ESCM.TransactionConvertModel>.Success(transactionConvertModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetTransactionConvert");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取业态营收占比
|
||
/// <summary>
|
||
/// 获取业态营收占比
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// 接口应用描述:<br/>
|
||
/// 接口用于展示月度经营业态营收金额占比,统计的维度可以是全省、片区、服务区,可以按照一级经营业态、最小一级经营业态显示占比数据;<br/>
|
||
/// 业务逻辑描述:<br/>
|
||
/// 查询【服务区营收日度报表】数据,根据入参查询,按照经营业态返回经营业态内码、经营业态名称、营收金额;<br/>
|
||
/// 入参字段说明:<br/>
|
||
/// 1、统计日期为必传<br/>
|
||
/// 2、片区内码、服务区内码、经营业态内码可以不传参,如果传值可以传多个,多个值用,隔开<br/>
|
||
/// 3、片区内码【SPREGIONTYPE_ID】、服务区内码【SERVERPART_ID】从服务区信息表【HIGHWAY_STORAGE.T_SERVERPART】中获取数值<br/>
|
||
/// 4、只传入片区内码,那么接口返回片区的经营业态营收金额占比<br/>
|
||
/// 5、只传入服务区内码,那么接口返回服务区的经营业态营收金额占比<br/>
|
||
/// 6、经营业态表里存储的是数值,从经营业态表【COOP_MERCHANT.T_AUTOSTATISTICS】中获取数值,
|
||
/// 经营业态表和服务区营收月度报表不在同一个数据库,所以是单独查询数据源再解析经营业态名称<br/>
|
||
/// 7、经营业态内码传值-1时,返回按一级经营业态统计营收金额;传了值,按最小一级经营业态统计营收金额;
|
||
/// 经营业态内码传值0,代表查询没有设置过经营业态的数据
|
||
/// </remarks>
|
||
/// <param name="ProvinceCode">省份编码</param>
|
||
/// <param name="StatisticsDate">统计日期,格式yyyy-MM-dd</param>
|
||
/// <param name="ServerpartId">服务区内码集合,多个用,隔开</param>
|
||
/// <param name="SPRegionTypeID">片区内码集合,多个用,隔开</param>
|
||
/// <param name="BusinessTradeIds">经营业态内码</param>
|
||
/// <remarks>
|
||
/// 涉及到的数据表:<br/>
|
||
/// 服务区营收日度报表【PLATFORM_DASHBOARD.T_REVENUEDAILY】<br/>
|
||
/// 服务区信息表【HIGHWAY_STORAGE.T_SERVERPART】<br/>
|
||
/// 两张表相对应的字段:服务区内码【SERVERPART_ID】,
|
||
/// 其中服务区信息表要查询正式【STATISTIC_TYPE=1000】的服务区【STATISTICS_TYPE=1000】营收数据
|
||
/// </remarks>
|
||
/// <example>
|
||
/// <!--
|
||
/// 入参样例:
|
||
/// ProvinceCode=340000&StatisticsDate=2023-4-1&ServerpartId=416
|
||
/// 返回结果样例:
|
||
/// -->
|
||
/// </example>
|
||
/// <returns>
|
||
/// 返参:<br/>
|
||
/// name:经营业态名称<br/>
|
||
/// value:营收金额<br/>
|
||
/// key:经营业态内码,0代表未设置过经营业态
|
||
/// </returns>
|
||
[Route("Revenue/GetBusinessTradeRevenue")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.TransactionModel>))]
|
||
public IHttpActionResult GetBusinessTradeRevenue(string ProvinceCode, string StatisticsDate,
|
||
string ServerpartId = "", string SPRegionTypeID = "", string BusinessTradeIds = "")
|
||
{
|
||
//根据用户权限获取省份编码默认值
|
||
ProvinceCode = GetStringHeader("ProvinceCode", ProvinceCode);
|
||
|
||
string Parameter = "入参信息:省份编码【" + ProvinceCode + "】," +
|
||
"统计月份【" + StatisticsDate + "】,片区内码【" + SPRegionTypeID + "】," +
|
||
"服务区内码【" + ServerpartId + "】,经营业态内码【" + BusinessTradeIds + "】";
|
||
try
|
||
{
|
||
//获取月度车流量汇总数据
|
||
ESCM.TransactionModel transactionModel = ESCG.TransactionHelper.GetBusinessTradeRevenue(
|
||
transaction, ProvinceCode, StatisticsDate, ServerpartId, SPRegionTypeID, BusinessTradeIds);
|
||
|
||
if (transactionModel == null)
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(101, "查询失败,无数据返回!"));
|
||
}
|
||
|
||
return Ok(Models.JsonMsg<ESCM.TransactionModel>.Success(transactionModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetBusinessTradeRevenue");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取业态消费水平占比
|
||
/// <summary>
|
||
/// 获取业态消费水平占比
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// 接口应用描述:<br/>
|
||
/// 业务逻辑描述:<br/>
|
||
/// </remarks>
|
||
/// <param name="ProvinceCode">省份编码</param>
|
||
/// <param name="StatisticsDate">统计日期,格式yyyy-MM-dd</param>
|
||
/// <param name="SPRegionTypeID">片区内码集合,多个用,隔开</param>
|
||
/// <param name="ServerpartId">服务区内码集合,多个用,隔开</param>
|
||
/// <param name="BusinessTradeIds">经营业态内码</param>
|
||
/// <param name="ShowTradeCount">最多显示几个业态,默认5</param>
|
||
/// <param name="ShowWholeTrade">是否包含全业态数据分析</param>
|
||
/// <remarks>
|
||
/// 涉及到的数据表:<br/>
|
||
/// </remarks>
|
||
/// <example>
|
||
/// <!--
|
||
/// 入参样例:
|
||
/// ProvinceCode=340000&StatisticsDate=2023-4-1&ServerpartId=416&ShowWholeTrade=true
|
||
/// 返回结果样例:
|
||
/// -->
|
||
/// </example>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetBusinessTradeLevel")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.CommonColumnLegendModel>))]
|
||
public IHttpActionResult GetBusinessTradeLevel(string ProvinceCode, string StatisticsDate,
|
||
string ServerpartId = "", string SPRegionTypeID = "", string BusinessTradeIds = "",
|
||
int ShowTradeCount = 5, bool ShowWholeTrade = false)
|
||
{
|
||
//根据用户权限获取省份编码默认值
|
||
ProvinceCode = GetStringHeader("ProvinceCode", ProvinceCode);
|
||
|
||
string Parameter = "入参信息:省份编码【" + ProvinceCode + "】," +
|
||
"统计月份【" + StatisticsDate + "】,片区内码【" + SPRegionTypeID + "】," +
|
||
"服务区内码【" + ServerpartId + "】,经营业态内码【" + BusinessTradeIds + "】";
|
||
try
|
||
{
|
||
//获取月度车流量汇总数据
|
||
ESCM.CommonColumnLegendModel transactionLevelModel = ESCG.TransactionHelper.GetBusinessTradeLevel(transaction,
|
||
ProvinceCode, StatisticsDate, ServerpartId, SPRegionTypeID, BusinessTradeIds, ShowTradeCount, ShowWholeTrade);
|
||
|
||
if (transactionLevelModel == null)
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(101, "查询失败,无数据返回!"));
|
||
}
|
||
|
||
return Ok(Models.JsonMsg<ESCM.CommonColumnLegendModel>.Success(transactionLevelModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetBusinessTradeLevel");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取品牌消费水平占比
|
||
/// <summary>
|
||
/// 获取品牌消费水平占比
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// 接口应用描述:<br/>
|
||
/// 业务逻辑描述:<br/>
|
||
/// </remarks>
|
||
/// <param name="ProvinceCode">省份编码</param>
|
||
/// <param name="StatisticsDate">统计日期,格式yyyy-MM-dd</param>
|
||
/// <param name="SPRegionTypeID">片区内码集合,多个用,隔开</param>
|
||
/// <param name="ServerpartId">服务区内码集合,多个用,隔开</param>
|
||
/// <param name="BusinessTradeIds">经营业态内码</param>
|
||
/// <param name="ShowBrandCount">最多显示几个品牌,默认5</param>
|
||
/// <param name="ShowWholeBrand">是否包含全品牌数据分析</param>
|
||
/// <remarks>
|
||
/// 涉及到的数据表:<br/>
|
||
/// </remarks>
|
||
/// <example>
|
||
/// <!--
|
||
/// 入参样例:
|
||
/// ProvinceCode=340000&StatisticsDate=2023-4-1&ServerpartId=416&ShowWholeTrade=true
|
||
/// 返回结果样例:
|
||
/// -->
|
||
/// </example>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetBusinessBrandLevel")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.CommonColumnLegendModel>))]
|
||
public IHttpActionResult GetBusinessBrandLevel(string ProvinceCode, string StatisticsDate,
|
||
string ServerpartId = "", string SPRegionTypeID = "", string BusinessTradeIds = "",
|
||
int ShowBrandCount = 5, bool ShowWholeBrand = false)
|
||
{
|
||
//根据用户权限获取省份编码默认值
|
||
ProvinceCode = GetStringHeader("ProvinceCode", ProvinceCode);
|
||
|
||
string Parameter = "入参信息:省份编码【" + ProvinceCode + "】," +
|
||
"统计月份【" + StatisticsDate + "】,片区内码【" + SPRegionTypeID + "】," +
|
||
"服务区内码【" + ServerpartId + "】,经营业态内码【" + BusinessTradeIds + "】";
|
||
try
|
||
{
|
||
//获取月度车流量汇总数据
|
||
ESCM.CommonColumnLegendModel transactionLevelModel = ESCG.TransactionHelper.GetBusinessBrandLevel(transaction,
|
||
ProvinceCode, StatisticsDate, ServerpartId, SPRegionTypeID, BusinessTradeIds, ShowBrandCount, ShowWholeBrand);
|
||
|
||
if (transactionLevelModel == null)
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(101, "查询失败,无数据返回!"));
|
||
}
|
||
|
||
return Ok(Models.JsonMsg<ESCM.CommonColumnLegendModel>.Success(transactionLevelModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetBusinessBrandLevel");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取营收同比数据
|
||
/// <summary>
|
||
/// 获取营收同比数据
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// 接口应用描述:<br/>
|
||
/// 业务逻辑描述:<br/>
|
||
/// </remarks>
|
||
/// <param name="ProvinceCode">省份编码</param>
|
||
/// <param name="StatisticsDate">统计日期,可以是年份/月份/日期</param>
|
||
/// <param name="ServerpartId">服务区内码集合,多个用,隔开</param>
|
||
/// <param name="SPRegionTypeID">片区内码集合,多个用,隔开</param>
|
||
/// <remarks>
|
||
/// 涉及到的数据表:<br/>
|
||
/// </remarks>
|
||
/// <example>
|
||
/// <!--
|
||
/// 入参样例:
|
||
/// 返回结果样例:
|
||
/// -->
|
||
/// </example>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetRevenueCompare")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.RevenueCompareModel>))]
|
||
public IHttpActionResult GetRevenueTrend(string ProvinceCode, string StatisticsDate,
|
||
string ServerpartId = "", string SPRegionTypeID = "")
|
||
{
|
||
//根据用户权限获取省份编码默认值
|
||
ProvinceCode = GetStringHeader("ProvinceCode", ProvinceCode);
|
||
|
||
string Parameter = "入参信息:省份编码【" + ProvinceCode + "】,统计时间【" + StatisticsDate + "】," +
|
||
"片区内码【" + SPRegionTypeID + "】,服务区内码【" + ServerpartId + "】";
|
||
try
|
||
{
|
||
//获取月度车流量汇总数据
|
||
ESCM.RevenueCompareModel revenueCompareModel = ESCG.RevenuePushHelper.GetRevenueCompare(
|
||
transaction, ProvinceCode, StatisticsDate, ServerpartId, SPRegionTypeID);
|
||
|
||
if (revenueCompareModel == null)
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(101, "查询失败,无数据返回!"));
|
||
}
|
||
|
||
return Ok(Models.JsonMsg<ESCM.RevenueCompareModel>.Success(revenueCompareModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetRevenueTrend");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取营收趋势图
|
||
/// <summary>
|
||
/// 获取营收趋势图
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// 接口应用描述:<br/>
|
||
/// 业务逻辑描述:<br/>
|
||
/// </remarks>
|
||
/// <param name="ProvinceCode">省份编码</param>
|
||
/// <param name="StatisticsType">
|
||
/// 统计类型,默认查询年度:<br/>
|
||
/// 1、统计年度数据<br/>
|
||
/// 2、统计月度数据<br/>
|
||
/// 3、统计时段数据
|
||
/// </param>
|
||
/// <param name="StatisticsDate">统计日期,可以是年份/月份/日期</param>
|
||
/// <param name="ServerpartId">服务区内码集合,多个用,隔开</param>
|
||
/// <param name="SPRegionTypeID">片区内码集合,多个用,隔开</param>
|
||
/// <remarks>
|
||
/// 涉及到的数据表:<br/>
|
||
/// </remarks>
|
||
/// <example>
|
||
/// <!--
|
||
/// 入参样例:
|
||
/// 返回结果样例:
|
||
/// -->
|
||
/// </example>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetRevenueTrend")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.CommonModel>>))]
|
||
public IHttpActionResult GetRevenueTrend(string ProvinceCode, string StatisticsDate,
|
||
int StatisticsType = 1, string ServerpartId = "", string SPRegionTypeID = "")
|
||
{
|
||
//根据用户权限获取省份编码默认值
|
||
ProvinceCode = GetStringHeader("ProvinceCode", ProvinceCode);
|
||
|
||
string Parameter = "入参信息:省份编码【" + ProvinceCode + "】,统计类型【" + StatisticsType + "】," +
|
||
"统计时间【" + StatisticsDate + "】,片区内码【" + SPRegionTypeID + "】,服务区内码【" + ServerpartId + "】";
|
||
try
|
||
{
|
||
//获取月度车流量汇总数据
|
||
List<Model.CommonModel> RevenueTrendList = ESCG.RevenuePushHelper.GetRevenueTrend(transaction,
|
||
ProvinceCode, StatisticsType, StatisticsDate, ServerpartId, SPRegionTypeID);
|
||
|
||
Models.JsonList<ESCM.CommonModel> jsonList = Models.JsonList<ESCM.CommonModel>.Success(
|
||
RevenueTrendList, RevenueTrendList.Count, 1, RevenueTrendList.Count);
|
||
|
||
return Ok(Models.JsonMsg<Models.JsonList<ESCM.CommonModel>>.Success(jsonList, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetRevenueTrend");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取服务区经营报表
|
||
/// <summary>
|
||
/// 获取服务区经营报表
|
||
/// </summary>
|
||
/// <param name="provinceCode">用户省份编码</param>
|
||
/// <param name="startTime">开始时间</param>
|
||
/// <param name="endTime">结束时间</param>
|
||
/// <param name="BusinessTrade">经营业态</param>
|
||
/// <param name="BusinessType">经营模式</param>
|
||
/// <param name="SettlementMode">结算模式</param>
|
||
/// <param name="SearchKeyName">
|
||
/// 模糊查询字段,多个用,隔开:<br/>
|
||
/// 商户【MerchantName】,品牌:【Brand】,门店:【Shop】,服务区:【Serverpart】
|
||
/// </param>
|
||
/// <param name="SearchKeyValue">模糊查询内容</param>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetRevenueReport")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.CommonModel>>))]
|
||
public IHttpActionResult GetRevenueReport(string provinceCode, string startTime, string endTime, string BusinessTrade = "",
|
||
string BusinessType = "", string SettlementMode = "", string SearchKeyName = "", string SearchKeyValue = "")
|
||
{
|
||
try
|
||
{
|
||
//获取服务区经营报表
|
||
ESCM.RevenueReportModel revenueReportModel = ESCG.RevenuePushHelper.GetRevenueReport(transaction, provinceCode,
|
||
startTime, endTime, BusinessTrade, BusinessType, SettlementMode, SearchKeyName, SearchKeyValue);
|
||
|
||
if (revenueReportModel == null)
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(200, "查询失败,无数数据返回!"));
|
||
}
|
||
|
||
return Ok(Models.JsonMsg<ESCM.RevenueReportModel>.Success(revenueReportModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
string Parameter = "入参信息:省份编码【" + provinceCode + "】,统计开始日期【" + startTime + "】,结束日期【" + endTime + "】," +
|
||
"经营业态【" + BusinessTrade + "】,经营模式【" + BusinessType + "】,结算模式【" + SettlementMode + "】," +
|
||
"模糊查询字段【" + SearchKeyName + "】,模糊查询内容【" + SearchKeyValue + "】";
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetRevenueReport");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取服务区经营报表详情
|
||
/// <summary>
|
||
/// 获取服务区经营报表详情
|
||
/// </summary>
|
||
/// <param name="provinceCode">省份编码</param>
|
||
/// <param name="serverpartId">服务区内码</param>
|
||
/// <param name="startTime">开始日期</param>
|
||
/// <param name="endTime">结束日期</param>
|
||
/// <param name="BusinessTrade">经营业态</param>
|
||
/// <param name="BusinessType">经营模式</param>
|
||
/// <param name="SettlementMode">结算模式</param>
|
||
/// <param name="SearchKeyName">
|
||
/// 模糊查询字段,多个用,隔开:<br/>
|
||
/// 商户【MerchantName】,品牌:【Brand】,门店:【Shop】,服务区:【Serverpart】
|
||
/// </param>
|
||
/// <param name="SearchKeyValue">模糊查询内容</param>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetRevenueReportDetil")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.CommonModel>>))]
|
||
public IHttpActionResult GetRevenueReportDetil(string provinceCode, int serverpartId, string startTime, string endTime,
|
||
string BusinessTrade = "", string BusinessType = "", string SettlementMode = "", string SearchKeyName = "", string SearchKeyValue = "")
|
||
{
|
||
string Parameter = "入参信息:省份编码【" + provinceCode + "】,服务区内码【" + serverpartId + "】," +
|
||
"统计开始日期【" + startTime + "】,统计结束日期【" + endTime + "】," +
|
||
"模糊查询字段【" + SearchKeyName + "】,模糊查询内容【" + SearchKeyValue + "】";
|
||
try
|
||
{
|
||
//获取服务区经营报表
|
||
ESCM.RevenueReportDetilsModel revenueReportModel = ESCG.RevenuePushHelper.GetRevenueReportDetil(transaction,
|
||
provinceCode, serverpartId, startTime, endTime, BusinessTrade, BusinessType, SettlementMode, SearchKeyName, SearchKeyValue);
|
||
|
||
if (revenueReportModel == null)
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(200, "查询失败,无数数据返回!"));
|
||
}
|
||
|
||
return Ok(Models.JsonMsg<ESCM.RevenueReportDetilsModel>.Success(revenueReportModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetRevenueReportDetil");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取商超畅销商品
|
||
/// <summary>
|
||
/// 获取商超畅销商品
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// 接口应用描述:显示在驿达数智化小程序-交易画像:商超畅销商品板块,显示当月商超的畅销商品和滞销商品排名<br/>
|
||
/// 业务逻辑描述:当前接口暂时没有编写逻辑,返回的是假数据<br/>
|
||
/// </remarks>
|
||
/// <param name="statisticsDate">统计日期</param>
|
||
/// <param name="provinceCode">业主单位标识</param>
|
||
/// <param name="Serverpart_ID">服务区内码</param>
|
||
/// <param name="SPRegionType_ID">服务区编码</param>
|
||
/// <remarks>
|
||
/// 涉及到的数据表:<br/>
|
||
/// </remarks>
|
||
/// <example>
|
||
/// <!--
|
||
/// 入参样例:
|
||
/// 返回结果样例:
|
||
/// -->
|
||
/// </example>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetSalableCommodity")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.Revenue.SalableCommodityModel>))]
|
||
public IHttpActionResult GetSalableCommodity(string statisticsDate, string provinceCode,
|
||
string Serverpart_ID = "", string SPRegionType_ID = "")
|
||
{
|
||
string Parameter = "入参信息:统计日期【" + statisticsDate + "】,业主单位标识【" + provinceCode + "】," +
|
||
"服务区内码【" + Serverpart_ID + "】,服务区编码【" + SPRegionType_ID + "】";
|
||
try
|
||
{
|
||
Models.Revenue.SalableCommodityModel salableCommodityModel = ESCG.Revenue.SalableCommodityHelper.GetCommoditySellWell(
|
||
transaction, provinceCode, statisticsDate, Serverpart_ID, SPRegionType_ID);
|
||
|
||
if (salableCommodityModel == null)
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(101, "查询失败,无数据返回!"));
|
||
}
|
||
|
||
return Ok(Models.JsonMsg<Models.Revenue.SalableCommodityModel>.Success(salableCommodityModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetSalableCommodity");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取近日服务区营收排行
|
||
/// <summary>
|
||
/// 获取近日服务区营收排行
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// 应用场景:国庆等节日,显示服务区营收排
|
||
/// </remarks>
|
||
/// <param name="pushProvinceCode">推送省份</param>
|
||
/// <param name="Statistics_Date">统计日期</param>
|
||
/// <param name="Serverpart_ID">服务区内码</param>
|
||
/// <param name="SPRegionType_ID">区域内码</param>
|
||
/// <param name="Revenue_Include">是否纳入营收【每日营收推送中是否展示该门店的营收数据】(0:否;1:是)</param>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetSPRevenueRank")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.RevenuePushModel>>))]
|
||
public IHttpActionResult GetSPRevenueRank(string pushProvinceCode, string Statistics_Date,
|
||
int? Serverpart_ID = null, int? SPRegionType_ID = null, int? Revenue_Include = null)
|
||
{
|
||
string Parameter = "入参信息:推送省份【" + pushProvinceCode + "】,统计日期【" + Statistics_Date + "】," +
|
||
"服务区内码【" + Serverpart_ID + "】,区域内码【" + SPRegionType_ID + "】,统计营收【" + Revenue_Include + "】";
|
||
try
|
||
{
|
||
//获取营收推送数据表列表
|
||
List<ESCM.RevenuePushModel> REVENUEPUSHList = ESCG.RevenuePushHelper.GetSPRevenueRank(transaction,
|
||
pushProvinceCode, Statistics_Date, Statistics_Date, Serverpart_ID, SPRegionType_ID, Revenue_Include);
|
||
decimal sumCashpay = REVENUEPUSHList.Sum(o => o.CashPay).TryParseToDecimal();
|
||
//返回的列表默认不显示万佳商贸下面的点位
|
||
REVENUEPUSHList = REVENUEPUSHList.FindAll(o => o.SPRegionType_Name != "万佳商贸");
|
||
//转化json形式
|
||
Models.JsonList<ESCM.RevenuePushModel, decimal> jsonList = Models.JsonList<ESCM.RevenuePushModel, decimal>.Success(
|
||
REVENUEPUSHList, sumCashpay);
|
||
|
||
return Ok(Models.JsonMsg<Models.JsonList<ESCM.RevenuePushModel, decimal>>.Success(jsonList, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetSPRevenueRank");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取每日营收同比数据
|
||
/// <summary>
|
||
/// 获取每日营收同比数据
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// 应用场景:国庆等节日,显示服务区同比营收数据
|
||
/// </remarks>
|
||
/// <param name="pushProvinceCode">推送省份</param>
|
||
/// <param name="StatisticsDate">营收汇总数据结算日期</param>
|
||
/// <param name="StatisticsStartDate">统计开始日期</param>
|
||
/// <param name="StatisticsEndDate">统计结束日期</param>
|
||
/// <param name="CompareStartDate">同比开始日期</param>
|
||
/// <param name="CompareEndDate">同比结束日期</param>
|
||
/// <param name="ServerpartId">服务区内码</param>
|
||
/// <param name="SPRegionTypeID">片区内码</param>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetRevenueYOY")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.RevenueYOYModel>))]
|
||
public IHttpActionResult GetRevenueYOY(string pushProvinceCode, string StatisticsStartDate,
|
||
string StatisticsEndDate, string CompareStartDate = "", string CompareEndDate = "",
|
||
string StatisticsDate = "", string ServerpartId = "", string SPRegionTypeID = "")
|
||
{
|
||
string Parameter = "入参信息:推送省份【" + pushProvinceCode + "】,营收汇总数据结算日期【" + StatisticsDate + "】," +
|
||
"统计开始日期【" + StatisticsStartDate + "】,统计结束日期【" + StatisticsEndDate + "】," +
|
||
"服务区内码【" + ServerpartId + "】,区域内码【" + SPRegionTypeID + "】";
|
||
try
|
||
{
|
||
//如果没有传入“营收汇总数据结算日期”,默认按结束日期计算
|
||
if (string.IsNullOrWhiteSpace(StatisticsDate))
|
||
{
|
||
StatisticsDate = StatisticsEndDate;
|
||
}
|
||
//默认同比开始时间为去年同期开始时间
|
||
if (string.IsNullOrWhiteSpace(CompareStartDate))
|
||
{
|
||
CompareStartDate = DateTime.Parse(StatisticsStartDate).AddYears(-1).ToString("yyyy/MM/dd");
|
||
}
|
||
//默认同比结束时间为去年同期结束时间
|
||
if (string.IsNullOrWhiteSpace(CompareEndDate))
|
||
{
|
||
CompareEndDate = DateTime.Parse(StatisticsEndDate).AddYears(-1).ToString("yyyy/MM/dd");
|
||
}
|
||
|
||
//获取营收推送数据表列表
|
||
ESCM.RevenueYOYModel revenueYOYModel = ESCG.RevenuePushHelper.GetRevenueYOY(transaction,
|
||
pushProvinceCode, StatisticsDate, StatisticsStartDate, StatisticsEndDate,
|
||
CompareStartDate, CompareEndDate, ServerpartId, SPRegionTypeID);
|
||
|
||
return Ok(Models.JsonMsg<ESCM.RevenueYOYModel>.Success(revenueYOYModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetRevenueYOY");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取节日营收同比数据
|
||
/// <summary>
|
||
/// 获取节日营收同比数据
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// 应用场景:国庆等节日,显示服务区同比营收数据
|
||
/// </remarks>
|
||
/// <param name="pushProvinceCode">推送省份</param>
|
||
/// <param name="StatisticsDate">营收汇总数据结算日期</param>
|
||
/// <param name="holidayType">
|
||
/// 节日类型:<br/>
|
||
/// 1【元旦】<br/>2【春运】<br/>3【清明】<br/>4【五一】<br/>5【端午】<br/>6【暑期】<br/>7【中秋】<br/>8【国庆】
|
||
/// </param>
|
||
/// <param name="curYear">当前年份</param>
|
||
/// <param name="compareYear">同比年份</param>
|
||
/// <param name="ServerpartId">服务区内码</param>
|
||
/// <param name="SPRegionTypeID">片区内码</param>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetHolidayCompare")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.RevenueYOYModel>))]
|
||
public IHttpActionResult GetHolidayCompare(string pushProvinceCode, string StatisticsDate,
|
||
int holidayType, int curYear, int compareYear, string ServerpartId = "", string SPRegionTypeID = "")
|
||
{
|
||
string Parameter = "入参信息:推送省份【" + pushProvinceCode + "】,营收汇总数据结算日期【" + StatisticsDate + "】," +
|
||
"节日类型【" + holidayType + "】,当前年份【" + curYear + "】,同比年份【" + compareYear + "】," +
|
||
"服务区内码【" + ServerpartId + "】,区域内码【" + SPRegionTypeID + "】";
|
||
try
|
||
{
|
||
//如果没有传入“营收汇总数据结算日期”,默认按结束日期计算
|
||
if (string.IsNullOrWhiteSpace(StatisticsDate))
|
||
{
|
||
StatisticsDate = DateTime.Now.ToShortDateString();
|
||
}
|
||
|
||
//获取营收推送数据表列表
|
||
ESCM.RevenueYOYModel revenueYOYModel = ESCG.RevenuePushHelper.GetHolidayCompare(transaction,
|
||
pushProvinceCode, StatisticsDate, holidayType, curYear, compareYear, ServerpartId, SPRegionTypeID);
|
||
|
||
return Ok(Models.JsonMsg<ESCM.RevenueYOYModel>.Success(revenueYOYModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetHolidayCompare");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取营收统计明细数据
|
||
/// <summary>
|
||
/// 获取营收统计明细数据
|
||
/// </summary>
|
||
/// <param name="calcType">计算方式:1【当月】,2【累计】</param>
|
||
/// <param name="pushProvinceCode">省份编码</param>
|
||
/// <param name="StatisticsMonth">统计结束月份,格式yyyyMM</param>
|
||
/// <param name="StatisticsStartMonth">统计开始月份,格式yyyyMM</param>
|
||
/// <param name="StatisticsDate">统计日期</param>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetAccountReceivable")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.AccountModel>))]
|
||
public IHttpActionResult GetAccountReceivable(string pushProvinceCode, string StatisticsDate,
|
||
string StatisticsMonth, string StatisticsStartMonth = "", int calcType = 1)
|
||
{
|
||
string Parameter = "入参信息:推送省份【" + pushProvinceCode + "】,计算方式【" + calcType + "】," +
|
||
"统计结算月份【" + StatisticsMonth + "】,统计开始月份【" + StatisticsStartMonth + "】,结算日期【" + StatisticsDate + "】";
|
||
try
|
||
{
|
||
//如果没有传入“营收汇总数据结算日期”,默认按结束日期计算
|
||
if (string.IsNullOrWhiteSpace(StatisticsDate))
|
||
{
|
||
StatisticsDate = DateTime.Now.ToShortDateString();
|
||
}
|
||
|
||
if (string.IsNullOrWhiteSpace(StatisticsStartMonth))
|
||
{
|
||
if (calcType == 1)
|
||
{
|
||
StatisticsStartMonth = StatisticsMonth;
|
||
}
|
||
else
|
||
{
|
||
StatisticsStartMonth = StatisticsMonth.Substring(0, 4) + "01";
|
||
}
|
||
}
|
||
|
||
//获取营收推送数据表列表
|
||
ESCM.AccountModel accountModel = ESCG.AccountHelper.GetAccountReceivable(transaction,
|
||
calcType, pushProvinceCode, StatisticsMonth, StatisticsStartMonth, StatisticsDate);
|
||
|
||
return Ok(Models.JsonMsg<ESCM.AccountModel>.Success(accountModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetAccountReceivable");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取实时营收交易数据
|
||
/// <summary>
|
||
/// 获取实时营收交易数据
|
||
/// </summary>
|
||
/// <param name="pushProvinceCode">省份编码</param>
|
||
/// <param name="StatisticsDate">统计日期</param>
|
||
/// <param name="serverPartId">服务区内码,多个用,隔开</param>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetCurRevenue")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.CurTransactionModel>))]
|
||
public IHttpActionResult GetCurRevenue(string pushProvinceCode, string StatisticsDate, string serverPartId = "")
|
||
{
|
||
string Parameter = "入参信息:推送省份【" + pushProvinceCode + "】," +
|
||
"统计日期【" + StatisticsDate + "】,服务区内码【" + serverPartId + "】";
|
||
try
|
||
{
|
||
//如果没有传入“营收汇总数据结算日期”,默认按结束日期计算
|
||
if (string.IsNullOrWhiteSpace(StatisticsDate))
|
||
{
|
||
StatisticsDate = DateTime.Now.ToShortDateString();
|
||
}
|
||
|
||
//获取实时营收数据
|
||
ESCM.CurTransactionModel curTransactionModel = ESCG.TransactionHelper.getCurRevenue(transaction,
|
||
pushProvinceCode, serverPartId, StatisticsDate, null, null, null);
|
||
if (curTransactionModel == null)
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(101, "查询失败,无数据返回!"));
|
||
}
|
||
|
||
return Ok(Models.JsonMsg<ESCM.CurTransactionModel>.Success(curTransactionModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetCurRevenue");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取实时门店营收交易数据
|
||
/// <summary>
|
||
/// 获取实时门店营收交易数据
|
||
/// </summary>
|
||
/// <param name="serverPartId">服务区内码,多个用,隔开</param>
|
||
/// <param name="statisticsDate">统计日期</param>
|
||
/// <param name="groupByShop">是否合并双侧同业态门店</param>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetShopCurRevenue")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.CurShopTransactionModel>>))]
|
||
public IHttpActionResult GetShopCurRevenue(string serverPartId, string statisticsDate, bool groupByShop = false)
|
||
{
|
||
string Parameter = "入参信息:服务区内码【" + serverPartId + "】," +
|
||
"统计日期【" + statisticsDate + "】,是否合并双侧同业态门店【" + groupByShop + "】";
|
||
try
|
||
{
|
||
//如果没有传入“营收汇总数据结算日期”,默认按结束日期计算
|
||
if (string.IsNullOrWhiteSpace(statisticsDate))
|
||
{
|
||
statisticsDate = DateTime.Now.ToShortDateString();
|
||
}
|
||
|
||
//获取实时营收数据
|
||
List<ESCM.CurShopTransactionModel> curTransactionList = ESCG.TransactionHelper.getShopCurRevenue(transaction,
|
||
serverPartId, statisticsDate, groupByShop);
|
||
if (curTransactionList == null)
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(101, "查询失败,无数据返回!"));
|
||
}
|
||
Models.JsonList<ESCM.CurShopTransactionModel> jsonList =
|
||
Models.JsonList<ESCM.CurShopTransactionModel>.Success(curTransactionList);
|
||
|
||
return Ok(Models.JsonMsg<Models.JsonList<ESCM.CurShopTransactionModel>>.Success(jsonList, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetShopCurRevenue");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取最新的同步日期
|
||
/// <summary>
|
||
/// 获取最新的同步日期
|
||
/// </summary>
|
||
[Route("Revenue/GetLastSyncDateTime")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<string>))]
|
||
public IHttpActionResult GetLastSyncDateTime()
|
||
{
|
||
try
|
||
{
|
||
//获取最新的同步日期
|
||
var result = ESCG.HolidayHelper.GetLastSyncDateTime(transaction);
|
||
return Ok(Models.JsonMsg<string>.Success(result, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n",
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetLastSyncDateTime");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取节日营收数据对比分析
|
||
/// <summary>
|
||
/// 获取节日营收数据对比分析
|
||
/// </summary>
|
||
/// <param name="pushProvinceCode">省份编码</param>
|
||
/// <param name="curYear">本年年份</param>
|
||
/// <param name="compareYear">历年年份</param>
|
||
/// <param name="HolidayType">
|
||
/// 节日类型:<br/>
|
||
/// 1【元旦】<br/>2【春运】<br/>3【清明】<br/>4【五一】<br/>5【端午】<br/>6【暑期】<br/>7【中秋】<br/>8【国庆】
|
||
/// </param>
|
||
/// <param name="StatisticsDate">统计日期</param>
|
||
/// <param name="ServerpartId">服务区内码,多个用,隔开</param>
|
||
[Route("Revenue/GetHolidayAnalysis")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.HolidayCompareModel>))]
|
||
public IHttpActionResult GetHolidayAnalysis(string pushProvinceCode,
|
||
int curYear, int compareYear, int HolidayType, string StatisticsDate, string ServerpartId = "")
|
||
{
|
||
string Parameter = "入参信息:推送省份【" + pushProvinceCode + "】,节日类型【" + HolidayType + "】," +
|
||
"本年年份【" + curYear + "】,历年年份【" + compareYear + "】," +
|
||
"统计日期【" + StatisticsDate + "】,服务区内码【" + ServerpartId + "】";
|
||
try
|
||
{
|
||
//如果没有传入“营收汇总数据结算日期”,默认按结束日期计算
|
||
if (string.IsNullOrWhiteSpace(StatisticsDate))
|
||
{
|
||
StatisticsDate = DateTime.Now.ToShortDateString();
|
||
}
|
||
//else if (HolidayType == 2 && DateTime.Parse(StatisticsDate).Date > DateTime.Parse("2024/3/5"))
|
||
//{
|
||
// StatisticsDate = "2024/3/5";
|
||
//}
|
||
|
||
//获取实时营收数据
|
||
ESCM.HolidayCompareModel holidayCompareModel = ESCG.HolidayHelper.GetRevenueAnalysis(transaction,
|
||
pushProvinceCode, curYear, compareYear, HolidayType, StatisticsDate, ServerpartId);
|
||
if (holidayCompareModel == null)
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(101, "查询失败,无数据返回!"));
|
||
}
|
||
|
||
return Ok(Models.JsonMsg<ESCM.HolidayCompareModel>.Success(holidayCompareModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetHolidayAnalysis");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取节假日区域对客分析
|
||
/// <summary>
|
||
/// 获取节假日区域对客分析
|
||
/// </summary>
|
||
/// <param name="pushProvinceCode">省份编码</param>
|
||
/// <param name="curYear">本年年份</param>
|
||
/// <param name="compareYear">历年年份</param>
|
||
/// <param name="HolidayType">
|
||
/// 节日类型:<br/>
|
||
/// 1【元旦】<br/>2【春运】<br/>3【清明】<br/>4【五一】<br/>5【端午】<br/>6【暑期】<br/>7【中秋】<br/>8【国庆】
|
||
/// </param>
|
||
/// <param name="StatisticsDate">统计日期</param>
|
||
/// <param name="businessType">
|
||
/// 经营模式:<br/>
|
||
/// 1000【合作分成】<br/>2000【固定租金】<br/>3000【自营提成】<br/>4000【业主自营】
|
||
/// </param>
|
||
/// <param name="businessTrade">
|
||
/// 经营业态:<br/>
|
||
/// 1【餐饮】<br/>2【便利店】<br/>3【加盟餐饮】<br/>4【客房及其他】
|
||
/// </param>
|
||
/// <param name="businessRegion">
|
||
/// 经营区域:<br/>
|
||
/// 1【服务区】<br/>2【城市店】
|
||
/// </param>
|
||
[Route("Revenue/GetHolidaySPRAnalysis")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.NestingModel<ESCM.HolidaySPRAnalysisModel>>>))]
|
||
public IHttpActionResult GetHolidaySPRAnalysis(string pushProvinceCode, int curYear, int compareYear, int HolidayType,
|
||
string StatisticsDate, string businessType = "", string businessTrade = "", string businessRegion = "")
|
||
{
|
||
string Parameter = "入参信息:推送省份【" + pushProvinceCode + "】,节日类型【" + HolidayType + "】," +
|
||
"本年年份【" + curYear + "】,历年年份【" + compareYear + "】,统计日期【" + StatisticsDate + "】," +
|
||
"经营模式【" + businessType + "】,经营业态【" + businessTrade + "】,经营区域【" + businessRegion + "】";
|
||
try
|
||
{
|
||
//如果没有传入“营收汇总数据结算日期”,默认按结束日期计算
|
||
if (string.IsNullOrWhiteSpace(StatisticsDate))
|
||
{
|
||
StatisticsDate = DateTime.Now.ToShortDateString();
|
||
}
|
||
//else if (HolidayType == 2 && DateTime.Parse(StatisticsDate).Date > DateTime.Parse("2024/3/5"))
|
||
//{
|
||
// StatisticsDate = "2024/3/5";
|
||
//}
|
||
|
||
//获取实时营收数据
|
||
List<ESCM.NestingModel<ESCM.HolidaySPRAnalysisModel>> holidaySPRAnalysisList =
|
||
ESCG.HolidayHelper.GetHolidaySPRAnalysis(transaction, pushProvinceCode, curYear, compareYear,
|
||
HolidayType, StatisticsDate, businessType, businessTrade, businessRegion);
|
||
if (holidaySPRAnalysisList == null || holidaySPRAnalysisList.Count == 0)
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(101, "查询失败,无数据返回!"));
|
||
}
|
||
Models.JsonList<ESCM.NestingModel<ESCM.HolidaySPRAnalysisModel>> jsonList =
|
||
Models.JsonList<ESCM.NestingModel<ESCM.HolidaySPRAnalysisModel>>.Success(holidaySPRAnalysisList);
|
||
|
||
return Ok(Models.JsonMsg<Models.JsonList<ESCM.NestingModel<ESCM.HolidaySPRAnalysisModel>>>.Success(jsonList, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetHolidaySPRAnalysis");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取节假日各类项目所有天数对客分析
|
||
/// <summary>
|
||
/// 获取节假日各类项目所有天数对客分析
|
||
/// </summary>
|
||
/// <param name="pushProvinceCode">省份编码</param>
|
||
/// <param name="curYear">本年年份</param>
|
||
/// <param name="compareYear">历年年份</param>
|
||
/// <param name="HolidayType">
|
||
/// 节日类型:<br/>
|
||
/// 1【元旦】<br/>2【春运】<br/>3【清明】<br/>4【五一】<br/>5【端午】<br/>6【暑期】<br/>7【中秋】<br/>8【国庆】
|
||
/// </param>
|
||
/// <param name="StatisticsDate">统计日期</param>
|
||
/// <param name="SPRegionTypeId">片区内码,多个用,隔开</param>
|
||
/// <param name="ServerpartId">服务区内码,多个用,隔开</param>
|
||
/// <param name="businessType">
|
||
/// 经营模式:<br/>
|
||
/// 1000【合作分成】<br/>2000【固定租金】<br/>3000【自营提成】<br/>4000【业主自营】
|
||
/// </param>
|
||
/// <param name="businessTrade">
|
||
/// 经营业态:<br/>
|
||
/// 1【餐饮】<br/>2【便利店】<br/>3【加盟餐饮】<br/>4【客房及其他】
|
||
/// </param>
|
||
/// <param name="businessRegion">
|
||
/// 经营区域:<br/>
|
||
/// 1【服务区】<br/>2【城市店】
|
||
/// </param>
|
||
[Route("Revenue/GetHolidayDailyAnalysis")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.CommonKeyDateModel>>))]
|
||
public IHttpActionResult GetHolidayDailyAnalysis(string pushProvinceCode, int curYear, int compareYear,
|
||
int HolidayType, string StatisticsDate, string SPRegionTypeId = "", string ServerpartId = "",
|
||
string businessType = "", string businessTrade = "", string businessRegion = "")
|
||
{
|
||
string Parameter = "入参信息:推送省份【" + pushProvinceCode + "】,节日类型【" + HolidayType + "】," +
|
||
"本年年份【" + curYear + "】,历年年份【" + compareYear + "】,统计日期【" + StatisticsDate + "】," +
|
||
"片区内码【" + SPRegionTypeId + "】,服务区内码【" + ServerpartId + "】," +
|
||
"经营模式【" + businessType + "】,经营业态【" + businessTrade + "】,经营区域【" + businessRegion + "】";
|
||
try
|
||
{
|
||
//如果没有传入“营收汇总数据结算日期”,默认按结束日期计算
|
||
if (string.IsNullOrWhiteSpace(StatisticsDate))
|
||
{
|
||
StatisticsDate = DateTime.Now.ToShortDateString();
|
||
}
|
||
//else if (HolidayType == 2 && DateTime.Parse(StatisticsDate).Date > DateTime.Parse("2024/3/5"))
|
||
//{
|
||
// StatisticsDate = "2024/3/5";
|
||
//}
|
||
|
||
//获取实时营收数据
|
||
List<ESCM.CommonKeyDateModel> dailyAnalysisList = ESCG.HolidayHelper.GetHolidayDailyAnalysis(
|
||
transaction, pushProvinceCode, curYear, compareYear, HolidayType, StatisticsDate,
|
||
SPRegionTypeId, ServerpartId, businessType, businessTrade, businessRegion);
|
||
if (dailyAnalysisList == null || dailyAnalysisList.Count == 0)
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(101, "查询失败,无数据返回!"));
|
||
}
|
||
Models.JsonList<ESCM.CommonKeyDateModel> jsonList =
|
||
Models.JsonList<ESCM.CommonKeyDateModel>.Success(dailyAnalysisList);
|
||
|
||
return Ok(Models.JsonMsg<Models.JsonList<ESCM.CommonKeyDateModel>>.Success(jsonList, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetHolidayDailyAnalysis");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取服务区营收增幅分析
|
||
/// <summary>
|
||
/// 获取服务区营收增幅分析
|
||
/// </summary>
|
||
/// <param name="calcType">计算方式:1【当日】,2【累计】</param>
|
||
/// <param name="pushProvinceCode">省份编码</param>
|
||
/// <param name="curYear">本年年份</param>
|
||
/// <param name="compareYear">历年年份</param>
|
||
/// <param name="HolidayType">
|
||
/// 节日类型:<br/>
|
||
/// 1【元旦】<br/>2【春运】<br/>3【清明】<br/>4【五一】<br/>5【端午】<br/>6【暑期】<br/>7【中秋】<br/>8【国庆】
|
||
/// </param>
|
||
/// <param name="StatisticsDate">统计日期</param>
|
||
/// <param name="CurStartDate">统计开始日期</param>
|
||
/// <param name="ServerpartId">服务区内码,多个用,隔开</param>
|
||
/// <param name="businessRegion">
|
||
/// 经营区域:<br/>
|
||
/// 1【服务区】<br/>
|
||
/// 2【城市店】
|
||
/// </param>
|
||
/// <param name="SortStr">
|
||
/// 排序字段:<br/>
|
||
/// 营业额:revenue<br/>
|
||
/// 驿达收入:account<br/>
|
||
/// 车流量:bayonet<br/>
|
||
/// 正序:asc,倒序:desc<br/>
|
||
/// 示例:revenue desc,bayonet desc
|
||
/// </param>
|
||
/// <param name="IsYOYCompare">是否对比同期数据</param>
|
||
[Route("Revenue/GetServerpartINCAnalysis")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.HolidayIncreaseModel>>))]
|
||
public IHttpActionResult GetServerpartINCAnalysis(int calcType, string pushProvinceCode,
|
||
int curYear, int HolidayType, string StatisticsDate, int? compareYear = null, string CurStartDate = "",
|
||
string ServerpartId = "", int? businessRegion = null, string SortStr = "", bool IsYOYCompare = false)
|
||
{
|
||
string Parameter = "入参信息:推送省份【" + pushProvinceCode + "】,节日类型【" + HolidayType + "】," +
|
||
"本年年份【" + curYear + "】,历年年份【" + compareYear + "】,对比同期数据【" + IsYOYCompare + "】," +
|
||
"计算方式【" + calcType + "】,统计日期【" + StatisticsDate + "】,统计开始日期【" + CurStartDate + "】," +
|
||
"服务区内码【" + ServerpartId + "】,经营区域【" + businessRegion + "】,排序字段【" + SortStr + "】";
|
||
try
|
||
{
|
||
//如果没有传入“营收汇总数据结算日期”,默认按结束日期计算
|
||
if (string.IsNullOrWhiteSpace(StatisticsDate))
|
||
{
|
||
StatisticsDate = DateTime.Now.ToShortDateString();
|
||
}
|
||
//else if (HolidayType == 2 && DateTime.Parse(StatisticsDate).Date > DateTime.Parse("2024/3/5"))
|
||
//{
|
||
// StatisticsDate = "2024/3/5";
|
||
//}
|
||
|
||
string HolidayPeriod = "";
|
||
List<ESCM.HolidayIncreaseModel> INCAnalysisList = ESCG.HolidayHelper.GetServerpartINCAnalysis(transaction,
|
||
pushProvinceCode, calcType, curYear, compareYear ?? curYear - 1, HolidayType, StatisticsDate,
|
||
CurStartDate, ServerpartId, businessRegion, SortStr, IsYOYCompare, ref HolidayPeriod);
|
||
if (INCAnalysisList == null || INCAnalysisList.Count == 0)
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(101, "查询失败,无数据返回!"));
|
||
}
|
||
Models.JsonList<ESCM.HolidayIncreaseModel, string> jsonList =
|
||
Models.JsonList<ESCM.HolidayIncreaseModel, string>.Success(INCAnalysisList, HolidayPeriod);
|
||
|
||
return Ok(Models.JsonMsg<Models.JsonList<ESCM.HolidayIncreaseModel, string>>.Success(jsonList, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetServerpartINCAnalysis");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取门店营收增幅分析
|
||
/// <summary>
|
||
/// 获取门店营收增幅分析
|
||
/// </summary>
|
||
/// <param name="calcType">计算方式:1【当日】,2【累计】</param>
|
||
/// <param name="pushProvinceCode">省份编码</param>
|
||
/// <param name="curYear">本年年份</param>
|
||
/// <param name="compareYear">历年年份</param>
|
||
/// <param name="HolidayType">
|
||
/// 节日类型:<br/>
|
||
/// 1【元旦】<br/>2【春运】<br/>3【清明】<br/>4【五一】<br/>5【端午】<br/>6【暑期】<br/>7【中秋】<br/>8【国庆】
|
||
/// </param>
|
||
/// <param name="StatisticsDate">统计日期</param>
|
||
/// <param name="CurStartDate">统计开始日期</param>
|
||
/// <param name="ServerpartId">服务区内码,多个用,隔开</param>
|
||
/// <param name="SortStr">
|
||
/// 排序字段:<br/>
|
||
/// 本年:curyeardata<br/>
|
||
/// 历年:lyeardata<br/>
|
||
/// 增长:increasedata<br/>
|
||
/// 增幅:increaserate<br/>
|
||
/// 正序:asc,倒序:desc<br/>
|
||
/// 示例:revenue desc
|
||
/// </param>
|
||
[Route("Revenue/GetShopINCAnalysis")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.HolidayIncreaseModel>))]
|
||
public IHttpActionResult GetShopINCAnalysis(int calcType, string pushProvinceCode, int curYear, int compareYear,
|
||
int HolidayType, int ServerpartId, string StatisticsDate, string CurStartDate = "", string SortStr = "")
|
||
{
|
||
string Parameter = "入参信息:推送省份【" + pushProvinceCode + "】,节日类型【" + HolidayType + "】," +
|
||
"本年年份【" + curYear + "】,历年年份【" + compareYear + "】,服务区内码【" + ServerpartId + "】," +
|
||
"统计日期【" + StatisticsDate + "】,统计开始日期【" + CurStartDate + "】,排序字段【" + SortStr + "】";
|
||
try
|
||
{
|
||
//如果没有传入“营收汇总数据结算日期”,默认按结束日期计算
|
||
if (string.IsNullOrWhiteSpace(StatisticsDate))
|
||
{
|
||
StatisticsDate = DateTime.Now.ToShortDateString();
|
||
}
|
||
//else if (HolidayType == 2 && DateTime.Parse(StatisticsDate).Date > DateTime.Parse("2024/3/5"))
|
||
//{
|
||
// StatisticsDate = "2024/3/5";
|
||
//}
|
||
|
||
//获取实时营收数据
|
||
ESCM.HolidayIncreaseModel increaseModel = ESCG.HolidayHelper.GetShopINCAnalysis(transaction, pushProvinceCode,
|
||
calcType, curYear, compareYear, HolidayType, ServerpartId, StatisticsDate, CurStartDate, SortStr);
|
||
if (increaseModel == null)
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(101, "查询失败,无数据返回!"));
|
||
}
|
||
|
||
return Ok(Models.JsonMsg<ESCM.HolidayIncreaseModel>.Success(increaseModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetShopINCAnalysis");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取月度经营增幅分析
|
||
/// <summary>
|
||
/// 获取月度经营增幅分析
|
||
/// </summary>
|
||
/// <param name="calcType">计算方式:1【当月】,2【累计】</param>
|
||
/// <param name="pushProvinceCode">省份编码</param>
|
||
/// <param name="curYear">本年年份</param>
|
||
/// <param name="compareYear">历年年份</param>
|
||
/// <param name="StatisticsMonth">结算结束月份</param>
|
||
/// <param name="StatisticsStartMonth">结算开始月份,格式yyyyMM</param>
|
||
/// <param name="StatisticsDate">统计日期</param>
|
||
/// <param name="SPRegionTypeId">片区内码,多个用,隔开</param>
|
||
/// <param name="ServerpartId">服务区内码,多个用,隔开</param>
|
||
/// <param name="businessType">
|
||
/// 经营模式:<br/>
|
||
/// 1000【合作分成】<br/>2000【固定租金】<br/>3000【自营提成】<br/>4000【业主自营】
|
||
/// </param>
|
||
/// <param name="businessTrade">
|
||
/// 经营业态:<br/>
|
||
/// 1【餐饮】<br/>2【便利店】<br/>3【加盟餐饮】<br/>4【客房及其他】
|
||
/// </param>
|
||
/// <param name="businessRegion">
|
||
/// 经营区域:<br/>
|
||
/// 1【服务区】<br/>2【城市店】
|
||
/// </param>
|
||
[Route("Revenue/GetMonthlyBusinessAnalysis")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.HolidayIncreaseModel>>))]
|
||
public IHttpActionResult GetMonthlyBusinessAnalysis(int calcType, string pushProvinceCode, int curYear, int compareYear,
|
||
int StatisticsMonth, int? StatisticsStartMonth = null, string StatisticsDate = "", string SPRegionTypeId = "",
|
||
string ServerpartId = "", string businessType = "", string businessTrade = "", string businessRegion = "")
|
||
{
|
||
string Parameter = "入参信息:计算方式【" + calcType + "】,推送省份【" + pushProvinceCode + "】," +
|
||
"本年年份【" + curYear + "】,历年年份【" + compareYear + "】," +
|
||
"结算月份【" + StatisticsMonth + "】,结算开始月份【" + StatisticsMonth + "】," +
|
||
"统计日期【" + StatisticsDate + "】,片区内码【" + SPRegionTypeId + "】,服务区内码【" + ServerpartId + "】," +
|
||
"经营模式【" + businessType + "】,经营业态【" + businessTrade + "】,经营区域【" + businessRegion + "】";
|
||
try
|
||
{
|
||
if (StatisticsStartMonth == null)
|
||
{
|
||
if (calcType == 1)
|
||
{
|
||
StatisticsStartMonth = curYear * 100 + StatisticsMonth;
|
||
}
|
||
else
|
||
{
|
||
StatisticsStartMonth = curYear * 100 + 1;
|
||
}
|
||
}
|
||
|
||
//获取实时营收数据
|
||
List<ESCM.HolidayIncreaseModel> dailyAnalysisList = ESCG.HolidayHelper.GetMonthlyBusinessAnalysis(transaction,
|
||
pushProvinceCode, calcType, curYear, compareYear, StatisticsMonth, StatisticsStartMonth.Value, StatisticsDate,
|
||
SPRegionTypeId, ServerpartId, businessType, businessTrade, businessRegion);
|
||
if (dailyAnalysisList == null || dailyAnalysisList.Count == 0)
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(101, "查询失败,无数据返回!"));
|
||
}
|
||
Models.JsonList<ESCM.HolidayIncreaseModel> jsonList =
|
||
Models.JsonList<ESCM.HolidayIncreaseModel>.Success(dailyAnalysisList);
|
||
|
||
return Ok(Models.JsonMsg<Models.JsonList<ESCM.HolidayIncreaseModel>>.Success(jsonList, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetMonthlyBusinessAnalysis");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取服务区营收增幅分析
|
||
/// <summary>
|
||
/// 获取服务区营收增幅分析
|
||
/// </summary>
|
||
/// <param name="calcType">计算方式:<br/>1【当日】,2【累计】</param>
|
||
/// <param name="pushProvinceCode">省份编码</param>
|
||
/// <param name="curYear">本年年份</param>
|
||
/// <param name="compareYear">历年年份</param>
|
||
/// <param name="StatisticsMonth">统计结束月份</param>
|
||
/// <param name="StatisticsStartMonth">统计开始月份,格式yyyyMM</param>
|
||
/// <param name="StatisticsDate">统计日期</param>
|
||
/// <param name="ServerpartId">服务区内码,多个用,隔开</param>
|
||
/// <param name="businessRegion">
|
||
/// 经营区域:<br/>
|
||
/// 1【服务区】<br/>
|
||
/// 2【城市店】
|
||
/// </param>
|
||
/// <param name="Dimension">
|
||
/// 统计维度:<br/>1【对客销售】<br/>2【营业收入】<br/>3【入区车流】
|
||
/// </param>
|
||
/// <param name="SortStr">
|
||
/// 排序字段:<br/>
|
||
/// 营业额:revenue<br/>
|
||
/// 驿达收入:account<br/>
|
||
/// 车流量:bayonet<br/>
|
||
/// 正序:asc,倒序:desc<br/>
|
||
/// 示例:revenue desc,bayonet desc
|
||
/// </param>
|
||
[Route("Revenue/GetMonthlySPINCAnalysis")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.HolidayIncreaseModel>>))]
|
||
public IHttpActionResult GetMonthlySPINCAnalysis(int calcType, string pushProvinceCode, int curYear, int compareYear,
|
||
string StatisticsDate, int StatisticsMonth, int? StatisticsStartMonth = null, string ServerpartId = "",
|
||
int? businessRegion = null, string Dimension = "", string SortStr = "")
|
||
{
|
||
string Parameter = "入参信息:推送省份【" + pushProvinceCode + "】,统计维度【" + Dimension + "】," +
|
||
"统计结束月份【" + StatisticsMonth + "】,统计开始月份【" + StatisticsStartMonth + "】," +
|
||
"本年年份【" + curYear + "】,历年年份【" + compareYear + "】,统计日期【" + StatisticsDate + "】," +
|
||
"服务区内码【" + ServerpartId + "】,经营区域【" + businessRegion + "】,排序字段【" + SortStr + "】";
|
||
try
|
||
{
|
||
if (StatisticsStartMonth == null)
|
||
{
|
||
if (calcType == 1)
|
||
{
|
||
StatisticsStartMonth = curYear * 100 + StatisticsMonth;
|
||
}
|
||
else
|
||
{
|
||
StatisticsStartMonth = curYear * 100 + 1;
|
||
}
|
||
}
|
||
|
||
//获取实时营收数据
|
||
List<ESCM.HolidayIncreaseModel> INCAnalysisList = ESCG.HolidayHelper.GetMonthlySPINCAnalysis(transaction,
|
||
pushProvinceCode, calcType, curYear, compareYear, StatisticsMonth, StatisticsStartMonth.Value, StatisticsDate,
|
||
ServerpartId, businessRegion, SortStr, Dimension);
|
||
if (INCAnalysisList == null || INCAnalysisList.Count == 0)
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(101, "查询失败,无数据返回!"));
|
||
}
|
||
Models.JsonList<ESCM.HolidayIncreaseModel> jsonList =
|
||
Models.JsonList<ESCM.HolidayIncreaseModel>.Success(INCAnalysisList);
|
||
|
||
return Ok(Models.JsonMsg<Models.JsonList<ESCM.HolidayIncreaseModel>>.Success(jsonList, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetMonthlySPINCAnalysis");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 月度服务区门店营收对比分析
|
||
/// <summary>
|
||
/// 月度服务区门店营收对比分析
|
||
/// </summary>
|
||
/// <param name="pushProvinceCode">省份编码</param>
|
||
/// <param name="StatisticsStartMonth">统计开始月份</param>
|
||
/// <param name="StatisticsEndMonth">统计结束月份</param>
|
||
/// <param name="ServerpartId">服务区内码,多个用,隔开</param>
|
||
/// <param name="businessRegion">
|
||
/// 经营区域:<br/>
|
||
/// 1:服务区<br/>
|
||
/// 2:城市店
|
||
/// </param>
|
||
/// <param name="BusinessTradeType">
|
||
/// 经营业态大类:<br/>
|
||
/// 1:自营便利店<br/>
|
||
/// 2:自营餐饮客房<br/>
|
||
/// 3:商铺租赁
|
||
/// </param>
|
||
/// <param name="shopTrade">商品业态</param>
|
||
/// <param name="compactStartDate">合同开始日期</param>
|
||
/// <param name="compactEndDate">合同结束日期</param>
|
||
/// <param name="calcQOQ">是否计算环比</param>
|
||
/// <param name="calcYOY">是否计算同比</param>
|
||
/// <param name="calcBayonet">是否计算车流量</param>
|
||
/// <param name="hasAnalog">是否包含模拟车流</param>
|
||
/// <param name="statisticsType">
|
||
/// 统计类型:<br/>
|
||
/// 1:门店<br/>
|
||
/// 2:业态分类<br/>
|
||
/// 3:服务区类型
|
||
/// </param>
|
||
/// <param name="accountType">
|
||
/// 收入结算类型:<br/>
|
||
/// 0【标准算法】<br/>
|
||
/// 1【自营的按照商超25%,餐饮20%计算】
|
||
/// </param>
|
||
/// <param name="showRevenue">
|
||
/// 经营数据:<br/>
|
||
/// 0:全部<br/>
|
||
/// 1:增长<br/>
|
||
/// 2:降低
|
||
/// </param>
|
||
/// <param name="showBayonet">
|
||
/// 车流数据:<br/>
|
||
/// 0:全部<br/>
|
||
/// 1:增长<br/>
|
||
/// 2:降低
|
||
/// </param>
|
||
/// <param name="showLevel">
|
||
/// 显示层级:<br/>
|
||
/// 1:服务区<br/>
|
||
/// 2:门店<br/>
|
||
/// </param>
|
||
/// <param name="solidType">是否查询固化数据</param>
|
||
/// <param name="showWarning">
|
||
/// 显示预警:<br/>
|
||
/// true:预警数据<br/>
|
||
/// false:正常数据
|
||
/// </param>
|
||
/// <param name="warningType">
|
||
/// 预警类型:<br/>
|
||
/// 1:车流增加,服务区营收减少<br/>
|
||
/// 2:车流增加,门店的营收减少<br/>
|
||
/// 3:车流增加,营收增长不匹配<br/>
|
||
/// 4:车流减少,营收减低不匹配
|
||
/// </param>
|
||
/// <returns></returns>
|
||
[Route("Revenue/GetMonthINCAnalysis")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.HolidayIncreaseModel>>))]
|
||
public IHttpActionResult GetMonthINCAnalysis(string pushProvinceCode, string StatisticsStartMonth,
|
||
string StatisticsEndMonth, string ServerpartId = "", int? businessRegion = null, string BusinessTradeType = "",
|
||
string shopTrade = "", string compactStartDate = "", string compactEndDate = "", bool calcQOQ = false, bool calcYOY = false,
|
||
bool calcBayonet = false, bool hasAnalog = true, int statisticsType = 1, int accountType = 0, int showRevenue = 0,
|
||
int showBayonet = 0, int showLevel = 1, bool solidType = true, bool? showWarning = true, int? warningType = null)
|
||
{
|
||
string Parameter = "入参信息:推送省份【" + pushProvinceCode + "】,统计类型【" + statisticsType + "】" +
|
||
"统计开始月份【" + StatisticsStartMonth + "】,统计结束月份【" + StatisticsEndMonth + "】," +
|
||
"服务区内码【" + ServerpartId + "】,经营区域【" + businessRegion + "】,商品业态【" + shopTrade + "】," +
|
||
"合同开始日期【" + compactStartDate + "】,合同结束日期【" + compactEndDate + "】,是否计算环比【" + calcQOQ + "】," +
|
||
"是否计算同比【" + calcYOY + "】,是否计算车流量【" + calcBayonet + "】,是否包含模拟车流【" + hasAnalog + "】," +
|
||
"统计类型【" + statisticsType + "】,收入结算类型【" + accountType + "】,查询固化【" + solidType + "】," +
|
||
"经营增幅【" + showRevenue + "】,车流增幅【" + showBayonet + "】,显示层级【" + showLevel + "】," +
|
||
"显示预警【" + showWarning + "】,预警类型【" + warningType + "】";
|
||
try
|
||
{
|
||
//获取实时营收数据
|
||
List<ESCM.NestingModel<ESCM.HolidayIncreaseModel>> INCAnalysisList = ESCG.AccountHelper.GetMonthINCAnalysis(
|
||
transaction, pushProvinceCode, StatisticsStartMonth, StatisticsEndMonth, ServerpartId, businessRegion,
|
||
BusinessTradeType, shopTrade, compactStartDate, compactEndDate, calcQOQ, calcYOY, calcBayonet, hasAnalog,
|
||
statisticsType, accountType, showRevenue, showBayonet, showLevel, solidType, showWarning, warningType);
|
||
if (INCAnalysisList == null || INCAnalysisList.Count == 0)
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(101, "查询失败,无数据返回!"));
|
||
}
|
||
Models.JsonList<ESCM.NestingModel<ESCM.HolidayIncreaseModel>> jsonList =
|
||
Models.JsonList<ESCM.NestingModel<ESCM.HolidayIncreaseModel>>.Success(INCAnalysisList);
|
||
|
||
return Ok(Models.JsonMsg<Models.JsonList<ESCM.NestingModel<
|
||
ESCM.HolidayIncreaseModel>>>.Success(jsonList, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetMonthINCAnalysis");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 汇总月度经营项目预警数值
|
||
/// <summary>
|
||
/// 汇总月度经营项目预警数值
|
||
/// </summary>
|
||
/// <param name="StatisticsStartMonth">统计开始月份</param>
|
||
/// <param name="StatisticsEndMonth">统计结束月份</param>
|
||
/// <param name="BusinessTradeType">
|
||
/// 经营业态大类:<br/>
|
||
/// 1:自营便利店<br/>
|
||
/// 2:自营餐饮客房<br/>
|
||
/// 3:商铺租赁
|
||
/// </param>
|
||
/// <param name="shopTrade">经营业态</param>
|
||
[Route("Revenue/GetMonthINCAnalysisSummary")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.CommonKeyModel>>))]
|
||
public IHttpActionResult GetMonthINCAnalysisSummary(string StatisticsStartMonth,
|
||
string StatisticsEndMonth, string BusinessTradeType = "", string shopTrade = "")
|
||
{
|
||
string Parameter = "入参信息:统计开始月份【" + StatisticsStartMonth + "】," +
|
||
"统计结束月份【" + StatisticsEndMonth + "】,经营业态大类【" + BusinessTradeType + "】,经营业态【" + shopTrade + "】";
|
||
try
|
||
{
|
||
//获取实时营收数据
|
||
List<ESCM.CommonKeyModel> INCAnalysisList = ESCG.AccountHelper.GetMonthINCAnalysisSummary(transaction,
|
||
StatisticsStartMonth, StatisticsEndMonth, BusinessTradeType, shopTrade);
|
||
|
||
Models.JsonList<ESCM.CommonKeyModel> jsonList =
|
||
Models.JsonList<ESCM.CommonKeyModel>.Success(INCAnalysisList);
|
||
|
||
return Ok(Models.JsonMsg<Models.JsonList<
|
||
ESCM.CommonKeyModel>>.Success(jsonList, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetMonthINCAnalysisSummary");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 固化月度经营预警数据
|
||
/// <summary>
|
||
/// 固化月度经营预警数据
|
||
/// </summary>
|
||
/// <param name="pushProvinceCode">省份编码</param>
|
||
/// <param name="StatisticsMonth">统计月份</param>
|
||
/// <param name="ServerpartId">服务区内码</param>
|
||
/// <param name="hasAnalog">是否包含模拟车流</param>
|
||
/// <param name="accountType">
|
||
/// 结算方式:<br/>
|
||
/// 0:自营100%<br/>
|
||
/// 1:自营按商超25%,餐饮20%计算
|
||
/// </param>
|
||
[Route("Revenue/StorageMonthINCAnalysis")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.CommonKeyModel>>))]
|
||
public IHttpActionResult StorageMonthINCAnalysis(string pushProvinceCode, string StatisticsMonth,
|
||
string ServerpartId = "", bool hasAnalog = true, int accountType = 0)
|
||
{
|
||
string Parameter = "入参信息:推送省份【" + pushProvinceCode + "】,统计月份【" + StatisticsMonth + "】," +
|
||
"服务区内码【" + ServerpartId + "】,是否包含模拟车流【" + hasAnalog + "】,收入结算类型【" + accountType + "】";
|
||
|
||
try
|
||
{
|
||
//获取实时营收数据
|
||
ESCG.AccountHelper.StorageMonthINCAnalysis(transaction, pushProvinceCode,
|
||
StatisticsMonth, ServerpartId, hasAnalog, accountType);
|
||
|
||
return Ok(ESCG.Common.ReturnJson(100, "生成成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "生成失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_StorageMonthINCAnalysis");
|
||
return Ok(ESCG.Common.ReturnJson(999, "生成失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 月度服务区门店商业适配指数(SABFI)
|
||
/// <summary>
|
||
/// 月度服务区门店商业适配指数(SABFI)
|
||
/// </summary>
|
||
/// <param name="pushProvinceCode">省份编码</param>
|
||
/// <param name="StatisticsMonth">统计月份</param>
|
||
/// <param name="ServerpartId">服务区内码,多个用,隔开</param>
|
||
/// <param name="BusinessTradeType">
|
||
/// 经营业态大类:<br/>
|
||
/// 1:自营便利店<br/>
|
||
/// 2:自营餐饮客房<br/>
|
||
/// 3:商铺租赁
|
||
/// </param>
|
||
/// <param name="BusinessTrade">经营业态</param>
|
||
/// <param name="accountType">
|
||
/// 结算方式:<br/>
|
||
/// 0:自营100%<br/>
|
||
/// 1:自营按商超25%,餐饮20%计算
|
||
/// </param>
|
||
[Route("Revenue/GetShopSABFIList")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.NestingModel<ESCM.SABFIModel>>>))]
|
||
public IHttpActionResult GetShopSABFIList(string pushProvinceCode, string StatisticsMonth,
|
||
string ServerpartId, string BusinessTradeType = "", string BusinessTrade = "", int accountType = 0)
|
||
{
|
||
try
|
||
{
|
||
//获取实时营收数据
|
||
List<ESCM.NestingModel<ESCM.SABFIModel>> AnalysisList = ESCG.AccountHelper.GetShopSABFIList(transaction,
|
||
pushProvinceCode, StatisticsMonth, ServerpartId, BusinessTradeType, BusinessTrade, accountType);
|
||
|
||
Models.JsonList<ESCM.NestingModel<ESCM.SABFIModel>> jsonList =
|
||
Models.JsonList<ESCM.NestingModel<ESCM.SABFIModel>>.Success(AnalysisList);
|
||
|
||
return Ok(Models.JsonMsg<Models.JsonList<ESCM.NestingModel<ESCM.SABFIModel>>>.Success(jsonList, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
string Parameter = "入参信息:推送省份【" + pushProvinceCode + "】,统计月份【" + StatisticsMonth + "】," +
|
||
"服务区内码【" + ServerpartId + "】,经营业态大类【" + BusinessTradeType + "】," +
|
||
"经营业态【" + BusinessTrade + "】,结算方式【" + accountType + "】";
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetShopSABFIList");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取实时交易明细
|
||
/// <summary>
|
||
/// 获取实时交易明细
|
||
/// </summary>
|
||
/// <param name="ProvinceCode">省份编码</param>
|
||
/// <param name="ServerpartId">服务区内码</param>
|
||
/// <param name="ServerpartShopId">门店内码</param>
|
||
/// <param name="StartTime">开始时间</param>
|
||
/// <param name="EndTime">结束时间</param>
|
||
/// <param name="PageIndex">显示页码</param>
|
||
/// <param name="PageSize">每页数量</param>
|
||
[Route("Revenue/GetTransactionDetailList")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.CurShopTransactionModel>>))]
|
||
public IHttpActionResult GetTransactionDetailList(string ProvinceCode, string ServerpartId = "",
|
||
string ServerpartShopId = "", string StartTime = "", string EndTime = "", int PageIndex = 1, int PageSize = 100)
|
||
{
|
||
try
|
||
{
|
||
int TotalCount = 0;
|
||
if (string.IsNullOrWhiteSpace(StartTime))
|
||
{
|
||
StartTime = DateTime.Now.AddMinutes(-10).ToString();
|
||
}
|
||
if (string.IsNullOrWhiteSpace(EndTime))
|
||
{
|
||
EndTime = DateTime.Now.ToString();
|
||
}
|
||
|
||
//获取实时营收数据
|
||
List<ESCM.CurShopTransactionModel> TransactionList = ESCG.TransactionHelper.GetTransactionDetailList(transaction,
|
||
ProvinceCode, ServerpartId, ServerpartShopId, StartTime, EndTime, PageIndex, PageSize, ref TotalCount);
|
||
|
||
Models.JsonList<ESCM.CurShopTransactionModel> jsonList =
|
||
Models.JsonList<ESCM.CurShopTransactionModel>.Success(TransactionList, TotalCount, PageIndex, PageSize);
|
||
|
||
return Ok(Models.JsonMsg<Models.JsonList<ESCM.CurShopTransactionModel>>.Success(jsonList, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
string Parameter = "入参信息:推送省份【" + ProvinceCode + "】,服务区内码【" + ServerpartId + "】," +
|
||
"门店内码【" + ServerpartShopId + "】,开始时间【" + StartTime + "】,结束时间【" + EndTime + "】," +
|
||
"显示页码【" + PageIndex + "】,每页数量【" + PageSize + "】";
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetTransactionDetailList");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
}
|
||
} |