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) {