diff --git a/src/YhCore.Service/Impl/WYDocPrintService.cs b/src/YhCore.Service/Impl/WYDocPrintService.cs index 3f45d1d..b7d977c 100644 --- a/src/YhCore.Service/Impl/WYDocPrintService.cs +++ b/src/YhCore.Service/Impl/WYDocPrintService.cs @@ -7,6 +7,7 @@ using Yh.Platform.Abstractions; using Yh.SchClass.OpenApi; using YhCore.Entity; using YhCore.Model.Dto; +using YhCore.Model.Vo; using YhCore.Repository; using YhCore.Service.Interfaces; @@ -72,7 +73,7 @@ namespace YhCore.Service.Impl #region 抄送 /// 抄送列表(旧 SendRdList:DocStatus 1/11,SendUserID 含本人;旧为教师内连接)。 - public async Task> SendRdListAsync(string name, string startDate, string endDate, string userId, string schSerId, int pageSize, int pageIndex) + public async Task> SendRdListAsync(string name, string startDate, string endDate, string userId, string schSerId, int pageSize, int pageIndex) { var docs = (await _doc.FindAsync(m => m.SchSerID == schSerId)).ToList(); @@ -88,6 +89,7 @@ namespace YhCore.Service.Impl docs = docs.Where(m => m.TakeDate <= date2).ToList(); } + var total = docs.Count(m => m.DocStatus == "1" || m.DocStatus == "11"); docs = docs.Where(m => m.DocStatus == "1" || m.DocStatus == "11") .OrderByDescending(m => m.SerID) .Skip(pageSize * pageIndex).Take(pageSize).ToList(); @@ -101,7 +103,7 @@ namespace YhCore.Service.Impl if (!TryGetTea(teaMap, item.UserID, out var tea)) continue; result.Add(await BuildListItemAsync(item, tea, dictMap, "yyyy-MM-dd")); } - return result; + return PageVO.Of(result, total, pageIndex, pageSize); } /// 查看抄送人员详情(旧 SendDetailsList)。 @@ -349,7 +351,7 @@ namespace YhCore.Service.Impl #region 列表 /// 我的文印列表(旧 MyList;旧 DocTypeName 误用 YZBM 字典,此处保持旧行为)。 - public async Task> MyListAsync(string name, string status, string startDate, string endDate, string userId, string schSerId, int pageSize, int pageIndex) + public async Task> MyListAsync(string name, string status, string startDate, string endDate, string userId, string schSerId, int pageSize, int pageIndex) { var docs = (await _doc.FindAsync(m => m.UserID == userId && m.SchSerID == schSerId)).ToList(); @@ -365,6 +367,7 @@ namespace YhCore.Service.Impl docs = docs.Where(m => m.TakeDate <= date2).ToList(); } + var total = docs.Count; docs = docs.OrderBy(m => m.DocStatus).ThenByDescending(m => m.TakeDate).ThenByDescending(m => m.EditDate) .Skip(pageSize * pageIndex).Take(pageSize).ToList(); @@ -376,14 +379,14 @@ namespace YhCore.Service.Impl TryGetTea(teaMap, item.UserID, out var tea); // 旧为左连接,缺失补空 result.Add(await BuildListItemAsync(item, tea, dictMap, "yyyy-MM-dd HH:mm", "YZBM")); } - return result; + return PageVO.Of(result, total, pageIndex, pageSize); } /// /// 全部文印列表(旧 AllList 原生 SQL 四分类:x=待我审(0) y=我已审(1) z=抄送我(2) m=我发起(3),按优先级去重)。 /// 旧 Name 过滤的 SQL 拼接存在运算符优先级缺陷,此处按语义实现:内容/教师名/字典名任一命中。 /// - public async Task> AllListAsync(string name, string userId, string schSerId, int pageSize, int pageIndex) + public async Task> AllListAsync(string name, string userId, string schSerId, int pageSize, int pageIndex) { int uid = int.Parse(userId); @@ -423,6 +426,7 @@ namespace YhCore.Service.Impl || DictNameContains(dictMap, "YZFL", t.doc.DPType, name)); } + var total = query.Count(); var pageItems = query.OrderByDescending(t => t.doc.SerID).ThenByDescending(t => t.doc.TakeDate) .Skip(pageSize * pageIndex).Take(pageSize).ToList(); @@ -434,16 +438,17 @@ namespace YhCore.Service.Impl item.ctype = ctype; result.Add(item); } - return result; + return PageVO.Of(result, total, pageIndex, pageSize); } /// /// 文印审核列表(旧 ShenheList:固定流程 + 指派 + 自由流程三路并集,HashSet 去重)。 /// 旧实现的 Name 过滤作用在未被使用的查询上(死代码),此处保持 Name 不生效的旧行为。 /// - public async Task> ShenheListAsync(string userId, string schSerId, int pageSize, int pageIndex) + public async Task> ShenheListAsync(string userId, string schSerId, int pageSize, int pageIndex) { var docs = await GetPendingShenheDocsAsync(userId, schSerId, requireFlowIdNonZero: false); + var total = docs.Count; docs = docs.OrderBy(m => m.DocStatus).ThenByDescending(m => m.TakeDate) .Skip(pageSize * pageIndex).Take(pageSize).ToList(); @@ -455,13 +460,13 @@ namespace YhCore.Service.Impl TryGetTea(teaMap, item.UserID, out var tea); result.Add(await BuildListItemAsync(item, tea, dictMap, "yyyy-MM-dd HH:mm")); } - return result; + return PageVO.Of(result, total, pageIndex, pageSize); } /// /// 审批列表(旧 SPList:待审(DS,zt=false)∪ 我已审(YS,zt=true,排除 DS),_disabled 即 zt)。 /// - public async Task> SPListAsync(string name, string status, string startDate, string endDate, string userId, string schSerId, int pageSize, int pageIndex) + public async Task> SPListAsync(string name, string status, string startDate, string endDate, string userId, string schSerId, int pageSize, int pageIndex) { var userid = int.Parse(userId); @@ -493,6 +498,7 @@ namespace YhCore.Service.Impl query = query.Where(m => m.doc.DocContent != null && m.doc.DocContent.IndexOf(name) >= 0); var ordered = query.OrderBy(m => m.doc.DocStatus).ThenByDescending(m => m.doc.EditDate).ToList(); + var total = ordered.Count; var teaMap = await GetTeaMapAsync(schSerId); var dictMap = await GetDictMapAsync(schSerId); @@ -504,11 +510,11 @@ namespace YhCore.Service.Impl item._disabled = zt; // 我已审的记录不可再编辑(覆盖通用 _disabled 语义,与旧一致) result.Add(item); } - return result; + return PageVO.Of(result, total, pageIndex, pageSize); } /// 文印已审列表(旧 YishenList:本人审核流水关联,排除撤销与已领取)。 - public async Task> YishenListAsync(string name, string userId, string schSerId, int pageSize, int pageIndex) + public async Task> YishenListAsync(string name, string userId, string schSerId, int pageSize, int pageIndex) { int uid = int.Parse(userId); var tranctDataIds = (await _flowtranct.FindAsync(b => b.actionuserid == uid && b.datatype == DocPrintConstants.AppCode.ToString() && b.actionstatus != 11)) @@ -521,6 +527,7 @@ namespace YhCore.Service.Impl if (!string.IsNullOrEmpty(name)) docs = docs.Where(m => m.DocContent != null && m.DocContent.Contains(name)).ToList(); + var total = docs.Count; docs = docs.OrderByDescending(m => m.SerID).ThenByDescending(m => m.TakeDate) .Skip(pageSize * pageIndex).Take(pageSize).ToList(); @@ -532,11 +539,11 @@ namespace YhCore.Service.Impl TryGetTea(teaMap, item.UserID, out var tea); result.Add(await BuildListItemAsync(item, tea, dictMap, "yyyy-MM-dd HH:mm")); } - return result; + return PageVO.Of(result, total, pageIndex, pageSize); } /// 全部文印列表(旧 totalList,管理员视角,按状态/时间过滤)。 - public async Task> TotalListAsync(string name, string stateid, string starttime, string endtime, string schSerId, int pageSize, int pageIndex) + public async Task> TotalListAsync(string name, string stateid, string starttime, string endtime, string schSerId, int pageSize, int pageIndex) { var docs = (await _doc.FindAsync(m => m.SchSerID == schSerId)).ToList(); @@ -552,6 +559,7 @@ namespace YhCore.Service.Impl if (!string.IsNullOrEmpty(name)) docs = docs.Where(m => m.DocContent != null && m.DocContent.IndexOf(name) >= 0).ToList(); + var total = docs.Count; docs = docs.OrderBy(m => m.DocStatus).ThenByDescending(m => m.TakeDate) .Skip(pageSize * pageIndex).Take(pageSize).ToList(); @@ -563,7 +571,7 @@ namespace YhCore.Service.Impl TryGetTea(teaMap, item.UserID, out var tea); result.Add(await BuildListItemAsync(item, tea, dictMap, "yyyy-MM-dd")); } - return result; + return PageVO.Of(result, total, pageIndex, pageSize); } /// @@ -895,7 +903,7 @@ namespace YhCore.Service.Impl } /// 文印详情统计列表(旧 List2:非待审单据按申请时间倒序分页)。 - public async Task> List2Async(string starttime, string endtime, string schSerId, int pageSize, int pageIndex) + public async Task> List2Async(string starttime, string endtime, string schSerId, int pageSize, int pageIndex) { var docs = (await _doc.FindAsync(m => m.SchSerID == schSerId && m.DocStatus != "0")).ToList(); if (DateTime.TryParse(starttime, out var date1)) @@ -933,13 +941,16 @@ namespace YhCore.Service.Impl }); } - return full.OrderByDescending(a => a.EditDate) - .Skip(pageSize * pageIndex).Take(pageSize) - .ToList(); + var total = full.Count; + return PageVO.Of( + full.OrderByDescending(a => a.EditDate) + .Skip(pageSize * pageIndex).Take(pageSize) + .ToList(), + total, pageIndex, pageSize); } /// 文印数量按用户排名(旧 List3)。 - public async Task> List3Async(string starttime, string endtime, string schSerId, int pageSize, int pageIndex) + public async Task> List3Async(string starttime, string endtime, string schSerId, int pageSize, int pageIndex) { var docs = (await _doc.FindAsync(m => m.SchSerID == schSerId && m.DocStatus == "1")).ToList(); if (DateTime.TryParse(starttime, out var date1)) @@ -965,23 +976,27 @@ namespace YhCore.Service.Impl .OrderByDescending(a => a.num) .ToList(); - return grouped.Skip(pageSize * pageIndex).Take(pageSize).ToList(); + var total = grouped.Count; + return PageVO.Of( + grouped.Skip(pageSize * pageIndex).Take(pageSize).ToList(), + total, pageIndex, pageSize); } /// 按月份统计明细(旧 List4:指定年月已印好单据,按申请时间倒序分页)。 - public async Task> List4Async(int year, int month, string schSerId, int pageSize, int pageIndex) + public async Task> List4Async(int year, int month, string schSerId, int pageSize, int pageIndex) { - var docs = (await _doc.FindAsync(m => m.SchSerID == schSerId - && m.DocStatus == "1" && m.EditDate.Year == year && m.EditDate.Month == month)) - .OrderByDescending(a => a.EditDate) + var all = (await _doc.FindAsync(m => m.SchSerID == schSerId + && m.DocStatus == "1" && m.EditDate.Year == year && m.EditDate.Month == month)).ToList(); + var total = all.Count; + var docs = all.OrderByDescending(a => a.EditDate) .Skip(pageSize * pageIndex).Take(pageSize) .ToList(); - return await BuildStatListAsync(docs, schSerId); + return PageVO.Of(await BuildStatListAsync(docs, schSerId), total, pageIndex, pageSize); } /// 按用户统计明细(旧 List5:指定用户已印好单据,按申请时间倒序分页)。 - public async Task> List5Async(string userid, string starttime, string endtime, string schSerId, int pageSize, int pageIndex) + public async Task> List5Async(string userid, string starttime, string endtime, string schSerId, int pageSize, int pageIndex) { var docs = (await _doc.FindAsync(m => m.SchSerID == schSerId && m.UserID == userid && m.DocStatus == "1")).ToList(); if (DateTime.TryParse(starttime, out var date1)) @@ -992,11 +1007,12 @@ namespace YhCore.Service.Impl docs = docs.Where(m => m.EditDate <= date2).ToList(); } + var total = docs.Count; docs = docs.OrderByDescending(a => a.EditDate) .Skip(pageSize * pageIndex).Take(pageSize) .ToList(); - return await BuildStatListAsync(docs, schSerId); + return PageVO.Of(await BuildStatListAsync(docs, schSerId), total, pageIndex, pageSize); } #endregion diff --git a/src/YhCore.Service/Impl/WYSHRoleService.cs b/src/YhCore.Service/Impl/WYSHRoleService.cs index 6d11c1e..bd38a78 100644 --- a/src/YhCore.Service/Impl/WYSHRoleService.cs +++ b/src/YhCore.Service/Impl/WYSHRoleService.cs @@ -1312,7 +1312,7 @@ namespace YhCore.Service.Impl return result; } - public async Task> MyListSHRoleAsync(string name, string status, string startDate, string endDate, int pageSize, int pageIndex, string userId, string schSerId) + public async Task> MyListSHRoleAsync(string name, string status, string startDate, string endDate, int pageSize, int pageIndex, string userId, string schSerId) { var resultList = (await _doc.FindAsync(m => m.UserID == userId && m.SchSerID == schSerId)).ToList(); @@ -1329,7 +1329,8 @@ namespace YhCore.Service.Impl } if (resultList.Count == 0) - return new List(); + return PageVO.Empty(pageIndex, pageSize); + var total = resultList.Count; var teaMap = await GetTeaMapAsync(schSerId); var pageList = resultList @@ -1375,10 +1376,10 @@ namespace YhCore.Service.Impl DocPrintNum = await GetDocPrintNumAsync(schSerId, 1, item.flowid, item.DocStep, item.SerID, userId, item.Examtype, item.DocStyle, item.grade, item.DocFix, item.DocShare, item.DocNum), }); } - return result; + return PageVO.Of(result, total, pageIndex, pageSize); } - public async Task> TotalListSHRoleAsync(int flowid, int dwid, string name, string stateid, string starttime, string endtime, int pageSize, int pageIndex, string schSerId) + public async Task> TotalListSHRoleAsync(int flowid, int dwid, string name, string stateid, string starttime, string endtime, int pageSize, int pageIndex, string schSerId) { var resultList = (await _doc.FindAsync(m => m.SchSerID == schSerId && m.DocStatus != "3")).ToList(); @@ -1413,7 +1414,8 @@ namespace YhCore.Service.Impl resultList = resultList.Where(m => m.rid == dwid).ToList(); if (resultList.Count == 0) - return new List(); + return PageVO.Empty(pageIndex, pageSize); + var total = resultList.Count; var teaMap2 = await GetTeaMapAsync(schSerId); var pageList = resultList @@ -1461,10 +1463,10 @@ namespace YhCore.Service.Impl DocPrintNum = await GetDocPrintNumAsync(schSerId, 4, item.flowid, item.DocStep, item.SerID, item.UserID, item.Examtype, item.DocStyle, item.grade, item.DocFix, item.DocShare, item.DocNum), }); } - return result; + return PageVO.Of(result, total, pageIndex, pageSize); } - public async Task> SendRdListSHRoleAsync(int flowid, int dwid, string name, string status, string startDate, string endDate, string userId, string schSerId, int pageSize, int pageIndex) + public async Task> SendRdListSHRoleAsync(int flowid, int dwid, string name, string status, string startDate, string endDate, string userId, string schSerId, int pageSize, int pageIndex) { var resultList = (await _doc.FindAsync(m => m.SchSerID == schSerId)).ToList(); var teaMap0 = await GetTeaMapAsync(schSerId); @@ -1529,7 +1531,8 @@ namespace YhCore.Service.Impl .ToList(); if (resultList2.Count == 0) - return new List(); + return PageVO.Empty(pageIndex, pageSize); + var total = resultList2.Count; var pageList = resultList2.Skip(pageSize * pageIndex).Take(pageSize).ToList(); var teaMap = await GetTeaMapAsync(schSerId); @@ -1579,10 +1582,10 @@ namespace YhCore.Service.Impl FJDownInfo = await GetFJDownInfoBySendAsync(item.UpFile), }); } - return result; + return PageVO.Of(result, total, pageIndex, pageSize); } - public async Task> SPListSHRoleAsync(int flowid, int dwid, string name, string status, string startDate, string endDate, string userId, string userName, string schSerId, int pageSize, int pageIndex) + public async Task> SPListSHRoleAsync(int flowid, int dwid, string name, string status, string startDate, string endDate, string userId, string userName, string schSerId, int pageSize, int pageIndex) { var userid = int.Parse(userId); var statuss = new[] { "0" }; @@ -1654,7 +1657,8 @@ namespace YhCore.Service.Impl resultList = resultList.Where(m => m.rid == dwid).ToList(); if (resultList.Count == 0) - return new List(); + return PageVO.Empty(pageIndex, pageSize); + var total = resultList.Count; var teaMap = await GetTeaMapAsync(schSerId); var pageList = resultList.OrderByDescending(m => m.EditDate) @@ -1704,7 +1708,7 @@ namespace YhCore.Service.Impl DocPrintNum = await GetDocPrintNumAsync(schSerId, 2, item.flowid, item.DocStep, item.SerID, userId, item.Examtype, item.DocStyle, item.grade, item.DocFix, item.DocShare, item.DocNum), }); } - return result; + return PageVO.Of(result, total, pageIndex, pageSize); } public async Task ShenheOkSHRoleAsync(FlowTranctDto model) @@ -2245,11 +2249,12 @@ namespace YhCore.Service.Impl return err; } - public async Task> GetRegetJERdAsync(string schSerId, int pageSize, int pageIndex) + public async Task> GetRegetJERdAsync(string schSerId, int pageSize, int pageIndex) { var resultList = (await _regetJERd.FindAsync(m => m.SchSerID == schSerId)).ToList(); if (resultList.Count == 0) - return new List(); + return PageVO.Empty(pageIndex, pageSize); + var total = resultList.Count; var teaMap = await GetTeaMapAsync(schSerId); var pageList = resultList.OrderByDescending(m => m.EditDatetime) @@ -2276,7 +2281,7 @@ namespace YhCore.Service.Impl UnitPrice = item.UnitPrice, }); } - return result; + return PageVO.Of(result, total, pageIndex, pageSize); } public async Task SetDownFileTimesAsync(int serId) diff --git a/src/YhCore.Service/Interfaces/IWYDocPrintService.cs b/src/YhCore.Service/Interfaces/IWYDocPrintService.cs index 0a5920e..13b0b4e 100644 --- a/src/YhCore.Service/Interfaces/IWYDocPrintService.cs +++ b/src/YhCore.Service/Interfaces/IWYDocPrintService.cs @@ -1,6 +1,7 @@ using System.Threading.Tasks; using System.Collections.Generic; using YhCore.Model.Dto; +using YhCore.Model.Vo; namespace YhCore.Service.Interfaces { @@ -11,7 +12,7 @@ namespace YhCore.Service.Interfaces public interface IWYDocPrintService { // ---- 抄送 ---- - Task> SendRdListAsync(string name, string startDate, string endDate, string userId, string schSerId, int pageSize, int pageIndex); + Task> SendRdListAsync(string name, string startDate, string endDate, string userId, string schSerId, int pageSize, int pageIndex); Task> SendDetailsListAsync(int serId); Task EditSendAsync(int serId, string senduserid, string mysenduserid, string schSerId, string uid); @@ -25,12 +26,12 @@ namespace YhCore.Service.Interfaces Task RevokeAsync(FlowTranctDto model); // ---- 列表 ---- - Task> MyListAsync(string name, string status, string startDate, string endDate, string userId, string schSerId, int pageSize, int pageIndex); - Task> AllListAsync(string name, string userId, string schSerId, int pageSize, int pageIndex); - Task> ShenheListAsync(string userId, string schSerId, int pageSize, int pageIndex); - Task> SPListAsync(string name, string status, string startDate, string endDate, string userId, string schSerId, int pageSize, int pageIndex); - Task> YishenListAsync(string name, string userId, string schSerId, int pageSize, int pageIndex); - Task> TotalListAsync(string name, string stateid, string starttime, string endtime, string schSerId, int pageSize, int pageIndex); + Task> MyListAsync(string name, string status, string startDate, string endDate, string userId, string schSerId, int pageSize, int pageIndex); + Task> AllListAsync(string name, string userId, string schSerId, int pageSize, int pageIndex); + Task> ShenheListAsync(string userId, string schSerId, int pageSize, int pageIndex); + Task> SPListAsync(string name, string status, string startDate, string endDate, string userId, string schSerId, int pageSize, int pageIndex); + Task> YishenListAsync(string name, string userId, string schSerId, int pageSize, int pageIndex); + Task> TotalListAsync(string name, string stateid, string starttime, string endtime, string schSerId, int pageSize, int pageIndex); Task> MyListtoOneAsync(int serId, string schSerId); Task> BindflowinfoAsync(string schSerId, int flowType); @@ -43,9 +44,9 @@ namespace YhCore.Service.Interfaces // ---- 统计 ---- Task> List1Async(string starttime, string endtime, string schSerId); - Task> List2Async(string starttime, string endtime, string schSerId, int pageSize, int pageIndex); - Task> List3Async(string starttime, string endtime, string schSerId, int pageSize, int pageIndex); - Task> List4Async(int year, int month, string schSerId, int pageSize, int pageIndex); - Task> List5Async(string userid, string starttime, string endtime, string schSerId, int pageSize, int pageIndex); + Task> List2Async(string starttime, string endtime, string schSerId, int pageSize, int pageIndex); + Task> List3Async(string starttime, string endtime, string schSerId, int pageSize, int pageIndex); + Task> List4Async(int year, int month, string schSerId, int pageSize, int pageIndex); + Task> List5Async(string userid, string starttime, string endtime, string schSerId, int pageSize, int pageIndex); } } diff --git a/src/YhCore.Service/Interfaces/IWYSHRoleService.cs b/src/YhCore.Service/Interfaces/IWYSHRoleService.cs index b479ab4..a5815df 100644 --- a/src/YhCore.Service/Interfaces/IWYSHRoleService.cs +++ b/src/YhCore.Service/Interfaces/IWYSHRoleService.cs @@ -50,10 +50,10 @@ namespace YhCore.Service.Interfaces // ---- 用户记录查看和审核 ---- Task GetshenheFlowAsync(string schSerId, decimal docprintId, int flowid); Task> MyListtoOneSHRoleAsync(int serId, string schSerId); - Task> MyListSHRoleAsync(string name, string status, string startDate, string endDate, int pageSize, int pageIndex, string userId, string schSerId); - Task> TotalListSHRoleAsync(int flowid, int dwid, string name, string stateid, string starttime, string endtime, int pageSize, int pageIndex, string schSerId); - Task> SendRdListSHRoleAsync(int flowid, int dwid, string name, string status, string startDate, string endDate, string userId, string schSerId, int pageSize, int pageIndex); - Task> SPListSHRoleAsync(int flowid, int dwid, string name, string status, string startDate, string endDate, string userId, string userName, string schSerId, int pageSize, int pageIndex); + Task> MyListSHRoleAsync(string name, string status, string startDate, string endDate, int pageSize, int pageIndex, string userId, string schSerId); + Task> TotalListSHRoleAsync(int flowid, int dwid, string name, string stateid, string starttime, string endtime, int pageSize, int pageIndex, string schSerId); + Task> SendRdListSHRoleAsync(int flowid, int dwid, string name, string status, string startDate, string endDate, string userId, string schSerId, int pageSize, int pageIndex); + Task> SPListSHRoleAsync(int flowid, int dwid, string name, string status, string startDate, string endDate, string userId, string userName, string schSerId, int pageSize, int pageIndex); Task ShenheOkSHRoleAsync(FlowTranctDto model); // ---- 规格表 / 签名 / 退回 / 金额 ---- @@ -64,7 +64,7 @@ namespace YhCore.Service.Interfaces Task TuiHuiAsync(string userId, string cont, decimal docId); Task UnTuiHuiAsync(string userId, decimal docId); Task RegetJEAsync(string schSerId, string userId, List listDocPrintId, string type); - Task> GetRegetJERdAsync(string schSerId, int pageSize, int pageIndex); + Task> GetRegetJERdAsync(string schSerId, int pageSize, int pageIndex); Task SetDownFileTimesAsync(int serId); } }