BiSnapshotController.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  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. if (items.Count != 0)
  100. {
  101. items.Add(new HotspotDataStatisticsOutDto
  102. {
  103. Name = "合计",
  104. OrderCount = items.Sum(x => x.OrderCount),
  105. });
  106. }
  107. return items;
  108. }
  109. /// <summary>
  110. /// 办件统计-随手拍
  111. /// </summary>
  112. /// <param name="dto"></param>
  113. /// <returns></returns>
  114. [HttpGet("processing-statistics")]
  115. public async Task<IList<SnapshotProcessingStatisticsOutDto>> GetSnapshotProcessingStatistics([FromQuery] SnapshotProcessingStatisticsInDto dto)
  116. => await _biSnapshotApplication.GetSnapshotProcessingStatistics(dto).ToListAsync();
  117. /// <summary>
  118. /// 办件统计明细-随手拍
  119. /// </summary>
  120. /// <param name="dto"></param>
  121. /// <returns></returns>
  122. [HttpGet("processing-statistics-detail")]
  123. public async Task<PagedDto<SnapshotProcessingStatisticsDetailsOutDto>> GetSnapshotProcessingStatisticsDetails([FromQuery]SnapshotProcessingStatisticsDetailsInDto dto)
  124. => (await _biSnapshotApplication.GetSnapshotProcessingStatisticsDetails(dto).ToPagedListAsync(dto)).ToPaged();
  125. /// <summary>
  126. /// 网格员办理情况统计
  127. /// </summary>
  128. /// <param name="dto"></param>
  129. /// <returns></returns>
  130. [HttpGet("guider-work-statistics")]
  131. public async Task<IList<GuiderWorkStatisticsOutDto>> GetGuiderWorkStatisticsAsync([FromQuery] GuiderWorkStatisticsInDto dto)
  132. => await _biSnapshotApplication.GetGuiderWorkStatisticsAsync(dto).ToListAsync();
  133. /// <summary>
  134. /// 网格员办理情况统计详情
  135. /// </summary>
  136. /// <param name="dto"></param>
  137. /// <returns></returns>
  138. [HttpGet("guider-work-statistics-detail")]
  139. public async Task<PagedDto<GuiderWorkStatisticsDetailsOutDto>> GetGuiderWorkStatisticsDetailsAsync([FromQuery] GuiderWorkStatisticsDetailsInDto dto)
  140. => (await _biSnapshotApplication.GetGuiderWorkStatisticsDetails(dto).ToPagedListAsync(dto)).ToPaged();
  141. /// <summary>
  142. /// 网格员系统工单状态日志基础数据
  143. /// </summary>
  144. /// <returns></returns>
  145. [HttpGet("guider-work-log/basedata")]
  146. public async Task<Dictionary<string, object>> GetGuiderWorkLogsAsyncBasedataAsync()
  147. {
  148. return new Dictionary<string, object>
  149. {
  150. { "orderStatus", EnumExts.GetDescriptions<EGuiderSystemReplyType>()},
  151. };
  152. }
  153. /// <summary>
  154. /// 网格员系统工单状态日志
  155. /// </summary>
  156. /// <param name="dto"></param>
  157. /// <returns></returns>
  158. [HttpGet("guider-work-log")]
  159. public async Task<PagedDto<GuiderWorkLogsOutDto>> GetGuiderWorkLogsAsync([FromQuery] GuiderWorkLogsInDto dto)
  160. => (await _biSnapshotApplication.GetGuiderWorkLogs(dto).ToPagedListAsync(dto)).ToPaged();
  161. /// <summary>
  162. /// 重复件-随手拍
  163. /// </summary>
  164. /// <param name="dto"></param>
  165. /// <returns></returns>
  166. [HttpGet("duplicate")]
  167. public async Task<PagedDto<DuplicateItemsOutDto>> GetDuplicateItemsAsync([FromQuery] DuplicateItemsInDto dto)
  168. => (await _biSnapshotApplication.GetDuplicateItems(dto).ToPagedListAsync(dto)).ToPaged();
  169. /// <summary>
  170. /// 社区统计
  171. /// </summary>
  172. /// <param name="dto"></param>
  173. /// <returns></returns>
  174. [HttpGet("community-statistics")]
  175. public async Task<IList<CommunityStatisticsOutDto>> GetCommunityStatisticsAsync([FromQuery] CommunityStatisticsInDto dto)
  176. => await _biSnapshotApplication.GetCommunityStatistics(dto).ToListAsync();
  177. /// <summary>
  178. /// 社区统计-详情
  179. /// </summary>
  180. /// <param name="dto"></param>
  181. /// <returns></returns>
  182. [HttpGet("community-statistics-detail")]
  183. public async Task<PagedDto<CommunityStatisticsDetailsOutDto>> GetCommunityStatisticsDetailsAsync([FromQuery] CommunityStatisticsDetailsInDto dto)
  184. => (await _biSnapshotApplication.GetCommunityStatisticsDetails(dto).ToPagedListAsync(dto)).ToPaged();
  185. /// <summary>
  186. /// 随手拍区域统计
  187. /// </summary>
  188. /// <param name="dto"></param>
  189. /// <returns></returns>
  190. [HttpGet("county-redpack-statistics")]
  191. public async Task<IList<CountyRedPackStatisticsOutDto>> GetCountyRedPackStatisticsAsync([FromQuery] CountyRedPackStatisticsInDto dto)
  192. => await _biSnapshotApplication.GetCountyRedPackStatistics(dto).ToListAsync();
  193. /// <summary>
  194. /// 部门考核统计-随手拍
  195. /// </summary>
  196. /// <param name="dto"></param>
  197. /// <returns></returns>
  198. [HttpGet("department-statistics")]
  199. public async Task<IList<SnapshotDepartmentStatisticsOutDto>> GetSnapshotDepartmentStatisticsAsync([FromQuery]SnapshotDepartmentStatisticsInDto dto)
  200. => await _biSnapshotApplication.GetSnapshotDepartmentStatistics(dto).ToListAsync();
  201. /// <summary>
  202. /// 部门平均办理时间-随手拍
  203. /// </summary>
  204. /// <param name="dto"></param>
  205. /// <returns></returns>
  206. [HttpGet("department-avetime-statistics")]
  207. public async Task<IList<SnapshotDepartmentAveTimeStatisticsOutDto>> GetSnapshotDepartmentAveTimeStatisticsAsync([FromQuery] SnapshotDepartmentAveTimeStatisticsInDto dto)
  208. => await _biSnapshotApplication.GetSnapshotDepartmentAveTimeStatistics(dto).ToListAsync();
  209. /// <summary>
  210. /// 部门平均办理时间-随手拍-详情
  211. /// </summary>
  212. /// <param name="dto"></param>
  213. /// <returns></returns>
  214. [HttpGet("department-avetime-statistics-detail")]
  215. public async Task<PagedDto<SnapshotDepartmentAveTimeStatisticsDetailsOutDto>> GetSnapshotDepartmentAveTimeStatisticsDtailsAsync([FromQuery]SnapshotDepartmentAveTimeStatisticsDetailsInDto dto)
  216. => (await _biSnapshotApplication.GetSnapshotDepartmentAveTimeStatisticsDtails(dto).ToPagedListAsync(dto)).ToPaged();
  217. /// <summary>
  218. /// 检查合规统计
  219. /// </summary>
  220. /// <param name="dto"></param>
  221. /// <returns></returns>
  222. [HttpGet("compliant-statistics")]
  223. public async Task<IList<CompliantStatisticsOutDto>> CompliantStatisticsAsync([FromQuery] CompliantStatisticsInDto dto)
  224. {
  225. var items = await _biSnapshotApplication.GetCompliantStatistics(dto).ToListAsync();
  226. items.AddSumLine("OrgName");
  227. return items;
  228. }
  229. /// <summary>
  230. /// 检查合规统计-详情
  231. /// </summary>
  232. /// <param name="dto"></param>
  233. /// <returns></returns>
  234. [HttpGet("compliant-statistics-detail")]
  235. public async Task<PagedDto<CompliantStatisticsDetailsOutDto>> CompliantStatisticsDetailsAsync([FromQuery] CompliantStatisticsDetailsInDto dto)
  236. => (await _biSnapshotApplication.GetCompliantStatisticsDetails(dto).ToPagedListAsync(dto)).ToPaged();
  237. }