diff --git a/business/jxstore/cms/store_sku_check.go b/business/jxstore/cms/store_sku_check.go index f3122f2a2..abfaff712 100644 --- a/business/jxstore/cms/store_sku_check.go +++ b/business/jxstore/cms/store_sku_check.go @@ -165,6 +165,18 @@ func GetSkuSaleStatusName(status int) string { return model.SkuStatusName[status] } +func GetBoolName(flag bool) string { + if flag { + return "是" + } else { + return "否" + } +} + +func IsSkuCanSale(saleStatus int) bool { + return saleStatus == model.SkuStatusNormal +} + func CompareJxAndVendor(vendorID int, storeIDStr, vendorStoreID, storeName string, filterJxSkuInfoMap map[int]*StoreSkuNameExt, filterVendorSkuInfoMap map[int]*partner.SkuNameInfo) { for skuID, jxSkuInfo := range filterJxSkuInfoMap { skuIDStr := utils.Int2Str(skuID) @@ -182,23 +194,14 @@ func CompareJxAndVendor(vendorID int, storeIDStr, vendorStoreID, storeName strin status = jxSkuInfo.Skus2[0].JdSyncStatus } syncStatus := utils.Int2Str(int(status)) - toBeCreate := "否" - if model.IsSyncStatusNeedCreate(status) { - toBeCreate = "是" - } - toBeDel := "否" - if model.IsSyncStatusNeedDelete(status) { - toBeDel = "是" - } + toBeCreate := GetBoolName(model.IsSyncStatusNeedCreate(status)) + toBeDel := GetBoolName(model.IsSyncStatusNeedDelete(status)) if vendorSkuInfo != nil { vendorSkuDetailName := vendorSkuInfo.SkuList[0].SkuName vendorSkuSaleStatusName := GetSkuSaleStatusName(vendorSkuInfo.SkuList[0].Status) isSaleStatusDiff := jxSkuSaleStatusName != vendorSkuSaleStatusName - if isFilterToBeCreateAndNotSale && model.IsSyncStatusNeedCreate(status) && jxSkuSaleStatus != model.SkuStatusNormal { - continue - } isNameDiff := jxSkuDetailName != vendorSkuDetailName if jxSkuDetailName != "" && vendorSkuDetailName != "" && strings.Contains(jxSkuDetailName, vendorSkuDetailName) { isNameDiff = false @@ -208,6 +211,9 @@ func CompareJxAndVendor(vendorID int, storeIDStr, vendorStoreID, storeName strin diffData.AppendData(vendorID, outPutData) } } else { + if isFilterToBeCreateAndNotSale && model.IsSyncStatusNeedCreate(status) && !IsSkuCanSale(jxSkuSaleStatus) { + continue + } outPutData := DiffData{storeIDStr, vendorStoreID, storeName, skuIDStr, syncStatus, toBeCreate, toBeDel, jxSkuDetailName, "", jxSkuSaleStatusName, ""} diffData.AppendData(vendorID, outPutData) }