京东商城创建门店

This commit is contained in:
苏尹岚
2020-05-15 16:08:25 +08:00
parent 68a7c6f81b
commit ba9d7c2a9d
9 changed files with 61 additions and 20 deletions

View File

@@ -233,13 +233,14 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs
loopStoreTask := tasksch.NewParallelTask(fmt.Sprintf("处理平台%s", model.VendorChineseNames[loopMapInfo.VendorID]), tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
var resultList []interface{}
var vendorStoreID string
storeMap := batchItemList[0].(*model.StoreMap)
db2 := db
if len(loopMapInfo.StoreMapList) > 1 {
db2 = dao.GetDB()
}
if model.IsSyncStatusNew(storeMap.SyncStatus) {
if err = handler.CreateStore2(db2, storeMap.StoreID, userName); err == nil {
if vendorStoreID, err = handler.CreateStore2(db2, storeMap.StoreID, userName); err == nil {
resultList = append(resultList, 1)
} else {
failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, model.VendorChineseNames[storeMap.VendorID], "创建门店")
@@ -258,8 +259,14 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs
}
}
if err == nil {
storeMap.SyncStatus = 0
_, err = dao.UpdateEntity(db, storeMap, model.FieldSyncStatus)
if model.IsSyncStatusNew(storeMap.SyncStatus) {
storeMap.VendorStoreID = vendorStoreID
storeMap.SyncStatus = 0
_, err = dao.UpdateEntity(db, storeMap, "VendorStoreID", model.FieldSyncStatus)
} else {
storeMap.SyncStatus = 0
_, err = dao.UpdateEntity(db, storeMap, model.FieldSyncStatus)
}
}
return resultList, err
}, loopMapInfo.StoreMapList)