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 0903d1a88..922a627d5 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 @@ -1,4 +1,6 @@ using Dapper; +using Learun.Application.Organization; +using Learun.Application.TwoDevelopment.EducationalAdministration; using Learun.Application.TwoDevelopment.PersonnelManagement.Gz_Amounts; using Learun.Cache.Base; using Learun.Cache.Factory; @@ -526,8 +528,8 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement 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 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 ?? "发放时间"; @@ -550,7 +552,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement 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 ?? "", TotalPay = x.FirstOrDefault(a => a.ItemId == yfhjId)?.OriVal ?? "" }); + 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 ?? "", 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 ?? "", TotalPay = x.FirstOrDefault(a => a.ItemId == yfhjId)?.OriVal ?? "" }); if (!kw.IsEmpty()) { @@ -564,6 +566,25 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement total = ls.Sum(x => x.TotalSendDecimal); var rs = ls.Skip(skip).Take(pagination.rows).ToList(); + + if(rs.Any()) + { + var usrNos = rs.Select(x => x.UserNo).ToArray(); + var user = this.BaseRepository("CollegeMIS").FindList(x => usrNos.Contains(x.EmpNo)).ToList(); + var deptId = user.Select(x => x.F_DepartmentId).ToArray(); + var depts = this.BaseRepository().FindList(x => deptId.Contains(x.F_DepartmentId)).ToList(); + var emps = user.Join(depts, a => a.F_DepartmentId, b => b.F_DepartmentId, (a, b) => new { a.EmpNo, a.F_DepartmentId, b.F_FullName }).ToList(); + foreach (var item in rs) + { + var emp = emps.FirstOrDefault(x => x.EmpNo == item.UserNo); + if(emp!=null) + { + item.DeptCode = emp.F_DepartmentId; + item.DeptName = emp.F_FullName; + } + } + } + return rs; } else