diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Echarts/EchartsApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Echarts/EchartsApi.cs index 646e6924a..b56240380 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Echarts/EchartsApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Echarts/EchartsApi.cs @@ -1,5 +1,6 @@ using Learun.Application.OA; using Learun.Application.OA.File.FileInfo; +using Learun.Application.TwoDevelopment.AssetManagementSystem; using Learun.Application.TwoDevelopment.EducationalAdministration; using Learun.Application.WorkFlow; using Learun.Util; @@ -19,6 +20,9 @@ namespace Learun.Application.WebApi.Modules.Echarts private FileInfoIBLL fileInfoBLL = new FileInfoBLL(); private NWFSchemeIBLL nWFSchemeIBLL = new NWFSchemeBLL(); private NWFProcessIBLL nWFProcessIBLL = new NWFProcessBLL(); + private EmpInfoIBLL empInfoIBLL = new EmpInfoBLL(); + private FundsApplyIBLL fundsApplyIBLL = new FundsApplyBLL(); + private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL(); public EchartsApi() : base("/api/echarts/") @@ -34,7 +38,16 @@ namespace Learun.Application.WebApi.Modules.Echarts Get["/SchemeInfoCount"] = SchemeInfoCount; Get["/ProcessNotFinishCount"] = ProcessNotFinishCount; Get["/ProcessCount"] = ProcessCount; - + Get["/teacher/sum"] = TeacherSum; + Get["/teacher/gendersum"] = TeacherGenderSum; + Get["/teacher/jsgwsum"] = TeacherTitSum; + Get["/foundapply/monthsum"] = FundsApplyMonthSum; + Get["/wf/sumuse"] = WfUseSumCount; + Get["/wf/use1"] = WfUseFive; + Get["/wf/use2"] = WfUseSix; + Get["/stu/sum"] = StuSum; + Get["/stu/gendersum"] = StuGenderSum; + Get["/stu/deptsum"] = StuDeptSum; } @@ -111,7 +124,7 @@ namespace Learun.Application.WebApi.Modules.Echarts data.Add(dic[i]); } - var res = new { categories = cate, series = new List { new { name = "公告", data = data } } }; + var res = new { categories = cate, series = new List { new { name = "邮件", data = data } } }; return Res(res); } @@ -148,7 +161,7 @@ namespace Learun.Application.WebApi.Modules.Echarts data.Add(dic[i]); } - var res = new { categories = cate, series = new List { new { name = "公告", data = data } } }; + var res = new { categories = cate, series = new List { new { name = "公文", data = data } } }; return Res(res); } /// @@ -188,9 +201,63 @@ namespace Learun.Application.WebApi.Modules.Echarts return Res(res); } + /// + /// 流程使用和数量雷达图 + /// + /// + /// + public Response WfUseSumCount(dynamic _) + { + var data = nWFSchemeIBLL.GetWfUseSum(); + var nm = data.Select(x => new { name = x.Item1, max = (x.Item2 + x.Item3) == 0 ? 50 : (x.Item2 + x.Item3) * 2 }).ToList(); + + var sumValue = data.Select(x => x.Item2).ToList(); + var useValue = data.Select(x => x.Item3).ToList(); + var values = new List(); + values.Add(new { name = "流程数量", value = sumValue }); + values.Add(new { name = "流程使用次数", value = useValue }); + var rs = new { indicator = nm, series = new List { new { data = values } } }; + + return Res(rs); + } + + /// + /// 使用1-5 + /// + /// + /// + public Response WfUseFive(dynamic _) + { + var data = nWFSchemeIBLL.GetUseCount().OrderByDescending(x => x.Value).Take(5); + var value = data.Select(x => x.Value).ToList(); + var nm = new List { "No.1", "No.2", "No.3", "No.4", "No.5" }; + var res = new { categories = nm, series = new List { new { name = "", data = value } } }; + return Res(res); + } + /// + /// 使用6- + /// + /// + /// + public Response WfUseSix(dynamic _) + { + var data = nWFSchemeIBLL.GetUseCount().OrderByDescending(x => x.Value).Skip(5).Take(5); + var value = data.Select(x => x.Value).ToList(); + if(value.Count!=5) + { + for (int i = 0; i < 5-value.Count; i++) + { + value.Add(0); + } + } + var nm = new List { "No.5", "No.7", "No.8", "No.9", "No.10" }; + + var res = new { categories = nm, series = new List { new { name = "", data = value } } }; + return Res(res); + } /// /// 云盘 /// @@ -224,7 +291,92 @@ namespace Learun.Application.WebApi.Modules.Echarts data.Add(dic[i]); } - var res = new { categories = cate, series = new List { new { name = "公告", data = data } } }; + var res = new { categories = cate, series = new List { new { name = "云盘", data = data } } }; + return Res(res); + } + + /// + /// 教师总数量 + /// + /// + /// + public Response TeacherSum(dynamic _) + { + var sum = empInfoIBLL.GetCount(); + var res = new { value = sum }; + + return Res(res); + } + + public Response TeacherGenderSum(dynamic _) + { + var dic = empInfoIBLL.GetGenderCount(); + + var res = dic.Select(x => new { name = x.Key, value = x.Value, url = string.Empty }); + return Res(res); + } + + public Response TeacherTitSum(dynamic _) + { + var dic = empInfoIBLL.GetTitCount(); + var res = dic.Select(x => new { name = x.Key, value = x.Value, url = string.Empty }); + return Res(res); + } + + /// + /// 申报经费按月 + /// + /// + /// + public Response FundsApplyMonthSum(dynamic _) + { + var dic = fundsApplyIBLL.GetMonthCount(); + var m = 0; + while (m < 13) + { + m++; + if (!dic.ContainsKey(m)) + { + dic.Add(m, 0); + } + } + var cate = new List(); + var data = new List(); + for (int i = 1; i < 13; i++) + { + cate.Add($"{i}月"); + data.Add(dic[i]); + } + + var res = new { categories = cate, series = new List { new { name = "云盘", data = data } } }; + return Res(res); + } + + /// + /// 学生总数量 + /// + /// + /// + public Response StuSum(dynamic _) + { + var sum = stuInfoBasicIBLL.GetCount(); + var res = new { value = sum }; + + return Res(res); + } + + public Response StuGenderSum(dynamic _) + { + var dic = stuInfoBasicIBLL.GetGenderCount(); + + var res = dic.Select(x => new { name = x.Key, value = x.Value, url = string.Empty }); + return Res(res); + } + + public Response StuDeptSum(dynamic _) + { + var dic = stuInfoBasicIBLL.GetDeptCount(); + var res = dic.Select(x => new { name = x.Key, value = x.Value, url = string.Empty }); return Res(res); } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyBLL.cs index 839b78995..be09d4285 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyBLL.cs @@ -244,7 +244,28 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem } } } + + #endregion + public Dictionary GetMonthCount() + { + try + { + return fundsApplyService.GetMonthCount(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyIBLL.cs index 4f929af7f..8a7939219 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyIBLL.cs @@ -72,5 +72,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem void ChangeStatusByProcessId(string processId, int status); #endregion + + Dictionary GetMonthCount(); } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyService.cs index d4d3ca065..6150c96ee 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyService.cs @@ -387,5 +387,27 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem #endregion + + public Dictionary GetMonthCount() + { + try + { + var dt = new DateTime(DateTime.Now.Year, 1, 1); + var query = this.BaseRepository("CollegeMIS").FindList(x => x.ApplyTime >= dt).Join(this.BaseRepository("CollegeMIS").FindList(), a => a.Id, b => b.ApplyId, (a, b) => new { a.ApplyTime.Value.Month, b.Amount }).ToList(); + var rs=query.GroupBy(x => x.Month).ToDictionary(x => x.Key, a => a.Sum(b => b.Amount ?? 0)); + return rs; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/EmpInfo/EmpInfoBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/EmpInfo/EmpInfoBLL.cs index 99de6390a..c1e40e5dc 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/EmpInfo/EmpInfoBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/EmpInfo/EmpInfoBLL.cs @@ -482,7 +482,65 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + #endregion + public int GetCount() + { + try + { + return empInfoService.GetCount(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + public Dictionary GetGenderCount() + { + try + { + return empInfoService.GetDicCount(1); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + public Dictionary GetTitCount() + { + try + { + return empInfoService.GetDicCount(2); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/EmpInfo/EmpInfoIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/EmpInfo/EmpInfoIBLL.cs index e50c559f0..66d356191 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/EmpInfo/EmpInfoIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/EmpInfo/EmpInfoIBLL.cs @@ -85,5 +85,10 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// void SaveEditEntity(string keyValue, EmpInfoEntity entity); EmpInfoEntity GetEmpInfoEntityByIdCardNo(string account); + + int GetCount(); + + Dictionary GetGenderCount(); + Dictionary GetTitCount(); } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/EmpInfo/EmpInfoService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/EmpInfo/EmpInfoService.cs index 73dfa3077..c15069128 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/EmpInfo/EmpInfoService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/EmpInfo/EmpInfoService.cs @@ -876,5 +876,85 @@ sum(case when DATEDIFF(YYYY, t.Birthday, GETDATE()) > 20 and DATEDIFF(YYYY, t.Bi #endregion + + public int GetCount() + { + try + { + return this.BaseRepository("CollegeMIS").FindList().Count(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// + /// + /// 1按性别,2按岗位类别 + /// + public Dictionary GetDicCount(int type) + { + try + { + var rs = new Dictionary(); + var query = this.BaseRepository("CollegeMIS").FindList(); + switch (type) + { + case 2: + var data = query.GroupBy(x => x.EmpSortNo).Select(x=>new Tuple(x.Key,x.Count())).ToList(); + ConvertName(data, rs); + break; + default: + rs = query.GroupBy(x => x.GenderNo ?? false).ToDictionary(x => x.Key ? "男" : "女", a => a.Count()); + break; + } + return rs; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + private void ConvertName(List> data, Dictionary rs) + { + if(data.Any()) + { + var detailList = this.BaseRepository().FindList(@"SELECT t.*,t2.F_ItemCode FROM LR_Base_DataItemDetail t + INNER JOIN LR_Base_DataItem t2 ON t.F_ItemId = t2.F_ItemId + WHERE t.F_DeleteMark = 0 and t2.f_itemcode='jsgw'"); + foreach (var item in data) + { + var dl = detailList.FirstOrDefault(x => x.F_ItemValue == item.Item1); + if(dl!=null) + { + if(!rs.ContainsKey(dl.F_ItemName)) + { + rs.Add(dl.F_ItemName, item.Item2); + } + else + { + rs[dl.F_ItemName] = rs[dl.F_ItemName] + item.Item2; + } + } + } + } + } } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicBLL.cs index 0f7e53144..80dad882d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicBLL.cs @@ -749,6 +749,63 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } } + + public int GetCount() + { + try + { + return stuInfoBasicService.GetCount(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + public Dictionary GetGenderCount() + { + try + { + return stuInfoBasicService.GetDicCount(1); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + public Dictionary GetDeptCount() + { + try + { + return stuInfoBasicService.GetDicCount(2); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicIBLL.cs index 497405396..e65eecf88 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicIBLL.cs @@ -119,5 +119,10 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration IEnumerable GetStuInfoByClassNo(string classNo); string StuInfoBasicImport(DataTable dt, string fileId); + + int GetCount(); + + Dictionary GetGenderCount(); + Dictionary GetDeptCount(); } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicService.cs index b052ff71d..f414dcaff 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicService.cs @@ -1782,5 +1782,61 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } } + + + public int GetCount() + { + try + { + return this.BaseRepository("CollegeMIS").FindList().Count(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// + /// + /// 1按性别,2按岗位类别 + /// + public Dictionary GetDicCount(int type) + { + try + { + var rs = new Dictionary(); + var query = this.BaseRepository("CollegeMIS").FindList(); + switch (type) + { + case 2: + rs = query.Join(this.BaseRepository("CollegeMIS").FindList(),a=>a.DeptNo,b=>b.DeptNo,(a,b)=>new { b.DeptName}).GroupBy(x => x.DeptName).ToDictionary(x=>x.Key,a=>a.Count()); + + break; + default: + rs = query.GroupBy(x => x.GenderNo ?? false).ToDictionary(x => x.Key ? "男" : "女", a => a.Count()); + break; + } + return rs; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeBLL.cs index e7923f095..060caf16f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeBLL.cs @@ -183,6 +183,44 @@ namespace Learun.Application.WorkFlow } } + public IEnumerable> GetWfUseSum() + { + try + { + return nWFSchemeService.GetWfUseSum(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + public Dictionary GetUseCount() + { + try + { + return nWFSchemeService.GetUseCount(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + #endregion } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeIBLL.cs index 6eef9c9b8..de2847261 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeIBLL.cs @@ -1,4 +1,5 @@ using Learun.Util; +using System; using System.Collections.Generic; namespace Learun.Application.WorkFlow @@ -110,6 +111,10 @@ namespace Learun.Application.WorkFlow /// IEnumerable GetNWFSchemeUseList(string queryJson); + IEnumerable> GetWfUseSum(); + + Dictionary GetUseCount(); + #endregion } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeService.cs index 1b36b2f0c..13c5854a9 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeService.cs @@ -4,6 +4,7 @@ using Learun.Util; using System; using System.Collections.Generic; using System.Data; +using System.Linq; using System.Text; namespace Learun.Application.WorkFlow @@ -510,6 +511,48 @@ namespace Learun.Application.WorkFlow } } + + public IEnumerable> GetWfUseSum() + { + try + { + var rs = new List>(); + var dt = new DateTime(DateTime.Now.Year, 1, 1); + var sum = this.BaseRepository().FindList(x => x.F_EnabledMark == 1).GroupBy(x => x.F_Category).ToDictionary(x=>x.Key,a=>a.Count()); + var uses = GetUseCount(); + + var keys = sum.Keys.ToList().Union(uses.Keys.ToList()); + + foreach (var k in keys) + { + var s = sum.ContainsKey(k) ? sum[k] : 0; + var u = uses.ContainsKey(k) ? uses[k] : 0; + rs.Add(new Tuple(k, s, u)); + } + + return rs; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + public Dictionary GetUseCount() + { + var dt = new DateTime(DateTime.Now.Year, 1, 1); + var uses = this.BaseRepository().FindList(x => x.F_EnabledMark == 1).Join(this.BaseRepository().FindList(x => x.F_Type == 1), a => a.F_Id, b => b.F_SchemeInfoId, (a, b) => new { a.F_Category, b.F_Id }).Join(this.BaseRepository().FindList(x => x.F_CreateDate >= dt), a => a.F_Id, b => b.F_SchemeId, (a, b) => new { a.F_Category, a.F_Id, ProcessId = b.F_Id }).GroupBy(x => x.F_Category).ToDictionary(x => x.Key, a => a.Count()); + + return uses; + } + #endregion } }