Accept Merge Request #21: (su -> mark)
Merge Request: 刷新历史订单结算价 Created By: @苏尹岚 Accepted By: @苏尹岚 URL: https://rosydev.coding.net/p/jx-callback/d/jx-callback/git/merge/21
This commit is contained in:
@@ -613,17 +613,17 @@ 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) (hint string, err error) {
|
||||
db := dao.GetDB()
|
||||
fromDateParam := utils.Str2Time(fromDate)
|
||||
toDateParam := utils.Str2Time(toDate)
|
||||
//若时间间隔大于10天则不允许查询
|
||||
if math.Ceil(toDateParam.Sub(fromDateParam).Hours()/24) > 10 {
|
||||
return errors.New(fmt.Sprintf("查询间隔时间不允许大于10天!时间范围:[%v] 至 [%v]", fromDate, toDate))
|
||||
return "", errors.New(fmt.Sprintf("查询间隔时间不允许大于10天!时间范围:[%v] 至 [%v]", fromDate, toDate))
|
||||
}
|
||||
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) {
|
||||
@@ -655,6 +655,9 @@ func (c *OrderManager) RefreshHistoryOrdersEarningPrice(ctx *jxcontext.Context,
|
||||
tasksch.HandleTask(task, nil, true).Run()
|
||||
if !isAsync {
|
||||
_, err = task.GetResult(0)
|
||||
hint = "1"
|
||||
} else {
|
||||
hint = task.GetID()
|
||||
}
|
||||
return err
|
||||
return hint, err
|
||||
}
|
||||
|
||||
@@ -744,10 +744,10 @@ func (c *OrderController) AmendMissingOrders() {
|
||||
// @Title 同步刷新历史订单的结算价按订单
|
||||
// @Description 同步刷新历史订单的结算价按订单
|
||||
// @Param token header string true "认证token"
|
||||
// @Param fromDate formData string true "订单起始日期"
|
||||
// @Param toDate formData string true "订单结束日期"
|
||||
// @Param fromTime formData string true "订单起始时间 (yyyy-mm-dd hh:ms:ss)"
|
||||
// @Param toTime formData string true "订单结束时间 (yyyy-mm-dd hh:ms:ss)"
|
||||
// @Param vendorOrderID formData string false "订单号"
|
||||
// @Param vendorIDs formData int false "平台ID列表[0,1,3]"
|
||||
// @Param vendorIDs formData string false "平台ID列表[0,1,3]"
|
||||
// @Param storeID formData int false "门店ID"
|
||||
// @Param isAsync formData bool true "是否异步操作"
|
||||
// @Param isContinueWhenError formData bool false "单个失败是否继续,缺省true"
|
||||
@@ -758,7 +758,7 @@ func (c *OrderController) RefreshHistoryOrdersEarningPrice() {
|
||||
c.callRefreshHistoryOrdersEarningPrice(func(params *tOrderRefreshHistoryOrdersEarningPriceParams) (retVal interface{}, errCode string, err error) {
|
||||
var vendorIDList []int
|
||||
if err = jxutils.Strings2Objs(params.VendorIDs, &vendorIDList); err == nil {
|
||||
err = orderman.FixedOrderManager.RefreshHistoryOrdersEarningPrice(params.Ctx, params.VendorOrderID, vendorIDList, params.StoreID, params.FromDate, params.ToDate, params.IsAsync, params.IsContinueWhenError)
|
||||
retVal, err = orderman.FixedOrderManager.RefreshHistoryOrdersEarningPrice(params.Ctx, params.VendorOrderID, vendorIDList, params.StoreID, params.FromTime, params.ToTime, params.IsAsync, params.IsContinueWhenError)
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user