diff --git a/business/jxcallback/scheduler/basesch/basesch_ext.go b/business/jxcallback/scheduler/basesch/basesch_ext.go index facb99a89..c6668a142 100644 --- a/business/jxcallback/scheduler/basesch/basesch_ext.go +++ b/business/jxcallback/scheduler/basesch/basesch_ext.go @@ -27,7 +27,7 @@ const ( func (c *BaseScheduler) CreateWaybillOnProviders(ctx *jxcontext.Context, order *model.GoodsOrder, courierVendorIDs, excludeCourierVendorIDs []int, maxDeliveryFee int64, createOnlyOne bool) (bills []*model.Waybill, err error) { userName := ctx.GetUserName() globals.SugarLogger.Infof("CreateWaybillOnProviders orderID:%s userName:%s, courierVendorIDs:%v, excludeCourierVendorIDs:%v", order.VendorOrderID, userName, courierVendorIDs, excludeCourierVendorIDs) - storeCourierList, err := dao.GetStoreCourierList(dao.GetDB(), []int{jxutils.GetSaleStoreIDFromOrder(order)}, model.StoreStatusOpened, model.StoreAuditStatusOnline) + storeCourierList, err := dao.GetStoreCourierList(dao.GetDB(), []int{jxutils.GetSaleStoreIDFromOrder(order)}, nil, model.StoreStatusOpened, model.StoreAuditStatusOnline) if err != nil { return nil, err } diff --git a/business/jxcallback/scheduler/defsch/defsch_ext.go b/business/jxcallback/scheduler/defsch/defsch_ext.go index 9ad7f3e83..3159be54c 100644 --- a/business/jxcallback/scheduler/defsch/defsch_ext.go +++ b/business/jxcallback/scheduler/defsch/defsch_ext.go @@ -232,7 +232,7 @@ func (s *DefScheduler) QueryOrderWaybillFeeInfoEx(ctx *jxcontext.Context, vendor if order.DeliveryType == model.OrderDeliveryTypeSelfTake { return nil, fmt.Errorf("订单:%s是自提单", vendorOrderID) } - storeCourierList, err := dao.GetStoreCourierList(db, []int{jxutils.GetSaleStoreIDFromOrder(order)}, model.StoreStatusAll, model.StoreAuditStatusOnline) + storeCourierList, err := dao.GetStoreCourierList(db, []int{jxutils.GetSaleStoreIDFromOrder(order)}, nil, model.StoreStatusAll, model.StoreAuditStatusOnline) if err != nil { return nil, err } diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 17d1e171a..6d40dcffa 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -412,7 +412,7 @@ func setStoreMapInfo(ctx *jxcontext.Context, db *dao.DaoDB, storesInfo *StoresIn if err != nil { return err } - storeCourierList, err := dao.GetStoreCourierList(db, storeIDs, model.StoreStatusAll, model.StoreAuditStatusAll) + storeCourierList, err := dao.GetStoreCourierList(db, storeIDs, nil, model.StoreStatusAll, model.StoreAuditStatusAll) if err != nil { return err } diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 019a079a0..4a89efbd7 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -1379,7 +1379,7 @@ func SetMTPSStatus(ctx *jxcontext.Context, storeId, courierStatus int) { db := dao.GetDB() /*比较营业状态*/ /*把获取的京西状态和名称存一下*/ - StoreCourierList, _ := dao.GetStoreCourierList(db, []int{}, model.StoreStatusAll, model.StoreStatusAll) + StoreCourierList, _ := dao.GetStoreCourierList(db, []int{}, nil, model.StoreStatusAll, model.StoreStatusAll) /*循环美团*/ for _, StoreInfoList1 := range StoreInfoList { for _, StoreInfoList11 := range StoreInfoList1.DataList { diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 9de9f2c17..5326f3594 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -8,13 +8,12 @@ import ( "strings" "time" - "git.rosy.net.cn/jx-callback/business/jxstore/act" - "git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin" "git.rosy.net.cn/jx-callback/business/partner/delivery" "github.com/360EntSecGroup-Skylar/excelize" "github.com/qiniu/api.v7/storage" + "git.rosy.net.cn/baseapi/platformapi/dadaapi" "git.rosy.net.cn/baseapi/platformapi/jdapi" "git.rosy.net.cn/baseapi/platformapi/mtwmapi" "git.rosy.net.cn/baseapi/utils" @@ -1585,76 +1584,19 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // fmt.Println("addList2", addList) // fmt.Println("updateList2", utils.Format4Output(updateList, false)) // fmt.Println("deleteList2", deleteList) - db := dao.GetDB() - storeIDs := []int{ - 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, 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, []int{0}, nil, nil, "", 0, 99999) - for _, actStoreSku := range actStoreSkus { - if actStoreSku.StoreID == storeID { - aa := &act.ActStoreSkuParam{ - ActStoreSku: model.ActStoreSku{ - StoreID: storeID, - SkuID: actStoreSku.SkuID, - ActID: v.ID, - }, - } - actStoreSkuParam = append(actStoreSkuParam, aa) - } - } - _, err = act.DeleteActStoreSkuBind(ctx, db, v.ID, actStoreSkuParam) - if err == nil { - _, err = act.SyncAct(ctx, nil, v.ID, nil, true) + var ( + db = dao.GetDB() + ) + list, err := dao.GetStoreCourierList(db, nil, []int{model.VendorIDDada}, model.StoreStatusAll, model.StoreAuditStatusAll) + for _, v := range list { + stores, _ := dao.GetStoreList(db, []int{v.StoreID}, nil, nil, nil, "") + sd, _ := api.DadaAPI.ShopDetail(v.VendorStoreID) + if !strings.Contains(sd.StationName, globals.StoreName) { + shopInfo := &dadaapi.ShopInfo{ + OriginShopID: v.VendorStoreID, + StationName: globals.StoreName + "-" + stores[0].Name, } + api.DadaAPI.ShopUpdate(shopInfo) } } return err diff --git a/business/model/dao/store.go b/business/model/dao/store.go index 25cca2baf..b14feb9dd 100644 --- a/business/model/dao/store.go +++ b/business/model/dao/store.go @@ -205,7 +205,7 @@ func GetStoreDetail2(db *DaoDB, storeID int, vendorStoreID string, vendorID int) return storeDetail, err } -func GetStoreCourierList(db *DaoDB, storeIDs []int, status, auditStatus int) (courierStoreList []*model.StoreCourierMap, err error) { +func GetStoreCourierList(db *DaoDB, storeIDs, vendorIDs []int, status, auditStatus int) (courierStoreList []*model.StoreCourierMap, err error) { sql := ` SELECT t1.* FROM store_courier_map t1 @@ -218,6 +218,10 @@ func GetStoreCourierList(db *DaoDB, storeIDs []int, status, auditStatus int) (co sql += " AND t1.store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")" sqlParams = append(sqlParams, storeIDs) } + if len(vendorIDs) > 0 { + sql += " AND t1.vendor_id IN (" + GenQuestionMarks(len(vendorIDs)) + ")" + sqlParams = append(sqlParams, vendorIDs) + } if status != model.StoreStatusAll { sql += " AND t1.status = ?" sqlParams = append(sqlParams, status) diff --git a/business/model/dao/store_test.go b/business/model/dao/store_test.go index b77ffffba..049f82bd8 100644 --- a/business/model/dao/store_test.go +++ b/business/model/dao/store_test.go @@ -17,7 +17,7 @@ func TestGetStoreDetail(t *testing.T) { } func TestGetStoreCourierList(t *testing.T) { - storeCourierList, err := GetStoreCourierList(GetDB(), []int{100119}, model.StoreStatusOpened, model.StoreAuditStatusOnline) + storeCourierList, err := GetStoreCourierList(GetDB(), []int{100119}, nil, model.StoreStatusOpened, model.StoreAuditStatusOnline) if err != nil { t.Fatal(err) } diff --git a/business/partner/delivery/dada/waybill.go b/business/partner/delivery/dada/waybill.go index c376f591d..f74e1dd9a 100644 --- a/business/partner/delivery/dada/waybill.go +++ b/business/partner/delivery/dada/waybill.go @@ -126,7 +126,7 @@ func StoreDetail2ShopInfo(storeDetail *dao.StoreDetail2) (shopInfo *dadaapi.Shop } shopInfo = &dadaapi.ShopInfo{ OriginShopID: storeDetail.VendorStoreID, - StationName: storeDetail.Name, + StationName: globals.StoreName + "-" + storeDetail.Name, Business: dadaapi.BusinessTypeConvStore, // 故意设置成这个的 CityName: cityName, AreaName: districtName,