正在显示
3 个修改的文件
包含
9 行增加
和
3 行删除
| 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 TransformToDividendsEstimateDomainModelFromPgModels(dividendsEstimateModel *models.DividendsEstimate) (*domain.DividendsEstimate, error) { | 9 | func TransformToDividendsEstimateDomainModelFromPgModels(dividendsEstimateModel *models.DividendsEstimate) (*domain.DividendsEstimate, error) { |
| 10 | + dividendsAmount, _ := decimal.NewFromFloatWithExponent(dividendsEstimateModel.DividendsAmount, -2).Float64() | ||
| 9 | return &domain.DividendsEstimate{ | 11 | return &domain.DividendsEstimate{ |
| 10 | DividendsEstimateId: dividendsEstimateModel.DividendsEstimateId, | 12 | DividendsEstimateId: dividendsEstimateModel.DividendsEstimateId, |
| 11 | DividendsAccountStatus: dividendsEstimateModel.DividendsAccountStatus, | 13 | DividendsAccountStatus: dividendsEstimateModel.DividendsAccountStatus, |
| 12 | - DividendsAmount: dividendsEstimateModel.DividendsAmount, | 14 | + DividendsAmount: dividendsAmount, |
| 13 | DividendsEstimateOrderNumber: dividendsEstimateModel.DividendsEstimateOrderNumber, | 15 | DividendsEstimateOrderNumber: dividendsEstimateModel.DividendsEstimateOrderNumber, |
| 14 | DividendsEstimateTime: dividendsEstimateModel.DividendsEstimateTime, | 16 | DividendsEstimateTime: dividendsEstimateModel.DividendsEstimateTime, |
| 15 | DividendsParticipateType: dividendsEstimateModel.DividendsParticipateType, | 17 | DividendsParticipateType: dividendsEstimateModel.DividendsParticipateType, |
| 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 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils" | 7 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils" |
| @@ -8,10 +9,11 @@ import ( | @@ -8,10 +9,11 @@ import ( | ||
| 8 | 9 | ||
| 9 | func TransformToMoneyIncentivesRuleDomainModelFromPgModels(moneyIncentivesRuleModel *models.MoneyIncentivesRule) (*domain.MoneyIncentivesRule, error) { | 10 | func TransformToMoneyIncentivesRuleDomainModelFromPgModels(moneyIncentivesRuleModel *models.MoneyIncentivesRule) (*domain.MoneyIncentivesRule, error) { |
| 10 | stageString := utils.NumberToCNNumber(int(moneyIncentivesRuleModel.MoneyIncentivesStage)) | 11 | stageString := utils.NumberToCNNumber(int(moneyIncentivesRuleModel.MoneyIncentivesStage)) |
| 12 | + moneyIncentivesAmount, _ := decimal.NewFromFloatWithExponent(moneyIncentivesRuleModel.MoneyIncentivesAmount, -2).Float64() | ||
| 11 | return &domain.MoneyIncentivesRule{ | 13 | return &domain.MoneyIncentivesRule{ |
| 12 | MoneyIncentivesRuleId: moneyIncentivesRuleModel.MoneyIncentivesRuleId, | 14 | MoneyIncentivesRuleId: moneyIncentivesRuleModel.MoneyIncentivesRuleId, |
| 13 | CooperationContractNumber: moneyIncentivesRuleModel.CooperationContractNumber, | 15 | CooperationContractNumber: moneyIncentivesRuleModel.CooperationContractNumber, |
| 14 | - MoneyIncentivesAmount: moneyIncentivesRuleModel.MoneyIncentivesAmount, | 16 | + MoneyIncentivesAmount: moneyIncentivesAmount, |
| 15 | MoneyIncentivesStage: moneyIncentivesRuleModel.MoneyIncentivesStage, | 17 | MoneyIncentivesStage: moneyIncentivesRuleModel.MoneyIncentivesStage, |
| 16 | MoneyIncentivesStageCN: stageString, | 18 | MoneyIncentivesStageCN: stageString, |
| 17 | MoneyIncentivesStageEnd: moneyIncentivesRuleModel.MoneyIncentivesStageEnd, | 19 | MoneyIncentivesStageEnd: moneyIncentivesRuleModel.MoneyIncentivesStageEnd, |
| 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 TransformToOrderGoodDomainModelFromPgModels(orderGoodModel *models.OrderGood) (*domain.OrderGood, error) { | 9 | func TransformToOrderGoodDomainModelFromPgModels(orderGoodModel *models.OrderGood) (*domain.OrderGood, error) { |
| 10 | + orderGoodAmount, _ := decimal.NewFromFloatWithExponent(orderGoodModel.OrderGoodAmount, -2).Float64() | ||
| 9 | return &domain.OrderGood{ | 11 | return &domain.OrderGood{ |
| 10 | OrderGoodId: orderGoodModel.OrderGoodId, | 12 | OrderGoodId: orderGoodModel.OrderGoodId, |
| 11 | - OrderGoodAmount: orderGoodModel.OrderGoodAmount, | 13 | + OrderGoodAmount: orderGoodAmount, |
| 12 | OrderGoodName: orderGoodModel.OrderGoodName, | 14 | OrderGoodName: orderGoodModel.OrderGoodName, |
| 13 | OrderGoodPrice: orderGoodModel.OrderGoodPrice, | 15 | OrderGoodPrice: orderGoodModel.OrderGoodPrice, |
| 14 | OrderGoodQuantity: orderGoodModel.OrderGoodQuantity, | 16 | OrderGoodQuantity: orderGoodModel.OrderGoodQuantity, |
-
请 注册 或 登录 后发表评论