作者 陈志颖

fix:分红退货单更新

... ... @@ -1149,6 +1149,16 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide
cooperationContractRepository = value
}
// 产品仓储初始化
var orderGoodRepository domain.OrderGoodRepository
if value, err := factory.CreateOrderGoodRepository(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
orderGoodRepository = value
}
// 查找合约
cooperationContractsMap := make(map[string]*domain.CooperationContract)
if count, cooperationContracts, err := cooperationContractRepository.Find(map[string]interface{}{
... ... @@ -1175,6 +1185,14 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err3.Error())
}
// 获取产品
orderGoodFound, err4 := orderGoodRepository.FindOne(map[string]interface{}{
"orderGoodId": orderGoodId,
})
if err4 != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err4.Error())
}
// 退货产品金额计算
orderGoodAmount, _ := decimal.NewFromFloat(orderGood.OrderGoodPrice).Mul(decimal.NewFromFloat(orderGood.OrderGoodQuantity)).Float64()
... ... @@ -1209,6 +1227,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide
DividendsReturnedOrderNumber: dividendsReturnedOrder.DividendsReturnedOrderNumber,
CooperationContractNumber: orderGood.CooperationContractNumber,
OrderGoodExpense: orderGood.OrderGoodExpense,
OrderGoodDividendsStatus: orderGoodFound.OrderGoodDividendsStatus,
OrgId: updateDividendsReturnedOrderCommand.OrgId,
CompanyId: updateDividendsReturnedOrderCommand.CompanyId,
CreatedAt: time.Time{},
... ...
... ... @@ -73,9 +73,6 @@ func (dividendsReturnedOrder *DividendsReturnedOrder) Identify() interface{} {
}
func (dividendsReturnedOrder *DividendsReturnedOrder) Update(data map[string]interface{}) error {
if dividendsReturnedOrderRefund, ok := data["dividendsReturnedOrderRefund"]; ok {
dividendsReturnedOrder.DividendsReturnedOrderRefund = dividendsReturnedOrderRefund.(float64)
}
if originalOrderNum, ok := data["originalOrderNum"]; ok {
dividendsReturnedOrder.OriginalOrderNum = originalOrderNum.(string)
}
... ...