|
@@ -101,6 +101,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai |
|
@@ -101,6 +101,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai |
|
101
|
); err != nil {
|
101
|
); err != nil {
|
|
102
|
return cooperationContract, err
|
102
|
return cooperationContract, err
|
|
103
|
}
|
103
|
}
|
|
|
|
104
|
+
|
|
104
|
// 新增相关人
|
105
|
// 新增相关人
|
|
105
|
var relevantPeopleModel []*models.CooperationContractRelevant
|
106
|
var relevantPeopleModel []*models.CooperationContractRelevant
|
|
106
|
for _, relevant := range cooperationContract.RelevantPeople {
|
107
|
for _, relevant := range cooperationContract.RelevantPeople {
|
|
@@ -116,14 +117,18 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai |
|
@@ -116,14 +117,18 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai |
|
116
|
UserType: relevant.UserType,
|
117
|
UserType: relevant.UserType,
|
|
117
|
Status: relevant.Status,
|
118
|
Status: relevant.Status,
|
|
118
|
Company: relevant.Company,
|
119
|
Company: relevant.Company,
|
|
119
|
- UpdatedAt: time.Now(),
|
120
|
+ UpdatedAt: time.Time{},
|
|
120
|
DeletedAt: time.Time{},
|
121
|
DeletedAt: time.Time{},
|
|
121
|
- CreatedAt: time.Time{},
|
122
|
+ CreatedAt: time.Now(),
|
|
122
|
})
|
123
|
})
|
|
123
|
}
|
124
|
}
|
|
124
|
if len(relevantPeopleModel) > 0 {
|
125
|
if len(relevantPeopleModel) > 0 {
|
|
125
|
- if _, err := tx.Model(&relevantPeopleModel).Insert(); err != nil {
|
126
|
+ if result, err := tx.Model(&relevantPeopleModel).Insert(); err != nil {
|
|
126
|
return nil, err
|
127
|
return nil, err
|
|
|
|
128
|
+ } else {
|
|
|
|
129
|
+ log.Logger.Info("新增的相关人", map[string]interface{}{
|
|
|
|
130
|
+ "relevantPeopleModel": result,
|
|
|
|
131
|
+ })
|
|
127
|
}
|
132
|
}
|
|
128
|
}
|
133
|
}
|
|
129
|
|
134
|
|
|
@@ -640,7 +645,14 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai |
|
@@ -640,7 +645,14 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai |
|
640
|
}
|
645
|
}
|
|
641
|
}
|
646
|
}
|
|
642
|
}
|
647
|
}
|
|
643
|
- return cooperationContract, nil
|
648
|
+ // 返回新增的合约
|
|
|
|
649
|
+ cooperationContractSaved, err := repository.FindOne(map[string]interface{}{
|
|
|
|
650
|
+ "cooperationContractId":cooperationContract.CooperationContractId,
|
|
|
|
651
|
+ })
|
|
|
|
652
|
+ if err != nil {
|
|
|
|
653
|
+ return nil, err
|
|
|
|
654
|
+ }
|
|
|
|
655
|
+ return cooperationContractSaved, nil
|
|
644
|
}
|
656
|
}
|
|
645
|
|
657
|
|
|
646
|
func (repository *CooperationContractRepository) UpdateOne(cooperationContract *domain.CooperationContract) (*domain.CooperationContract, error) {
|
658
|
func (repository *CooperationContractRepository) UpdateOne(cooperationContract *domain.CooperationContract) (*domain.CooperationContract, error) {
|