123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379 |
- // Copyright 2019 github.com. All rights reserved.
- // Use of this source code is governed by github.com.
- package route
- import (
- "net/http"
- "github.com/gin-gonic/gin"
- "property-applete-gateway/controller/v1"
- _ "property-applete-gateway/docs"
- "property-applete-gateway/route/middleware"
- )
- func SetupRoute(engine *gin.Engine) {
- // 404页面
- engine.NoRoute(func(c *gin.Context) {
- c.String(http.StatusNotFound, "Not Found")
- })
- // 服务健康检查
- engine.GET("/ping", func(c *gin.Context) {
- // TODO 心跳检查
- c.String(http.StatusOK, "pong")
- })
- //engine.Use(middleware.Session("smart-site-supplier"))
- // version 1
- apiv1 := engine.Group("/api/v1")
- {
- c := v1.NewController()
- engine.POST("/api/v1/user/login", c.Login)
- engine.POST("/api/v1/upload", c.Upload)
- engine.PUT("/api/v1/user/reset_password", c.ResetPassword)
- engine.POST("/api/v1/user/login_by_phone", c.LoginByPhone)
- engine.GET("/api/v1/user/vcode", c.GetVcode)
- apiv1.PUT("/token_refresh", c.TokenRefresh)
- apiv1.Use(middleware.Jwt())
- user := apiv1.Group("/user")
- {
- user.GET("/choose_user", c.ChooseUser)
- user.PUT("/change_password", c.ChangePassword)
- }
- service := apiv1.Group("/service")
- {
- vote := service.Group("/vote")
- {
- vote.POST("", c.VoteAdd)
- vote.PUT("", c.VoteUpdate)
- vote.DELETE("", c.VoteDel)
- vote.GET("", c.VoteList)
- vote.GET("/result", c.VoteResultList)
- vote.GET("/result/statistic", c.VoteResultStatistic)
- }
- event := service.Group("/event")
- {
- event.POST("", c.EventAdd)
- event.PUT("", c.EventUpdate)
- event.GET("", c.EventList)
- event.DELETE("", c.EventDel)
- sign := event.Group("/sign")
- {
- sign.GET("", c.EventSignList)
- sign.DELETE("", c.EventSignDel)
- }
- }
- announcement := service.Group("/announcement")
- {
- announcement.POST("", c.AnnouncementAdd)
- announcement.PUT("", c.AnnouncementUpdate)
- announcement.GET("", c.AnnouncementList)
- announcement.DELETE("", c.AnnouncementDel)
- }
- neighbor := service.Group("/neighbor")
- {
- neighbor.POST("/class", c.NeighborClassAdd)
- neighbor.PUT("/class", c.NeighborClassUpdate)
- neighbor.DELETE("/class", c.NeighborClassDel)
- neighbor.GET("/class", c.NeighborClassList)
- neighbor.DELETE("/article", c.NeighborArticleDel)
- neighbor.GET("/article", c.NeighborArticleList)
- neighbor.DELETE("/comment", c.NeighborCommentDel)
- neighbor.GET("/comment", c.NeighborCommentList)
- }
- }
- gate := apiv1.Group("/gate")
- {
- gate.GET("", c.GateList)
- gate.PUT("/enable", c.GateEnable)
- gate.PUT("/set", c.GateSet)
- white := gate.Group("/white")
- {
- white.POST("", c.GateWhiteAdd)
- white.DELETE("", c.GateWhiteDel)
- white.GET("/household", c.GateWhiteHouseholdList)
- white.GET("/card", c.GateWhiteCardList)
- white.PUT("/sync", c.GateWhiteSync)
- }
- command := gate.Group("/command")
- {
- command.POST("/open", c.GateOpen)
- command.POST("/restart", c.GateRestart)
- command.GET("", c.GateCommandList)
- }
- }
- garden := apiv1.Group("/garden")
- {
- garden.GET("", c.GardenInfo)
- garden.PUT("", c.GardenUpdate)
- keyInfo := garden.Group("/key_info")
- {
- keyInfo.PUT("", c.GardenKeyInfoChange)
- keyInfo.GET("", c.GardenKeyInfoChangeList)
- }
- }
- charge := apiv1.Group("/charge")
- {
- // 物业费套餐
- propertyPackage := charge.Group("/property_package")
- {
- propertyPackage.POST("", c.PropertyPackageAdd)
- propertyPackage.PUT("", c.PropertyPackageUpdate)
- propertyPackage.DELETE("", c.PropertyPackageDel)
- propertyPackage.GET("", c.PropertyPackageList)
- }
- // 费项配置
- conf := charge.Group("/conf")
- {
- conf.POST("", c.ChargeConfAdd)
- conf.PUT("", c.ChargeConfUpdate)
- conf.DELETE("", c.ChargeConfDel)
- conf.GET("", c.ChargeConfList)
- }
- // 抄表
- power := charge.Group("/power")
- {
- power.POST("/batch", c.PowerRecordBatchAdd)
- power.POST("", c.PowerRecordAdd)
- power.DELETE("", c.PowerRecordDel)
- power.GET("", c.PowerRecordList)
- power.GET("/template", c.ChargePowerTemplate)
- }
- // 绑定费用
- charge.PUT("/bind", c.ChargeBind)
- // 解绑费用
- charge.PUT("/unbind", c.ChargeUnbind)
- // 获取催缴信息
- charge.GET("/urge", c.ChargeUrgeInfo)
- charge.GET("/batch_urge", c.BatchUrge)
- // 催缴配置
- charge.PUT("/urge", c.ChargeUrgeSet)
- house := charge.Group("/house")
- {
- // 已绑定某费项的房屋列表
- house.GET("/binded_list", c.ChargeHouseBindedList)
- // 可以绑定某费项的房屋列表
- house.GET("/can_bind_list", c.ChargeHouseNotBindList)
- }
- space := charge.Group("/space")
- {
- // 已绑定某费项的车位列表
- space.GET("/binded_list", c.ChargeSpaceBindedList)
- // 可以绑定某费项的车位列表
- space.GET("/can_bind_list", c.ChargeSpaceNotBindList)
- }
- vehicle := charge.Group("/vehicle")
- {
- // 已绑定某费项的车辆列表
- vehicle.GET("/binded_list", c.ChargeVehicleBindedList)
- // 可以绑定某费项的车辆列表
- vehicle.GET("/can_bind_list", c.ChargeVehicleNotBindList)
- }
- objCharge := charge.Group("/obj_charge")
- {
- // 房屋收费房屋列表
- objCharge.GET("/house_list", c.ChargeHouseGroup)
- // 车位收费 车位列表
- objCharge.GET("/space_list", c.ChargeSpaceGroup)
- // 车辆收费车辆列表
- objCharge.GET("/vehicle_list", c.ChargeVehicleGroup)
- // 欠费缴费线下支付
- objCharge.PUT("/pay", c.ChargeBillPay)
- // 二维码收款
- objCharge.PUT("/native_pay", c.ChargeBillPayByHousehold)
- // 欠费缴费欠费项目列表
- objCharge.GET("/unpay_list", c.ChargeUnpayList)
- // 查看费用 费项列表
- objCharge.GET("/charge_list", c.ChargeList)
- // 对象下的某费项下的账单列表
- objCharge.GET("/bill_list", c.ChargeBillList)
- // 变更时间
- objCharge.PUT("/time", c.ChargeTimeSet)
- // 手动生成账单
- objCharge.PUT("/bill", c.ChargeGenerateBill)
- // 获取小票或收据信息
- objCharge.GET("/ticket", c.ChargeOrderTicket)
- // 物业或车位费预支付前获取金额信息
- objCharge.GET("/pre_pay_info",c.ChargePrePayInfo)
- // 物业或车位费预支付
- objCharge.PUT("/pre_pay", c.ChargePrePay)
- }
- unpayBill := charge.Group("/unpay_bill")
- {
- // 应收账单对象列表
- unpayBill.GET("/obj_list", c.ChargeBillObjList)
- // 对象下的账单列表
- unpayBill.GET("/obj_bill_list", c.ChargeObjBillList)
- // 作废账单
- unpayBill.PUT("/discard", c.ChargeDelBill)
- unpayBill.POST("/urge", c.ChargeUrge)
- }
- payedBill := charge.Group("/payed_bill")
- {
- // 已缴账单
- payedBill.GET("/list", c.ChargePayedBillList)
- }
- discardBill := charge.Group("/discard_bill")
- {
- // 作废账单列表
- discardBill.GET("/list", c.ChargeDelBillList)
- // 恢复账单
- discardBill.PUT("/recover", c.ChargeRecoverBill)
- }
- order := charge.Group("/order")
- {
- // 订单列表
- order.GET("/list", c.ChargeOrderList)
- // 订单详情
- order.GET("/info", c.ChargeOrderInfo)
- // 确认订单已支付
- order.PUT("/confirm", c.ChargeOrderPay)
- }
- }
- systemUser := apiv1.Group("/system_user")
- {
- systemUser.GET("", c.UserList)
- }
- household := apiv1.Group("/household")
- {
- household.GET("/list", c.HouseholdList)
- household.PUT("/approve", c.HouseholdApprove)
- household.GET("/user_list", c.HouseholdUserList)
- }
- department := apiv1.Group("/department")
- {
- department.POST("", c.DepartmentAdd)
- department.PUT("", c.DepartmentUpdate)
- department.DELETE("", c.DepartmentDel)
- department.GET("", c.DepartmentList)
- }
- buildings := apiv1.Group("/buildings")
- {
- buildings.POST("/building", c.BuildingAdd)
- buildings.PUT("/building", c.BuildingUpdate)
- buildings.GET("/building", c.BuildingList)
- buildings.DELETE("/building", c.BuildingDel)
- buildings.POST("/unit", c.UnitAdd)
- buildings.PUT("/unit", c.UnitUpdate)
- buildings.GET("/unit", c.UnitList)
- buildings.DELETE("/unit", c.UnitDel)
- buildings.POST("/house", c.HouseAdd)
- buildings.PUT("/house", c.HouseUpdate)
- buildings.GET("/house", c.HouseList)
- buildings.DELETE("/house", c.HouseDel)
- buildings.POST("/batch", c.BatchHouseAdd)
- }
- systemMsg := apiv1.Group("/system_msg")
- {
- systemMsg.GET("/count", c.SystemMsgCount)
- systemMsg.GET("/list", c.SystemMsgList)
- systemMsg.PUT("", c.SystemMsgReaded)
- }
- servicePhone := apiv1.Group("/service_phone")
- {
- class := servicePhone.Group("/class")
- {
- class.POST("", c.ServicePhoneClassAdd)
- class.PUT("", c.ServicePhoneClassUpdate)
- class.GET("", c.ServicePhoneClassList)
- class.DELETE("", c.ServicePhoneClassDel)
- }
- servicePhone.POST("", c.ServicePhoneAdd)
- servicePhone.PUT("", c.ServicePhoneUpdate)
- servicePhone.GET("", c.ServicePhoneList)
- servicePhone.DELETE("", c.ServicePhoneDel)
- }
- repair := apiv1.Group("/repair")
- {
- class := repair.Group("/class")
- {
- class.POST("", c.RepairClassAdd)
- class.PUT("", c.RepairClassUpdate)
- class.GET("", c.RepairClassList)
- class.DELETE("", c.RepairClassDel)
- }
- order := repair.Group("/order")
- {
- order.POST("", c.RepairOrderAdd)
- order.PUT("", c.RepairOrderUpdate)
- order.GET("", c.RepairOrderList)
- order.DELETE("", c.RepairOrderDel)
- order.GET("/info", c.RepairOrderInfo)
- order.PUT("/send", c.RepairOrderSend)
- order.PUT("/finish", c.RepairOrderFinish)
- order.PUT("/back", c.RepairOrderBack)
- order.PUT("/return_visit", c.RepairOrderReturnVisit)
- }
- }
- suggestion := apiv1.Group("/suggestion")
- {
- order := suggestion.Group("/order")
- {
- order.POST("", c.SuggestionOrderAdd)
- order.PUT("", c.SuggestionOrderUpdate)
- order.GET("", c.SuggestionOrderList)
- order.DELETE("", c.SuggestionOrderDel)
- order.GET("/info", c.SuggestionOrderInfo)
- order.PUT("/send", c.SuggestionOrderSend)
- order.PUT("/finish", c.SuggestionOrderFinish)
- order.PUT("/back", c.SuggestionOrderBack)
- order.PUT("/return_visit", c.SuggestionOrderReturnVisit)
- }
- }
- rent := apiv1.Group("/rent")
- {
- house := rent.Group("/house")
- {
- house.GET("", c.HouseRentList)
- house.POST("", c.HouseRentApply)
- house.PUT("", c.HouseRentUpdate)
- house.PUT("/approve", c.HouseRentApprove)
- house.PUT("/down", c.HouseRentDown)
- manager := house.Group("/manager")
- {
- manager.GET("", c.HouseRentManagerList)
- manager.POST("", c.HouseRentAddManager)
- manager.DELETE("", c.HouseRentDelManager)
- }
- appointment := house.Group("/appointment")
- {
- appointment.DELETE("", c.HouseRentAppointmentDel)
- appointment.GET("", c.HouseRentAppointmentList)
- }
- }
- }
- }
- }
|