刷新历史订单结算价修改
This commit is contained in:
@@ -637,32 +637,24 @@ func (c *OrderManager) RefreshHistoryOrdersEarningPrice(ctx *jxcontext.Context,
|
|||||||
v := batchItemList[0].(*model.GoodsOrder)
|
v := batchItemList[0].(*model.GoodsOrder)
|
||||||
order, _ := c.loadOrder(v.VendorOrderID, "", v.VendorID)
|
order, _ := c.loadOrder(v.VendorOrderID, "", v.VendorID)
|
||||||
updateSingleOrderEarningPrice(order, db)
|
updateSingleOrderEarningPrice(order, db)
|
||||||
for _, orderSku := range order.Skus {
|
for _, value := range order.Skus {
|
||||||
actStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, []int{v.VendorID}, []int{v.StoreID}, []int{orderSku.SkuID}, v.OrderCreatedAt, v.OrderCreatedAt)
|
dao.Begin(db)
|
||||||
if err != nil {
|
_, err := dao.UpdateOrderSkuEariningPrice(db, value, v.StoreID, fromDateParm, toDateParm)
|
||||||
globals.SugarLogger.Errorf("updateOrderSkuOtherInfo can not get sku promotion info for error:%v", err)
|
if err == nil{
|
||||||
return "", err
|
dao.Commit(db)
|
||||||
}
|
}
|
||||||
if actStoreSkuMap := jxutils.NewActStoreSkuMap(actStoreSkuList, false); actStoreSkuMap != nil {
|
if err != nil && !isContinueWhenError {
|
||||||
for _, value := range actStoreSkuList {
|
dao.Rollback(db)
|
||||||
num, err := dao.UpdateOrderSkuEariningPrice(db, value, fromDateParm, toDateParm)
|
return "", err
|
||||||
if err != nil && !isContinueWhenError {
|
|
||||||
return "", err
|
|
||||||
} else {
|
|
||||||
globals.SugarLogger.Debug(fmt.Sprintf("更新order_sku , 行数:%d, storeid :%d ,skuid : %d, vendoreid : %d, earningPrice : %v, store_sub_id : %d", num, value.StoreID, value.SkuID, value.VendorID, value.EarningPrice, value.ActID))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return retVal, err
|
return retVal, err
|
||||||
}, orderList)
|
}, orderList)
|
||||||
tasksch.HandleTask(task1, task, true).Run()
|
tasksch.HandleTask(task1, task, true).Run()
|
||||||
case 1:
|
case 1:
|
||||||
num2, err2 := dao.UpdateGoodOrderEaringPrice(db, fromDateParm, toDateParm)
|
_, err2 := dao.UpdateGoodOrderEaringPrice(db, fromDateParm, toDateParm)
|
||||||
if err2 != nil && !isContinueWhenError {
|
if err2 != nil && !isContinueWhenError {
|
||||||
return "", err2
|
return "", err2
|
||||||
} else {
|
|
||||||
globals.SugarLogger.Debug(fmt.Sprintf("更新goods_order , 行数:%d, 时间: %v 至 %v", num2, fromDateParm, toDateParm))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result, err
|
return result, err
|
||||||
|
|||||||
@@ -590,7 +590,7 @@ func GetRiskOrderCount(db *DaoDB, dayNum int, includeToday bool) (storeOrderList
|
|||||||
return storeOrderList, GetRows(db, &storeOrderList, sql, sqlParams)
|
return storeOrderList, GetRows(db, &storeOrderList, sql, sqlParams)
|
||||||
}
|
}
|
||||||
|
|
||||||
func UpdateOrderSkuEariningPrice(db *DaoDB, actStoreSku2 *model.ActStoreSku2, fromDateParm, toDateParm time.Time) (num int64, err error) {
|
func UpdateOrderSkuEariningPrice(db *DaoDB, skus *model.OrderSku, storeID int, fromDateParm, toDateParm time.Time) (num int64, err error) {
|
||||||
sql := `
|
sql := `
|
||||||
UPDATE order_sku t1
|
UPDATE order_sku t1
|
||||||
JOIN goods_order tt1 ON tt1.vendor_order_id = t1.vendor_order_id
|
JOIN goods_order tt1 ON tt1.vendor_order_id = t1.vendor_order_id
|
||||||
@@ -602,13 +602,13 @@ func UpdateOrderSkuEariningPrice(db *DaoDB, actStoreSku2 *model.ActStoreSku2, fr
|
|||||||
WHERE t1.store_sub_id = 0
|
WHERE t1.store_sub_id = 0
|
||||||
`
|
`
|
||||||
sqlParams := []interface{}{
|
sqlParams := []interface{}{
|
||||||
actStoreSku2.VendorID,
|
skus.VendorID,
|
||||||
actStoreSku2.SkuID,
|
skus.SkuID,
|
||||||
actStoreSku2.StoreID,
|
storeID,
|
||||||
fromDateParm,
|
fromDateParm,
|
||||||
toDateParm,
|
toDateParm,
|
||||||
actStoreSku2.EarningPrice,
|
skus.EarningPrice,
|
||||||
actStoreSku2.ActID,
|
skus.StoreSubID,
|
||||||
}
|
}
|
||||||
return ExecuteSQL(db, sql, sqlParams...)
|
return ExecuteSQL(db, sql, sqlParams...)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user