route.go 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. // Copyright 2019 github.com. All rights reserved.
  2. // Use of this source code is governed by github.com.
  3. package route
  4. import (
  5. "net/http"
  6. "github.com/gin-gonic/gin"
  7. "property-applete-gateway/controller/v1"
  8. _ "property-applete-gateway/docs"
  9. "property-applete-gateway/route/middleware"
  10. )
  11. func SetupRoute(engine *gin.Engine) {
  12. // 404页面
  13. engine.NoRoute(func(c *gin.Context) {
  14. c.String(http.StatusNotFound, "Not Found")
  15. })
  16. // 服务健康检查
  17. engine.GET("/ping", func(c *gin.Context) {
  18. // TODO 心跳检查
  19. c.String(http.StatusOK, "pong")
  20. })
  21. //engine.Use(middleware.Session("smart-site-supplier"))
  22. // version 1
  23. apiv1 := engine.Group("/api/v1")
  24. {
  25. c := v1.NewController()
  26. engine.POST("/api/v1/user/login", c.Login)
  27. engine.POST("/api/v1/upload", c.Upload)
  28. engine.PUT("/api/v1/user/reset_password", c.ResetPassword)
  29. engine.POST("/api/v1/user/login_by_phone", c.LoginByPhone)
  30. engine.GET("/api/v1/user/vcode", c.GetVcode)
  31. apiv1.PUT("/token_refresh", c.TokenRefresh)
  32. apiv1.Use(middleware.Jwt())
  33. user := apiv1.Group("/user")
  34. {
  35. user.GET("/choose_user", c.ChooseUser)
  36. user.PUT("/change_password", c.ChangePassword)
  37. }
  38. service := apiv1.Group("/service")
  39. {
  40. vote := service.Group("/vote")
  41. {
  42. vote.POST("", c.VoteAdd)
  43. vote.PUT("", c.VoteUpdate)
  44. vote.DELETE("", c.VoteDel)
  45. vote.GET("", c.VoteList)
  46. vote.GET("/result", c.VoteResultList)
  47. vote.GET("/result/statistic", c.VoteResultStatistic)
  48. }
  49. event := service.Group("/event")
  50. {
  51. event.POST("", c.EventAdd)
  52. event.PUT("", c.EventUpdate)
  53. event.GET("", c.EventList)
  54. event.DELETE("", c.EventDel)
  55. sign := event.Group("/sign")
  56. {
  57. sign.GET("", c.EventSignList)
  58. sign.DELETE("", c.EventSignDel)
  59. }
  60. }
  61. announcement := service.Group("/announcement")
  62. {
  63. announcement.POST("", c.AnnouncementAdd)
  64. announcement.PUT("", c.AnnouncementUpdate)
  65. announcement.GET("", c.AnnouncementList)
  66. announcement.DELETE("", c.AnnouncementDel)
  67. }
  68. neighbor := service.Group("/neighbor")
  69. {
  70. neighbor.POST("/class", c.NeighborClassAdd)
  71. neighbor.PUT("/class", c.NeighborClassUpdate)
  72. neighbor.DELETE("/class", c.NeighborClassDel)
  73. neighbor.GET("/class", c.NeighborClassList)
  74. neighbor.DELETE("/article", c.NeighborArticleDel)
  75. neighbor.GET("/article", c.NeighborArticleList)
  76. neighbor.DELETE("/comment", c.NeighborCommentDel)
  77. neighbor.GET("/comment", c.NeighborCommentList)
  78. }
  79. }
  80. gate := apiv1.Group("/gate")
  81. {
  82. gate.GET("", c.GateList)
  83. gate.PUT("/enable", c.GateEnable)
  84. gate.PUT("/set", c.GateSet)
  85. white := gate.Group("/white")
  86. {
  87. white.POST("", c.GateWhiteAdd)
  88. white.DELETE("", c.GateWhiteDel)
  89. white.GET("/household", c.GateWhiteHouseholdList)
  90. white.GET("/card", c.GateWhiteCardList)
  91. white.PUT("/sync", c.GateWhiteSync)
  92. }
  93. command := gate.Group("/command")
  94. {
  95. command.POST("/open", c.GateOpen)
  96. command.POST("/restart", c.GateRestart)
  97. command.GET("", c.GateCommandList)
  98. }
  99. }
  100. garden := apiv1.Group("/garden")
  101. {
  102. garden.GET("", c.GardenInfo)
  103. garden.PUT("", c.GardenUpdate)
  104. keyInfo := garden.Group("/key_info")
  105. {
  106. keyInfo.PUT("", c.GardenKeyInfoChange)
  107. keyInfo.GET("", c.GardenKeyInfoChangeList)
  108. }
  109. }
  110. charge := apiv1.Group("/charge")
  111. {
  112. // 物业费套餐
  113. propertyPackage := charge.Group("/property_package")
  114. {
  115. propertyPackage.POST("", c.PropertyPackageAdd)
  116. propertyPackage.PUT("", c.PropertyPackageUpdate)
  117. propertyPackage.DELETE("", c.PropertyPackageDel)
  118. propertyPackage.GET("", c.PropertyPackageList)
  119. }
  120. // 费项配置
  121. conf := charge.Group("/conf")
  122. {
  123. conf.POST("", c.ChargeConfAdd)
  124. conf.PUT("", c.ChargeConfUpdate)
  125. conf.DELETE("", c.ChargeConfDel)
  126. conf.GET("", c.ChargeConfList)
  127. }
  128. // 抄表
  129. power := charge.Group("/power")
  130. {
  131. power.POST("/batch", c.PowerRecordBatchAdd)
  132. power.POST("", c.PowerRecordAdd)
  133. power.DELETE("", c.PowerRecordDel)
  134. power.GET("", c.PowerRecordList)
  135. power.GET("/template", c.ChargePowerTemplate)
  136. }
  137. // 绑定费用
  138. charge.PUT("/bind", c.ChargeBind)
  139. // 解绑费用
  140. charge.PUT("/unbind", c.ChargeUnbind)
  141. // 获取催缴信息
  142. charge.GET("/urge", c.ChargeUrgeInfo)
  143. charge.GET("/batch_urge", c.BatchUrge)
  144. // 催缴配置
  145. charge.PUT("/urge", c.ChargeUrgeSet)
  146. house := charge.Group("/house")
  147. {
  148. // 已绑定某费项的房屋列表
  149. house.GET("/binded_list", c.ChargeHouseBindedList)
  150. // 可以绑定某费项的房屋列表
  151. house.GET("/can_bind_list", c.ChargeHouseNotBindList)
  152. }
  153. space := charge.Group("/space")
  154. {
  155. // 已绑定某费项的车位列表
  156. space.GET("/binded_list", c.ChargeSpaceBindedList)
  157. // 可以绑定某费项的车位列表
  158. space.GET("/can_bind_list", c.ChargeSpaceNotBindList)
  159. }
  160. vehicle := charge.Group("/vehicle")
  161. {
  162. // 已绑定某费项的车辆列表
  163. vehicle.GET("/binded_list", c.ChargeVehicleBindedList)
  164. // 可以绑定某费项的车辆列表
  165. vehicle.GET("/can_bind_list", c.ChargeVehicleNotBindList)
  166. }
  167. objCharge := charge.Group("/obj_charge")
  168. {
  169. // 房屋收费房屋列表
  170. objCharge.GET("/house_list", c.ChargeHouseGroup)
  171. // 车位收费 车位列表
  172. objCharge.GET("/space_list", c.ChargeSpaceGroup)
  173. // 车辆收费车辆列表
  174. objCharge.GET("/vehicle_list", c.ChargeVehicleGroup)
  175. // 欠费缴费线下支付
  176. objCharge.PUT("/pay", c.ChargeBillPay)
  177. // 二维码收款
  178. objCharge.PUT("/native_pay", c.ChargeBillPayByHousehold)
  179. // 欠费缴费欠费项目列表
  180. objCharge.GET("/unpay_list", c.ChargeUnpayList)
  181. // 查看费用 费项列表
  182. objCharge.GET("/charge_list", c.ChargeList)
  183. // 对象下的某费项下的账单列表
  184. objCharge.GET("/bill_list", c.ChargeBillList)
  185. // 变更时间
  186. objCharge.PUT("/time", c.ChargeTimeSet)
  187. // 手动生成账单
  188. objCharge.PUT("/bill", c.ChargeGenerateBill)
  189. // 获取小票或收据信息
  190. objCharge.GET("/ticket", c.ChargeOrderTicket)
  191. // 物业或车位费预支付前获取金额信息
  192. objCharge.GET("/pre_pay_info",c.ChargePrePayInfo)
  193. // 物业或车位费预支付
  194. objCharge.PUT("/pre_pay", c.ChargePrePay)
  195. }
  196. unpayBill := charge.Group("/unpay_bill")
  197. {
  198. // 应收账单对象列表
  199. unpayBill.GET("/obj_list", c.ChargeBillObjList)
  200. // 对象下的账单列表
  201. unpayBill.GET("/obj_bill_list", c.ChargeObjBillList)
  202. // 作废账单
  203. unpayBill.PUT("/discard", c.ChargeDelBill)
  204. unpayBill.POST("/urge", c.ChargeUrge)
  205. }
  206. payedBill := charge.Group("/payed_bill")
  207. {
  208. // 已缴账单
  209. payedBill.GET("/list", c.ChargePayedBillList)
  210. }
  211. discardBill := charge.Group("/discard_bill")
  212. {
  213. // 作废账单列表
  214. discardBill.GET("/list", c.ChargeDelBillList)
  215. // 恢复账单
  216. discardBill.PUT("/recover", c.ChargeRecoverBill)
  217. }
  218. order := charge.Group("/order")
  219. {
  220. // 订单列表
  221. order.GET("/list", c.ChargeOrderList)
  222. // 订单详情
  223. order.GET("/info", c.ChargeOrderInfo)
  224. // 确认订单已支付
  225. order.PUT("/confirm", c.ChargeOrderPay)
  226. }
  227. }
  228. systemUser := apiv1.Group("/system_user")
  229. {
  230. systemUser.GET("", c.UserList)
  231. }
  232. household := apiv1.Group("/household")
  233. {
  234. household.GET("/list", c.HouseholdList)
  235. household.PUT("/approve", c.HouseholdApprove)
  236. household.GET("/user_list", c.HouseholdUserList)
  237. }
  238. department := apiv1.Group("/department")
  239. {
  240. department.POST("", c.DepartmentAdd)
  241. department.PUT("", c.DepartmentUpdate)
  242. department.DELETE("", c.DepartmentDel)
  243. department.GET("", c.DepartmentList)
  244. }
  245. buildings := apiv1.Group("/buildings")
  246. {
  247. buildings.POST("/building", c.BuildingAdd)
  248. buildings.PUT("/building", c.BuildingUpdate)
  249. buildings.GET("/building", c.BuildingList)
  250. buildings.DELETE("/building", c.BuildingDel)
  251. buildings.POST("/unit", c.UnitAdd)
  252. buildings.PUT("/unit", c.UnitUpdate)
  253. buildings.GET("/unit", c.UnitList)
  254. buildings.DELETE("/unit", c.UnitDel)
  255. buildings.POST("/house", c.HouseAdd)
  256. buildings.PUT("/house", c.HouseUpdate)
  257. buildings.GET("/house", c.HouseList)
  258. buildings.DELETE("/house", c.HouseDel)
  259. buildings.POST("/batch", c.BatchHouseAdd)
  260. }
  261. systemMsg := apiv1.Group("/system_msg")
  262. {
  263. systemMsg.GET("/count", c.SystemMsgCount)
  264. systemMsg.GET("/list", c.SystemMsgList)
  265. systemMsg.PUT("", c.SystemMsgReaded)
  266. }
  267. servicePhone := apiv1.Group("/service_phone")
  268. {
  269. class := servicePhone.Group("/class")
  270. {
  271. class.POST("", c.ServicePhoneClassAdd)
  272. class.PUT("", c.ServicePhoneClassUpdate)
  273. class.GET("", c.ServicePhoneClassList)
  274. class.DELETE("", c.ServicePhoneClassDel)
  275. }
  276. servicePhone.POST("", c.ServicePhoneAdd)
  277. servicePhone.PUT("", c.ServicePhoneUpdate)
  278. servicePhone.GET("", c.ServicePhoneList)
  279. servicePhone.DELETE("", c.ServicePhoneDel)
  280. }
  281. repair := apiv1.Group("/repair")
  282. {
  283. class := repair.Group("/class")
  284. {
  285. class.POST("", c.RepairClassAdd)
  286. class.PUT("", c.RepairClassUpdate)
  287. class.GET("", c.RepairClassList)
  288. class.DELETE("", c.RepairClassDel)
  289. }
  290. order := repair.Group("/order")
  291. {
  292. order.POST("", c.RepairOrderAdd)
  293. order.PUT("", c.RepairOrderUpdate)
  294. order.GET("", c.RepairOrderList)
  295. order.DELETE("", c.RepairOrderDel)
  296. order.GET("/info", c.RepairOrderInfo)
  297. order.PUT("/send", c.RepairOrderSend)
  298. order.PUT("/finish", c.RepairOrderFinish)
  299. order.PUT("/back", c.RepairOrderBack)
  300. order.PUT("/return_visit", c.RepairOrderReturnVisit)
  301. }
  302. }
  303. suggestion := apiv1.Group("/suggestion")
  304. {
  305. order := suggestion.Group("/order")
  306. {
  307. order.POST("", c.SuggestionOrderAdd)
  308. order.PUT("", c.SuggestionOrderUpdate)
  309. order.GET("", c.SuggestionOrderList)
  310. order.DELETE("", c.SuggestionOrderDel)
  311. order.GET("/info", c.SuggestionOrderInfo)
  312. order.PUT("/send", c.SuggestionOrderSend)
  313. order.PUT("/finish", c.SuggestionOrderFinish)
  314. order.PUT("/back", c.SuggestionOrderBack)
  315. order.PUT("/return_visit", c.SuggestionOrderReturnVisit)
  316. }
  317. }
  318. rent := apiv1.Group("/rent")
  319. {
  320. house := rent.Group("/house")
  321. {
  322. house.GET("", c.HouseRentList)
  323. house.POST("", c.HouseRentApply)
  324. house.PUT("", c.HouseRentUpdate)
  325. house.PUT("/approve", c.HouseRentApprove)
  326. house.PUT("/down", c.HouseRentDown)
  327. manager := house.Group("/manager")
  328. {
  329. manager.GET("", c.HouseRentManagerList)
  330. manager.POST("", c.HouseRentAddManager)
  331. manager.DELETE("", c.HouseRentDelManager)
  332. }
  333. appointment := house.Group("/appointment")
  334. {
  335. appointment.DELETE("", c.HouseRentAppointmentDel)
  336. appointment.GET("", c.HouseRentAppointmentList)
  337. }
  338. }
  339. }
  340. }
  341. }