storedetail

This commit is contained in:
苏尹岚
2020-11-18 10:22:12 +08:00
parent 5a6dae8d53
commit d14bb10be7
29 changed files with 81 additions and 76 deletions

View File

@@ -219,7 +219,7 @@ func ActStoreSkuParam2Model(ctx *jxcontext.Context, db *dao.DaoDB, act *model.Ac
validVendorMap := make(map[int]int)
validSkuMap := make(map[int]int)
for _, vendorID := range vendorIDs {
storeDetail, err2 := dao.GetStoreDetail(db, storeID, vendorID)
storeDetail, err2 := dao.GetStoreDetail(db, storeID, vendorID, "")
if err = err2; err == nil {
if storeDetail.IsSync != 0 {
if act.Type == model.ActSkuFake ||
@@ -1231,7 +1231,7 @@ func ForceUpdateVendorPrice(ctx *jxcontext.Context, vendorID int, actType int, s
for _, storeSkuBind := range storeSkuBindList {
if _, err2 := dao.UpdateEntity(db, storeSkuBind); err2 == nil {
if storeVendorIDMap[storeSkuBind.StoreID] == "" {
if storeDetail, err2 := dao.GetStoreDetail(db, storeSkuBind.StoreID, vendorID); err2 == nil {
if storeDetail, err2 := dao.GetStoreDetail(db, storeSkuBind.StoreID, vendorID, ""); err2 == nil {
storeVendorIDMap[storeSkuBind.StoreID] = storeDetail.VendorStoreID
}
}
@@ -1682,5 +1682,3 @@ func checkPriceDefendOrderByPrice(db *dao.DaoDB, storeID, skuID, stock, jxPrice
}
return stock
}

View File

@@ -1373,7 +1373,7 @@ func refreshStoreSkuPrice(ctx *jxcontext.Context, db *dao.DaoDB, skuID int) (err
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
v := batchItemList[0].(*dao.StoreSkuAndName)
storeID := v.StoreID
storeDetail, _ := dao.GetStoreDetail(db, storeID, model.VendorIDJX)
storeDetail, _ := dao.GetStoreDetail(db, storeID, model.VendorIDJX, "")
if storeDetail == nil {
return retVal, err
}

View File

@@ -1168,7 +1168,7 @@ func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, vendorID int, vend
} else {
err = ErrCanNotFindVendor
}
storeDetail, _ := dao.GetStoreDetailByVendorStoreID(db, storeMap.VendorStoreID, storeMap.VendorID)
storeDetail, _ := dao.GetStoreDetailByVendorStoreID(db, storeMap.VendorStoreID, storeMap.VendorID, "")
if storeDetail != nil {
return nil, fmt.Errorf("此平台门店ID已在京西有绑定请先解除绑定平台门店ID :[%v]", storeMap.VendorStoreID)
}
@@ -2214,7 +2214,7 @@ func SendAlarmVendorSnapshot(ctx *jxcontext.Context, parentTask tasksch.ITask, p
userMap := make(map[string]map[int]int)
userMapTxt := make(map[string][]*model.VendorStoreSnapshot)
for storeID, list := range alarmSnapshotMap {
storeDetail, _ := dao.GetStoreDetail(db, storeID, list[0].VendorID)
storeDetail, _ := dao.GetStoreDetail(db, storeID, list[0].VendorID, "")
if storeDetail != nil {
storeDetailMap[storeID] = storeDetail
userList := getAllUsers4Store(ctx, db, &storeDetail.Store)
@@ -2496,7 +2496,7 @@ func SyncStoresQualify(ctx *jxcontext.Context, storeIDs []int, isAsync, isContin
vendorID := model.VendorIDJD
if handler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IStoreSyncQualifyHandler); handler != nil {
storeID := batchItemList[0].(int)
storeDetail, err2 := dao.GetStoreDetail(db, storeID, vendorID)
storeDetail, err2 := dao.GetStoreDetail(db, storeID, vendorID, "")
if err = err2; err == nil {
if err = handler.SyncQualify(ctx, storeDetail); err == nil {
retVal = []int{1}
@@ -2536,7 +2536,7 @@ func JdStoreInfoCoordinateRecover(ctx *jxcontext.Context, vendorOrgCode string,
if v.Status != model.StoreStatusDisabled && v.CreatedAt.Sub(utils.Str2Time("2019-10-01")) > 0 {
storeInfo, err := jd.GetAPI(vendorOrgCode).GetStoreInfoByStationNo2(v.VendorStoreID)
if err == nil && storeInfo.CreateTime.GoTime().Sub(utils.Str2Time("2019-10-25")) > 0 {
if storeDetail, err := dao.GetStoreDetail(db, v.StoreID, v.VendorID); err == nil {
if storeDetail, err := dao.GetStoreDetail(db, v.StoreID, v.VendorID, ""); err == nil {
validStoreList = append(validStoreList, storeDetail)
}
}
@@ -2638,7 +2638,7 @@ func GetVendorStoreInfo(ctx *jxcontext.Context, vendorIDList []int, isAsync, isC
}
}
db := dao.GetDB()
storeDetail2, err := dao.GetStoreDetailByVendorStoreID(db, storeDetail.VendorStoreID, vendorID)
storeDetail2, err := dao.GetStoreDetailByVendorStoreID(db, storeDetail.VendorStoreID, vendorID, "")
if err != nil {
return "", err
}
@@ -3406,7 +3406,7 @@ func UpdateStorePricePack(ctx *jxcontext.Context, storeID, vendorID int, pricePa
return err
}
db := dao.GetDB()
storeDetail, _ := dao.GetStoreDetail(db, storeID, vendorID)
storeDetail, _ := dao.GetStoreDetail(db, storeID, vendorID, "")
if storeDetail.PayPercentage > 50 {
return fmt.Errorf("目前只允许扣点的门店修改调价包!")
}
@@ -3519,7 +3519,7 @@ func GetJdDeliveryArea(ctx *jxcontext.Context, storeIDs []int) (err error) {
}
}
for _, v := range ss {
storeDetail, _ := dao.GetStoreDetailByVendorStoreID(dao.GetDB(), v.JdID, model.VendorIDJD)
storeDetail, _ := dao.GetStoreDetailByVendorStoreID(dao.GetDB(), v.JdID, model.VendorIDJD, "")
place, _ := dao.GetPlaceByCode(dao.GetDB(), storeDetail.CityCode)
specialtyStoreSku := &SpecialtyStoreSkus{
StoreID: storeDetail.ID,

View File

@@ -1077,7 +1077,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
}()
for _, storeID := range storeIDs {
// todo 可以考虑在需要更新价格再获取
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), storeID, model.VendorIDJX)
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), storeID, model.VendorIDJX, "")
if err != nil || storeDetail == nil {
continue
}
@@ -2290,7 +2290,7 @@ func RefreshStoresSkuByVendor(ctx *jxcontext.Context, storeIDs []int, vendorID i
if v.VendorID != vendorID {
return "", fmt.Errorf("门店%d绑定的不是京东", v.StoreID)
}
storeMap[v.StoreID], err = dao.GetStoreDetail(db, v.StoreID, v.VendorID)
storeMap[v.StoreID], err = dao.GetStoreDetail(db, v.StoreID, v.VendorID, "")
if err != nil {
return "", err
}
@@ -2522,7 +2522,7 @@ func ReCalculateJxPrice(db *dao.DaoDB, ctx *jxcontext.Context, storeIDs []int) (
task := tasksch.NewParallelTask("刷新京西平台价格", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
storeID := batchItemList[0].(int)
if storeDetail, err := dao.GetStoreDetail(db, storeID, model.VendorIDJX); err == nil {
if storeDetail, err := dao.GetStoreDetail(db, storeID, model.VendorIDJX, ""); err == nil {
if storeSkuList, err := dao.GetStoresSkusInfo(db, []int{storeID}, nil); err == nil {
for _, skuBind := range storeSkuList {
skuBind.JxPrice = jxutils.CaculatePriceByPricePack(storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage), skuBind.Price)
@@ -2543,7 +2543,7 @@ func ReCalculateJxPrice(db *dao.DaoDB, ctx *jxcontext.Context, storeIDs []int) (
func ReCalculateJxPriceLight(db *dao.DaoDB, ctx *jxcontext.Context, storeID int) (err error) {
if storeID != 0 {
if storeDetail, err := dao.GetStoreDetail(db, storeID, model.VendorIDJX); err == nil {
if storeDetail, err := dao.GetStoreDetail(db, storeID, model.VendorIDJX, ""); err == nil {
if storeSkuList, err := dao.GetStoresSkusInfo(db, []int{storeID}, nil); err == nil {
for _, skuBind := range storeSkuList {
skuBind.JxPrice = jxutils.CaculatePriceByPricePack(storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage), skuBind.Price)
@@ -2635,7 +2635,7 @@ func GetTopSkusByCityCode(ctx *jxcontext.Context, cityCode, storeID int) (skuNam
for _, v := range skuNameList {
skuNameMap[v.ID] = v
}
store, err := dao.GetStoreDetail(db, storeID, -1)
store, err := dao.GetStoreDetail(db, storeID, -1, "")
if err != nil {
return nil, err
}
@@ -2752,7 +2752,7 @@ func RefershStoreSkusMidPrice(ctx *jxcontext.Context, storeIDs []int, isCountry
}
for _, v := range storeIDs {
var skuBindInfos []*StoreSkuBindInfo
store, err := dao.GetStoreDetail(db, v, -1)
store, err := dao.GetStoreDetail(db, v, -1, "")
if err != nil {
return err
}
@@ -3124,7 +3124,7 @@ func GetVendorStoreSkuPrice(ctx *jxcontext.Context, vendorIDs []int, skuID int,
inStoreSku.SkuID = skuID
}
inStoreSkuList = append(inStoreSkuList, inStoreSku)
storeDetail2, err := dao.GetStoreDetailByVendorStoreID(db, vendorStoreID, vendorID)
storeDetail2, err := dao.GetStoreDetailByVendorStoreID(db, vendorStoreID, vendorID, "")
if storeDetail2 != nil {
outStoreSkuList, err = handler.GetStoreSkusBareInfo(ctx, v, task, storeDetail2.ID, vendorStoreID, inStoreSkuList)
} else {
@@ -3375,7 +3375,7 @@ func FocusStoreSkusBySku(ctx *jxcontext.Context, skuBindInfos []*StoreSkuBindInf
skuBindInfo := batchItemList[0].(*StoreSkuBindInfo)
storeID := skuBindInfo.StoreID
skuID := skuBindInfo.Skus[0].SkuID
store, err := dao.GetStoreDetail(db, storeID, -1)
store, err := dao.GetStoreDetail(db, storeID, -1, "")
if len(skuBindInfos) > 1 {
if store.StoreLevel == "D" || store.StoreLevel == "E" {
return retVal, err
@@ -3665,7 +3665,7 @@ func UpdateStoreSkusSpecTagBin(ctx *jxcontext.Context, reader io.Reader, vendorI
results[len(results)-i-1] = tmp
}
for _, v := range results {
store, err := dao.GetStoreDetail(db, v.StoreID, model.VendorIDMTWM)
store, err := dao.GetStoreDetail(db, v.StoreID, model.VendorIDMTWM, "")
if err != nil || store == nil {
continue
}
@@ -3775,7 +3775,7 @@ func SendSeckillSkusCountMsg(ctx *jxcontext.Context, vendorIDs []int, isAsync, i
}
}
if type1 < type1Count || type2 < type2Count {
storeDetail, _ := dao.GetStoreDetail(db, store.StoreID, store.VendorID)
storeDetail, _ := dao.GetStoreDetail(db, store.StoreID, store.VendorID, "")
var (
type1Str = "爆品数量低于8个"
type2Str = "爆品价格小于1元的爆品数量低于5个"
@@ -3895,7 +3895,7 @@ func RefreshJxPriceByVendor(ctx *jxcontext.Context, jdStoreSkus []*JdStoreSkus,
} else {
return result, fmt.Errorf("没有找到该京东skuID对应的京西skuID,京东skuID :[%v]", v.JdSkuID)
}
store, err := dao.GetStoreDetailByVendorStoreID(db, utils.Int2Str(v.JdStoreID), vendorID)
store, err := dao.GetStoreDetailByVendorStoreID(db, utils.Int2Str(v.JdStoreID), vendorID, "")
if err != nil || store == nil {
return result, fmt.Errorf("没有找到该京东门店对应的京西门店!,京东门店ID :[%v]", v.JdStoreID)
}
@@ -3967,7 +3967,7 @@ func RefreshJxPriceByVendor(ctx *jxcontext.Context, jdStoreSkus []*JdStoreSkus,
if len(skus) == 0 {
continue
}
store, _ := dao.GetStoreDetail(db, v.JdStoreID, vendorID)
store, _ := dao.GetStoreDetail(db, v.JdStoreID, vendorID, "")
err = jxutils.Strings2Objs(store.PricePercentagePackStr, &pricePercentagePack)
if skus[0].Unit == model.SpecialUnit {
if skus[0].SpecUnit == model.SpecUnitNames[1] || skus[0].SpecUnit == model.SpecUnitNames[2] {
@@ -4055,7 +4055,7 @@ func RefreshJxPriceByVendor2(ctx *jxcontext.Context, storeIDs []int, vendorID in
pricePercentagePack []*model.PricePercentageItem
skuNameMap = make(map[int]int64)
)
storeDetail, _ := dao.GetStoreDetail(db, storeID, vendorID)
storeDetail, _ := dao.GetStoreDetail(db, storeID, vendorID, "")
err = jxutils.Strings2Objs(storeDetail.PricePercentagePackStr, &pricePercentagePack)
if partner.IsMultiStore(vendorID) {
mulitStoreSkuHandler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IPurchasePlatformStoreSkuHandler)
@@ -4312,7 +4312,7 @@ func buildStoreSkuBindInfosAndFocus(ctx *jxcontext.Context, db *dao.DaoDB, store
skus, _ := dao.GetSkus(db, nil, []int{nameID}, nil, nil, nil)
err = jxutils.Strings2Objs(store.PricePercentagePackStr, &pricePercentagePack)
price := jxutils.CaculateJxPriceByPricePack(pricePercentagePack, 0, int(v.SkuList[0].VendorPrice))
store2, _ := dao.GetStoreDetail(db, store.ID, model.VendorIDJX)
store2, _ := dao.GetStoreDetail(db, store.ID, model.VendorIDJX, "")
if store2 != nil {
err = jxutils.Strings2Objs(store2.PricePercentagePackStr, &pricePercentagePack2)
jxPrice = jxutils.CaculatePriceByPricePack(pricePercentagePack2, 0, price)
@@ -4950,7 +4950,7 @@ func GetSpecialtyStoreSkus(ctx *jxcontext.Context, storeIDs, vendorIDs []int) (e
)
for _, v := range vendorIDs {
for _, vv := range storeIDs {
storeDetail, err := dao.GetStoreDetail(db, vv, v)
storeDetail, err := dao.GetStoreDetail(db, vv, v, "")
if err != nil || storeDetail == nil {
continue
}

View File

@@ -1337,7 +1337,7 @@ func WriteToExcel(task *tasksch.SeqTask, data map[int][]DiffData, depotData map[
func SetJxPrice(jxSkuInfoDataMulti *dao.StoreSkuNamesInfo, storeId int, vendorid int) (err error) {
db := dao.GetDB()
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), storeId, vendorid)
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), storeId, vendorid, "")
if err != nil {
dao.Rollback(db)
return err

View File

@@ -25,7 +25,7 @@ func (s *StoreManager) OnStoreStatusChanged(vendorStoreID string, vendorID int,
return err
globals.SugarLogger.Debugf("OnStoreStatusChanged venvendorStoreID:%s, storeStatus:%d", vendorStoreID, storeStatus)
db := dao.GetDB()
storeDetail, err := dao.GetStoreDetailByVendorStoreID(db, vendorStoreID, vendorID)
storeDetail, err := dao.GetStoreDetailByVendorStoreID(db, vendorStoreID, vendorID, "")
if err == nil {
var storeKV, storeMapKV map[string]interface{}
if storeStatus == model.StoreStatusOpened {

View File

@@ -34,7 +34,7 @@ func OpenRemoteStoreByJxStatus(ctx *jxcontext.Context, vendorIDs, storeIDs []int
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
storeMap := batchItemList[0].(*model.StoreMap)
if handler, _ := partner.GetPurchasePlatformFromVendorID(storeMap.VendorID).(partner.IStoreHandler); handler != nil {
storeDetail, err := dao.GetStoreDetail(db, storeMap.StoreID, storeMap.VendorID)
storeDetail, err := dao.GetStoreDetail(db, storeMap.StoreID, storeMap.VendorID, "")
if err == nil && storeDetail.Status == model.StoreStatusOpened {
if err = handler.UpdateStoreStatus(ctx, storeMap.VendorOrgCode, storeMap.StoreID, storeMap.VendorStoreID, model.StoreStatusOpened); err == nil {
storeMap.Status = model.StoreStatusOpened

View File

@@ -410,7 +410,7 @@ func isSkuLockTimeValid(sku *dao.StoreSkuSyncInfo) bool {
func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag int, isFull bool, vendorID, storeID int, nameIDs, skuIDs, excludeSkuIDs []int, useVendorPriceDirectly, isContinueWhenError bool) (err error) {
globals.SugarLogger.Debugf("syncStoreSkuNew causeFlag:%d", causeFlag)
db := dao.GetDB()
storeDetail, err := dao.GetStoreDetail(db, storeID, vendorID)
storeDetail, err := dao.GetStoreDetail(db, storeID, vendorID, "")
if err != nil {
return err
}
@@ -901,7 +901,7 @@ func amendAndPruneStoreStuff(ctx *jxcontext.Context, parentTask tasksch.ITask, v
return "", fmt.Errorf("平台:%s不支持此操作", model.VendorChineseNames[vendorID])
}
db := dao.GetDB()
storeDetail, err := dao.GetStoreDetail(db, storeID, vendorID)
storeDetail, err := dao.GetStoreDetail(db, storeID, vendorID, "")
if err != nil {
return "", err
}
@@ -1357,7 +1357,7 @@ func SyncStoreSkuBindAct(ctx *jxcontext.Context, parentTask tasksch.ITask, isCre
subTask := tasksch.NewParallelTask(fmt.Sprintf("%s门店:%d", taskName, storeID), nil, ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
vendorID := batchItemList[0].(int)
storeDetail, err := dao.GetStoreDetail(db, storeID, vendorID)
storeDetail, err := dao.GetStoreDetail(db, storeID, vendorID, "")
if err == nil {
if isCreate {
err = createStoreSkuActs2(ctx, task, vendorID, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, storeSkuMap[storeID][vendorID], storeSkuActMap[storeID][vendorID])

View File

@@ -58,7 +58,7 @@ func getStoreSkus(db *dao.DaoDB, storeID int, skuIDs []int) (skus []*dao.StoreSk
func SyncStoreSku4FakeJD(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, vendorStoreID string, inSkuMap map[int]string, isContinueWhenError bool) (err error) {
vendorID := model.VendorIDJD
db := dao.GetDB()
storeDetail, err := dao.GetStoreDetail(db, storeID, vendorID)
storeDetail, err := dao.GetStoreDetail(db, storeID, vendorID, "")
if err != nil {
return err
}

View File

@@ -67,7 +67,7 @@ func GetNearSupplyGoodsStoreByStoreID(ctx *jxcontext.Context, storeID int) (stor
stores []*model.Store
db = dao.GetDB()
)
store2, _ := dao.GetStoreDetail(db, storeID, model.VendorIDJX)
store2, _ := dao.GetStoreDetail(db, storeID, model.VendorIDJX, "")
if store2 == nil {
return nil, fmt.Errorf("该门店未绑定京西平台storeID: %v", storeID)
}

View File

@@ -1243,7 +1243,7 @@ func JdStoreInfo1125() (hint string, err error) {
if v.Status != model.StoreStatusDisabled && v.CreatedAt.Sub(utils.Str2Time("2019-10-01")) > 0 {
storeInfo, err := api.JdAPI.GetStoreInfoByStationNo2(v.VendorStoreID)
if err == nil && storeInfo.CreateTime.GoTime().Sub(utils.Str2Time("2019-10-25")) > 0 {
if storeDetail, err := dao.GetStoreDetail(db, v.StoreID, v.VendorID); err == nil {
if storeDetail, err := dao.GetStoreDetail(db, v.StoreID, v.VendorID, ""); err == nil {
validStoreList = append(validStoreList, storeDetail)
}
}