router.go 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. package router
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "iot_manager_service/app/controller"
  5. "iot_manager_service/app/middleware"
  6. )
  7. func InitRouter(engine *gin.Engine) {
  8. // 跨域处理
  9. engine.Use(middleware.Cors())
  10. // 登录验证中间件
  11. engine.Use(middleware.CheckLogin())
  12. // 校验权限
  13. engine.Use(middleware.CheckAuth())
  14. // 设备管理
  15. device := engine.Group("/api/longchi/device/")
  16. // 设备管理
  17. handleHistory := engine.Group("/api/longchi/handlehistory")
  18. {
  19. handleHistory.GET("/list", controller.HandleHistory.List)
  20. }
  21. //桥梁
  22. bridge := device.Group("bridge")
  23. {
  24. bridge.GET("/detail", controller.Bridge.Detail)
  25. bridge.GET("/list", controller.Bridge.List)
  26. bridge.POST("/submit", controller.Bridge.CreateOrUpdate)
  27. bridge.POST("/remove", controller.Bridge.Remove)
  28. bridge.GET("/dropdown", controller.Bridge.GetList)
  29. bridge.POST("/import-excel", controller.Bridge.ImportExcel)
  30. bridge.GET("/export-excel", controller.Bridge.ExportExcel)
  31. bridge.GET("/export-template", controller.Bridge.ExportTemplate)
  32. }
  33. //桥梁传感器 控制器
  34. bridgeSensor := device.Group("bridgesensor")
  35. {
  36. bridgeSensor.GET("/detail", controller.BridgeSensor.Detail)
  37. bridgeSensor.GET("/list", controller.BridgeSensor.List)
  38. bridgeSensor.POST("/submit", controller.BridgeSensor.CreateOrUpdate)
  39. bridgeSensor.POST("/remove", controller.BridgeSensor.Remove)
  40. bridgeSensor.GET("/dropdown", controller.BridgeSensor.GetList)
  41. bridgeSensor.POST("/enable-disable", controller.BridgeSensor.Enable)
  42. bridgeSensor.POST("/import-excel", controller.BridgeSensor.ImportExcel)
  43. bridgeSensor.GET("/export-excel", controller.BridgeSensor.ExportExcel)
  44. bridgeSensor.GET("/export-template", controller.BridgeSensor.ExportTemplate)
  45. }
  46. //摄像头
  47. camera := device.Group("/camera")
  48. {
  49. camera.GET("/detail", controller.Camera.Detail)
  50. camera.GET("/list", controller.Camera.List)
  51. camera.POST("/submit", controller.Camera.CreateOrUpdate)
  52. camera.POST("/remove", controller.Camera.Remove)
  53. camera.POST("/import-excel", controller.Camera.ImportExcel)
  54. camera.GET("/export-excel", controller.Camera.ExportExcel)
  55. camera.GET("/export-template", controller.Camera.ExportTemplate)
  56. camera.POST("/enable-disable", controller.Camera.Enable)
  57. camera.GET("/getList", controller.Camera.GetList)
  58. }
  59. //抓拍单元+卡口 控制器
  60. captureUnit := device.Group("captureunit")
  61. {
  62. captureUnit.GET("/detail", controller.CaptureUint.Detail)
  63. captureUnit.GET("/capture-list", controller.CaptureUint.CaptureList)
  64. captureUnit.POST("/capture-submit", controller.CaptureUint.CaptureSubmit)
  65. captureUnit.GET("/capture-pull-down-list", controller.CaptureUint.CaptureGetList)
  66. captureUnit.GET("/point-list", controller.CaptureUint.PointList)
  67. captureUnit.POST("/point-submit", controller.CaptureUint.PointSubmit)
  68. captureUnit.GET("/point-pull-down-list", controller.CaptureUint.PointGetList)
  69. captureUnit.POST("/remove", controller.CaptureUint.Remove)
  70. }
  71. //垃圾桶台账 控制器
  72. garbage := device.Group("garbage")
  73. {
  74. garbage.GET("/detail", controller.Garbage.Detail)
  75. garbage.GET("/list", controller.Garbage.List)
  76. garbage.POST("/submit", controller.Garbage.CreateOrUpdate)
  77. garbage.POST("/remove", controller.Garbage.Remove)
  78. garbage.GET("/dropdown", controller.Garbage.GetList)
  79. garbage.POST("/import-excel", controller.Garbage.ImportExcel)
  80. garbage.GET("/export-excel", controller.Garbage.ExportExcel)
  81. garbage.GET("/export-template", controller.Garbage.ExportTemplate)
  82. }
  83. //垃圾桶道路分组管理 控制器
  84. garbageWayGroup := device.Group("garbage-way-group")
  85. {
  86. garbageWayGroup.GET("/detail", controller.GarbageWay.Detail)
  87. garbageWayGroup.GET("/list", controller.GarbageWay.List)
  88. garbageWayGroup.POST("/submit", controller.GarbageWay.CreateOrUpdate)
  89. garbageWayGroup.POST("/remove", controller.GarbageWay.Remove)
  90. garbageWayGroup.GET("/getList", controller.GarbageWay.GetList)
  91. }
  92. //信息屏基本信息 控制器
  93. infoBoard := device.Group("infoboard")
  94. {
  95. infoBoard.GET("/detail", controller.InfoBoard.Detail)
  96. infoBoard.GET("/list", controller.InfoBoard.List)
  97. infoBoard.POST("/submit", controller.InfoBoard.CreateOrUpdate)
  98. infoBoard.POST("/remove", controller.InfoBoard.Remove)
  99. infoBoard.POST("/import-excel", controller.InfoBoard.ImportExcel)
  100. infoBoard.GET("/export-excel", controller.InfoBoard.ExportExcel)
  101. infoBoard.GET("/export-template", controller.InfoBoard.ExportTemplate)
  102. infoBoard.GET("/system-operation", controller.InfoBoard.CreateOrUpdate)
  103. infoBoard.POST("/enable-disable", controller.InfoBoard.Enable)
  104. infoBoard.POST("/show-setting", controller.InfoBoard.ShowSetting)
  105. }
  106. //IP广播基本信息 控制器
  107. ipBroadCast := device.Group("ipbroadcast")
  108. {
  109. ipBroadCast.GET("/detail", controller.IpBroadcast.Detail)
  110. ipBroadCast.GET("/list", controller.IpBroadcast.List)
  111. ipBroadCast.POST("/submit", controller.IpBroadcast.CreateOrUpdate)
  112. ipBroadCast.POST("/remove", controller.IpBroadcast.Remove)
  113. ipBroadCast.POST("/import-excel", controller.IpBroadcast.ImportExcel)
  114. ipBroadCast.GET("/export-excel", controller.IpBroadcast.ExportExcel)
  115. ipBroadCast.GET("/export-template", controller.IpBroadcast.ExportTemplate)
  116. ipBroadCast.POST("/setting-volume", controller.IpBroadcast.SettingVolume)
  117. }
  118. //一键报警服务表 控制器
  119. Alarm := device.Group("akeyalarmserve")
  120. {
  121. Alarm.GET("/detail", controller.Alarm.Detail)
  122. Alarm.GET("/list", controller.Alarm.List)
  123. Alarm.POST("/submit", controller.Alarm.CreateOrUpdate)
  124. Alarm.POST("/remove", controller.Alarm.Remove)
  125. Alarm.GET("/getList", controller.Alarm.GetList)
  126. Alarm.POST("/import-excel", controller.Alarm.ImportExcel)
  127. Alarm.GET("/export-excel", controller.Alarm.ExportExcel)
  128. Alarm.GET("/export-template", controller.Alarm.ExportTemplate)
  129. }
  130. //一键报警终端表 控制器
  131. AlarmTerminal := device.Group("akeyalarmterminal")
  132. {
  133. AlarmTerminal.GET("/detail", controller.AlarmTerminal.Detail)
  134. AlarmTerminal.GET("/list", controller.AlarmTerminal.List)
  135. AlarmTerminal.POST("/submit", controller.AlarmTerminal.CreateOrUpdate)
  136. AlarmTerminal.POST("/remove", controller.AlarmTerminal.Remove)
  137. AlarmTerminal.POST("/import-excel", controller.AlarmTerminal.ImportExcel)
  138. AlarmTerminal.GET("/export-excel", controller.AlarmTerminal.ExportExcel)
  139. AlarmTerminal.GET("/export-template", controller.AlarmTerminal.ExportTemplate)
  140. }
  141. //灯杆基本信息 控制器
  142. lampPole := device.Group("lamppole")
  143. {
  144. lampPole.GET("/detail", controller.LampPole.Detail)
  145. lampPole.GET("/getRelevanceDetail", controller.LampPole.GetRelevanceDetail)
  146. lampPole.GET("/list", controller.LampPole.List)
  147. lampPole.POST("/submit", controller.LampPole.CreateOrUpdate)
  148. lampPole.POST("/remove", controller.LampPole.Remove)
  149. lampPole.GET("/getList", controller.LampPole.GetList)
  150. lampPole.POST("/import-excel", controller.LampPole.ImportExcel)
  151. lampPole.GET("/export-excel", controller.LampPole.ExportExcel)
  152. lampPole.GET("/export-template", controller.LampPole.ExportTemplate)
  153. }
  154. //灯杆分组
  155. lampPoleGroup := device.Group("/lamppolegroup")
  156. {
  157. lampPoleGroup.GET("/detail", controller.LampPoleGroup.Detail)
  158. lampPoleGroup.GET("/list", controller.LampPoleGroup.List)
  159. lampPoleGroup.POST("/submit", controller.LampPoleGroup.CreateOrUpdate)
  160. lampPoleGroup.POST("/remove", controller.LampPoleGroup.Remove)
  161. lampPoleGroup.GET("/getList", controller.LampPoleGroup.GetList)
  162. lampPoleGroup.GET("/filtration-list", controller.LampPoleGroup.FiltrationList)
  163. lampPoleGroup.GET("/getTree", controller.LampPoleGroup.GetTree)
  164. }
  165. //灯控基本信息 控制器
  166. lightControl := device.Group("lightcontrol")
  167. {
  168. lightControl.GET("/detail", controller.Light.Detail)
  169. lightControl.GET("/list", controller.Light.List)
  170. lightControl.POST("/submit", controller.Light.CreateOrUpdate)
  171. lightControl.POST("/remove", controller.Light.Remove)
  172. lightControl.GET("/getLampPoleList", controller.Light.GetList)
  173. lightControl.POST("/import-excel", controller.Light.ImportExcel)
  174. lightControl.GET("/export-excel", controller.Light.ExportExcel)
  175. lightControl.GET("/export-template", controller.Light.ExportTemplate)
  176. lightControl.POST("/enable-disable", controller.Light.Enable)
  177. lightControl.POST("/off-one", controller.Light.Switch) //todo 在strategy中
  178. }
  179. strategy := device.Group("/api/longchi/strategy")
  180. lightrelation := strategy.Group("lightrelation")
  181. {
  182. lightrelation.POST("/changeHandSwitch", controller.Light.ChangeHandSwitch)
  183. }
  184. //井盖基本信息 控制器
  185. manholeCover := device.Group("manholecover")
  186. {
  187. manholeCover.GET("/detail", controller.ManholeCover.Detail)
  188. manholeCover.GET("/list", controller.ManholeCover.List)
  189. manholeCover.POST("/submit", controller.ManholeCover.CreateOrUpdate)
  190. manholeCover.POST("/remove", controller.ManholeCover.Remove)
  191. manholeCover.POST("/setting", controller.ManholeCover.Setting)
  192. manholeCover.GET("/getList", controller.ManholeCover.GetList)
  193. manholeCover.POST("/import-excel", controller.ManholeCover.ImportExcel)
  194. manholeCover.GET("/export-excel", controller.ManholeCover.ExportExcel)
  195. manholeCover.GET("/export-template", controller.ManholeCover.ExportExcel)
  196. manholeCover.GET("/all-list", controller.ManholeCover.AllList)
  197. }
  198. //灯随车走分组 控制器
  199. onDemandGroup := device.Group("on-demand-group")
  200. {
  201. onDemandGroup.GET("/detail", controller.OnDemandGroup.Detail)
  202. onDemandGroup.GET("/list", controller.OnDemandGroup.List)
  203. onDemandGroup.POST("/submit", controller.OnDemandGroup.CreateOrUpdate)
  204. onDemandGroup.POST("/remove", controller.OnDemandGroup.Remove)
  205. onDemandGroup.GET("/getList", controller.OnDemandGroup.GetList)
  206. onDemandGroup.GET("/group-number", controller.OnDemandGroup.GroupNumber)
  207. }
  208. //灯随车走传感器 控制器
  209. onDemandSensor := device.Group("on-demand-sensor")
  210. {
  211. onDemandSensor.GET("/detail", controller.OnDemandSensor.Detail)
  212. onDemandSensor.GET("/list", controller.OnDemandSensor.List)
  213. onDemandSensor.POST("/submit", controller.OnDemandSensor.CreateOrUpdate)
  214. onDemandSensor.POST("/remove", controller.OnDemandSensor.Remove)
  215. onDemandSensor.POST("/import-excel", controller.OnDemandSensor.ImportExcel)
  216. onDemandSensor.GET("/export-excel", controller.OnDemandSensor.ExportExcel)
  217. onDemandSensor.GET("/export-template", controller.OnDemandSensor.ExportTemplate)
  218. }
  219. //环境传感器 控制器
  220. optoSensor := device.Group("optosensor")
  221. {
  222. optoSensor.GET("/detail", controller.OptoSensor.Detail)
  223. optoSensor.GET("/list", controller.OptoSensor.List)
  224. optoSensor.POST("/submit", controller.OptoSensor.CreateOrUpdate)
  225. optoSensor.POST("/remove", controller.OptoSensor.Remove)
  226. optoSensor.GET("/getList", controller.OptoSensor.GetList)
  227. optoSensor.POST("/set-default", controller.OptoSensor.SetDefault)
  228. optoSensor.POST("/import-excel", controller.OptoSensor.ImportExcel)
  229. optoSensor.GET("/export-excel", controller.OptoSensor.ExportExcel)
  230. optoSensor.GET("/export-template", controller.OptoSensor.ExportTemplate)
  231. }
  232. //配电箱基本信息 控制器
  233. switchBox := device.Group("switchbox")
  234. {
  235. switchBox.GET("/detail", controller.SwitchBox.Detail)
  236. switchBox.GET("/list", controller.SwitchBox.List)
  237. switchBox.POST("/submit", controller.SwitchBox.CreateOrUpdate)
  238. switchBox.POST("/remove", controller.SwitchBox.Remove)
  239. switchBox.GET("/getList", controller.SwitchBox.GetList)
  240. switchBox.POST("/import-excel", controller.SwitchBox.ImportExcel)
  241. switchBox.GET("/export-excel", controller.SwitchBox.ExportExcel)
  242. switchBox.GET("/export-template", controller.SwitchBox.ExportTemplate)
  243. }
  244. //变压器基本信息 控制器
  245. transformer := device.Group("transformer")
  246. {
  247. transformer.GET("/detail", controller.Transformer.Detail)
  248. transformer.GET("/list", controller.Transformer.List)
  249. transformer.POST("/submit", controller.Transformer.CreateOrUpdate)
  250. transformer.POST("/remove", controller.Transformer.Remove)
  251. transformer.GET("/getList", controller.Transformer.GetList)
  252. }
  253. //智慧网关基本信息 控制器
  254. wisdomGateway := device.Group("wisdomgateway")
  255. {
  256. wisdomGateway.GET("/detail", controller.WisdomGateway.Detail)
  257. wisdomGateway.GET("/list", controller.WisdomGateway.List)
  258. wisdomGateway.POST("/submit", controller.WisdomGateway.CreateOrUpdate)
  259. wisdomGateway.POST("/remove", controller.WisdomGateway.Remove)
  260. wisdomGateway.GET("/getList", controller.WisdomGateway.GetList)
  261. wisdomGateway.GET("/getRelevanceDetail", controller.WisdomGateway.GetRelevanceDetail)
  262. wisdomGateway.POST("/import-excel", controller.WisdomGateway.ImportExcel)
  263. wisdomGateway.GET("/export-excel", controller.WisdomGateway.ExportExcel)
  264. wisdomGateway.GET("/export-template", controller.WisdomGateway.ExportTemplate)
  265. }
  266. //zigBee网关 控制器
  267. zigbee := device.Group("zigbee")
  268. {
  269. zigbee.GET("/detail", controller.Zigbee.Detail)
  270. zigbee.GET("/list", controller.Zigbee.List)
  271. zigbee.POST("/submit", controller.Zigbee.CreateOrUpdate)
  272. zigbee.POST("/remove", controller.Zigbee.Remove)
  273. zigbee.GET("/getList", controller.Zigbee.GetList)
  274. zigbee.POST("/import-excel", controller.Zigbee.ImportExcel)
  275. zigbee.GET("/export-excel", controller.Zigbee.ExportExcel)
  276. zigbee.GET("/export-template", controller.Zigbee.ExportTemplate)
  277. }
  278. }