...
|
...
|
@@ -6,6 +6,7 @@ import ( |
|
|
"fmt"
|
|
|
"github.com/linmadan/egglib-go/core/application"
|
|
|
"github.com/linmadan/egglib-go/utils/tool_funs"
|
|
|
"github.com/shopspring/decimal"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/dividendsReturnedOrder/command"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/dividendsReturnedOrder/query"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/factory"
|
...
|
...
|
@@ -130,12 +131,16 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide |
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "分红退货单号已存在")
|
|
|
}
|
|
|
|
|
|
// 退货金额
|
|
|
var dividendsReturnedOrderRefund float64
|
|
|
|
|
|
// 获取分红退货单产品
|
|
|
var orderGoods []*domain.OrderGood
|
|
|
for _, orderGood := range createDividendsReturnedOrderCommand.OrderGoods {
|
|
|
orderGoodAmount, _ := decimal.NewFromFloat(orderGood.OrderGoodPrice).Mul(decimal.NewFromFloat(float64(orderGood.OrderGoodQuantity))).Float64()
|
|
|
orderGoods = append(orderGoods, &domain.OrderGood{
|
|
|
OrderGoodId: 0,
|
|
|
OrderGoodAmount: orderGood.OrderGoodAmount,
|
|
|
OrderGoodAmount: orderGoodAmount,
|
|
|
OrderGoodName: orderGood.OrderGoodName,
|
|
|
OrderGoodPrice: orderGood.OrderGoodPrice,
|
|
|
OrderGoodQuantity: orderGood.OrderGoodQuantity,
|
...
|
...
|
@@ -150,11 +155,12 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide |
|
|
DeletedAt: time.Time{},
|
|
|
UpdatedAt: time.Time{},
|
|
|
})
|
|
|
dividendsReturnedOrderRefund, _ = decimal.NewFromFloat(dividendsReturnedOrderRefund).Add(decimal.NewFromFloat(orderGood.OrderGoodPrice).Mul(decimal.NewFromFloat(float64(orderGood.OrderGoodQuantity)))).Float64()
|
|
|
}
|
|
|
|
|
|
newDividendsReturnedOrder := &domain.DividendsReturnedOrder{
|
|
|
DividendsReturnedOrderNumber: dividendsReturnedOrderNumber,
|
|
|
DividendsReturnedOrderRefund: createDividendsReturnedOrderCommand.DividendsReturnedOrderRefund,
|
|
|
DividendsReturnedOrderRefund: dividendsReturnedOrderRefund,
|
|
|
OriginalOrderNum: createDividendsReturnedOrderCommand.OriginalOrderNum,
|
|
|
DividendsOrderNumber: createDividendsReturnedOrderCommand.DividendsOrderNumber,
|
|
|
DividendsReturnedCustomerName: createDividendsReturnedOrderCommand.DividendsReturnedCustomerName,
|
...
|
...
|
|