From 1f9c3ae763a478880461c7757808dfc825458d67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 10 Sep 2020 08:56:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E9=80=81=E8=B4=B9?= =?UTF-8?q?=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 | 21 +++++++++++++++++++-- business/jxstore/cms/sync_store_sku.go | 6 ------ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index f7655a986..bb0cb3ad1 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1,6 +1,7 @@ package orderman import ( + "crypto/md5" "errors" "fmt" "math" @@ -1755,7 +1756,7 @@ func UpdateWaybillDesiredFee(ctx *jxcontext.Context, vendorOrderID string, desir waybill := &model.Waybill{ VendorOrderID: order.VendorOrderID, OrderVendorID: order.VendorID, - VendorWaybillID: "-1", + VendorWaybillID: GenOrderNo(ctx), WaybillVendorID: -1, Status: model.WaybillStatusDelivered, WaybillCreatedAt: time.Now(), @@ -1765,7 +1766,7 @@ func UpdateWaybillDesiredFee(ctx *jxcontext.Context, vendorOrderID string, desir DesiredFee: int64(desiredFee), } dao.CreateEntity(db, waybill) - order.VendorWaybillID = "-1" + order.VendorWaybillID = waybill.VendorWaybillID dao.UpdateEntity(db, order, "VendorWaybillID") } else { bill.DesiredFee = int64(desiredFee) @@ -1779,3 +1780,19 @@ func AcceptOrRefuseOrder(ctx *jxcontext.Context, vendorOrderID string, vendorID handler := partner.GetPurchaseOrderHandlerFromVendorID(vendorID) return handler.AcceptOrRefuseOrder(order, isAccept, ctx.GetUserName()) } + +func GenOrderNo(ctx *jxcontext.Context) (orderNo int64) { + const prefix = 88 + const randPartNum = 1000 + orderNo = time.Now().Unix() - orderNoBeginTimestamp + // fmt.Println(orderNo) + orderNo = orderNo * randPartNum + md5Bytes := md5.Sum([]byte(utils.GetUUID())) + randPart := 0 + for k, v := range md5Bytes { + randPart += int(v) << ((k % 3) * 8) + } + orderNo += int64(randPart % randPartNum) + orderNo += int64(math.Pow10(int(math.Log10(float64(orderNo)))+1)) * prefix + return orderNo +} diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index 2441dbbe8..014b2a965 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -437,18 +437,12 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag } skus = skus2 } - if storeID == 667481 { - fmt.Println("gggggggggggggggggggggg1", len(skus)) - } formalizeStoreSkuList(skus) //京东商城的商品名规则不同 // name,空格,comment,约xxg // if vendorID == model.VendorIDJDShop { // formalizeStoreSkuListForJds(skus) // } - if storeID == 667481 { - fmt.Println("gggggggggggggggggggggg2", len(skus)) - } singleStoreHandler, _ := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreStoreSkuHandler) storeSkuHandler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IPurchasePlatformStoreSkuHandler) reorderHandler, _ := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IStoreSkuSorter)