|
@@ -417,8 +417,7 @@ func (s *StoreEntry) SearchFeedStatistics(ctx context.Context, req *operationPb.
|
|
|
}
|
|
|
|
|
|
if response.Code == http.StatusOK && response.Data.List != nil {
|
|
|
- feedStatisticsConversions := FeedStatisticsConversions(response.Data.List)
|
|
|
- feedStatisticsConversions.PastureName = groupPasture.Name
|
|
|
+ feedStatisticsConversions := FeedStatisticsConversions(response.Data.List, groupPasture.Name)
|
|
|
res.Data.List[groupPasture.Name] = feedStatisticsConversions
|
|
|
}
|
|
|
}(v)
|
|
@@ -429,74 +428,79 @@ func (s *StoreEntry) SearchFeedStatistics(ctx context.Context, req *operationPb.
|
|
|
}
|
|
|
|
|
|
// FeedStatisticsConversions 数据转换
|
|
|
-func FeedStatisticsConversions(req interface{}) *model.FeedStatisticsConversions {
|
|
|
- feedStatisticsList := &model.FeedStatisticsConversions{}
|
|
|
+func FeedStatisticsConversions(req interface{}, pastureName string) []*model.FeedStatisticsConversions {
|
|
|
+ feedStatisticsList := make([]*model.FeedStatisticsConversions, 0)
|
|
|
if data, ok := req.([]interface{}); ok && len(data) > 0 {
|
|
|
- value := data[0]
|
|
|
- if v, yes := value.(map[string]interface{}); yes {
|
|
|
- if d, t := v["TMR干物质"]; t {
|
|
|
- feedStatisticsList.TmrDryMatter = d.(string)
|
|
|
+ for _, value := range data {
|
|
|
+ feedStatistics := &model.FeedStatisticsConversions{
|
|
|
+ PastureName: pastureName,
|
|
|
}
|
|
|
- if d, t := v["barname"]; t {
|
|
|
- feedStatisticsList.BarName = d.(string)
|
|
|
- }
|
|
|
- if d, t := v["产奶量"]; t {
|
|
|
- feedStatisticsList.MilkYield = d.(string)
|
|
|
- }
|
|
|
- if d, t := v["今日剩料量"]; t {
|
|
|
- feedStatisticsList.TodayLeftovers = d.(string)
|
|
|
- }
|
|
|
- if d, t := v["公斤奶饲料成本"]; t {
|
|
|
- feedStatisticsList.FeedCosts = d.(float64)
|
|
|
- }
|
|
|
- if d, t := v["剩料率"]; t {
|
|
|
- feedStatisticsList.LeftoverRate = d.(string)
|
|
|
- }
|
|
|
- if d, t := v["实际干物质采食量"]; t {
|
|
|
- feedStatisticsList.ActualDryMatterIntake = d.(string)
|
|
|
- }
|
|
|
- if d, t := v["实际成本"]; t {
|
|
|
- feedStatisticsList.ActualCost = d.(string)
|
|
|
- }
|
|
|
- if d, t := v["实际牛头数"]; t {
|
|
|
- feedStatisticsList.ActualNumberOfCattle = d.(string)
|
|
|
- }
|
|
|
- if d, t := v["应混料量"]; t {
|
|
|
- feedStatisticsList.AmountToBeMixed = d.(string)
|
|
|
- }
|
|
|
- if d, t := v["混料时间"]; t {
|
|
|
- feedStatisticsList.MixingTime = d.(string)
|
|
|
- }
|
|
|
- if d, t := v["牲畜类别"]; t {
|
|
|
- feedStatisticsList.CategoryCattleName = d.(string)
|
|
|
- }
|
|
|
- if d, t := v["理论干物质"]; t {
|
|
|
- feedStatisticsList.TheoreticalDryMatter = d.(string)
|
|
|
- }
|
|
|
- if d, t := v["转投剩料量"]; t {
|
|
|
- feedStatisticsList.LeftoverMaterial = d.(float64)
|
|
|
- }
|
|
|
- if d, t := v["配方干物质采食量"]; t {
|
|
|
- feedStatisticsList.FormulatedDryMatterIntake = d.(string)
|
|
|
- }
|
|
|
- if d, t := v["配方成本"]; t {
|
|
|
- feedStatisticsList.CostOfFormulation = d.(string)
|
|
|
- }
|
|
|
- if d, t := v["采食率"]; t {
|
|
|
- feedStatisticsList.FoodIntakeRate = d.(string)
|
|
|
- }
|
|
|
- if d, t := v["饲料转化率"]; t {
|
|
|
- feedStatisticsList.FeedConversionRatio = d.(float64)
|
|
|
- }
|
|
|
- if d, t := v["配方模板"]; t {
|
|
|
- feedStatisticsList.FeedFormulaName = d.(string)
|
|
|
- }
|
|
|
- if d, t := v["实际混料量"]; t {
|
|
|
- feedStatisticsList.ActualMixedVolume = d.(string)
|
|
|
- }
|
|
|
- if d, t := v["撒料量"]; t {
|
|
|
- feedStatisticsList.SprinkleVolume = d.(string)
|
|
|
+ if v, yes := value.(map[string]interface{}); yes {
|
|
|
+ if d, t := v["TMR干物质"]; t {
|
|
|
+ feedStatistics.TmrDryMatter = d.(string)
|
|
|
+ }
|
|
|
+ if d, t := v["barname"]; t {
|
|
|
+ feedStatistics.BarName = d.(string)
|
|
|
+ }
|
|
|
+ if d, t := v["产奶量"]; t {
|
|
|
+ feedStatistics.MilkYield = d.(string)
|
|
|
+ }
|
|
|
+ if d, t := v["今日剩料量"]; t {
|
|
|
+ feedStatistics.TodayLeftovers = d.(string)
|
|
|
+ }
|
|
|
+ if d, t := v["公斤奶饲料成本"]; t {
|
|
|
+ feedStatistics.FeedCosts = d.(float64)
|
|
|
+ }
|
|
|
+ if d, t := v["剩料率"]; t {
|
|
|
+ feedStatistics.LeftoverRate = d.(string)
|
|
|
+ }
|
|
|
+ if d, t := v["实际干物质采食量"]; t {
|
|
|
+ feedStatistics.ActualDryMatterIntake = d.(string)
|
|
|
+ }
|
|
|
+ if d, t := v["实际成本"]; t {
|
|
|
+ feedStatistics.ActualCost = d.(string)
|
|
|
+ }
|
|
|
+ if d, t := v["实际牛头数"]; t {
|
|
|
+ feedStatistics.ActualNumberOfCattle = d.(string)
|
|
|
+ }
|
|
|
+ if d, t := v["应混料量"]; t {
|
|
|
+ feedStatistics.AmountToBeMixed = d.(string)
|
|
|
+ }
|
|
|
+ if d, t := v["混料时间"]; t {
|
|
|
+ feedStatistics.MixingTime = d.(string)
|
|
|
+ }
|
|
|
+ if d, t := v["牲畜类别"]; t {
|
|
|
+ feedStatistics.CategoryCattleName = d.(string)
|
|
|
+ }
|
|
|
+ if d, t := v["理论干物质"]; t {
|
|
|
+ feedStatistics.TheoreticalDryMatter = d.(string)
|
|
|
+ }
|
|
|
+ if d, t := v["转投剩料量"]; t {
|
|
|
+ feedStatistics.LeftoverMaterial = d.(float64)
|
|
|
+ }
|
|
|
+ if d, t := v["配方干物质采食量"]; t {
|
|
|
+ feedStatistics.FormulatedDryMatterIntake = d.(string)
|
|
|
+ }
|
|
|
+ if d, t := v["配方成本"]; t {
|
|
|
+ feedStatistics.CostOfFormulation = d.(string)
|
|
|
+ }
|
|
|
+ if d, t := v["采食率"]; t {
|
|
|
+ feedStatistics.FoodIntakeRate = d.(string)
|
|
|
+ }
|
|
|
+ if d, t := v["饲料转化率"]; t {
|
|
|
+ feedStatistics.FeedConversionRatio = d.(float64)
|
|
|
+ }
|
|
|
+ if d, t := v["配方模板"]; t {
|
|
|
+ feedStatistics.FeedFormulaName = d.(string)
|
|
|
+ }
|
|
|
+ if d, t := v["实际混料量"]; t {
|
|
|
+ feedStatistics.ActualMixedVolume = d.(string)
|
|
|
+ }
|
|
|
+ if d, t := v["撒料量"]; t {
|
|
|
+ feedStatistics.SprinkleVolume = d.(string)
|
|
|
+ }
|
|
|
}
|
|
|
+ feedStatisticsList = append(feedStatisticsList, feedStatistics)
|
|
|
}
|
|
|
}
|
|
|
return feedStatisticsList
|