创建标品优化
This commit is contained in:
@@ -1959,7 +1959,7 @@ func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader, categoryID
|
||||
if specQuality != 0 {
|
||||
skuName.Skus[0].SpecQuality = specQuality
|
||||
if specUnit == model.SpecUnitNames[1] || specUnit == model.SpecUnitNames[2] {
|
||||
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(specQuality))) * 1000)
|
||||
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(specQuality) * 1000)))
|
||||
} else {
|
||||
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(specQuality))))
|
||||
}
|
||||
@@ -1967,7 +1967,7 @@ func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader, categoryID
|
||||
if getNetUpcInfo.SpecQuality != 0 {
|
||||
if getNetUpcInfo.SpecUnit == model.SpecUnitNames[1] || getNetUpcInfo.SpecUnit == model.SpecUnitNames[2] ||
|
||||
getNetUpcInfo.SpecUnit == "KG" || getNetUpcInfo.SpecUnit == "l" {
|
||||
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(getNetUpcInfo.SpecQuality))) * 1000)
|
||||
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(getNetUpcInfo.SpecQuality) * 1000)))
|
||||
} else {
|
||||
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(specQuality))))
|
||||
}
|
||||
@@ -2044,7 +2044,7 @@ func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader, categoryID
|
||||
if specQuality != 0 {
|
||||
skuName.Skus[0].SpecQuality = specQuality
|
||||
if specUnit == model.SpecUnitNames[1] || specUnit == model.SpecUnitNames[2] {
|
||||
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(specQuality))) * 1000)
|
||||
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(specQuality) * 1000)))
|
||||
} else {
|
||||
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(specQuality))))
|
||||
}
|
||||
@@ -2053,7 +2053,7 @@ func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader, categoryID
|
||||
if getNetUpcInfo.SpecQuality != 0 {
|
||||
if getNetUpcInfo.SpecUnit == model.SpecUnitNames[1] || getNetUpcInfo.SpecUnit == model.SpecUnitNames[2] ||
|
||||
getNetUpcInfo.SpecUnit == "KG" || getNetUpcInfo.SpecUnit == "l" {
|
||||
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(getNetUpcInfo.SpecQuality))) * 1000)
|
||||
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(getNetUpcInfo.SpecQuality) * 1000)))
|
||||
} else {
|
||||
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(getNetUpcInfo.SpecQuality))))
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@ import (
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
|
||||
"git.rosy.net.cn/jx-callback/business/partner/purchase/jd"
|
||||
"git.rosy.net.cn/jx-callback/globals/api/apimanager"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
@@ -257,24 +255,25 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int, isAsyn
|
||||
}
|
||||
}
|
||||
dao.Commit(db)
|
||||
case 3:
|
||||
priceReferSnapshotList, err = dao.GetPriceReferSnapshotNoPage(db, []int{0}, nil, nil, snapshotAt)
|
||||
taskFunc := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
v := batchItemList[0].(*model.PriceReferSnapshot)
|
||||
for _, appOrg := range apimanager.CurAPIManager.GetAppOrgCodeList(model.VendorIDJD) {
|
||||
directPrice, _ := jd.GetAPI(appOrg).GetJdSkuDirectPrice(v.SkuID)
|
||||
v.JdDirectPrice = int(directPrice)
|
||||
dao.UpdateEntity(db, v, "JdDirectPrice")
|
||||
}
|
||||
return retVal, err
|
||||
}
|
||||
taskParallel := tasksch.NewParallelTask("获取并更新京东指导价格", tasksch.NewParallelConfig(), ctx, taskFunc, priceReferSnapshotList)
|
||||
tasksch.HandleTask(taskParallel, task, true).Run()
|
||||
_, err = taskParallel.GetResult(0)
|
||||
//TODO 京东查询接口报错,暂时屏蔽了
|
||||
// case 3:
|
||||
// priceReferSnapshotList, err = dao.GetPriceReferSnapshotNoPage(db, []int{0}, nil, nil, snapshotAt)
|
||||
// taskFunc := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
// v := batchItemList[0].(*model.PriceReferSnapshot)
|
||||
// for _, appOrg := range apimanager.CurAPIManager.GetAppOrgCodeList(model.VendorIDJD) {
|
||||
// directPrice, _ := jd.GetAPI(appOrg).GetJdSkuDirectPrice(v.SkuID)
|
||||
// v.JdDirectPrice = int(directPrice)
|
||||
// dao.UpdateEntity(db, v, "JdDirectPrice")
|
||||
// }
|
||||
// return retVal, err
|
||||
// }
|
||||
// taskParallel := tasksch.NewParallelTask("获取并更新京东指导价格", tasksch.NewParallelConfig(), ctx, taskFunc, priceReferSnapshotList)
|
||||
// tasksch.HandleTask(taskParallel, task, true).Run()
|
||||
// _, err = taskParallel.GetResult(0)
|
||||
}
|
||||
return result, err
|
||||
}
|
||||
taskSeq := tasksch.NewSeqTask2("生成每日价格统计", ctx, isContinueWhenError, taskSeqFunc, 4)
|
||||
taskSeq := tasksch.NewSeqTask2("生成每日价格统计", ctx, isContinueWhenError, taskSeqFunc, 3)
|
||||
tasksch.HandleTask(taskSeq, nil, true).Run()
|
||||
if !isAsync {
|
||||
_, err = taskSeq.GetResult(0)
|
||||
|
||||
Reference in New Issue
Block a user