12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- package model
- import (
- "strings"
- pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
- )
- type EventSale struct {
- Id int64 `json:"id"`
- PastureId int64 `json:"pastureId"`
- DealerId int32 `json:"dealerId"`
- DealerName string `json:"dealerName"`
- SalePrice float64 `json:"salePrice"`
- SaleAllWeight int32 `json:"saleAllWeight"`
- SaleAllAmount float64 `json:"saleAllAmount"`
- SaleCowCount int32 `json:"saleCowCount"`
- CowIds string `json:"cowIds"`
- SaleAt int64 `json:"saleAt"`
- SaleTicker string `json:"saleTicker"`
- QuarantineReport string `json:"quarantineReport"`
- Remarks string `json:"remarks"`
- OperationId int64 `json:"operationId"`
- OperationName string `json:"operationName"`
- MessageId int64 `json:"messageId"`
- MessageName string `json:"messageName"`
- CreatedAt int64 `json:"createdAt"`
- UpdatedAt int64 `json:"updatedAt"`
- }
- func (e *EventSale) TableName() string {
- return "event_sale"
- }
- func NewEventSale(pastureId int64, dealerInfo *SaleDealer, cowIds string, req *pasturePb.EventCowSale, operationUser, currUser *SystemUser) *EventSale {
- return &EventSale{
- PastureId: pastureId,
- DealerId: dealerInfo.Id,
- DealerName: dealerInfo.Name,
- SalePrice: float64(req.SalePrice),
- SaleAllWeight: int32(req.SaleAllWeight * 1000),
- SaleAllAmount: float64(req.SaleAllPrice),
- SaleCowCount: int32(len(req.CowIds)),
- CowIds: cowIds,
- SaleAt: int64(req.SaleAt),
- SaleTicker: strings.Join(req.SaleTicket, ","),
- QuarantineReport: strings.Join(req.QuarantineReport, ","),
- Remarks: req.Remarks,
- OperationId: operationUser.Id,
- OperationName: operationUser.Name,
- MessageId: currUser.Id,
- MessageName: currUser.Name,
- }
- }
|