From e3ddc509dd63fad7e2a0ce51fa1e86a7a66eccab Mon Sep 17 00:00:00 2001 From: zzj <31836194@qq.com> Date: Mon, 26 Feb 2024 16:56:06 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E6=88=91=E7=9A=84?= =?UTF-8?q?=E5=B7=A5=E8=B5=84=E9=BB=98=E8=AE=A4=E6=95=B0=E6=8D=AE=E3=80=81?= =?UTF-8?q?=E5=B9=B4=E6=9C=88=E6=9F=A5=E8=AF=A2=E6=95=B0=E6=8D=AE=E3=80=81?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PersonnelManagement/GzAmountApi.cs | 4 +- .../Gz_Amounts/Gz_AmountsBLL.cs | 20 +++++- .../Gz_Amounts/Gz_AmountsIBLL.cs | 5 +- .../Gz_Amounts/Gz_AmountsService.cs | 65 +++++++++++++++++-- 4 files changed, 84 insertions(+), 10 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/PersonnelManagement/GzAmountApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/PersonnelManagement/GzAmountApi.cs index 30d3775cd..c6cab883b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/PersonnelManagement/GzAmountApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/PersonnelManagement/GzAmountApi.cs @@ -31,9 +31,9 @@ namespace Learun.Application.WebApi.Modules.PersonnelManagement var year = Convert.ToInt32(qj["year"]); var month = Convert.ToInt32(qj["month"]); - var cs = qj["cs"].ToString(); + //var cs = qj["cs"].ToString(); - var data = gz_AmountsIBLL.GetAmountsDetail(this.userInfo.account, year, month, cs, 1); + var data = gz_AmountsIBLL.GetAmountsDetail(this.userInfo.account, year, month, 1); var jsonData = new { rows = data, diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Gz_Amounts/Gz_AmountsBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Gz_Amounts/Gz_AmountsBLL.cs index 742900e85..f58ce9a0d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Gz_Amounts/Gz_AmountsBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Gz_Amounts/Gz_AmountsBLL.cs @@ -209,6 +209,24 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement } } } + public List>> GetAmountsDetail(string userNo, int year, int month, int show) + { + try + { + return gz_AmountsService.GetAmountsDetail(userNo, year, month, show); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } public IEnumerable GetPageListCol(Pagination pagination, string queryJson, string userNo) { @@ -248,7 +266,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement } } - public IEnumerable> GetAmountsCurrent(string userNo, out int year, out int month) + public List>> GetAmountsCurrent(string userNo, out int year, out int month) { try { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Gz_Amounts/Gz_AmountsIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Gz_Amounts/Gz_AmountsIBLL.cs index bd75b5f32..f36bac918 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Gz_Amounts/Gz_AmountsIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Gz_Amounts/Gz_AmountsIBLL.cs @@ -69,8 +69,9 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement IEnumerable GetPageListCol(string userNo, out int year, out int month); IEnumerable> GetAmountsDetail(string userNo, int year, int month, string cs, int show); - - IEnumerable> GetAmountsCurrent(string userNo, out int year, out int month); + List>> GetAmountsDetail(string userNo, int year, int month, int show); + + List>> GetAmountsCurrent(string userNo, out int year, out int month); #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Gz_Amounts/Gz_AmountsService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Gz_Amounts/Gz_AmountsService.cs index 5ffe43747..6f319aaf7 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Gz_Amounts/Gz_AmountsService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Gz_Amounts/Gz_AmountsService.cs @@ -449,6 +449,47 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement } } + public List>> GetAmountsDetail(string userNo, int year, int month, int show) + { + try + { + var rs = new List>>(); + var items = this.BaseRepository("CollegeMIS").FindList(x => x.IsShow == (show == 1)).OrderBy(x => x.ShowOrder).ToList(); + var itemId = items.Select(x => x.Id).ToArray(); + //var query = this.BaseRepository("CollegeMIS").FindList(x => itemId.Contains(x.ItemId) && x.Year == year && x.Month == month && x.UserNo == userNo).Join(items, a => a.ItemId, b => b.Id, (a, b) => new Tuple(b.Name, a.OriVal, b.ShowOrder ?? 0)).OrderBy(x => x.Item3); + + var query = this.BaseRepository("CollegeMIS").FindList(x => itemId.Contains(x.ItemId) && x.UserNo == userNo && x.Year == year && x.Month == month).ToList(); + + if (query.Any()) + { + + var ls = query.GroupBy(x => x.SendCount).ToDictionary(x => x.Key, a => a.ToList()); + + foreach (var item in ls.Keys) + { + var dl = ls[item].Join(items, a => a.ItemId, b => b.Id, (a, b) => new Tuple(b.Name, a.OriVal, b.ShowOrder ?? 0)).OrderBy(x => x.Item3).ToList(); + dl.Add(new Tuple("发放次数", item, 0)); + rs.Add(dl); + } + + //query.Join(items, a => a.ItemId, b => b.Id, (a, b) => new Tuple(b.Name, a.OriVal, b.ShowOrder ?? 0)).OrderBy(x => x.Item3); + //return rs; + } + return rs; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + public IEnumerable GetPageListCol(Pagination pagination, string queryJson, string userNo) { try @@ -526,28 +567,42 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement } } } - public IEnumerable> GetAmountsCurrent(string userNo, out int year, out int month) + public List>> GetAmountsCurrent(string userNo, out int year, out int month) { try { var items = this.BaseRepository("CollegeMIS").FindList(x => x.IsShow == true).OrderBy(x => x.ShowOrder).ToList(); var itemId = items.Select(x => x.Id).ToArray(); - var c = itemId.Length; + //var c = itemId.Length; var query = this.BaseRepository("CollegeMIS").FindList(x => itemId.Contains(x.ItemId) && x.UserNo == userNo).GroupBy(x=> new { x.Year,x.Month}).Take(1).ToList(); + var rs = new List>>(); + if (query.Any()) { year = query.First().Key.Year ?? DateTime.Now.Year; month = query.First().Key.Month ?? DateTime.Now.Month; - var rs = new List>(); //query.Join(items, a => a.ItemId, b => b.Id, (a, b) => new Tuple(b.Name, a.OriVal, b.ShowOrder ?? 0)).OrderBy(x => x.Item3); - return rs; + //var rs = new List>(); + + var ls = query.First().GroupBy(x => x.SendCount).ToDictionary(x=>x.Key,a=>a.ToList()); + + foreach (var item in ls.Keys) + { + var dl=ls[item].Join(items, a => a.ItemId, b => b.Id, (a, b) => new Tuple(b.Name, a.OriVal, b.ShowOrder ?? 0)).OrderBy(x => x.Item3).ToList(); + dl.Add(new Tuple("发放次数", item, 0)); + rs.Add(dl); + } + + //query.Join(items, a => a.ItemId, b => b.Id, (a, b) => new Tuple(b.Name, a.OriVal, b.ShowOrder ?? 0)).OrderBy(x => x.Item3); + //return rs; } else { year = DateTime.Now.Year; month = DateTime.Now.Month; - return new List>(); + //return new List>(); } + return rs; } catch (Exception ex) {