diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index c412de47a..d8712fcda 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -873,6 +873,9 @@ func RefreshMissingDadaStores(ctx *jxcontext.Context, storeID int, isAsync, isCo storeDetail := batchItemList[0].(*dao.StoreDetail2) var resultList []interface{} if storeDetail.DadaStoreID == "" { + if storeDetail.DistrictName == "" || storeDetail.CityName == "" { + return nil, fmt.Errorf("门店:%s的城市码或区码有错误", storeDetail.Name) + } db := dao.GetDB() if _, err = AddStoreCourierMap(ctx, db, storeDetail.ID, model.VendorIDDada, &model.StoreCourierMap{ VendorStoreID: utils.Int2Str(storeDetail.ID), @@ -896,6 +899,12 @@ func RefreshMissingDadaStores(ctx *jxcontext.Context, storeID int, isAsync, isCo } func updateOrCreateDadaStore(storeDetail *dao.StoreDetail2) (err error) { + if storeDetail.DistrictName == "" { + return fmt.Errorf("门店的区码有问题,请检查") + } + if storeDetail.CityName == "" { + return fmt.Errorf("门店的城市码有问题,请检查") + } if globals.EnableStoreWrite { _, err = api.DadaAPI.ShopDetail(storeDetail.DadaStoreID) if err != nil { diff --git a/business/model/dao/store.go b/business/model/dao/store.go index 3a6c07005..7614a371a 100644 --- a/business/model/dao/store.go +++ b/business/model/dao/store.go @@ -136,8 +136,8 @@ func GetMissingDadaStores(db *DaoDB, storeID int, isMustHaveJdStore bool) (store t3.vendor_store_id dada_store_id FROM store t1 LEFT JOIN store_map t2 ON t1.id = t2.store_id AND t2.vendor_id = ? AND t2.deleted_at = ? - JOIN place city ON city.code = t1.city_code - JOIN place district ON district.code = t1.district_code + LEFT JOIN place city ON city.code = t1.city_code + LEFT JOIN place district ON district.code = t1.district_code LEFT JOIN store_courier_map t3 ON t3.store_id = t1.id AND t3.vendor_id = ? AND t3.deleted_at = ? WHERE t1.deleted_at = ? `