BiSnapshotApplication.cs 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  1. using FluentValidation.Results;
  2. using Hotline.FlowEngine.Workflows;
  3. using Hotline.Orders;
  4. using Hotline.Repository.SqlSugar.Orders;
  5. using Hotline.Settings;
  6. using Hotline.Settings.Hotspots;
  7. using Hotline.Share.Attributes;
  8. using Hotline.Share.Dtos;
  9. using Hotline.Share.Dtos.Order;
  10. using Hotline.Share.Dtos.Snapshot;
  11. using Hotline.Share.Enums.FlowEngine;
  12. using Hotline.Share.Enums.Order;
  13. using Hotline.Share.Enums.Snapshot;
  14. using Hotline.Share.Requests;
  15. using Hotline.Share.Tools;
  16. using Hotline.Snapshot;
  17. using Hotline.Snapshot.Interfaces;
  18. using Hotline.Tools;
  19. using Mapster;
  20. using MediatR;
  21. using Microsoft.AspNetCore.Http;
  22. using Microsoft.AspNetCore.Mvc;
  23. using NPOI.SS.Formula.Functions;
  24. using SqlSugar;
  25. using System;
  26. using System.Collections.Generic;
  27. using System.Linq;
  28. using System.Text;
  29. using System.Threading.Tasks;
  30. using XF.Domain.Authentications;
  31. using XF.Domain.Dependency;
  32. using XF.Domain.Exceptions;
  33. using XF.Domain.Repository;
  34. using static NPOI.HSSF.Util.HSSFColor;
  35. using static NPOI.SS.Format.CellNumberFormatter;
  36. namespace Hotline.Application.Snapshot;
  37. public class BiSnapshotApplication : IBiSnapshotApplication, IScopeDependency
  38. {
  39. private readonly IOrderSnapshotRepository _orderSnapshotRepository;
  40. private readonly IRedPackRecordRepository _redPackRecordRepository;
  41. private readonly IIndustryRepository _industryRepository;
  42. private readonly IIndustryCaseRepository _industryCaseRepository;
  43. private readonly IRedPackAuditRepository _redPackAuditRepository;
  44. private readonly IRepository<Hotspot> _hotspotTypeRepository;
  45. private readonly ISessionContext _sessionContext;
  46. private readonly IOrderRepository _orderRepository;
  47. public BiSnapshotApplication(IOrderSnapshotRepository orderSnapshotRepository, IRedPackRecordRepository redPackRecordRepository, IIndustryRepository industryRepository, IIndustryCaseRepository industryCaseRepository, IRedPackAuditRepository redPackAuditRepository, IRepository<Hotspot> hotspotTypeRepository, ISessionContext sessionContext, IOrderRepository orderRepository)
  48. {
  49. _orderSnapshotRepository = orderSnapshotRepository;
  50. _redPackRecordRepository = redPackRecordRepository;
  51. _industryRepository = industryRepository;
  52. _industryCaseRepository = industryCaseRepository;
  53. _redPackAuditRepository = redPackAuditRepository;
  54. _hotspotTypeRepository = hotspotTypeRepository;
  55. _sessionContext = sessionContext;
  56. _orderRepository = orderRepository;
  57. }
  58. public ISugarQueryable<HotspotStatisticsOutDto> GetHotspotStatistics(HotspotStatisticsInDto dto)
  59. {
  60. var IsCenter = _sessionContext.OrgIsCenter;
  61. string count = "2";
  62. string countx = string.Empty;
  63. if (dto.HotspotCode.NotNullOrEmpty())
  64. {
  65. count = (dto.HotspotCode.Length + 2).ToString();
  66. countx = dto.HotspotCode.Length.ToString();
  67. }
  68. return _hotspotTypeRepository.Queryable()
  69. .LeftJoin<Order>((it, o) => it.Id == o.HotspotId)
  70. .LeftJoin<OrderSnapshot>((it, o, s) => o.Id == s.Id)
  71. .Where((it, o, s) => o.CreationTime >= dto.StartTime && o.CreationTime <= dto.EndTime && s.Id != null)
  72. .WhereIF(dto.HotspotCode.IsNullOrEmpty(), (it, o) => o.Id != null)
  73. .WhereIF(dto.HotspotCode.NotNullOrEmpty(), (it, o) => it.ParentId.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>(countx)) == dto.HotspotCode)
  74. .WhereIF(IsCenter == false, (it, o) => o.ActualHandleOrgCode.StartsWith(_sessionContext.RequiredOrgId))
  75. .GroupBy((it, o) => new { Id = it.Id.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>(count)) })
  76. .Select((it, o) => new
  77. {
  78. HotspotCode = it.Id.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>(count)),
  79. SumCount = SqlFunc.AggregateCount(it.HotSpotName)
  80. })
  81. .MergeTable()
  82. .LeftJoin<Hotspot>((x, q) => x.HotspotCode == q.Id)
  83. .Select((x, q) => new HotspotStatisticsOutDto
  84. {
  85. HotspotCode = x.HotspotCode,
  86. SumCount = x.SumCount,
  87. HotspotName = q.HotSpotName,
  88. HasChild = SqlFunc.Subqueryable<Hotspot>().Where(d => d.ParentId == x.HotspotCode).Any()
  89. });
  90. }
  91. /// <summary>
  92. /// 热点类型小类统计明细
  93. /// </summary>
  94. /// <param name="dto"></param>
  95. /// <returns></returns>
  96. public ISugarQueryable<HotspotStatisticsDetailsOutDto> HotspotStatisticsDetail([FromQuery] HotspotStatisticsDetailsInDto dto)
  97. {
  98. var IsCenter = _sessionContext.OrgIsCenter;
  99. IsCenter = true;
  100. var query = _orderRepository.Queryable()
  101. .Includes(d => d.OrderVisits)
  102. .Where(d => d.CreationTime >= dto.StartTime && d.CreationTime <= dto.EndTime)
  103. .WhereIF(dto.HotspotCode.NotNullOrEmpty(), d => d.HotspotId.StartsWith(dto.HotspotCode))
  104. .WhereIF(IsCenter == false, d => d.ActualHandleOrgCode.StartsWith(_sessionContext.RequiredOrgId))
  105. .Select(d => new HotspotStatisticsDetailsOutDto
  106. {
  107. OrderScreenStatus = SqlFunc.Subqueryable<OrderScreen>().Where(q => q.OrderId == d.Id).OrderByDesc(q => q.CreationTime).Select(q => q.Status), //x.OrderScreens.FirstOrDefault().Status,
  108. }, true);
  109. return query;
  110. }
  111. /// <summary>
  112. /// 市民红包审批统计
  113. /// </summary>
  114. /// <param name="dto"></param>
  115. /// <param name="requestAborted"></param>
  116. /// <returns></returns>
  117. /// <exception cref="NotImplementedException"></exception>
  118. [ExportExcel("市民红包审核统计")]
  119. public IList<RedPackStatisticsOutDto> GetRedPackAuditStatistics(RedPackStatisticsInDto dto)
  120. {
  121. var industries = _industryRepository.Queryable(includeDeleted: true)
  122. .LeftJoin<IndustryCase>((industry, industryCase) => industry.Id == industryCase.IndustryId && industryCase.IsEnable == true)
  123. .Select((industry, industryCase) => new RedPackStatisticsOutDto
  124. {
  125. Id = industry.Id,
  126. Name = industry.Name,
  127. CaseId = industryCase.Id,
  128. CaseName = industryCase.Name,
  129. ShouldAmount = industryCase.CitizenReadPackAmount == null ? industry.CitizenReadPackAmount : industryCase.CitizenReadPackAmount,
  130. }).ToList();
  131. var redPackOutDto = _redPackAuditRepository.Queryable(includeDeleted: true)
  132. .LeftJoin<OrderSnapshot>((audit, snapshot) => audit.OrderId == snapshot.Id)
  133. .LeftJoin<RedPackRecord>((audit, snapshot, record) => record.RedPackAuditId == audit.Id)
  134. .LeftJoin<SupplementRecord>((audit, snapshot, record, supplement) => supplement.RedPackAuditId == audit.Id)
  135. .Where((audit, snapshot) => audit.CreationTime >= dto.StartTime && audit.CreationTime <= dto.EndTime)
  136. .GroupBy((audit, snapshot) => new { snapshot.IndustryCase, snapshot.IndustryId, snapshot.IndustryName })
  137. .Select((audit, snapshot, record, supplement) => new RedPackStatisticsOutDto
  138. {
  139. Id = snapshot.IndustryId,
  140. Name = snapshot.IndustryName,
  141. CaseId = snapshot.IndustryCase,
  142. ApprovalAmount = SqlFunc.AggregateSum(SqlFunc.IIF(audit.Status == ERedPackAuditStatus.Agree, audit.ApprovedAmount, 0)), //审批同意总金额
  143. ApprovalCount = SqlFunc.AggregateSum(SqlFunc.IIF(audit.Status == ERedPackAuditStatus.Agree, 1, 0)), // 审批同意总个数
  144. SentAmount = SqlFunc.AggregateSum(SqlFunc.IIF(audit.IsSend == true, audit.AcutalAmount, 0)), // 发送成功金额
  145. SentCount = SqlFunc.AggregateSum(SqlFunc.IIF(audit.IsSend == true, 1, 0)), // 发送成功个数
  146. SendFailAmount = SqlFunc.AggregateSum(SqlFunc.IIF(record.DistributionState == EReadPackSendStatus.Fail, record.Amount, 0)), //发送失败金额
  147. SendFailCount = SqlFunc.AggregateSum(SqlFunc.IIF(record.DistributionState == EReadPackSendStatus.Fail, 1, 0)), // 发送失败个数
  148. PendingAmount = SqlFunc.AggregateSum(SqlFunc.IIF(record.DistributionState == EReadPackSendStatus.Unsend, audit.ApprovedAmount, 0)), // 待发金额
  149. PendingCount = SqlFunc.AggregateSum(SqlFunc.IIF(record.DistributionState == EReadPackSendStatus.Unsend, 1, 0)), // 待发个数
  150. SupplementAmount = SqlFunc.AggregateSum(supplement.ReplenishAmount), // 补充红包金额
  151. SupplementCount = SqlFunc.AggregateCount(supplement.Id), // 补充红包数
  152. }).ToList();
  153. foreach (var industry in industries)
  154. {
  155. var item = redPackOutDto
  156. .WhereIF(industry.CaseId != null, m => m.CaseId == industry.CaseId)
  157. .WhereIF(industry.CaseId == null, m => m.Id == industry.Id)
  158. .FirstOrDefault();
  159. var config = new TypeAdapterConfig();
  160. config.ForType<RedPackStatisticsOutDto, RedPackStatisticsOutDto>()
  161. .Ignore(dest => dest.CaseId)
  162. .Ignore(dest => dest.CaseName)
  163. .Ignore(dest => dest.ShouldAmount);
  164. item?.Adapt(industry, config);
  165. if (industry.CaseId == null)
  166. {
  167. industry.IndustryName = $"{industry.Name}({industry.ShouldAmount?.ToString("f2")})";
  168. industry.IndustryType = 1;
  169. industry.IndustryId = industry.Id;
  170. }
  171. else
  172. {
  173. industry.IndustryType = 2;
  174. industry.IndustryId = industry.CaseId;
  175. if (industry.CaseName == industry.Name)
  176. industry.IndustryName = $"{industry.Name}({industry.ShouldAmount?.ToString("f2")})";
  177. else
  178. {
  179. industry.IndustryName = $"{industry.Name}-{industry.CaseName}({industry.ShouldAmount?.ToString("f2")})";
  180. }
  181. }
  182. }
  183. return industries;
  184. }
  185. public ISugarQueryable<RedPackStatisticsDetailsOutDto> GetRedPackAuditStatisticsDetails(RedPackStatisticsDetailsInDto dto)
  186. {
  187. dto.ValidateObject();
  188. dto.FieldName = dto.FieldName.ToLower();
  189. var query = _orderSnapshotRepository.Queryable(includeDeleted: true)
  190. .LeftJoin<Order>((snapshot, order) => order.Id == snapshot.Id)
  191. .LeftJoin<RedPackAudit>((snapshot, order, audit) => snapshot.Id == audit.OrderId)
  192. .LeftJoin<RedPackRecord>((snapshot, order, audit, record) => audit.Id == record.RedPackAuditId)
  193. .LeftJoin<SupplementRecord>((snapshot, order, audit, record, supplement) => audit.Id == supplement.RedPackAuditId)
  194. .Where((snapshot, order, audit) => audit.CreationTime >= dto.StartTime && audit.CreationTime <= dto.EndTime)
  195. .WhereIF(dto.IndustryType == 1, (snapshot, order, audit) => snapshot.IndustryId == dto.IndustryId)
  196. .WhereIF(dto.IndustryType == 2, (snapshot, order, audit) => snapshot.IndustryCase == dto.IndustryId);
  197. query = dto.FieldName switch
  198. {
  199. "approvalamount" => query.Where((snapshot, order, audit) => audit.Status == ERedPackAuditStatus.Agree),
  200. "approvalcount" => query.Where((snapshot, order, audit) => audit.Status == ERedPackAuditStatus.Agree),
  201. "sentamount" => query.Where((snapshot, order, audit) => audit.IsSend == true),
  202. "sentcount" => query.Where((snapshot, order, audit) => audit.IsSend == true),
  203. "sendfailamount" => query.Where((snapshot, order, audit, record) => record.DistributionState == EReadPackSendStatus.Fail),
  204. "sendfailcount" => query.Where((snapshot, order, audit, record) => record.DistributionState == EReadPackSendStatus.Fail),
  205. "pendingamount" => query.Where((snapshot, order, audit, record) => record.DistributionState == EReadPackSendStatus.Unsend),
  206. "pendingcount" => query.Where((snapshot, order, audit, record) => record.DistributionState == EReadPackSendStatus.Unsend),
  207. "supplementamount" => query.Where((snapshot, order, audit, record, supplement) => supplement.Id != null),
  208. "supplementcount" => query.Where((snapshot, order, audit, record, supplement) => supplement.Id != null),
  209. _ => throw new UserFriendlyException($"不支持输入字段: {dto.FieldName}")
  210. };
  211. return query.Select((snapshot, order, audit, record, supplement) => new RedPackStatisticsDetailsOutDto
  212. {
  213. CreationTime = order.CreationTime
  214. }, true);
  215. }
  216. public async Task<SnapshotStatisticsOutDto> GetSnapshotStatisticsAsync(SnapshotStatisticsInDto dto, CancellationToken token)
  217. {
  218. var query = _orderSnapshotRepository.Queryable(includeDeleted: true)
  219. .LeftJoin<Order>((snapshot, order) => order.Id == snapshot.Id)
  220. .LeftJoin<RedPackAudit>((snapshot, order, redPackAudit) => snapshot.Id == redPackAudit.OrderId)
  221. .LeftJoin<SpecialRedPackAudit>((snapshot, order, redPackAudit, special) => snapshot.Id == special.OrderId)
  222. .LeftJoin<RedPackGuiderAudit>((snapshot, order, redPackAudit, special, guiderAudit) => snapshot.Id == guiderAudit.OrderId)
  223. .LeftJoin<RedPackRecord>((snapshot, order, redPackAudit, special, guiderAudit, record) => redPackAudit.Id == record.RedPackAuditId)
  224. .LeftJoin<OrderSecondaryHandling>((snapshot, order, redPackAudit, special, guiderAudit, record, second) => snapshot.Id == second.OrderId)
  225. .LeftJoin<OrderSpecial>((snapshot, order, redPackAudit, special, guiderAudit, record, second, orderSpecial) => snapshot.Id == orderSpecial.OrderId)
  226. .Where((snapshot) => snapshot.CreationTime >= dto.StartTime && snapshot.CreationTime <= dto.EndTime)
  227. .Select((snapshot, order, redPackAudit, special, guiderAudit, record, second, orderSpecial) => new SnapshotStatisticsOutDto
  228. {
  229. WZSLFWNJS = SqlFunc.AggregateSum(SqlFunc.IIF(order.HotspotName == "非受理范围", 1, 0)), // 未在受理范围内件数,
  230. SSPZ12345JS = SqlFunc.AggregateSum(SqlFunc.IIF(order.SourceChannelCode == "SJP12345", 1, 0)), // 随手拍转12345件数,
  231. SLFWNZJS = SqlFunc.AggregateSum(SqlFunc.IIF(order.HotspotName != "非受理范围" && order.SourceChannelCode == "SJP12345", 1, 0)), // 受理范围内总件数,
  232. SLFWNPGWGYSXSNHFJS = SqlFunc.AggregateSum(SqlFunc.IIF(snapshot.IsGuidSystemCallBack == true && snapshot.GuidSystemCallBackTime.Value.AddHours(-4) > snapshot.SendGuidSystemTime, 1, 0)), // 受理范围内派给网格员四小时内回复件数,
  233. SLFWNPGWGYCGSXSHFJS = SqlFunc.AggregateSum(SqlFunc.IIF(snapshot.IsGuidSystemCallBack == true && snapshot.GuidSystemCallBackTime.Value.AddHours(-4) <= snapshot.SendGuidSystemTime, 1, 0)), // 受理范围内派给网格员超过四小时回复件数
  234. SLFWNPGWGYWHFJS = SqlFunc.AggregateSum(SqlFunc.IIF(snapshot.IsGuidSystemCallBack == false, 1, 0)), // 受理范围内派给网格员未回复件数
  235. SLFWNA12345ZPGGBMJS = 0, //受理范围内按12345直派给各部门件数,
  236. SLFWNA12345ZPGGQXJS = 0, //受理范围内按12345直派给各区县件数
  237. ZXYB = SqlFunc.AggregateSum(SqlFunc.IIF(order.FileOrgIsCenter == true, 1, 0)), // 中心已办
  238. BMYB = SqlFunc.AggregateSum(SqlFunc.IIF(order.FileOrgIsCenter == false, 1, 0)), // 部门已办
  239. SLFWMYD = 0, //受理范围满意度
  240. MYL = SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonListObjectAny(order.OrgProcessingResults, "key", "1") || SqlFunc.JsonListObjectAny(order.OrgProcessingResults, "key", "2"), 0, 1)), // 满意量
  241. BMYL = SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonListObjectAny(order.OrgProcessingResults, "key", "1") || SqlFunc.JsonListObjectAny(order.OrgProcessingResults, "key", "2"), 1, 0)), // 不满意量
  242. SPBTYHBGS = SqlFunc.AggregateSum(SqlFunc.IIF(redPackAudit.Status == ERedPackAuditStatus.Refuse, 1, 0)), // 审批不同意红包个数
  243. SPTYHBGS = SqlFunc.AggregateSum(SqlFunc.IIF(redPackAudit.Status == ERedPackAuditStatus.Agree, 1, 0)), // 审批同意红包个数
  244. TSHBSP = 0, //特殊红包审批统计
  245. SPTYGS = SqlFunc.AggregateSum(SqlFunc.IIF(special.Status == ERedPackAuditStatus.Agree, 1, 0)), //审批同意个数
  246. YFJE = SqlFunc.AggregateSum(SqlFunc.IIF(special.IsSend == true, special.AcutalAmount, 0)), // 已发金额
  247. JSHFFWGJLGS = 0, //局审核发放网格员奖励个数
  248. SPTYWGYHBGS = SqlFunc.AggregateSum(SqlFunc.IIF(guiderAudit.LevelTwoStatus == ERedPackAuditStatus.Agree, 1, 0)), //审批同意(网格员)红包个数
  249. SPBTYWGYHBGS = SqlFunc.AggregateSum(SqlFunc.IIF(guiderAudit.LevelOneStatus == ERedPackAuditStatus.Refuse || guiderAudit.LevelTwoStatus == ERedPackAuditStatus.Refuse, 1, 0)), //审批不同意(网格员)红包个数
  250. SMJLZE = SqlFunc.AggregateSum(redPackAudit.AcutalAmount), // 市民奖励总额
  251. SMYFFJLZE = SqlFunc.AggregateSum(SqlFunc.IIF(redPackAudit.IsSend == true, redPackAudit.AcutalAmount, 0)), // 市民已发放奖励总额
  252. SMDFFJLZE = SqlFunc.AggregateSum(SqlFunc.IIF(redPackAudit.IsSend == false, redPackAudit.ApprovedAmount, 0)), // 市民待发奖励总额
  253. YFG = SqlFunc.AggregateSum(SqlFunc.IIF(redPackAudit.IsSend == true, 1, 0)), //已发(个)
  254. WFLXG = 0, // 无法联系(个)
  255. WJHBG = SqlFunc.AggregateSum(SqlFunc.IIF(record.FailCase == ERedPackPickupFailCase.Excuse, 1, 0)), // 婉拒红包(个)
  256. WGYYFJLJE = SqlFunc.AggregateSum(SqlFunc.IIF(guiderAudit.LevelTwoStatus == ERedPackAuditStatus.Agree, guiderAudit.AcutalAmount, 0)), //网格员应发奖励金额
  257. WGYYFFJLZE = SqlFunc.AggregateSum(SqlFunc.IIF(guiderAudit.IsSend == true, guiderAudit.AcutalAmount, 0)), // 网格员已发放奖励总额
  258. WGYDFFJLZE = SqlFunc.AggregateSum(SqlFunc.IIF(guiderAudit.LevelTwoStatus == ERedPackAuditStatus.Agree && guiderAudit.IsSend == false, guiderAudit.ApprovedAmount, 0)), // 网格员待发放奖励总额
  259. WGYKKZEYF = 0, // 网格员扣款总额(已发)
  260. WGYKKZEDF = 0, // 网格员扣款总额(待发)
  261. SLFWNDBMHQJJS = SqlFunc.AggregateSum(SqlFunc.IIF(order.CounterSignType != null, 1, 0)), // 受理范围内多部门会签件件数
  262. SLFWNRXZXGDJS = SqlFunc.AggregateSum(SqlFunc.IIF(order.FileOrgIsCenter == true, 1, 0)), // 受理范围内热线中心归档件数
  263. RXZXFQHQJJS = SqlFunc.AggregateSum(SqlFunc.IIF(order.CounterSignType != null && order.CounterSignType == ECounterSignType.Center, 1, 0)), // 热线中心发起会签件件数
  264. AQYH = SqlFunc.AggregateSum(SqlFunc.IIF(snapshot.IsDangerDepartment == true, 1, 0)), // 安全隐患
  265. YWCAQYHZG = SqlFunc.AggregateSum(SqlFunc.IIF(snapshot.IsRectifyDepartment == true, 1, 0)), // 已完成安全隐患整改
  266. SQYQGDJS = SqlFunc.AggregateSum(SqlFunc.IIF(order.OrderDelays.Count(m => m.DelayState == EDelayState.Pass) > 0, 1, 0)), // 申请延期工单件数
  267. SQYQGDCS = SqlFunc.AggregateSum(SqlFunc.IIF(order.OrderDelays.Count() > 0, order.OrderDelays.Count(m => m.DelayState == EDelayState.Pass), 0)), // 申请延期工单次数
  268. CQJ = SqlFunc.AggregateSum(SqlFunc.IIF(order.Status >= EOrderStatus.Filed && order.ExpiredTime < order.FiledTime, 1, 0)), // 超期件
  269. ECBLJSTHBM = SqlFunc.AggregateSum(SqlFunc.IIF(second.State == ESecondaryHandlingState.Handled && second.ApplyOrgId != "001", 1, 0)), // 二次办理件数 - 退回部门
  270. ECBLJSHFBMYCB = SqlFunc.AggregateSum(SqlFunc.IIF(second.State == ESecondaryHandlingState.Handled, 1, 0)), // 二次办理件数-回访不满意重办
  271. ECBLJSTTDYYJBM = SqlFunc.AggregateSum(SqlFunc.IIF(second.State == ESecondaryHandlingState.Handled, 1, 0)), // 二次办理件数-特提到原一级部门
  272. ECBLJSHFMY = SqlFunc.AggregateSum(SqlFunc.IIF(second.State == ESecondaryHandlingState.Handled && (SqlFunc.JsonField(order.OrgProcessingResults, "Key") == "5" || SqlFunc.JsonField(order.OrgProcessingResults, "Key") == "4" || SqlFunc.JsonField(order.OrgProcessingResults, "Key") == "-1" || SqlFunc.JsonField(order.OrgProcessingResults, "Key") == "0"), 1, 0)), // 二次办理件数-回访满意
  273. // ECBLGDMYL = , // 二次办理工单满意率
  274. ECBLGDJSTMBMHFMYD = SqlFunc.AggregateSum(SqlFunc.IIF(second.State == ESecondaryHandlingState.Handled && second.ApplyOrgId != "001" && (SqlFunc.JsonField(order.OrgProcessingResults, "Key") == "5" || SqlFunc.JsonField(order.OrgProcessingResults, "Key") == "4" || SqlFunc.JsonField(order.OrgProcessingResults, "Key") == "-1" || SqlFunc.JsonField(order.OrgProcessingResults, "Key") == "0"), 1, 0)), // 二次办理工单件数-退回部门回访满意
  275. // ECBLGDMYLTHBM = , // 二次办理工单满意率-退回部门
  276. // ECBLGDMYLHFBMYCB = 0, // 二次办理工单满意率-回访不满意重办
  277. TTDYYJBMJS = SqlFunc.AggregateSum(SqlFunc.IIF(orderSpecial.State == 1 && orderSpecial.SpecialType == ESpecialType.Special && orderSpecial.NextStepName == "一级部门", 1, 0)), // 特提到原一级部门件数
  278. TTDPDZJS = SqlFunc.AggregateSum(SqlFunc.IIF(orderSpecial.State == 1 && orderSpecial.SpecialType == ESpecialType.Special && orderSpecial.NextStepName == "派单组", 1, 0)), // 特提到派单组件数
  279. QTTTJS = SqlFunc.AggregateSum(SqlFunc.IIF(orderSpecial.State == 1 && orderSpecial.SpecialType == ESpecialType.Special && (orderSpecial.NextStepName != "一级部门" || orderSpecial.NextStepName != "派单组"), 1, 0)), // 其他特提件数
  280. });
  281. return await query.FirstAsync();
  282. }
  283. public ISugarQueryable<SnapshotStatisticsDetailOutDto> GetSnapshotStatisticsDetail(SnapshotStatisticsDetailInDto dto)
  284. {
  285. dto.FieldName = dto.FieldName.ToUpper();
  286. var query = _orderSnapshotRepository.Queryable(includeDeleted: true)
  287. .LeftJoin<Order>((snapshot, order) => order.Id == snapshot.Id)
  288. .LeftJoin<RedPackAudit>((snapshot, order, redPackAudit) => snapshot.Id == redPackAudit.OrderId)
  289. .LeftJoin<SpecialRedPackAudit>((snapshot, order, redPackAudit, special) => snapshot.Id == special.OrderId)
  290. .LeftJoin<RedPackGuiderAudit>((snapshot, order, redPackAudit, special, guiderAudit) => snapshot.Id == guiderAudit.OrderId)
  291. .Where((snapshot, order) => order.CreationTime >= dto.StartTime && order.CreationTime <= dto.EndTime);
  292. query = dto.FieldName switch
  293. {
  294. "WZSLFWNJS" => query.Where((snapshot, order) => order.SourceChannelCode != "SSP"),
  295. "SSPZ12345JS" => query.Where((snapshot, order) => order.SourceChannelCode != "SSP"),
  296. "SLFWNPGWGYSXSNHFJS" => query.Where((snapshot, order) => snapshot.IsGuidSystemCallBack == true && snapshot.GuidSystemCallBackTime!.Value.AddHours(-4) <= snapshot.SendGuidSystemTime),
  297. "SLFWNPGWGYCGSXSHFJS" => query.Where((snapshot, order) => snapshot.IsGuidSystemCallBack == true && snapshot.GuidSystemCallBackTime!.Value.AddHours(-4) <= snapshot.SendGuidSystemTime),
  298. "SLFWNPGWGYWHFJS" => query.Where((snapshot, order) => snapshot.IsGuidSystemCallBack == false),
  299. "ZXYB" => query.Where((snapshop, order) => order.FileOrgIsCenter == true),
  300. "BMYB" => query.Where((snapshop, order) => order.FileOrgIsCenter == false),
  301. "MYL" => query.Where((snapshot, order) => SqlFunc.JsonListObjectAny(order.OrgProcessingResults, "key", "-1") || SqlFunc.JsonListObjectAny(order.OrgProcessingResults, "key", "3") || SqlFunc.JsonListObjectAny(order.OrgProcessingResults, "key", "4") || SqlFunc.JsonListObjectAny(order.OrgProcessingResults, "key", "5")),
  302. "BMYL" => query.Where((snapshot, order) => SqlFunc.JsonListObjectAny(order.OrgProcessingResults, "key", "1") || SqlFunc.JsonListObjectAny(order.OrgProcessingResults, "key", "2")),
  303. "SPBTYHBGS" => query.Where((snapshot, order, redPackAudit) => redPackAudit.Status == ERedPackAuditStatus.Refuse),
  304. "SPTYHBGS" => query.Where((snapshot, order, redPackAudit) => redPackAudit.Status == ERedPackAuditStatus.Agree),
  305. "SPTYGS" => query.Where((snapshot, order, redPackAudit, special) => special.Status == ERedPackAuditStatus.Agree),
  306. "YFJE" => query.Where((snapshot, order, redPackAudit, special) => special.IsSend == true),
  307. "SPTYWGYHBGS" => query.Where((snapshot, order, redPackAudit, special, guiderAudit) => guiderAudit.LevelTwoStatus == ERedPackAuditStatus.Agree),
  308. "SPBTYWGYHBGS" => query.Where((snapshot, order, redPackAudit, special, guiderAudit) => guiderAudit.LevelOneStatus == ERedPackAuditStatus.Refuse || guiderAudit.LevelTwoStatus == ERedPackAuditStatus.Refuse),
  309. _ => throw new UserFriendlyException("入参错误:" + dto.FieldName + " 未实现")
  310. };
  311. return query.Select((snapshot, order, redPackAudit, special, guiderAudit) => new SnapshotStatisticsDetailOutDto
  312. {
  313. CreationTime = order.CreationTime
  314. }, true);
  315. }
  316. /// <summary>
  317. /// 办件统计-随手拍
  318. /// </summary>
  319. /// <param name="dto"></param>
  320. /// <returns></returns>
  321. /// <exception cref="NotImplementedException"></exception>
  322. public ISugarQueryable<SnapshotProcessingStatisticsOutDto> GetSnapshotProcessingStatistics(SnapshotProcessingStatisticsInDto dto)
  323. {
  324. bool IsCenter = _sessionContext.OrgIsCenter;
  325. var orgLevel = _sessionContext.OrgLevel;
  326. string orgLevelStr = (_sessionContext.RequiredOrgId.Length + 3).ToString();
  327. var query = _orderSnapshotRepository.Queryable(includeDeleted: true)
  328. .LeftJoin<Order>((snapshot, order) => snapshot.Id == order.Id)
  329. .LeftJoin<OrderSendBackAudit>((snapshot, order, back) => snapshot.Id == back.OrderId && back.State == ESendBackAuditState.End)
  330. .LeftJoin<OrderVisit>((snapshot, order, back, visit) => snapshot.Id == visit.OrderId && visit.VisitState == EVisitState.Visited)
  331. .LeftJoin<OrderSecondaryHandling>((snapshot, order, back, visit, second) => snapshot.Id == second.OrderId && second.State == ESecondaryHandlingState.End)
  332. .Where(snapshot => snapshot.CreationTime >= dto.StartTime && snapshot.CreationTime <= dto.EndTime)
  333. .WhereIF(dto.IndustryId.NotNullOrEmpty(), snapshot => snapshot.IndustryId == dto.IndustryId)
  334. .GroupBy((snapshot, order) => new
  335. {
  336. OrgCode = order.ActualHandleOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6"))
  337. })
  338. .Select((snapshot, order, back, visit, second) => new SnapshotProcessingStatisticsOutDto()
  339. {
  340. OrgCode = order.ActualHandleOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6")),
  341. YbOrderCountNum = SqlFunc.AggregateCount(SqlFunc.IIF(order.Status >= EOrderStatus.Filed, 1, 0)),
  342. ZbOrderCountNum = SqlFunc.AggregateCount(SqlFunc.IIF(order.Status < EOrderStatus.Filed, 1, 0)),
  343. ReceiveIn20Minutes = SqlFunc.AggregateCount(SqlFunc.IIF(order.ActualHandleStepCreateTime != null && order.ActualHandleStepCreateTime.Value.AddMinutes(-20) <= order.CreationTime, 1, 0)),
  344. ReceiveOut20Minutes = SqlFunc.AggregateCount(SqlFunc.IIF(order.ActualHandleStepCreateTime == null || order.ActualHandleStepCreateTime.Value.AddMinutes(-20) > order.CreationTime, 1, 0)),
  345. BackNum = SqlFunc.AggregateCount(SqlFunc.IIF(back.OrderId != null && back.OrderId != "", 1, 0)),
  346. TotalHandleDuration = SqlFunc.AggregateSum(order.HandleDuration),
  347. End3Day = SqlFunc.AggregateSum(SqlFunc.IIF(order.FiledTime != null && order.FiledTime.Value.AddDays(-3) < order.CreationTime, 1, 0)),
  348. End3To5Day = SqlFunc.AggregateSum(SqlFunc.IIF(order.FiledTime != null && order.FiledTime.Value.AddDays(-3) > order.CreationTime && order.FiledTime.Value.AddDays(-5) < order.CreationTime, 1, 0)),
  349. End5To7Day = SqlFunc.AggregateSum(SqlFunc.IIF(order.FiledTime != null && order.FiledTime.Value.AddDays(-5) > order.CreationTime && order.FiledTime.Value.AddDays(-7) < order.CreationTime, 1, 0)),
  350. End7Day = SqlFunc.AggregateSum(SqlFunc.IIF(order.FiledTime != null && order.FiledTime.Value.AddDays(-7) < order.CreationTime, 1, 0)),
  351. OnTimeCount = SqlFunc.AggregateSum(SqlFunc.IIF(order.FiledTime <= order.ExpiredTime, 1, 0)),
  352. SatisfiedCount = SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonListObjectAny(visit.NowEvaluate, "key", "1") || SqlFunc.JsonListObjectAny(visit.NowEvaluate, "key", "2"), 1, 0)),
  353. NoSatisfiedCount = SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonListObjectAny(visit.NowEvaluate, "key", "1") || SqlFunc.JsonListObjectAny(visit.NowEvaluate, "key", "2"), 0, 1)),
  354. SecondNum = SqlFunc.AggregateCount(second.Id)
  355. })
  356. .MergeTable()
  357. .LeftJoin<SystemOrganize>((it, o) => it.OrgCode == o.Id)
  358. .Select((it, o) => new SnapshotProcessingStatisticsOutDto()
  359. {
  360. OrgName = o.Name,
  361. OrgCode = it.OrgCode,
  362. YbOrderCountNum = it.YbOrderCountNum,
  363. ZbOrderCountNum = it.ZbOrderCountNum,
  364. ReceiveIn20Minutes = it.ReceiveIn20Minutes,
  365. ReceiveOut20Minutes = it.ReceiveOut20Minutes,
  366. BackNum = it.BackNum,
  367. TotalHandleDuration = it.TotalHandleDuration,
  368. End3Day = it.End3Day,
  369. End3To5Day = it.End3To5Day,
  370. End5To7Day = it.End5To7Day,
  371. End7Day = it.End7Day,
  372. OnTimeCount = it.OnTimeCount,
  373. SatisfiedCount = it.SatisfiedCount,
  374. NoSatisfiedCount = it.NoSatisfiedCount,
  375. SecondNum = it.SecondNum
  376. });
  377. return query;
  378. }
  379. public ISugarQueryable<SnapshotProcessingStatisticsDetailsOutDto> GetSnapshotProcessingStatisticsDetails(SnapshotProcessingStatisticsDetailsInDto dto)
  380. {
  381. dto.FieldName = dto.FieldName.ToLower();
  382. var IsCenter = _sessionContext.OrgIsCenter;
  383. IsCenter = true;
  384. var query = _orderSnapshotRepository.Queryable(includeDeleted: true)
  385. .LeftJoin<Order>((snapshot, order) => snapshot.Id == order.Id)
  386. .LeftJoin<OrderSendBackAudit>((snapshot, order, back) => snapshot.Id == back.OrderId && back.State == ESendBackAuditState.End)
  387. .LeftJoin<OrderVisit>((snapshot, order, back, visit) => snapshot.Id == visit.OrderId && visit.VisitState == EVisitState.Visited)
  388. .LeftJoin<OrderSecondaryHandling>((snapshot, order, back, visit, second) => snapshot.Id == second.OrderId && second.State == ESecondaryHandlingState.End)
  389. .Where((snapshot, order, back) => order.CreationTime >= dto.StartTime && order.CreationTime <= dto.EndTime && order.ActualHandleOrgCode.StartsWith(dto.OrgId))
  390. .WhereIF(IsCenter == false, (snapshot, order, back) => order.ActualHandleOrgCode.StartsWith(_sessionContext.RequiredOrgId))
  391. .WhereIF(dto.IndustryId.NotNullOrEmpty(), (snapshot, order, back) => snapshot.IndustryId == dto.IndustryId);
  392. query = dto.FieldName switch
  393. {
  394. "ybordercountnum" => query.Where((snapshot, order, back) => order.Status >= EOrderStatus.Filed),
  395. "zbordercountnum" => query.Where((snapshot, order, back) => order.Status < EOrderStatus.Filed),
  396. "receivein20minutes" => query.Where((snapshot, order, back) => order.ActualHandleStepCreateTime != null && order.ActualHandleStepCreateTime.Value.AddMinutes(-20) <= order.CreationTime),
  397. "receiveout20minutes" => query.Where((snapshot, order, back) => order.ActualHandleStepCreateTime == null || order.ActualHandleStepCreateTime.Value.AddMinutes(-20) > order.CreationTime),
  398. "backnum" => query.Where((snapshot, order, back) => back.OrderId != null && back.OrderId != ""),
  399. "end3day" => query.Where((snapshot, order, back) => order.FiledTime != null && order.FiledTime.Value.AddDays(-3) < order.CreationTime),
  400. "end3to5day" => query.Where((snapshot, order, back) => order.FiledTime != null && order.FiledTime.Value.AddDays(-3) > order.CreationTime && order.FiledTime.Value.AddDays(-5) < order.CreationTime),
  401. "end5to7day" => query.Where((snapshot, order, back) => order.FiledTime != null && order.FiledTime.Value.AddDays(-5) > order.CreationTime && order.FiledTime.Value.AddDays(-7) < order.CreationTime),
  402. "end7day" => query.Where((snapshot, order, back) => order.FiledTime != null && order.FiledTime.Value.AddDays(-7) < order.CreationTime),
  403. "satisfiedcount" => query.Where((snapshot, order, back, visit) => SqlFunc.JsonListObjectAny(visit.NowEvaluate, "key", "1") || SqlFunc.JsonListObjectAny(visit.NowEvaluate, "key", "2")),
  404. "nosatisfiedcount" => query.Where((snapshot, order, back, visit) => SqlFunc.JsonListObjectAny(visit.NowEvaluate, "key", "1") || SqlFunc.JsonListObjectAny(visit.NowEvaluate, "key", "2")),
  405. "secondnum" => query.Where((snapshot, order, back, visit, second) => second.Id != null || second.Id != ""),
  406. _ => throw new UserFriendlyException($"入参: {dto.FieldName} 异常")
  407. };
  408. return query.Select(d => new SnapshotProcessingStatisticsDetailsOutDto
  409. {
  410. OrderScreenStatus = SqlFunc.Subqueryable<OrderScreen>().Where(q => q.OrderId == d.Id).OrderByDesc(q => q.CreationTime).Select(q => q.Status),
  411. }, true);
  412. }
  413. public ISugarQueryable<GuiderWorkStatisticsOutDto> GetGuiderWorkStatisticsAsync(GuiderWorkStatisticsInDto dto)
  414. {
  415. var query = _orderSnapshotRepository.Queryable(includeDeleted: true)
  416. .Where(snapshot => snapshot.CreationTime >= dto.StartTime && snapshot.CreationTime <= dto.EndTime && snapshot.MemberName != null )
  417. .GroupBy(snapshot => new { snapshot.MemberName, snapshot.MemberMobile })
  418. .Select(snapshot => new GuiderWorkStatisticsOutDto
  419. {
  420. MemberMobile = snapshot.MemberMobile,
  421. MemberName = snapshot.MemberName,
  422. ReplyIn4HourCount = SqlFunc.AggregateSum(SqlFunc.IIF(snapshot.ReplyResultType == EGuiderSystemReplyType.Field && snapshot.GuidSystemCallBackTime.Value.AddHours(-4) <= snapshot.SendGuidSystemTime, 1, 0)),
  423. ReplyOut4HourCount = SqlFunc.AggregateSum(SqlFunc.IIF(snapshot.ReplyResultType == EGuiderSystemReplyType.Field && snapshot.GuidSystemCallBackTime.Value.AddHours(-4) > snapshot.SendGuidSystemTime, 1, 0)),
  424. UnReplyCount = SqlFunc.AggregateSum(SqlFunc.IIF(snapshot.ReplyResultType != EGuiderSystemReplyType.Field, 1, 0)),
  425. });
  426. return query;
  427. }
  428. public ISugarQueryable<GuiderWorkStatisticsDetailsOutDto> GetGuiderWorkStatisticsDetails(GuiderWorkStatisticsDetailsInDto dto)
  429. {
  430. dto.FieldName = dto.FieldName.ToLower();
  431. var query = _orderSnapshotRepository.Queryable(includeDeleted: true)
  432. .LeftJoin<Order>((snapshot, order) => order.Id == snapshot.Id)
  433. .Where(snapshot => snapshot.CreationTime >= dto.StartTime && snapshot.CreationTime <= dto.EndTime && snapshot.MemberMobile == dto.MemberMobile);
  434. query = dto.FieldName switch
  435. {
  436. "replyin4hourcount" => query.Where(snapshot => snapshot.ReplyResultType == EGuiderSystemReplyType.Field && snapshot.GuidSystemCallBackTime.Value.AddHours(-4) <= snapshot.SendGuidSystemTime),
  437. "replyout4hourcount" => query.Where(snapshot => snapshot.ReplyResultType == EGuiderSystemReplyType.Field && snapshot.GuidSystemCallBackTime.Value.AddHours(-4) > snapshot.SendGuidSystemTime),
  438. "unreplycount" => query.Where(snapshot => snapshot.ReplyResultType != EGuiderSystemReplyType.Field),
  439. _ => throw new UserFriendlyException($"入参: {dto.FieldName} 异常")
  440. };
  441. return query.Select((snapshot, order) => new GuiderWorkStatisticsDetailsOutDto
  442. {
  443. }, true);
  444. }
  445. public ISugarQueryable<HotspotDataStatisticsOutDto> GetHotspotDataStatisticsAsync(HotspotDataStatisticsInDto dto)
  446. {
  447. var isCenter = _sessionContext.OrgIsCenter;
  448. var query = _hotspotTypeRepository.Queryable(includeDeleted: true)
  449. .LeftJoin<Order>((hotspot, order) => order.HotspotSpliceName != null && (hotspot.HotSpotName == order.HotspotSpliceName || order.HotspotSpliceName.Contains(hotspot.HotSpotName)) && order.IsDeleted == false && order.CreationTime >= dto.StartTime && order.CreationTime <= dto.EndTime)
  450. .WhereIF(isCenter == false, (hotspot, order) => order.ActualHandleOrgCode == _sessionContext.RequiredOrgId)
  451. .Where(hotspot => hotspot.ParentId == null)
  452. .GroupBy((hotspot, order) => new { hotspot.Id, hotspot.HotSpotName })
  453. .Select((hotspot, order) => new HotspotDataStatisticsOutDto
  454. {
  455. Name = hotspot.HotSpotName,
  456. OrderCount = SqlFunc.AggregateSum(SqlFunc.IIF(order.Id != null, 1, 0)),
  457. });
  458. return query;
  459. }
  460. public ISugarQueryable<GuiderWorkLogsOutDto> GetGuiderWorkLogs(GuiderWorkLogsInDto dto)
  461. {
  462. var query = _orderSnapshotRepository.Queryable()
  463. .LeftJoin<Order>((snapshot, order) => order.Id == snapshot.Id)
  464. .Where((snapshot, order) => snapshot.IsGuidSystemCallBack == true)
  465. .WhereIF(dto.MemberMobile.NotNullOrEmpty(), snapshot => snapshot.MemberMobile.Contains(dto.MemberMobile))
  466. .WhereIF(dto.BeginCreationTime != null && dto.EndCreationTime != null, snapshot => snapshot.CreationTime >= dto.BeginCreationTime && snapshot.CreationTime <= dto.EndCreationTime)
  467. .WhereIF(dto.MemberName.NotNullOrEmpty(), snapshot => snapshot.MemberName.Contains( dto.MemberName))
  468. .WhereIF(dto.No.NotNullOrEmpty(), (snapshot, order) => order.No.Contains(dto.No))
  469. .WhereIF(dto.Title.NotNullOrEmpty(), (snapshot, order) => order.Title.Contains(dto.Title))
  470. .WhereIF(dto.NetworkENumber.NotNullOrEmpty(), (snapshot, order) => snapshot.NetworkENumber.Contains(dto.NetworkENumber))
  471. .WhereIF(dto.Status != null, (snapshot, order) => order.Status == dto.Status)
  472. .OrderByDescending(snapshot => snapshot.CreationTime)
  473. .Select(snapshot => new GuiderWorkLogsOutDto(), true);
  474. return query;
  475. }
  476. public ISugarQueryable<DuplicateItemsOutDto> GetDuplicateItems(DuplicateItemsInDto dto)
  477. {
  478. var query = _orderSnapshotRepository.Queryable(includeDeleted: true)
  479. .LeftJoin<Order>((snapshot, order) => order.Id == snapshot.Id)
  480. .WhereIF(dto.No.NotNullOrEmpty(), (snapshot, order) => order.No.Contains(dto.No))
  481. .WhereIF(dto.Title.NotNullOrEmpty(), (snapshot, order) => order.Title.Contains(dto.Title))
  482. .WhereIF(dto.FromName.NotNullOrEmpty(), (snapshot, order) => order.FromName.Contains(dto.FromName))
  483. .WhereIF(dto.FromPhone.NotNullOrEmpty(), (snapshot, order) => order.FromPhone.Contains(dto.FromPhone))
  484. .WhereIF(dto.BeginCreationTime != null && dto.EndCreationTime != null, (snapshot, order) => order.CreationTime >= dto.BeginCreationTime && order.CreationTime <= dto.EndCreationTime)
  485. .WhereIF(dto.BeginExpiredTime != null && dto.EndExpiredTime != null, (snapshot, order) => order.ExpiredTime >= dto.BeginExpiredTime && order.ExpiredTime <= dto.EndExpiredTime)
  486. .WhereIF(dto.ActualHandleOrgName.NotNullOrEmpty(), (snapshot, order) => order.ActualHandleOrgName == dto.ActualHandleOrgName)
  487. .WhereIF(dto.AcceptType.NotNullOrEmpty(), (snapshot, order) => order.AcceptType == dto.AcceptType)
  488. .WhereIF(dto.HotspotName.NotNullOrEmpty(), (snapshot, order) => order.HotspotName == dto.HotspotName)
  489. .WhereIF(dto.AcceptorName.NotNullOrEmpty(), (snapshot, order) => order.AcceptorName == dto.AcceptorName)
  490. .WhereIF(dto.IndustryId.NotNullOrEmpty(), (snapshot, order) => snapshot.IndustryId == dto.IndustryId)
  491. .Select((snapshot, order) => new DuplicateItemsOutDto(), true);
  492. return query;
  493. }
  494. }