From 2a2242c10f4cfe8e3f4be0d50225f9bf88d9a581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 13 May 2020 18:08:02 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=88=B7=E6=96=B0=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E7=BB=93=E7=AE=97=E4=BB=B7=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 +++ 1 file changed, 3 insertions(+) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index d7bdec088..200ececb5 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -710,6 +710,9 @@ func (c *OrderManager) RefreshHistoryOrdersEarningPrice(ctx *jxcontext.Context, actList, _ := dao.QueryActs(db, actID, 0, math.MaxInt32, 0, "", -1, nil, nil, nil, 0, nil, 0, utils.DefaultTimeValue, utils.DefaultTimeValue, utils.DefaultTimeValue, utils.DefaultTimeValue) if len(actList.Data) > 0 { orderList, _ = dao.QueryOrders(db, vendorOrderID, actID, vendorIDs, storeID, actList.Data[0].BeginAt, actList.Data[0].EndAt) + if len(orderList) == 0 { + return "", model.ErrCodeGeneralFailed, errors.New(fmt.Sprintf("未查询到相关订单!开始时间:[%v],结束时间:[%v]", actList.Data[0].BeginAt, actList.Data[0].EndAt)) + } } else { return "", model.ErrCodeGeneralFailed, errors.New(fmt.Sprintf("未查询到相关结算活动,活动ID:[%d]", actID)) } From f1e5c2c9984bad3cf0f849b024d4a770743cbd84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 13 May 2020 18:12:06 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=88=B7=E6=96=B0=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E7=BB=93=E7=AE=97=E4=BB=B7=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 | 1 + 1 file changed, 1 insertion(+) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 200ececb5..aa1353764 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -750,6 +750,7 @@ func (c *OrderManager) RefreshHistoryOrdersEarningPrice(ctx *jxcontext.Context, } }() for _, value := range order.Skus { + fmt.Println("test1111111111111111111111", utils.Format4Output(value, false)) // storeID := 0 // if order.StoreID == 0 { // storeID = order.JxStoreID From 0685af5764fb822ec925d0485a63d69c108d706c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 13 May 2020 18:18:28 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E5=88=B7=E6=96=B0=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E7=BB=93=E7=AE=97=E4=BB=B7=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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index aa1353764..10e13bd27 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -423,6 +423,7 @@ func updateSingleOrderEarningPrice(order *model.GoodsOrder, db *dao.DaoDB) { } if len(skuIDMap) > 0 { actStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, []int{order.VendorID}, model.ActTypeAll, []int{jxStoreID}, jxutils.IntMap2List(skuIDMap), order.OrderCreatedAt, order.OrderCreatedAt) + fmt.Println("test11111111111111111111111111111", utils.Format4Output(actStoreSkuList, false)) if err != nil { globals.SugarLogger.Errorf("updateOrderSkuOtherInfo can not get sku promotion info for error:%v", err) } @@ -750,7 +751,6 @@ func (c *OrderManager) RefreshHistoryOrdersEarningPrice(ctx *jxcontext.Context, } }() for _, value := range order.Skus { - fmt.Println("test1111111111111111111111", utils.Format4Output(value, false)) // storeID := 0 // if order.StoreID == 0 { // storeID = order.JxStoreID From e56231a2d80979499b8fc000e5f21b8e0188b738 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, 14 May 2020 08:51:18 +0800 Subject: [PATCH 4/6] aa --- business/jxcallback/orderman/order.go | 1 - 1 file changed, 1 deletion(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 10e13bd27..200ececb5 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -423,7 +423,6 @@ func updateSingleOrderEarningPrice(order *model.GoodsOrder, db *dao.DaoDB) { } if len(skuIDMap) > 0 { actStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, []int{order.VendorID}, model.ActTypeAll, []int{jxStoreID}, jxutils.IntMap2List(skuIDMap), order.OrderCreatedAt, order.OrderCreatedAt) - fmt.Println("test11111111111111111111111111111", utils.Format4Output(actStoreSkuList, false)) if err != nil { globals.SugarLogger.Errorf("updateOrderSkuOtherInfo can not get sku promotion info for error:%v", err) } From f6c7275d4f33d4bd1f560754ae68bf4525c9d3c5 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, 14 May 2020 09:22:59 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E4=BB=B7=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 2 +- business/jxutils/jxutils_act.go | 6 ++++++ business/model/order.go | 1 + business/partner/purchase/mtwm/order.go | 7 +++++++ business/partner/purchase/yb/store_sku.go | 3 +++ 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 200ececb5..88e899361 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -387,7 +387,7 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao. storeID = order.StoreID } result, err := dao.GetEffectiveActStoreSkuInfo2(db, 0, []int{order.VendorID}, []int{model.ActSkuSecKill, model.ActSkuDirectDown}, []int{storeID}, []int{v.SkuID}, order.OrderCreatedAt, order.OrderCreatedAt) - if len(result) > 0 && err == nil { + if (len(result) > 0 && err == nil) || v.IsVendorAct == model.YES { if v.VendorPrice == v.SalePrice { var earningPrice = 0 if v.ShopPrice < v.SalePrice { diff --git a/business/jxutils/jxutils_act.go b/business/jxutils/jxutils_act.go index 575e8f650..cd12c9076 100644 --- a/business/jxutils/jxutils_act.go +++ b/business/jxutils/jxutils_act.go @@ -1,6 +1,10 @@ package jxutils import ( + "fmt" + + "git.rosy.net.cn/baseapi/utils" + "git.rosy.net.cn/jx-callback/business/model" ) @@ -19,9 +23,11 @@ func NewActStoreSkuMap(actStoreSkuList []*model.ActStoreSku2, isActPrice bool) ( } if (isActPrice && v.ActualActPrice > 0 && (actStoreSkuMap[index][v.VendorID] == nil || actStoreSkuMap[index][v.VendorID].ActualActPrice > v.ActualActPrice)) || (!isActPrice && v.EarningPrice > 0 && (actStoreSkuMap[index][v.VendorID] == nil || actStoreSkuMap[index][v.VendorID].EarningPrice > v.EarningPrice)) { + fmt.Println("test222222222222222222222222222222222", *v) actStoreSkuMap[index][v.VendorID] = v } } + fmt.Println("test11111111111111111111111111111111", utils.Format4Output(actStoreSkuMap, false)) actMap.actStoreSkuMap = actStoreSkuMap return actMap } diff --git a/business/model/order.go b/business/model/order.go index 175171a9f..a1a3cd677 100644 --- a/business/model/order.go +++ b/business/model/order.go @@ -154,6 +154,7 @@ type OrderSku struct { SkuType int `json:"skuType"` // 当前如果为gift就为1,否则缺省为0 PromotionType int `json:"promotionType"` // todo 当前是用于记录京东的PromotionType(生成jxorder用),没有做转换 OrderCreatedAt time.Time `orm:"type(datetime);index" json:"-"` // 分区考虑 + IsVendorAct int `json:"isVendorAct"` } // 同样商品在一个订单中可能重复出现(比如搞活动时,相同商品价格不一样,第一个有优惠) diff --git a/business/partner/purchase/mtwm/order.go b/business/partner/purchase/mtwm/order.go index 7a53cfb1c..06e8fff29 100644 --- a/business/partner/purchase/mtwm/order.go +++ b/business/partner/purchase/mtwm/order.go @@ -232,6 +232,7 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo } ignoreSkuMap := make(map[int]int) // detail := result["detail"].([]interface{}) + multiSkuMap := make(map[int]int) for _, product := range detail { // product := product2.(map[string]interface{}) skuName := product["food_name"].(string) @@ -264,6 +265,12 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo // sku.SkuType = 1 // } order.Skus = append(order.Skus, sku) + multiSkuMap[sku.SkuID]++ + } + for _, v := range order.Skus { + if multiSkuMap[v.SkuID] > 1 && v.SalePrice == v.VendorPrice { + v.IsVendorAct = model.YES + } } jxutils.RefreshOrderSkuRelated(order) diff --git a/business/partner/purchase/yb/store_sku.go b/business/partner/purchase/yb/store_sku.go index 85b208608..530c8964d 100644 --- a/business/partner/purchase/yb/store_sku.go +++ b/business/partner/purchase/yb/store_sku.go @@ -101,6 +101,9 @@ func (p *PurchaseHandler) GetStoreSkusFullInfo(ctx *jxcontext.Context, parentTas if len(storeSkuList) == 1 { storeSku := storeSkuList[0] result, err := api.YinBaoAPI.QueryProductByBarcode(storeSku.VendorSkuID) + if err != nil || result == nil { + return nil, err + } resultp, err := api.YinBaoAPI.QueryProductImagesByBarcode(result.Barcode) // resultp, err := getProductImages(vendorStoreID, storeSku.VendorSkuID) if err != nil { From d06d411b893c8de271953763ef1118231ce0d68e 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, 14 May 2020 09:50:05 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=88=B7=E6=96=B0=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E4=BB=B7=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 1 + business/jxutils/jxutils_act.go | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 88e899361..810e68296 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -738,6 +738,7 @@ func (c *OrderManager) RefreshHistoryOrdersEarningPrice(ctx *jxcontext.Context, task := tasksch.NewParallelTask("刷新历史订单结算价", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { order := batchItemList[0].(*model.GoodsOrder) + fmt.Println("test333333333333333333333333333333", order.VendorOrderID) db := dao.GetDB() updateSingleOrderEarningPrice(order, db) dao.Begin(db) diff --git a/business/jxutils/jxutils_act.go b/business/jxutils/jxutils_act.go index cd12c9076..575e8f650 100644 --- a/business/jxutils/jxutils_act.go +++ b/business/jxutils/jxutils_act.go @@ -1,10 +1,6 @@ package jxutils import ( - "fmt" - - "git.rosy.net.cn/baseapi/utils" - "git.rosy.net.cn/jx-callback/business/model" ) @@ -23,11 +19,9 @@ func NewActStoreSkuMap(actStoreSkuList []*model.ActStoreSku2, isActPrice bool) ( } if (isActPrice && v.ActualActPrice > 0 && (actStoreSkuMap[index][v.VendorID] == nil || actStoreSkuMap[index][v.VendorID].ActualActPrice > v.ActualActPrice)) || (!isActPrice && v.EarningPrice > 0 && (actStoreSkuMap[index][v.VendorID] == nil || actStoreSkuMap[index][v.VendorID].EarningPrice > v.EarningPrice)) { - fmt.Println("test222222222222222222222222222222222", *v) actStoreSkuMap[index][v.VendorID] = v } } - fmt.Println("test11111111111111111111111111111111", utils.Format4Output(actStoreSkuMap, false)) actMap.actStoreSkuMap = actStoreSkuMap return actMap }