@@ -1,4 +1,6 @@ | |||
using Learun.Application.OA; | |||
using Learun.Application.OA.File.FileInfo; | |||
using Learun.Application.TwoDevelopment.EducationalAdministration; | |||
using Learun.Util; | |||
using Nancy; | |||
using System; | |||
@@ -10,13 +12,21 @@ namespace Learun.Application.WebApi.Modules.Echarts | |||
{ | |||
private NewsIBLL newsIBLL = new NewsBLL(); | |||
private SYS_SendMessageIBLL sYS_SendMessageIBLL = new SYS_SendMessageBLL(); | |||
private Sys_ReceiveFileIBLL sys_ReceiveFileIBLL = new Sys_ReceiveFileBLL(); | |||
private FileInfoIBLL fileInfoBLL = new FileInfoBLL(); | |||
public EchartsApi() : base("/api/echarts/") | |||
{ | |||
Get["/notice/sum"] = NoticeSum; | |||
Get["/notice/monthsum"] = NoticeMonthSum; | |||
Get["/message/sum"] = MessageSum; | |||
Get["/message/monthsum"] = MessageMonthSum; | |||
Get["/receivefile/sum"] = ReceiveFileSum; | |||
Get["/receivefile/monthsum"] = ReceiveFileMonthSum; | |||
Get["/resourcefile/sum"] = ResourceFileSum; | |||
Get["/resourcefile/monthsum"] = ResourceFileMonthSum; | |||
} | |||
@@ -40,10 +50,47 @@ namespace Learun.Application.WebApi.Modules.Echarts | |||
{ | |||
var dic = newsIBLL.GetMonthCount(); | |||
var m = 0; | |||
while (m<13) | |||
while (m < 13) | |||
{ | |||
m++; | |||
if (!dic.ContainsKey(m)) | |||
{ | |||
dic.Add(m, 0); | |||
} | |||
} | |||
var cate = new List<string>(); | |||
var data = new List<int>(); | |||
for (int i = 1; i < 13; i++) | |||
{ | |||
cate.Add($"{i}月"); | |||
data.Add(dic[i]); | |||
} | |||
var res = new { categories = cate, series = new List<object> { new { name = "公告", data = data } } }; | |||
return Res(res); | |||
} | |||
/// <summary> | |||
/// 邮件 | |||
/// </summary> | |||
/// <param name="_"></param> | |||
/// <returns></returns> | |||
public Response MessageSum(dynamic _) | |||
{ | |||
var sum = sYS_SendMessageIBLL.GetCount(); | |||
var res = new { value = sum }; | |||
return Res(res); | |||
} | |||
public Response MessageMonthSum(dynamic _) | |||
{ | |||
var dic = sYS_SendMessageIBLL.GetMonthCount(); | |||
var m = 0; | |||
while (m < 13) | |||
{ | |||
m++; | |||
if(!dic.ContainsKey(m)) | |||
if (!dic.ContainsKey(m)) | |||
{ | |||
dic.Add(m, 0); | |||
} | |||
@@ -60,5 +107,79 @@ namespace Learun.Application.WebApi.Modules.Echarts | |||
return Res(res); | |||
} | |||
/// <summary> | |||
/// 公文 | |||
/// </summary> | |||
/// <param name="_"></param> | |||
/// <returns></returns> | |||
public Response ReceiveFileSum(dynamic _) | |||
{ | |||
var sum = sys_ReceiveFileIBLL.GetCount(); | |||
var res = new { value = sum }; | |||
return Res(res); | |||
} | |||
public Response ReceiveFileMonthSum(dynamic _) | |||
{ | |||
var dic = sys_ReceiveFileIBLL.GetMonthCount(); | |||
var m = 0; | |||
while (m < 13) | |||
{ | |||
m++; | |||
if (!dic.ContainsKey(m)) | |||
{ | |||
dic.Add(m, 0); | |||
} | |||
} | |||
var cate = new List<string>(); | |||
var data = new List<int>(); | |||
for (int i = 1; i < 13; i++) | |||
{ | |||
cate.Add($"{i}月"); | |||
data.Add(dic[i]); | |||
} | |||
var res = new { categories = cate, series = new List<object> { new { name = "公告", data = data } } }; | |||
return Res(res); | |||
} | |||
/// <summary> | |||
/// 云盘 | |||
/// </summary> | |||
/// <param name="_"></param> | |||
/// <returns></returns> | |||
public Response ResourceFileSum(dynamic _) | |||
{ | |||
var sum = fileInfoBLL.GetCount(); | |||
var res = new { value = sum }; | |||
return Res(res); | |||
} | |||
public Response ResourceFileMonthSum(dynamic _) | |||
{ | |||
var dic = fileInfoBLL.GetMonthCount(); | |||
var m = 0; | |||
while (m < 13) | |||
{ | |||
m++; | |||
if (!dic.ContainsKey(m)) | |||
{ | |||
dic.Add(m, 0); | |||
} | |||
} | |||
var cate = new List<string>(); | |||
var data = new List<int>(); | |||
for (int i = 1; i < 13; i++) | |||
{ | |||
cate.Add($"{i}月"); | |||
data.Add(dic[i]); | |||
} | |||
var res = new { categories = cate, series = new List<object> { new { name = "公告", data = data } } }; | |||
return Res(res); | |||
} | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
using System; | |||
using Learun.Util; | |||
using System; | |||
using System.Collections.Generic; | |||
namespace Learun.Application.OA.File.FileInfo | |||
@@ -183,5 +184,43 @@ namespace Learun.Application.OA.File.FileInfo | |||
} | |||
} | |||
#endregion | |||
public int GetCount() | |||
{ | |||
try | |||
{ | |||
return service.GetCount(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
public Dictionary<int, int> GetMonthCount() | |||
{ | |||
try | |||
{ | |||
return service.GetMonthCount(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -92,5 +92,9 @@ namespace Learun.Application.OA.File.FileInfo | |||
/// <param name="IsShare">是否共享:1-共享 0取消共享</param> | |||
void ShareFile(string keyValue, int IsShare = 1); | |||
#endregion | |||
int GetCount(); | |||
Dictionary<int, int> GetMonthCount(); | |||
} | |||
} |
@@ -5,6 +5,7 @@ using System; | |||
using System.Collections.Generic; | |||
using System.Data; | |||
using System.Data.Common; | |||
using System.Linq; | |||
using System.Text; | |||
namespace Learun.Application.OA.File.FileInfo | |||
{ | |||
@@ -156,7 +157,7 @@ namespace Learun.Application.OA.File.FileInfo | |||
/// </summary> | |||
/// <param name="userId">用户Id</param> | |||
/// <returns></returns> | |||
public IEnumerable<FileInfoEntity> GetDocumentList(string userId,string queryJson) | |||
public IEnumerable<FileInfoEntity> GetDocumentList(string userId, string queryJson) | |||
{ | |||
var strSql = new StringBuilder(); | |||
strSql.Append(@"SELECT F_FileId , | |||
@@ -188,7 +189,7 @@ namespace Learun.Application.OA.File.FileInfo | |||
/// </summary> | |||
/// <param name="userId">用户Id</param> | |||
/// <returns></returns> | |||
public IEnumerable<FileInfoEntity> GetImageList(string userId,string queryJson) | |||
public IEnumerable<FileInfoEntity> GetImageList(string userId, string queryJson) | |||
{ | |||
var strSql = new StringBuilder(); | |||
strSql.Append(@"SELECT F_FileId , | |||
@@ -249,7 +250,7 @@ namespace Learun.Application.OA.File.FileInfo | |||
/// </summary> | |||
/// <param name="userId">用户Id</param> | |||
/// <returns></returns> | |||
public IEnumerable<FileInfoEntity> GetMyShareList(string userId,string queryJson) | |||
public IEnumerable<FileInfoEntity> GetMyShareList(string userId, string queryJson) | |||
{ | |||
var strSql = new StringBuilder(); | |||
strSql.Append(@"SELECT * | |||
@@ -287,7 +288,7 @@ namespace Learun.Application.OA.File.FileInfo | |||
/// </summary> | |||
/// <param name="userId">用户Id</param> | |||
/// <returns></returns> | |||
public IEnumerable<FileInfoEntity> GetOthersShareList(string userId,string queryJson) | |||
public IEnumerable<FileInfoEntity> GetOthersShareList(string userId, string queryJson) | |||
{ | |||
var strSql = new StringBuilder(); | |||
strSql.Append(@"SELECT * | |||
@@ -397,5 +398,17 @@ namespace Learun.Application.OA.File.FileInfo | |||
this.BaseRepository().Update(fileInfoEntity); | |||
} | |||
#endregion | |||
public int GetCount() | |||
{ | |||
return this.BaseRepository().FindList<FileInfoEntity>().Count(x => x.F_DeleteMark == 0); | |||
} | |||
public Dictionary<int, int> GetMonthCount() | |||
{ | |||
var dt = new DateTime(DateTime.Now.Year, 1, 1); | |||
var ls = this.BaseRepository().FindList<FileInfoEntity>(x => x.F_CreateDate >= dt).Select(x => new { Year = x.F_CreateDate.Value.Year, Month = x.F_CreateDate.Value.Month }).GroupBy(x => new { x.Year, x.Month }).ToDictionary(x => x.Key.Month, a => a.Count()); | |||
return ls; | |||
} | |||
} | |||
} |
@@ -181,7 +181,45 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
#endregion | |||
public int GetCount() | |||
{ | |||
try | |||
{ | |||
return sYS_SendMessageService.GetCount(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
public Dictionary<int, int> GetMonthCount() | |||
{ | |||
try | |||
{ | |||
return sYS_SendMessageService.GetMonthCount(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -55,5 +55,9 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
#endregion | |||
void Send(string messageid); | |||
int GetCount(); | |||
Dictionary<int, int> GetMonthCount(); | |||
} | |||
} |
@@ -377,5 +377,17 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
} | |||
public int GetCount() | |||
{ | |||
return this.BaseRepository().FindList<SYS_SendMessageEntity>().Count(); | |||
} | |||
public Dictionary<int, int> GetMonthCount() | |||
{ | |||
var dt = new DateTime(DateTime.Now.Year, 1, 1); | |||
var ls = this.BaseRepository().FindList<SYS_SendMessageEntity>(x => x.SENDTIME >= dt).Select(x => new { Year = x.SENDTIME.Value.Year, Month = x.SENDTIME.Value.Month }).GroupBy(x => new { x.Year, x.Month }).ToDictionary(x => x.Key.Month, a => a.Count()); | |||
return ls; | |||
} | |||
} | |||
} |
@@ -406,7 +406,46 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
#endregion | |||
public int GetCount() | |||
{ | |||
try | |||
{ | |||
return sys_ReceiveFileService.GetCount(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
public Dictionary<int, int> GetMonthCount() | |||
{ | |||
try | |||
{ | |||
return sys_ReceiveFileService.GetMonthCount(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -86,5 +86,9 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
string ZhuRenP(); | |||
string XiaoZhangP(); | |||
object GetInstructions(string keyValue); | |||
int GetCount(); | |||
Dictionary<int, int> GetMonthCount(); | |||
} | |||
} |
@@ -792,5 +792,17 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
public int GetCount() | |||
{ | |||
return this.BaseRepository().FindList<Sys_ReceiveFileEntity>().Count(); | |||
} | |||
public Dictionary<int, int> GetMonthCount() | |||
{ | |||
var dt = new DateTime(DateTime.Now.Year, 1, 1); | |||
var ls = this.BaseRepository().FindList<Sys_ReceiveFileEntity>(x => x.SendTime >= dt).Select(x => new { Year = x.SendTime.Value.Year, Month = x.SendTime.Value.Month }).GroupBy(x => new { x.Year, x.Month }).ToDictionary(x => x.Key.Month, a => a.Count()); | |||
return ls; | |||
} | |||
} | |||
} |