using NCC.Common.Core.Manager;
using NCC.Common.Helper;
using NCC.Dependency;
using NCC.DynamicApiController;
using NCC.Message.Interfaces.Message;
using NCC.System.Interfaces.System;
using NCC.VisualDev.Entitys.Dto.Dashboard;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NCC.VisualDev
{
///
/// 业务实现:主页显示
///
[ApiDescriptionSettings(Tag = "VisualDev", Name = "Dashboard", Order = 174)]
[Route("api/visualdev/[controller]")]
public class DashboardService : IDynamicApiController, ITransient
{
private readonly IMessageService _messageService;
private readonly IUserManager _userManager;
private readonly IDictionaryDataService _dictionaryDataService;
///
/// 初始化一个 类型的新实例
///
public DashboardService(
IMessageService messageService,
IUserManager userManager,
IDictionaryDataService dictionaryDataService)
{
_messageService = messageService;
_userManager = userManager;
_dictionaryDataService = dictionaryDataService;
}
#region Get
///
/// 获取我的待办
///
[HttpGet("FlowTodoCount")]
public async Task GetFlowTodoCount()
{
var userId = _userManager.UserId;
var waitList = new List();// await _flowTaskRepository.GetWaitList();
var flowList = new List();// await _flowDelegateService.GetList(userId);
var trialList = new List();// await _flowTaskRepository.GetTrialList();
var data = new FlowTodoCountOutput()
{
toBeReviewed = waitList.Count(),
entrust = flowList.Count(),
flowDone = trialList.Count()
};
return data;
}
///
/// 获取通知公告
///
[HttpGet("Notice")]
public async Task GetNotice()
{
List list = new List();
(await _messageService.GetList(1)).ForEach(l =>
{
list.Add(new NoticeOutput()
{
id = l.Id,
fullName = l.Title,
creatorTime = l.CreatorTime
});
});
return new { list = list };
}
///
/// 获取待办事项
///
[HttpGet("FlowTodo")]
public async Task GetFlowTodo()
{
List list = new List();
return new { list = list };
}
///
/// 获取我的待办事项
///
[HttpGet("MyFlowTodo")]
public async Task GetMyFlowTodo()
{
List list = new List();
return new { list = list };
}
///
/// 获取未读邮件
///
[HttpGet("Email")]
public async Task GetEmail()
{
List list = new List();
return new { list = list };
}
///
/// 获取横幅计算数据
///
///
[HttpGet("CountData")]
public async Task GetCountData()
{
var data = new
{
list = new List()
};
return data;
}
///
/// 获取新闻信息
///
[HttpGet("Article")]
public async Task GetArticle()
{
List list = new List();
return new { list = list };
}
[HttpGet("ProjectMonthLine")]
public async Task ProjectMonthLine()
{
//StringBuilder sb = new StringBuilder();
//sb.AppendLine("{");
//sb.AppendLine(" \"color\": [");
//sb.AppendLine(" \"#1890ff\"");
//sb.AppendLine(" ],");
//sb.AppendLine(" \"title\": {");
//sb.AppendLine(" \"text\": \"\",");
//sb.AppendLine(" \"subtext\": \"\"");
//sb.AppendLine(" },");
//sb.AppendLine(" \"tooltip\": {");
//sb.AppendLine(" \"trigger\": \"axis\",");
//sb.AppendLine(" \"axisPointer\": {");
//sb.AppendLine(" \"type\": \"shadow\"");
//sb.AppendLine(" }");
//sb.AppendLine(" },");
//sb.AppendLine(" \"grid\": {");
//sb.AppendLine(" \"left\": \"3%\",");
//sb.AppendLine(" \"right\": \"4%\",");
//sb.AppendLine(" \"bottom\": \"3%\",");
//sb.AppendLine(" \"containLabel\": true");
//sb.AppendLine(" },");
//sb.AppendLine(" \"xAxis\": [");
//sb.AppendLine(" {");
//sb.AppendLine(" \"type\": \"category\",");
//sb.AppendLine(" \"data\": [");
//for (int i = 1; i <= DateTime.Now.Month; i++)
//{
// if (i < DateTime.Now.Month)
// sb.AppendLine(" \"" + i + "月\",");
// else
// sb.AppendLine(" \"" + i + "月\"");
//}
////sb.AppendLine(" \"1月\",");
////sb.AppendLine(" \"2月\",");
////sb.AppendLine(" \"3月\",");
////sb.AppendLine(" \"4月\",");
////sb.AppendLine(" \"5月\",");
////sb.AppendLine(" \"6月\"");
//sb.AppendLine(" ],");
//sb.AppendLine(" \"axisTick\": {");
//sb.AppendLine(" \"alignWithLabel\": true");
//sb.AppendLine(" }");
//sb.AppendLine(" }");
//sb.AppendLine(" ],");
//sb.AppendLine(" \"yAxis\": [");
//sb.AppendLine(" {");
//sb.AppendLine(" \"type\": \"value\"");
//sb.AppendLine(" }");
//sb.AppendLine(" ],");
//sb.AppendLine(" \"series\": [");
//sb.AppendLine(" {");
//sb.AppendLine(" \"name\": \"项目数量(个)\",");
//sb.AppendLine(" \"type\": \"bar\",");
//sb.AppendLine(" \"barWidth\": \"60%\",");
//sb.AppendLine(" \"data\": [");
//for (int i = 1; i <= DateTime.Now.Month; i++)
//{
// if (i < DateTime.Now.Month)
// sb.AppendLine(" \"" + await _zyZbwfProjectitemService.GetProAmountMonth(i) + "\",");
// else
// sb.AppendLine(" \"" + await _zyZbwfProjectitemService.GetProAmountMonth(i) + "\"");
//}
////sb.AppendLine(" 1012,");
////sb.AppendLine(" 2000,");
////sb.AppendLine(" 800,");
////sb.AppendLine(" 1500,");
////sb.AppendLine(" 1600,");
////sb.AppendLine(" 1103");
//sb.AppendLine(" ]");
//sb.AppendLine(" }");
//sb.AppendLine(" ]");
//sb.AppendLine("}");
var data = new
{
chartdata = JsonHelper.ToObject("{}")
};
return data;
}
[HttpGet("VipShopPie")]
public async Task VipShopPie()
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("{");
sb.AppendLine(" \"title\": {");
sb.AppendLine(" \"text\": \"会员情况统计\",");
sb.AppendLine(" \"subtext\": \"实时数据\",");
sb.AppendLine(" \"left\": \"center\"");
sb.AppendLine(" },");
sb.AppendLine(" \"tooltip\": {");
sb.AppendLine(" \"trigger\": \"item\",");
sb.AppendLine(" \"formatter\": \"{a} {b} : {c} ({d}%)\"");
sb.AppendLine(" },");
sb.AppendLine(" \"legend\": {");
sb.AppendLine(" \"bottom\": 10,");
sb.AppendLine(" \"left\": \"center\",");
sb.AppendLine(" \"data\": [");
sb.AppendLine(" \"春凡大药房\",");
sb.AppendLine(" \"春国大药房\"");
sb.AppendLine(" ]");
sb.AppendLine(" },");
sb.AppendLine(" \"series\": [");
sb.AppendLine(" {");
sb.AppendLine(" \"type\": \"pie\",");
sb.AppendLine(" \"radius\": \"65%\",");
sb.AppendLine(" \"center\": [");
sb.AppendLine(" \"50%\",");
sb.AppendLine(" \"50%\"");
sb.AppendLine(" ],");
sb.AppendLine(" \"selectedMode\": \"single\",");
sb.AppendLine(" \"data\": [");
sb.AppendLine(" {");
// sb.AppendLine(" \"value\": " + await vipbll.GetShopVipCount("CF") + ",");
sb.AppendLine(" \"name\": \"春凡大药房\",");
sb.AppendLine(" \"itemStyle\": {");
sb.AppendLine(" \"color\": \"#1890ff\"");
sb.AppendLine(" }");
sb.AppendLine(" },");
sb.AppendLine(" {");
// sb.AppendLine(" \"value\": " + await vipbll.GetShopVipCount("CG1") + ",");
sb.AppendLine(" \"name\": \"春国大药房\",");
sb.AppendLine(" \"itemStyle\": {");
sb.AppendLine(" \"color\": \"#ff3b3b\"");
sb.AppendLine(" }");
sb.AppendLine(" }");
sb.AppendLine(" ],");
sb.AppendLine(" \"emphasis\": {");
sb.AppendLine(" \"itemStyle\": {");
sb.AppendLine(" \"shadowBlur\": 10,");
sb.AppendLine(" \"shadowOffsetX\": 0,");
sb.AppendLine(" \"shadowColor\": \"rgba(0, 0, 0, 0.5)\"");
sb.AppendLine(" }");
sb.AppendLine(" }");
sb.AppendLine(" }");
sb.AppendLine(" ]");
sb.AppendLine("}");
var data = new
{
piedata = JsonHelper.ToObject(sb.ToString())
};
return data;
}
#endregion
}
}