From 325a3eb8708df8da7f6478eb49a5103f5f6d61d9 Mon Sep 17 00:00:00 2001 From: gazebo Date: Mon, 11 Feb 2019 16:57:19 +0800 Subject: [PATCH] - fix bug in TransferLegacyJdOrder and TransferLegacyElmOrder --- business/jxstore/tempop/tempop.go | 41 ++++++++++++++----------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index fa15055cb..57559ecee 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -3,7 +3,6 @@ package tempop import ( "fmt" "math" - "runtime" "strings" "time" @@ -276,7 +275,7 @@ func TransferLegacyJdOrder(ctx *jxcontext.Context, isAsync, isContinueWhenError SELECT t1.* FROM jdorder t1 LEFT JOIN goods_order_original t2 ON t2.vendor_order_id = t1.vendor_order_id - WHERE t2.id IS NULL + WHERE t2.id IS NULL AND LENGTH(t1.data) > 10 AND t1.cityname = 'all' ORDER BY t1.orderstatustime LIMIT ? ` @@ -290,25 +289,23 @@ func TransferLegacyJdOrder(ctx *jxcontext.Context, isAsync, isContinueWhenError var orderDetailList []*model.GoodsOrderOriginal for _, v := range batchItemList { jdOrder := v.(*legacymodel2.Jdorder) - if len(jdOrder.Data) > 10 { - var detail map[string]interface{} - if err = utils.UnmarshalUseNumber([]byte(strings.Replace(strings.Replace(jdOrder.Data, "\n", "", -1), "\r", "", -1)), &detail); err != nil { - return nil, err - } - resultList := detail["result"].(map[string]interface{})["resultList"].([]interface{}) - if len(resultList) > 0 { - originalData := resultList[0].(map[string]interface{}) - orgCode := originalData["orgCode"].(string) - if orgCode == "320406" { - orderDetail := &model.GoodsOrderOriginal{ - VendorOrderID: jdOrder.VendorOrderID, - VendorID: model.VendorIDJD, - AccountNo: orgCode, - OrderCreatedAt: utils.Str2Time(originalData["orderPurchaseTime"].(string)), - OriginalData: string(utils.MustMarshal(originalData)), - } - orderDetailList = append(orderDetailList, orderDetail) + var detail map[string]interface{} + if err = utils.UnmarshalUseNumber([]byte(strings.Replace(strings.Replace(jdOrder.Data, "\n", "", -1), "\r", "", -1)), &detail); err != nil { + return nil, err + } + resultList := detail["result"].(map[string]interface{})["resultList"].([]interface{}) + if len(resultList) > 0 { + originalData := resultList[0].(map[string]interface{}) + orgCode := originalData["orgCode"].(string) + if orgCode == "320406" { + orderDetail := &model.GoodsOrderOriginal{ + VendorOrderID: jdOrder.VendorOrderID, + VendorID: model.VendorIDJD, + AccountNo: orgCode, + OrderCreatedAt: utils.Str2Time(originalData["orderPurchaseTime"].(string)), + OriginalData: string(utils.MustMarshal(originalData)), } + orderDetailList = append(orderDetailList, orderDetail) } } } @@ -320,7 +317,6 @@ func TransferLegacyJdOrder(ctx *jxcontext.Context, isAsync, isContinueWhenError // rootTask.AddChild(task).Run() task.Run() _, err = task.GetResult(0) - runtime.GC() } else { rootTask.Cancel() } @@ -342,7 +338,7 @@ func TransferLegacyElmOrder(ctx *jxcontext.Context, isAsync, isContinueWhenError SELECT t1.* FROM elemeorder t1 LEFT JOIN goods_order_original t2 ON t2.vendor_order_id = t1.orderid - WHERE t2.id IS NULL + WHERE t2.id IS NULL AND LENGTH(t1.data) > 10 ORDER BY t1.order_created_at LIMIT ? ` @@ -379,7 +375,6 @@ func TransferLegacyElmOrder(ctx *jxcontext.Context, isAsync, isContinueWhenError // rootTask.AddChild(task).Run() task.Run() _, err = task.GetResult(0) - runtime.GC() } else { rootTask.Cancel() }