From f1d025eb159c0ad86317700a5e9f55e38700dd2e Mon Sep 17 00:00:00 2001 From: gazebo Date: Mon, 30 Dec 2019 16:50:32 +0800 Subject: [PATCH] =?UTF-8?q?+StoreMap.BoxFee=20=E7=BE=8E=E5=9B=A2=E5=A4=96?= =?UTF-8?q?=E5=8D=96=E6=94=AF=E6=8C=81=E6=89=93=E5=8C=85=E8=A2=8B=E8=B4=B9?= =?UTF-8?q?=EF=BC=8C=E7=BE=8E=E5=9B=A2=E5=95=86=E5=93=81=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E6=B7=BB=E5=8A=A01=E8=A7=92=E6=89=93=E5=8C=85=E8=B4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store.go | 22 ++++++++++++++++++-- business/model/dao/store.go | 3 ++- business/model/store.go | 2 ++ business/partner/purchase/mtwm/store.go | 6 ++++++ business/partner/purchase/mtwm/store_sku2.go | 5 +++-- 5 files changed, 33 insertions(+), 5 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index ee40f141a..be11f8cfa 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -176,6 +176,13 @@ var ( "promoteInfo": 1, } + storeMapKeyPropertyMap = map[string]int{ + "status": 1, + "freightDeductionPack": 1, + "vendorStoreName": 1, + "boxFee": 1, + } + WatchVendorStoreTimeList = []string{ "8:00:00", "10:00:00", @@ -1121,6 +1128,17 @@ func DeleteStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor return num, err } +func isStoreMapNeedSync(vendorID int, valid map[string]interface{}) bool { + if vendorID != model.VendorIDJX { + for k := range valid { + if storeMapKeyPropertyMap[k] == 1 { + return true + } + } + } + return false +} + func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID int, payload map[string]interface{}, userName string) (num int64, err error) { if vendorID != model.VendorIDJD { if autoPickup, ok := payload["autoPickup"]; ok && autoPickup == 0 { @@ -1196,7 +1214,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor panic(r) } }() - if valid["status"] != nil || valid["vendorStoreName"] != nil { // 对于store vendor map,只有Status改变才需要同步到厂商 + if isStoreMapNeedSync(vendorID, valid) { // 对于store vendor map,只有Status改变才需要同步到厂商 num, err = dao.UpdateEntityLogicallyAndUpdateSyncStatus(db, storeMap, valid, userName, map[string]interface{}{ model.FieldStoreID: storeID, model.FieldVendorID: vendorID, @@ -1229,7 +1247,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor } } dao.Commit(db) - if vendorID != model.VendorIDJX && (valid["status"] != nil || valid["freightDeductionPack"] != nil || valid["vendorStoreName"] != nil) { + if isStoreMapNeedSync(vendorID, valid) { _, err = CurVendorSync.SyncStore(ctx, db, vendorID, storeID, false, userName) } } diff --git a/business/model/dao/store.go b/business/model/dao/store.go index c1b82afea..3fca98344 100644 --- a/business/model/dao/store.go +++ b/business/model/dao/store.go @@ -26,6 +26,7 @@ type StoreDetail struct { FreightDeductionPackStr string `orm:"size(4096)" json:"-"` // FreightDeductionPackObj *model.FreightDeductionPack `orm:"-" json:"-"` + BoxFee int `orm:"default(1)" json:"boxFee"` // 打包费 AutoPickup int8 `orm:"default(1)" json:"autoPickup"` // 是否自动拣货 DeliveryType int8 `orm:"default(0)" json:"deliveryType"` // 配送类型 @@ -84,7 +85,7 @@ func getStoreDetail(db *DaoDB, storeID, vendorID int, vendorStoreID string) (sto sql := ` SELECT t1.*, t2.vendor_store_id, t2.status vendor_status, t2.delivery_fee, t2.sync_status, t2.vendor_org_code, - t2.price_percentage, t2.auto_pickup, t2.delivery_type, t2.delivery_competition, t2.is_sync, t2.vendor_store_name, + t2.price_percentage, t2.auto_pickup, t2.delivery_type, t2.delivery_competition, t2.is_sync, t2.vendor_store_name, t2.box_fee, t3.value price_percentage_pack_str, t4.value freight_deduction_pack_str, district.name district_name, diff --git a/business/model/store.go b/business/model/store.go index 83467b027..5afa67828 100644 --- a/business/model/store.go +++ b/business/model/store.go @@ -398,6 +398,8 @@ type StoreMap struct { FreightDeductionPack string `orm:"size(32)" json:"freightDeductionPack"` // + BoxFee int `orm:"default(0)" json:"boxFee"` // 打包费 + AutoPickup int8 `orm:"default(1)" json:"autoPickup"` // 是否自动拣货 DeliveryType int8 `orm:"default(0)" json:"deliveryType"` // 配送类型 DeliveryFee int `json:"deliveryFee"` diff --git a/business/partner/purchase/mtwm/store.go b/business/partner/purchase/mtwm/store.go index f0538aa3a..75d35c49b 100644 --- a/business/partner/purchase/mtwm/store.go +++ b/business/partner/purchase/mtwm/store.go @@ -156,6 +156,7 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin errList.AddErr(p.UpdateStoreStatus(jxcontext.AdminCtx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, mergedStoreStatus)) } errList.AddErr(p.UpdateStoreOpTime(jxcontext.AdminCtx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, storeDetail.GetOpTimeList())) + errList.AddErr(p.UpdateStoreBoxFee(jxcontext.AdminCtx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, storeDetail.BoxFee)) return errList.GetErrListAsOne() } @@ -290,3 +291,8 @@ func (c *PurchaseHandler) GetAllStoresVendorID(ctx *jxcontext.Context, vendorOrg func (c *PurchaseHandler) UpdateStoreCustomID(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID string, storeID int64) (err error) { return err } + +func (c *PurchaseHandler) UpdateStoreBoxFee(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, boxFee int) (err error) { + err = api.MtwmAPI.PackagePriceUpdate(vendorStoreID, 1, boxFee) + return err +} diff --git a/business/partner/purchase/mtwm/store_sku2.go b/business/partner/purchase/mtwm/store_sku2.go index eff8ab3e0..6266bbbcd 100644 --- a/business/partner/purchase/mtwm/store_sku2.go +++ b/business/partner/purchase/mtwm/store_sku2.go @@ -28,6 +28,7 @@ const ( specialStoreID = "8171010" // specialStoreID = "2523687" + fixBoxFee = 10 ) var ( @@ -252,8 +253,8 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI } foodData["min_order_count"] = 1 foodData["unit"] = storeSku.Unit - foodData["box_num"] = 0 - foodData["box_price"] = 0.0 + foodData["box_num"] = 1 + foodData["box_price"] = jxutils.IntPrice2Standard(fixBoxFee) catCode := tryCatName2Code(storeSku.VendorCatID) if catCode != "" { foodData["category_code"] = catCode