From dc9c93f6282989d4d1938e78f9176d6902fac38c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 23 Jun 2020 08:41:56 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BE=8E=E5=9B=A2=E9=85=8D=E9=80=81=E6=9E=9C?= =?UTF-8?q?=E5=9B=AD=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 3 + business/jxstore/cms/store_sku.go | 2 +- business/jxstore/cms/sync.go | 4 +- business/jxstore/cms/sync_store_sku.go | 4 +- business/jxstore/misc/misc.go | 3 +- business/jxstore/tempop/tempop.go | 291 ---------------------- business/partner/delivery/mtps/waybill.go | 7 +- 7 files changed, 14 insertions(+), 300 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 51bdbc739..0f2aebec6 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1224,6 +1224,9 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) } stores, err := dao.GetStoreList(db, []int{storeID}, nil, nil, nil, "") if len(storeMaps) > 0 && len(stores) > 0 { + if storeMaps[0].VendorStoreID == "" { + return "", fmt.Errorf("该门店未绑定京狗平台,或绑定有误,请联系技术部!门店:[%v]", storeID) + } order.StoreID = storeID order.StoreName = stores[0].Name order.VendorStoreID = storeMaps[0].VendorStoreID diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index c2d2c3ffe..7858319e0 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -3334,6 +3334,7 @@ func AutoFocusStoreSkusForTopSkus(ctx *jxcontext.Context, isAsync, isContinueWhe var skuBindInfoList []*StoreSkuBindInfo for _, vv := range skuNameAndPlaceList { if skuNameMap[vv.ID] != 0 { + globals.SugarLogger.Debugf("testAutoFocusStoreSkusForTopSkus,storeID:%v,nameID:%v", v.ID, vv.ID) storeSkuBindInfo := &StoreSkuBindInfo{ StoreID: v.ID, NameID: vv.ID, @@ -4693,4 +4694,3 @@ func StoreSkuPriceAudit(ctx *jxcontext.Context, storeSkuAudits []*model.StoreSku } return hint, err } - diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 5edc598d3..667f1d49d 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -1184,14 +1184,14 @@ func syncJdsStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, parentTask tasksch for _, v := range updateList { skuBindInfos1 = append(skuBindInfos1, buildStoreSkuBindInfo(db, storeMap.StoreID, v, false)) } - _, err = UpdateStoresSkusByBind(ctx, parentTask, skuBindInfos1, isAsync, isContinueWhenError, false) + UpdateStoresSkusByBind(ctx, parentTask, skuBindInfos1, isAsync, isContinueWhenError, false) } if len(addList) > 0 { for _, v := range addList { skuBindInfos2 = append(skuBindInfos2, buildStoreSkuBindInfo(db, storeMap.StoreID, v, true)) } - _, err = UpdateStoresSkusByBind(ctx, parentTask, skuBindInfos2, isAsync, isContinueWhenError, false) + UpdateStoresSkusByBind(ctx, parentTask, skuBindInfos2, isAsync, isContinueWhenError, false) } return err } diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index a59358f35..81d2efce6 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -914,7 +914,9 @@ func amendAndPruneStoreStuff(ctx *jxcontext.Context, parentTask tasksch.ITask, v }) } } - + if storeID == 103075 { + fmt.Println("sku2Delete", utils.Format4Output(sku2Delete, false)) + } if opType == AmendPruneOnlyAmend || opType == AmendPruneAll { for _, v := range localSkuList { if !model.IsSyncStatusDelete(v.SkuSyncStatus) && v.BindID != 0 { diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index ce27f22ce..dd402e730 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -362,8 +362,7 @@ func syncStoreSku() { errList.AddErr(cms.SetSingleStoreSkuSyncModifyStatus(db, []int{1, 3})) // errList.AddErr(cms.SetSingleStoreSkuSyncModifyStatus(db, partner.GetSingleStoreVendorIDs())) - //TODO 06-22 暂时不做这个看看 - // _, err = cms.CurVendorSync.AmendAndPruneStoreStuff(jxcontext.AdminCtx, []int{1, 3}, nil, false, true, cms.AmendPruneAll, false) + _, err = cms.CurVendorSync.AmendAndPruneStoreStuff(jxcontext.AdminCtx, []int{1, 3}, nil, false, true, cms.AmendPruneAll, false) // _, err = cms.CurVendorSync.AmendAndPruneStoreStuff(jxcontext.AdminCtx, partner.GetSingleStoreVendorIDs(), nil, false, true, cms.AmendPruneAll, false) errList.AddErr(err) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 3f33d72d7..4a8654820 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -8,8 +8,6 @@ import ( "strings" "time" - "git.rosy.net.cn/baseapi/platformapi/jdshopapi" - "git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin" "git.rosy.net.cn/jx-callback/business/partner/delivery" "github.com/360EntSecGroup-Skylar/excelize" @@ -1611,295 +1609,6 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // continue // } // } - var jdsIds = []int64{69355523686, - 69353698875, - 69353633443, - 69353579080, - 69353592976, - 69353575450, - 69353669915, - 69353617240, - 69353711276, - 69355552630, - 69353579078, - 69633169613, - 69353608855, - 69634881612, - 69353634806, - 69353675911, - 69353698186, - 69353698877, - 69607962771, - 69608002604, - 69666543870, - 69353541693, - 69411607058, - 69353594629, - 69353602818, - 69353698187, - 69355538267, - 69353633269, - 69355549016, - 69411607059, - 69593365617, - 69353589341, - 69353618034, - 69353633445, - 69353644658, - 69353644659, - 69353664332, - 69355505481, - 69355531215, - 69355552632, - 69353618035, - 69353619589, - 69353684423, - 69353687174, - 69353722053, - 69355493882, - 69627859883, - 69680935348, - 69353555847, - 69353570677, - 69353589397, - 69353592975, - 69353594611, - 69353602819, - 69353616402, - 69353624528, - 69353654004, - 69353668114, - 69353687173, - 69353701089, - 69353722052, - 69353723922, - 69355527850, - 69355552631, - 69628257042, - 69636525703, - 69680935349, - 69353579081, - 69353589342, - 69353632136, - 69353654006, - 69353726354, - 69355496067, - 69355515747, - 69355516049, - 69355527036, - 69355532703, - 69355558164, - 69355560640, - 69608002434, - 69608089252, - 69626869676, - 69628142211, - 69651275202, - 69665458721, - 69980157422, - 69353511255, - 69353550931, - 69353555846, - 69353579079, - 69353593375, - 69353595563, - 69353603501, - 69353608856, - 69353618036, - 69353628469, - 69353628470, - 69353632137, - 69353633267, - 69353633444, - 69353651935, - 69353668115, - 69353683331, - 69353684157, - 69353701088, - 69353723844, - 69353723845, - 69353726353, - 69355490631, - 69355493881, - 69355493884, - 69355520278, - 69355523687, - 69355532705, - 69355533814, - 69355536851, - 69355538268, - 69355538269, - 69593321185, - 69593321186, - 69607997022, - 69626638026, - 69626638027, - 69626872037, - 69627693305, - 69627954144, - 69628180933, - 69633580083, - 69633580085, - 69634881613, - 69635037810, - 69635204944, - 69636212985, - 69636446354, - 69659137913, - 69659219611, - 69665406179, - 69666460731, - 69673523007, - 69680905913, - 69681869918, - 69821176674, - 69913341309, - 69916445013, - 69353511254, - 69353570678, - 69353581400, - 69353589343, - 69353589398, - 69353593376, - 69353594630, - 69353609816, - 69353616406, - 69353617241, - 69353619591, - 69353633268, - 69353634833, - 69353642793, - 69353647695, - 69353651934, - 69353654005, - 69353664333, - 69353669914, - 69353673334, - 69353684159, - 69353684603, - 69353684604, - 69353684605, - 69353684607, - 69353698876, - 69353701090, - 69353711277, - 69353711278, - 69353726357, - 69355496066, - 69355520277, - 69355523688, - 69355527851, - 69355533813, - 69355533815, - 69355538270, - 69355559874, - 69355559875, - 69355559876, - 69355560641, - 69607988687, - 69608089253, - 69625036409, - 69625436705, - 69626674146, - 69626756838, - 69626849783, - 69626872040, - 69627211928, - 69627823696, - 69627823697, - 69627824429, - 69627859882, - 69627954146, - 69628055157, - 69628209840, - 69628220046, - 69628244518, - 69628620179, - 69628645373, - 69633038980, - 69633169614, - 69633311068, - 69633433209, - 69634285577, - 69634285578, - 69634566319, - 69634566320, - 69634620948, - 69635037811, - 69635075404, - 69635108188, - 69636525704, - 69636563250, - 69636658901, - 69636658902, - 69651265114, - 69659219612, - 69659883978, - 69662122661, - 69666543871, - 69666543872, - 69666660395, - 69666907986, - 69666931214, - 69673508504, - 69680887348, - 69818078270, - 69881553035, - 69901783885, - 69913362221, - 69916396643, - 69925717199, - 69933144351, - 69933974117, - 69935756246, - 69935768981, - 69935855227, - 69935915640, - 69937601360, - 69937642148, - 69939562884, - 69939571687, - 69948026907, - } - db := dao.GetDB() - for _, v := range jdsIds { - vendorSku, _ := api.JdShopAPI.FindSkuById(v) - var sku *model.Sku - sql := ` - SELECT b.* FROM store_sku_bind a,sku b WHERE a.sku_id = b.id AND a.store_id = 102919 AND a.jds_id = ? - ` - sqlParams := []interface{}{v} - err = dao.GetRow(db, &sku, sql, sqlParams) - skus, _ := dao.GetStoreSkus(db, model.VendorIDJDShop, model.JdShopMainStoreID, []int{sku.ID}) - storeSku := skus[0] - if sku.Comment != "" { - var specQuality = utils.Float64ToStr(float64(storeSku.SpecQuality)) + storeSku.SpecUnit - vendorSkuAttr := vendorSku.SaleAttrs[0].AttrValueAlias[0] - if vendorSkuAttr == specQuality { - err = api.JdShopAPI.UpdateWareSaleAttrvalueAlias(&jdshopapi.UpdateWareSaleAttrvalueAliasParam{ - WareID: vendorSku.WareID, - Props: []*jdshopapi.CreateSkuParamAttrs2{ - &jdshopapi.CreateSkuParamAttrs2{ - AttrID: vendorSku.SaleAttrs[0].AttrID, - AttrValues: []string{vendorSku.SaleAttrs[0].AttrValues[0]}, - AttrValueAlias: []string{sku.Comment}, - Type: "com.jd.pop.ware.ic.api.domain.prop", - Type2: "com.jd.pop.ware.ic.api.domain.Prop", - }, - }, - }) - } else { - if vendorSkuAttr != sku.Comment { - _, maxNo, _ := api.JdShopAPI.FindValuesByAttrId(utils.Str2Int(vendorSku.SaleAttrs[0].AttrID)) - api.JdShopAPI.SaveVenderAttrValue(sku.Comment, utils.Str2Int(vendorSku.SaleAttrs[0].AttrID), int(storeSku.VendorVendorCatID), maxNo+1) - } - } - } - // attrValue := vendorSku.SaleAttrs[0].AttrValueAlias[0] - // if storeSkus != nil { - // cms.CurVendorSync.SyncStoresSkus(ctx, nil, 0, db, []int{model.VendorIDJDShop}, []int{model.JdShopMainStoreID}, []int{storeSkus.SkuID}, false, true, true) - // } - } return err } diff --git a/business/partner/delivery/mtps/waybill.go b/business/partner/delivery/mtps/waybill.go index 09fc6e264..4ef35ec60 100644 --- a/business/partner/delivery/mtps/waybill.go +++ b/business/partner/delivery/mtps/waybill.go @@ -61,6 +61,7 @@ func OnWaybillExcept(msg *mtpsapi.CallbackOrderExceptionMsg) (retVal *mtpsapi.Ca } func (c *DeliveryHandler) OnWaybillMsg(msg *mtpsapi.CallbackOrderMsg) (retVal *mtpsapi.CallbackResponse) { + c.pushToGy(msg) jxutils.CallMsgHandler(func() { retVal = c.onWaybillMsg(msg) }, jxutils.ComposeUniversalOrderID(msg.OrderID, model.VendorIDMTPS)) @@ -104,13 +105,13 @@ func (c *DeliveryHandler) onWaybillMsg(msg *mtpsapi.CallbackOrderMsg) (retVal *m globals.SugarLogger.Warnf("onWaybillMsg unknown msg:%v", msg) return mtpsapi.SuccessResponse } - c.pushToGy(order, msg) globals.SugarLogger.Debugf("onWaybillMsg test, %v", msg) return mtpsapi.Err2CallbackResponse(partner.CurOrderManager.OnWaybillStatusChanged(order), order.VendorStatus) } -func (c *DeliveryHandler) pushToGy(waybill *model.Waybill, msg *mtpsapi.CallbackOrderMsg) { - order, _ := dao.GetSimpleOrder(dao.GetDB(), waybill.VendorOrderID) +func (c *DeliveryHandler) pushToGy(msg *mtpsapi.CallbackOrderMsg) { + vendorOrderID, _ := jxutils.SplitUniversalOrderID(msg.OrderID) + order, _ := dao.GetSimpleOrder(dao.GetDB(), vendorOrderID) //查不到订单可能就是果园的订单 if order == nil { cl := http.Client{}