|
|
package transform
|
|
|
|
|
|
import (
|
|
|
"github.com/shopspring/decimal"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models"
|
|
|
)
|
|
|
|
|
|
func TransformToCreditAccountDomainModelFromPgModels(creditAccountModel *models.CreditAccount) (*domain.CreditAccount, error) {
|
|
|
settlementAmount, _ := decimal.NewFromFloatWithExponent(creditAccountModel.SettlementAmount, -2).Float64()
|
|
|
return &domain.CreditAccount{
|
|
|
CreditAccountId: creditAccountModel.CreditAccountId,
|
|
|
ActuallyPaidAmount: creditAccountModel.ActuallyPaidAmount,
|
|
|
CreditAccountOrderNum: creditAccountModel.CreditAccountOrderNum,
|
|
|
PaymentStatus: creditAccountModel.PaymentStatus,
|
|
|
PaymentTime: creditAccountModel.PaymentTime,
|
|
|
SettlementAmount: creditAccountModel.SettlementAmount,
|
|
|
SettlementAmount: settlementAmount,
|
|
|
SettlementTime: creditAccountModel.SettlementTime,
|
|
|
CooperationContractNumber: creditAccountModel.CooperationContractNumber,
|
|
|
Participator: creditAccountModel.Participator,
|
...
|
...
|
|