|
@@ -4,6 +4,7 @@ import ( |
|
@@ -4,6 +4,7 @@ import ( |
4
|
"fmt"
|
4
|
"fmt"
|
5
|
"github.com/go-pg/pg/v10"
|
5
|
"github.com/go-pg/pg/v10"
|
6
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
|
6
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
|
|
|
7
|
+ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/log"
|
7
|
"time"
|
8
|
"time"
|
8
|
|
9
|
|
9
|
"github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
|
10
|
"github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
|
|
@@ -246,6 +247,32 @@ func (repository *DividendsReturnedOrderRepository) Save(dividendsReturnedOrder |
|
@@ -246,6 +247,32 @@ func (repository *DividendsReturnedOrderRepository) Save(dividendsReturnedOrder |
246
|
}
|
247
|
}
|
247
|
}
|
248
|
}
|
248
|
}
|
249
|
}
|
|
|
250
|
+ log.Logger.Info("待更新的分红退货单产品", map[string]interface{}{
|
|
|
251
|
+ "orderGoodModelsToUpdate": orderGoodModelsToUpdate,
|
|
|
252
|
+ })
|
|
|
253
|
+ for i, orderGoodModelToUpdate := range orderGoodModelsToUpdate {
|
|
|
254
|
+ for j, orderGood := range dividendsReturnedOrder.Goods {
|
|
|
255
|
+ if orderGood.OrderGoodId == orderGoodModelToUpdate.OrderGoodId {
|
|
|
256
|
+ orderGoodModelsToUpdate[i] = &models.OrderGood{
|
|
|
257
|
+ OrderGoodId: dividendsReturnedOrder.Goods[j].OrderGoodId,
|
|
|
258
|
+ OrderGoodAmount: dividendsReturnedOrder.Goods[j].OrderGoodAmount,
|
|
|
259
|
+ OrderGoodName: dividendsReturnedOrder.Goods[j].OrderGoodName,
|
|
|
260
|
+ OrderGoodPrice: dividendsReturnedOrder.Goods[j].OrderGoodPrice,
|
|
|
261
|
+ OrderGoodQuantity: dividendsReturnedOrder.Goods[j].OrderGoodQuantity,
|
|
|
262
|
+ DividendsOrderNumber: dividendsReturnedOrder.Goods[j].DividendsOrderNumber,
|
|
|
263
|
+ DividendsReturnedOrderNumber: dividendsReturnedOrder.Goods[j].DividendsReturnedOrderNumber,
|
|
|
264
|
+ CooperationContractNumber: dividendsReturnedOrder.Goods[j].CooperationContractNumber,
|
|
|
265
|
+ OrgId: dividendsReturnedOrder.Goods[j].OrgId,
|
|
|
266
|
+ CompanyId: dividendsReturnedOrder.Goods[j].CompanyId,
|
|
|
267
|
+ OrderGoodExpense: dividendsReturnedOrder.Goods[j].OrderGoodExpense,
|
|
|
268
|
+ OrderGoodDividendsStatus: dividendsReturnedOrder.Goods[j].OrderGoodDividendsStatus,
|
|
|
269
|
+ CreatedAt: orderGoodModelsToUpdate[i].CreatedAt,
|
|
|
270
|
+ DeletedAt: orderGoodModelsToUpdate[i].DeletedAt,
|
|
|
271
|
+ UpdatedAt: time.Now(),
|
|
|
272
|
+ }
|
|
|
273
|
+ }
|
|
|
274
|
+ }
|
|
|
275
|
+ }
|
249
|
if len(orderGoodModelsToUpdate) > 0 {
|
276
|
if len(orderGoodModelsToUpdate) > 0 {
|
250
|
if _, err := tx.Model(&orderGoodModelsToUpdate).WherePK().Update(); err != nil {
|
277
|
if _, err := tx.Model(&orderGoodModelsToUpdate).WherePK().Update(); err != nil {
|
251
|
return nil, err
|
278
|
return nil, err
|