不比较待创建且不可售的,京西有平台没有的商品

This commit is contained in:
Rosy-zhudan
2019-08-13 14:53:14 +08:00
parent 505dc40559
commit 06594330a5

View File

@@ -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)
}