|
@@ -143,7 +143,16 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai |
|
@@ -143,7 +143,16 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai |
143
|
// 新增承接人
|
143
|
// 新增承接人
|
144
|
var undertakersModel []*models.CooperationContractUndertaker
|
144
|
var undertakersModel []*models.CooperationContractUndertaker
|
145
|
for _, undertaker := range cooperationContract.Undertakers {
|
145
|
for _, undertaker := range cooperationContract.Undertakers {
|
|
|
146
|
+ if undertaker.Identify() == nil {
|
|
|
147
|
+ undertakerId, err := repository.nextIdentify()
|
|
|
148
|
+ if err != nil {
|
|
|
149
|
+ return nil, err
|
|
|
150
|
+ } else {
|
|
|
151
|
+ undertaker.UndertakerId = undertakerId
|
|
|
152
|
+ }
|
|
|
153
|
+ }
|
146
|
undertakersModel = append(undertakersModel, &models.CooperationContractUndertaker{
|
154
|
undertakersModel = append(undertakersModel, &models.CooperationContractUndertaker{
|
|
|
155
|
+ CooperationContractUndertakerId: undertaker.UndertakerId,
|
147
|
CooperationContractNumber: cooperationContract.CooperationContractNumber,
|
156
|
CooperationContractNumber: cooperationContract.CooperationContractNumber,
|
148
|
CooperationContractId: cooperationContract.CooperationContractId,
|
157
|
CooperationContractId: cooperationContract.CooperationContractId,
|
149
|
UserId: undertaker.UserId,
|
158
|
UserId: undertaker.UserId,
|
|
@@ -1063,16 +1072,6 @@ func (repository *CooperationContractRepository) FindOne(queryOptions map[string |
|
@@ -1063,16 +1072,6 @@ func (repository *CooperationContractRepository) FindOne(queryOptions map[string |
1063
|
if cooperationContractModel.CooperationContractId == 0 {
|
1072
|
if cooperationContractModel.CooperationContractId == 0 {
|
1064
|
return nil, nil
|
1073
|
return nil, nil
|
1065
|
} else {
|
1074
|
} else {
|
1066
|
- // 获取共创模式
|
|
|
1067
|
- //cooperationModeModels := new(models.CooperationMode)
|
|
|
1068
|
- //cooperationModeQuery := tx.Model(cooperationModeModels)
|
|
|
1069
|
- //if err := cooperationModeQuery.
|
|
|
1070
|
- // Where("company->>'companyId' = '?'", cooperationContractModel.Company.CompanyId).
|
|
|
1071
|
- // Where("org->>'orgId' = '?'", cooperationContractModel.Org.OrgId).
|
|
|
1072
|
- // Where("cooperation_mode_number = ?", cooperationContractModel.CooperationModeNumber).
|
|
|
1073
|
- // First(); err != nil {
|
|
|
1074
|
- // return nil, fmt.Errorf("共创合约关联的共创模式不存在")
|
|
|
1075
|
- //}
|
|
|
1076
|
var cooperationModeModels []*models.CooperationMode
|
1075
|
var cooperationModeModels []*models.CooperationMode
|
1077
|
cooperationModeQuery := tx.Model(&cooperationModeModels)
|
1076
|
cooperationModeQuery := tx.Model(&cooperationModeModels)
|
1078
|
if countMode, err := cooperationModeQuery.
|
1077
|
if countMode, err := cooperationModeQuery.
|