|
@@ -61,8 +61,9 @@ func (s *StoreEntry) SearchFormulaEstimateList(ctx context.Context, req *operati
|
|
|
if err != nil {
|
|
|
return nil, xerr.WithStack(err)
|
|
|
}
|
|
|
+ pastureId := req.PastureId
|
|
|
if groupPasture.PastureId > 0 {
|
|
|
- req.PastureId = int32(groupPasture.PastureId)
|
|
|
+ pastureId = int32(groupPasture.PastureId)
|
|
|
}
|
|
|
|
|
|
body := &model.PastureCommonRequest{
|
|
@@ -72,7 +73,7 @@ func (s *StoreEntry) SearchFormulaEstimateList(ctx context.Context, req *operati
|
|
|
PageCount: req.Pagination.PageSize,
|
|
|
ReturnType: "Map",
|
|
|
ParamMaps: &model.FormulaEstimateParams{
|
|
|
- PastureId: fmt.Sprintf("%d", req.PastureId),
|
|
|
+ PastureId: fmt.Sprintf("%d", pastureId),
|
|
|
StartTime: req.StartTime,
|
|
|
StopTime: req.EndTime,
|
|
|
Search: fmt.Sprintf("%d", req.SearchType),
|
|
@@ -93,8 +94,9 @@ func (s *StoreEntry) SearchInventoryStatistics(ctx context.Context, req *operati
|
|
|
if err != nil {
|
|
|
return nil, xerr.WithStack(err)
|
|
|
}
|
|
|
+ pastureId := req.PastureId
|
|
|
if groupPasture.PastureId > 0 {
|
|
|
- req.PastureId = int32(groupPasture.PastureId)
|
|
|
+ pastureId = int32(groupPasture.PastureId)
|
|
|
}
|
|
|
|
|
|
body := &model.PastureCommonRequest{
|
|
@@ -104,7 +106,7 @@ func (s *StoreEntry) SearchInventoryStatistics(ctx context.Context, req *operati
|
|
|
PageCount: req.Pagination.PageSize,
|
|
|
ReturnType: "Map",
|
|
|
ParamMaps: &model.InventoryStatisticsParams{
|
|
|
- PastureId: fmt.Sprintf("%d", req.PastureId),
|
|
|
+ PastureId: fmt.Sprintf("%d", pastureId),
|
|
|
StartTime: req.StartTime,
|
|
|
StopTime: req.EndTime,
|
|
|
FeedName: req.FeedName,
|
|
@@ -214,8 +216,9 @@ func (s *StoreEntry) SearchUserMaterialsStatistics(ctx context.Context, req *ope
|
|
|
if err != nil {
|
|
|
return nil, xerr.WithStack(err)
|
|
|
}
|
|
|
+ pastureId := req.PastureId
|
|
|
if groupPasture.PastureId > 0 {
|
|
|
- req.PastureId = int32(groupPasture.PastureId)
|
|
|
+ pastureId = int32(groupPasture.PastureId)
|
|
|
}
|
|
|
|
|
|
body := &model.PastureCommonRequest{
|
|
@@ -226,7 +229,7 @@ func (s *StoreEntry) SearchUserMaterialsStatistics(ctx context.Context, req *ope
|
|
|
ReturnType: "Map",
|
|
|
Checked: req.ErrorCheck,
|
|
|
ParamMaps: &model.UserMaterialsStatisticsParams{
|
|
|
- PastureId: fmt.Sprintf("%d", req.PastureId),
|
|
|
+ PastureId: fmt.Sprintf("%d", pastureId),
|
|
|
StartTime: req.StartTime,
|
|
|
StopTime: req.EndTime,
|
|
|
FeedName: req.FeedName,
|
|
@@ -327,8 +330,9 @@ func (s *StoreEntry) SearchPriceStatistics(ctx context.Context, req *operationPb
|
|
|
if err != nil {
|
|
|
return nil, xerr.WithStack(err)
|
|
|
}
|
|
|
+ pastureId := req.PastureId
|
|
|
if groupPasture.PastureId > 0 {
|
|
|
- req.PastureId = int32(groupPasture.PastureId)
|
|
|
+ pastureId = int32(groupPasture.PastureId)
|
|
|
}
|
|
|
|
|
|
body := &model.PastureCommonRequest{
|
|
@@ -338,7 +342,7 @@ func (s *StoreEntry) SearchPriceStatistics(ctx context.Context, req *operationPb
|
|
|
PageCount: req.Pagination.PageSize,
|
|
|
ReturnType: "Map",
|
|
|
ParamMaps: &model.PriceStatisticsParams{
|
|
|
- PastureId: fmt.Sprintf("%d", req.PastureId),
|
|
|
+ PastureId: fmt.Sprintf("%d", pastureId),
|
|
|
StartTime: req.StartTime,
|
|
|
StopTime: req.EndTime,
|
|
|
FeedName: req.FeedName,
|
|
@@ -384,6 +388,17 @@ func (s *StoreEntry) SearchFeedStatistics(ctx context.Context, req *operationPb.
|
|
|
for _, v := range req.PastureId {
|
|
|
go func(pastureId int32) {
|
|
|
defer wg.Done()
|
|
|
+
|
|
|
+ groupPasture, err := s.GetGroupPastureListById(ctx, int64(pastureId))
|
|
|
+ if err != nil {
|
|
|
+ zaplog.Error("SearchFeedStatistics", zap.Any("GetGroupPastureListById", err))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ pastureID := pastureId
|
|
|
+ if groupPasture.PastureId > 0 {
|
|
|
+ pastureID = int32(groupPasture.PastureId)
|
|
|
+ }
|
|
|
+
|
|
|
body := &model.PastureCommonRequest{
|
|
|
Name: req.ApiName,
|
|
|
Page: req.Pagination.Page,
|
|
@@ -391,7 +406,7 @@ func (s *StoreEntry) SearchFeedStatistics(ctx context.Context, req *operationPb.
|
|
|
PageCount: req.Pagination.PageSize,
|
|
|
ReturnType: "Map",
|
|
|
ParamMaps: &model.FeedStatisticsParams{
|
|
|
- PastureId: fmt.Sprintf("%d", pastureId),
|
|
|
+ PastureId: fmt.Sprintf("%d", pastureID),
|
|
|
StartTime: req.StartTime,
|
|
|
StopTime: req.StartTime,
|
|
|
Date: req.StartTime,
|
|
@@ -404,8 +419,7 @@ func (s *StoreEntry) SearchFeedStatistics(ctx context.Context, req *operationPb.
|
|
|
response := &model.PastureCommonResponse{
|
|
|
Data: &model.PastureCommonData{},
|
|
|
}
|
|
|
- groupPasture, err := s.PastureHttpClient(ctx, model.UrlDataByName, int64(pastureId), body, response)
|
|
|
- if err != nil {
|
|
|
+ if _, err = s.PastureHttpClient(ctx, model.UrlDataByName, int64(pastureId), body, response); err != nil {
|
|
|
zaplog.Error("SearchFeedStatistics",
|
|
|
zap.Any("pastureId", pastureId),
|
|
|
zap.Any("url", model.UrlDataByName),
|
|
@@ -413,6 +427,7 @@ func (s *StoreEntry) SearchFeedStatistics(ctx context.Context, req *operationPb.
|
|
|
zap.Any("response", response))
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
if response.Code == http.StatusOK && response.Data.List != nil {
|
|
|
if req.ApiName == "getFeedEfficiencySC" {
|
|
|
feedStatisticsConversions := FeedStatisticsConversions(response.Data.List)
|
|
@@ -500,13 +515,14 @@ func (s *StoreEntry) FeedChartStatistics(ctx context.Context, req *operationPb.F
|
|
|
if err != nil {
|
|
|
return nil, xerr.WithStack(err)
|
|
|
}
|
|
|
+ pastureId := req.PastureId
|
|
|
if groupPasture.PastureId > 0 {
|
|
|
- req.PastureId = int32(groupPasture.PastureId)
|
|
|
+ pastureId = int32(groupPasture.PastureId)
|
|
|
}
|
|
|
|
|
|
body := &model.FeedChartParams{
|
|
|
ParamMaps: &model.ParamMaps{
|
|
|
- PastureId: fmt.Sprintf("%d", req.PastureId),
|
|
|
+ PastureId: fmt.Sprintf("%d", pastureId),
|
|
|
StartTime: req.StartTime,
|
|
|
StopTime: req.StartTime,
|
|
|
Status: req.Status,
|
|
@@ -517,7 +533,7 @@ func (s *StoreEntry) FeedChartStatistics(ctx context.Context, req *operationPb.F
|
|
|
return nil, xerr.Customf("错误的接口类型:%s", req.ApiType)
|
|
|
}
|
|
|
response := &model.PastureCommonResponse{Data: &model.PastureCommonData{}}
|
|
|
- if _, err := s.PastureHttpClient(ctx, url, int64(req.PastureId), body, response); err != nil {
|
|
|
+ if _, err = s.PastureHttpClient(ctx, url, int64(req.PastureId), body, response); err != nil {
|
|
|
return nil, xerr.WithStack(err)
|
|
|
}
|
|
|
return response, nil
|
|
@@ -529,8 +545,9 @@ func (s *StoreEntry) CowsAnalysis(ctx context.Context, req *operationPb.CowsAnal
|
|
|
if err != nil {
|
|
|
return nil, xerr.WithStack(err)
|
|
|
}
|
|
|
+ pastureId := req.PastureId
|
|
|
if groupPasture.PastureId > 0 {
|
|
|
- req.PastureId = int32(groupPasture.PastureId)
|
|
|
+ pastureId = int32(groupPasture.PastureId)
|
|
|
}
|
|
|
|
|
|
body := &model.PastureCommonRequest{
|
|
@@ -540,13 +557,13 @@ func (s *StoreEntry) CowsAnalysis(ctx context.Context, req *operationPb.CowsAnal
|
|
|
PageCount: req.Pagination.PageSize,
|
|
|
ReturnType: "Map",
|
|
|
ParamMaps: &model.MixFeedStatisticsParams{
|
|
|
- PastureId: fmt.Sprintf("%d", req.PastureId),
|
|
|
+ PastureId: fmt.Sprintf("%d", pastureId),
|
|
|
StartTime: req.StartTime,
|
|
|
StopTime: req.StartTime,
|
|
|
},
|
|
|
}
|
|
|
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
|
|
@@ -558,13 +575,14 @@ func (s *StoreEntry) SearchAccuracyAggStatistics(ctx context.Context, req *opera
|
|
|
if err != nil {
|
|
|
return nil, xerr.WithStack(err)
|
|
|
}
|
|
|
+ pastureId := req.PastureId
|
|
|
if groupPasture.PastureId > 0 {
|
|
|
- req.PastureId = int32(groupPasture.PastureId)
|
|
|
+ pastureId = int32(groupPasture.PastureId)
|
|
|
}
|
|
|
|
|
|
body := &model.FeedChartParams{
|
|
|
ParamMaps: &model.AccuracyAggParams{
|
|
|
- PastureId: fmt.Sprintf("%d", req.PastureId),
|
|
|
+ PastureId: fmt.Sprintf("%d", pastureId),
|
|
|
StartTime: req.StartTime,
|
|
|
StopTime: req.EndTime,
|
|
|
FName: req.Fname,
|
|
@@ -589,7 +607,7 @@ func (s *StoreEntry) SearchAccuracyAggStatistics(ctx context.Context, req *opera
|
|
|
},
|
|
|
}
|
|
|
response := &model.PastureCommonResponse{Data: &model.PastureCommonData{}}
|
|
|
- if _, err := s.PastureHttpClient(ctx, model.UrlSummary, int64(req.PastureId), body, response); err != nil {
|
|
|
+ if _, err = s.PastureHttpClient(ctx, model.UrlSummary, int64(req.PastureId), body, response); err != nil {
|
|
|
return nil, xerr.WithStack(err)
|
|
|
}
|
|
|
return response, nil
|
|
@@ -601,8 +619,9 @@ func (s *StoreEntry) SearchMixFeedStatistics(ctx context.Context, req *operation
|
|
|
if err != nil {
|
|
|
return nil, xerr.WithStack(err)
|
|
|
}
|
|
|
+ pastureId := req.PastureId
|
|
|
if groupPasture.PastureId > 0 {
|
|
|
- req.PastureId = int32(groupPasture.PastureId)
|
|
|
+ pastureId = int32(groupPasture.PastureId)
|
|
|
}
|
|
|
|
|
|
times := ""
|
|
@@ -617,7 +636,7 @@ func (s *StoreEntry) SearchMixFeedStatistics(ctx context.Context, req *operation
|
|
|
PageCount: req.Pagination.PageSize,
|
|
|
ReturnType: "Map",
|
|
|
ParamMaps: &model.MixFeedStatisticsParams{
|
|
|
- PastureId: fmt.Sprintf("%d", req.PastureId),
|
|
|
+ PastureId: fmt.Sprintf("%d", pastureId),
|
|
|
StartTime: req.StartTime,
|
|
|
StopTime: req.StartTime,
|
|
|
TmrTName: req.EquipmentName,
|
|
@@ -636,7 +655,7 @@ func (s *StoreEntry) SearchMixFeedStatistics(ctx context.Context, req *operation
|
|
|
},
|
|
|
}
|
|
|
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
|
|
@@ -648,8 +667,9 @@ func (s *StoreEntry) SearchSprinkleStatistics(ctx context.Context, req *operatio
|
|
|
if err != nil {
|
|
|
return nil, xerr.WithStack(err)
|
|
|
}
|
|
|
+ pastureId := req.PastureId
|
|
|
if groupPasture.PastureId > 0 {
|
|
|
- req.PastureId = int32(groupPasture.PastureId)
|
|
|
+ pastureId = int32(groupPasture.PastureId)
|
|
|
}
|
|
|
|
|
|
times := ""
|
|
@@ -663,7 +683,7 @@ func (s *StoreEntry) SearchSprinkleStatistics(ctx context.Context, req *operatio
|
|
|
PageCount: req.Pagination.PageSize,
|
|
|
ReturnType: "Map",
|
|
|
ParamMaps: &model.SprinkleStatisticsParams{
|
|
|
- PastureId: fmt.Sprintf("%d", req.PastureId),
|
|
|
+ PastureId: fmt.Sprintf("%d", pastureId),
|
|
|
StartTime: req.StartTime,
|
|
|
StopTime: req.StartTime,
|
|
|
TmrTName: req.EquipmentName,
|
|
@@ -695,8 +715,9 @@ func (s *StoreEntry) SearchProcessAnalysis(ctx context.Context, req *operationPb
|
|
|
if err != nil {
|
|
|
return nil, xerr.WithStack(err)
|
|
|
}
|
|
|
+ pastureId := req.PastureId
|
|
|
if groupPasture.PastureId > 0 {
|
|
|
- req.PastureId = int32(groupPasture.PastureId)
|
|
|
+ pastureId = int32(groupPasture.PastureId)
|
|
|
}
|
|
|
|
|
|
body := &model.PastureCommonRequest{
|
|
@@ -706,7 +727,7 @@ func (s *StoreEntry) SearchProcessAnalysis(ctx context.Context, req *operationPb
|
|
|
PageCount: req.Pagination.PageSize,
|
|
|
ReturnType: "Map",
|
|
|
ParamMaps: &model.ProcessAnalysisParams{
|
|
|
- PastureId: fmt.Sprintf("%d", req.PastureId),
|
|
|
+ PastureId: fmt.Sprintf("%d", pastureId),
|
|
|
StartTime: req.StartTime,
|
|
|
StopTime: req.StartTime,
|
|
|
TmrTName: req.TmrName,
|
|
@@ -737,14 +758,15 @@ func (s *StoreEntry) GetDataByName(ctx context.Context, req *operationPb.GetData
|
|
|
if err != nil {
|
|
|
return nil, xerr.WithStack(err)
|
|
|
}
|
|
|
+ pastureId := req.PastureId
|
|
|
if groupPasture.PastureId > 0 {
|
|
|
- req.PastureId = int32(groupPasture.PastureId)
|
|
|
+ pastureId = int32(groupPasture.PastureId)
|
|
|
}
|
|
|
|
|
|
body := &model.PastureCommonRequest{
|
|
|
Name: req.ApiName,
|
|
|
ParamMaps: &model.GetDataByNameParams{
|
|
|
- PastureId: fmt.Sprintf("%d", req.PastureId),
|
|
|
+ PastureId: fmt.Sprintf("%d", pastureId),
|
|
|
StartTime: req.StartTime,
|
|
|
StopTime: req.StartTime,
|
|
|
},
|
|
@@ -762,8 +784,9 @@ func (s *StoreEntry) GetTrainNumber(ctx context.Context, req *operationPb.TrainN
|
|
|
if err != nil {
|
|
|
return nil, xerr.WithStack(err)
|
|
|
}
|
|
|
+ pastureId := req.PastureId
|
|
|
if groupPasture.PastureId > 0 {
|
|
|
- req.PastureId = int32(groupPasture.PastureId)
|
|
|
+ pastureId = int32(groupPasture.PastureId)
|
|
|
}
|
|
|
|
|
|
body := &model.PastureCommonRequest{
|
|
@@ -773,7 +796,7 @@ func (s *StoreEntry) GetTrainNumber(ctx context.Context, req *operationPb.TrainN
|
|
|
PageCount: req.Pagination.PageSize,
|
|
|
ReturnType: "Map",
|
|
|
ParamMaps: &model.TrainNumberParams{
|
|
|
- PastureId: fmt.Sprintf("%d", req.PastureId),
|
|
|
+ PastureId: fmt.Sprintf("%d", pastureId),
|
|
|
InfoRName: req.InfoName,
|
|
|
},
|
|
|
}
|