This commit is contained in:
苏尹岚
2021-02-04 15:22:31 +08:00
parent 6856ef2f8f
commit 09e751b83a
4 changed files with 77 additions and 17 deletions

View File

@@ -2540,12 +2540,11 @@ func SyncStoresCourierInfo(ctx *jxcontext.Context, storeIDs []int, isAsync, isCo
return hint, err
}
func SyncStoresQualify(ctx *jxcontext.Context, storeIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
func SyncStoresQualify(ctx *jxcontext.Context, storeIDs []int, vendorID int, isAsync, isContinueWhenError bool) (hint string, err error) {
if len(storeIDs) > 0 {
db := dao.GetDB()
task := tasksch.NewParallelTask(fmt.Sprintf("上传门店资质:%v", storeIDs), tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError), ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
vendorID := model.VendorIDJD
if handler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IStoreSyncQualifyHandler); handler != nil {
storeID := batchItemList[0].(int)
storeDetail, err2 := dao.GetStoreDetail(db, storeID, vendorID, "")
@@ -3893,6 +3892,10 @@ func CreateVendorStore(ctx *jxcontext.Context, storeID, vendorID int, payload ma
db = dao.GetDB()
storeDetail *dao.StoreDetail
)
if vendorID != model.VendorIDEBAI {
return fmt.Errorf("当前只允许创建饿百门店!")
}
if storeDetail, err = dao.GetStoreDetail(db, storeID, vendorID, ""); err != nil {
return fmt.Errorf("获取门店信息失败,请联系技术部!")
}
@@ -3908,11 +3911,25 @@ func CreateVendorStore(ctx *jxcontext.Context, storeID, vendorID int, payload ma
}
}
}
// handler := partner.GetPurchasePlatformFromVendorID(vendorID)
// vendorStoreID, err := handler.CreateStore2(db, storeID, ctx.GetUserName(), payload)
// if err != nil {
// return err
// }
// AddStoreVendorMap(ctx, db, vendorID, vendorOrgCode, storeID, storeMap)
handler := partner.GetPurchasePlatformFromVendorID(vendorID)
vendorStoreID, err := handler.CreateStore2(db, storeID, ctx.GetUserName(), payload, storeDetail)
if err != nil {
return err
}
//AddStoreVendorMap 太复杂了并不满足,还是手动加吧
storeMap := &model.StoreMap{
VendorStoreID: vendorStoreID,
StoreID: storeID,
VendorID: vendorID,
VendorOrgCode: payload["vendorOrgCode"].(string),
Status: 0, //平台还未审核等
DeliveryType: model.StoreDeliveryTypeByStore,
PricePercentage: payload["pricePercentage"].(int16),
AutoPickup: 1,
IsSync: 1,
PricePercentagePack: payload["pricePercentagePack"].(string),
}
dao.WrapAddIDCULDEntity(storeMap, ctx.GetUserName())
err = dao.CreateEntity(db, storeMap)
return err
}