作者 陈志颖

fix:账期结算金额保留两位小数

1 package transform 1 package transform
2 2
3 import ( 3 import (
  4 + "github.com/shopspring/decimal"
4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain" 5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models" 6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models"
6 ) 7 )
7 8
8 func TransformToCreditAccountDomainModelFromPgModels(creditAccountModel *models.CreditAccount) (*domain.CreditAccount, error) { 9 func TransformToCreditAccountDomainModelFromPgModels(creditAccountModel *models.CreditAccount) (*domain.CreditAccount, error) {
  10 + settlementAmount, _ := decimal.NewFromFloatWithExponent(creditAccountModel.SettlementAmount, -2).Float64()
9 return &domain.CreditAccount{ 11 return &domain.CreditAccount{
10 CreditAccountId: creditAccountModel.CreditAccountId, 12 CreditAccountId: creditAccountModel.CreditAccountId,
11 ActuallyPaidAmount: creditAccountModel.ActuallyPaidAmount, 13 ActuallyPaidAmount: creditAccountModel.ActuallyPaidAmount,
12 CreditAccountOrderNum: creditAccountModel.CreditAccountOrderNum, 14 CreditAccountOrderNum: creditAccountModel.CreditAccountOrderNum,
13 PaymentStatus: creditAccountModel.PaymentStatus, 15 PaymentStatus: creditAccountModel.PaymentStatus,
14 PaymentTime: creditAccountModel.PaymentTime, 16 PaymentTime: creditAccountModel.PaymentTime,
15 - SettlementAmount: creditAccountModel.SettlementAmount, 17 + SettlementAmount: settlementAmount,
16 SettlementTime: creditAccountModel.SettlementTime, 18 SettlementTime: creditAccountModel.SettlementTime,
17 CooperationContractNumber: creditAccountModel.CooperationContractNumber, 19 CooperationContractNumber: creditAccountModel.CooperationContractNumber,
18 Participator: creditAccountModel.Participator, 20 Participator: creditAccountModel.Participator,