差异对比程序修改
This commit is contained in:
@@ -36,7 +36,7 @@ const (
|
||||
DatAanalyse5 = "京西商品库没有,平台商品库有 "
|
||||
DatAanalyse6 = "京西商品库有,平台商品库没有"
|
||||
DatAanalyse7 = "同步状态异常"
|
||||
DatAanalyse8 = "平台门店未关注,应添加对应的平台门店商品"
|
||||
DatAanalyse8 = "平台门店未关注或平台门店商品库存为0,应添加对应的平台门店商品"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -369,11 +369,14 @@ func CompareJxAndVendor(vendorID int, storeIDStr, vendorStoreID, storeName strin
|
||||
if isSaleStatusDiff {
|
||||
reason += DatAanalyse4
|
||||
}
|
||||
if status != model.SkuStatusDontSale {
|
||||
reason += DatAanalyse7
|
||||
}
|
||||
outPutData := DiffData{storeIDStr, vendorStoreID, storeName, skuIDStr, syncStatus, toBeCreate, toBeDel, jxSkuDetailName, vendorSkuDetailName, jxSkuSaleStatusName, vendorSkuSaleStatusName, reason}
|
||||
diffData.AppendData(vendorID, outPutData)
|
||||
}
|
||||
if !isSaleStatusDiff && !isNameDiff {
|
||||
if status != 0 {
|
||||
if status != model.SkuStatusDontSale {
|
||||
outPutData := DiffData{storeIDStr, vendorStoreID, storeName, skuIDStr, syncStatus, toBeCreate, toBeDel, jxSkuDetailName, vendorSkuDetailName, jxSkuSaleStatusName, vendorSkuSaleStatusName, DatAanalyse7}
|
||||
diffData.AppendData(vendorID, outPutData)
|
||||
}
|
||||
@@ -383,11 +386,14 @@ func CompareJxAndVendor(vendorID int, storeIDStr, vendorStoreID, storeName strin
|
||||
continue
|
||||
}
|
||||
reason := ""
|
||||
if status == 0 {
|
||||
if status == model.SkuStatusDontSale {
|
||||
reason = DatAanalyse8
|
||||
} else {
|
||||
reason = DatAanalyse2
|
||||
}
|
||||
if status != model.SkuStatusDontSale {
|
||||
reason += DatAanalyse7
|
||||
}
|
||||
outPutData := DiffData{storeIDStr, vendorStoreID, storeName, skuIDStr, syncStatus, toBeCreate, toBeDel, jxSkuDetailName, "", jxSkuSaleStatusName, "", reason}
|
||||
diffData.AppendData(vendorID, outPutData)
|
||||
}
|
||||
@@ -537,15 +543,26 @@ func CheckSkuDiffBetweenJxAndVendor(ctx *jxcontext.Context, vendorIDList []int,
|
||||
storeIDStr := utils.Int2Str(storeID)
|
||||
storeName := jxStoreInfoListValue.Name
|
||||
if jxStoreInfoListValue.StoreMaps != nil {
|
||||
isGetJxSkuInfoData := false
|
||||
var filterJxSkuInfoMap map[int]*StoreSkuNameExt
|
||||
var filterJxSkuInfoMapSingle map[int]*StoreSkuNameExt
|
||||
var filterJxSkuInfoMapMulti map[int]*StoreSkuNameExt
|
||||
for _, vendorListValue := range jxStoreInfoListValue.StoreMaps {
|
||||
vendorID := int(utils.MustInterface2Int64(vendorListValue["vendorID"]))
|
||||
|
||||
if isGetJxSkuInfoData == false { //only get once jx sku info list every store id
|
||||
isGetJxSkuInfoData = true
|
||||
jxSkuInfoData, _ := GetStoreSkus(ctx, storeID, filterJxDepotUnSaleSkuIds, true, "", true, false, map[string]interface{}{}, 0, -1)
|
||||
filterJxSkuInfoMap = GetFilterJxSkuInfoMap(jxSkuInfoData.SkuNames) //map[京西商品ID:StoreSkuNameExt]
|
||||
//京西的门店商品只取一次
|
||||
flag := false
|
||||
jxSkuInfoDataSingle := &StoreSkuNamesInfo{}
|
||||
jxSkuInfoDataMulti := &StoreSkuNamesInfo{}
|
||||
if partner.IsMultiStore(vendorID) {
|
||||
if flag == false {
|
||||
jxSkuInfoDataMulti, _ = GetStoreSkus(ctx, storeID, filterJxDepotUnSaleSkuIds, true, "", true, false, map[string]interface{}{}, 0, -1)
|
||||
filterJxSkuInfoMapMulti = GetFilterJxSkuInfoMap(jxSkuInfoDataMulti.SkuNames) //map[京西商品ID:StoreSkuNameExt]
|
||||
flag = true
|
||||
}
|
||||
} else {
|
||||
if flag == false {
|
||||
jxSkuInfoDataSingle, _ = GetStoreSkus(ctx, storeID, []int{}, true, "", true, false, map[string]interface{}{}, 0, -1)
|
||||
filterJxSkuInfoMapSingle = GetFilterJxSkuInfoMap(jxSkuInfoDataSingle.SkuNames) //map[京西商品ID:StoreSkuNameExt]
|
||||
flag = true
|
||||
}
|
||||
}
|
||||
|
||||
vendorStoreID := utils.Interface2String(vendorListValue["vendorStoreID"])
|
||||
@@ -559,7 +576,7 @@ func CheckSkuDiffBetweenJxAndVendor(ctx *jxcontext.Context, vendorIDList []int,
|
||||
baseapi.SugarLogger.Infof("CheckSkuDiffBetweenJxAndVendor GetStoreSkusBareInfo error:%v", err)
|
||||
} else if len(skuBareInfoList) > 0 {
|
||||
filterSkuInfoMap := GetFilterMultiStoreSkuInfoMap(vendorID, skuBareInfoList) //map[京东商品ID:SkuNameInfo]
|
||||
CompareJxAndVendor(vendorID, storeIDStr, vendorStoreID, storeName, filterJxSkuInfoMap, filterSkuInfoMap)
|
||||
CompareJxAndVendor(vendorID, storeIDStr, vendorStoreID, storeName, filterJxSkuInfoMapMulti, filterSkuInfoMap)
|
||||
}
|
||||
} else {
|
||||
singleStoreHandler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreStoreSkuHandler)
|
||||
@@ -568,7 +585,7 @@ func CheckSkuDiffBetweenJxAndVendor(ctx *jxcontext.Context, vendorIDList []int,
|
||||
baseapi.SugarLogger.Infof("CheckSkuDiffBetweenJxAndVendor GetStoreSkusFullInfo error:%v", err)
|
||||
} else if len(vendorSkuInfoList) > 0 {
|
||||
filterVendorSkuInfoMap := GetFilterVendorSkuInfoMap(vendorSkuInfoList) //map[平台商品ID:SkuNameInfo]
|
||||
CompareJxAndVendor(vendorID, storeIDStr, vendorStoreID, storeName, filterJxSkuInfoMap, filterVendorSkuInfoMap)
|
||||
CompareJxAndVendor(vendorID, storeIDStr, vendorStoreID, storeName, filterJxSkuInfoMapSingle, filterVendorSkuInfoMap)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user