...
|
...
|
@@ -434,27 +434,27 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai |
|
|
"待更新的承接人": undertakerModelsToUpdate,
|
|
|
})
|
|
|
for i, undertakerModelToUpdate := range undertakerModelsToUpdate {
|
|
|
for j, undertaker := range cooperationContract.Undertakers {
|
|
|
for _, undertaker := range cooperationContract.Undertakers {
|
|
|
if undertaker.UndertakerId == undertakerModelToUpdate.CooperationContractUndertakerId {
|
|
|
undertakerModelsToUpdate[i] = &models.CooperationContractUndertaker{
|
|
|
CooperationContractUndertakerId: cooperationContract.Undertakers[j].UndertakerId,
|
|
|
CooperationContractNumber: cooperationContract.Undertakers[j].CooperationContractNumber,
|
|
|
UserId: cooperationContract.Undertakers[j].UserId,
|
|
|
UserBaseId: cooperationContract.Undertakers[j].UserBaseId,
|
|
|
Org: cooperationContract.Undertakers[j].Org,
|
|
|
Orgs: cooperationContract.Undertakers[j].Orgs,
|
|
|
Department: cooperationContract.Undertakers[j].Department,
|
|
|
Roles: cooperationContract.Undertakers[j].Roles,
|
|
|
UserInfo: cooperationContract.Undertakers[j].UserInfo,
|
|
|
UserType: cooperationContract.Undertakers[j].UserType,
|
|
|
Referrer: cooperationContract.Undertakers[j].Referrer,
|
|
|
Salesman: cooperationContract.Undertakers[j].Salesman,
|
|
|
Status: cooperationContract.Undertakers[j].Status,
|
|
|
Company: cooperationContract.Undertakers[j].Company,
|
|
|
ContractAttachment: cooperationContract.Undertakers[j].ContractAttachment,
|
|
|
CreatedAt: undertakerModelsToUpdate[i].CreatedAt,
|
|
|
CooperationContractUndertakerId: undertaker.UndertakerId,
|
|
|
CooperationContractNumber: undertaker.CooperationContractNumber,
|
|
|
UserId: undertaker.UserId,
|
|
|
UserBaseId: undertaker.UserBaseId,
|
|
|
Org: undertaker.Org,
|
|
|
Orgs: undertaker.Orgs,
|
|
|
Department: undertaker.Department,
|
|
|
Roles: undertaker.Roles,
|
|
|
UserInfo: undertaker.UserInfo,
|
|
|
UserType: undertaker.UserType,
|
|
|
Referrer: undertaker.Referrer,
|
|
|
Salesman: undertaker.Salesman,
|
|
|
Status: undertaker.Status,
|
|
|
Company: undertaker.Company,
|
|
|
ContractAttachment: undertaker.ContractAttachment,
|
|
|
CreatedAt: undertakerModelToUpdate.CreatedAt,
|
|
|
UpdatedAt: time.Now(),
|
|
|
DeletedAt: undertakerModelsToUpdate[i].DeletedAt,
|
|
|
DeletedAt: undertakerModelToUpdate.DeletedAt,
|
|
|
}
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -558,7 +558,30 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai |
|
|
log.Logger.Info("待更新的分红激励规则", map[string]interface{}{
|
|
|
"dividendsRuleModelsToUpdate": dividendsRuleModelsToUpdate,
|
|
|
})
|
|
|
|
|
|
if len(dividendsRuleModelsToUpdate) > 0 {
|
|
|
for i, dividendsRuleModelToUpdate := range dividendsRuleModelsToUpdate {
|
|
|
for _, dividendsRule := range cooperationContract.DividendsIncentivesRules {
|
|
|
if dividendsRule.DividendsIncentivesRuleId == dividendsRuleModelToUpdate.DividendsIncentivesRuleId {
|
|
|
dividendsRuleModelsToUpdate[i] = &models.DividendsIncentivesRule{
|
|
|
DividendsIncentivesRuleId: dividendsRuleModelToUpdate.DividendsIncentivesRuleId,
|
|
|
CooperationContractNumber: dividendsRuleModelToUpdate.CooperationContractNumber,
|
|
|
ReferrerPercentage: dividendsRuleModelToUpdate.ReferrerPercentage,
|
|
|
SalesmanPercentage: dividendsRuleModelToUpdate.SalesmanPercentage,
|
|
|
DividendsIncentivesPercentage: dividendsRuleModelToUpdate.DividendsIncentivesPercentage,
|
|
|
DividendsIncentivesStage: dividendsRuleModelToUpdate.DividendsIncentivesStage,
|
|
|
DividendsIncentivesStageEnd: dividendsRuleModelToUpdate.DividendsIncentivesStageEnd,
|
|
|
DividendsIncentivesStageStart: dividendsRuleModelToUpdate.DividendsIncentivesStageStart,
|
|
|
Remarks: dividendsRuleModelToUpdate.Remarks,
|
|
|
Org: dividendsRuleModelToUpdate.Org,
|
|
|
Company: dividendsRuleModelToUpdate.Company,
|
|
|
UpdatedAt: time.Now(),
|
|
|
DeletedAt: dividendsRuleModelToUpdate.DeletedAt,
|
|
|
CreatedAt: dividendsRuleModelToUpdate.CreatedAt,
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if _, err := tx.Model(÷ndsRuleModelsToUpdate).WherePK().Update(); err != nil {
|
|
|
return nil, err
|
|
|
}
|
...
|
...
|
@@ -656,6 +679,29 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai |
|
|
"moneyRuleModelsToUpdate": moneyRuleModelsToUpdate,
|
|
|
})
|
|
|
if len(moneyRuleModelsToUpdate) > 0 {
|
|
|
for i, moneyRuleModelToUpdate := range moneyRuleModelsToUpdate {
|
|
|
for _, moneyRule := range cooperationContract.MoneyIncentivesRules {
|
|
|
if moneyRule.MoneyIncentivesRuleId == moneyRuleModelToUpdate.MoneyIncentivesRuleId {
|
|
|
moneyRuleModelsToUpdate[i] = &models.MoneyIncentivesRule{
|
|
|
MoneyIncentivesRuleId: moneyRule.MoneyIncentivesRuleId,
|
|
|
CooperationContractNumber: moneyRule.CooperationContractNumber,
|
|
|
MoneyIncentivesAmount: moneyRule.MoneyIncentivesAmount,
|
|
|
MoneyIncentivesStage: moneyRule.MoneyIncentivesStage,
|
|
|
MoneyIncentivesStageEnd: moneyRule.MoneyIncentivesStageEnd,
|
|
|
MoneyIncentivesStageStart: moneyRule.MoneyIncentivesStageStart,
|
|
|
MoneyIncentivesTime: moneyRule.MoneyIncentivesTime,
|
|
|
ReferrerPercentage: moneyRule.MoneyIncentivesAmount,
|
|
|
SalesmanPercentage: moneyRule.MoneyIncentivesAmount,
|
|
|
Remarks: moneyRule.Remarks,
|
|
|
Org: moneyRule.Org,
|
|
|
Company: moneyRule.Company,
|
|
|
UpdatedAt: time.Now(),
|
|
|
DeletedAt: moneyRuleModelToUpdate.DeletedAt,
|
|
|
CreatedAt: moneyRuleModelToUpdate.CreatedAt,
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if _, err := tx.Model(&moneyRuleModelsToUpdate).WherePK().Update(); err != nil {
|
|
|
return nil, err
|
|
|
}
|
...
|
...
|
|