From 349b8fd4dc3719ec95b38e40566e0e594cc276a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 12 Jan 2024 10:23:16 +0800 Subject: [PATCH 1/8] 1 --- business/jxstore/cms/store.go | 2 +- business/jxstore/cms/store_sku.go | 28 ++++-------- business/partner/purchase/mtwm/order.go | 2 +- business/partner/purchase/mtwm/store_sku2.go | 46 ++++++++++++++++++++ controllers/cms_sku.go | 18 ++++++++ routers/commentsRouter_controllers.go | 10 +++++ 6 files changed, 84 insertions(+), 22 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 8d61a7c2c..03151e971 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -1854,7 +1854,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor // dao.UpdateEntity(db, storeDetail, "Address") // // 添加同步 valid["address"] = payload["address"].(string) - //syncStatus |= model.SyncFlagStoreName + syncStatus |= model.SyncFlagStoreName address = payload["address"].(string) } diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 8a568f8dd..0e9c26711 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -6692,23 +6692,11 @@ func BatchSetRestockingPrice(ctx *jxcontext.Context, preData map[string][]mtwmap } // BatchSetMTBoxPrice 批量修改美团包装费为0 -//func BatchSetMTBoxPrice(jxStoreId []int) error { -// var db = dao.GetDB() -// for _, v := range jxStoreId { -// storeDetail, err := dao.GetStoreDetail(db, v, model.VendorIDMTWM, "") -// if err != nil { -// return err -// } -// -// storeSkuList, err := dao.GetStoresSkusInfo(db, []int{v}, nil) -// if err != nil { -// return err -// } -// -// } -// -// utils.CallFuncAsync(func() { -// -// }) -// return nil -//} +func BatchSetMTBoxPrice(ctx *jxcontext.Context, jxStoreId []int) error { + var db = dao.GetDB() + for _, v := range jxStoreId { + mtwm.UpdateBoxPrice(ctx, db, v) + } + + return nil +} diff --git a/business/partner/purchase/mtwm/order.go b/business/partner/purchase/mtwm/order.go index 994752818..02f6b66db 100644 --- a/business/partner/purchase/mtwm/order.go +++ b/business/partner/purchase/mtwm/order.go @@ -632,7 +632,7 @@ func (c *PurchaseHandler) SelfDeliverDelivered(order *model.GoodsOrder, userName riderInfo.ThirdCarrierOrderId = order.VendorOrderID } else { for _, v := range waybills { - if v.Status >= model.OrderStatusDelivering && v.Status <= model.OrderStatusFinished { + if v.Status != model.OrderStatusCanceled && v.Status != model.OrderStatusFinished && v.Status != model.OrderStatusEndEnd { riderInfo.CourierName = v.CourierName riderInfo.CourierPhone = v.CourierMobile riderInfo.ThirdCarrierOrderId = v.VendorWaybillID diff --git a/business/partner/purchase/mtwm/store_sku2.go b/business/partner/purchase/mtwm/store_sku2.go index 399e348d2..28c40eb92 100644 --- a/business/partner/purchase/mtwm/store_sku2.go +++ b/business/partner/purchase/mtwm/store_sku2.go @@ -3,6 +3,7 @@ package mtwm import ( "encoding/json" "fmt" + "math" "regexp" "strings" @@ -437,6 +438,9 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI // boxPirce = storeSku.LadderBoxPrice //} //skus[0]["ladder_box_price"] = jxutils.IntPrice2Standard(int64(boxPirce)) + + skus[0]["ladder_box_num"] = 0 + skus[0]["ladder_box_price"] = 0 if foodData["tag_id"] != nil { skus[0]["weight"] = storeSku.Weight // weight字段仅限服饰鞋帽、美妆、日用品、母婴、生鲜果蔬、生活超市下的便利店/超市门店品类的商家使用 } @@ -895,3 +899,45 @@ func (p *PurchaseHandler) UpdateStoreSkusSpecTag(ctx *jxcontext.Context, vendorO func (p *PurchaseHandler) GetSkuCategoryIdByName(vendorOrgCode, skuName string) (vendorCategoryId string, err error) { return "", err } + +func UpdateBoxPrice(ctx *jxcontext.Context, db *dao.DaoDB, storeId int) error { + storeDetail, err := dao.GetStoreDetail(db, storeId, model.VendorIDMTWM, "") + if err != nil { + return err + } + + storeSkuList, err := dao.GetStoresSkusInfo(db, []int{storeId}, nil) + if err != nil { + return err + } + + api := getAPI(storeDetail.VendorOrgCode, storeId, storeDetail.VendorStoreID) + foodDataList := make([]map[string]interface{}, 0) + for _, v := range storeSkuList { + if v.MtwmID != model.NO { + continue + } + + foodDataList = append(foodDataList, map[string]interface{}{ + "app_spu_code": utils.Int2Str(v.SkuID), + "skus": []map[string]interface{}{ + { + "sku_id": utils.Int2Str(v.SkuID), + "ladder_box_num": "0", + "ladder_box_price": "0", + }, + }, + }) + } + + count := utils.Float64TwoInt(math.Ceil(float64(len(foodDataList)) / float64(50))) + for i := 1; i <= count; i++ { + if i == count { + _, _ = api.RetailBatchInitData(ctx.GetTrackInfo(), storeDetail.VendorStoreID, foodDataList[(i-1)*50:]) + } else { + _, _ = api.RetailBatchInitData(ctx.GetTrackInfo(), storeDetail.VendorStoreID, foodDataList[(i-1)*50:i*50]) + } + } + + return nil +} diff --git a/controllers/cms_sku.go b/controllers/cms_sku.go index 95a3d1a46..76557cfec 100644 --- a/controllers/cms_sku.go +++ b/controllers/cms_sku.go @@ -885,6 +885,24 @@ func (c *SkuController) BatchSetRestockingPrice() { }) } +// @Title 批量设置美团商品打包费为零 +// @Description 批量设置美团商品打包费为零 +// @Param token header string true "认证token" +// @Param storeIds formData string true "门店id列表" +// @Success 200 {object} controllers.CallResult +// @Failure 200 {object} controllers.CallResult +// @router /BatchSetBoxPrice [post] +func (c *SkuController) BatchSetBoxPrice() { + c.callBatchSetBoxPrice(func(params *tSkuBatchSetBoxPriceParams) (retVal interface{}, errCode string, err error) { + var stores []int + if err = jxutils.Strings2Objs(params.StoreIds, &stores); err != nil { + return retVal, "", err + } + err = cms.BatchSetMTBoxPrice(params.Ctx, stores) + return retVal, "", err + }) +} + type CategoryList struct { DdId string `json:"dd_id"` Id int `json:"id"` diff --git a/routers/commentsRouter_controllers.go b/routers/commentsRouter_controllers.go index b9564d1a7..861c3647a 100644 --- a/routers/commentsRouter_controllers.go +++ b/routers/commentsRouter_controllers.go @@ -2025,6 +2025,16 @@ func init() { Filters: nil, Params: nil}) + // 修改门店美团包装费 + web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SkuController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SkuController"], + web.ControllerComments{ + Method: "BatchSetBoxPrice", + Router: `/BatchSetBoxPrice`, + AllowHTTPMethods: []string{"post"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + // 修改抖店分类商品 web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SkuController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SkuController"], web.ControllerComments{ From 74bc1477101703f74c430531bef3b22ad3291abf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 12 Jan 2024 10:34:03 +0800 Subject: [PATCH 2/8] 1 --- business/jxstore/cms/store.go | 1 + business/jxstore/cms/sync.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 03151e971..6b11f1887 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -1919,6 +1919,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor valid["address"] = address } + globals.SugarLogger.Debugf("===============aa:= %s", utils.Format4Output(isUpdateStoreNeedSync(valid), false)) if isUpdateStoreNeedSync(valid) { // 同步修改门店已经配送门店 _, err = CurVendorSync.SyncStore(ctx, db, vendorID, storeID, false, userName) //updateCourierStores(ctx, storeID) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 4b080d6d7..1d11536cc 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -249,6 +249,7 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs db2 = dao.GetDB() } if model.IsSyncStatusNew(storeMap.SyncStatus) { + globals.SugarLogger.Debugf("==============storeMap.SyncStatus1 %d", storeMap.SyncStatus) storeDetail, _ := dao.GetStoreDetail(db, storeMap.StoreID, storeMap.VendorID, storeMap.VendorOrgCode) if vendorStoreID, err = handler.CreateStore2(db2, storeMap.StoreID, userName, nil, storeDetail); err == nil { resultList = append(resultList, 1) @@ -256,12 +257,14 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, model.VendorChineseNames[storeMap.VendorID], "创建门店") } } else if model.IsSyncStatusDelete(storeMap.SyncStatus) { + globals.SugarLogger.Debugf("==============storeMap.SyncStatus2 %d", storeMap.SyncStatus) if err = handler.DeleteStore(db2, storeMap.StoreID, userName); err == nil { resultList = append(resultList, 1) } else { failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, model.VendorChineseNames[storeMap.VendorID], "删除门店") } } else { + globals.SugarLogger.Debugf("==============storeMap.SyncStatus3 %d", storeMap.SyncStatus) if err = handler.UpdateStore(db2, storeMap.StoreID, userName); err == nil { resultList = append(resultList, 1) } else { From dccba77da3ff484a4aa40b8cefa8aa571b030af1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 12 Jan 2024 10:41:05 +0800 Subject: [PATCH 3/8] 1 --- business/jxstore/cms/sync.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 1d11536cc..f4f871480 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -248,6 +248,7 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs if len(loopMapInfo.StoreMapList) > 1 { db2 = dao.GetDB() } + globals.SugarLogger.Debugf("==============storeMap %s", utils.Format4Output(storeMap, false)) if model.IsSyncStatusNew(storeMap.SyncStatus) { globals.SugarLogger.Debugf("==============storeMap.SyncStatus1 %d", storeMap.SyncStatus) storeDetail, _ := dao.GetStoreDetail(db, storeMap.StoreID, storeMap.VendorID, storeMap.VendorOrgCode) From 362903a76ad660a594bf2559708262a10b232c2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 12 Jan 2024 10:47:44 +0800 Subject: [PATCH 4/8] 1 --- business/jxstore/cms/sync.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index f4f871480..83d933872 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -231,6 +231,7 @@ func (v *VendorSync) SyncReorderCategories(ctx *jxcontext.Context, db *dao.DaoDB // } func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs, storeIDs []int, mustDirty, isAsync bool) (hint string, err error) { + globals.SugarLogger.Debugf("==============storeMap %s , %s", utils.Format4Output(vendorIDs, false), utils.Format4Output(storeIDs, false)) userName := ctx.GetUserName() isManageIt := len(storeIDs) == 0 || len(storeIDs) > 5 _, hint, err = v.LoopStoresMap2(ctx, nil, db, fmt.Sprintf("同步门店信息:%v", storeIDs), isAsync, isManageIt, vendorIDs, storeIDs, mustDirty, func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (resultList interface{}, err error) { @@ -683,6 +684,7 @@ func (v *VendorSync) LoopStoresMap2(ctx *jxcontext.Context, parentTask tasksch.I if storeMapList, err = dao.GetStoresMapList2(db, vendorIDs, storeIDs, nil, model.StoreStatusAll, model.StoreIsSyncYes, "", "", "", mustDirty); err != nil { return nil, "", err } + globals.SugarLogger.Debugf("=========storeMapList := %s", utils.Format4Output(storeMapList, false)) if len(storeMapList) == 0 { return nil, "", nil } From 8ba5b55bf47991bd64a5d9e589cd75078d68adbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 12 Jan 2024 10:52:15 +0800 Subject: [PATCH 5/8] 1 --- business/jxstore/cms/sync.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 83d933872..96caa6dd1 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -231,13 +231,13 @@ func (v *VendorSync) SyncReorderCategories(ctx *jxcontext.Context, db *dao.DaoDB // } func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs, storeIDs []int, mustDirty, isAsync bool) (hint string, err error) { - globals.SugarLogger.Debugf("==============storeMap %s , %s", utils.Format4Output(vendorIDs, false), utils.Format4Output(storeIDs, false)) userName := ctx.GetUserName() isManageIt := len(storeIDs) == 0 || len(storeIDs) > 5 _, hint, err = v.LoopStoresMap2(ctx, nil, db, fmt.Sprintf("同步门店信息:%v", storeIDs), isAsync, isManageIt, vendorIDs, storeIDs, mustDirty, func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (resultList interface{}, err error) { loopMapInfo := batchItemList[0].(*LoopStoreMapInfo) var failedList []*partner.StoreSkuInfoWithErr handler := v.GetStoreHandler(loopMapInfo.VendorID) + globals.SugarLogger.Debugf("==============handler %s , %s", utils.Format4Output(handler, false), utils.Format4Output(loopMapInfo.VendorID, false)) if handler != nil { if len(loopMapInfo.StoreMapList) > 1 { loopStoreTask := tasksch.NewParallelTask(fmt.Sprintf("处理平台%s", model.VendorChineseNames[loopMapInfo.VendorID]), tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx, @@ -684,7 +684,6 @@ func (v *VendorSync) LoopStoresMap2(ctx *jxcontext.Context, parentTask tasksch.I if storeMapList, err = dao.GetStoresMapList2(db, vendorIDs, storeIDs, nil, model.StoreStatusAll, model.StoreIsSyncYes, "", "", "", mustDirty); err != nil { return nil, "", err } - globals.SugarLogger.Debugf("=========storeMapList := %s", utils.Format4Output(storeMapList, false)) if len(storeMapList) == 0 { return nil, "", nil } From 85e17d6dfa03a893f60fe41b62bdbd2b1732c6aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 12 Jan 2024 10:58:59 +0800 Subject: [PATCH 6/8] 1 --- business/jxstore/cms/store.go | 1 - business/jxstore/cms/sync.go | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 6b11f1887..03151e971 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -1919,7 +1919,6 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor valid["address"] = address } - globals.SugarLogger.Debugf("===============aa:= %s", utils.Format4Output(isUpdateStoreNeedSync(valid), false)) if isUpdateStoreNeedSync(valid) { // 同步修改门店已经配送门店 _, err = CurVendorSync.SyncStore(ctx, db, vendorID, storeID, false, userName) //updateCourierStores(ctx, storeID) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 96caa6dd1..a768d91cd 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -235,11 +235,13 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs isManageIt := len(storeIDs) == 0 || len(storeIDs) > 5 _, hint, err = v.LoopStoresMap2(ctx, nil, db, fmt.Sprintf("同步门店信息:%v", storeIDs), isAsync, isManageIt, vendorIDs, storeIDs, mustDirty, func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (resultList interface{}, err error) { loopMapInfo := batchItemList[0].(*LoopStoreMapInfo) + globals.SugarLogger.Debugf("==============handler %s", utils.Format4Output(loopMapInfo, false)) var failedList []*partner.StoreSkuInfoWithErr handler := v.GetStoreHandler(loopMapInfo.VendorID) - globals.SugarLogger.Debugf("==============handler %s , %s", utils.Format4Output(handler, false), utils.Format4Output(loopMapInfo.VendorID, false)) if handler != nil { + globals.SugarLogger.Debugf("==============handler %s", "11111111111") if len(loopMapInfo.StoreMapList) > 1 { + globals.SugarLogger.Debugf("==============handler2 %s", "11111111111") loopStoreTask := tasksch.NewParallelTask(fmt.Sprintf("处理平台%s", model.VendorChineseNames[loopMapInfo.VendorID]), tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { var resultList []interface{} From e4608f3106d398c06a919e8691a31fc7490b72bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 12 Jan 2024 11:01:57 +0800 Subject: [PATCH 7/8] 1 --- business/jxstore/cms/sync.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index a768d91cd..b41d49b3e 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -235,9 +235,9 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs isManageIt := len(storeIDs) == 0 || len(storeIDs) > 5 _, hint, err = v.LoopStoresMap2(ctx, nil, db, fmt.Sprintf("同步门店信息:%v", storeIDs), isAsync, isManageIt, vendorIDs, storeIDs, mustDirty, func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (resultList interface{}, err error) { loopMapInfo := batchItemList[0].(*LoopStoreMapInfo) - globals.SugarLogger.Debugf("==============handler %s", utils.Format4Output(loopMapInfo, false)) var failedList []*partner.StoreSkuInfoWithErr handler := v.GetStoreHandler(loopMapInfo.VendorID) + globals.SugarLogger.Debugf("==============handler %d", loopMapInfo.VendorID) if handler != nil { globals.SugarLogger.Debugf("==============handler %s", "11111111111") if len(loopMapInfo.StoreMapList) > 1 { From fa4a73052952864ed07b2c3a343bc83437d75ec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 12 Jan 2024 11:44:21 +0800 Subject: [PATCH 8/8] 1 --- business/jxstore/cms/store.go | 5 ++++- business/jxstore/cms/sync.go | 7 ------- business/model/dao/store.go | 2 +- business/partner/purchase/mtwm/store.go | 8 ++++++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 03151e971..b343e0e37 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -1856,6 +1856,9 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor valid["address"] = payload["address"].(string) syncStatus |= model.SyncFlagStoreName address = payload["address"].(string) + // 这个字段暂存美团门店地址 + storeMap.YbStorePrefix = address + dao.UpdateEntity(db, storeMap, "YbStorePrefix") } if err == nil { @@ -1920,7 +1923,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor } if isUpdateStoreNeedSync(valid) { // 同步修改门店已经配送门店 - _, err = CurVendorSync.SyncStore(ctx, db, vendorID, storeID, false, userName) + _, err = CurVendorSync.SyncStore(ctx, db, vendorID, storeID, false, userName) // address原来的userName 因为storeMap无法保存address,所以美团暂时使用该参数代替 //updateCourierStores(ctx, storeID) } diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index b41d49b3e..4b080d6d7 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -237,11 +237,8 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs loopMapInfo := batchItemList[0].(*LoopStoreMapInfo) var failedList []*partner.StoreSkuInfoWithErr handler := v.GetStoreHandler(loopMapInfo.VendorID) - globals.SugarLogger.Debugf("==============handler %d", loopMapInfo.VendorID) if handler != nil { - globals.SugarLogger.Debugf("==============handler %s", "11111111111") if len(loopMapInfo.StoreMapList) > 1 { - globals.SugarLogger.Debugf("==============handler2 %s", "11111111111") loopStoreTask := tasksch.NewParallelTask(fmt.Sprintf("处理平台%s", model.VendorChineseNames[loopMapInfo.VendorID]), tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { var resultList []interface{} @@ -251,9 +248,7 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs if len(loopMapInfo.StoreMapList) > 1 { db2 = dao.GetDB() } - globals.SugarLogger.Debugf("==============storeMap %s", utils.Format4Output(storeMap, false)) if model.IsSyncStatusNew(storeMap.SyncStatus) { - globals.SugarLogger.Debugf("==============storeMap.SyncStatus1 %d", storeMap.SyncStatus) storeDetail, _ := dao.GetStoreDetail(db, storeMap.StoreID, storeMap.VendorID, storeMap.VendorOrgCode) if vendorStoreID, err = handler.CreateStore2(db2, storeMap.StoreID, userName, nil, storeDetail); err == nil { resultList = append(resultList, 1) @@ -261,14 +256,12 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, model.VendorChineseNames[storeMap.VendorID], "创建门店") } } else if model.IsSyncStatusDelete(storeMap.SyncStatus) { - globals.SugarLogger.Debugf("==============storeMap.SyncStatus2 %d", storeMap.SyncStatus) if err = handler.DeleteStore(db2, storeMap.StoreID, userName); err == nil { resultList = append(resultList, 1) } else { failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, model.VendorChineseNames[storeMap.VendorID], "删除门店") } } else { - globals.SugarLogger.Debugf("==============storeMap.SyncStatus3 %d", storeMap.SyncStatus) if err = handler.UpdateStore(db2, storeMap.StoreID, userName); err == nil { resultList = append(resultList, 1) } else { diff --git a/business/model/dao/store.go b/business/model/dao/store.go index 6d08fc6e6..de0441184 100644 --- a/business/model/dao/store.go +++ b/business/model/dao/store.go @@ -62,7 +62,7 @@ type StoreDetail struct { YbAppID string `orm:"column(yb_app_id)" json:"ybAppID"` YbAppKey string `json:"ybAppKey"` - YbStorePrefix string `json:"ybStorePrefix"` //vendorID=14 暂存打包费 + YbStorePrefix string `json:"ybStorePrefix"` //vendorID=14 暂存打包费 / vendorID = 1 暂存美团门店地址 MtwmToken string `json:"mtwmToken"` // 当vendor为美团时存储美团token,为抖店时存储抖店token,也储存淘鲜达token,其他品牌门店授权时appkey相同时token不相同 EbaiSupplierID string `json:"ebaiSupplierID"` diff --git a/business/partner/purchase/mtwm/store.go b/business/partner/purchase/mtwm/store.go index 402936939..42346874b 100644 --- a/business/partner/purchase/mtwm/store.go +++ b/business/partner/purchase/mtwm/store.go @@ -263,8 +263,8 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin //TODO 美团暂时不用那个电话 phone := storeDetail.Tel1 params := map[string]interface{}{ - "name": name, //jxutils.ComposeStoreName(storeDetail.Store.Name, model.VendorIDMTWM), - "address": storeDetail.Address, // 美团好像地址也不能改的? + "name": name, //jxutils.ComposeStoreName(storeDetail.Store.Name, model.VendorIDMTWM), + // "address": storeDetail.Address, // 美团好像地址也不能改的? "longitude": jxutils.IntCoordinate2Standard(int(remoteStoreInfo.Longitude)), "latitude": jxutils.IntCoordinate2Standard(int(remoteStoreInfo.Latitude)), "phone": phone, @@ -275,6 +275,10 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin "third_tag_name": remoteStoreInfo.ThirdTagName, "promotion_info": storeDetail.PromoteInfo, } + if storeDetail.Address != storeDetail.YbStorePrefix && storeDetail.YbStorePrefix != "" { + params["address"] = storeDetail.YbStorePrefix + } + if globals.EnableMtwmStoreWrite { errList.AddErr(mtapi.PoiSave(storeDetail.VendorStoreID, params)) }