BiSnapshotController.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. using Hotline.Application.Snapshot;
  2. using Hotline.Share.Dtos;
  3. using Hotline.Share.Dtos.Snapshot;
  4. using Microsoft.AspNetCore.Mvc;
  5. using Hotline.Repository.SqlSugar.Extensions;
  6. using Hotline.Share.Tools;
  7. using Hotline.Snapshot.Interfaces;
  8. using Hotline.Settings.Hotspots;
  9. using Hotline.Share.Requests;
  10. using SqlSugar;
  11. using XF.Domain.Authentications;
  12. using Hotline.Settings;
  13. using Hotline.Caching.Interfaces;
  14. using Hotline.Share.Enums.Order;
  15. using Hotline.Share.Enums.Snapshot;
  16. using XF.Utility.EnumExtensions;
  17. using Amazon.Runtime.Internal.Util;
  18. namespace Hotline.Api.Controllers.Snapshot;
  19. /// <summary>
  20. /// 随手拍统计
  21. /// </summary>
  22. public class BiSnapshotController : BaseController
  23. {
  24. private readonly IBiSnapshotApplication _biSnapshotApplication;
  25. private readonly IIndustryRepository _industryRepository;
  26. public BiSnapshotController(IBiSnapshotApplication biSnapshotApplication, IIndustryRepository industryRepository)
  27. {
  28. _biSnapshotApplication = biSnapshotApplication;
  29. _industryRepository = industryRepository;
  30. }
  31. /// <summary>
  32. /// 随手拍统计基础数据
  33. /// </summary>
  34. /// <returns></returns>
  35. [HttpGet("statistics/basedata")]
  36. public async Task<Dictionary<string, object>> GetSnapshotStatisticsBaseDataAsync()
  37. {
  38. return new Dictionary<string, object>()
  39. {
  40. { "industry", await _industryRepository.GetDataBaseAsync() }
  41. };
  42. }
  43. /// <summary>
  44. /// 随手拍统计
  45. /// </summary>
  46. /// <returns></returns>
  47. [HttpGet("statistics")]
  48. public async Task<SnapshotStatisticsOutDto> GetSnapshotStatisticsAsync([FromQuery] SnapshotStatisticsInDto dto)
  49. => await _biSnapshotApplication.GetSnapshotStatisticsAsync(dto, HttpContext.RequestAborted);
  50. /// <summary>
  51. /// 随手拍统计详情集合
  52. /// </summary>
  53. /// <param name="dto"></param>
  54. /// <returns></returns>
  55. [HttpGet("statistics/details")]
  56. public async Task<PagedDto<SnapshotStatisticsDetailOutDto>> GetSnapshotStatisticsDetailAsync([FromQuery] SnapshotStatisticsDetailInDto dto)
  57. => (await _biSnapshotApplication.GetSnapshotStatisticsDetail(dto).ToPagedListAsync(dto)).ToPaged();
  58. /// <summary>
  59. /// 市民红包审核统计
  60. /// </summary>
  61. /// <param name="dto"></param>
  62. /// <returns></returns>
  63. [HttpGet("redpack/audit")]
  64. public IList<RedPackStatisticsOutDto> GetRedPackAuditStatisticsAsync([FromQuery] RedPackStatisticsInDto dto)
  65. => _biSnapshotApplication.GetRedPackAuditStatistics(dto);
  66. /// <summary>
  67. /// 市民红包审核统计详情
  68. /// </summary>
  69. /// <param name="dto"></param>
  70. /// <returns></returns>
  71. [HttpGet("redpack/audit/details")]
  72. public async Task<PagedDto<RedPackStatisticsDetailsOutDto>> GetRedPackAuditStatisticsDetailsAsync([FromQuery] RedPackStatisticsDetailsInDto dto)
  73. => (await _biSnapshotApplication.GetRedPackAuditStatisticsDetails(dto).ToPagedListAsync(dto)).ToPaged();
  74. /// <summary>
  75. /// 热点类型小类统计
  76. /// </summary>
  77. /// <param name="dto"></param>
  78. /// <returns></returns>
  79. [HttpGet("hotspot-statistics")]
  80. public async Task<IList<HotspotStatisticsOutDto>> GetHotspotStatisticsAsync([FromQuery] HotspotStatisticsInDto dto)
  81. => await _biSnapshotApplication.GetHotspotStatistics(dto).ToListAsync();
  82. /// <summary>
  83. /// 热点类型小类统计明细
  84. /// </summary>
  85. /// <param name="dto"></param>
  86. /// <returns></returns>
  87. [HttpGet("hotspot-statistics-detail")]
  88. public async Task<PagedDto<HotspotStatisticsDetailsOutDto>> GetHotspotStatisticsDetailAsync([FromQuery] HotspotStatisticsDetailsInDto dto)
  89. => (await _biSnapshotApplication.HotspotStatisticsDetail(dto).ToPagedListAsync(dto)).ToPaged();
  90. /// <summary>
  91. /// 热点类型-随手拍
  92. /// </summary>
  93. /// <param name="dto"></param>
  94. /// <returns></returns>
  95. [HttpGet("hotspot-data-statistics")]
  96. public async Task<IList<HotspotDataStatisticsOutDto>> GetHotspotDataStatisticsAsync([FromQuery] HotspotDataStatisticsInDto dto)
  97. {
  98. var items = await _biSnapshotApplication.GetHotspotDataStatisticsAsync(dto).ToListAsync();
  99. items.Add(new HotspotDataStatisticsOutDto
  100. {
  101. Name = "合计",
  102. OrderCount = items.Sum(x => x.OrderCount),
  103. });
  104. return items;
  105. }
  106. /// <summary>
  107. /// 办件统计-随手拍
  108. /// </summary>
  109. /// <param name="dto"></param>
  110. /// <returns></returns>
  111. [HttpGet("processing-statistics")]
  112. public async Task<IList<SnapshotProcessingStatisticsOutDto>> GetSnapshotProcessingStatistics([FromQuery] SnapshotProcessingStatisticsInDto dto)
  113. => await _biSnapshotApplication.GetSnapshotProcessingStatistics(dto).ToListAsync();
  114. /// <summary>
  115. /// 办件统计明细-随手拍
  116. /// </summary>
  117. /// <param name="dto"></param>
  118. /// <returns></returns>
  119. [HttpGet("processing-statistics-detail")]
  120. public async Task<PagedDto<SnapshotProcessingStatisticsDetailsOutDto>> GetSnapshotProcessingStatisticsDetails([FromQuery]SnapshotProcessingStatisticsDetailsInDto dto)
  121. => (await _biSnapshotApplication.GetSnapshotProcessingStatisticsDetails(dto).ToPagedListAsync(dto)).ToPaged();
  122. /// <summary>
  123. /// 网格员办理情况统计
  124. /// </summary>
  125. /// <param name="dto"></param>
  126. /// <returns></returns>
  127. [HttpGet("guider-work-statistics")]
  128. public async Task<IList<GuiderWorkStatisticsOutDto>> GetGuiderWorkStatisticsAsync([FromQuery] GuiderWorkStatisticsInDto dto)
  129. => await _biSnapshotApplication.GetGuiderWorkStatisticsAsync(dto).ToListAsync();
  130. /// <summary>
  131. /// 网格员办理情况统计详情
  132. /// </summary>
  133. /// <param name="dto"></param>
  134. /// <returns></returns>
  135. [HttpGet("guider-work-statistics-detail")]
  136. public async Task<PagedDto<GuiderWorkStatisticsDetailsOutDto>> GetGuiderWorkStatisticsDetailsAsync([FromQuery] GuiderWorkStatisticsDetailsInDto dto)
  137. => (await _biSnapshotApplication.GetGuiderWorkStatisticsDetails(dto).ToPagedListAsync(dto)).ToPaged();
  138. /// <summary>
  139. /// 网格员系统工单状态日志基础数据
  140. /// </summary>
  141. /// <returns></returns>
  142. [HttpGet("guider-work-log/basedata")]
  143. public async Task<Dictionary<string, object>> GetGuiderWorkLogsAsyncBasedataAsync()
  144. {
  145. return new Dictionary<string, object>
  146. {
  147. { "orderStatus", EnumExts.GetDescriptions<EGuiderSystemReplyType>()},
  148. };
  149. }
  150. /// <summary>
  151. /// 网格员系统工单状态日志
  152. /// </summary>
  153. /// <param name="dto"></param>
  154. /// <returns></returns>
  155. [HttpGet("guider-work-log")]
  156. public async Task<PagedDto<GuiderWorkLogsOutDto>> GetGuiderWorkLogsAsync([FromQuery] GuiderWorkLogsInDto dto)
  157. => (await _biSnapshotApplication.GetGuiderWorkLogs(dto).ToPagedListAsync(dto)).ToPaged();
  158. /// <summary>
  159. /// 重复件-随手拍
  160. /// </summary>
  161. /// <param name="dto"></param>
  162. /// <returns></returns>
  163. [HttpGet("duplicate")]
  164. public async Task<PagedDto<DuplicateItemsOutDto>> GetDuplicateItemsAsync([FromQuery] DuplicateItemsInDto dto)
  165. => (await _biSnapshotApplication.GetDuplicateItems(dto).ToPagedListAsync(dto)).ToPaged();
  166. /// <summary>
  167. /// 社区统计
  168. /// </summary>
  169. /// <param name="dto"></param>
  170. /// <returns></returns>
  171. [HttpGet("community-statistics")]
  172. public async Task<IList<CommunityStatisticsOutDto>> GetCommunityStatisticsAsync([FromQuery] CommunityStatisticsInDto dto)
  173. => await _biSnapshotApplication.GetCommunityStatistics(dto).ToListAsync();
  174. /// <summary>
  175. /// 社区统计-详情
  176. /// </summary>
  177. /// <param name="dto"></param>
  178. /// <returns></returns>
  179. [HttpGet("community-statistics-detail")]
  180. public async Task<PagedDto<CommunityStatisticsDetailsOutDto>> GetCommunityStatisticsDetailsAsync([FromQuery] CommunityStatisticsDetailsInDto dto)
  181. => (await _biSnapshotApplication.GetCommunityStatisticsDetails(dto).ToPagedListAsync(dto)).ToPaged();
  182. /// <summary>
  183. /// 随手拍区域统计
  184. /// </summary>
  185. /// <param name="dto"></param>
  186. /// <returns></returns>
  187. [HttpGet("county-redpack-statistics")]
  188. public async Task<IList<CountyRedPackStatisticsOutDto>> GetCountyRedPackStatisticsAsync([FromQuery] CountyRedPackStatisticsInDto dto)
  189. => await _biSnapshotApplication.GetCountyRedPackStatistics(dto).ToListAsync();
  190. /// <summary>
  191. /// 部门考核统计-随手拍
  192. /// </summary>
  193. /// <param name="dto"></param>
  194. /// <returns></returns>
  195. [HttpGet("department-statistics")]
  196. public async Task<IList<SnapshotDepartmentStatisticsOutDto>> GetSnapshotDepartmentStatisticsAsync([FromQuery]SnapshotDepartmentStatisticsInDto dto)
  197. => await _biSnapshotApplication.GetSnapshotDepartmentStatistics(dto).ToListAsync();
  198. /// <summary>
  199. /// 部门平均办理时间-随手拍
  200. /// </summary>
  201. /// <param name="dto"></param>
  202. /// <returns></returns>
  203. [HttpGet("department-avetime-statistics")]
  204. public async Task<IList<SnapshotDepartmentAveTimeStatisticsOutDto>> GetSnapshotDepartmentAveTimeStatisticsAsync([FromQuery] SnapshotDepartmentAveTimeStatisticsInDto dto)
  205. => await _biSnapshotApplication.GetSnapshotDepartmentAveTimeStatistics(dto).ToListAsync();
  206. /// <summary>
  207. /// 部门平均办理时间-随手拍-详情
  208. /// </summary>
  209. /// <param name="dto"></param>
  210. /// <returns></returns>
  211. public async Task<PagedDto<SnapshotDepartmentAveTimeStatisticsDetailsOutDto>> GetSnapshotDepartmentAveTimeStatisticsDtailsAsync([FromQuery]SnapshotDepartmentAveTimeStatisticsDetailsInDto dto)
  212. => (await _biSnapshotApplication.GetSnapshotDepartmentAveTimeStatisticsDtails(dto).ToPagedListAsync(dto)).ToPaged();
  213. }