删除日志
This commit is contained in:
@@ -69,7 +69,6 @@ func CreateStoreCategoryByStoreSku(ctx *jxcontext.Context, vendorID, storeID int
|
||||
}
|
||||
|
||||
func SyncStoreCategories(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorID, storeID int, vendorStoreID string, nameIDs, skuIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
globals.SugarLogger.Debugf("SyncStoreCategories %s storeID:%d, %s, userName:%s", model.VendorChineseNames[vendorID], storeID, vendorStoreID, ctx.GetUserName())
|
||||
handler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreStoreSkuHandler)
|
||||
num := 0
|
||||
db := dao.GetDB()
|
||||
@@ -387,12 +386,6 @@ func sku2Update(vendorID int, sku *dao.StoreSkuSyncInfo, syncStatus int8) (item
|
||||
|
||||
func updateStoreSku(db *dao.DaoDB, vendorID int, storeSkuList []*dao.StoreSkuSyncInfo, syncStatus int8) (num int64, err error) {
|
||||
if len(storeSkuList) > 0 {
|
||||
// defer func() {
|
||||
// if r := recover(); r != nil {
|
||||
// globals.SugarLogger.Debugf("updateStoreSku panic, vendorID:%d, len:%d, storeID0:%d, skuID0:%d, syncStatus:%d", vendorID, len(storeSkuList), storeSkuList[0].StoreID, storeSkuList[0].SkuID, syncStatus)
|
||||
// panic(r)
|
||||
// }
|
||||
// }()
|
||||
if vendorID == model.VendorIDJDShop {
|
||||
if syncStatus != model.SyncFlagPriceMask && syncStatus != model.SyncFlagSaleMask && syncStatus != model.SyncFlagStockMask {
|
||||
for _, v := range storeSkuList {
|
||||
@@ -440,7 +433,6 @@ func isSkuLockTimeValid(sku *dao.StoreSkuSyncInfo) bool {
|
||||
}
|
||||
|
||||
func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag int, isFull bool, vendorID, storeID int, vendorOrgCode string, nameIDs, skuIDs, excludeSkuIDs []int, useVendorPriceDirectly, isContinueWhenError bool) (err error) {
|
||||
globals.SugarLogger.Debugf("syncStoreSkuNew causeFlag:%d ,vendorOrgCode:%s", causeFlag, vendorOrgCode)
|
||||
db := dao.GetDB()
|
||||
storeDetail, err := dao.GetStoreDetail(db, storeID, vendorID, vendorOrgCode)
|
||||
if err != nil {
|
||||
@@ -503,7 +495,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
|
||||
var bareSku *partner.StoreSkuInfo
|
||||
isNeedReorder := false
|
||||
if isStoreSkuSyncNeedDelete(sku) {
|
||||
globals.SugarLogger.Debug("1.进入isStoreSkuSyncNeedDelete")
|
||||
if !dao.IsVendorThingIDEmpty(sku.VendorSkuID) {
|
||||
bareSku = storeSkuSyncInfo2Bare(sku)
|
||||
if singleStoreHandler == nil {
|
||||
@@ -516,10 +507,8 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
|
||||
updateItems = append(updateItems, sku2Update(vendorID, sku, model.SyncFlagDeletedMask))
|
||||
}
|
||||
} else if model.IsSyncStatusNew(sku.SkuSyncStatus) {
|
||||
globals.SugarLogger.Debug("4.进入model.IsSyncStatusNew(sku.SkuSyncStatus)")
|
||||
calVendorPrice4StoreSku(sku, storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage))
|
||||
if singleStoreHandler == nil {
|
||||
globals.SugarLogger.Debug("5.进入singleStoreHandler == nil")
|
||||
if dao.IsVendorThingIDEmpty(sku.VendorSkuID) {
|
||||
// todo 多平台商品库没有正常创建,直接跳过
|
||||
} else {
|
||||
@@ -532,11 +521,9 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
|
||||
} else {
|
||||
offlineList = append(offlineList, bareSku)
|
||||
}
|
||||
globals.SugarLogger.Debug("6.stockList,priceList,onlineList||offlineList ==============", stockList, priceList, onlineList, offlineList)
|
||||
}
|
||||
} else {
|
||||
if sku.MergedStatus == model.SkuStatusNormal {
|
||||
globals.SugarLogger.Debug("7.进入sku.MergedStatus == model.SkuStatusNormal")
|
||||
if vendorID == model.VendorIDDD {
|
||||
createList = append(createList, sku)
|
||||
} else if dao.IsVendorThingIDEmpty(sku.VendorCatID) && !strings.Contains(sku.StoreName, model.ExdStoreName) && vendorID != model.VendorIDYB && vendorID != model.VendorIDJDShop {
|
||||
@@ -547,13 +534,10 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
|
||||
createList = append(createList, sku)
|
||||
}
|
||||
}
|
||||
globals.SugarLogger.Debug("8.createList=======", createList)
|
||||
}
|
||||
isNeedReorder = true
|
||||
} else {
|
||||
globals.SugarLogger.Debug("9.进入not isStoreSkuSyncNeedDelete IsSyncStatusNew")
|
||||
if dao.IsVendorThingIDEmpty(sku.VendorSkuID) && vendorID != model.VendorIDJDShop {
|
||||
globals.SugarLogger.Debug("10.进入vendorID != model.VendorIDJDShop")
|
||||
// err = fmt.Errorf("门店:%d,修改没有创建的商品:%d", storeID, sku.SkuID)
|
||||
if vendorID != model.VendorIDJDShop || (vendorID == model.VendorIDJDShop && storeID == model.JdShopMainStoreID && sku.StoreSkuStatus != model.SkuStatusDontSale) {
|
||||
err = utils.NewErrorCode(fmt.Sprintf("门店:%d,修改没有创建的商品:%d", storeID, sku.SkuID), "-1", 0)
|
||||
@@ -564,14 +548,12 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
|
||||
parentTask.AddBatchErr(err)
|
||||
parentTask.AddFailedList(failedList)
|
||||
}
|
||||
globals.SugarLogger.Debug("11.failedList======", failedList)
|
||||
} else {
|
||||
globals.SugarLogger.Debug("12.进入vendorID == model.VendorIDJDShop")
|
||||
isAdded2Update := false
|
||||
// 修改商品信息时不改价(以免活动引起的失败),而用单独的改价来改
|
||||
if (model.IsSyncStatusUpdate(sku.SkuSyncStatus) || (model.IsSyncStatusSeq(sku.SkuSyncStatus) && reorderHandler == nil)) && singleStoreHandler != nil {
|
||||
if dao.IsVendorThingIDEmpty(sku.VendorCatID) && !strings.Contains(sku.StoreName, model.ExdStoreName) && vendorID != model.VendorIDYB {
|
||||
// globals.SugarLogger.Warnf("syncStoreSkuNew 修改门店:%d商品:%d,但没有平台分类ID", storeID, sku.SkuID)
|
||||
globals.SugarLogger.Warnf("syncStoreSkuNew 修改门店:%d商品:%d,但没有平台分类ID", storeID, sku.SkuID)
|
||||
} else {
|
||||
isAdded2Update = true
|
||||
updateList = append(updateList, calVendorPrice4StoreSku(sku, storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage)))
|
||||
@@ -582,7 +564,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
|
||||
priceList = append(priceList, bareSku)
|
||||
}
|
||||
if !isAdded2Update {
|
||||
globals.SugarLogger.Debug("15.进入!isAdded2Update")
|
||||
if model.IsSyncStatusUpdate(sku.SkuSyncStatus) && singleStoreHandler == nil { // 正常就不应该进到这里
|
||||
// if bareSku == nil {
|
||||
// bareSku = storeSkuSyncInfo2Bare(sku)
|
||||
@@ -603,7 +584,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
|
||||
// stockList = append(stockList, bareSku)
|
||||
// }
|
||||
}
|
||||
globals.SugarLogger.Debug("16.onlineList,stockList,offlineList===========", onlineList, stockList, offlineList)
|
||||
}
|
||||
//if model.IsSyncStatusStock(sku.SkuSyncStatus) {
|
||||
// if bareSku == nil {
|
||||
@@ -738,7 +718,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
|
||||
err = nil
|
||||
failedList = nil // 因为batchSize为1,可以这样处理
|
||||
} else if err2 != nil {
|
||||
globals.SugarLogger.Debug("31.sth wrong on err2: %v", err2)
|
||||
failedList = append(failedList, putils.GetErrMsg2FailedSingleList(batchedStoreSkuList, err2, storeID, model.VendorChineseNames[vendorID], "查询是否有该商品")...)
|
||||
}
|
||||
}
|
||||
@@ -758,7 +737,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
|
||||
}
|
||||
successList := putils.UnselectStoreSkuSyncListByVendorSkuIDs(batchedStoreSkuList, GetVendorSkuIDList(failedList))
|
||||
if len(successList) > 0 {
|
||||
globals.SugarLogger.Debug("19.len(successList) > 0 ,successList=========", successList)
|
||||
_, err := updateStoreSku(dao.GetDB(), vendorID, successList, model.SyncFlagNewMask)
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debugf("20.sth wrong on updateStoreSku: %v", err)
|
||||
@@ -787,7 +765,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
|
||||
task.AddFailedList(failedList)
|
||||
}
|
||||
successList := putils.UnselectStoreSkuSyncListByVendorSkuIDs(batchedStoreSkuList, GetVendorSkuIDList(failedList))
|
||||
globals.SugarLogger.Debug("23.failedList,successList============", failedList, successList)
|
||||
if len(successList) > 0 {
|
||||
_, err := updateStoreSku(dao.GetDB(), vendorID, successList, model.SyncFlagModifiedMask)
|
||||
if err != nil {
|
||||
@@ -804,7 +781,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
|
||||
_, err = putils.FreeBatchStoreSkuInfo("更新门店商品库存", func(task tasksch.ITask, batchedStoreSkuList []*partner.StoreSkuInfo) (result interface{}, successCount int, err error) {
|
||||
var failedList []*partner.StoreSkuInfoWithErr
|
||||
failedList, err = storeSkuHandler.UpdateStoreSkusStock(ctx, storeDetail.VendorOrgCode, storeID, vendorStoreID, batchedStoreSkuList)
|
||||
globals.SugarLogger.Debugf("failedList===========%s", utils.Format4Output(failedList, true))
|
||||
failedList, err = buildFailedListAndErr(failedList, err, batchedStoreSkuList, nil, storeID, vendorID, "更新门店商品库存")
|
||||
if len(failedList) > 0 {
|
||||
task.AddFailedList(failedList)
|
||||
@@ -869,7 +845,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
|
||||
for vendorCatID := range reorderSkuMap {
|
||||
vendorCatIDs = append(vendorCatIDs, vendorCatID)
|
||||
}
|
||||
globals.SugarLogger.Debugf("================门店商品排序%s", utils.Format4Output(reorderSkuMap, true))
|
||||
reorderTask := tasksch.NewParallelTask("门店商品排序", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError2), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
vendorCatID := batchItemList[0].(string)
|
||||
@@ -1140,8 +1115,6 @@ func AddCreateFlagForJxStoreSku(ctx *jxcontext.Context, parentTask tasksch.ITask
|
||||
}
|
||||
|
||||
func ClearRemoteStoreStuffAndSetNew(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorID, storeID int, vendorStoreID string, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
userName := ctx.GetUserName()
|
||||
globals.SugarLogger.Debugf("ClearRemoteStoreStuffAndSetNew storeID:%d, isContinueWhenError:%t, userName:%s", storeID, isContinueWhenError, userName)
|
||||
handler, _ := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreStoreSkuHandler)
|
||||
if handler == nil {
|
||||
return "", fmt.Errorf("平台:%s不支持此操作", model.VendorChineseNames[vendorID])
|
||||
@@ -1299,7 +1272,6 @@ func parseStoreSkuActList(isCreateAct bool, storeSkuList []*partner.StoreSkuInfo
|
||||
}
|
||||
|
||||
func createStoreSkuActs(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorID int, vendorOrgCode string, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo, isChangePrice bool) (err error) {
|
||||
globals.SugarLogger.Debugf("createStoreSkuActs vendorID:%d, storeID:%d, storeSkuList:%s", vendorID, storeID, utils.Format4Output(storeSkuList, true))
|
||||
skuIDs := putils.StoreSkuList2IDs(storeSkuList)
|
||||
db := dao.GetDB()
|
||||
storeSkuActList, err := dao.GetStoresSkusAct(db, 0, false, []int{storeID}, skuIDs, []int{vendorID}, false, 1, 0)
|
||||
@@ -1313,7 +1285,6 @@ func createStoreSkuActs(ctx *jxcontext.Context, parentTask tasksch.ITask, vendor
|
||||
}
|
||||
|
||||
func cancelStoreSkuActs(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorID int, vendorOrgCode string, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo, isChangePrice bool) (err error) {
|
||||
globals.SugarLogger.Debugf("cancelStoreSkuActs vendorID:%d, storeID:%d, storeSkuList:%s", vendorID, storeID, utils.Format4Output(storeSkuList, true))
|
||||
skuIDs := putils.StoreSkuList2IDs(storeSkuList)
|
||||
db := dao.GetDB()
|
||||
storeSkuActList, err := dao.GetStoresSkusAct(db, 0, false, []int{storeID}, skuIDs, []int{vendorID}, true, 0, 0)
|
||||
@@ -1328,7 +1299,6 @@ func cancelStoreSkuActs(ctx *jxcontext.Context, parentTask tasksch.ITask, vendor
|
||||
|
||||
func createStoreSkuActs2(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorID int, vendorOrgCode string, storeID int, vendorStoreID string,
|
||||
storeSkuList []*partner.StoreSkuInfo, storeSkuActList []*model.StoreSkuAct) (err error) {
|
||||
globals.SugarLogger.Debugf("createStoreSkuActs vendorID:%d, storeID:%d, storeSkuList:%s", vendorID, storeID, utils.Format4Output(storeSkuList, true))
|
||||
storeSkuList2, storeSkuActMap := parseStoreSkuActList(true, storeSkuList, storeSkuActList)
|
||||
if len(storeSkuList2) > 0 {
|
||||
storeSkuHandler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IPurchasePlatformStoreSkuHandler)
|
||||
@@ -1350,7 +1320,6 @@ func createStoreSkuActs2(ctx *jxcontext.Context, parentTask tasksch.ITask, vendo
|
||||
|
||||
func cancelStoreSkuActs2(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorID int, vendorOrgCode string, storeID int, vendorStoreID string,
|
||||
storeSkuList []*partner.StoreSkuInfo, storeSkuActList []*model.StoreSkuAct) (err error) {
|
||||
globals.SugarLogger.Debugf("cancelStoreSkuActs vendorID:%d, storeID:%d, storeSkuList:%s", vendorID, storeID, utils.Format4Output(storeSkuList, true))
|
||||
storeSkuList2, storeSkuActMap := parseStoreSkuActList(false, storeSkuList, storeSkuActList)
|
||||
if len(storeSkuList2) > 0 {
|
||||
storeSkuHandler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IPurchasePlatformStoreSkuHandler)
|
||||
|
||||
Reference in New Issue
Block a user