|  | @@ -1,16 +1,22 @@
 | 
											
												
													
														|  |  package model
 |  |  package model
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
 |  | 
 | 
											
												
													
														|  | 
 |  | +import (
 | 
											
												
													
														|  | 
 |  | +	"time"
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
 | 
											
												
													
														|  | 
 |  | +)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  type EventMating struct {
 |  |  type EventMating struct {
 | 
											
												
													
														|  |  	Id                int64                           `json:"id"`
 |  |  	Id                int64                           `json:"id"`
 | 
											
												
													
														|  |  	CowId             int64                           `json:"cowId"`
 |  |  	CowId             int64                           `json:"cowId"`
 | 
											
												
													
														|  |  	DayAge            int64                           `json:"dayAge"`
 |  |  	DayAge            int64                           `json:"dayAge"`
 | 
											
												
													
														|  |  	Lact              int8                            `json:"lact"`
 |  |  	Lact              int8                            `json:"lact"`
 | 
											
												
													
														|  | 
 |  | +	CowType           pasturePb.CowType_Kind          `json:"cowType"`
 | 
											
												
													
														|  |  	CalvingAge        int32                           `json:"calvingAge"`
 |  |  	CalvingAge        int32                           `json:"calvingAge"`
 | 
											
												
													
														|  | -	PlanDay           string                          `json:"planDay"`
 |  | 
 | 
											
												
													
														|  | -	EndDay            string                          `json:"endDay"`
 |  | 
 | 
											
												
													
														|  | -	RealityDay        string                          `json:"realityDay"`
 |  | 
 | 
											
												
													
														|  | 
 |  | +	PlanDay           int64                           `json:"planDay"`
 | 
											
												
													
														|  | 
 |  | +	EndDay            int64                           `json:"endDay"`
 | 
											
												
													
														|  | 
 |  | +	CalvingAt         int64                           `json:"calvingAt"`
 | 
											
												
													
														|  | 
 |  | +	RealityDay        int64                           `json:"realityDay"`
 | 
											
												
													
														|  |  	Status            pasturePb.IsShow_Kind           `json:"status"`
 |  |  	Status            pasturePb.IsShow_Kind           `json:"status"`
 | 
											
												
													
														|  |  	MatingNumber      int64                           `json:"matingNumber"`
 |  |  	MatingNumber      int64                           `json:"matingNumber"`
 | 
											
												
													
														|  |  	MatingResult      pasturePb.MatingResult_Kind     `json:"matingResult"`
 |  |  	MatingResult      pasturePb.MatingResult_Kind     `json:"matingResult"`
 | 
											
										
											
												
													
														|  | @@ -28,10 +34,12 @@ func (e *EventMating) TableName() string {
 | 
											
												
													
														|  |  	return "event_mating"
 |  |  	return "event_mating"
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -func NewEventMating(cow *Cow, planDay string) *EventMating {
 |  | 
 | 
											
												
													
														|  | 
 |  | +func NewEventMating(cow *Cow, planDay int64) *EventMating {
 | 
											
												
													
														|  |  	return &EventMating{
 |  |  	return &EventMating{
 | 
											
												
													
														|  |  		CowId:            cow.Id,
 |  |  		CowId:            cow.Id,
 | 
											
												
													
														|  |  		Lact:             int8(cow.Lact),
 |  |  		Lact:             int8(cow.Lact),
 | 
											
												
													
														|  | 
 |  | +		CowType:          cow.CowType,
 | 
											
												
													
														|  | 
 |  | +		CalvingAt:        cow.CalvingAt,
 | 
											
												
													
														|  |  		PlanDay:          planDay,
 |  |  		PlanDay:          planDay,
 | 
											
												
													
														|  |  		EndDay:           planDay,
 |  |  		EndDay:           planDay,
 | 
											
												
													
														|  |  		MatingResult:     pasturePb.MatingResult_Invalid,
 |  |  		MatingResult:     pasturePb.MatingResult_Invalid,
 | 
											
										
											
												
													
														|  | @@ -40,7 +48,7 @@ func NewEventMating(cow *Cow, planDay string) *EventMating {
 | 
											
												
													
														|  |  	}
 |  |  	}
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -func NewEventMatingList(cowList []*Cow, planDay string) []*EventMating {
 |  | 
 | 
											
												
													
														|  | 
 |  | +func NewEventMatingList(cowList []*Cow, planDay int64) []*EventMating {
 | 
											
												
													
														|  |  	var matingList []*EventMating
 |  |  	var matingList []*EventMating
 | 
											
												
													
														|  |  	for _, cow := range cowList {
 |  |  	for _, cow := range cowList {
 | 
											
												
													
														|  |  		matingList = append(matingList, NewEventMating(cow, planDay))
 |  |  		matingList = append(matingList, NewEventMating(cow, planDay))
 | 
											
										
											
												
													
														|  | @@ -59,8 +67,8 @@ func (e EventMatingSlice) ToPB(exposeEstrusTypeMap map[pasturePb.ExposeEstrusTyp
 | 
											
												
													
														|  |  			DayAge:               int32(v.DayAge),
 |  |  			DayAge:               int32(v.DayAge),
 | 
											
												
													
														|  |  			Lact:                 int32(v.Lact),
 |  |  			Lact:                 int32(v.Lact),
 | 
											
												
													
														|  |  			CalvingAge:           v.CalvingAge,
 |  |  			CalvingAge:           v.CalvingAge,
 | 
											
												
													
														|  | -			PlanDay:              v.PlanDay,
 |  | 
 | 
											
												
													
														|  | -			RealityDay:           v.RealityDay,
 |  | 
 | 
											
												
													
														|  | 
 |  | +			PlanDay:              time.Unix(v.PlanDay, 0).Format(LayoutDate2),
 | 
											
												
													
														|  | 
 |  | +			RealityDay:           time.Unix(v.RealityDay, 0).Format(LayoutDate2),
 | 
											
												
													
														|  |  			ExposeEstrusType:     v.ExposeEstrusType,
 |  |  			ExposeEstrusType:     v.ExposeEstrusType,
 | 
											
												
													
														|  |  			ExposeEstrusTypeName: exposeEstrusTypeMap[v.ExposeEstrusType],
 |  |  			ExposeEstrusTypeName: exposeEstrusTypeMap[v.ExposeEstrusType],
 | 
											
												
													
														|  |  			FrozenSemenNumber:    v.FrozenSemenNumber,
 |  |  			FrozenSemenNumber:    v.FrozenSemenNumber,
 | 
											
										
											
												
													
														|  | @@ -132,3 +140,23 @@ func (s CowMatingBodySlice) ToPB(
 | 
											
												
													
														|  |  	}
 |  |  	}
 | 
											
												
													
														|  |  	return res
 |  |  	return res
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +type MatingTimelyChart struct {
 | 
											
												
													
														|  | 
 |  | +	CalvingAge int32  `json:"calvingAge"`
 | 
											
												
													
														|  | 
 |  | +	RealityDay string `json:"realityDay"`
 | 
											
												
													
														|  | 
 |  | +	LactGroup  string `json:"lactGroup"`
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +func (e EventMatingSlice) ToPB2() []*pasturePb.CowList {
 | 
											
												
													
														|  | 
 |  | +	res := make([]*pasturePb.CowList, len(e))
 | 
											
												
													
														|  | 
 |  | +	for i, v := range e {
 | 
											
												
													
														|  | 
 |  | +		res[i] = &pasturePb.CowList{
 | 
											
												
													
														|  | 
 |  | +			CowId:           int32(v.CowId),
 | 
											
												
													
														|  | 
 |  | +			DayAge:          int32(v.DayAge),
 | 
											
												
													
														|  | 
 |  | +			CalvingAge:      v.CalvingAge,
 | 
											
												
													
														|  | 
 |  | +			MatingAtFormat:  time.Unix(v.RealityDay, 0).Format(LayoutDate2),
 | 
											
												
													
														|  | 
 |  | +			CalvingAtFormat: time.Unix(v.CalvingAt, 0).Format(LayoutDate2),
 | 
											
												
													
														|  | 
 |  | +		}
 | 
											
												
													
														|  | 
 |  | +	}
 | 
											
												
													
														|  | 
 |  | +	return res
 | 
											
												
													
														|  | 
 |  | +}
 |