2025-04-24 18:31:27 +08:00

204 lines
7.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
{
/// <summary>
/// 2023年8月版本的总部管理者的报表
/// </summary>
public class ManagerReport2308Controller : BaseWechatController
{
private IReport2308Service _report2308Service;
private IUserService _userService;
/// <summary>
/// 初始化一个<see cref="GoodsController"/>类型的实例
/// </summary>
public ManagerReport2308Controller(IReport2308Service report2308Service
, IUserService userService)
{
_report2308Service = report2308Service;
_userService = userService;
}
#region GetUserOrganizationTrees()
/// <summary>
/// 获取树形结构的某账号下的组织架构用户
/// </summary>
/// <param name="req">组织ID初始本人传"-1"</param>
/// <returns></returns>
[HttpPost]
public List<UserOrganizationTree> 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(使)
/// <summary>
/// 系统使用数据
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[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()
/// <summary>
/// 区域方块数据查询
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[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)
/// <summary>
/// 202308版本报表查询店铺分页列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
public List<ShopCustomerListResp> GetManageShopPageList(KeyWords2308Quest request)
{
request.LabelQuery = null;
return _report2308Service.GetManageShop2308PageList(request, this.CurrentLogin);
}
#endregion
#region GetShopsListByLabel()
/// <summary>
/// 根据选中的标签得到店铺数组
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
public List<ShopCustomerListResp> 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(使)
/// <summary>
/// 手动保存每日系统使用数据到缓存
/// </summary>
/// <param name="begin"></param>
/// <param name="zhiDingShopId">指定店铺ID空则是全部正常营业的店铺</param>
[HttpGet]
[AllowAnonymous]
public void Save2308TodayDataShouDong(DateTime begin, Guid zhiDingShopId, string key)
{
if (key == "123456789")
_report2308Service.Save2308TodayDataShouDong(begin, zhiDingShopId);
}
#endregion
#region GetShopLabelList()
/// <summary>
/// 获取店铺标签列表
/// </summary>
/// <returns></returns>
[HttpGet]
public List<ItemResult> GetShopLabelList()
{
return _report2308Service.GetShopLabelList(1);
}
#endregion
//#region GetTheMonthData(获取全部的诊断四表数据)
///// <summary>
///// 获取全部的诊断四表数据
///// </summary>
///// <param name="begin"></param>
///// <param name="end"></param>
///// <returns></returns>
//[HttpGet]
//[AllowAnonymous]
//public List<TheMonthDataResp> GetTheMonthData(DateTime begin, DateTime end)
//{
// return _report2308Service.GetTheMonthData1(begin, end);
//}
//#endregion
}
}