123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292 |
- package routers
- import (
- "github.com/gin-gonic/gin"
- "kpt.xdmy/pkg/app"
- "kpt.xdmy/pkg/e"
- )
- func GetWaterYieldByPasture(c *gin.Context) {
- appG := app.Gin{C: c}
- center := c.Query("center")
- startTime := c.Query("startTime")
- endTime := c.Query("endTime")
- startTime = startTime + "-01"
- endTime = endTime + "-01"
- data, err := svc.GetWaterYieldByPasture(center, startTime, endTime)
- if err != nil {
- c.JSON(200, map[string]interface{}{"code": 200, "data": err.Error(), "msg": "fail"})
- return
- }
- appG.Response(200, e.SUCCESS, data)
- }
- func GetWaterSingleCowByPasture(c *gin.Context) {
- appG := app.Gin{C: c}
- center := c.Query("center")
- startTime := c.Query("startTime")
- endTime := c.Query("endTime")
- startTime = startTime + "-01"
- endTime = endTime + "-01"
- data, err := svc.GetWaterSingleCowByPasture(center, startTime, endTime)
- if err != nil {
- c.JSON(200, map[string]interface{}{"code": 200, "data": err.Error(), "msg": "fail"})
- return
- }
- appG.Response(200, e.SUCCESS, data)
- }
- func GetWaterRateByPasture(c *gin.Context) {
- appG := app.Gin{C: c}
- center := c.Query("center")
- startTime := c.Query("startTime")
- endTime := c.Query("endTime")
- startTime = startTime + "-01"
- endTime = endTime + "-01"
- data, err := svc.GetWaterRateByPasture(center, startTime, endTime)
- if err != nil {
- c.JSON(200, map[string]interface{}{"code": 200, "data": err.Error(), "msg": "fail"})
- return
- }
- appG.Response(200, e.SUCCESS, data)
- }
- func GetWaterRateCompleteByPasture(c *gin.Context) {
- appG := app.Gin{C: c}
- center := c.Query("center")
- startTime := c.Query("startTime")
- endTime := c.Query("endTime")
- startTime = startTime + "-01"
- endTime = endTime + "-01"
- data, err := svc.GetWaterRateCompleteByPasture(center, startTime, endTime)
- if err != nil {
- c.JSON(200, map[string]interface{}{"code": 200, "data": err.Error(), "msg": "fail"})
- return
- }
- appG.Response(200, e.SUCCESS, data)
- }
- func GetWaterPerHeadByPasture(c *gin.Context) {
- appG := app.Gin{C: c}
- pastureId := c.Query("pastureId")
- startTime := c.Query("startTime")
- endTime := c.Query("endTime")
- startTime = startTime + "-01"
- endTime = endTime + "-01"
- data, err := svc.GetWaterPerHeadByPasture(pastureId, startTime, endTime)
- if err != nil {
- c.JSON(200, map[string]interface{}{"code": 200, "data": err.Error(), "msg": "fail"})
- return
- }
- appG.Response(200, e.SUCCESS, data)
- }
- func GetElectricityYieldByPasture(c *gin.Context) {
- appG := app.Gin{C: c}
- center := c.Query("center")
- startTime := c.Query("startTime")
- endTime := c.Query("endTime")
- startTime = startTime + "-01"
- endTime = endTime + "-01"
- data, err := svc.GetElectricityYieldByPasture(center, startTime, endTime)
- if err != nil {
- c.JSON(200, map[string]interface{}{"code": 200, "data": err.Error(), "msg": "fail"})
- return
- }
- appG.Response(200, e.SUCCESS, data)
- }
- func GetElectricitySingleCowByPasture(c *gin.Context) {
- appG := app.Gin{C: c}
- center := c.Query("center")
- startTime := c.Query("startTime")
- endTime := c.Query("endTime")
- startTime = startTime + "-01"
- endTime = endTime + "-01"
- data, err := svc.GetElectricitySingleCowByPasture(center, startTime, endTime)
- if err != nil {
- c.JSON(200, map[string]interface{}{"code": 200, "data": err.Error(), "msg": "fail"})
- return
- }
- appG.Response(200, e.SUCCESS, data)
- }
- func GetElectricityRateByPasture(c *gin.Context) {
- appG := app.Gin{C: c}
- center := c.Query("center")
- startTime := c.Query("startTime")
- endTime := c.Query("endTime")
- startTime = startTime + "-01"
- endTime = endTime + "-01"
- data, err := svc.GetElectricityRateByPasture(center, startTime, endTime)
- if err != nil {
- c.JSON(200, map[string]interface{}{"code": 200, "data": err.Error(), "msg": "fail"})
- return
- }
- appG.Response(200, e.SUCCESS, data)
- }
- func GetElectricityRateCompleteByPasture(c *gin.Context) {
- appG := app.Gin{C: c}
- center := c.Query("center")
- startTime := c.Query("startTime")
- endTime := c.Query("endTime")
- startTime = startTime + "-01"
- endTime = endTime + "-01"
- data, err := svc.GetElectricityRateCompleteByPasture(center, startTime, endTime)
- if err != nil {
- c.JSON(200, map[string]interface{}{"code": 200, "data": err.Error(), "msg": "fail"})
- return
- }
- appG.Response(200, e.SUCCESS, data)
- }
- func GetElectricityPerHeadByPasture(c *gin.Context) {
- appG := app.Gin{C: c}
- pastureId := c.Query("pastureId")
- startTime := c.Query("startTime")
- endTime := c.Query("endTime")
- startTime = startTime + "-01"
- endTime = endTime + "-01"
- data, err := svc.GetElectricityPerHeadByPasture(pastureId, startTime, endTime)
- if err != nil {
- c.JSON(200, map[string]interface{}{"code": 200, "data": err.Error(), "msg": "fail"})
- return
- }
- appG.Response(200, e.SUCCESS, data)
- }
- func GetWxYieldByPasture(c *gin.Context) {
- appG := app.Gin{C: c}
- center := c.Query("center")
- departmentName := c.Query("departmentName")
- startTime := c.Query("startTime")
- endTime := c.Query("endTime")
- startTime = startTime + "-01"
- endTime = endTime + "-01"
- data, err := svc.GetWxYieldByPasture(departmentName, center, startTime, endTime)
- if err != nil {
- c.JSON(200, map[string]interface{}{"code": 200, "data": err.Error(), "msg": "fail"})
- return
- }
- appG.Response(200, e.SUCCESS, data)
- }
- func GetWxSingleCowByPasture(c *gin.Context) {
- appG := app.Gin{C: c}
- center := c.Query("center")
- startTime := c.Query("startTime")
- endTime := c.Query("endTime")
- startTime = startTime + "-01"
- endTime = endTime + "-01"
- data, err := svc.GetWxSingleCowByPasture(center, startTime, endTime)
- if err != nil {
- c.JSON(200, map[string]interface{}{"code": 200, "data": err.Error(), "msg": "fail"})
- return
- }
- appG.Response(200, e.SUCCESS, data)
- }
- func GetWxPerHeadByPasture(c *gin.Context) {
- appG := app.Gin{C: c}
- pastureId := c.Query("pastureId")
- startTime := c.Query("startTime")
- endTime := c.Query("endTime")
- startTime = startTime + "-01"
- endTime = endTime + "-01"
- data, err := svc.GetWxPerHeadByPasture(pastureId, startTime, endTime)
- if err != nil {
- c.JSON(200, map[string]interface{}{"code": 200, "data": err.Error(), "msg": "fail"})
- return
- }
- appG.Response(200, e.SUCCESS, data)
- }
- //各牧场年度燃动费对比
- func GetIgnitionYieldByPasture(c *gin.Context) {
- appG := app.Gin{C: c}
- pastureId := c.Query("pastureId")
- startTime := c.Query("startTime")
- endTime := c.Query("endTime")
- startTime = startTime + "-01"
- endTime = endTime + "-01"
- data, err := svc.GetIgnitionYieldByPasture(pastureId, startTime, endTime)
- if err != nil {
- c.JSON(200, map[string]interface{}{"code": 200, "data": err.Error(), "msg": "fail"})
- return
- }
- appG.Response(200, e.SUCCESS, data)
- }
- //各牧场年度柴油对比
- func GetDieselYieldByPasture(c *gin.Context) {
- appG := app.Gin{C: c}
- pastureId := c.Query("pastureId")
- startTime := c.Query("startTime")
- endTime := c.Query("endTime")
- startTime = startTime + "-01"
- endTime = endTime + "-01"
- data, err := svc.GetDieselYieldByPasture(pastureId, startTime, endTime)
- if err != nil {
- c.JSON(200, map[string]interface{}{"code": 200, "data": err.Error(), "msg": "fail"})
- return
- }
- appG.Response(200, e.SUCCESS, data)
- }
- //单头牛柴油
- func GetDieselRateByPasture(c *gin.Context) {
- appG := app.Gin{C: c}
- pastureId := c.Query("pastureId")
- startTime := c.Query("startTime")
- endTime := c.Query("endTime")
- startTime = startTime + "-01"
- endTime = endTime + "-01"
- data, err := svc.GetDieselRateByPasture(pastureId, startTime, endTime)
- if err != nil {
- c.JSON(200, map[string]interface{}{"code": 200, "data": err.Error(), "msg": "fail"})
- return
- }
- appG.Response(200, e.SUCCESS, data)
- }
- //单头牛燃动费
- func GetIgnitionRateByPasture(c *gin.Context) {
- appG := app.Gin{C: c}
- pastureId := c.Query("pastureId")
- startTime := c.Query("startTime")
- endTime := c.Query("endTime")
- startTime = startTime + "-01"
- endTime = endTime + "-01"
- data, err := svc.GetIgnitionRateByPasture(pastureId, startTime, endTime)
- if err != nil {
- c.JSON(200, map[string]interface{}{"code": 200, "data": err.Error(), "msg": "fail"})
- return
- }
- appG.Response(200, e.SUCCESS, data)
- }
- //单头牛燃动费
- func GetDieselPerHeadByPasture(c *gin.Context) {
- appG := app.Gin{C: c}
- pastureId := c.Query("pastureId")
- startTime := c.Query("startTime")
- endTime := c.Query("endTime")
- startTime = startTime + "-01"
- endTime = endTime + "-01"
- data, err := svc.GetDieselPerHeadByPasture(pastureId, startTime, endTime)
- if err != nil {
- c.JSON(200, map[string]interface{}{"code": 200, "data": err.Error(), "msg": "fail"})
- return
- }
- appG.Response(200, e.SUCCESS, data)
- }
|