using MyCode.Project.Domain.Message.Act.Report2301;
using MyCode.Project.Domain.Message.Request.Report40;
using MyCode.Project.Domain.Message.Request.Shop;
using MyCode.Project.Domain.Message.Response.Common;
using MyCode.Project.Domain.Message.Response.Report40;
using MyCode.Project.Domain.Message.Response.ReturnVisitLog;
using MyCode.Project.Domain.Message.Response.Shop;
using MyCode.Project.Infrastructure.Common;
using MyCode.Project.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
namespace MyCode.Project.WebApi.Areas.Wechat.Controllers
{
///
/// 2023年8月版本的总部管理者的报表
///
public class ManagerReport2308Controller : BaseWechatController
{
private IReport2308Service _report2308Service;
private IUserService _userService;
///
/// 初始化一个类型的实例
///
public ManagerReport2308Controller(IReport2308Service report2308Service
, IUserService userService)
{
_report2308Service = report2308Service;
_userService = userService;
}
#region GetUserOrganizationTrees(获取树形结构的某账号下的组织架构用户)
///
/// 获取树形结构的某账号下的组织架构用户
///
/// 组织ID,初始本人传"-1"
///
[HttpPost]
public List GetUserOrganizationTrees(GetUserOrganizationTrees req)
{
Guid userId = this.CurrentLogin.UserId;
if (req.UserId.HasValue)
{
userId = req.UserId.Value;
}
return _report2308Service.GetUserOrganizationTrees(req.OrganizationId, userId);
}
#endregion
#region shiYongShuJu2308(系统使用数据)
///
/// 系统使用数据
///
///
///
[HttpPost]
public ShiYongShuJu2308 ShiYongShuJu(ChiXuShiYongTianShuQuery req)
{
ShiYongShuJu2308 result = new ShiYongShuJu2308();
result.ChiXuShiYongDianShu2308 = new ShiYongDianShu2308();
result.ShiYongDianShu = new ShiYongDianShu2308();
result.ZongDianShu = new ItemDetail2308();
var condition = req;
if (req.OrganizationId == null&& (req.ShopIds.Count==0 || req.ShopIds==null) && req.IfAllShop == 1
|| (req.IfAllShop == 0 && condition.LabelQuery != null && condition.LabelQuery.SearchType > 0 && condition.LabelQuery.LabelIds.Count > 0))
{
var ids = _userService.GetShopListByLoginId(this.CurrentLogin.UserId, this.CurrentLogin.RoleId, this.CurrentLogin.OrganizationId);
req.ShopIds = ids;
}
return _report2308Service.ShiYongShuJu2308(req);
}
#endregion
#region QuYuZongLan2308(区域方块数据查询)
///
/// 区域方块数据查询
///
///
///
[HttpPost]
[AllowAnonymous]
public QuYuZongLan2308 QuYuZongLan(QuYu2308Query req)
{
var condition = req;
//按区域类型,今日和月分别查询
if (req.OrganizationId == null && (req.ShopIds.Count == 0 || req.ShopIds == null) && req.IfAllShop==1
|| (req.IfAllShop == 0 && condition.LabelQuery != null && condition.LabelQuery.SearchType > 0 && condition.LabelQuery.LabelIds.Count > 0))
{
var ids = _userService.GetShopListByLoginId(this.CurrentLogin.UserId, this.CurrentLogin.RoleId, this.CurrentLogin.OrganizationId);
req.ShopIds = ids;
}
return _report2308Service.QuYuZongLan2308(req);
}
#endregion
#region GetManageShopPageList(202308版本报表查询店铺分页列表)
///
/// 202308版本报表查询店铺分页列表
///
///
///
[HttpPost]
public List GetManageShopPageList(KeyWords2308Quest request)
{
request.LabelQuery = null;
return _report2308Service.GetManageShop2308PageList(request, this.CurrentLogin);
}
#endregion
#region GetShopsListByLabel(根据选中的标签得到店铺数组)
///
/// 根据选中的标签得到店铺数组
///
///
///
[HttpPost]
public List GetShopsListByLabel(KeyWords2308Quest request)
{
return _report2308Service.GetManageShop2308PageList(request, this.CurrentLogin);
}
#endregion
[HttpGet]
[AllowAnonymous]
public void SaveAll2308TodayData(string key)
{
if(key=="123456789")
_report2308Service.SaveAll2308TodayData();
}
[HttpGet]
[AllowAnonymous]
public void Save2308TodayData(DateTime begin, Guid zhiDingShopId, string key)
{
if (key == "123456789")
_report2308Service.Save2308TodayData(begin, zhiDingShopId);
}
[HttpGet]
[AllowAnonymous]
public void MonthData2(string key)
{
if (key == "123456789")
_report2308Service.MonthData2();
}
#region Save2308TodayDataShouDong(手动保存每日系统使用数据到缓存)
///
/// 手动保存每日系统使用数据到缓存
///
///
/// 指定店铺ID,空则是全部正常营业的店铺
[HttpGet]
[AllowAnonymous]
public void Save2308TodayDataShouDong(DateTime begin, Guid zhiDingShopId, string key)
{
if (key == "123456789")
_report2308Service.Save2308TodayDataShouDong(begin, zhiDingShopId);
}
#endregion
#region GetShopLabelList(获取店铺标签列表)
///
/// 获取店铺标签列表
///
///
[HttpGet]
public List GetShopLabelList()
{
return _report2308Service.GetShopLabelList(1);
}
#endregion
//#region GetTheMonthData(获取全部的诊断四表数据)
/////
///// 获取全部的诊断四表数据
/////
/////
/////
/////
//[HttpGet]
//[AllowAnonymous]
//public List GetTheMonthData(DateTime begin, DateTime end)
//{
// return _report2308Service.GetTheMonthData1(begin, end);
//}
//#endregion
}
}