Api.kt 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. package com.framework.app.api
  2. import com.framework.app.http.FileDownloadInfo
  3. import com.framework.app.http.FileInfo
  4. import com.framework.app.http.FileUploadInfo
  5. import com.framework.mvvm.model.data.Model
  6. import com.framework.mvvm.model.vo.*
  7. import okhttp3.RequestBody
  8. import retrofit2.http.*
  9. interface Api {
  10. /**
  11. * 获取自字典数据
  12. */
  13. @POST("adm/dict")
  14. suspend fun getDict(@Body request: AdmRequest): Model<Dict>
  15. /**
  16. * 获取配置信息
  17. */
  18. @POST("adm/config")
  19. suspend fun getConfig(@Body request: AdmRequest): Model<Config>
  20. /**
  21. * 获取框架数据
  22. */
  23. @POST("adm/frame")
  24. suspend fun getFrame(@Body request: AdmRequest): Model<Frame>
  25. /**
  26. * 获取建筑数据
  27. */
  28. @POST("adm/download")
  29. suspend fun getBuilding(@Body request: AdmRequest): Model<Building>
  30. /**
  31. * 上传建筑数据
  32. */
  33. @Headers("Content-Encoding: gzip")
  34. @POST("adm/upload")
  35. suspend fun uploadBuilding(@Body building: UploadBuilding): Model<UploadResult>
  36. @POST("adm/clientId")
  37. suspend fun getClient(@Body client: Client): Model<Client>
  38. /**
  39. * 获取文件上传接口
  40. */
  41. @POST("http://develop.persagy.com/dmp-file/file/initSingleUpload")
  42. suspend fun getFileUploadInfo(
  43. @QueryMap param: Map<String, String> = mapOf(
  44. "appId" to "adm",
  45. "userId" to "bdtp",
  46. "groupCode" to "XG",
  47. "projectId" to "Pj5001120003"
  48. ),
  49. @Body file: FileInfo
  50. ): Model<FileUploadInfo>
  51. /**
  52. * 上传文件
  53. */
  54. @PUT
  55. suspend fun uploadFile(@Url url: String, @Body file: RequestBody): String
  56. /**
  57. * 文件下载
  58. */
  59. @POST("http://develop.persagy.com/dmp-file/file/initFileDownload")
  60. fun getFileDownloadInfo(
  61. @QueryMap param: Map<String, String> = mapOf(
  62. "appId" to "adm",
  63. "userId" to "bdtp",
  64. "groupCode" to "XG",
  65. "projectId" to "Pj5001120003"
  66. ),
  67. @Body fileId: String
  68. ): Model<FileDownloadInfo>
  69. /**
  70. * 返回地图
  71. */
  72. @GET
  73. suspend fun downloadFile(@Url url: String): String
  74. /**
  75. * 登录
  76. */
  77. @POST("http://82.157.151.123/login-service")
  78. suspend fun login(@Query("jsonString") json: String): Model<List<User>>
  79. /**
  80. * 获取项目
  81. */
  82. @POST("http://82.157.151.123/getUserById")
  83. suspend fun getProjects(@Query("jsonString") json: String): Model<List<User>>
  84. }