同步错误门店管理返回新增

This commit is contained in:
苏尹岚
2020-01-15 14:41:09 +08:00
parent d092792229
commit 1ded6199f4

View File

@@ -6,6 +6,8 @@ import (
"sync"
"time"
"git.rosy.net.cn/jx-callback/business/partner/putils"
"git.rosy.net.cn/baseapi"
"git.rosy.net.cn/baseapi/platformapi/dingdingapi"
"git.rosy.net.cn/baseapi/utils"
@@ -230,6 +232,7 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs
isManageIt := len(storeIDs) == 0 || len(storeIDs) > 5
_, hint, err = v.LoopStoresMap2(ctx, nil, db, fmt.Sprintf("同步门店信息:%v", storeIDs), isAsync, isManageIt, vendorIDs, storeIDs, mustDirty, func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (resultList interface{}, err error) {
loopMapInfo := batchItemList[0].(*LoopStoreMapInfo)
var failedList []*partner.StoreSkuInfoWithErr
handler := v.GetStoreHandler(loopMapInfo.VendorID)
if handler != nil {
if len(loopMapInfo.StoreMapList) > 1 {
@@ -245,6 +248,8 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs
storeMap.SyncStatus = 0
_, err = dao.UpdateEntity(db2, storeMap, model.FieldSyncStatus)
resultList = append(resultList, 1)
} else {
failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, storeMap.VendorID, "同步门店")
}
return resultList, err
}, loopMapInfo.StoreMapList)
@@ -255,6 +260,8 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs
if err = handler.UpdateStore(db, storeMap.StoreID, userName); err == nil {
storeMap.SyncStatus = 0
_, err = dao.UpdateEntity(db, storeMap, model.FieldSyncStatus)
} else {
failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, storeMap.VendorID, "同步门店")
}
if err == nil {
resultList = []interface{}{1}
@@ -262,6 +269,9 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs
}
err = partner.AddVendorInfo2Err(err, loopMapInfo.VendorID)
}
if len(failedList) > 0 {
t.AddFailedList(failedList)
}
return resultList, err
}, true)
return hint, makeSyncError(err)