瀏覽代碼

feed_template: 饲喂和配方修改记录

Yi 1 年之前
父節點
當前提交
5751183827

+ 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-20231115083432-5a4d773a736c
+	gitee.com/xuyiping_admin/go_proto v0.0.0-20231116063239-b531a3099bd3
 	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

+ 4 - 2
go.sum

@@ -36,8 +36,10 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX
 cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
 cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
 dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
-gitee.com/xuyiping_admin/go_proto v0.0.0-20231115083432-5a4d773a736c h1:80wrZFyWIvWqgrGqkA15wbMNcCTVt8T8XvDs3XnTPY0=
-gitee.com/xuyiping_admin/go_proto v0.0.0-20231115083432-5a4d773a736c/go.mod h1:x47UOU+lOkZnrtAENAsOGd7mZ5I8D2JRkMKMqLLRlVw=
+gitee.com/xuyiping_admin/go_proto v0.0.0-20231116060440-d644eee73ee6 h1:+Lah4VWetGE6dzqmOusq3212dCrVLumib9xscB85mP0=
+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/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=

+ 18 - 3
http/handler/statistic/analysis.go

@@ -2,13 +2,14 @@ package statistic
 
 import (
 	"fmt"
+	"kpt-tmr-group/http/middleware"
+	"net/http"
+	"time"
+
 	operationPb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/operation"
 	"gitee.com/xuyiping_admin/pkg/apierr"
 	"gitee.com/xuyiping_admin/pkg/ginutil"
 	"gitee.com/xuyiping_admin/pkg/valid"
-	"kpt-tmr-group/http/middleware"
-	"net/http"
-	"time"
 
 	"github.com/gin-gonic/gin"
 )
@@ -544,3 +545,17 @@ func FeedMixedAndTmrName(c *gin.Context) {
 	}
 	c.JSON(http.StatusOK, res)
 }
+
+func FeedTemplateHistory(c *gin.Context) {
+	var req operationPb.FeedTemplateHistoryRequest
+	if err := ginutil.BindProto(c, &req); err != nil {
+		apierr.AbortBadRequest(c, http.StatusBadRequest, err)
+		return
+	}
+	res, err := middleware.BackendOperation(c).OpsService.FeedTemplateHistory(c, &req)
+	if err != nil {
+		apierr.ClassifiedAbort(c, err)
+		return
+	}
+	c.JSON(http.StatusOK, res)
+}

+ 3 - 1
http/route/ops_api.go

