|
@@ -77,9 +77,17 @@ func (s *StoreEntry) CalvingCreate(ctx context.Context, req *pasturePb.EventCalv
|
|
|
defer func() {
|
|
|
if err == nil {
|
|
|
// 母牛事件日志
|
|
|
- cowLogs := s.SubmitEventLog(ctx, cow, pasturePb.EventType_Calving, req)
|
|
|
+ cowLogs := s.SubmitEventLog(ctx, cow, pasturePb.EventType_Calving, pasturePb.ExposeEstrusType_Invalid, req)
|
|
|
s.DB.Table(cowLogs.TableName()).Create(cowLogs)
|
|
|
- // todo 犊牛的
|
|
|
+ // 犊牛事件日志
|
|
|
+ for _, v := range req.CalfItemList {
|
|
|
+ if v.IsLive == pasturePb.IsShow_No || v.IsAdoption == pasturePb.IsShow_No {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ cow, _ = s.GetCowInfoByCowId(ctx, int64(v.CowId))
|
|
|
+ cowLogs = s.SubmitEventLog(ctx, cow, pasturePb.EventType_Birth, pasturePb.ExposeEstrusType_Invalid, v)
|
|
|
+ s.DB.Table(cowLogs.TableName()).Create(cowLogs)
|
|
|
+ }
|
|
|
}
|
|
|
}()
|
|
|
|
|
@@ -118,16 +126,11 @@ func (s *StoreEntry) CalvingCreate(ctx context.Context, req *pasturePb.EventCalv
|
|
|
}
|
|
|
|
|
|
// 更新母牛信息
|
|
|
- if err = tx.Model(new(model.Cow)).Where("id = ?", cow.Id).
|
|
|
- Updates(map[string]interface{}{
|
|
|
- "calving_age": int32(time.Now().Sub(time.Unix(int64(req.CalvingAt), 0)).Hours() / 24),
|
|
|
- "mating_times": 0,
|
|
|
- "pregnancy_age": 0,
|
|
|
- "lact": cow.Lact + 1,
|
|
|
- "breed_status": pasturePb.BreedStatus_Calving,
|
|
|
- "is_pregnant": pasturePb.IsShow_No,
|
|
|
- "last_calving_at": int64(req.CalvingAt),
|
|
|
- }).Error; err != nil {
|
|
|
+ cow.EventCalvingUpdate(int64(req.CalvingAt))
|
|
|
+ if err = tx.Model(cow).
|
|
|
+ Select("calving_age,mating_times,pregnancy_age,lact,breed_status,is_pregnant,last_calving_at").
|
|
|
+ Where("id = ?", cow.Id).
|
|
|
+ Updates(cow).Error; err != nil {
|
|
|
return xerr.WithStack(err)
|
|
|
}
|
|
|
return nil
|
|
@@ -177,8 +180,7 @@ func (s *StoreEntry) EstrusList(ctx context.Context, req *pasturePb.EstrusItemsR
|
|
|
}, nil
|
|
|
}
|
|
|
|
|
|
-func (s *StoreEntry) EstrusBatch(ctx context.Context, req *pasturePb.EventEstrus) error {
|
|
|
- eventMatingList := make([]*model.EventMating, 0)
|
|
|
+func (s *StoreEntry) EstrusBatch(ctx context.Context, req *pasturePb.EventEstrus) (err error) {
|
|
|
currentUser, err := s.GetCurrentSystemUser(ctx)
|
|
|
if err != nil {
|
|
|
return xerr.Custom("当前用户信息错误")
|
|
@@ -187,8 +189,10 @@ func (s *StoreEntry) EstrusBatch(ctx context.Context, req *pasturePb.EventEstrus
|
|
|
if err != nil {
|
|
|
return xerr.Customf("该用户不存在: %d", req.OperationId)
|
|
|
}
|
|
|
+ req.OperationName = operationUser.Name
|
|
|
|
|
|
eventEstrusIds := make([]string, 0)
|
|
|
+ eventMatingList := make([]*model.EventMating, 0)
|
|
|
for _, cowId := range req.CowIds {
|
|
|
cowInfo := GetCowInfoByCowId(s.DB, int64(cowId))
|
|
|
if cowInfo == nil {
|
|
@@ -212,10 +216,19 @@ func (s *StoreEntry) EstrusBatch(ctx context.Context, req *pasturePb.EventEstrus
|
|
|
}
|
|
|
eventMatingList = append(eventMatingList, newEventMating)
|
|
|
}
|
|
|
-
|
|
|
if len(eventMatingList) <= 0 {
|
|
|
return nil
|
|
|
}
|
|
|
+ defer func() {
|
|
|
+ // 记录牛只事件日志
|
|
|
+ if err == nil {
|
|
|
+ for _, v := range eventMatingList {
|
|
|
+ cow, _ := s.GetCowInfoByCowId(ctx, v.CowId)
|
|
|
+ cowLogs := s.SubmitEventLog(ctx, cow, pasturePb.EventType_Mating, pasturePb.ExposeEstrusType_Neck_Ring, req)
|
|
|
+ s.DB.Table(cowLogs.TableName()).Create(cowLogs)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }()
|
|
|
|
|
|
if err = s.DB.Transaction(func(tx *gorm.DB) error {
|
|
|
if len(eventEstrusIds) > 0 {
|
|
@@ -241,90 +254,111 @@ func (s *StoreEntry) EstrusBatch(ctx context.Context, req *pasturePb.EventEstrus
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-func (s *StoreEntry) SameTimeCreate(ctx context.Context, req *pasturePb.EventSameTime) error {
|
|
|
- eventCowSameTime, err := s.GetEventCowSameTimeById(ctx, int64(req.Id))
|
|
|
+func (s *StoreEntry) SameTimeCreate(ctx context.Context, req *pasturePb.EventSameTime) (err error) {
|
|
|
+ eventCowSameTime, err := s.GetEventCowSameTimeByCowId(ctx, int64(req.CowId))
|
|
|
if err != nil {
|
|
|
- return xerr.WithStack(err)
|
|
|
- }
|
|
|
-
|
|
|
- if eventCowSameTime.Status == pasturePb.IsShow_Ok {
|
|
|
- return xerr.Custom("该事件已处理")
|
|
|
- }
|
|
|
-
|
|
|
- if eventCowSameTime.CowId != int64(req.CowId) {
|
|
|
- return xerr.Custom("牛只Id 不匹配")
|
|
|
+ zaplog.Error("SameTimeCreate", zap.Any("err", err), zap.Any("req", req))
|
|
|
+ return xerr.Customf("异常数据")
|
|
|
}
|
|
|
|
|
|
drugs := &model.Drugs{}
|
|
|
- if req.DrugsId > 0 {
|
|
|
- if drugs, err = s.GetDrugsById(ctx, int64(req.DrugsId)); err != nil {
|
|
|
- return xerr.WithStack(err)
|
|
|
- }
|
|
|
+ if drugs, err = s.GetDrugsById(ctx, int64(req.DrugsId)); err != nil {
|
|
|
+ zaplog.Error("SameTimeCreate", zap.Any("err", err), zap.Any("req", req))
|
|
|
+ return xerr.Customf("该药品不存在: %d", req.DrugsId)
|
|
|
}
|
|
|
+ req.DrugsName = drugs.Name
|
|
|
+
|
|
|
operationUser, err := s.GetSystemUserById(ctx, int64(req.OperationId))
|
|
|
if err != nil {
|
|
|
return xerr.WithStack(err)
|
|
|
}
|
|
|
|
|
|
- if err = s.DB.Transaction(func(tx *gorm.DB) error {
|
|
|
- if err = tx.Model(new(model.CowSameTime)).
|
|
|
- Where("cow_id = ?", eventCowSameTime.CowId).
|
|
|
- Where("same_time_id = ?", eventCowSameTime.Id).
|
|
|
- Where("same_time_status = ?", pasturePb.SameTimeStatus_No_Start).
|
|
|
- Update("same_time_status", pasturePb.SameTimeStatus_In_Progress).Error; err != nil {
|
|
|
- zaplog.Error("SameTimeCreate", zap.Any("err", err), zap.Any("req", req))
|
|
|
- }
|
|
|
+ currentUser, err := s.GetCurrentSystemUser(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return xerr.Custom("当前用户信息错误")
|
|
|
+ }
|
|
|
|
|
|
- if err = tx.Model(new(model.EventCowSameTime)).
|
|
|
- Where("id = ?", eventCowSameTime.Id).
|
|
|
- Where("cow_id = ?", eventCowSameTime.CowId).
|
|
|
- Where("status = ?", pasturePb.IsShow_No).
|
|
|
- Updates(map[string]interface{}{
|
|
|
- "status": pasturePb.IsShow_Ok,
|
|
|
- "drug_id": drugs.Id,
|
|
|
- "unit": drugs.Unit,
|
|
|
- "usage": req.Usage,
|
|
|
- "remarks": req.Remarks,
|
|
|
- "operation_id": operationUser.Id,
|
|
|
- "operation_name": operationUser.Name,
|
|
|
- }).Error; err != nil {
|
|
|
- return xerr.WithStack(err)
|
|
|
+ eventCowSameTime.Update(drugs, req.Usage, req.Remarks, operationUser, currentUser)
|
|
|
+ defer func() {
|
|
|
+ if err == nil {
|
|
|
+ // 记录牛只事件日志
|
|
|
+ cow, _ := s.GetCowInfoByCowId(ctx, eventCowSameTime.CowId)
|
|
|
+ cowLogs := s.SubmitEventLog(ctx, cow, pasturePb.EventType_Seme_Time, pasturePb.ExposeEstrusType_Same_Time, req)
|
|
|
+ s.DB.Table(cowLogs.TableName()).Create(cowLogs)
|
|
|
+
|
|
|
+ if err = s.DB.Model(new(model.CowSameTime)).
|
|
|
+ Where("cow_id = ?", eventCowSameTime.CowId).
|
|
|
+ Where("same_time_id = ?", eventCowSameTime.Id).
|
|
|
+ Where("same_time_status = ?", pasturePb.SameTimeStatus_No_Start).
|
|
|
+ Update("same_time_status", pasturePb.SameTimeStatus_In_Progress).Error; err != nil {
|
|
|
+ zaplog.Error("SameTimeCreate", zap.Any("err", err), zap.Any("req", req))
|
|
|
+ }
|
|
|
}
|
|
|
- return nil
|
|
|
- }); err != nil {
|
|
|
+ }()
|
|
|
+
|
|
|
+ if err = s.DB.Model(new(model.EventCowSameTime)).
|
|
|
+ Select("status,drugs_id,unit,usage,remarks,operation_id,operation_name").
|
|
|
+ Where("id = ?", eventCowSameTime.Id).
|
|
|
+ Updates(eventCowSameTime).Error; err != nil {
|
|
|
return xerr.WithStack(err)
|
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-func (s *StoreEntry) SameTimeBatch(ctx context.Context, req *pasturePb.EventSameTimeBatch) error {
|
|
|
- drugs := &model.Drugs{}
|
|
|
- var err error
|
|
|
- if req.DrugsId > 0 {
|
|
|
- if drugs, err = s.GetDrugsById(ctx, int64(req.DrugsId)); err != nil {
|
|
|
- return xerr.WithStack(err)
|
|
|
- }
|
|
|
- }
|
|
|
+func (s *StoreEntry) SameTimeBatch(ctx context.Context, req *pasturePb.EventSameTimeBatch) (err error) {
|
|
|
operationUser, err := s.GetSystemUserById(ctx, int64(req.OperationId))
|
|
|
if err != nil {
|
|
|
- return xerr.WithStack(err)
|
|
|
+ return xerr.Customf("异常数据")
|
|
|
+ }
|
|
|
+ req.OperationName = operationUser.Name
|
|
|
+
|
|
|
+ currentUser, err := s.GetCurrentSystemUser(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return xerr.Customf("异常数据")
|
|
|
+ }
|
|
|
+ drugs := &model.Drugs{}
|
|
|
+ if drugs, err = s.GetDrugsById(ctx, int64(req.DrugsId)); err != nil {
|
|
|
+ zaplog.Error("SameTimeBatch", zap.Any("err", err), zap.Any("req", req))
|
|
|
+ return xerr.Customf("该药物不存在: %d", req.DrugsId)
|
|
|
}
|
|
|
+ req.DrugsName = drugs.Name
|
|
|
+
|
|
|
eventCowSameTimeList := make([]*model.EventCowSameTime, 0)
|
|
|
- for _, v := range req.Item {
|
|
|
- eventCowSameTime, err := s.GetEventCowSameTimeById(ctx, int64(v.Id))
|
|
|
+ for _, v := range req.CowIds {
|
|
|
+ eventCowSameTime, err := s.GetEventCowSameTimeByCowId(ctx, int64(v))
|
|
|
if err != nil {
|
|
|
+ zaplog.Error("SameTimeCreate", zap.Any("err", err), zap.Any("req", req))
|
|
|
return xerr.WithStack(err)
|
|
|
}
|
|
|
-
|
|
|
- if eventCowSameTime.Status == pasturePb.IsShow_Ok {
|
|
|
- return xerr.Custom("该事件已处理")
|
|
|
- }
|
|
|
-
|
|
|
- if eventCowSameTime.CowId != int64(v.CowId) {
|
|
|
- return xerr.Custom(" 牛只Id 不匹配")
|
|
|
- }
|
|
|
eventCowSameTimeList = append(eventCowSameTimeList, eventCowSameTime)
|
|
|
}
|
|
|
+ defer func() {
|
|
|
+ // 记录牛只事件日志
|
|
|
+ if err == nil {
|
|
|
+ for _, v := range eventCowSameTimeList {
|
|
|
+ cow, _ := s.GetCowInfoByCowId(ctx, v.CowId)
|
|
|
+ cowLogs := s.SubmitEventLog(
|
|
|
+ ctx,
|
|
|
+ cow,
|
|
|
+ pasturePb.EventType_Seme_Time,
|
|
|
+ pasturePb.ExposeEstrusType_Same_Time,
|
|
|
+ &pasturePb.EventSameTime{
|
|
|
+ Id: int32(v.Id),
|
|
|
+ CowId: int32(v.CowId),
|
|
|
+ SameTimeId: int32(v.SameTimeId),
|
|
|
+ SameTimeType: v.SameTimeType,
|
|
|
+ SameTimeTypeName: v.SameTimeName,
|
|
|
+ DrugsId: int32(v.DrugsId),
|
|
|
+ DrugsName: drugs.Name,
|
|
|
+ Usage: req.Usage,
|
|
|
+ OperationId: int32(operationUser.Id),
|
|
|
+ OperationName: operationUser.Name,
|
|
|
+ SameTimeAt: req.SameTimeAt,
|
|
|
+ })
|
|
|
+ s.DB.Table(cowLogs.TableName()).Create(cowLogs)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }()
|
|
|
|
|
|
if err = s.DB.Transaction(func(tx *gorm.DB) error {
|
|
|
for _, v := range eventCowSameTimeList {
|
|
@@ -336,19 +370,12 @@ func (s *StoreEntry) SameTimeBatch(ctx context.Context, req *pasturePb.EventSame
|
|
|
zaplog.Error("SameTimeCreate", zap.Any("err", err), zap.Any("req", req))
|
|
|
}
|
|
|
|
|
|
+ // 更新SameTime
|
|
|
+ v.Update(drugs, req.Usage, req.Remarks, currentUser, operationUser)
|
|
|
if err = tx.Model(new(model.EventCowSameTime)).
|
|
|
+ Select("status,drugs_id,unit,usage,remarks,operation_id,operation_name").
|
|
|
Where("id = ?", v.Id).
|
|
|
- Where("cow_id = ?", v.CowId).
|
|
|
- Where("status = ?", pasturePb.IsShow_No).
|
|
|
- Updates(map[string]interface{}{
|
|
|
- "status": pasturePb.IsShow_Ok,
|
|
|
- "drugs_id": drugs.Id,
|
|
|
- "unit": drugs.Unit,
|
|
|
- "usage": req.Usage,
|
|
|
- "remarks": req.Remarks,
|
|
|
- "operation_id": operationUser.Id,
|
|
|
- "operation_name": operationUser.Name,
|
|
|
- }).Error; err != nil {
|
|
|
+ Updates(v).Error; err != nil {
|
|
|
return xerr.WithStack(err)
|
|
|
}
|
|
|
}
|
|
@@ -423,7 +450,8 @@ func (s *StoreEntry) MatingList(ctx context.Context, req *pasturePb.SearchEventR
|
|
|
}, nil
|
|
|
}
|
|
|
|
|
|
-func (s *StoreEntry) MatingCreate(ctx context.Context, req *pasturePb.EventMating) error {
|
|
|
+// MatingCreate 牛只配种
|
|
|
+func (s *StoreEntry) MatingCreate(ctx context.Context, req *pasturePb.EventMating) (err error) {
|
|
|
eventCheckModel, err := s.MatingCreateCheck(ctx, req)
|
|
|
if err != nil {
|
|
|
return xerr.WithStack(err)
|
|
@@ -507,6 +535,16 @@ func (s *StoreEntry) MatingCreate(ctx context.Context, req *pasturePb.EventMatin
|
|
|
)
|
|
|
return xerr.Custom("配种信息有误")
|
|
|
}
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ // 记录事件日志
|
|
|
+ for _, cowId := range cowIds {
|
|
|
+ cow, _ := s.GetCowInfoByCowId(ctx, cowId)
|
|
|
+ cowLogs := s.SubmitEventLog(ctx, cow, pasturePb.EventType_Mating, req.ExposeEstrusType, req)
|
|
|
+ s.DB.Table(cowLogs.TableName()).Create(cowLogs)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }()
|
|
|
|
|
|
itemFrozenSemenLog := model.NewEventFrozenSemenLog(req)
|
|
|
if err = s.DB.Transaction(func(tx *gorm.DB) error {
|
|
@@ -515,16 +553,9 @@ func (s *StoreEntry) MatingCreate(ctx context.Context, req *pasturePb.EventMatin
|
|
|
if err = tx.Model(new(model.EventMating)).
|
|
|
Where("id IN ?", updateMatingList).
|
|
|
Where("status = ?", pasturePb.IsShow_No).
|
|
|
- Updates(map[string]interface{}{
|
|
|
- "mating_result": pasturePb.MatingResult_Unknown,
|
|
|
- "status": pasturePb.IsShow_Ok,
|
|
|
- "reality_day": int64(req.MatingAt),
|
|
|
- "frozen_semen_number": req.FrozenSemenNumber,
|
|
|
- "operation_id": eventCheckModel.OperationUser.Id,
|
|
|
- "operation_name": eventCheckModel.OperationUser.Name,
|
|
|
- "message_id": eventCheckModel.CurrentUser.Id,
|
|
|
- "message_name": eventCheckModel.CurrentUser.Name,
|
|
|
- }).Error; err != nil {
|
|
|
+ Updates(
|
|
|
+ model.EventMatingUpdateMap(int64(req.MatingAt), req.FrozenSemenNumber, eventCheckModel.OperationUser, eventCheckModel.CurrentUser),
|
|
|
+ ).Error; err != nil {
|
|
|
return xerr.WithStack(err)
|
|
|
}
|
|
|
}
|
|
@@ -610,7 +641,6 @@ func (s *StoreEntry) MatingCreate(ctx context.Context, req *pasturePb.EventMatin
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
return nil
|
|
|
}); err != nil {
|
|
|
return xerr.WithStack(err)
|
|
@@ -619,7 +649,7 @@ func (s *StoreEntry) MatingCreate(ctx context.Context, req *pasturePb.EventMatin
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-func (s *StoreEntry) WeaningBatch(ctx context.Context, req *pasturePb.EventWeaningBatchRequest) error {
|
|
|
+func (s *StoreEntry) WeaningBatch(ctx context.Context, req *pasturePb.EventWeaningBatchRequest) (err error) {
|
|
|
if len(req.Item) <= 0 {
|
|
|
return nil
|
|
|
}
|
|
@@ -631,8 +661,7 @@ func (s *StoreEntry) WeaningBatch(ctx context.Context, req *pasturePb.EventWeani
|
|
|
}
|
|
|
|
|
|
eventWeaningList := make([]*model.EventWeaning, 0)
|
|
|
-
|
|
|
- if err := s.DB.Model(new(model.EventWeaning)).
|
|
|
+ if err = s.DB.Model(new(model.EventWeaning)).
|
|
|
Where("cow_id IN ?", cowIds).
|
|
|
Where("status = ?", pasturePb.IsShow_No).
|
|
|
Find(&eventWeaningList).Error; err != nil {
|
|
@@ -649,27 +678,50 @@ func (s *StoreEntry) WeaningBatch(ctx context.Context, req *pasturePb.EventWeani
|
|
|
return xerr.WithStack(err)
|
|
|
}
|
|
|
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ for _, cowId := range cowIds {
|
|
|
+ cow, _ := s.GetCowInfoByCowId(ctx, cowId)
|
|
|
+ cowLogs := s.SubmitEventLog(ctx, cow, pasturePb.EventType_Weaning, pasturePb.ExposeEstrusType_Invalid, req)
|
|
|
+ s.DB.Table(cowLogs.TableName()).Create(cowLogs)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
if err = s.DB.Transaction(func(tx *gorm.DB) error {
|
|
|
+ cowInfo := &model.Cow{}
|
|
|
for _, v := range eventWeaningList {
|
|
|
- if err = tx.Model(new(model.EventWeaning)).Where("id = ?", v.Id).Updates(map[string]interface{}{
|
|
|
- "status": pasturePb.IsShow_Ok,
|
|
|
- "reality_day": int64(req.WeaningAt),
|
|
|
- "operation_id": req.OperationId,
|
|
|
- "operation_name": operation.Name,
|
|
|
- "message_id": currentUser.Id,
|
|
|
- "message_name": currentUser.Name,
|
|
|
- "remarks": req.Remarks,
|
|
|
- "after_pen_id": req.PenId,
|
|
|
- }).Error; err != nil {
|
|
|
+ v.EventUpdate(int64(req.WeaningAt), req.Remarks, req.PenId, operation, currentUser)
|
|
|
+ if err = tx.Model(new(model.EventWeaning)).
|
|
|
+ Select("status,reality_day,operation_id,operation_name,message_id,message_name,remarks,after_pen_id").
|
|
|
+ Where("id = ?", v.Id).
|
|
|
+ Updates(v).Error; err != nil {
|
|
|
return xerr.WithStack(err)
|
|
|
}
|
|
|
-
|
|
|
- if err = tx.Model(new(model.Cow)).Where("id = ?", v.CowId).Updates(map[string]interface{}{
|
|
|
- "pen_id": req.PenId,
|
|
|
- "current_weight": cowWeightMap[v.CowId],
|
|
|
- "weaning_at": req.WeaningAt,
|
|
|
- "last_weight_at": req.WeaningAt,
|
|
|
- }).Error; err != nil {
|
|
|
+ cowInfo, err = s.GetCowInfoByCowId(ctx, v.CowId)
|
|
|
+ if err != nil {
|
|
|
+ return xerr.WithStack(err)
|
|
|
+ }
|
|
|
+ cowInfo.EventWeaningUpdate(int64(req.WeaningAt), req.PenId, int64(cowWeightMap[cowInfo.Id]*1000))
|
|
|
+ if err = tx.Model(new(model.Cow)).
|
|
|
+ Select("pen_id,current_weight,weaning_at,last_weight_at").
|
|
|
+ Where("id = ?", v.CowId).
|
|
|
+ Updates(cowInfo).Error; err != nil {
|
|
|
+ return xerr.WithStack(err)
|
|
|
+ }
|
|
|
+ // 创建牛只的体重记录
|
|
|
+ newEventWeight := model.NewEventWeight(
|
|
|
+ cowInfo,
|
|
|
+ currentUser,
|
|
|
+ int32(cowWeightMap[v.CowId]*1000),
|
|
|
+ 0,
|
|
|
+ &pasturePb.EventWeight{
|
|
|
+ WeightAt: req.WeaningAt,
|
|
|
+ OperationId: req.OperationId,
|
|
|
+ OperationName: req.OperationName,
|
|
|
+ Remarks: req.Remarks,
|
|
|
+ })
|
|
|
+ if err = tx.Create(newEventWeight).Error; err != nil {
|
|
|
return xerr.WithStack(err)
|
|
|
}
|
|
|
}
|