|
@@ -2,14 +2,11 @@ package group
|
|
|
|
|
|
import (
|
|
|
"context"
|
|
|
- "encoding/json"
|
|
|
"net/http"
|
|
|
"tmr-watch/models"
|
|
|
"tmr-watch/module"
|
|
|
- "tmr-watch/pkg/logger/zaplog"
|
|
|
|
|
|
feedPb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/pasture"
|
|
|
- "go.uber.org/zap"
|
|
|
)
|
|
|
|
|
|
func SearchFeedTemplateList(ctx context.Context, req *feedPb.SearchFeedTemplateRequest) (*feedPb.SearchFeedTemplateResponse, error) {
|
|
@@ -60,21 +57,18 @@ func GetFeetTemplateVersion(ctx context.Context, pastureId, feedTemplateId int)
|
|
|
res := &feedPb.GetFeetTemplateVersionResponse{
|
|
|
Code: http.StatusOK,
|
|
|
Msg: "ok",
|
|
|
- Data: make([]*feedPb.FeetTemplateVersionData, 0),
|
|
|
+ Data: &feedPb.FeetTemplateVersionData{
|
|
|
+ Version: int32(newFeedTemplateDetailVersion.Id),
|
|
|
+ List: make([]*feedPb.FeetTemplateVersionList, 0),
|
|
|
+ },
|
|
|
}
|
|
|
|
|
|
- b, _ := json.Marshal(newFeedTemplateDetailVersionLogList)
|
|
|
- c, _ := json.Marshal(historyFeedTemplateDetailList)
|
|
|
- zaplog.Info("newFeedTemplateDetailVersionLogList", zap.String("ok", string(b)))
|
|
|
- zaplog.Info("historyFeedTemplateDetailList", zap.String("ok", string(c)))
|
|
|
-
|
|
|
// 比例两个配方饲料的不同
|
|
|
for _, n := range newFeedTemplateDetailVersionLogList {
|
|
|
-
|
|
|
// 更新
|
|
|
for _, v := range historyFeedTemplateDetailList {
|
|
|
if v.FName == n.ForageName {
|
|
|
- res.Data = append(res.Data, &feedPb.FeetTemplateVersionData{
|
|
|
+ res.Data.List = append(res.Data.List, &feedPb.FeetTemplateVersionList{
|
|
|
ForageName: v.FName,
|
|
|
ForageGroupNameOld: n.ForageName,
|
|
|
ForageGroupName: v.FeedGroup,
|
|
@@ -104,7 +98,7 @@ func GetFeetTemplateVersion(ctx context.Context, pastureId, feedTemplateId int)
|
|
|
}
|
|
|
|
|
|
if !insertInfo {
|
|
|
- res.Data = append(res.Data, &feedPb.FeetTemplateVersionData{
|
|
|
+ res.Data.List = append(res.Data.List, &feedPb.FeetTemplateVersionList{
|
|
|
ForageName: n.ForageName,
|
|
|
ForageGroupName: n.ForageGroupName,
|
|
|
Weight: float32(n.Weight),
|
|
@@ -127,7 +121,7 @@ func GetFeetTemplateVersion(ctx context.Context, pastureId, feedTemplateId int)
|
|
|
}
|
|
|
}
|
|
|
if !deleteInfo {
|
|
|
- res.Data = append(res.Data, &feedPb.FeetTemplateVersionData{
|
|
|
+ res.Data.List = append(res.Data.List, &feedPb.FeetTemplateVersionList{
|
|
|
ForageName: v.FName,
|
|
|
ForageGroupName: v.FeedGroup,
|
|
|
Weight: float32(v.LWeight),
|