@@ -89,11 +89,13 @@ func OpsAPI(opts ...func(engine *gin.Engine)) func(s *gin.Engine) {
 		opsRoute.POST("/accuracy/agg_statistics", statistic.SearchAccuracyAggStatistics)
 		opsRoute.POST("/accuracy/mixed_statistics", statistic.SearchMixFeedStatistics)
 		opsRoute.POST("/accuracy/sprinkle_statistics", statistic.SearchSprinkleStatistics)
-		opsRoute.POST("/accuracy/data_by_name", statistic.GetDataByName)
+
 		opsRoute.POST("/process/analysis", statistic.SearchProcessAnalysis)
 		opsRoute.POST("/process/analysis/mixed_sprinkle_detail", statistic.AnalysisMixedSprinkleDetail)
 		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("/accuracy/data_by_name", statistic.GetDataByName)
 
 		// 首页仪表盘
 		opsRoute.POST("/dashboard/accuracy", dashboard.AnalysisAccuracy)

+ 11 - 1
model/formula_estimate.go

@@ -2,6 +2,7 @@ package model
 
 import (
 	"fmt"
+
 	operationPb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/operation"
 )
 
@@ -332,7 +333,9 @@ type GetDataByNameParams struct {
 	StartTime string `json:"startTime"`
 	StopTime  string `json:"stopTime"`
 	Pid       string `json:"pid"`
-	Optdevice string `json:"optdevice"`
+	Optdevice string `json:"optdevice,omitempty"`
+	FtId      int32  `json:"ftid,omitempty"`
+	Name      string `json:"name,omitempty"`
 }
 
 type FeedStatisticsResponse struct {
@@ -387,3 +390,10 @@ func NewMixedSprinkleDetailRequest(pastureId int64, req *operationPb.ProcessMixe
 		Id:        req.Id,
 	}
 }
+
+type PastureFeedTemplateHistoryRequest struct {
+	PastureId string `json:"pastureid"`
+	FTid      int64  `json:"ftid"`
+	StartDate string `json:"startdate"`
+	EndDate   string `json:"enddate"`
+}

+ 6 - 5
model/group_pasture.go

@@ -18,11 +18,12 @@ import (
 )
 
 const (
-	InitManagerPassword = "123456"
-	UrlDataByName       = "authdata/GetDataByName"
-	UrlReportForm       = "authdata/GetReportform"
-	UrlSummary          = "authdata/summary"
-	UrlProcess          = "authdata/processAnalysist"
+	InitManagerPassword    = "123456"
+	UrlDataByName          = "authdata/GetDataByName"
+	UrlReportForm          = "authdata/GetReportform"
+	UrlSummary             = "authdata/summary"
+	UrlProcess             = "authdata/processAnalysist"
+	UrlFeedTemplateHistory = "authdata/feedtemplet/history"
 )
 
 const (

+ 24 - 1
module/backend/dashboard_service.go

@@ -733,7 +733,30 @@ func (s *StoreEntry) FeedMixedAndTmrName(ctx context.Context, req *operationPb.M
 		},
 	}
 	response := &model.PastureCommonResponse{Data: &model.PastureCommonData{}}
-	if err := s.PastureHttpClient(ctx, model.UrlDataByName, int64(req.PastureId), body, response); err != nil {
+	if err = s.PastureHttpClient(ctx, model.UrlDataByName, int64(req.PastureId), body, response); err != nil {
+		return nil, xerr.WithStack(err)
+	}
+	return response, nil
+}
+
+func (s *StoreEntry) FeedTemplateHistory(ctx context.Context, req *operationPb.FeedTemplateHistoryRequest) (*model.PastureCommonResponse, error) {
+	groupPasture, err := s.GetGroupPastureListById(ctx, int64(req.PastureId))
+	if err != nil {
+		return nil, xerr.WithStack(err)
+	}
+	pastureId := req.PastureId
+	if groupPasture.PastureId > 0 {
+		pastureId = int32(groupPasture.PastureId)
+	}
+
+	body := &model.PastureFeedTemplateHistoryRequest{
+		PastureId: fmt.Sprintf("%d", pastureId),
+		FTid:      int64(req.Ftid),
+		StartDate: req.StartTime,
+		EndDate:   req.EndTime,
+	}
+	response := &model.PastureCommonResponse{Data: &model.PastureCommonData{}}
+	if err = s.PastureHttpClient(ctx, model.UrlFeedTemplateHistory, int64(req.PastureId), body, response); err != nil {
 		return nil, xerr.WithStack(err)
 	}
 	return response, nil

+ 1 - 0
module/backend/interface.go

@@ -172,6 +172,7 @@ type StatisticService interface {
 	ExecutionTime(ctx context.Context, req *operationPb.SearchAnalysisAccuracyRequest) (*model.ExecTimeResponse, error)
 	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.PastureCommonResponse, error)
 }
 
 //go:generate mockgen -destination mock/WxAppletService.go -package kptservicemock kpt-tmr-group/module/backend WxAppletService

+ 2 - 0
module/backend/statistic_service.go

@@ -716,6 +716,8 @@ func (s *StoreEntry) GetDataByName(ctx context.Context, req *operationPb.GetData
 			StopTime:  req.StartTime,
 			Pid:       req.Pid,
 			Optdevice: req.Optdevice,
+			FtId:      req.Ftid,
+			Name:      req.Name,
 		},
 	}
 	response := &model.PastureCommonResponse{Data: &model.PastureCommonData{}}