From 5ad3eeb87d5f879095a6174703972ebe0f7872fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 31 Jul 2020 13:36:54 +0800 Subject: [PATCH 01/44] =?UTF-8?q?=E4=B8=8A=E9=BC=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/misc/misc.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index fc15eb8ce..47642005c 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -165,9 +165,9 @@ func Init() { ScheduleTimerFunc("doDailyWork2", doDailyWork2, dailyWorkTimeList2) - ScheduleTimerFuncByInterval(func() { - orderman.SaveJdsOrders(jxcontext.AdminCtx, time.Now().Add(-20*time.Minute), time.Now()) - }, 10*time.Second, 10*time.Minute) + // ScheduleTimerFuncByInterval(func() { + // orderman.SaveJdsOrders(jxcontext.AdminCtx, time.Now().Add(-20*time.Minute), time.Now()) + // }, 10*time.Second, 10*time.Minute) //京东的订单信息解密密钥获取 ScheduleTimerFuncByInterval(func() { From 2d855e18bb6a531ca9c69b56ca60331b1cc44dbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 31 Jul 2020 13:52:57 +0800 Subject: [PATCH 02/44] =?UTF-8?q?jdsorder=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/callback.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/business/partner/purchase/jdshop/callback.go b/business/partner/purchase/jdshop/callback.go index e43544522..0ff5b9daa 100644 --- a/business/partner/purchase/jdshop/callback.go +++ b/business/partner/purchase/jdshop/callback.go @@ -29,13 +29,13 @@ func OnCallbackMsg(msg *jdshopapi.CallBackResult) (err error) { msgType := msg.MsgType switch msgType { case jcqapi.TopicOrderPay: - jxutils.CallMsgHandler(func() { + utils.CallFuncAsync(func() { SaveJdsOrders(msg) - }, jxutils.ComposeUniversalOrderID(msg.OrderID, model.VendorIDJDShop)) + }) case jcqapi.TopicOrderCancel: - jxutils.CallMsgHandler(func() { + utils.CallFuncAsync(func() { CurPurchaseHandler.CancelOrder(jxcontext.AdminCtx, getRealOrderID(msg.OrderID), "系统取消") - }, jxutils.ComposeUniversalOrderID(msg.OrderID, model.VendorIDJDShop)) + }) default: return fmt.Errorf("暂不支持的topic类型!topic: %v", msgType) } From 8560bc67550aad5ac3ad4a590fcbe3c4d27b9153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 31 Jul 2020 14:03:51 +0800 Subject: [PATCH 03/44] =?UTF-8?q?jds=E8=AE=A2=E5=8D=95=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/callback.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/partner/purchase/jdshop/callback.go b/business/partner/purchase/jdshop/callback.go index 0ff5b9daa..3fcad726f 100644 --- a/business/partner/purchase/jdshop/callback.go +++ b/business/partner/purchase/jdshop/callback.go @@ -99,6 +99,7 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err } order.StoreID = storeList[0].ID order.StoreName = storeList[0].Name + globals.SugarLogger.Debugf("jds GetStoreListByLocation, orderID: %v storeID :%v", order.VendorOrderID, order.StoreID) storeMaps, _ := dao.GetStoresMapList(dao.GetDB(), []int{model.VendorIDJDShop}, []int{order.StoreID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "") if len(storeMaps) > 0 { order.VendorStoreID = storeMaps[0].VendorStoreID From 9768dd865e8e168c2a3bf3dfb51a715c7c1e89ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 31 Jul 2020 14:24:45 +0800 Subject: [PATCH 04/44] =?UTF-8?q?=E8=88=92=E6=9C=8D=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/callback.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/business/partner/purchase/jdshop/callback.go b/business/partner/purchase/jdshop/callback.go index 3fcad726f..01e637273 100644 --- a/business/partner/purchase/jdshop/callback.go +++ b/business/partner/purchase/jdshop/callback.go @@ -44,6 +44,9 @@ func OnCallbackMsg(msg *jdshopapi.CallBackResult) (err error) { func SaveJdsOrders(msg *jdshopapi.CallBackResult) (err error) { order, err := result2Orders(msg) + if err != nil { + return err + } order.StoreID = 102919 order.JxStoreID = 102919 order.StoreName = "商城模板(成都发货)" From f3f1f8a87c63ad025e10c49151adcb360283fb2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 31 Jul 2020 14:25:29 +0800 Subject: [PATCH 05/44] =?UTF-8?q?=E8=88=92=E6=9C=8D=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/callback.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/partner/purchase/jdshop/callback.go b/business/partner/purchase/jdshop/callback.go index 01e637273..19e27a7ba 100644 --- a/business/partner/purchase/jdshop/callback.go +++ b/business/partner/purchase/jdshop/callback.go @@ -46,6 +46,7 @@ func SaveJdsOrders(msg *jdshopapi.CallBackResult) (err error) { order, err := result2Orders(msg) if err != nil { return err + } order.StoreID = 102919 order.JxStoreID = 102919 From 8254e0a06879ecabb309298e5b2db9a92cd5b016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 31 Jul 2020 15:15:45 +0800 Subject: [PATCH 06/44] =?UTF-8?q?=E9=97=A8=E5=BA=97=E8=AF=84=E5=88=86?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/misc/store_score.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/jxstore/misc/store_score.go b/business/jxstore/misc/store_score.go index 269467ba8..90e3a24ce 100644 --- a/business/jxstore/misc/store_score.go +++ b/business/jxstore/misc/store_score.go @@ -804,6 +804,7 @@ func GetWeeklyStoreScore(storeID, weekIndexParam int) (outWeeklyStoreScoreDataLi if weekIndexParam == -1 { outWeeklyStoreScoreDataList = weeklyStoreScoreDataList } else { + fmt.Println("testss", utils.Format4Output(weeklyStoreScoreDataList, false)) outWeeklyStoreScoreDataList = []*model.WeeklyStoreScore{weeklyStoreScoreDataList[weekIndexParam]} } } From 3fd12b3638892d50cad63ff64ae9afb9eee6cc32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 31 Jul 2020 15:19:25 +0800 Subject: [PATCH 07/44] c --- business/model/store_sku.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/business/model/store_sku.go b/business/model/store_sku.go index 9b924990e..cb80fa6b6 100644 --- a/business/model/store_sku.go +++ b/business/model/store_sku.go @@ -95,8 +95,8 @@ type StoreSkuBind struct { SubStoreID int `orm:"column(sub_store_id)"` Price int // 单位为分,不用int64的原因是这里不需要累加 UnitPrice int // 这个是一斤的门店商品价,放在这里的原因是避免额外增加一张store sku_name表,逻辑上要保证同一SKU NAME中的所有SKU这个字段的数据一致 - Stock int `json:"stock"` //门店商品库存 - Status int + // Stock int `json:"stock"` //门店商品库存 + Status int // ElmID int64 `orm:"column(elm_id);index"` MtwmID int64 `orm:"column(mtwm_id);index"` From b98d6b77fd94143a4b8e624a650fc07efbb1156e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 31 Jul 2020 15:19:49 +0800 Subject: [PATCH 08/44] c --- business/model/store_sku.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/business/model/store_sku.go b/business/model/store_sku.go index cb80fa6b6..9b924990e 100644 --- a/business/model/store_sku.go +++ b/business/model/store_sku.go @@ -95,8 +95,8 @@ type StoreSkuBind struct { SubStoreID int `orm:"column(sub_store_id)"` Price int // 单位为分,不用int64的原因是这里不需要累加 UnitPrice int // 这个是一斤的门店商品价,放在这里的原因是避免额外增加一张store sku_name表,逻辑上要保证同一SKU NAME中的所有SKU这个字段的数据一致 - // Stock int `json:"stock"` //门店商品库存 - Status int + Stock int `json:"stock"` //门店商品库存 + Status int // ElmID int64 `orm:"column(elm_id);index"` MtwmID int64 `orm:"column(mtwm_id);index"` From 980aea7b04da8a4143473e53d8b7ed7b58b5a7a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 31 Jul 2020 15:46:49 +0800 Subject: [PATCH 09/44] =?UTF-8?q?=E5=BE=97=E5=88=B0=E7=8A=B6=E6=80=81?= =?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/partner/purchase/jdshop/order.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/business/partner/purchase/jdshop/order.go b/business/partner/purchase/jdshop/order.go index 0afe3cf4f..0e605f0e6 100644 --- a/business/partner/purchase/jdshop/order.go +++ b/business/partner/purchase/jdshop/order.go @@ -1,6 +1,7 @@ package jdshop import ( + "encoding/json" "fmt" "net/http" "strings" @@ -50,7 +51,9 @@ func (p *PurchaseHandler) GetOrderStatus(vendorOrgCode, vendorOrderID string) (s params["orderID"] = vendorOrderID params["token"] = "JxCaIsHiGetJsdOrderTmpToken_20200731" result, err := apiToYd("order/GetJdsOrder", params) - return status2Jxstatus(result["orderState"].(string)), err + jdsOrder := &jdshopapi.GetOrderResult{} + json.Unmarshal([]byte(strings.ReplaceAll(result["data"].(string), "\\", "")), &jdsOrder) + return status2Jxstatus(jdsOrder.OrderState), err } func (p *PurchaseHandler) AcceptOrRefuseOrder(order *model.GoodsOrder, isAcceptIt bool, userName string) (err error) { @@ -193,9 +196,11 @@ func apiToYd(url string, params map[string]interface{}) (retVal map[string]inter } if err == nil { if jsonResult1["code"] != nil { - errLevel = platformapi.ErrLevelGeneralFail - err = utils.NewErrorCode(jsonResult1["desc"].(string), jsonResult1["code"].(string)) - baseapi.SugarLogger.Debugf("yd AccessAPI failed, jsonResult1:%s", utils.Format4Output(jsonResult1, true)) + if utils.Interface2Int64WithDefault(jsonResult1["code"], 0) != 0 { + errLevel = platformapi.ErrLevelGeneralFail + err = utils.NewErrorCode(jsonResult1["desc"].(string), jsonResult1["code"].(string)) + baseapi.SugarLogger.Debugf("yd AccessAPI failed, jsonResult1:%s", utils.Format4Output(jsonResult1, true)) + } } retVal = jsonResult1 } From c45ce8a678118cf7713b14acfa73402f5d1c432e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 31 Jul 2020 16:49:03 +0800 Subject: [PATCH 10/44] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=94=AE=E5=90=8E?= =?UTF-8?q?=E5=8E=9F=E5=9B=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jd/order_afs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/partner/purchase/jd/order_afs.go b/business/partner/purchase/jd/order_afs.go index 37a935747..c8695c0ff 100644 --- a/business/partner/purchase/jd/order_afs.go +++ b/business/partner/purchase/jd/order_afs.go @@ -219,7 +219,7 @@ func (c *PurchaseHandler) RefundOrder(ctx *jxcontext.Context, order *model.Goods // 发起部分退款 func (c *PurchaseHandler) PartRefundOrder(ctx *jxcontext.Context, order *model.GoodsOrder, refundSkuList []*model.OrderSku, reason string) (err error) { if globals.EnableJdStoreWrite { - _, err = getAPI(order.VendorOrgCode).AfsSubmit(order.VendorOrderID, ctx.GetUserName(), utils.Int2Str(jdapi.AfsReasonWrongPurchase), reason, "", order.ConsigneeName, order.ConsigneeMobile, order.ConsigneeAddress, orderSkus2AfsSkus(refundSkuList)) + _, err = getAPI(order.VendorOrgCode).AfsSubmit(order.VendorOrderID, ctx.GetUserName(), utils.Int2Str(jdapi.AfsReasonTypeWrongGoods), reason, "", order.ConsigneeName, order.ConsigneeMobile, order.ConsigneeAddress, orderSkus2AfsSkus(refundSkuList)) } return err } From 9ed5763c33cb32a32bb3297e40d9657ea271e8de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 31 Jul 2020 17:18:54 +0800 Subject: [PATCH 11/44] =?UTF-8?q?=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store.go | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index c01c4157b..e6476dd1e 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -2,6 +2,7 @@ package cms import ( "bytes" + "encoding/json" "errors" "fmt" "io" @@ -3399,17 +3400,20 @@ func UpdateStorePricePack(ctx *jxcontext.Context, storeID, vendorID int, pricePa }() //证明是门店自己的调价包 if strings.Contains(pricePack, utils.Int2Str(storeID)) { - configList, err := dao.QueryConfigs(db, pricePack, model.ConfigTypePricePack, "") - if err != nil { - dao.Rollback(db) - return err - } - if _, err = dao.UpdateEntityLogically(db, configList[0], map[string]interface{}{ - "Value": value, - }, ctx.GetUserName(), nil); err != nil { - dao.Rollback(db) - return err - } + obj := dao.PricePercentagePack2Obj(value) + realValue, _ := json.Marshal(obj) + _, err = UpdateConfig(ctx, pricePack, model.ConfigTypePricePack, string(realValue)) + // configList, err := dao.QueryConfigs(db, pricePack, model.ConfigTypePricePack, "") + // if err != nil { + // dao.Rollback(db) + // return err + // } + // if _, err = dao.UpdateEntityLogically(db, configList[0], map[string]interface{}{ + // "Value": value, + // }, ctx.GetUserName(), nil); err != nil { + // dao.Rollback(db) + // return err + // } } else { //表示门店要改他原有的调价包 //1、调价包名字要加上门店编号门店名等 From eca8124344559e06b776ae2c6332ca885d7adcda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 31 Jul 2020 17:20:09 +0800 Subject: [PATCH 12/44] =?UTF-8?q?=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index e6476dd1e..17d1e171a 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -3402,18 +3402,18 @@ func UpdateStorePricePack(ctx *jxcontext.Context, storeID, vendorID int, pricePa if strings.Contains(pricePack, utils.Int2Str(storeID)) { obj := dao.PricePercentagePack2Obj(value) realValue, _ := json.Marshal(obj) - _, err = UpdateConfig(ctx, pricePack, model.ConfigTypePricePack, string(realValue)) - // configList, err := dao.QueryConfigs(db, pricePack, model.ConfigTypePricePack, "") - // if err != nil { - // dao.Rollback(db) - // return err - // } - // if _, err = dao.UpdateEntityLogically(db, configList[0], map[string]interface{}{ - // "Value": value, - // }, ctx.GetUserName(), nil); err != nil { - // dao.Rollback(db) - // return err - // } + // _, err = UpdateConfig(ctx, pricePack, model.ConfigTypePricePack, string(realValue)) + configList, err := dao.QueryConfigs(db, pricePack, model.ConfigTypePricePack, "") + if err != nil { + dao.Rollback(db) + return err + } + if _, err = dao.UpdateEntityLogically(db, configList[0], map[string]interface{}{ + "Value": string(realValue), + }, ctx.GetUserName(), nil); err != nil { + dao.Rollback(db) + return err + } } else { //表示门店要改他原有的调价包 //1、调价包名字要加上门店编号门店名等 From 89a3108eee0f2cb127254fa845719f35cb4c5678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 31 Jul 2020 18:24:14 +0800 Subject: [PATCH 13/44] =?UTF-8?q?=E5=8F=96=E6=B6=88=E8=AE=A2=E5=8D=95bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/callback.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/business/partner/purchase/jdshop/callback.go b/business/partner/purchase/jdshop/callback.go index 19e27a7ba..0ae0945c2 100644 --- a/business/partner/purchase/jdshop/callback.go +++ b/business/partner/purchase/jdshop/callback.go @@ -34,7 +34,10 @@ func OnCallbackMsg(msg *jdshopapi.CallBackResult) (err error) { }) case jcqapi.TopicOrderCancel: utils.CallFuncAsync(func() { - CurPurchaseHandler.CancelOrder(jxcontext.AdminCtx, getRealOrderID(msg.OrderID), "系统取消") + order := getRealOrderID(msg.OrderID) + if order != nil { + CurPurchaseHandler.CancelOrder(jxcontext.AdminCtx, order, "系统取消") + } }) default: return fmt.Errorf("暂不支持的topic类型!topic: %v", msgType) From 9912f96c7b7d35c866fb00f41afde09e91e35a49 Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Sat, 1 Aug 2020 10:05:32 +0800 Subject: [PATCH 14/44] =?UTF-8?q?jds=E8=AE=A2=E5=8D=95=E5=8F=96=E6=B6=88?= =?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/partner/purchase/jdshop/callback.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/business/partner/purchase/jdshop/callback.go b/business/partner/purchase/jdshop/callback.go index 0ae0945c2..b7b7c2bfe 100644 --- a/business/partner/purchase/jdshop/callback.go +++ b/business/partner/purchase/jdshop/callback.go @@ -36,7 +36,9 @@ func OnCallbackMsg(msg *jdshopapi.CallBackResult) (err error) { utils.CallFuncAsync(func() { order := getRealOrderID(msg.OrderID) if order != nil { - CurPurchaseHandler.CancelOrder(jxcontext.AdminCtx, order, "系统取消") + if order.Status != model.OrderStatusCanceled { + CurPurchaseHandler.CancelOrder(jxcontext.AdminCtx, order, "系统取消") + } } }) default: @@ -123,6 +125,7 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err order.BusinessType = model.BusinessTypeImmediate } else { globals.SugarLogger.Warnf("暂不支持的京东商城订单类型!type: %v", msg.OrderState) + return nil, err } //结算类型 From 6f44c537d6dc1d2e5240a4f3b1502f47e7c89c08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 3 Aug 2020 09:00:51 +0800 Subject: [PATCH 15/44] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/callback.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/business/partner/purchase/jdshop/callback.go b/business/partner/purchase/jdshop/callback.go index 0ae0945c2..5d4ba5bb5 100644 --- a/business/partner/purchase/jdshop/callback.go +++ b/business/partner/purchase/jdshop/callback.go @@ -81,8 +81,8 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err OrderCreatedAt: utils.Str2Time(msg.OrderStartTime), ConsigneeAddress: Decrypt(msg.ConsigneeInfo.FullAddress), ConsigneeName: Decrypt(msg.ConsigneeInfo.Fullname), - ConsigneeMobile: Decrypt(msg.ConsigneeInfo.Telephone), - ConsigneeMobile2: Decrypt(msg.ConsigneeInfo.Mobile), + ConsigneeMobile: Decrypt(msg.ConsigneeInfo.Mobile), + ConsigneeMobile2: Decrypt(msg.ConsigneeInfo.Telephone), ActualPayPrice: jxutils.StandardPrice2Int(utils.Str2Float64(msg.OrderPayment)), Status: model.OrderStatusNew, TotalShopMoney: utils.Float64TwoInt64(math.Round(float64(jxutils.StandardPrice2Int(utils.Str2Float64(msg.OrderPayment))) * jdshopapi.JdsPayPercentage)), @@ -170,6 +170,9 @@ func setJdsOrderSeq(order *model.GoodsOrder) (err error) { } func Decrypt(p string) (result string) { + if p == "" { + return "" + } data, _ := base64.StdEncoding.DecodeString(strings.ReplaceAll(p, " ", "+")) key := GetKey(hex.EncodeToString(data)[4:36]) data2, _ := base64.StdEncoding.DecodeString(key) From 7f109f9a4bce3281fab5cb7d925a73cb208e9aad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 3 Aug 2020 15:30:28 +0800 Subject: [PATCH 16/44] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/callback.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/business/partner/purchase/jdshop/callback.go b/business/partner/purchase/jdshop/callback.go index d216d59a6..804df7589 100644 --- a/business/partner/purchase/jdshop/callback.go +++ b/business/partner/purchase/jdshop/callback.go @@ -49,9 +49,8 @@ func OnCallbackMsg(msg *jdshopapi.CallBackResult) (err error) { func SaveJdsOrders(msg *jdshopapi.CallBackResult) (err error) { order, err := result2Orders(msg) - if err != nil { + if err != nil || order == nil { return err - } order.StoreID = 102919 order.JxStoreID = 102919 From a166afa671e95c0b9b11b82c51e6482e210242e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 3 Aug 2020 17:31:34 +0800 Subject: [PATCH 17/44] =?UTF-8?q?=E5=8F=96=E6=B6=88=E9=97=A8=E5=BA=97?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 44 ++++++++++++++----------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 447935b92..5405d5286 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1587,30 +1587,26 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // fmt.Println("deleteList2", deleteList) db := dao.GetDB() storeIDs := []int{ - 667443, - 667433, - 667389, - 666862, - 666835, - 666830, - 666826, - 666822, - 666800, - 666785, - 666775, - 666772, - 103459, - 102860, - 102859, - 102858, - 102852, - 102847, - 102811, - 102793, - 102780, - 101732, - 100714, - 100712, + 667159, + 667139, + 666842, + 666799, + 666794, + 666770, + 666739, + 666729, + 103177, + 103027, + 102808, + 102733, + 102718, + 102686, + 102676, + 102675, + 102661, + 101097, + 100041, + 100032, } for _, storeID := range storeIDs { acts, _ := dao.QueryActs(db, 0, 0, 50, -1, "", -1, []int{1}, []int{0, 3, 4}, nil, storeID, nil, 0, utils.ZeroTimeValue, utils.ZeroTimeValue, utils.Str2Time("2020-05-30 00:00:00"), utils.Str2Time("2020-07-30 00:00:00")) From 7c5ac06349f1538d132b05d0aa68c971c51df1e3 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, 4 Aug 2020 08:59:26 +0800 Subject: [PATCH 18/44] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=BD=AC=E7=A7=BB?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=A0=A1=E9=AA=8C=E8=A7=84=E5=88=99=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 7bb29ce3f..147b140f9 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1270,29 +1270,29 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) order.StoreID = storeID order.StoreName = stores[0].Name order.VendorStoreID = storeMaps[0].VendorStoreID - //如果是立即达的订单,要判断一下送达时间是否在门店营业时间范围内 + //如果是立即达的订单,要判断一下下单时间是否在门店营业时间范围内 //若没有,则要把这个订单变成定时达,预计送达时间改为门店的营业时间 //如果门店没有营业时间,则直接报错 if order.BusinessType == model.BusinessTypeImmediate { store := stores[0] var ( - opentime1 = jxutils.JxOperationTime2TimeByDate(store.OpenTime1, order.ExpectedDeliveredTime) - opentime2 = jxutils.JxOperationTime2TimeByDate(store.OpenTime2, order.ExpectedDeliveredTime) - closetime1 = jxutils.JxOperationTime2TimeByDate(store.CloseTime1, order.ExpectedDeliveredTime) - closetime2 = jxutils.JxOperationTime2TimeByDate(store.CloseTime2, order.ExpectedDeliveredTime) - expectedTime = order.ExpectedDeliveredTime + opentime1 = jxutils.JxOperationTime2TimeByDate(store.OpenTime1, order.OrderCreatedAt) + opentime2 = jxutils.JxOperationTime2TimeByDate(store.OpenTime2, order.OrderCreatedAt) + closetime1 = jxutils.JxOperationTime2TimeByDate(store.CloseTime1, order.OrderCreatedAt) + closetime2 = jxutils.JxOperationTime2TimeByDate(store.CloseTime2, order.OrderCreatedAt) + orderCreatedAt = order.OrderCreatedAt ) if store.OpenTime1 == 0 || store.CloseTime1 == 0 { return "", fmt.Errorf("该门店没有营业时间,不能接单!门店:[%v]", storeID) } - if !(expectedTime.Sub(opentime1) >= 0 && expectedTime.Sub(closetime1) <= 0) { + if !(orderCreatedAt.Sub(opentime1) >= 0 && orderCreatedAt.Sub(closetime1) <= 0) { if store.OpenTime2 != 0 && store.CloseTime2 != 0 { - if !(expectedTime.Sub(opentime2) >= 0 && expectedTime.Sub(closetime2) <= 0) { - if expectedTime.Sub(opentime1) < 0 { + if !(orderCreatedAt.Sub(opentime2) >= 0 && orderCreatedAt.Sub(closetime2) <= 0) { + if orderCreatedAt.Sub(opentime1) < 0 { order.ExpectedDeliveredTime = opentime1 order.BusinessType = model.BusinessTypeDingshida } else { - if expectedTime.Sub(opentime2) < 0 { + if orderCreatedAt.Sub(opentime2) < 0 { order.ExpectedDeliveredTime = opentime2 } else { order.ExpectedDeliveredTime = opentime1.AddDate(0, 0, 1) @@ -1301,7 +1301,7 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) } } } else { - if expectedTime.Sub(opentime1) < 0 { + if orderCreatedAt.Sub(opentime1) < 0 { order.ExpectedDeliveredTime = opentime1 } else { order.ExpectedDeliveredTime = opentime1.AddDate(0, 0, 1) From 8cd3a1f63744f9c519a5d354f63821bad0a0552b 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, 4 Aug 2020 11:22:58 +0800 Subject: [PATCH 19/44] nenew_earning_perice --- business/jxcallback/scheduler/defsch/defsch.go | 2 +- business/jxutils/jxutils.go | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index 639e308e9..c121ada50 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -1180,7 +1180,7 @@ func (s *DefScheduler) updateOrderByBill(order *model.GoodsOrder, bill *model.Wa if bill.Status == model.WaybillStatusDelivered { storeDetail, _ := partner.CurOrderManager.LoadStoreDetail(jxutils.GetSaleStoreIDFromOrder(order), order.VendorID) if storeDetail != nil { - jxutils.RefreshOrderEarningPrice2(order, storeDetail.PayPercentage) + jxutils.RefreshOrderEarningPrice3(order, storeDetail.PayPercentage, bill) updateFields = append(updateFields, "NewEarningPrice") } } diff --git a/business/jxutils/jxutils.go b/business/jxutils/jxutils.go index afe67673b..30064d05e 100644 --- a/business/jxutils/jxutils.go +++ b/business/jxutils/jxutils.go @@ -601,6 +601,19 @@ func RefreshOrderEarningPrice2(order *model.GoodsOrder, payPercentage int) *mode return order } +func RefreshOrderEarningPrice3(order *model.GoodsOrder, payPercentage int, bill *model.Waybill) *model.GoodsOrder { + if order.EarningType == model.EarningTypePoints { + if order.VendorID == model.VendorIDJDShop || order.VendorID == model.VendorIDJX { + order.NewEarningPrice = (order.TotalShopMoney - bill.DesiredFee) * int64((100 - payPercentage)) / 100 + } else { + order.NewEarningPrice = (order.TotalShopMoney - bill.DesiredFee) * int64((100 - payPercentage/2)) / 100 + } + } else { + order.NewEarningPrice = order.EarningPrice + } + return order +} + func RefreshAfsOrderSkuRelated(afsOrder *model.AfsOrder) *model.AfsOrder { afsOrder.SkuUserMoney = 0 afsOrder.PmSkuSubsidyMoney = 0 From 7034a37b62e260964b937dd07c43527c9565fb47 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, 4 Aug 2020 11:59:10 +0800 Subject: [PATCH 20/44] nenew_earning_perice --- business/jxcallback/orderman/order.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 147b140f9..4ef397fff 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -194,6 +194,21 @@ func (c *OrderManager) OnOrderStatusChanged(vendorOrgCode string, orderStatus *m } } } + //更新订单new_earning_price + if order.EarningType == model.EarningTypePoints { + waybill, _ := c.LoadWaybill(order.VendorWaybillID, order.WaybillVendorID) + store, _ := c.LoadStoreDetail(jxutils.GetSaleStoreIDFromOrder(order), order.VendorID) + if waybill == nil { + if order.NewEarningPrice == 0 || order.NewEarningPrice != order.TotalShopMoney*int64(100-store.PayPercentage)/int64(100) { + order.NewEarningPrice = order.TotalShopMoney * int64(100-store.PayPercentage) / int64(100) + } + } else { + if order.NewEarningPrice == 0 || order.NewEarningPrice != (order.TotalShopMoney-waybill.DesiredFee)*int64(100-store.PayPercentage)/int64(100) { + order.NewEarningPrice = (order.TotalShopMoney - waybill.DesiredFee) * int64(100-store.PayPercentage) / int64(100) + } + } + dao.UpdateEntity(db, order, "NewEarningPrice") + } } } if !isDuplicated { From 32e82fb0c10c5405624351b8b5bbacdafc590d72 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, 4 Aug 2020 13:34:45 +0800 Subject: [PATCH 21/44] =?UTF-8?q?=E4=BA=AC=E8=A5=BF=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E7=BB=93=E7=AE=97=E6=AF=94=E4=BE=8B0.96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jx/localjx/order.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/business/partner/purchase/jx/localjx/order.go b/business/partner/purchase/jx/localjx/order.go index 56315d974..d3c8e9220 100644 --- a/business/partner/purchase/jx/localjx/order.go +++ b/business/partner/purchase/jx/localjx/order.go @@ -9,6 +9,8 @@ import ( "strings" "time" + "git.rosy.net.cn/baseapi/platformapi/jdshopapi" + "git.rosy.net.cn/jx-callback/business/jxcallback/orderman" "git.rosy.net.cn/jx-callback/business/jxstore/event" @@ -857,6 +859,7 @@ func jxOrder2GoodsOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, deliveryAd } order.TotalShopMoney += jxOrder.FreightPrice order.ActualPayPrice = order.TotalShopMoney + order.TotalShopMoney = utils.Float64TwoInt64(float64(order.TotalShopMoney) * jdshopapi.JdsPayPercentage) if jxOrder.FromStoreID != 0 { order.FromStoreID = jxOrder.FromStoreID order.WaybillVendorID = model.VendorIDJDWL From 2463ec8e33abe8122c8190f72eb98625a0600a0b 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, 4 Aug 2020 13:58:02 +0800 Subject: [PATCH 22/44] =?UTF-8?q?=E9=87=8D=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jx/localjx/order.go | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/business/partner/purchase/jx/localjx/order.go b/business/partner/purchase/jx/localjx/order.go index d3c8e9220..e7bb5b01d 100644 --- a/business/partner/purchase/jx/localjx/order.go +++ b/business/partner/purchase/jx/localjx/order.go @@ -1719,44 +1719,44 @@ func SendFailedMatterOrder(ctx *jxcontext.Context, vendorOrderID string) (err er if order == nil || order.StoreID != model.MatterStoreID || order.FromStoreID == 0 { return fmt.Errorf("只允许物料店重发物料订单调用此接口!") } - queryOrderStatus, err := api.JdEclpAPI.QueryOrderStatus(order.EclpOutID) - if len(queryOrderStatus.OrderStatusList) > 0 { - code := queryOrderStatus.OrderStatusList[len(queryOrderStatus.OrderStatusList)-1].SoStatusCode - if code == jdeclpapi.SoStatusCode10022 || code == jdeclpapi.SoStatusCode10038 { //表示该订单在京东物流为暂停或已经逆向发货完成 - if len(order.VendorOrderID) == 14 && order.EclpOutID != "" { //这是不分包的订单 - _, err = createMatterOrder(buildJxOrderInfo(order, order.Skus), order, int64(00)) - err = CancelMatterOrder(db, order, cancelMatterOrderReason) - changeOrderStatus(order.VendorOrderID, model.OrderStatusCanceled, cancelMatterOrderReason) - for _, v := range order.Skus { - cms.RefreshMatterStock(jxcontext.AdminCtx, v.SkuID) - } - } else if len(order.VendorOrderID) == 14 && order.EclpOutID == "" { //这是分包的主订单 - goodsList, err := dao.GetMatterChildOrders(db, order.VendorOrderID) + // queryOrderStatus, err := api.JdEclpAPI.QueryOrderStatus(order.EclpOutID) + // if len(queryOrderStatus.OrderStatusList) > 0 { + // code := queryOrderStatus.OrderStatusList[len(queryOrderStatus.OrderStatusList)-1].SoStatusCode + // if code == jdeclpapi.SoStatusCode10022 || code == jdeclpapi.SoStatusCode10038 { //表示该订单在京东物流为暂停或已经逆向发货完成 + if len(order.VendorOrderID) == 14 && order.EclpOutID != "" { //这是不分包的订单 + _, err = createMatterOrder(buildJxOrderInfo(order, order.Skus), order, int64(00)) + err = CancelMatterOrder(db, order, cancelMatterOrderReason) + changeOrderStatus(order.VendorOrderID, model.OrderStatusCanceled, cancelMatterOrderReason) + for _, v := range order.Skus { + cms.RefreshMatterStock(jxcontext.AdminCtx, v.SkuID) + } + } else if len(order.VendorOrderID) == 14 && order.EclpOutID == "" { //这是分包的主订单 + goodsList, err := dao.GetMatterChildOrders(db, order.VendorOrderID) + if err != nil { + return err + } + if len(goodsList) > 0 { + for _, v := range goodsList { + cOrder, err := partner.CurOrderManager.LoadOrder(v.VendorOrderID, model.VendorIDJX) if err != nil { return err } - if len(goodsList) > 0 { - for _, v := range goodsList { - cOrder, err := partner.CurOrderManager.LoadOrder(v.VendorOrderID, model.VendorIDJX) - if err != nil { - return err - } - suffix := utils.Str2Int64(cOrder.VendorOrderID[len(cOrder.VendorOrderID)-2:]) + int64(len(goodsList)) - _, err = createMatterOrder(buildJxOrderInfo(cOrder, cOrder.Skus), cOrder, suffix) - for _, v := range cOrder.Skus { - cms.RefreshMatterStock(jxcontext.AdminCtx, v.SkuID) - } - } + suffix := utils.Str2Int64(cOrder.VendorOrderID[len(cOrder.VendorOrderID)-2:]) + int64(len(goodsList)) + _, err = createMatterOrder(buildJxOrderInfo(cOrder, cOrder.Skus), cOrder, suffix) + for _, v := range cOrder.Skus { + cms.RefreshMatterStock(jxcontext.AdminCtx, v.SkuID) } - err = CancelMatterOrder(db, order, cancelMatterOrderReason) - changeOrderStatus(order.VendorOrderID, model.OrderStatusCanceled, cancelMatterOrderReason) - } else if len(order.VendorOrderID) == 16 && order.EclpOutID != "" { // 这是分包的子订单 - return fmt.Errorf("请重发主订单!主订单号:[%v]", order.VendorOrderID[len(order.VendorOrderID)-2:]) } - } else { - return fmt.Errorf("只允许物流订单为暂停或逆向完成才能调用此接口!") } + err = CancelMatterOrder(db, order, cancelMatterOrderReason) + changeOrderStatus(order.VendorOrderID, model.OrderStatusCanceled, cancelMatterOrderReason) + } else if len(order.VendorOrderID) == 16 && order.EclpOutID != "" { // 这是分包的子订单 + return fmt.Errorf("请重发主订单!主订单号:[%v]", order.VendorOrderID[len(order.VendorOrderID)-2:]) } + // } else { + // return fmt.Errorf("只允许物流订单为暂停或逆向完成才能调用此接口!") + // } + // } return err } From e7f821ee3caf11ea82235d848a80346bed849aad 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, 4 Aug 2020 14:20:00 +0800 Subject: [PATCH 23/44] =?UTF-8?q?=E9=87=8D=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jx/localjx/order.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/partner/purchase/jx/localjx/order.go b/business/partner/purchase/jx/localjx/order.go index e7bb5b01d..dbcc1f598 100644 --- a/business/partner/purchase/jx/localjx/order.go +++ b/business/partner/purchase/jx/localjx/order.go @@ -1724,7 +1724,7 @@ func SendFailedMatterOrder(ctx *jxcontext.Context, vendorOrderID string) (err er // code := queryOrderStatus.OrderStatusList[len(queryOrderStatus.OrderStatusList)-1].SoStatusCode // if code == jdeclpapi.SoStatusCode10022 || code == jdeclpapi.SoStatusCode10038 { //表示该订单在京东物流为暂停或已经逆向发货完成 if len(order.VendorOrderID) == 14 && order.EclpOutID != "" { //这是不分包的订单 - _, err = createMatterOrder(buildJxOrderInfo(order, order.Skus), order, int64(00)) + _, err = createMatterOrder(buildJxOrderInfo(order, order.Skus), order, int64(01)) err = CancelMatterOrder(db, order, cancelMatterOrderReason) changeOrderStatus(order.VendorOrderID, model.OrderStatusCanceled, cancelMatterOrderReason) for _, v := range order.Skus { From 0e1d290e53f66ab93536e442da3708dc33959e66 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, 5 Aug 2020 08:57:45 +0800 Subject: [PATCH 24/44] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=95=86=E5=93=81?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E6=9C=80=E5=8E=9F=E5=A7=8B=E7=9A=84=E6=8B=BC?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 1 + business/model/dao/store_sku.go | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 4ef397fff..768b1b30a 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -408,6 +408,7 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao. v.ShopPrice = v.SalePrice * 70 / 100 } } + v.SkuName = jxutils.ComposeSkuNameOriginal(skuBindInfo.Prefix, skuBindInfo.Name, skuBindInfo.Comment, skuBindInfo.Unit, skuBindInfo.SpecQuality, skuBindInfo.SpecUnit, 0) v.Weight = skuBindInfo.Weight // 以本地信息中的WEIGHT为准 //饿鲜达的订单做一下处理 if strings.Contains(order.StoreName, model.ExdStoreName) { diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index ed059cb03..0700961be 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -284,6 +284,12 @@ type StoreSkuPriceAndWeight struct { SkuID int `orm:"column(sku_id)"` Weight int Price int + Prefix string + Name string + Unit string + Comment string + SpecQuality float32 + SpecUnit string } type StoreSkuAndName struct { @@ -619,10 +625,12 @@ func GetStoreSkuPriceAndWeight(db *DaoDB, vendorStoreID string, vendorID int, ve vendorSkuIDField = fmt.Sprintf("t2.%s_id", ConvertDBFieldPrefix(model.VendorNames[vendorID])) } sql := fmt.Sprintf(` - SELECT %s vendor_sku_id, t1.id sku_id, t2.price, t1.weight + SELECT %s vendor_sku_id, t1.id sku_id, t2.price, t1.weight, + t5.prefix, t5.name, t1.comment, t5.unit, t1.sepc_quality, t1.sepc_unit FROM sku t1 JOIN store_sku_bind t2 ON t2.sku_id = t1.id AND t2.deleted_at = ? JOIN store_map t3 ON t3.store_id = t2.store_id AND t3.vendor_id = ? AND t3.vendor_store_id = ? AND t3.deleted_at = ? + JOIN sku_name t5 ON t5.id = t1.name_id %s WHERE %s IN (`+GenQuestionMarks(len(vendorSkuIDs))+`)`, vendorSkuIDField, sqlThingMap, vendorSkuIDField) sqlParams := []interface{}{ From f70031bf10dc58f09ec927606a099b9a94e28791 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, 5 Aug 2020 09:01:33 +0800 Subject: [PATCH 25/44] c --- business/model/dao/store_sku.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index 0700961be..5d6c9e7c2 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -626,7 +626,7 @@ func GetStoreSkuPriceAndWeight(db *DaoDB, vendorStoreID string, vendorID int, ve } sql := fmt.Sprintf(` SELECT %s vendor_sku_id, t1.id sku_id, t2.price, t1.weight, - t5.prefix, t5.name, t1.comment, t5.unit, t1.sepc_quality, t1.sepc_unit + t5.prefix, t5.name, t1.comment, t5.unit, t1.spec_quality, t1.spec_unit FROM sku t1 JOIN store_sku_bind t2 ON t2.sku_id = t1.id AND t2.deleted_at = ? JOIN store_map t3 ON t3.store_id = t2.store_id AND t3.vendor_id = ? AND t3.vendor_store_id = ? AND t3.deleted_at = ? From 8be85256d626f9563b96386ae9a179ad989ed6e0 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, 5 Aug 2020 10:04:04 +0800 Subject: [PATCH 26/44] banner --- business/model/store.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/model/store.go b/business/model/store.go index 059396263..fd89ff1e4 100644 --- a/business/model/store.go +++ b/business/model/store.go @@ -351,6 +351,7 @@ type Store struct { PromoteInfo string `orm:"size(255)" json:"promoteInfo"` //门店公告(所有平台统一的公告) IsBoughtMatter int `json:"isBoughtMatter"` //这周是否申请过物料 SoundPercentage int `json:"soundPercentage"` //打印机声音大小比例 + Banner string `orm:"size(9999)" json:"banner"` //门店商城bannar图 } func (*Store) TableUnique() [][]string { From 0508fd922bef330fefaad7bb03ba2b019eedbd05 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, 5 Aug 2020 11:21:48 +0800 Subject: [PATCH 27/44] =?UTF-8?q?=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 20 ++++++++++++++++---- business/jxstore/cms/sync.go | 6 ++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 768b1b30a..841c2e7ad 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -199,12 +199,24 @@ func (c *OrderManager) OnOrderStatusChanged(vendorOrgCode string, orderStatus *m waybill, _ := c.LoadWaybill(order.VendorWaybillID, order.WaybillVendorID) store, _ := c.LoadStoreDetail(jxutils.GetSaleStoreIDFromOrder(order), order.VendorID) if waybill == nil { - if order.NewEarningPrice == 0 || order.NewEarningPrice != order.TotalShopMoney*int64(100-store.PayPercentage)/int64(100) { - order.NewEarningPrice = order.TotalShopMoney * int64(100-store.PayPercentage) / int64(100) + if order.VendorID == model.VendorIDJDShop || order.VendorID == model.VendorIDJX { + if order.NewEarningPrice == 0 || order.NewEarningPrice != order.TotalShopMoney*int64(100-store.PayPercentage)/int64(100) { + order.NewEarningPrice = order.TotalShopMoney * int64(100-store.PayPercentage) / int64(100) + } + } else { + if order.NewEarningPrice == 0 || order.NewEarningPrice != order.TotalShopMoney*int64(100-store.PayPercentage/2)/int64(100) { + order.NewEarningPrice = order.TotalShopMoney * int64(100-store.PayPercentage/2) / int64(100) + } } } else { - if order.NewEarningPrice == 0 || order.NewEarningPrice != (order.TotalShopMoney-waybill.DesiredFee)*int64(100-store.PayPercentage)/int64(100) { - order.NewEarningPrice = (order.TotalShopMoney - waybill.DesiredFee) * int64(100-store.PayPercentage) / int64(100) + if order.VendorID == model.VendorIDJDShop || order.VendorID == model.VendorIDJX { + if order.NewEarningPrice == 0 || order.NewEarningPrice != (order.TotalShopMoney-waybill.DesiredFee)*int64(100-store.PayPercentage)/int64(100) { + order.NewEarningPrice = (order.TotalShopMoney - waybill.DesiredFee) * int64(100-store.PayPercentage) / int64(100) + } + } else { + if order.NewEarningPrice == 0 || order.NewEarningPrice != (order.TotalShopMoney-waybill.DesiredFee)*int64(100-store.PayPercentage/2)/int64(100) { + order.NewEarningPrice = (order.TotalShopMoney - waybill.DesiredFee) * int64(100-store.PayPercentage/2) / int64(100) + } } } dao.UpdateEntity(db, order, "NewEarningPrice") diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 7974fcc30..4b84bae1d 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -1297,6 +1297,12 @@ func SetMTPSStatus(ctx *jxcontext.Context, storeId, courierStatus int) { ShopInfo, _ := api.MtpsAPI.ShopQuery(strconv.Itoa(storeId)) if ShopInfo != nil { ShopName = ShopInfo.ShopName + if ShopName == "" { + if StoreLists[0].Name[len(StoreLists[0].Name)-1:] == "店" { + + } + ShopName = StoreLists[0].Name + } StoreInfoList, _ = api.MtpsAPI.GetStoreStatus(ShopName) if StoreInfoList != nil && StoreInfoList.DataList != nil { goto ifExist From 95e9bb516a4ff3c878525b97d71462192d1cc0f3 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, 5 Aug 2020 11:55:43 +0800 Subject: [PATCH 28/44] =?UTF-8?q?=E7=BE=8E=E5=9B=A2=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 4b84bae1d..a197068fb 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -1298,10 +1298,7 @@ func SetMTPSStatus(ctx *jxcontext.Context, storeId, courierStatus int) { if ShopInfo != nil { ShopName = ShopInfo.ShopName if ShopName == "" { - if StoreLists[0].Name[len(StoreLists[0].Name)-1:] == "店" { - - } - ShopName = StoreLists[0].Name + ShopName = StoreLists[0].Name[:len(StoreLists[0].Name)-3] } StoreInfoList, _ = api.MtpsAPI.GetStoreStatus(ShopName) if StoreInfoList != nil && StoreInfoList.DataList != nil { From 8353290f426eec604eeb48515f78375a1178889c 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, 5 Aug 2020 13:42:07 +0800 Subject: [PATCH 29/44] =?UTF-8?q?=E5=88=B7=E6=96=B0=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index a197068fb..019a079a0 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -1357,15 +1357,15 @@ func SetMTPSStatus(ctx *jxcontext.Context, storeId, courierStatus int) { { if StoreInfoList.DataList[0].OuterPoiID != "" { //若存在且名字不为空,就是找到了 - if StoreInfoList.DataList[0].OpenType != courierStatus { - sl := make(map[string]interface{}) - sl["vendorStoreID"] = StoreInfoList.DataList[0].OuterPoiID - sl["status"] = StoreInfoList.DataList[0].OpenType - sl["vendorStatus"] = StoreInfoList.DataList[0].OpenType - globals.SugarLogger.Debugf("被修改配送状态的VendorStoreID是:%s,名称是:%s,美团状态是:%s,本地状态是:%s", - StoreInfoList.DataList[0].OuterPoiID, StoreInfoList.DataList[0].PoiName, strconv.Itoa(StoreInfoList.DataList[0].OpenType), strconv.Itoa(StoreLists[0].Status)) - UpdateStoreCourierMap(ctx, nil, storeId, model.VendorIDMTPS, sl, ctx.GetUserName()) - } + // if StoreInfoList.DataList[0].OpenType != courierStatus ||{ + sl := make(map[string]interface{}) + sl["vendorStoreID"] = StoreInfoList.DataList[0].OuterPoiID + sl["status"] = StoreInfoList.DataList[0].OpenType + sl["vendorStatus"] = StoreInfoList.DataList[0].OpenType + globals.SugarLogger.Debugf("被修改配送状态的VendorStoreID是:%s,名称是:%s,美团状态是:%s,本地状态是:%s", + StoreInfoList.DataList[0].OuterPoiID, StoreInfoList.DataList[0].PoiName, strconv.Itoa(StoreInfoList.DataList[0].OpenType), strconv.Itoa(StoreLists[0].Status)) + UpdateStoreCourierMap(ctx, nil, storeId, model.VendorIDMTPS, sl, ctx.GetUserName()) + // } } } } else { From a823f904e88bce53eede9bd0e07262d334caee2d 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, 5 Aug 2020 15:03:08 +0800 Subject: [PATCH 30/44] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=BE=85=E6=8B=A3?= =?UTF-8?q?=E8=B4=A7=E5=8F=96=E6=B6=88=E5=B0=9D=E8=AF=95=E6=8B=A3=E8=B4=A7?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jd/order.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/business/partner/purchase/jd/order.go b/business/partner/purchase/jd/order.go index 0ee2081ac..fbc1aacf2 100644 --- a/business/partner/purchase/jd/order.go +++ b/business/partner/purchase/jd/order.go @@ -109,6 +109,13 @@ func (c *PurchaseHandler) onOrderMsg(vendorOrgCode string, msg *jdapi.CallbackOr c.onOrderComment2(a, msg) }) } + if msg.StatusID == jdapi.OrderStatusVenderAgreeCancel { + order := &model.GoodsOrder{ + VendorOrgCode: vendorOrgCode, + VendorOrderID: msg.BillID, + } + c.PickupGoods(order, false, jxcontext.AdminCtx.GetUserName()) + } err := partner.CurOrderManager.OnOrderStatusChanged(vendorOrgCode, status) retVal = jdapi.Err2CallbackResponse(err, status.VendorStatus) } From 376aaedde784014a49c4beb422736df85e0b1953 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, 5 Aug 2020 15:04:34 +0800 Subject: [PATCH 31/44] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=BE=85=E6=8B=A3?= =?UTF-8?q?=E8=B4=A7=E5=8F=96=E6=B6=88=E5=B0=9D=E8=AF=95=E6=8B=A3=E8=B4=A7?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jd/order.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/business/partner/purchase/jd/order.go b/business/partner/purchase/jd/order.go index fbc1aacf2..fcb958031 100644 --- a/business/partner/purchase/jd/order.go +++ b/business/partner/purchase/jd/order.go @@ -114,7 +114,10 @@ func (c *PurchaseHandler) onOrderMsg(vendorOrgCode string, msg *jdapi.CallbackOr VendorOrgCode: vendorOrgCode, VendorOrderID: msg.BillID, } - c.PickupGoods(order, false, jxcontext.AdminCtx.GetUserName()) + err2 := c.PickupGoods(order, false, jxcontext.AdminCtx.GetUserName()) + if err2 != nil { + globals.SugarLogger.Warnf("京东取消拣货:%v", err2) + } } err := partner.CurOrderManager.OnOrderStatusChanged(vendorOrgCode, status) retVal = jdapi.Err2CallbackResponse(err, status.VendorStatus) From 009f75149c78f1815712de97cae4ab928d0a6227 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, 5 Aug 2020 16:34:15 +0800 Subject: [PATCH 32/44] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=8B=A3=E8=B4=A7?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=BE=80=E5=89=8D=E6=8F=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jxcallback/scheduler/defsch/defsch.go | 6 +++--- business/partner/purchase/jd/order.go | 20 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index c121ada50..d67ec8997 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -41,9 +41,9 @@ const ( minute2Schedule3rdCarrier4Ebai = 30 // 饿百的最少转自配送需要的时间(分钟) minMinute2Schedule3rdCarrier = 5 // 转三方配送最少等待时间(分钟) - time2AutoPickupMin = 14 * time.Minute // 自动拣货等待时间,这个只有在没有PickDeadline信息才有用,否则会根据PickDeadline设置 - second2AutoPickupGap = 60 //随机60秒 - time2AutoPickupAhead = 20 * time.Second // 有最后拣货时间的提前值 + time2AutoPickupMin = 14 * time.Minute // 自动拣货等待时间,这个只有在没有PickDeadline信息才有用,否则会根据PickDeadline设置 + second2AutoPickupGap = 60 //随机60秒 + time2AutoPickupAhead = 120 * time.Second // 有最后拣货时间的提前值 switch2SelfDeliverRetryGap = 3 * time.Second // 转自送失败尝试的时间间隙 switch2SelfDeliverRetryCount = 2 // 转自送失败尝试次数 diff --git a/business/partner/purchase/jd/order.go b/business/partner/purchase/jd/order.go index fcb958031..7bcb7d284 100644 --- a/business/partner/purchase/jd/order.go +++ b/business/partner/purchase/jd/order.go @@ -109,16 +109,16 @@ func (c *PurchaseHandler) onOrderMsg(vendorOrgCode string, msg *jdapi.CallbackOr c.onOrderComment2(a, msg) }) } - if msg.StatusID == jdapi.OrderStatusVenderAgreeCancel { - order := &model.GoodsOrder{ - VendorOrgCode: vendorOrgCode, - VendorOrderID: msg.BillID, - } - err2 := c.PickupGoods(order, false, jxcontext.AdminCtx.GetUserName()) - if err2 != nil { - globals.SugarLogger.Warnf("京东取消拣货:%v", err2) - } - } + // if msg.StatusID == jdapi.OrderStatusVenderAgreeCancel { + // order := &model.GoodsOrder{ + // VendorOrgCode: vendorOrgCode, + // VendorOrderID: msg.BillID, + // } + // err2 := c.PickupGoods(order, false, jxcontext.AdminCtx.GetUserName()) + // if err2 != nil { + // globals.SugarLogger.Warnf("京东取消拣货:%v", err2) + // } + // } err := partner.CurOrderManager.OnOrderStatusChanged(vendorOrgCode, status) retVal = jdapi.Err2CallbackResponse(err, status.VendorStatus) } From 90418dc7e968f871b4d19e6b77483d6b4985b216 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, 6 Aug 2020 08:56:39 +0800 Subject: [PATCH 33/44] =?UTF-8?q?=E6=89=93=E5=8D=B0=E5=8E=BB=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 1 - 1 file changed, 1 deletion(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index a510c1f63..5cd426f30 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -4367,7 +4367,6 @@ func SyncMatterC4ToGy(ctx *jxcontext.Context, isContinueWhenError, isAsync bool) updateMatters = append(updateMatters, skusMap[c4.EclpID]) } } - fmt.Println("updateMatters", utils.Format4Output(updateMatters, false)) case 1: if len(deleteMatters) > 0 { for _, v := range deleteMatters { From 1b08386fe991317402c630a6a07f7688f03c2cc9 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, 6 Aug 2020 09:46:53 +0800 Subject: [PATCH 34/44] =?UTF-8?q?=E4=B8=89=E6=96=B9=E9=85=8D=E9=80=81?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=A4=87=E6=B3=A8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/delivery/dada/waybill.go | 14 +++++++------- business/partner/delivery/mtps/waybill.go | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/business/partner/delivery/dada/waybill.go b/business/partner/delivery/dada/waybill.go index 86f6e8308..c376f591d 100644 --- a/business/partner/delivery/dada/waybill.go +++ b/business/partner/delivery/dada/waybill.go @@ -228,14 +228,14 @@ func (c *DeliveryHandler) getBillParams(db *dao.DaoDB, order *model.GoodsOrder) } if billParams.ShopNo, err = c.getDadaShopID(order, db); err == nil { if billParams.CityCode, err = c.getDataCityCodeFromOrder(order, db); err == nil { - storeTel := "" - storeID := jxutils.GetSaleStoreIDFromOrder(order) - storeDeatail, _ := dao.GetStoreDetail(db, storeID, order.VendorID) - if storeDeatail.Tel2 != "" { - storeTel = ",门店电话:" + storeDeatail.Tel2 - } + // storeTel := "" + // storeID := jxutils.GetSaleStoreIDFromOrder(order) + // storeDeatail, _ := dao.GetStoreDetail(db, storeID, order.VendorID) + // if storeDeatail.Tel2 != "" { + // storeTel = ",门店电话:" + storeDeatail.Tel2 + // } billParams.ReceiverLng, billParams.ReceiverLat, _ = jxutils.IntCoordinate2MarsStandard(order.ConsigneeLng, order.ConsigneeLat, order.CoordinateType) - billParams.Info = fmt.Sprintf("%s第%d号订单, %s", model.VendorChineseNames[order.VendorID], order.OrderSeq, utils.FilterMb4(order.BuyerComment+"取货失败请联系平台电话:18048531223"+storeTel)) + billParams.Info = fmt.Sprintf("%s第%d号订单, %s", model.VendorChineseNames[order.VendorID], order.OrderSeq, utils.FilterMb4(order.BuyerComment+"取货失败或配送遇到问题请联系18048531223,禁止未配送直接完成定单!")) billParams.CargoType = dadaapi.CargoTypeFresh billParams.CargoWeight = float64(jxutils.IntWeight2Float(limitOrderWeight(order.Weight))) billParams.CargoNum = order.GoodsCount diff --git a/business/partner/delivery/mtps/waybill.go b/business/partner/delivery/mtps/waybill.go index bab269c74..5d18a4190 100644 --- a/business/partner/delivery/mtps/waybill.go +++ b/business/partner/delivery/mtps/waybill.go @@ -238,13 +238,13 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee // "goods_pickup_info": fmt.Sprintf("%s第%d号单", model.VendorChineseNames[order.VendorID], order.OrderSeq), // "poi_seq": fmt.Sprintf("#%d", order.OrderSeq), // } - storeTel := "" - storeID := jxutils.GetSaleStoreIDFromOrder(order) - storeDeatail, _ := dao.GetStoreDetail(db, storeID, order.VendorID) - if storeDeatail.Tel2 != "" { - storeTel = ",门店电话:" + storeDeatail.Tel2 - } - billParams.Note = utils.FilterMb4(order.BuyerComment + ",取货失败请联系平台电话:18048531223" + storeTel) + // storeTel := "" + // storeID := jxutils.GetSaleStoreIDFromOrder(order) + // storeDeatail, _ := dao.GetStoreDetail(db, storeID, order.VendorID) + // if storeDeatail.Tel2 != "" { + // storeTel = ",门店电话:" + storeDeatail.Tel2 + // } + billParams.Note = utils.FilterMb4(order.BuyerComment + ",取货失败或配送遇到问题请联系18048531223,禁止未配送直接完成定单!") billParams.GoodsDetail = string(utils.MustMarshal(goods)) billParams.GoodsPickupInfo = fmt.Sprintf("%s第%d号单", model.VendorChineseNames[order.VendorID], order.OrderSeq) billParams.PoiSeq = fmt.Sprintf("#%d", order.OrderSeq) From 00f5ae1c19b455c75b756c04128feeceaa3890f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 7 Aug 2020 11:54:29 +0800 Subject: [PATCH 35/44] =?UTF-8?q?=E5=8F=96=E6=B6=88=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 70 +++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 22 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 5405d5286..9de9f2c17 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1587,32 +1587,58 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // fmt.Println("deleteList2", deleteList) db := dao.GetDB() storeIDs := []int{ - 667159, - 667139, - 666842, - 666799, - 666794, - 666770, - 666739, - 666729, - 103177, - 103027, - 102808, - 102733, - 102718, - 102686, - 102676, - 102675, - 102661, - 101097, - 100041, - 100032, + 667335, + 667321, + 667319, + 667260, + 667227, + 667167, + 667109, + 667094, + 667050, + 666898, + 666852, + 666815, + 666763, + 666761, + 666760, + 666759, + 666714, + 666708, + 666705, + 666669, + 103437, + 103425, + 103349, + 103123, + 103116, + 103107, + 103069, + 103019, + 102940, + 102890, + 102831, + 102772, + 102751, + 101870, + 101755, + 101176, + 100767, + 100754, + 100726, + 100699, + 100476, + 100369, + 100366, + 100361, + 100351, + 100350, } for _, storeID := range storeIDs { - acts, _ := dao.QueryActs(db, 0, 0, 50, -1, "", -1, []int{1}, []int{0, 3, 4}, nil, storeID, nil, 0, utils.ZeroTimeValue, utils.ZeroTimeValue, utils.Str2Time("2020-05-30 00:00:00"), utils.Str2Time("2020-07-30 00:00:00")) + acts, _ := dao.QueryActs(db, 0, 0, 50, 0, "", -1, []int{1}, []int{0, 3, 4}, nil, storeID, nil, 0, utils.ZeroTimeValue, utils.ZeroTimeValue, utils.Str2Time("2020-05-30 00:00:00"), utils.Str2Time("2020-07-30 00:00:00")) for _, v := range acts.Data { var actStoreSkuParam []*act.ActStoreSkuParam - _, actStoreSkus, _ := dao.GetActStoreSkuVendorList(db, v.ID, nil, nil, nil, "", 0, 99999) + _, actStoreSkus, _ := dao.GetActStoreSkuVendorList(db, v.ID, []int{0}, nil, nil, "", 0, 99999) for _, actStoreSku := range actStoreSkus { if actStoreSku.StoreID == storeID { aa := &act.ActStoreSkuParam{ From 7e5d1227b5fb122530b47a26c19af5cb3708b0b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 7 Aug 2020 16:08:12 +0800 Subject: [PATCH 36/44] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E9=97=A8=E5=BA=97?= =?UTF-8?q?=E5=88=A0=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/act/act.go | 41 +++++++++++++++++++++++++++ controllers/act.go | 21 ++++++++++++++ routers/commentsRouter_controllers.go | 9 ++++++ 3 files changed, 71 insertions(+) diff --git a/business/jxstore/act/act.go b/business/jxstore/act/act.go index 5cd8e4116..77a5b8c39 100644 --- a/business/jxstore/act/act.go +++ b/business/jxstore/act/act.go @@ -1057,6 +1057,47 @@ func RefreshPageActs(ctx *jxcontext.Context, vendorIDs []int, createdFrom time.T return hint, err } +func DeleteStoresFromAct(ctx *jxcontext.Context, vendorID int, actTypes, storeIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) { + db := dao.GetDB() + task := tasksch.NewParallelTask("将SKU从所有活动中删除", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError), ctx, + func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { + storeID := batchItemList[0].(int) + acts, _ := dao.QueryActs(db, 0, 0, 50, 0, "", vendorID, []int{1}, actTypes, nil, storeID, nil, 0, utils.ZeroTimeValue, utils.ZeroTimeValue, time.Now().AddDate(0, -3, 0), time.Now()) + for _, v := range acts.Data { + var actStoreSkuParam []*ActStoreSkuParam + _, actStoreSkus, _ := dao.GetActStoreSkuVendorList(db, v.ID, []int{vendorID}, nil, nil, "", 0, 99999) + for _, actStoreSku := range actStoreSkus { + if actStoreSku.StoreID == storeID { + aa := &ActStoreSkuParam{ + ActStoreSku: model.ActStoreSku{ + StoreID: storeID, + SkuID: actStoreSku.SkuID, + ActID: v.ID, + }, + } + actStoreSkuParam = append(actStoreSkuParam, aa) + } + } + _, err = DeleteActStoreSkuBind(ctx, db, v.ID, actStoreSkuParam) + if err == nil { + _, err = SyncAct(ctx, nil, v.ID, nil, true) + } + } + + return retVal, err + }, storeIDs) + tasksch.HandleTask(task, nil, true).Run() + if isAsync { + hint = task.GetID() + } else { + resultList, err2 := task.GetResult(0) + if err = err2; err == nil { + hint = utils.Int2Str(len(resultList)) + } + } + return hint, err +} + func DeleteSkusFromAct(ctx *jxcontext.Context, vendorID int, actTypes, skuIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) { db := dao.GetDB() actMap := make(map[int]*model.Act) diff --git a/controllers/act.go b/controllers/act.go index b4df2580a..bc1a12896 100644 --- a/controllers/act.go +++ b/controllers/act.go @@ -307,6 +307,27 @@ func (c *ActController) DeleteSkusFromAct() { }) } +// @Title 将门店从所有活动中删除 +// @Description 将门店从所有活动中删除 +// @Param token header string true "认证token" +// @Param storeIDs query string true "门店ID列表" +// @Param vendorID query int true "厂商ID" +// @Param types query string false "活动类型列表" +// @Param isAsync query bool false "是否异步" +// @Param isContinueWhenError query bool false "单个同步失败是否继续,缺省false" +// @Success 200 {object} controllers.CallResult +// @Failure 200 {object} controllers.CallResult +// @router /DeleteStoresFromAct [delete] +func (c *ActController) DeleteStoresFromAct() { + c.callDeleteStoresFromAct(func(params *tActDeleteStoresFromActParams) (retVal interface{}, errCode string, err error) { + var storeIDs, types []int + if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.Types, &types); err == nil { + retVal, err = act.DeleteStoresFromAct(params.Ctx, params.VendorID, types, storeIDs, params.IsAsync, params.IsContinueWhenError) + } + return retVal, "", err + }) +} + // @Title 强制更新商品平台价 // @Description 强制更新商品平台价 // @Param token header string true "认证token" diff --git a/routers/commentsRouter_controllers.go b/routers/commentsRouter_controllers.go index d0f89c7bf..7a51db86e 100644 --- a/routers/commentsRouter_controllers.go +++ b/routers/commentsRouter_controllers.go @@ -43,6 +43,15 @@ func init() { Filters: nil, Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:ActController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:ActController"], + beego.ControllerComments{ + Method: "DeleteStoresFromAct", + Router: `/DeleteStoresFromAct`, + AllowHTTPMethods: []string{"delete"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:ActController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:ActController"], beego.ControllerComments{ Method: "ForceUpdateVendorPrice", From 71e3361118a68150e6a07baa338ae5d62a01da74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 7 Aug 2020 16:15:21 +0800 Subject: [PATCH 37/44] =?UTF-8?q?=E8=B5=B7=E8=B4=AD=E5=88=86=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/sku.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/model/sku.go b/business/model/sku.go index 15b179ef0..7c6eba473 100644 --- a/business/model/sku.go +++ b/business/model/sku.go @@ -226,6 +226,7 @@ type Sku struct { ExdSkuID string `orm:"column(exd_sku_id)" json:"exdSkuID"` //饿鲜达商品ID ExdCategoryThirdID int `orm:"column(exd_category_third_id)" json:"exdCategoryThirdID"` EclpID string `orm:"column(eclp_id)" json:"eclpID"` //eclp物料商品ID + MinOrderCount int `json:"minOrderCount"` //最少起购份数,美团用 // JdID int64 `orm:"column(jd_id);null;index" json:"jdID"` // JdSyncStatus int8 `orm:"default(2)" json:"jdSyncStatus"` From a3ec749c6ee0cbff987b067c79dc2e5e35a3ff79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 7 Aug 2020 16:29:55 +0800 Subject: [PATCH 38/44] =?UTF-8?q?=E6=9C=80=E5=B0=91=E8=B5=B7=E8=B4=AD?= =?UTF-8?q?=E5=88=86=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/mtwm/store_sku2.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/business/partner/purchase/mtwm/store_sku2.go b/business/partner/purchase/mtwm/store_sku2.go index 346a2de66..3f2de6e17 100644 --- a/business/partner/purchase/mtwm/store_sku2.go +++ b/business/partner/purchase/mtwm/store_sku2.go @@ -261,7 +261,11 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI if isNeedUpdatePrice { foodData["price"] = jxutils.IntPrice2Standard(storeSku.VendorPrice) } - foodData["min_order_count"] = 1 + if storeSku.MinOrderCount != 0 { + foodData["min_order_count"] = storeSku.MinOrderCount + } else { + foodData["min_order_count"] = 1 + } foodData["unit"] = storeSku.Unit foodData["box_num"] = 1 foodData["box_price"] = jxutils.IntPrice2Standard(storeSku.BoxFee) From 47e100656d80384905c68ec2faa457f10ebfab64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 7 Aug 2020 16:44:41 +0800 Subject: [PATCH 39/44] =?UTF-8?q?=E5=A4=87=E4=BB=BDstoreskus=E5=88=B05?= =?UTF-8?q?=E5=A4=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 5cd426f30..a451c0018 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -4049,7 +4049,7 @@ func BackUpStoreSkuBind(ctx *jxcontext.Context, isAsync, isContinueWhenError boo snapshotAt = utils.Time2Date(time.Now()) ) storeSkuBindHis := &model.StoreSkuBindHistory{ - SnapshotAt: snapshotAt.AddDate(0, 0, -2), + SnapshotAt: snapshotAt.AddDate(0, 0, -5), } dao.DeleteEntity(db, storeSkuBindHis, "SnapshotAt") storeList, err := dao.GetStoreList(db, nil, nil, nil, nil, "") From 59a06812477d4c9586bc7fc76ef262b19d2ebe7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 10 Aug 2020 09:02:30 +0800 Subject: [PATCH 40/44] =?UTF-8?q?=E9=A5=BF=E7=99=BE=E9=97=A8=E5=BA=97?= =?UTF-8?q?=E5=AE=A2=E6=9C=8D=E7=94=B5=E8=AF=9D=E8=A6=81=E8=83=BD=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/ebai/store.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/business/partner/purchase/ebai/store.go b/business/partner/purchase/ebai/store.go index 4ae71f077..17e01b310 100644 --- a/business/partner/purchase/ebai/store.go +++ b/business/partner/purchase/ebai/store.go @@ -390,6 +390,7 @@ func genStoreMapFromStore(store *tEbaiStoreInfo) map[string]interface{} { phone = model.VendorStoreTel } params["ivr_phone"] = phone //统一改为这个电话 + if store.VendorStoreID != "" { params["baidu_shop_id"] = store.VendorStoreID } @@ -402,7 +403,7 @@ func genStoreMapFromStore(store *tEbaiStoreInfo) map[string]interface{} { } boxFee, _ := dao.GetSysConfigAsInt64(dao.GetDB(), model.ConfigSysEbaiBoxFee) params["package_box_price"] = boxFee - + params["service_phone"] = store.Tel1 params["address"] = store.Address // todo 饿百 开店审核通过后不允许修改商户信息 if store.SyncStatus&(model.SyncFlagNewMask /*|model.SyncFlagStoreAddress*/) != 0 { From 60a850eccaacab25ee47b20463e5f785b7a37213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 10 Aug 2020 17:39:58 +0800 Subject: [PATCH 41/44] getskuname --- business/jxstore/cms/sku.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index 14563243f..9e4039c4d 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -670,6 +670,7 @@ func GetSkuNames(ctx *jxcontext.Context, keyword string, isBySku, isQueryMidPric '","lastOperator":"', t2.last_operator, '","specQuality":', t2.spec_quality, ',"specUnit":"', t2.spec_unit, '","exdSkuID":"', t2.exd_sku_id, '","eclpID":"', t2.eclp_id, + '","minOrderCount":"', t2.min_order_count, '","weight":', t2.weight, ',"categoryID":', t2.category_id, ',"nameID":', t2.name_id, ', "seq":', t2.seq, "}")), "]") skus_str, From dbc87bd0d78493405d5764bc4e8535f27b940217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 10 Aug 2020 18:01:52 +0800 Subject: [PATCH 42/44] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=92=8C=E4=BA=AC=E8=A5=BF=E7=9A=84=E8=AE=A2=E5=8D=95=E7=BB=93?= =?UTF-8?q?=E7=AE=97=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 | 32 +++++++++++++-------------- business/jxutils/jxutils.go | 20 ++++++++--------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 841c2e7ad..865209fc4 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -199,25 +199,25 @@ func (c *OrderManager) OnOrderStatusChanged(vendorOrgCode string, orderStatus *m waybill, _ := c.LoadWaybill(order.VendorWaybillID, order.WaybillVendorID) store, _ := c.LoadStoreDetail(jxutils.GetSaleStoreIDFromOrder(order), order.VendorID) if waybill == nil { - if order.VendorID == model.VendorIDJDShop || order.VendorID == model.VendorIDJX { - if order.NewEarningPrice == 0 || order.NewEarningPrice != order.TotalShopMoney*int64(100-store.PayPercentage)/int64(100) { - order.NewEarningPrice = order.TotalShopMoney * int64(100-store.PayPercentage) / int64(100) - } - } else { - if order.NewEarningPrice == 0 || order.NewEarningPrice != order.TotalShopMoney*int64(100-store.PayPercentage/2)/int64(100) { - order.NewEarningPrice = order.TotalShopMoney * int64(100-store.PayPercentage/2) / int64(100) - } + // if order.VendorID == model.VendorIDJDShop || order.VendorID == model.VendorIDJX { + // if order.NewEarningPrice == 0 || order.NewEarningPrice != order.TotalShopMoney*int64(100-store.PayPercentage)/int64(100) { + // order.NewEarningPrice = order.TotalShopMoney * int64(100-store.PayPercentage) / int64(100) + // } + // } else { + if order.NewEarningPrice == 0 || order.NewEarningPrice != order.TotalShopMoney*int64(100-store.PayPercentage/2)/int64(100) { + order.NewEarningPrice = order.TotalShopMoney * int64(100-store.PayPercentage/2) / int64(100) } + // } } else { - if order.VendorID == model.VendorIDJDShop || order.VendorID == model.VendorIDJX { - if order.NewEarningPrice == 0 || order.NewEarningPrice != (order.TotalShopMoney-waybill.DesiredFee)*int64(100-store.PayPercentage)/int64(100) { - order.NewEarningPrice = (order.TotalShopMoney - waybill.DesiredFee) * int64(100-store.PayPercentage) / int64(100) - } - } else { - if order.NewEarningPrice == 0 || order.NewEarningPrice != (order.TotalShopMoney-waybill.DesiredFee)*int64(100-store.PayPercentage/2)/int64(100) { - order.NewEarningPrice = (order.TotalShopMoney - waybill.DesiredFee) * int64(100-store.PayPercentage/2) / int64(100) - } + // if order.VendorID == model.VendorIDJDShop || order.VendorID == model.VendorIDJX { + // if order.NewEarningPrice == 0 || order.NewEarningPrice != (order.TotalShopMoney-waybill.DesiredFee)*int64(100-store.PayPercentage)/int64(100) { + // order.NewEarningPrice = (order.TotalShopMoney - waybill.DesiredFee) * int64(100-store.PayPercentage) / int64(100) + // } + // } else { + if order.NewEarningPrice == 0 || order.NewEarningPrice != (order.TotalShopMoney-waybill.DesiredFee)*int64(100-store.PayPercentage/2)/int64(100) { + order.NewEarningPrice = (order.TotalShopMoney - waybill.DesiredFee) * int64(100-store.PayPercentage/2) / int64(100) } + // } } dao.UpdateEntity(db, order, "NewEarningPrice") } diff --git a/business/jxutils/jxutils.go b/business/jxutils/jxutils.go index 30064d05e..c7288df87 100644 --- a/business/jxutils/jxutils.go +++ b/business/jxutils/jxutils.go @@ -590,11 +590,11 @@ func RefreshOrderSkuRelated(order *model.GoodsOrder) *model.GoodsOrder { func RefreshOrderEarningPrice2(order *model.GoodsOrder, payPercentage int) *model.GoodsOrder { if order.EarningType == model.EarningTypePoints { - if order.VendorID == model.VendorIDJDShop || order.VendorID == model.VendorIDJX { - order.NewEarningPrice = order.TotalShopMoney * int64((100 - payPercentage)) / 100 - } else { - order.NewEarningPrice = order.TotalShopMoney * int64((100 - payPercentage/2)) / 100 - } + // if order.VendorID == model.VendorIDJDShop || order.VendorID == model.VendorIDJX { + // order.NewEarningPrice = order.TotalShopMoney * int64((100 - payPercentage)) / 100 + // } else { + order.NewEarningPrice = order.TotalShopMoney * int64((100 - payPercentage/2)) / 100 + // } } else { order.NewEarningPrice = order.EarningPrice } @@ -603,11 +603,11 @@ func RefreshOrderEarningPrice2(order *model.GoodsOrder, payPercentage int) *mode func RefreshOrderEarningPrice3(order *model.GoodsOrder, payPercentage int, bill *model.Waybill) *model.GoodsOrder { if order.EarningType == model.EarningTypePoints { - if order.VendorID == model.VendorIDJDShop || order.VendorID == model.VendorIDJX { - order.NewEarningPrice = (order.TotalShopMoney - bill.DesiredFee) * int64((100 - payPercentage)) / 100 - } else { - order.NewEarningPrice = (order.TotalShopMoney - bill.DesiredFee) * int64((100 - payPercentage/2)) / 100 - } + // if order.VendorID == model.VendorIDJDShop || order.VendorID == model.VendorIDJX { + // order.NewEarningPrice = (order.TotalShopMoney - bill.DesiredFee) * int64((100 - payPercentage)) / 100 + // } else { + order.NewEarningPrice = (order.TotalShopMoney - bill.DesiredFee) * int64((100 - payPercentage/2)) / 100 + // } } else { order.NewEarningPrice = order.EarningPrice } From 68cf04d034d7259234af8a7121d46fe4bc6d78b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 10 Aug 2020 18:07:06 +0800 Subject: [PATCH 43/44] getskunames --- business/jxstore/cms/sku.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index 9e4039c4d..b2a92a7e2 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -670,9 +670,9 @@ func GetSkuNames(ctx *jxcontext.Context, keyword string, isBySku, isQueryMidPric '","lastOperator":"', t2.last_operator, '","specQuality":', t2.spec_quality, ',"specUnit":"', t2.spec_unit, '","exdSkuID":"', t2.exd_sku_id, '","eclpID":"', t2.eclp_id, - '","minOrderCount":"', t2.min_order_count, '","weight":', t2.weight, ',"categoryID":', t2.category_id, ',"nameID":', t2.name_id, ', "seq":', t2.seq, + ', "minOrderCount":', t2.min_order_count, "}")), "]") skus_str, CONCAT("[", GROUP_CONCAT(DISTINCT t3.place_code), "]") places_str ` + sql + ` From d2ff7cde17e34e3e487a1e2c32c1a4e5d4659fa0 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, 11 Aug 2020 09:17:13 +0800 Subject: [PATCH 44/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E9=85=8D=E9=80=81=E8=B4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 20 ++++++++++++++++++++ controllers/jx_order.go | 15 +++++++++++++++ controllers/jx_order2.go | 2 ++ routers/commentsRouter_controllers.go | 9 +++++++++ 4 files changed, 46 insertions(+) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 865209fc4..ebc45ba75 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1490,3 +1490,23 @@ func AdjustJdsOrderSimple(ctx *jxcontext.Context, vendorOrderID string, skuID in } return err } + +func UpdateWaybillDesiredFee(ctx *jxcontext.Context, vendorOrderID string, desiredFee int) (err error) { + var ( + db = dao.GetDB() + ) + order, _ := dao.GetSimpleOrder(db, vendorOrderID) + if order == nil { + return fmt.Errorf("未找到该订单!orderID: %v", vendorOrderID) + } + bill, err := partner.CurOrderManager.LoadWaybill(order.VendorWaybillID, order.WaybillVendorID) + if err != nil { + return err + } + if bill == nil { + return fmt.Errorf("未找到此订单对应的运单!orderID: %v", vendorOrderID) + } + bill.DesiredFee = int64(desiredFee) + _, err = dao.UpdateEntity(db, bill, "DesiredFee") + return err +} diff --git a/controllers/jx_order.go b/controllers/jx_order.go index 0839dcc9a..63b872ad7 100644 --- a/controllers/jx_order.go +++ b/controllers/jx_order.go @@ -1119,3 +1119,18 @@ func (c *OrderController) AdjustJdsOrderSimple() { return retVal, "", err }) } + +// @Title 修改订单运费 +// @Description 修改订单运费 +// @Param token header string true "认证token" +// @Param vendorOrderID formData string true "订单号" +// @Param desiredFee formData int true "运费" +// @Success 200 {object} controllers.CallResult +// @Failure 200 {object} controllers.CallResult +// @router /UpdateWaybillDesiredFee [put] +func (c *OrderController) UpdateWaybillDesiredFee() { + c.callUpdateWaybillDesiredFee(func(params *tOrderUpdateWaybillDesiredFeeParams) (retVal interface{}, errCode string, err error) { + err = orderman.UpdateWaybillDesiredFee(params.Ctx, params.VendorOrderID, params.DesiredFee) + return retVal, "", err + }) +} diff --git a/controllers/jx_order2.go b/controllers/jx_order2.go index 707c210c9..b355610cb 100644 --- a/controllers/jx_order2.go +++ b/controllers/jx_order2.go @@ -222,3 +222,5 @@ func (c *JxOrderController) SendFailedMatterOrder() { return retVal, "", err }) } + + diff --git a/routers/commentsRouter_controllers.go b/routers/commentsRouter_controllers.go index 7a51db86e..22f502d75 100644 --- a/routers/commentsRouter_controllers.go +++ b/routers/commentsRouter_controllers.go @@ -1314,6 +1314,15 @@ func init() { Filters: nil, Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"], + beego.ControllerComments{ + Method: "UpdateWaybillDesiredFee", + Router: `/UpdateWaybillDesiredFee`, + AllowHTTPMethods: []string{"put"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:ReportController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:ReportController"], beego.ControllerComments{ Method: "AutoFocusStoreSkus",