...
|
...
|
@@ -4,6 +4,7 @@ import ( |
|
|
"fmt"
|
|
|
"github.com/go-pg/pg/v10"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/log"
|
|
|
"time"
|
|
|
|
|
|
"github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
|
...
|
...
|
@@ -246,6 +247,32 @@ func (repository *DividendsReturnedOrderRepository) Save(dividendsReturnedOrder |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
log.Logger.Info("待更新的分红退货单产品", map[string]interface{}{
|
|
|
"orderGoodModelsToUpdate": orderGoodModelsToUpdate,
|
|
|
})
|
|
|
for i, orderGoodModelToUpdate := range orderGoodModelsToUpdate {
|
|
|
for j, orderGood := range dividendsReturnedOrder.Goods {
|
|
|
if orderGood.OrderGoodId == orderGoodModelToUpdate.OrderGoodId {
|
|
|
orderGoodModelsToUpdate[i] = &models.OrderGood{
|
|
|
OrderGoodId: dividendsReturnedOrder.Goods[j].OrderGoodId,
|
|
|
OrderGoodAmount: dividendsReturnedOrder.Goods[j].OrderGoodAmount,
|
|
|
OrderGoodName: dividendsReturnedOrder.Goods[j].OrderGoodName,
|
|
|
OrderGoodPrice: dividendsReturnedOrder.Goods[j].OrderGoodPrice,
|
|
|
OrderGoodQuantity: dividendsReturnedOrder.Goods[j].OrderGoodQuantity,
|
|
|
DividendsOrderNumber: dividendsReturnedOrder.Goods[j].DividendsOrderNumber,
|
|
|
DividendsReturnedOrderNumber: dividendsReturnedOrder.Goods[j].DividendsReturnedOrderNumber,
|
|
|
CooperationContractNumber: dividendsReturnedOrder.Goods[j].CooperationContractNumber,
|
|
|
OrgId: dividendsReturnedOrder.Goods[j].OrgId,
|
|
|
CompanyId: dividendsReturnedOrder.Goods[j].CompanyId,
|
|
|
OrderGoodExpense: dividendsReturnedOrder.Goods[j].OrderGoodExpense,
|
|
|
OrderGoodDividendsStatus: dividendsReturnedOrder.Goods[j].OrderGoodDividendsStatus,
|
|
|
CreatedAt: orderGoodModelsToUpdate[i].CreatedAt,
|
|
|
DeletedAt: orderGoodModelsToUpdate[i].DeletedAt,
|
|
|
UpdatedAt: time.Now(),
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if len(orderGoodModelsToUpdate) > 0 {
|
|
|
if _, err := tx.Model(&orderGoodModelsToUpdate).WherePK().Update(); err != nil {
|
|
|
return nil, err
|
...
|
...
|
|