新增检测美团、饿了吗商品id与商品库差异
This commit is contained in:
@@ -33,15 +33,16 @@ const (
|
||||
|
||||
//错误类型
|
||||
const (
|
||||
DatAanalyse1 = "京西门店未关注,应删除对应的平台门店商品"
|
||||
DatAanalyse2 = "平台商品库未创建成功(可能无经营许可等) "
|
||||
DatAanalyse3 = "商品名不同 "
|
||||
DatAanalyse4 = "商品可售状态不同 "
|
||||
DatAanalyse5 = "京西商品库没有,平台商品库有 "
|
||||
DatAanalyse6 = "京西商品库有,平台商品库没有"
|
||||
DatAanalyse7 = "同步状态异常"
|
||||
DatAanalyse8 = "平台门店未关注或平台门店商品库存为0,应添加对应的平台门店商品"
|
||||
DatAanalyse9 = "平台门店价格与京西商品库价格不一致"
|
||||
DatAanalyse1 = "京西门店未关注,应删除对应的平台门店商品"
|
||||
DatAanalyse2 = "平台商品库未创建成功(可能无经营许可等) "
|
||||
DatAanalyse3 = "商品名不同 "
|
||||
DatAanalyse4 = "商品可售状态不同 "
|
||||
DatAanalyse5 = "京西商品库没有,平台商品库有 "
|
||||
DatAanalyse6 = "京西商品库有,平台商品库没有"
|
||||
DatAanalyse7 = "同步状态异常"
|
||||
DatAanalyse8 = "平台门店未关注或平台门店商品库存为0,应添加对应的平台门店商品"
|
||||
DatAanalyse9 = "平台门店价格与京西商品库价格不一致"
|
||||
DatAanalyse10 = "平台商品的VendorSkuID与京西的VendorSkuID不一致"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -59,6 +60,8 @@ var (
|
||||
"平台门店ID",
|
||||
"门店名",
|
||||
"SkuID",
|
||||
"京西美团外卖ID",
|
||||
"京西饿百ID",
|
||||
"同步状态",
|
||||
"待创建",
|
||||
"待删除",
|
||||
@@ -135,6 +138,8 @@ type DiffData struct {
|
||||
VendorStoreID string `json:"平台门店ID"`
|
||||
VendorStoreName string `json:"门店名"`
|
||||
SkuID string `json:"SkuID"`
|
||||
MtwmID string `json:"京西美团外卖ID"`
|
||||
EbaiID string `json:"京西饿百ID"`
|
||||
SyncStatus string `json:"同步状态"`
|
||||
ToBeCreate string `json:"待创建"`
|
||||
ToBeDel string `json:"待删除"`
|
||||
@@ -346,8 +351,8 @@ func IsSkuCanSale(saleStatus int) bool {
|
||||
}
|
||||
|
||||
//京西平台和其他平台商品的对比
|
||||
//storeIDStr 京西商家id ,vendorStoreID 平台商家id
|
||||
func CompareJxAndVendor(vendorID int, storeIDStr, vendorStoreID, storeName string, filterJxSkuInfoMap map[int]*dao.StoreSkuNameExt, filterVendorSkuInfoMap map[int]*partner.SkuNameInfo) {
|
||||
//storeIDStr 京西商家id ,vendorStoreID 平台商家id ,isJd 京东比较的标记 0不是,1是
|
||||
func CompareJxAndVendor(vendorID int, storeIDStr, vendorStoreID, storeName string, filterJxSkuInfoMap map[int]*dao.StoreSkuNameExt, filterVendorSkuInfoMap map[int]*partner.SkuNameInfo, isJd int) {
|
||||
//utils.Writelog("进入 CompareJxAndVendor 方法")
|
||||
for skuID, jxSkuInfo := range filterJxSkuInfoMap {
|
||||
skuIDStr := utils.Int2Str(skuID)
|
||||
@@ -368,6 +373,10 @@ func CompareJxAndVendor(vendorID int, storeIDStr, vendorStoreID, storeName strin
|
||||
jxSkuSaleStatusName := GetSkuSaleStatusName(jxSkuSaleStatus + 3)
|
||||
/*京西价格*/
|
||||
jxSkuPrice := fmt.Sprintf("%.2f", float64(jxSkuInfo.Skus[0].JxPrice)/float64(100))
|
||||
/*饿了吗编码*/
|
||||
ebaiid := jxSkuInfo.Skus[0].EbaiID
|
||||
/*美团编码*/
|
||||
mtwmid := jxSkuInfo.Skus[0].MtwmID
|
||||
//jxSkuPrice := strconv.Itoa(jxSkuInfo.Skus[0].JxPrice)
|
||||
vendorSkuInfo := filterVendorSkuInfoMap[skuID]
|
||||
var status int8
|
||||
@@ -387,6 +396,12 @@ func CompareJxAndVendor(vendorID int, storeIDStr, vendorStoreID, storeName strin
|
||||
vendorSkuSaleStatusName := GetSkuSaleStatusName(vendorSkuInfo.SkuList[0].Status + 3)
|
||||
/* 供货商价格 */
|
||||
vendorPrice := fmt.Sprintf("%.2f", float64(vendorSkuInfo.SkuList[0].StoreSkuInfo.VendorPrice)/float64(100))
|
||||
var IdMark bool
|
||||
if isJd == 0 {
|
||||
IdMark = skuIDStr != ebaiid && skuIDStr != mtwmid
|
||||
} else {
|
||||
IdMark = false
|
||||
}
|
||||
isSaleStatusDiff := jxSkuSaleStatusName != vendorSkuSaleStatusName
|
||||
isNameDiff := jxSkuDetailName != vendorSkuDetailName
|
||||
/*比较价格*/
|
||||
@@ -407,15 +422,18 @@ func CompareJxAndVendor(vendorID int, storeIDStr, vendorStoreID, storeName strin
|
||||
if isPriceDiff {
|
||||
reason += DatAanalyse9
|
||||
}
|
||||
if IdMark {
|
||||
reason += DatAanalyse10
|
||||
}
|
||||
if status != model.SkuStatusDontSale {
|
||||
reason += DatAanalyse7
|
||||
}
|
||||
outPutData := DiffData{storeIDStr, vendorStoreID, storeName, skuIDStr, syncStatus, toBeCreate, toBeDel, jxSkuDetailName, vendorSkuDetailName, jxSkuSaleStatusName, vendorSkuSaleStatusName, jxSkuPrice, vendorPrice, reason}
|
||||
outPutData := DiffData{storeIDStr, vendorStoreID, storeName, skuIDStr, mtwmid, ebaiid, syncStatus, toBeCreate, toBeDel, jxSkuDetailName, vendorSkuDetailName, jxSkuSaleStatusName, vendorSkuSaleStatusName, jxSkuPrice, vendorPrice, reason}
|
||||
diffData.AppendData(vendorID, outPutData)
|
||||
}
|
||||
if !isSaleStatusDiff && !isNameDiff {
|
||||
if status != model.SkuStatusDontSale {
|
||||
outPutData := DiffData{storeIDStr, vendorStoreID, storeName, skuIDStr, syncStatus, toBeCreate, toBeDel, jxSkuDetailName, vendorSkuDetailName, jxSkuSaleStatusName, vendorSkuSaleStatusName, jxSkuPrice, vendorPrice, DatAanalyse7}
|
||||
outPutData := DiffData{storeIDStr, vendorStoreID, storeName, skuIDStr, mtwmid, ebaiid, syncStatus, toBeCreate, toBeDel, jxSkuDetailName, vendorSkuDetailName, jxSkuSaleStatusName, vendorSkuSaleStatusName, jxSkuPrice, vendorPrice, DatAanalyse7}
|
||||
diffData.AppendData(vendorID, outPutData)
|
||||
}
|
||||
}
|
||||
@@ -432,7 +450,7 @@ func CompareJxAndVendor(vendorID int, storeIDStr, vendorStoreID, storeName strin
|
||||
if status != model.SkuStatusDontSale {
|
||||
reason += DatAanalyse7
|
||||
}
|
||||
outPutData := DiffData{storeIDStr, vendorStoreID, storeName, skuIDStr, syncStatus, toBeCreate, toBeDel, jxSkuDetailName, "", jxSkuSaleStatusName, "", jxSkuPrice, "", reason}
|
||||
outPutData := DiffData{storeIDStr, vendorStoreID, storeName, skuIDStr, mtwmid, ebaiid, syncStatus, toBeCreate, toBeDel, jxSkuDetailName, "", jxSkuSaleStatusName, "", jxSkuPrice, "", reason}
|
||||
diffData.AppendData(vendorID, outPutData)
|
||||
}
|
||||
}
|
||||
@@ -448,7 +466,7 @@ func CompareJxAndVendor(vendorID int, storeIDStr, vendorStoreID, storeName strin
|
||||
jxSkuInfo := filterJxSkuInfoMap[skuID]
|
||||
/*平台有,京西没有*/
|
||||
if jxSkuInfo == nil {
|
||||
outPutData := DiffData{storeIDStr, vendorStoreID, storeName, skuIDStr, "", "", "", "", vendorSkuDetailName, "", vendorSkuSaleStatusName, "", vendorPrice, DatAanalyse1}
|
||||
outPutData := DiffData{storeIDStr, vendorStoreID, "", "", storeName, skuIDStr, "", "", "", "", vendorSkuDetailName, "", vendorSkuSaleStatusName, "", vendorPrice, DatAanalyse1}
|
||||
diffData.AppendData(vendorID, outPutData)
|
||||
}
|
||||
} else {
|
||||
@@ -673,7 +691,7 @@ func TestDiff(ctx *jxcontext.Context, vendorIDList []int, storeIDList []int) {
|
||||
} else if len(skuBareInfoList) > 0 {
|
||||
//获取京东的商品
|
||||
filterSkuInfoMap := GetFilterMultiStoreSkuInfoMap(vendorID, vendorListValue.VendorOrgCode, skuBareInfoList) //map[京东商品ID:SkuNameInfo]
|
||||
CompareJxAndVendor(vendorID, storeIDStr, vendorStoreID, storeName, filterJxSkuInfoMapMulti, filterSkuInfoMap)
|
||||
CompareJxAndVendor(vendorID, storeIDStr, vendorStoreID, storeName, filterJxSkuInfoMapMulti, filterSkuInfoMap, 1)
|
||||
}
|
||||
} else {
|
||||
singleStoreHandler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreStoreSkuHandler)
|
||||
@@ -683,7 +701,7 @@ func TestDiff(ctx *jxcontext.Context, vendorIDList []int, storeIDList []int) {
|
||||
} else if len(vendorSkuInfoList) > 0 {
|
||||
//获取京东的商品
|
||||
filterVendorSkuInfoMap := GetFilterVendorSkuInfoMap(vendorSkuInfoList) //map[平台商品ID:SkuNameInfo]
|
||||
CompareJxAndVendor(vendorID, storeIDStr, vendorStoreID, storeName, filterJxSkuInfoMapSingle, filterVendorSkuInfoMap)
|
||||
CompareJxAndVendor(vendorID, storeIDStr, vendorStoreID, storeName, filterJxSkuInfoMapSingle, filterVendorSkuInfoMap, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -871,7 +889,7 @@ func CheckSkuDiffBetweenJxAndVendor(ctx *jxcontext.Context, vendorIDList []int,
|
||||
baseapi.SugarLogger.Infof("CheckSkuDiffBetweenJxAndVendor GetStoreSkusBareInfo error:%v", err)
|
||||
} else if len(skuBareInfoList) > 0 {
|
||||
filterSkuInfoMap := GetFilterMultiStoreSkuInfoMap(vendorID, vendorListValue.VendorOrgCode, skuBareInfoList) //map[京东商品ID:SkuNameInfo]
|
||||
CompareJxAndVendor(vendorID, storeIDStr, vendorStoreID, storeName, filterJxSkuInfoMapMulti, filterSkuInfoMap)
|
||||
CompareJxAndVendor(vendorID, storeIDStr, vendorStoreID, storeName, filterJxSkuInfoMapMulti, filterSkuInfoMap, 1)
|
||||
}
|
||||
} else {
|
||||
singleStoreHandler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreStoreSkuHandler)
|
||||
@@ -880,7 +898,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, filterJxSkuInfoMapSingle, filterVendorSkuInfoMap)
|
||||
CompareJxAndVendor(vendorID, storeIDStr, vendorStoreID, storeName, filterJxSkuInfoMapSingle, filterVendorSkuInfoMap, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user