aa
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -341,6 +341,9 @@ type Store struct {
|
||||
PayPercentage int `json:"payPercentage"`
|
||||
OldPayPercentage int `json:"oldPayPercentage"`
|
||||
|
||||
StoreFrontPic string `orm:"size(255)" json:"storeFrontPic"` //门面照
|
||||
StoreInPic string `orm:"size(255)" json:"storeInPic"` //门店内照片
|
||||
|
||||
// OperatorName string `orm:"size(8)" json:"operatorName"` // 运营人姓名
|
||||
OperatorPhone string `orm:"size(16)" json:"operatorPhone"` // 京东运营人电话
|
||||
OperatorRole string `orm:"size(32)" json:"operatorRole"` // 京东运营人组(角色)
|
||||
|
||||
@@ -19,19 +19,26 @@ import (
|
||||
)
|
||||
|
||||
type tEbaiSupplierInfo struct {
|
||||
SupplierID string `json:"supplierID"`
|
||||
Logo string `json:"logo"`
|
||||
SupplierID string `json:"supplierID"`
|
||||
Logo string `json:"logo"`
|
||||
CategoryID1 int
|
||||
CategoryID2 int
|
||||
BusinessFormID int //门店业态
|
||||
}
|
||||
|
||||
var (
|
||||
ebaiSupplierInfo = map[string]*tEbaiSupplierInfo{
|
||||
EbaiSupplierIDsc: &tEbaiSupplierInfo{
|
||||
SupplierID: EbaiSupplierIDsc,
|
||||
Logo: "http://image.jxc4.com/image/4573e7789c647d4961f8955e3733dbd6.tem.jpg",
|
||||
SupplierID: EbaiSupplierIDsc,
|
||||
Logo: "http://image.jxc4.com/image/4573e7789c647d4961f8955e3733dbd6.tem.jpg",
|
||||
CategoryID1: 166,
|
||||
CategoryID2: 222,
|
||||
BusinessFormID: 1672214913,
|
||||
},
|
||||
EbaiSupplierIDc4: &tEbaiSupplierInfo{
|
||||
SupplierID: EbaiSupplierIDc4,
|
||||
Logo: "",
|
||||
SupplierID: EbaiSupplierIDc4,
|
||||
Logo: "",
|
||||
BusinessFormID: 2233065879,
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -578,7 +585,7 @@ func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri
|
||||
} else {
|
||||
param["name"] = brand.Name + "(" + storeDetail.Name + ")"
|
||||
}
|
||||
param["supplier_id"] = params["supplier_id"]
|
||||
param["supplier_id"] = params["supplierID"]
|
||||
//省市区
|
||||
placeCity, err := dao.GetPlaceByCode(db, storeDetail.CityCode)
|
||||
param["city"] = placeCity.EbaiCode
|
||||
@@ -593,17 +600,49 @@ func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri
|
||||
} else {
|
||||
phone = model.VendorStoreTel
|
||||
}
|
||||
ebaiInfo := ebaiSupplierInfo[param["supplier_id"].(string)]
|
||||
param["phone"] = phone
|
||||
param["ivr_phone"] = phone
|
||||
param["service_phone"] = storeDetail.Tel1
|
||||
param["address"] = params["address"]
|
||||
param["longitude"] = jxutils.IntCoordinate2Standard(storeDetail.Lng)
|
||||
param["latitude"] = jxutils.IntCoordinate2Standard(storeDetail.Lat)
|
||||
param["coord_type"] = "amap" //高德坐标系
|
||||
param["shop_logo"] = ebaiInfo.Logo
|
||||
param["categorys"] = []map[string]int{
|
||||
map[string]int{
|
||||
"category1": ebaiInfo.CategoryID1,
|
||||
"category2": ebaiInfo.CategoryID2,
|
||||
},
|
||||
}
|
||||
time1map := map[string]string{
|
||||
"start": jxutils.JxOperationTime2StrTime(storeDetail.OpenTime1),
|
||||
"end": jxutils.JxOperationTime2StrTime(storeDetail.CloseTime1),
|
||||
}
|
||||
var time2map = make(map[string]string)
|
||||
if storeDetail.OpenTime2 != 0 && storeDetail.CloseTime2 != 0 {
|
||||
time2map["start"] = jxutils.JxOperationTime2StrTime(storeDetail.OpenTime2)
|
||||
time2map["end"] = jxutils.JxOperationTime2StrTime(storeDetail.CloseTime2)
|
||||
}
|
||||
var timeLis []map[string]string
|
||||
timeLis = append(timeLis, time1map)
|
||||
if time2map != nil {
|
||||
timeLis = append(timeLis, time2map)
|
||||
}
|
||||
param["business_time"] = timeLis
|
||||
param["business_form_id"] = ebaiInfo.BusinessFormID
|
||||
if baiduShopID, err := api.EbaiAPI.ShopCreate(param); err == nil {
|
||||
//上传资质
|
||||
|
||||
api.EbaiAPI.ShopCreate(params)
|
||||
return utils.Int64ToStr(baiduShopID), err
|
||||
}
|
||||
return vendorStoreID, err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) DeleteStore(db *dao.DaoDB, storeID int, userName string) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) SyncQualify(ctx *jxcontext.Context, storeDetail *dao.StoreDetail) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -419,6 +419,7 @@ func (c *StoreController) BindPrinter() {
|
||||
// @Description 同步门店资质信息至平台(当前只支持京东)
|
||||
// @Param token header string true "认证token"
|
||||
// @Param storeIDs formData string true "京西门店ID列表,必须非空值"
|
||||
// @Param vendorID formData int true "平台ID"
|
||||
// @Param isAsync formData bool true "是否异步操作"
|
||||
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
@@ -429,7 +430,7 @@ func (c *StoreController) SyncStoresQualify() {
|
||||
var storeIDs []int
|
||||
err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs)
|
||||
if err == nil {
|
||||
retVal, err = cms.SyncStoresQualify(params.Ctx, storeIDs, params.IsAsync, params.IsContinueWhenError)
|
||||
retVal, err = cms.SyncStoresQualify(params.Ctx, storeIDs, params.VendorID, params.IsAsync, params.IsContinueWhenError)
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user