StatisticsService.swift 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // StatisticsService.swift
  3. // JiaPeiManage
  4. //
  5. // Created by Ning.ge on 2023/6/26.
  6. //
  7. import RxSwift
  8. import RxCocoa
  9. import SwiftyJSON
  10. protocol StatisticsServiceType {
  11. //查询每日报名数
  12. func everyDayStuCountRequest(city: String, schoolId: Int, startDate: String, endDate: String,fieldType:Int,sortType:Int) -> Single<StuCountDataModel>
  13. //查询每月报名数
  14. func everyMonthStuCount(city: String, schoolId: Int, startMonth: String, endMonth: String,fieldType:Int,sortType:Int) -> Single<StuCountDataModel>
  15. //查询每年报名数
  16. func everyYearStuCount(city: String, schoolId: Int, startYear: String, endYear: String,fieldType:Int,sortType:Int) -> Single<StuCountDataModel>
  17. //查询驾校ID 报名数
  18. func statisticsStuCount(city: String, schoolId: Int) -> Single<StuTotalCountDataModel>
  19. }
  20. final class StatisticsService: StatisticsServiceType {
  21. private let networking : StatisticsNetworking
  22. init(networking: StatisticsNetworking) {
  23. self.networking = networking
  24. }
  25. //查询每日报名数
  26. func everyDayStuCountRequest(city: String, schoolId: Int, startDate: String, endDate: String,fieldType:Int,sortType:Int) -> RxSwift.Single<StuCountDataModel> {
  27. let api = StatisticsAPI.everyDayStuCount(city: city, schoolId: schoolId, startDate: startDate, endDate: endDate , fieldType: fieldType, sortType: sortType)
  28. return networking.request(api).map(StuCountDataModel.self, isModel: true)
  29. }
  30. //查询每月报名数
  31. func everyMonthStuCount(city: String, schoolId: Int, startMonth: String, endMonth: String,fieldType:Int,sortType:Int) -> RxSwift.Single<StuCountDataModel> {
  32. let api = StatisticsAPI.everyMonthStuCount(city: city, schoolId: schoolId, startMonth: startMonth, endMonth: endMonth, fieldType: fieldType, sortType: sortType)
  33. return networking.request(api).map(StuCountDataModel.self, isModel: true)
  34. }
  35. //查询每年报名数
  36. func everyYearStuCount(city: String, schoolId: Int, startYear: String, endYear: String,fieldType:Int,sortType:Int) -> RxSwift.Single<StuCountDataModel> {
  37. let api = StatisticsAPI.everyYearStuCount(city: city, schoolId: schoolId, startYear: startYear, endYear: endYear, fieldType: fieldType, sortType: sortType)
  38. return networking.request(api).map(StuCountDataModel.self, isModel: true)
  39. }
  40. //查询驾校ID 报名数
  41. func statisticsStuCount(city: String, schoolId: Int) -> RxSwift.Single<StuTotalCountDataModel> {
  42. let api = StatisticsAPI.statisticsStuCount(city: city, schoolId: schoolId)
  43. return networking.request(api).map(StuTotalCountDataModel.self)
  44. }
  45. }