- RefreshMtpsWaybillFee
This commit is contained in:
@@ -8,6 +8,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"git.rosy.net.cn/jx-callback/business/partner/delivery"
|
||||||
|
|
||||||
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxcallback/orderman"
|
"git.rosy.net.cn/jx-callback/business/jxcallback/orderman"
|
||||||
@@ -960,3 +962,29 @@ func RetrieveEbaiShopLicence(ctx *jxcontext.Context, isAsync, isContinueWhenErro
|
|||||||
}
|
}
|
||||||
return hint, err
|
return hint, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func RefreshMtpsWaybillFee(ctx *jxcontext.Context, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||||
|
var waybillList []*model.Waybill
|
||||||
|
db := dao.GetDB()
|
||||||
|
if err = dao.GetRows(db, &waybillList, `
|
||||||
|
SELECT *
|
||||||
|
FROM waybill
|
||||||
|
WHERE status_time > '2019-05-10' AND waybill_vendor_id = 102 AND desired_fee > 0
|
||||||
|
`); err == nil {
|
||||||
|
globals.SugarLogger.Debugf("RefreshMtpsWaybillFee, count:%d", len(waybillList))
|
||||||
|
rootTask := tasksch.NewParallelTask("RefreshMtpsWaybillFee", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx,
|
||||||
|
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||||
|
bill := batchItemList[0].(*model.Waybill)
|
||||||
|
bill.DesiredFee, _ = delivery.CalculateBillDeliveryFee(bill)
|
||||||
|
_, err = dao.UpdateEntity(db, bill, "DesiredFee")
|
||||||
|
return nil, err
|
||||||
|
}, waybillList)
|
||||||
|
tasksch.ManageTask(rootTask).Run()
|
||||||
|
if !isAsync {
|
||||||
|
_, err = rootTask.GetResult(0)
|
||||||
|
} else {
|
||||||
|
hint = rootTask.ID
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hint, err
|
||||||
|
}
|
||||||
|
|||||||
@@ -215,3 +215,18 @@ func (c *TempOpController) RetrieveEbaiShopLicence() {
|
|||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Title 刷新美团配送价格
|
||||||
|
// @Description 刷新美团配送价格
|
||||||
|
// @Param token header string true "认证token"
|
||||||
|
// @Param isAsync formData bool false "是否异步操作"
|
||||||
|
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||||||
|
// @Success 200 {object} controllers.CallResult
|
||||||
|
// @Failure 200 {object} controllers.CallResult
|
||||||
|
// @router /RefreshMtpsWaybillFee [post]
|
||||||
|
func (c *TempOpController) RefreshMtpsWaybillFee() {
|
||||||
|
c.callRefreshMtpsWaybillFee(func(params *tTempopRefreshMtpsWaybillFeeParams) (retVal interface{}, errCode string, err error) {
|
||||||
|
retVal, err = tempop.RefreshMtpsWaybillFee(params.Ctx, params.IsAsync, params.IsContinueWhenError)
|
||||||
|
return retVal, "", err
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -1366,6 +1366,15 @@ func init() {
|
|||||||
Filters: nil,
|
Filters: nil,
|
||||||
Params: nil})
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:TempOpController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:TempOpController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "RefreshMtpsWaybillFee",
|
||||||
|
Router: `/RefreshMtpsWaybillFee`,
|
||||||
|
AllowHTTPMethods: []string{"post"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:TempOpController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:TempOpController"],
|
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:TempOpController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:TempOpController"],
|
||||||
beego.ControllerComments{
|
beego.ControllerComments{
|
||||||
Method: "RetrieveEbaiShopLicence",
|
Method: "RetrieveEbaiShopLicence",
|
||||||
|
|||||||
Reference in New Issue
Block a user