This commit is contained in:
suyl
2021-09-01 11:21:09 +08:00
parent 947833a28f
commit 5acc9f31f6
3 changed files with 61 additions and 29 deletions

View File

@@ -461,12 +461,12 @@ func setStoreMapInfo(ctx *jxcontext.Context, db *dao.DaoDB, storesInfo *StoresIn
if err != nil { if err != nil {
return err return err
} }
isStoreVendorStatus := false //isStoreVendorStatus := false
if isBussinessStatus != nil { //if isBussinessStatus != nil {
if isBussinessStatus.(bool) { // if isBussinessStatus.(bool) {
isStoreVendorStatus = true // isStoreVendorStatus = true
} // }
} //}
storeMapMap := dao.StoreMapList2Map(storeMapList) storeMapMap := dao.StoreMapList2Map(storeMapList)
storeCourierMap := dao.StoreCourierList2Map(storeCourierList) storeCourierMap := dao.StoreCourierList2Map(storeCourierList)
@@ -486,26 +486,26 @@ func setStoreMapInfo(ctx *jxcontext.Context, db *dao.DaoDB, storesInfo *StoresIn
v.CourierMaps = append(v.CourierMaps, v2) v.CourierMaps = append(v.CourierMaps, v2)
} }
} }
task := tasksch.NewParallelTask("上下线状态", tasksch.NewParallelConfig().SetParallelCount(4), ctx, //task := tasksch.NewParallelTask("上下线状态", tasksch.NewParallelConfig().SetParallelCount(4), ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { // func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
store := batchItemList[0].(*StoreExt) // store := batchItemList[0].(*StoreExt)
for _, v2 := range store.StoreMaps { // for _, v2 := range store.StoreMaps {
if isStoreVendorStatus { // if isStoreVendorStatus {
if handler := CurVendorSync.GetStoreHandler(v2.VendorID); handler != nil { // if handler := CurVendorSync.GetStoreHandler(v2.VendorID); handler != nil {
if store, err := handler.ReadStore(ctx, v2.VendorOrgCode, v2.VendorStoreID); err == nil && store != nil { // if store, err := handler.ReadStore(ctx, v2.VendorOrgCode, v2.VendorStoreID); err == nil && store != nil {
if store.Status != model.StoreStatusDisabled { // if store.Status != model.StoreStatusDisabled {
v2.BussinessStatus = 1 // v2.BussinessStatus = 1
} else { // } else {
v2.BussinessStatus = -1 // v2.BussinessStatus = -1
} // }
} // }
} // }
} // }
} // }
return retVal, err // return retVal, err
}, storesInfo.Stores) // }, storesInfo.Stores)
task.Run() //task.Run()
task.GetResult(0) //task.GetResult(0)
return nil return nil
} }
@@ -4287,7 +4287,7 @@ func RefreshStoreBind(ctx *jxcontext.Context) (err error) {
if store.OperatorPhone3 != "" { if store.OperatorPhone3 != "" {
mobileList = append(mobileList, store.OperatorPhone3) mobileList = append(mobileList, store.OperatorPhone3)
} }
mobileList = append(mobileList, "18160030913", "15520595380", "18980410281", "18048531223", "18080188338", "13012345678") mobileList = append(mobileList, "18160030913", "15520595380", "18048531223", "18080188338", "13012345678")
for _, v := range mobileList { for _, v := range mobileList {
if user, err := dao.GetUserByID(db, "mobile", v); err == nil && user != nil { if user, err := dao.GetUserByID(db, "mobile", v); err == nil && user != nil {
userIDmap1[user.UserID] = user.UserID userIDmap1[user.UserID] = user.UserID
@@ -4323,7 +4323,13 @@ func UpdateVendorStoreBussinessStatus(ctx *jxcontext.Context, storeID, vendorID,
return err return err
} }
handler := partner.GetPurchasePlatformFromVendorID(vendorID) handler := partner.GetPurchasePlatformFromVendorID(vendorID)
err = handler.UpdateStoreLineStatus(ctx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, status) if err = handler.UpdateStoreLineStatus(ctx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, status); err == nil {
if storeMaps, _ := dao.GetStoresMapList(db, []int{vendorID}, []int{storeID}, nil, model.StoreStatusAll,
model.StoreIsSyncAll, "", "", ""); len(storeMaps) > 0 {
storeMaps[0].IsOnline = status
dao.UpdateEntity(db, storeMaps[0], "IsOnline")
}
}
return err return err
} }
@@ -5146,3 +5152,27 @@ func UpdateBrandUser(ctx *jxcontext.Context, brandID int, userID string, isDel b
} }
return err return err
} }
func RefreshStoreIsOnline(ctx *jxcontext.Context) (err error) {
var (
db = dao.GetDB()
)
stores, _ := dao.GetStoresMapList(db, []int{model.VendorIDMTWM, model.VendorIDJD, model.VendorIDEBAI}, nil, nil, model.StoreStatusAll, model.StoreStatusAll, "", "", "")
task := tasksch.NewParallelTask("RefreshStoreBind", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
storeMap := batchItemList[0].(*model.StoreMap)
if handler := CurVendorSync.GetStoreHandler(storeMap.VendorID); handler != nil {
if store, err := handler.ReadStore(ctx, storeMap.VendorOrgCode, storeMap.VendorStoreID); err == nil && store != nil {
if store.Status != model.StoreStatusDisabled {
storeMap.IsOnline = 1
} else {
storeMap.IsOnline = -1
}
}
}
return retVal, err
}, stores)
tasksch.HandleTask(task, nil, true).Run()
task.GetID()
return err
}

View File

@@ -324,6 +324,8 @@ func Init() {
RefreshAfsOrderStatusAccess(jxcontext.AdminCtx) RefreshAfsOrderStatusAccess(jxcontext.AdminCtx)
//刷新门店分组管理 //刷新门店分组管理
cms.RefreshStoreBind(jxcontext.AdminCtx) cms.RefreshStoreBind(jxcontext.AdminCtx)
//更新所有门店的上下线状态
cms.RefreshStoreIsOnline(jxcontext.AdminCtx)
}, dailyWorkTimeList) }, dailyWorkTimeList)
ScheduleTimerFunc("RrefreshMtwmVendorAct", func() { ScheduleTimerFunc("RrefreshMtwmVendorAct", func() {
//刷新美团平台活动 //刷新美团平台活动

View File

@@ -427,7 +427,7 @@ type StoreMap struct {
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"` VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"`
Status int `json:"status"` // 取值同Store.Status Status int `json:"status"` // 取值同Store.Status
IsOnline int `json:"isOnline"` //上下线状态, 0是下线1是上线 IsOnline int `json:"isOnline"` //上下线状态, -1是下线1是上线
StoreName string `orm:"size(255)" json:"storeName"` // 平台门店的名字,由平台到京西 StoreName string `orm:"size(255)" json:"storeName"` // 平台门店的名字,由平台到京西
VendorStoreName string `orm:"size(255)" json:"vendorStoreName"` //平台门店名,由京西到平台 VendorStoreName string `orm:"size(255)" json:"vendorStoreName"` //平台门店名,由京西到平台
VendorPayPercentage int `json:"vendorPayPercentage"` //平台结算比例 VendorPayPercentage int `json:"vendorPayPercentage"` //平台结算比例