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

@@ -33,7 +33,7 @@ func (c *OrderManager) OnNewFakeJdOrder(vendorOrderID string) (err error) {
func (c *OrderManager) notifyNewFakeJdOrder(order *model.GoodsOrder) (err error) {
db := dao.GetDB()
storeDetail, err := dao.GetStoreDetailByVendorStoreID(db, order.VendorStoreID, model.VendorIDJD)
storeDetail, err := dao.GetStoreDetailByVendorStoreID(db, order.VendorStoreID, model.VendorIDJD, "")
if err != nil {
return err
}

View File

@@ -625,7 +625,7 @@ func (c *OrderManager) updateOrderOtherInfo(order *model.GoodsOrder, db *dao.Dao
payPercentage := 0
changePriceType := model.StoreChangePriceTypeDirect
storeDetail, err := dao.GetStoreDetailByVendorStoreID(db, order.VendorStoreID, order.VendorID)
storeDetail, err := dao.GetStoreDetailByVendorStoreID(db, order.VendorStoreID, order.VendorID, "")
if err != nil {
if !dao.IsNoRowsError(err) {
globals.SugarLogger.Warnf("updateOrderOtherInfo GetStoreDetailByVendorStoreID orderID:%s, VendorStoreID:%s, error:%v", order.VendorOrderID, order.VendorStoreID, err)
@@ -748,7 +748,7 @@ func (c *OrderManager) LoadStoreDetail(storeID, vendorID int) (storeDetail *dao.
var (
db = dao.GetDB()
)
storeDetail, err = dao.GetStoreDetail(db, storeID, vendorID)
storeDetail, err = dao.GetStoreDetail(db, storeID, vendorID, "")
return storeDetail, err
}
@@ -983,7 +983,7 @@ func (c *OrderManager) RefreshHistoryOrdersEarningPrice(ctx *jxcontext.Context,
} else {
storeID = order.StoreID
}
store, _ := dao.GetStoreDetail(db, storeID, order.VendorID)
store, _ := dao.GetStoreDetail(db, storeID, order.VendorID, "")
payPercentage := store.PayPercentage
if payPercentage <= 50 {
order.NewEarningPrice = order.TotalShopMoney * int64((100 - payPercentage/2)) / 100
@@ -1296,7 +1296,7 @@ func result2Orders(ctx *jxcontext.Context, result *jdshopapi.AllOrdersResult) (o
}
//结算类型
storeDetail, _ := dao.GetStoreDetail(dao.GetDB(), order.StoreID, model.VendorIDJDShop)
storeDetail, _ := dao.GetStoreDetail(dao.GetDB(), order.StoreID, model.VendorIDJDShop, "")
if storeDetail != nil {
if storeDetail.PayPercentage < 50 {
order.EarningType = model.EarningTypePoints

View File

@@ -320,7 +320,7 @@ func (c *OrderManager) updateAfsOrderSkuOtherInfo(db *dao.DaoDB, order *model.Af
func (c *OrderManager) updateAfsOrderOtherInfo(db *dao.DaoDB, afsOrder *model.AfsOrder) (err error) {
globals.SugarLogger.Debugf("updateAfsOrderOtherInfo orderID:%s, VendorStoreID:%s", afsOrder.VendorOrderID, afsOrder.VendorStoreID)
if afsOrder.VendorStoreID != "" {
if storeDetail, err := dao.GetStoreDetailByVendorStoreID(db, afsOrder.VendorStoreID, 0); err == nil {
if storeDetail, err := dao.GetStoreDetailByVendorStoreID(db, afsOrder.VendorStoreID, 0, ""); err == nil {
afsOrder.JxStoreID = storeDetail.Store.ID
}
}

View File

@@ -85,7 +85,7 @@ func (c *OrderManager) OnOrderComments(orderCommentList []*model.OrderComment) (
err = nil
isNewComment = true
if orderComment.IsReplied == 0 && time.Now().Sub(orderComment.CommentCreatedAt) < time.Duration(orderComment.ModifyDuration)*time.Hour {
if storeDetail, err2 := dao.GetStoreDetail(db, orderComment.StoreID, orderComment.VendorID); err2 == nil {
if storeDetail, err2 := dao.GetStoreDetail(db, orderComment.StoreID, orderComment.VendorID, ""); err2 == nil {
if storeDetail.AutoReplyType == model.AutoReplyAll ||
orderComment.Score > JX_BAD_COMMENTS_MAX_LEVEL && storeDetail.AutoReplyType == model.AutoReplyGoodComment {
c.replyOrderComment(storeDetail.VendorOrgCode, orderComment)
@@ -120,7 +120,7 @@ func (c *OrderManager) OnOrderComments(orderCommentList []*model.OrderComment) (
orderComment.ConsigneeMobile = order.ConsigneeMobile
}
} else {
if storeDetail, err := dao.GetStoreDetailByVendorStoreID(db, orderComment.VendorStoreID, orderComment.VendorID); err == nil {
if storeDetail, err := dao.GetStoreDetailByVendorStoreID(db, orderComment.VendorStoreID, orderComment.VendorID, ""); err == nil {
orderComment.StoreID = storeDetail.ID
}
}

View File

@@ -1079,7 +1079,7 @@ func (c *OrderManager) AmendMissingOrders(ctx *jxcontext.Context, vendorIDs []in
vendorStoreIDMap := make(map[int]string)
if storeID > 0 {
for _, vendorID := range vendorIDs {
storeDetail, err2 := dao.GetStoreDetail(db, storeID, vendorID)
storeDetail, err2 := dao.GetStoreDetail(db, storeID, vendorID, "")
if err = err2; err != nil {
return "", err
}

View File

@@ -226,7 +226,7 @@ func (c *BaseScheduler) AgreeOrRefuseRefund(ctx *jxcontext.Context, afsOrderID s
for _, sku := range order.Skus {
skuMap[sku.SkuID] = sku
}
storeDetail, _ := dao.GetStoreDetail(db, jxutils.GetSaleStoreIDFromOrder(order), order.VendorID)
storeDetail, _ := dao.GetStoreDetail(db, jxutils.GetSaleStoreIDFromOrder(order), order.VendorID, "")
waybills, _ := dao.GetWaybills(db, order.VendorOrderID)
//京东商城和京西要重新算totalshopmoney等
if order.VendorID == model.VendorIDJDShop || order.VendorID == model.VendorIDJX {
@@ -311,7 +311,7 @@ func (c *BaseScheduler) SetOrderWaybillTipByOrder(ctx *jxcontext.Context, order
}
db := dao.GetDB()
storeDetail, err2 := dao.GetStoreDetail(db, jxutils.GetSaleStoreIDFromOrder(order), order.VendorID)
storeDetail, err2 := dao.GetStoreDetail(db, jxutils.GetSaleStoreIDFromOrder(order), order.VendorID, "")
if err = err2; err != nil {
return err
}

View File

@@ -165,7 +165,7 @@ func (s *WatchOrderInfo) updateOrderStoreFeature(order *model.GoodsOrder) (err e
jxStoreID := jxutils.GetSaleStoreIDFromOrder(order)
if jxStoreID > 0 {
db := dao.GetDB()
storeDetail, err2 := dao.GetStoreDetail(db, jxStoreID, order.VendorID)
storeDetail, err2 := dao.GetStoreDetail(db, jxStoreID, order.VendorID, "")
if err = err2; err != nil {
return err
}
@@ -235,7 +235,7 @@ func init() {
},
TimeoutAction: func(savedOrderInfo *WatchOrderInfo, bill *model.Waybill) (err error) {
order := savedOrderInfo.order
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), jxutils.GetSaleStoreIDFromOrder(order), order.VendorID)
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), jxutils.GetSaleStoreIDFromOrder(order), order.VendorID, "")
if err == nil {
savedOrderInfo.storeDetail = storeDetail
}
@@ -538,7 +538,7 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo
}
if needAddTip {
if handler := partner.GetWaybillTipUpdater(bill.WaybillVendorID); handler != nil {
if storeDetail, err2 := dao.GetStoreDetail(dao.GetDB(), jxutils.GetSaleStoreIDFromOrder(order), order.VendorID); err2 == nil {
if storeDetail, err2 := dao.GetStoreDetail(dao.GetDB(), jxutils.GetSaleStoreIDFromOrder(order), order.VendorID, ""); err2 == nil {
handler.UpdateWaybillTip(jxcontext.AdminCtx, order.VendorOrgCode, order.VendorStoreID, order.VendorOrderID, bill.VendorWaybillID, bill.VendorWaybillID2, utils.Int2Str(storeDetail.CityCode), order.WaybillTipMoney)
}
}
@@ -1483,7 +1483,7 @@ func OnDefSchConfChanged(key, value string) {
func setFakeActualPayPrice(order *model.GoodsOrder) (newOrder *model.GoodsOrder) {
orderCopy := *order
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), order.JxStoreID, order.VendorID)
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), order.JxStoreID, order.VendorID, "")
if err == nil {
if storeDetail.PayPercentage < 50 {
orderCopy.ActualPayPrice = order.TotalShopMoney * (100 - int64(storeDetail.PayPercentage/2)) / 100
@@ -1563,7 +1563,7 @@ func OrderProfitWarning(order *model.GoodsOrder) {
return
}
storeID := jxutils.GetShowStoreIDFromOrder(order)
storeDetail, err := dao.GetStoreDetail(db, storeID, order.VendorID)
storeDetail, err := dao.GetStoreDetail(db, storeID, order.VendorID, "")
if storeDetail != nil && err == nil {
payPercentage := storeDetail.PayPercentage
if beego.BConfig.RunMode == "jxgy" {
@@ -1624,7 +1624,7 @@ func (s *DefScheduler) notifyOrderStakeHolder(order *model.GoodsOrder, msgTitle,
// "18180948107",
}
db := dao.GetDB()
storeDetail, err := dao.GetStoreDetail(db, jxutils.GetSaleStoreIDFromOrder(order), order.VendorID)
storeDetail, err := dao.GetStoreDetail(db, jxutils.GetSaleStoreIDFromOrder(order), order.VendorID, "")
if err == nil {
operatorPhone, _ := getOrderOperatorInfo(order, storeDetail)
if operatorPhone != "" {

View File

@@ -38,7 +38,7 @@ func (s *DefScheduler) SelfDeliveringAndUpdateStatus(ctx *jxcontext.Context, ven
if err == nil {
if model.IsOrderDeliveryByStore(order) {
if order.Status < model.OrderStatusDelivering {
storeDetail, err2 := dao.GetStoreDetail(dao.GetDB(), order.StoreID, order.VendorID)
storeDetail, err2 := dao.GetStoreDetail(dao.GetDB(), order.StoreID, order.VendorID, "")
phone := userName
if err = err2; err == nil {
phone = storeDetail.Tel1

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)
}
}

View File

@@ -184,7 +184,7 @@ func getOrderDetailBrief(order *model.GoodsOrder) (brief string) {
if order.EarningType == model.EarningTypePoints {
price = order.ActualPayPrice
} else {
storeDetail, _ := dao.GetStoreDetail(dao.GetDB(), jxutils.GetSaleStoreIDFromOrder(order), order.VendorID)
storeDetail, _ := dao.GetStoreDetail(dao.GetDB(), jxutils.GetSaleStoreIDFromOrder(order), order.VendorID, "")
if storeDetail.CityCode == 510100 {
price = order.ActualPayPrice
} else {
@@ -208,7 +208,7 @@ func NotifyNewOrder(order *model.GoodsOrder) (err error) {
return nil
}
suffix := ""
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), jxutils.GetSaleStoreIDFromOrder(order), order.VendorID)
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), jxutils.GetSaleStoreIDFromOrder(order), order.VendorID, "")
if err == nil && storeDetail != nil {
suffix = storeDetail.CityName + "," + storeDetail.Name
}
@@ -325,7 +325,7 @@ func NotifyUserApplyCancel(order *model.GoodsOrder, cancelReason string) (err er
return nil
}
suffix := ""
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), jxutils.GetSaleStoreIDFromOrder(order), order.VendorID)
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), jxutils.GetSaleStoreIDFromOrder(order), order.VendorID, "")
if err == nil && storeDetail != nil {
suffix = storeDetail.CityName + "," + storeDetail.Name
}
@@ -407,7 +407,7 @@ func NotifyOrderCanceled(order *model.GoodsOrder) (err error) {
return nil
}
suffix := ""
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), jxutils.GetSaleStoreIDFromOrder(order), order.VendorID)
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), jxutils.GetSaleStoreIDFromOrder(order), order.VendorID, "")
if err == nil && storeDetail != nil {
suffix = storeDetail.CityName + "," + storeDetail.Name
}
@@ -447,7 +447,7 @@ func NotifyOrderCanceled(order *model.GoodsOrder) (err error) {
func PushJDBadCommentToWeiXin(comment *legacymodel.JxBadComments, isBadComment bool, order *model.GoodsOrder) (err error) {
globals.SugarLogger.Debugf("PushJDBadCommentToWeiXin orderID:%s", comment.OrderId)
suffix := ""
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), jxutils.GetSaleStoreIDFromOrder(order), order.VendorID)
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), jxutils.GetSaleStoreIDFromOrder(order), order.VendorID, "")
if err == nil && storeDetail != nil {
suffix = storeDetail.CityName + "," + storeDetail.Name
}

View File

@@ -95,7 +95,7 @@ func (s *StoreDetail) GetPricePerentage(price int) (pricePercentage int) {
return pricePercentage
}
func getStoreDetail(db *DaoDB, storeID, vendorID int, vendorStoreID string) (storeDetail *StoreDetail, err error) {
func getStoreDetail(db *DaoDB, storeID, vendorID int, vendorStoreID, vendorOrgCode string) (storeDetail *StoreDetail, err error) {
sql := `
SELECT t1.*,
t2.vendor_store_id, t2.status vendor_status, t2.delivery_fee_deduction_sill, t2.delivery_fee_deduction_fee, t2.sync_status, t2.vendor_org_code,
@@ -145,6 +145,13 @@ func getStoreDetail(db *DaoDB, storeID, vendorID int, vendorStoreID string) (sto
sql += " AND t2.vendor_store_id = ?"
sqlParams = append(sqlParams, vendorStoreID)
}
if vendorOrgCode != "" {
sql += " AND t2.vendor_org_code = ?"
sqlParams = append(sqlParams, vendorOrgCode)
}
if vendorID == model.VendorIDJDShop && vendorOrgCode == "" {
sql += " AND t2.vendor_org_code = 1"
}
if err = GetRow(db, &storeDetail, sql, sqlParams...); err == nil {
storeDetail.PricePercentagePackObj = PricePercentagePack2Obj(storeDetail.PricePercentagePackStr)
storeDetail.FreightDeductionPackObj = FreightDeductionPack2Obj(storeDetail.FreightDeductionPackStr)
@@ -163,15 +170,15 @@ func getStoreDetail(db *DaoDB, storeID, vendorID int, vendorStoreID string) (sto
return nil, err
}
func GetStoreDetail(db *DaoDB, storeID, vendorID int) (storeDetail *StoreDetail, err error) {
return getStoreDetail(db, storeID, vendorID, "")
func GetStoreDetail(db *DaoDB, storeID, vendorID int, vendorOrgCode string) (storeDetail *StoreDetail, err error) {
return getStoreDetail(db, storeID, vendorID, "", vendorOrgCode)
}
func GetStoreDetailByVendorStoreID(db *DaoDB, vendorStoreID string, vendorID int) (storeDetail *StoreDetail, err error) {
func GetStoreDetailByVendorStoreID(db *DaoDB, vendorStoreID string, vendorID int, vendorOrgCode string) (storeDetail *StoreDetail, err error) {
if vendorID != model.VendorIDJX {
return getStoreDetail(db, 0, vendorID, vendorStoreID)
return getStoreDetail(db, 0, vendorID, vendorStoreID, vendorOrgCode)
}
if storeDetail, err = getStoreDetail(db, int(utils.Str2Int64WithDefault(vendorStoreID, 0)), vendorID, ""); err == nil {
if storeDetail, err = getStoreDetail(db, int(utils.Str2Int64WithDefault(vendorStoreID, 0)), vendorID, "", vendorOrgCode); err == nil {
storeDetail.VendorStoreID = vendorStoreID
}
return storeDetail, err

View File

@@ -84,7 +84,7 @@ func (p *PurchaseHandler) IsErrCategoryNotExist(err error) (isNotExist bool) {
}
func getCheckExdStoreNameAndSeq(storeID int, storeCat *dao.SkuStoreCatInfo) (name string, seq int, isCheck bool) {
store, err := dao.GetStoreDetail(dao.GetDB(), storeID, model.VendorIDEBAI)
store, err := dao.GetStoreDetail(dao.GetDB(), storeID, model.VendorIDEBAI, "")
if err != nil || store == nil {
return storeCat.Name, storeCat.Seq, false
}

View File

@@ -204,7 +204,7 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
errList.AddErr(a.UpdateStoreInfo4Open2(storeParams, modifyCloseStatus))
}
if store.FreightDeductionPack != "" {
storeDetail, err2 := dao.GetStoreDetail(db, store.ID, model.VendorIDJD)
storeDetail, err2 := dao.GetStoreDetail(db, store.ID, model.VendorIDJD, "")
if err2 == nil {
if storeDetail.FreightDeductionPackObj != nil {
freightParams := &jdapi.UpdateStoreFreightParam{

View File

@@ -205,7 +205,7 @@ func (p *PurchaseHandler) UpdateStoreSkusStock(ctx *jxcontext.Context, vendorOrg
func (p *PurchaseHandler) SyncStoreProducts(ctx *jxcontext.Context, vendorOrgCode string, parentTask tasksch.ITask, storeID int, skuIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
globals.SugarLogger.Debugf("jd SyncStoreProducts, storeID:%d", storeID)
db := dao.GetDB()
storeDetail, err := dao.GetStoreDetail(db, storeID, model.VendorIDJD)
storeDetail, err := dao.GetStoreDetail(db, storeID, model.VendorIDJD, "")
if err != nil {
return "", err
}

View File

@@ -174,7 +174,7 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err
order.StoreName = store.Name
globals.SugarLogger.Debugf("jds GetStoreListByLocation, orderID: %v storeID :%v", order.VendorOrderID, order.StoreID)
//结算类型
storeDetail, _ := dao.GetStoreDetail(dao.GetDB(), order.StoreID, model.VendorIDJDShop)
storeDetail, _ := dao.GetStoreDetail(dao.GetDB(), order.StoreID, model.VendorIDJDShop, "")
if storeDetail != nil {
if storeDetail.PayPercentage < 50 {
order.EarningType = model.EarningTypePoints

View File

@@ -38,7 +38,7 @@ func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorOrgCode, vendo
// stoerIDs为nil表示所有
func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName string) (err error) {
store, err := dao.GetStoreDetail(db, storeID, model.VendorIDJDShop)
store, err := dao.GetStoreDetail(db, storeID, model.VendorIDJDShop, "")
if err != nil {
return err
}
@@ -77,7 +77,7 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
}
func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName string) (vendorStoreID string, err error) {
store, err := dao.GetStoreDetail(db, storeID, model.VendorIDJDShop)
store, err := dao.GetStoreDetail(db, storeID, model.VendorIDJDShop, "")
if err != nil {
return vendorStoreID, err
}

View File

@@ -428,7 +428,7 @@ func findDiscountCard(dicountCards []*model.DiscountCard, thingID int) (dicountC
func GetAvailableDeliverTime(ctx *jxcontext.Context, storeID int) (deliverTimerList []*DeliveryDayTimeInfo, err error) {
db := dao.GetDB()
storeDetail, err := dao.GetStoreDetail(db, storeID, model.VendorIDJX)
storeDetail, err := dao.GetStoreDetail(db, storeID, model.VendorIDJX, "")
if err != nil {
return nil, err
}
@@ -590,7 +590,7 @@ func generateOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64
return nil, nil, fmt.Errorf("没有指定门店信息")
}
// 配送范围检查
storeDetail, err := dao.GetStoreDetail(db, jxOrder.StoreID, model.VendorIDJX)
storeDetail, err := dao.GetStoreDetail(db, jxOrder.StoreID, model.VendorIDJX, "")
if err != nil {
return nil, nil, err
}
@@ -874,7 +874,7 @@ func generateOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64
//表示此订单为物料配送订单
if jxOrder.OrderType != model.OrderTypeNormal {
// if fromStoreID != 0 {
storeDetail2, err2 := dao.GetStoreDetail(db, fromStoreID, model.VendorIDJX)
storeDetail2, err2 := dao.GetStoreDetail(db, fromStoreID, model.VendorIDJX, "")
if err = err2; err != nil {
return nil, nil, fmt.Errorf("fromStoreID有误,[%v]", fromStoreID)
}

View File

@@ -109,7 +109,7 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
if db == nil {
db = dao.GetDB()
}
storeDetail, err := dao.GetStoreDetail(db, storeID, model.VendorIDMTWM)
storeDetail, err := dao.GetStoreDetail(db, storeID, model.VendorIDMTWM, "")
if err != nil {
return err
}

View File

@@ -107,7 +107,7 @@ func (p *PurchaseHandler) DeleteStoreSkus(ctx *jxcontext.Context, storeID int, v
}
func (p *PurchaseHandler) GetStoreSkusFullInfo(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (skuNameList []*partner.SkuNameInfo, err error) {
storeDetail, _ := dao.GetStoreDetail(dao.GetDB(), storeID, model.VendorIDYB)
storeDetail, _ := dao.GetStoreDetail(dao.GetDB(), storeID, model.VendorIDYB, "")
api.YinBaoAPI = yinbaoapi.New(storeDetail.YbAppKey, storeDetail.YbAppID)
if configs, err := dao.QueryConfigs(dao.GetDB(), "yinbaoCookie", model.ConfigTypeCookie, ""); err == nil {
yinbaoCookie := configs[0].Value