From e33dd48728df63af3002f7b895a24cff83e2b9de 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, 29 Sep 2020 10:22:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=AC=E4=B8=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 10 +++++++++ business/jxstore/tempop/tempop.go | 30 ++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 8d2cb061c..4ab88a78f 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1876,6 +1876,16 @@ func UpdateOrderInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID int, order, err := partner.CurOrderManager.LoadOrder(vendorOrderID, vendorID) valid := dao.StrictMakeMapByStructObject(payload, order, ctx.GetUserName()) if len(valid) > 0 { + if payload["consigneeLng"] != nil || payload["consigneeLat"] != nil { + intLng := jxutils.StandardCoordinate2Int(utils.Interface2Float64WithDefault(payload["consigneeLng"], 0.0)) + intLat := jxutils.StandardCoordinate2Int(utils.Interface2Float64WithDefault(payload["consigneeLat"], 0.0)) + if intLng != 0 && intLng != order.ConsigneeLng { + valid["consigneeLng"] = intLng + } + if intLat != 0 && intLat != order.ConsigneeLat { + valid["consigneeLat"] = intLat + } + } dao.Begin(db) defer func() { if r := recover(); r != nil { diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index f4df58aee..181cbded6 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1585,7 +1585,35 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // fmt.Println("deleteList2", deleteList) // cms.DeletedDuplicateWaitAuditData(ctx, dao.GetDB()) // orderman.RefreshJdShopOrdersEarningPrice(jxcontext.AdminCtx, time.Now().AddDate(0, 0, -2).Format("20060102"), time.Now().Format("20060102")) - + var ( + db = dao.GetDB() + goods []*model.GoodsOrder + ) + sql := `SELECT * from goods_order where vendor_id = 0 and buyer_comment = '【JD】' and total_shop_money = 0 and status = 110 + AND order_created_at > '2020-09-01'` + dao.GetRows(db, &goods, sql, nil) + for _, order2 := range goods { + results, err := api.JdAPI.GetJdShopOrders(order2.OrderCreatedAt.AddDate(0, 0, -1).Format("20060102"), order2.OrderCreatedAt.Format("20060102"), globals.JdOrgCode, globals.JdLoginName) + if err != nil { + return err + } + for _, v := range results.BillList.Result { + if v.DueAmount != 0 { + order, _ := partner.CurOrderManager.LoadOrder(utils.Int64ToStr(v.OrderID), model.VendorIDJD) + stores, _ := dao.GetStoreList(db, []int{jxutils.GetSaleStoreIDFromOrder(order)}, nil, nil, nil, "") + if len(stores) > 0 { + store := stores[0] + if order.NewEarningPrice == 0 { + jxutils.RefreshOrderEarningPrice2(order, store.PayPercentage) + } + if order.TotalShopMoney == 0 { + order.TotalShopMoney = utils.Float64TwoInt64(v.DueAmount * 100) + } + dao.UpdateEntity(db, order, "TotalShopMoney", "NewEarningPrice") + } + } + } + } return err }