Browse Source

barn: 增加栏舍修改å记录

Yi 1 year ago
parent
commit
3f2874b344

+ 1 - 1
go.mod

@@ -3,7 +3,7 @@ module kpt-tmr-group
 go 1.17
 
 require (
-	gitee.com/xuyiping_admin/go_proto v0.0.0-20231116063239-b531a3099bd3
+	gitee.com/xuyiping_admin/go_proto v0.0.0-20231129062310-bbb6722ac3a0
 	gitee.com/xuyiping_admin/pkg v0.0.0-20230822102440-0e489dd5d75a
 	github.com/dgrijalva/jwt-go v3.2.0+incompatible
 	github.com/getsentry/sentry-go v0.23.0

+ 2 - 0
go.sum

@@ -40,6 +40,8 @@ gitee.com/xuyiping_admin/go_proto v0.0.0-20231116060440-d644eee73ee6 h1:+Lah4VWe
 gitee.com/xuyiping_admin/go_proto v0.0.0-20231116060440-d644eee73ee6/go.mod h1:x47UOU+lOkZnrtAENAsOGd7mZ5I8D2JRkMKMqLLRlVw=
 gitee.com/xuyiping_admin/go_proto v0.0.0-20231116063239-b531a3099bd3 h1:JN21X8a0RJN1PBMnliQldz4YpO63IogaSVGonXo8dYw=
 gitee.com/xuyiping_admin/go_proto v0.0.0-20231116063239-b531a3099bd3/go.mod h1:x47UOU+lOkZnrtAENAsOGd7mZ5I8D2JRkMKMqLLRlVw=
+gitee.com/xuyiping_admin/go_proto v0.0.0-20231129062310-bbb6722ac3a0 h1:j/zcYZroC7tAhPSNrxgwsTkhYkn4DdjDb8ShNBcVEbw=
+gitee.com/xuyiping_admin/go_proto v0.0.0-20231129062310-bbb6722ac3a0/go.mod h1:x47UOU+lOkZnrtAENAsOGd7mZ5I8D2JRkMKMqLLRlVw=
 gitee.com/xuyiping_admin/pkg v0.0.0-20230822102440-0e489dd5d75a h1:+SSGto+q5BKy6r9FLFQXooTNqZs4tALceFpoo2jef8w=
 gitee.com/xuyiping_admin/pkg v0.0.0-20230822102440-0e489dd5d75a/go.mod h1:vK5K2LnhWZnvZlEY9gmT6GFdq/5Y0mtxuKLNJHFJkE4=
 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=

+ 14 - 0
http/handler/statistic/analysis.go

@@ -559,3 +559,17 @@ func FeedTemplateHistory(c *gin.Context) {
 	}
 	c.JSON(http.StatusOK, res)
 }
+
+func BarnHistory(c *gin.Context) {
+	var req operationPb.BarnHistoryRequest
+	if err := ginutil.BindProto(c, &req); err != nil {
+		apierr.AbortBadRequest(c, http.StatusBadRequest, err)
+		return
+	}
+	res, err := middleware.BackendOperation(c).OpsService.BarnHistory(c, &req)
+	if err != nil {
+		apierr.ClassifiedAbort(c, err)
+		return
+	}
+	c.JSON(http.StatusOK, res)
+}

+ 1 - 0
http/route/ops_api.go

@@ -95,6 +95,7 @@ func OpsAPI(opts ...func(engine *gin.Engine)) func(s *gin.Engine) {
 		opsRoute.POST("/statistics/train_number", statistic.TrainNumber)
 		opsRoute.POST("/statistics/mixed_category_tmr_name", statistic.FeedMixedAndTmrName)
 		opsRoute.POST("/feed_template/history", statistic.FeedTemplateHistory)
+		opsRoute.POST("/barn/history", statistic.BarnHistory)
 		opsRoute.POST("/accuracy/data_by_name", statistic.GetDataByName)
 
 		// 首页仪表盘

+ 12 - 0
model/formula_estimate.go

@@ -411,3 +411,15 @@ type PastureFeedTemplateHistoryResponse struct {
 	Msg  string      `json:"msg"`
 	Data interface{} `json:"data"`
 }
+
+type PastureBarnHistoryRequest struct {
+	BarName   string `json:"barname"`
+	StartDate string `json:"startdate"`
+	EndDate   string `json:"enddate"`
+}
+
+type PastureBarnHistoryResponse struct {
+	Code int32       `json:"code"`
+	Msg  string      `json:"msg"`
+	Data interface{} `json:"data"`
+}

+ 1 - 0
model/group_pasture.go

@@ -24,6 +24,7 @@ const (
 	UrlSummary             = "authdata/summary"
 	UrlProcess             = "authdata/processAnalysist"
 	UrlFeedTemplateHistory = "authdata/feedtemplet/history"
+	UrlBarnHistory         = "authdata/feedp/history"
 )
 
 const (

+ 17 - 0
module/backend/dashboard_service.go

@@ -762,6 +762,23 @@ func (s *StoreEntry) FeedTemplateHistory(ctx context.Context, req *operationPb.F
 	return response, nil
 }
 
+func (s *StoreEntry) BarnHistory(ctx context.Context, req *operationPb.BarnHistoryRequest) (*model.PastureBarnHistoryResponse, error) {
+	_, err := s.GetGroupPastureListById(ctx, int64(req.PastureId))
+	if err != nil {
+		return nil, xerr.WithStack(err)
+	}
+	body := &model.PastureBarnHistoryRequest{
+		BarName:   req.BarnName,
+		StartDate: req.StartTime,
+		EndDate:   req.EndTime,
+	}
+	response := &model.PastureBarnHistoryResponse{}
+	if err = s.PastureHttpClient(ctx, model.UrlBarnHistory, int64(req.PastureId), body, response); err != nil {
+		return nil, xerr.WithStack(err)
+	}
+	return response, nil
+}
+
 func sprinkleExecTimeAnalysis(sprinkleFeedTimeList map[int32]map[int32][]int64) (int32, int32) {
 	var infoSprinkleNumber, errorSprinkleNumber int32 = 0, 0
 	if len(sprinkleFeedTimeList) <= 0 {

+ 1 - 0
module/backend/interface.go

@@ -173,6 +173,7 @@ type StatisticService interface {
 	SprinkleFeedTime(ctx context.Context, req *operationPb.SprinkleFeedTimeRequest) (*model.SprinkleFeedTimeResponse, error)
 	FeedMixedAndTmrName(ctx context.Context, req *operationPb.MixedCategoryTmrName) (*model.PastureCommonResponse, error)
 	FeedTemplateHistory(ctx context.Context, req *operationPb.FeedTemplateHistoryRequest) (*model.PastureFeedTemplateHistoryResponse, error)
+	BarnHistory(ctx context.Context, req *operationPb.BarnHistoryRequest) (*model.PastureBarnHistoryResponse, error)
 }
 
 //go:generate mockgen -destination mock/WxAppletService.go -package kptservicemock kpt-tmr-group/module/backend WxAppletService