From 3b88b012b33f05f05df2449667fa73c4ce5b8664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Sat, 8 Oct 2022 18:07:48 +0800 Subject: [PATCH 1/4] 1 --- business/jxstore/cms/store_sku.go | 1 + business/jxstore/cms/store_sku_check.go | 13 ++++++++----- business/model/dao/store.go | 3 +++ business/model/dao/store_sku.go | 2 ++ business/model/model.go | 1 + business/model/store_sku.go | 2 ++ 6 files changed, 17 insertions(+), 5 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 857b009b2..b75deb6db 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -2060,6 +2060,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs skuBind.EbaiID = deletedSku.EbaiID skuBind.JdsID = deletedSku.JdsID skuBind.JdsWareID = deletedSku.JdsWareID + skuBind.DdID = deletedSku.DdID if num, err = dao.UpdateEntity(db, skuBind); err != nil { dao.Rollback(db, txDB) return nil, err diff --git a/business/jxstore/cms/store_sku_check.go b/business/jxstore/cms/store_sku_check.go index ff4bc0d3a..2fa311982 100644 --- a/business/jxstore/cms/store_sku_check.go +++ b/business/jxstore/cms/store_sku_check.go @@ -142,6 +142,7 @@ type DiffData struct { VendorStoreName string `json:"门店名"` SkuID string `json:"SkuID"` MtwmID string `json:"京西美团外卖ID"` + DdID string `json:"京西抖店ID"` EbaiID string `json:"京西饿百ID"` SyncStatus string `json:"同步状态"` ToBeCreate string `json:"待创建"` @@ -382,6 +383,8 @@ func CompareJxAndVendor(vendorID int, storeIDStr, vendorStoreID, storeName strin ebaiid := jxSkuInfo.Skus[0].EbaiID /*美团编码*/ mtwmid := jxSkuInfo.Skus[0].MtwmID + /*抖店编码*/ + ddid := jxSkuInfo.Skus[0].DdID //jxSkuPrice := strconv.Itoa(jxSkuInfo.Skus[0].JxPrice) /*商品类名*/ jxCategoryName := jxSkuInfo.Skus[0].CategoryName @@ -418,7 +421,7 @@ func CompareJxAndVendor(vendorID int, storeIDStr, vendorStoreID, storeName strin vendorPrice := fmt.Sprintf("%.2f", float64(vendorSkuInfo.SkuList[0].StoreSkuInfo.VendorPrice)/float64(100)) var IdMark bool if isJd == 0 { - IdMark = skuIDStr != ebaiid && skuIDStr != mtwmid + IdMark = skuIDStr != ebaiid && skuIDStr != mtwmid && skuIDStr != ddid } else { IdMark = false } @@ -454,12 +457,12 @@ func CompareJxAndVendor(vendorID int, storeIDStr, vendorStoreID, storeName strin if status != model.SkuStatusDontSale { reason += DatAanalyse7 } - outPutData := DiffData{storeIDStr, vendorStoreID, storeName, skuIDStr, mtwmid, ebaiid, syncStatus, toBeCreate, toBeDel, jxSkuDetailName, vendorSkuDetailName, jxSkuSaleStatusName, vendorSkuSaleStatusName, jxSkuPrice, vendorPrice, jxCategoryName, vendorCategoryName, reason} + outPutData := DiffData{storeIDStr, vendorStoreID, storeName, skuIDStr, mtwmid, ddid, ebaiid, syncStatus, toBeCreate, toBeDel, jxSkuDetailName, vendorSkuDetailName, jxSkuSaleStatusName, vendorSkuSaleStatusName, jxSkuPrice, vendorPrice, jxCategoryName, vendorCategoryName, reason} diffData.AppendData(vendorID, outPutData) } if !isSaleStatusDiff && !isNameDiff { if status != model.SkuStatusDontSale { - outPutData := DiffData{storeIDStr, vendorStoreID, storeName, skuIDStr, mtwmid, ebaiid, syncStatus, toBeCreate, toBeDel, jxSkuDetailName, vendorSkuDetailName, jxSkuSaleStatusName, vendorSkuSaleStatusName, jxSkuPrice, vendorPrice, jxCategoryName, vendorCategoryName, DatAanalyse7} + outPutData := DiffData{storeIDStr, vendorStoreID, storeName, skuIDStr, mtwmid, ddid, ebaiid, syncStatus, toBeCreate, toBeDel, jxSkuDetailName, vendorSkuDetailName, jxSkuSaleStatusName, vendorSkuSaleStatusName, jxSkuPrice, vendorPrice, jxCategoryName, vendorCategoryName, DatAanalyse7} diffData.AppendData(vendorID, outPutData) } } @@ -476,7 +479,7 @@ func CompareJxAndVendor(vendorID int, storeIDStr, vendorStoreID, storeName strin if status != model.SkuStatusDontSale { reason += DatAanalyse7 } - outPutData := DiffData{storeIDStr, vendorStoreID, storeName, skuIDStr, mtwmid, ebaiid, syncStatus, toBeCreate, toBeDel, jxSkuDetailName, "", jxSkuSaleStatusName, "", jxSkuPrice, "", jxCategoryName, "", reason} + outPutData := DiffData{storeIDStr, vendorStoreID, storeName, skuIDStr, mtwmid, ddid, ebaiid, syncStatus, toBeCreate, toBeDel, jxSkuDetailName, "", jxSkuSaleStatusName, "", jxSkuPrice, "", jxCategoryName, "", reason} diffData.AppendData(vendorID, outPutData) } } @@ -497,7 +500,7 @@ func CompareJxAndVendor(vendorID int, storeIDStr, vendorStoreID, storeName strin if len(vendorSkuInfo.VendorCatIDList) != 0 { vendorCategoryName = vendorSkuInfo.VendorCatIDList[len(vendorSkuInfo.VendorCatIDList)-1] } - outPutData := DiffData{storeIDStr, vendorStoreID, storeName, skuIDStr, "", "", "", "", "", "", vendorSkuDetailName, "", vendorSkuSaleStatusName, "", vendorPrice, "", vendorCategoryName, DatAanalyse1} + outPutData := DiffData{storeIDStr, vendorStoreID, storeName, skuIDStr, "", "", "", "", "", "", vendorSkuDetailName, "", vendorSkuSaleStatusName, "", vendorPrice, "", vendorCategoryName, DatAanalyse1, ""} diffData.AppendData(vendorID, outPutData) } } else { diff --git a/business/model/dao/store.go b/business/model/dao/store.go index 8f13399e6..29b6cb461 100644 --- a/business/model/dao/store.go +++ b/business/model/dao/store.go @@ -521,6 +521,9 @@ func AddStoreCategoryMap(db *DaoDB, storeID, categoryID int, vendorID int, vendo } else if vendorID == model.VendorIDJDShop { storeCat.JdsID = utils.Str2Int64WithDefault(vendorCategoryID, 0) storeCat.JdsSyncStatus = status + } else if vendorID == model.VendorIDDD { + storeCat.DdID = vendorCategoryID + storeCat.DdSyncStatus = status } else { panic("unsupported vendor") } diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index e9ecf8fc6..20cbe4fb2 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -286,11 +286,13 @@ type StoreSkuExt struct { EbaiID string `orm:"column(ebai_id);index" json:"ebaiID"` MtwmID string `orm:"column(mtwm_id)" json:"mtwmID"` // 这个也不是必须的,只是为了DAO取数据语句一致 YbID string `orm:"column(yb_id);index" json:"ybID"` + DdID string `orm:"column(dd_id);index" json:"ddID"` JdsID string `orm:"column(jds_id);index" json:"jdsID"` JdSyncStatus int8 `orm:"default(2)" json:"jdSyncStatus"` EbaiSyncStatus int8 `orm:"default(2)" json:"ebaiSyncStatus"` MtwmSyncStatus int8 `orm:"default(2)" json:"mtwmSyncStatus"` + DdSyncStatus int8 `orm:"default(2)" json:"ddSyncStatus"` YbSyncStatus int8 `orm:"default(2)" json:"ybSyncStatus"` JdsSyncStatus int8 `orm:"default(2)" json:"jdsSyncStatus"` //京东商城 diff --git a/business/model/model.go b/business/model/model.go index 10995dc59..233a9947b 100644 --- a/business/model/model.go +++ b/business/model/model.go @@ -33,6 +33,7 @@ const ( // FieldElmID = "ElmID" FieldEbaiID = "EbaiID" FieldMtwmID = "MtwmID" + FieldDdID = "DdID" // FieldWscID = "WscID" // FieldWscID2 = "WscID2" diff --git a/business/model/store_sku.go b/business/model/store_sku.go index 8d68cec39..676a2a216 100644 --- a/business/model/store_sku.go +++ b/business/model/store_sku.go @@ -58,11 +58,13 @@ type StoreSkuCategoryMap struct { // ElmID int64 `orm:"column(elm_id);index"` EbaiID int64 `orm:"column(ebai_id);index"` MtwmID string `orm:"column(mtwm_id);index;size(16)"` + DdID string `orm:"column(dd_id);index;size(16)"` // WscID int64 `orm:"column(wsc_id);index"` // ElmSyncStatus int8 `orm:"default(2)"` EbaiSyncStatus int8 `orm:"default(2)"` MtwmSyncStatus int8 `orm:"default(2)"` + DdSyncStatus int8 `orm:"default(2)"` // WscSyncStatus int8 `orm:"default(2)"` YbID int64 `orm:"column(yb_id);index"` YbSyncStatus int8 `orm:"default(2)"` From 13449061f58f160af1ad59f069de4c3f3e5d3e6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Sat, 8 Oct 2022 18:27:04 +0800 Subject: [PATCH 2/4] 1 --- business/jxstore/cms/store_sku.go | 14 +++++++------- business/model/dao/store_sku.go | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index b75deb6db..a1398d59c 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -617,8 +617,8 @@ func getGetStoresSkusBaseSQL(db *dao.DaoDB, storeIDs, skuIDs []int, upcs []strin keywordInt64, keywordInt64, model.ThingTypeSku, utils.DefaultTimeValue, keywordInt64) if isFocus { - sql += " OR t4.ebai_id = ? OR t4.mtwm_id = ?" - sqlParams = append(sqlParams, keywordInt64, keywordInt64) + sql += " OR t4.ebai_id = ? OR t4.mtwm_id = ? OR t4.dd_id = ?" + sqlParams = append(sqlParams, keywordInt64, keywordInt64,keywordInt64) } } sql += ")" @@ -875,8 +875,8 @@ func getGetStoresSkusBaseSQL2(db *dao.DaoDB, storeIDs, skuIDs []int, upcs []stri keywordInt64, keywordInt64, model.ThingTypeSku, utils.DefaultTimeValue, keywordInt64) if isFocus { - sql += " OR t4.ebai_id = ? OR t4.mtwm_id = ?" - sqlParams = append(sqlParams, keywordInt64, keywordInt64) + sql += " OR t4.ebai_id = ? OR t4.mtwm_id = ? OR t4.dd_id = ?" + sqlParams = append(sqlParams, keywordInt64, keywordInt64,keywordInt64) } } sql += ")" @@ -1134,7 +1134,7 @@ func GetStoresSkusNew(ctx *jxcontext.Context, storeIDs, skuIDs []int, upcs []str t2.comment, t2.category_id sku_category_id, t2.status sku_status, t2.eclp_id, t4.created_at bind_created_at, t4.updated_at bind_updated_at, t4.last_operator bind_last_operator, t4.deleted_at bind_deleted_at, t4.sub_store_id, t4.price bind_price, IF(t4.unit_price IS NOT NULL, t4.unit_price, t1.price) unit_price, t4.status store_sku_status, t4.auto_sale_at, - t4.ebai_id, t4.mtwm_id, t4.yb_id, CONCAT(smm.yb_store_prefix,t1.yb_name_suffix) yb_sku_name, t4.jds_id, t4.jds_ware_id, + t4.ebai_id, t4.mtwm_id,t4.dd_id, t4.yb_id, CONCAT(smm.yb_store_prefix,t1.yb_name_suffix) yb_sku_name, t4.jds_id, t4.jds_ware_id, t4.jd_sync_status, t4.ebai_sync_status, t4.mtwm_sync_status, t4.yb_sync_status, t4.jds_sync_status, t4.jd_price, t4.ebai_price, t4.mtwm_price, t4.jx_price, t4.yb_price, t4.jds_price, t4.jd_lock_time, t4.ebai_lock_time, t4.mtwm_lock_time, t4.jx_lock_time, t4.yb_lock_time, t4.jds_lock_time, @@ -1307,7 +1307,7 @@ func GetStoresSkusNew2(ctx *jxcontext.Context, storeIDs, skuIDs []int, upcs []st t2.comment, t2.category_id sku_category_id, t2.status sku_status, t2.eclp_id, t4.created_at bind_created_at, t4.updated_at bind_updated_at, t4.last_operator bind_last_operator, t4.deleted_at bind_deleted_at, t4.sub_store_id, t4.price bind_price, IF(t4.unit_price IS NOT NULL, t4.unit_price, t1.price) unit_price, t4.status store_sku_status, t4.auto_sale_at, - t4.ebai_id, t4.mtwm_id, t4.yb_id, CONCAT(smm.yb_store_prefix,t1.yb_name_suffix) yb_sku_name, t4.jds_id, t4.jds_ware_id, + t4.ebai_id, t4.mtwm_id,t4.dd_id, t4.yb_id, CONCAT(smm.yb_store_prefix,t1.yb_name_suffix) yb_sku_name, t4.jds_id, t4.jds_ware_id, t4.jd_sync_status, t4.ebai_sync_status, t4.mtwm_sync_status, t4.yb_sync_status, t4.jds_sync_status, t4.jd_price, t4.ebai_price, t4.mtwm_price, t4.jx_price, t4.yb_price, t4.jds_price, t4.jd_lock_time, t4.ebai_lock_time, t4.mtwm_lock_time, t4.jx_lock_time, t4.yb_lock_time, t4.jds_lock_time, @@ -3472,7 +3472,7 @@ func GetLocalStoreSkusByStoreID(storeID int) (tmp []*tGetStoresSkusInfoContainCa t2.comment, t2.category_id sku_category_id, t2.status sku_status, t2.eclp_id, t4.created_at bind_created_at, t4.updated_at bind_updated_at, t4.last_operator bind_last_operator, t4.deleted_at bind_deleted_at, t4.sub_store_id, t4.price bind_price, IF(t4.unit_price IS NOT NULL, t4.unit_price, t1.price) unit_price, t4.status store_sku_status, t4.auto_sale_at, - t4.ebai_id, t4.mtwm_id, t4.yb_id, CONCAT(smm.yb_store_prefix,t1.yb_name_suffix) yb_sku_name, t4.jds_id, t4.jds_ware_id, + t4.ebai_id, t4.mtwm_id,t4.dd_id, t4.yb_id, CONCAT(smm.yb_store_prefix,t1.yb_name_suffix) yb_sku_name, t4.jds_id, t4.jds_ware_id, t4.jd_sync_status, t4.ebai_sync_status, t4.mtwm_sync_status, t4.yb_sync_status, t4.jds_sync_status, t4.jd_price, t4.ebai_price, t4.mtwm_price, t4.jx_price, t4.yb_price, t4.jds_price, t4.jd_lock_time, t4.ebai_lock_time, t4.mtwm_lock_time, t4.jx_lock_time, t4.yb_lock_time, t4.jds_lock_time, diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index 20cbe4fb2..66c84fe78 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -1246,8 +1246,8 @@ func GetTopSkusByStoreIDs(db *DaoDB, storeIDs []int) (storeSkuNameExt []*StoreSk sql2 := ` SELECT a.id sku_id,a.*,t4.created_at bind_created_at, t4.updated_at bind_updated_at, t4.last_operator bind_last_operator, t4.deleted_at bind_deleted_at, t4.sub_store_id, t4.price bind_price, IF(t4.unit_price IS NOT NULL, t4.unit_price, t1.price) unit_price, t4.status store_sku_status, t4.auto_sale_at, - t4.ebai_id, t4.mtwm_id, - t4.ebai_sync_status, t4.mtwm_sync_status, + t4.ebai_id, t4.mtwm_id,t4.dd_id, + t4.ebai_sync_status, t4.mtwm_sync_status,t4.dd_sync_status, t4.jd_price, t4.ebai_price, t4.mtwm_price, t4.jx_price, t4.stock, a.spec_quality sku_spec_quality, a.spec_unit sku_spec_unit FROM sku a From a14879e0cf82a4b1b28cb36657b51881526ba56d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Sat, 8 Oct 2022 18:33:49 +0800 Subject: [PATCH 3/4] 1 --- business/model/dao/store_sku.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index 66c84fe78..2394aa151 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -308,6 +308,7 @@ type StoreSkuExt struct { JdsLockTime *time.Time `orm:"null" json:"jdsLockTime,omitempty"` EbaiLockTime *time.Time `orm:"null" json:"ebaiLockTime,omitempty"` MtwmLockTime *time.Time `orm:"null" json:"mtwmLockTime,omitempty"` + DdLockTime *time.Time `orm:"null" json:"ddLockTime,omitempty"` JxLockTime *time.Time `orm:"null" json:"jxLockTime,omitempty"` YbLockTime *time.Time `orm:"null" json:"ybLockTime,omitempty"` From 5b8e769ed1a6df5ef4fc0ff7626bd610fd015795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Sat, 8 Oct 2022 19:56:12 +0800 Subject: [PATCH 4/4] 1 --- business/jxstore/cms/sync.go | 4 +++- business/jxstore/cms/sync_store_sku.go | 1 - business/model/sku.go | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 12d79ed25..fc75537ea 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -461,7 +461,7 @@ func (v *VendorSync) SyncStoresCategory(ctx *jxcontext.Context, db *dao.DaoDB, v hint, err = v.LoopStoresMap(ctx, db, fmt.Sprintf("同步门店分类信息:%v", storeIDs), isAsync, isManageIt, vendorIDs, storeIDs, func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (interface{}, error) { loopMapInfo := batchItemList[0].(*LoopStoreMapInfo) - globals.SugarLogger.Debug("?????????????????????",v.GetSingleStoreHandler(loopMapInfo.VendorID)) + globals.SugarLogger.Debug("?????????????????????", v.GetSingleStoreHandler(loopMapInfo.VendorID)) if handler := v.GetSingleStoreHandler(loopMapInfo.VendorID); handler != nil { if isForce { dao.SetStoreCategorySyncStatus(db, loopMapInfo.VendorID, storeIDs, nil, model.SyncFlagModifiedMask) @@ -502,7 +502,9 @@ func (v *VendorSync) SyncStoresSkus2(ctx *jxcontext.Context, parentTask tasksch. tasksch.NewParallelConfig().SetParallelCount(parallelCount).SetIsContinueWhenError(isContinueWhenError), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { storeMap := batchItemList[0].(*model.StoreMap) + globals.SugarLogger.Debug("SyncStoresSkus2===============1") if syncDisabled || storeMap.Status > model.StoreStatusDisabled { + globals.SugarLogger.Debug("SyncStoresSkus2===============2") if setSyncStatus != 0 { dao.SetStoreSkuSyncStatus(db, storeMap.VendorID, []int{storeMap.StoreID}, skuIDs, setSyncStatus) } diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index e6b5c182d..48ff59ee1 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -442,7 +442,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag if err != nil || len(skus) == 0 { return err } - // globals.SugarLogger.Debugf("syncStoreSkuNew len(skus):%v", len(skus)) if len(excludeSkuIDs) > 0 { excludeSkuMap := jxutils.IntList2Map(excludeSkuIDs) var skus2 []*dao.StoreSkuSyncInfo diff --git a/business/model/sku.go b/business/model/sku.go index 294f43fca..a0ecb6e12 100644 --- a/business/model/sku.go +++ b/business/model/sku.go @@ -22,9 +22,9 @@ const ( ) const ( - SkuStatusDeleted = -1 - SkuStatusDontSale = 0 - SkuStatusNormal = 1 + SkuStatusDeleted = -1 // 商品删除 + SkuStatusDontSale = 0 // 商品正常 + SkuStatusNormal = 1 // 商品不可售 ) const (