From c1c96658dfd01ac49ee19fd1cfa36f9a9aaf6868 Mon Sep 17 00:00:00 2001 From: zzj <31836194@qq.com> Date: Tue, 30 Jan 2024 11:55:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84=E5=B7=A5=E8=B5=84=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=AB=AF=E9=BB=98=E8=AE=A4=E6=95=B0=E6=8D=AE=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=8CPC=E7=AB=AF=E9=BB=98=E8=AE=A4=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Gz_AmountsController.cs | 19 ++++ .../PersonnelManagement/GzAmountApi.cs | 21 +++- .../Gz_Amounts/Gz_AmountsBLL.cs | 38 +++++++ .../Gz_Amounts/Gz_AmountsIBLL.cs | 5 + .../Gz_Amounts/Gz_AmountsService.cs | 105 ++++++++++++------ 5 files changed, 153 insertions(+), 35 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/Gz_AmountsController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/Gz_AmountsController.cs index f13655841..d575ac597 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/Gz_AmountsController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/Gz_AmountsController.cs @@ -138,6 +138,25 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers }; return Success(jsonData); } + + [HttpGet] + [AjaxOnly] + public ActionResult GetPageListMyCurrCol(string pagination, string queryJson) + { + Pagination paginationobj = pagination.ToObject(); + var user = LoginUserInfo.Get(); + var data = gz_AmountsIBLL.GetPageListCol(user.account,out var year,out var month); + var jsonData = new + { + year, + month, + rows = data, + total = paginationobj.total, + page = paginationobj.page, + records = paginationobj.records + }; + return Success(jsonData); + } /// /// 获取表单数据 /// 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 2922977a6..9a35910e4 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 @@ -19,6 +19,7 @@ namespace Learun.Application.WebApi.Modules.PersonnelManagement { Get["/my"] = GetMy; Get["/more"] = GetMore; + Get["/curr"] = GetCurr; } @@ -31,7 +32,7 @@ namespace Learun.Application.WebApi.Modules.PersonnelManagement var year = Convert.ToInt32(qj["year"]); var month = Convert.ToInt32(qj["month"]); - var data = gz_AmountsIBLL.GetAmountsDetail(this.userInfo.account,year,month,1); + var data = gz_AmountsIBLL.GetAmountsDetail(this.userInfo.account, year, month, 1); var jsonData = new { rows = data, @@ -60,5 +61,23 @@ namespace Learun.Application.WebApi.Modules.PersonnelManagement }; return Success(jsonData); } + + public Response GetCurr(dynamic _) + { + ReqPageParam parameter = this.GetReqData(); + + + var data = gz_AmountsIBLL.GetAmountsCurrent(this.userInfo.account, out var year, out var month); + var jsonData = new + { + year, + month, + rows = data, + total = parameter.pagination.total, + page = parameter.pagination.page, + records = parameter.pagination.records + }; + return Success(jsonData); + } } } \ No newline at end of file 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 213287d7f..c06a6f634 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 @@ -247,6 +247,44 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement } } } + + public IEnumerable> GetAmountsCurrent(string userNo, out int year, out int month) + { + try + { + return gz_AmountsService.GetAmountsCurrent(userNo, out year, out month); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + public IEnumerable GetPageListCol(string userNo, out int year, out int month) + { + try + { + return gz_AmountsService.GetPageListCol(userNo, out year, out month); + } + 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/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 29eb8b1da..3138da8e6 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 @@ -63,7 +63,12 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement IEnumerable GetPageListCol(Pagination pagination, string queryJson, string userNo); + + IEnumerable GetPageListCol(string userNo, out int year, out int month); + IEnumerable> GetAmountsDetail(string userNo, int year, int month, int show); + + IEnumerable> 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 a36875779..0903d1a88 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 @@ -433,40 +433,77 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement return GetAmountsCols(pagination, yearStart, monthStart, yearEnd, monthEnd, userNo, string.Empty, string.Empty, out var total); - //var items = this.BaseRepository("CollegeMIS").FindList(x => x.IsShow == true).ToList(); - //if (items.Any()) - //{ - // var xmId = items.FirstOrDefault(x => x.Name == "职员姓名")?.Id ?? "职员姓名"; - // var deptCodeId = items.FirstOrDefault(x => x.Name == "部门代码")?.Id ?? "部门代码"; - // var deptId = items.FirstOrDefault(x => x.Name == "部门名称")?.Id ?? "部门名称"; - // var ptcId = items.FirstOrDefault(x => x.Name == "职员类型代码")?.Id ?? "职员类型代码"; - // var ptId = items.FirstOrDefault(x => x.Name == "职员类型")?.Id ?? "职员类型"; - // var sendId = items.FirstOrDefault(x => x.Name == "发放时间")?.Id ?? "发放时间"; - // var sendCountId = items.FirstOrDefault(x => x.Name == "发放次数")?.Id ?? "发放次数"; - // var kchjId = items.FirstOrDefault(x => x.Name == "扣款合计")?.Id ?? "扣款合计"; - // var sfhjId = items.FirstOrDefault(x => x.Name == "实发合计")?.Id ?? "实发合计"; - // var bzId = items.FirstOrDefault(x => x.Name == "备注")?.Id ?? "备注"; - // var shrId = items.FirstOrDefault(x => x.Name == "审核人")?.Id ?? "审核人"; - - // var itemId = items.Select(x => x.Id).ToArray(); - - // var q = this.BaseRepository("CollegeMIS").FindList(x => x.UserNo == userNo && itemId.Contains(x.ItemId) && ((yearStart == yearEnd && x.Year == yearStart && x.Month >= monthStart && x.Month <= monthEnd) || (yearStart < yearEnd && (x.Year == yearStart && x.Month >= monthStart) || (x.Year == yearEnd && x.Month <= monthEnd) || (x.Year > yearStart && x.Year < yearEnd)))); - - // var query = q.GroupBy(x => new { x.UserNo, x.Year, x.Month }); - // pagination.records = query.Count(); - - // var ls = query.Select(x => new Gz_AmountsCols { UserNo = x.Key.UserNo, Year = x.Key.Year ?? 0, Month = x.Key.Month ?? 0, RealName = x.FirstOrDefault(a => a.ItemId == xmId)?.OriVal ?? "", DeptCode = x.FirstOrDefault(a => a.ItemId == deptCodeId)?.OriVal ?? "", DeptName = x.FirstOrDefault(a => a.ItemId == deptId)?.OriVal ?? "", PersonTypeCode = x.FirstOrDefault(a => a.ItemId == ptcId)?.OriVal ?? "", PersonType = x.FirstOrDefault(a => a.ItemId == ptId)?.OriVal ?? "", SendDate = x.FirstOrDefault(a => a.ItemId == sendId)?.OriVal ?? "", SendCount = x.FirstOrDefault(a => a.ItemId == sendCountId)?.OriVal ?? "", TotalDeduction = x.FirstOrDefault(a => a.ItemId == kchjId)?.OriVal ?? "", TotalSend = x.FirstOrDefault(a => a.ItemId == sfhjId)?.OriVal ?? "", TotalSendDecimal = x.FirstOrDefault(a => a.ItemId == sfhjId)?.Amount ?? 0, Remark = x.FirstOrDefault(a => a.ItemId == bzId)?.OriVal ?? "", Reviewer = x.FirstOrDefault(a => a.ItemId == shrId)?.OriVal ?? "" }); - - - - // var rs = ls.Skip(skip).Take(pagination.rows); - // return rs; - //} - //else - //{ - // pagination.records = 0; - // return new List(); - //} + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + public IEnumerable GetPageListCol(string userNo, out int year, out int month) + { + try + { + var yearStart = DateTime.Now.Year; + var monthStart = DateTime.Now.Month; + var yearEnd = DateTime.Now.Year; + var monthEnd = DateTime.Now.Month; + + var data = this.BaseRepository("CollegeMIS").FindList(x => x.UserNo == userNo).OrderByDescending(x => x.Year).ThenByDescending(x => x.Month).Take(1).ToList(); + if (data.Any()) + { + yearStart = data[0].Year ?? DateTime.Now.Year; + monthStart = data[0].Month ?? DateTime.Now.Month; + yearEnd = data[0].Year ?? DateTime.Now.Year; + monthEnd = data[0].Month ?? DateTime.Now.Month; + } + + year = yearStart; + month = monthStart; + + return GetAmountsCols(new Pagination { rows=30,page=1}, yearStart, monthStart, yearEnd, monthEnd, userNo, string.Empty, string.Empty, out var total); + + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + public IEnumerable> 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 query = this.BaseRepository("CollegeMIS").FindList(x => itemId.Contains(x.ItemId) && x.UserNo == userNo).OrderByDescending(x => x.Year).ThenByDescending(x => x.Month).Take(c).ToList(); + if (query.Any()) + { + year = query.First().Year ?? DateTime.Now.Year; + month = query.First().Month ?? DateTime.Now.Month; + var rs = 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>(); + } } catch (Exception ex) {