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) }