作者 陈志颖

fix:分红退货单更新

@@ -1149,6 +1149,16 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide @@ -1149,6 +1149,16 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide
1149 cooperationContractRepository = value 1149 cooperationContractRepository = value
1150 } 1150 }
1151 1151
  1152 + // 产品仓储初始化
  1153 + var orderGoodRepository domain.OrderGoodRepository
  1154 + if value, err := factory.CreateOrderGoodRepository(map[string]interface{}{
  1155 + "transactionContext": transactionContext,
  1156 + }); err != nil {
  1157 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  1158 + } else {
  1159 + orderGoodRepository = value
  1160 + }
  1161 +
1152 // 查找合约 1162 // 查找合约
1153 cooperationContractsMap := make(map[string]*domain.CooperationContract) 1163 cooperationContractsMap := make(map[string]*domain.CooperationContract)
1154 if count, cooperationContracts, err := cooperationContractRepository.Find(map[string]interface{}{ 1164 if count, cooperationContracts, err := cooperationContractRepository.Find(map[string]interface{}{
@@ -1175,6 +1185,14 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide @@ -1175,6 +1185,14 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide
1175 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err3.Error()) 1185 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err3.Error())
1176 } 1186 }
1177 1187
  1188 + // 获取产品
  1189 + orderGoodFound, err4 := orderGoodRepository.FindOne(map[string]interface{}{
  1190 + "orderGoodId": orderGoodId,
  1191 + })
  1192 + if err4 != nil {
  1193 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err4.Error())
  1194 + }
  1195 +
1178 // 退货产品金额计算 1196 // 退货产品金额计算
1179 orderGoodAmount, _ := decimal.NewFromFloat(orderGood.OrderGoodPrice).Mul(decimal.NewFromFloat(orderGood.OrderGoodQuantity)).Float64() 1197 orderGoodAmount, _ := decimal.NewFromFloat(orderGood.OrderGoodPrice).Mul(decimal.NewFromFloat(orderGood.OrderGoodQuantity)).Float64()
1180 1198
@@ -1209,6 +1227,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide @@ -1209,6 +1227,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide
1209 DividendsReturnedOrderNumber: dividendsReturnedOrder.DividendsReturnedOrderNumber, 1227 DividendsReturnedOrderNumber: dividendsReturnedOrder.DividendsReturnedOrderNumber,
1210 CooperationContractNumber: orderGood.CooperationContractNumber, 1228 CooperationContractNumber: orderGood.CooperationContractNumber,
1211 OrderGoodExpense: orderGood.OrderGoodExpense, 1229 OrderGoodExpense: orderGood.OrderGoodExpense,
  1230 + OrderGoodDividendsStatus: orderGoodFound.OrderGoodDividendsStatus,
1212 OrgId: updateDividendsReturnedOrderCommand.OrgId, 1231 OrgId: updateDividendsReturnedOrderCommand.OrgId,
1213 CompanyId: updateDividendsReturnedOrderCommand.CompanyId, 1232 CompanyId: updateDividendsReturnedOrderCommand.CompanyId,
1214 CreatedAt: time.Time{}, 1233 CreatedAt: time.Time{},
@@ -73,9 +73,6 @@ func (dividendsReturnedOrder *DividendsReturnedOrder) Identify() interface{} { @@ -73,9 +73,6 @@ func (dividendsReturnedOrder *DividendsReturnedOrder) Identify() interface{} {
73 } 73 }
74 74
75 func (dividendsReturnedOrder *DividendsReturnedOrder) Update(data map[string]interface{}) error { 75 func (dividendsReturnedOrder *DividendsReturnedOrder) Update(data map[string]interface{}) error {
76 - if dividendsReturnedOrderRefund, ok := data["dividendsReturnedOrderRefund"]; ok {  
77 - dividendsReturnedOrder.DividendsReturnedOrderRefund = dividendsReturnedOrderRefund.(float64)  
78 - }  
79 if originalOrderNum, ok := data["originalOrderNum"]; ok { 76 if originalOrderNum, ok := data["originalOrderNum"]; ok {
80 dividendsReturnedOrder.OriginalOrderNum = originalOrderNum.(string) 77 dividendsReturnedOrder.OriginalOrderNum = originalOrderNum.(string)
81 } 78 }