刷新历史订单结算价
This commit is contained in:
@@ -613,7 +613,7 @@ func (c *OrderManager) UpdateOrderFields(order *model.GoodsOrder, fieldList []st
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *OrderManager) RefreshHistoryOrdersEarningPrice(ctx *jxcontext.Context, vendorOrderId string, vendorIDs []int, storeId int, fromDate string, toDate string, isAsync, isContinueWhenError bool) (err error) {
|
||||
func (c *OrderManager) RefreshHistoryOrdersEarningPrice(ctx *jxcontext.Context, vendorOrderID string, vendorIDs []int, storeID int, fromDate string, toDate string, isAsync, isContinueWhenError bool) (err error) {
|
||||
db := dao.GetDB()
|
||||
fromDateParam := utils.Str2Time(fromDate)
|
||||
toDateParam := utils.Str2Time(toDate)
|
||||
@@ -621,9 +621,9 @@ func (c *OrderManager) RefreshHistoryOrdersEarningPrice(ctx *jxcontext.Context,
|
||||
if math.Ceil(toDateParam.Sub(fromDateParam).Hours()/24) > 10 {
|
||||
return errors.New(fmt.Sprintf("查询间隔时间不允许大于10天!时间范围:[%v] 至 [%v]", fromDate, toDate))
|
||||
}
|
||||
orderList, _ := dao.QueryOrders(db, vendorOrderId, vendorIDs, storeId, fromDateParam, toDateParam)
|
||||
orderList, _ := dao.QueryOrders(db, vendorOrderID, vendorIDs, storeID, fromDateParam, toDateParam)
|
||||
if len(orderList) <= 0 {
|
||||
return errors.New(fmt.Sprintf("未查询到订单!,vendorOrderId : %s, 时间范围:[%v] 至 [%v]", vendorOrderId, fromDate, toDate))
|
||||
return errors.New(fmt.Sprintf("未查询到订单!,vendorOrderID : %s, 时间范围:[%v] 至 [%v]", vendorOrderID, fromDate, toDate))
|
||||
}
|
||||
task := tasksch.NewParallelTask("刷新历史订单结算价", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
@@ -641,19 +641,18 @@ func (c *OrderManager) RefreshHistoryOrdersEarningPrice(ctx *jxcontext.Context,
|
||||
}
|
||||
}()
|
||||
for _, value := range order.Skus {
|
||||
if _, err := dao.UpdateEntity(db, value, "EarningPrice", "StoreSubID"); err != nil {
|
||||
if _, err = dao.UpdateEntity(db, value, "EarningPrice", "StoreSubID"); err != nil {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
jxutils.RefreshOrderSkuRelated(order)
|
||||
if _, err2 := dao.UpdateEntity(db, order, "EarningPrice"); err2 != nil {
|
||||
return "", err2
|
||||
if _, err = dao.UpdateEntity(db, order, "EarningPrice"); err != nil {
|
||||
return "", err
|
||||
}
|
||||
dao.Commit(db)
|
||||
return retVal, err
|
||||
}, orderList)
|
||||
tasksch.HandleTask(task, nil, true).Run()
|
||||
|
||||
if !isAsync {
|
||||
_, err = task.GetResult(0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user