dividends_estimate.go
2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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 TransformToDividendsEstimateDomainModelFromPgModels(dividendsEstimateModel *models.DividendsEstimate) (*domain.DividendsEstimate, error) {
dividendsAmount, _ := decimal.NewFromFloatWithExponent(dividendsEstimateModel.DividendsAmount, -2).Float64()
return &domain.DividendsEstimate{
DividendsEstimateId: dividendsEstimateModel.DividendsEstimateId,
DividendsAccountStatus: dividendsEstimateModel.DividendsAccountStatus,
PaymentStatus: dividendsEstimateModel.PaymentStatus,
DividendsAmount: dividendsAmount,
DividendsEstimateOrderNumber: dividendsEstimateModel.DividendsEstimateOrderNumber,
DividendsEstimateTime: dividendsEstimateModel.DividendsEstimateTime,
DividendsParticipateType: dividendsEstimateModel.DividendsParticipateType,
DividendsType: dividendsEstimateModel.DividendsType,
DividendsTypeName: dividendsEstimateModel.DividendsTypeName,
OrderOrReturnedOrderNum: dividendsEstimateModel.OrderOrReturnedOrderNum,
CooperationContractNumber: dividendsEstimateModel.CooperationContractNumber,
CooperationContractUndertakerId: dividendsEstimateModel.CooperationContractUndertakerId,
DividendsUser: dividendsEstimateModel.DividendsUser,
DividendsPercentage: dividendsEstimateModel.DividendsPercentage,
DividendsStage: dividendsEstimateModel.DividendsStage,
Org: dividendsEstimateModel.Org,
Company: dividendsEstimateModel.Company,
Operator: dividendsEstimateModel.Operator,
OperateTime: dividendsEstimateModel.OperateTime,
IsCanceled: dividendsEstimateModel.IsCanceled,
OrderGoodId: dividendsEstimateModel.OrderGoodId,
CreatedAt: dividendsEstimateModel.CreatedAt,
DeletedAt: dividendsEstimateModel.DeletedAt,
UpdatedAt: dividendsEstimateModel.UpdatedAt,
CreditAccountId: dividendsEstimateModel.CreditAccountId,
}, nil
}