...
|
...
|
@@ -5,7 +5,51 @@ import ( |
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models"
|
|
|
)
|
|
|
|
|
|
func TransformToCooperationContractDomainModelFromPgModels(cooperationContractModel *models.CooperationContract) (*domain.CooperationContract, error) {
|
|
|
func TransformToCooperationContractDomainModelFromPgModels(
|
|
|
cooperationContractModel *models.CooperationContract,
|
|
|
cooperationMode *models.CooperationMode,
|
|
|
dividendsIncentivesRules []*models.DividendsIncentivesRule,
|
|
|
moneyIncentivesRules []*models.MoneyIncentivesRule) (*domain.CooperationContract, error) {
|
|
|
|
|
|
var dividendsIncentivesRulesDomain []*domain.DividendsIncentivesRule
|
|
|
for _, rule := range dividendsIncentivesRules {
|
|
|
dividendsIncentivesRulesDomain = append(dividendsIncentivesRulesDomain, &domain.DividendsIncentivesRule{
|
|
|
DividendsIncentivesRuleId: rule.DividendsIncentivesRuleId,
|
|
|
CooperationContractNumber: rule.CooperationContractNumber,
|
|
|
ReferrerPercentage: rule.ReferrerPercentage,
|
|
|
SalesmanPercentage: rule.SalesmanPercentage,
|
|
|
DividendsIncentivesPercentage: rule.DividendsIncentivesPercentage,
|
|
|
DividendsIncentivesStage: rule.DividendsIncentivesStage,
|
|
|
DividendsIncentivesStageEnd: rule.DividendsIncentivesStageEnd,
|
|
|
DividendsIncentivesStageStart: rule.DividendsIncentivesStageStart,
|
|
|
Org: rule.Org,
|
|
|
Company: rule.Company,
|
|
|
UpdatedAt: rule.UpdatedAt,
|
|
|
DeletedAt: rule.DeletedAt,
|
|
|
CreatedAt: rule.CreatedAt,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
var moneyIncentivesRulesDomain []*domain.MoneyIncentivesRule
|
|
|
for _, rule := range moneyIncentivesRules {
|
|
|
moneyIncentivesRulesDomain = append(moneyIncentivesRulesDomain, &domain.MoneyIncentivesRule{
|
|
|
MoneyIncentivesRuleId: rule.MoneyIncentivesRuleId,
|
|
|
CooperationContractNumber: rule.CooperationContractNumber,
|
|
|
MoneyIncentivesAmount: rule.MoneyIncentivesAmount,
|
|
|
MoneyIncentivesStage: rule.MoneyIncentivesStage,
|
|
|
MoneyIncentivesStageEnd: rule.MoneyIncentivesStageEnd,
|
|
|
MoneyIncentivesStageStart: rule.MoneyIncentivesStageStart,
|
|
|
MoneyIncentivesTime: rule.MoneyIncentivesTime,
|
|
|
ReferrerPercentage: rule.ReferrerPercentage,
|
|
|
SalesmanPercentage: rule.SalesmanPercentage,
|
|
|
Org: rule.Org,
|
|
|
Company: rule.Company,
|
|
|
UpdatedAt: rule.UpdatedAt,
|
|
|
DeletedAt: rule.DeletedAt,
|
|
|
CreatedAt: rule.CreatedAt,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
return &domain.CooperationContract{
|
|
|
CooperationContractId: cooperationContractModel.CooperationContractId,
|
|
|
CooperationContractDescription: cooperationContractModel.CooperationContractDescription,
|
...
|
...
|
@@ -15,14 +59,29 @@ func TransformToCooperationContractDomainModelFromPgModels(cooperationContractMo |
|
|
CooperationContractSalesman: cooperationContractModel.CooperationContractSalesman,
|
|
|
CooperationContractUndertakerType: cooperationContractModel.CooperationContractUndertakerType,
|
|
|
CooperationContractSponsor: cooperationContractModel.CooperationContractSponsor,
|
|
|
CooperationMode: cooperationContractModel.CooperationMode,
|
|
|
Status: cooperationContractModel.Status,
|
|
|
Org: cooperationContractModel.Org,
|
|
|
Company: cooperationContractModel.Company,
|
|
|
Operator: cooperationContractModel.Operator,
|
|
|
OperateTime: cooperationContractModel.OperateTime,
|
|
|
CreatedAt: cooperationContractModel.CreatedAt,
|
|
|
DeletedAt: cooperationContractModel.DeletedAt,
|
|
|
UpdatedAt: cooperationContractModel.UpdatedAt,
|
|
|
CooperationMode: &domain.CooperationMode{
|
|
|
CooperationModeId: cooperationMode.CooperationModeId,
|
|
|
CooperationModeNumber: cooperationMode.CooperationModeNumber,
|
|
|
CooperationModeName: cooperationMode.CooperationModeName,
|
|
|
Status: cooperationMode.Status,
|
|
|
Org: cooperationMode.Org,
|
|
|
Company: cooperationMode.Company,
|
|
|
Remarks: cooperationMode.Remarks,
|
|
|
Operator: cooperationMode.Operator,
|
|
|
OperateTime: cooperationMode.OperateTime,
|
|
|
UpdatedAt: cooperationMode.UpdatedAt,
|
|
|
DeletedAt: cooperationMode.DeletedAt,
|
|
|
CreatedAt: cooperationMode.CreatedAt,
|
|
|
},
|
|
|
DividendsIncentivesRules: dividendsIncentivesRulesDomain,
|
|
|
MoneyIncentivesRules: moneyIncentivesRulesDomain,
|
|
|
Status: cooperationContractModel.Status,
|
|
|
Org: cooperationContractModel.Org,
|
|
|
Company: cooperationContractModel.Company,
|
|
|
Operator: cooperationContractModel.Operator,
|
|
|
OperateTime: cooperationContractModel.OperateTime,
|
|
|
CreatedAt: cooperationContractModel.CreatedAt,
|
|
|
DeletedAt: cooperationContractModel.DeletedAt,
|
|
|
UpdatedAt: cooperationContractModel.UpdatedAt,
|
|
|
}, nil
|
|
|
} |
...
|
...
|
|