冲突
This commit is contained in:
@@ -672,6 +672,7 @@ func GetSkuNames(ctx *jxcontext.Context, keyword string, isBySku, isQueryMidPric
|
||||
'","eclpID":"', t2.eclp_id,
|
||||
'","weight":', t2.weight, ',"categoryID":', t2.category_id, ',"nameID":', t2.name_id,
|
||||
', "seq":', t2.seq,
|
||||
', "minOrderCount":', t2.min_order_count,
|
||||
"}")), "]") skus_str,
|
||||
CONCAT("[", GROUP_CONCAT(DISTINCT t3.place_code), "]") places_str
|
||||
` + sql + `
|
||||
|
||||
@@ -412,7 +412,7 @@ func setStoreMapInfo(ctx *jxcontext.Context, db *dao.DaoDB, storesInfo *StoresIn
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
storeCourierList, err := dao.GetStoreCourierList(db, storeIDs, model.StoreStatusAll, model.StoreAuditStatusAll)
|
||||
storeCourierList, err := dao.GetStoreCourierList(db, storeIDs, nil, model.StoreStatusAll, model.StoreAuditStatusAll)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -65,9 +65,9 @@ type ExcelParam struct {
|
||||
|
||||
// UpdateStoreSku用,API调用时
|
||||
type StoreSkuBindSkuInfo struct {
|
||||
SkuID int `json:"skuID"`
|
||||
IsSale int `json:"isSale,omitempty"` // -1:不可售,0:忽略,1:可售
|
||||
Stock int `json:"stock,omitempty"`
|
||||
SkuID int `json:"skuID"`
|
||||
IsSale int `json:"isSale,omitempty"` // -1:不可售,0:忽略,1:可售
|
||||
Stock *int `json:"stock"`
|
||||
// ElmID int64 `json:"elmID,omitempty"`
|
||||
// EbaiID int64 `json:"ebaiID,omitempty"`
|
||||
}
|
||||
@@ -583,7 +583,7 @@ func GetStoresSkusNew(ctx *jxcontext.Context, storeIDs, skuIDs []int, isFocus, i
|
||||
t4.jd_sync_status, t4.ebai_sync_status, t4.mtwm_sync_status, t4.yb_sync_status, t4.jds_sync_status,
|
||||
t4.jd_price, t4.ebai_price, t4.mtwm_price, t4.jx_price, t4.yb_price, t4.jds_price,
|
||||
t4.jd_lock_time, t4.ebai_lock_time, t4.mtwm_lock_time, t4.jx_lock_time, t4.yb_lock_time, t4.jds_lock_time,
|
||||
t4.status_sale_begin, t4.status_sale_end,
|
||||
t4.status_sale_begin, t4.status_sale_end, t4.stock,
|
||||
t6.mid_unit_price real_mid_unit_price,
|
||||
t7.unit_price audit_unit_price
|
||||
` + sql
|
||||
@@ -1161,6 +1161,23 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
||||
skuBind.JxPrice = jxutils.CaculatePriceByPricePack(storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage), skuBind.Price)
|
||||
if tmpStatus := getSkuSaleStatus(inSkuBind, skuBindInfo); tmpStatus != model.StoreSkuBindStatusNA {
|
||||
skuBind.Status = tmpStatus
|
||||
if inSkuBind != nil {
|
||||
if inSkuBind.Stock != nil {
|
||||
skuBind.Stock = *inSkuBind.Stock
|
||||
} else {
|
||||
if tmpStatus == model.StoreSkuBindStatusNormal {
|
||||
skuBind.Stock = model.MaxStoreSkuStockQty
|
||||
} else {
|
||||
skuBind.Stock = 0
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if tmpStatus == model.StoreSkuBindStatusNormal {
|
||||
skuBind.Stock = model.MaxStoreSkuStockQty
|
||||
} else {
|
||||
skuBind.Stock = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
if globals.IsAddEvent {
|
||||
err = AddEventDetail(db, ctx, model.OperateAdd, v.RealSkuID, model.ThingTypeSku, storeID, "", utils.Int2Str(skuBind.UnitPrice))
|
||||
@@ -1241,6 +1258,19 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
||||
}
|
||||
skuBind.Status = tmpStatus
|
||||
setStoreSkuBindStatus(skuBind, model.SyncFlagSaleMask)
|
||||
setStoreSkuBindStatus(skuBind, model.SyncFlagStockMask)
|
||||
if tmpStatus == model.StoreSkuBindStatusNormal {
|
||||
skuBind.Stock = model.MaxStoreSkuStockQty
|
||||
} else {
|
||||
skuBind.Stock = 0
|
||||
}
|
||||
}
|
||||
if inSkuBind != nil {
|
||||
if inSkuBind.Stock != nil {
|
||||
updateFieldMap["Stock"] = 1
|
||||
skuBind.Stock = *inSkuBind.Stock
|
||||
setStoreSkuBindStatus(skuBind, model.SyncFlagStockMask)
|
||||
}
|
||||
}
|
||||
if skuBindInfo.UnitPrice != 0 && isCanChangePrice { // 这里是否需要加此条件限制
|
||||
price := jxutils.CaculateSkuPrice(unitPrice, v.SpecQuality, v.SpecUnit, v.SkuNameUnit)
|
||||
|
||||
@@ -1379,7 +1379,7 @@ func SetMTPSStatus(ctx *jxcontext.Context, storeId, courierStatus int) {
|
||||
db := dao.GetDB()
|
||||
/*比较营业状态*/
|
||||
/*把获取的京西状态和名称存一下*/
|
||||
StoreCourierList, _ := dao.GetStoreCourierList(db, []int{}, model.StoreStatusAll, model.StoreStatusAll)
|
||||
StoreCourierList, _ := dao.GetStoreCourierList(db, []int{}, nil, model.StoreStatusAll, model.StoreStatusAll)
|
||||
/*循环美团*/
|
||||
for _, StoreInfoList1 := range StoreInfoList {
|
||||
for _, StoreInfoList11 := range StoreInfoList1.DataList {
|
||||
|
||||
@@ -253,10 +253,11 @@ func storeSkuSyncInfo2Bare(inSku *dao.StoreSkuSyncInfo) (outSku *partner.StoreSk
|
||||
VendorSkuID2: utils.Int64ToStr(inSku.JdsWareID),
|
||||
JdsStockSwitch: inSku.JdsStockSwitch,
|
||||
IsDeletedBySku: inSku.IsDeletedBySku,
|
||||
Stock: inSku.Stock,
|
||||
}
|
||||
if !isStoreSkuSyncNeedDelete(inSku) {
|
||||
outSku.Stock = model.MaxStoreSkuStockQty
|
||||
}
|
||||
// if !isStoreSkuSyncNeedDelete(inSku) {
|
||||
// outSku.Stock = model.MaxStoreSkuStockQty
|
||||
// }
|
||||
return outSku
|
||||
}
|
||||
|
||||
@@ -480,6 +481,7 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
|
||||
if !dao.IsVendorThingIDEmpty(sku.VendorSkuID) {
|
||||
bareSku = storeSkuSyncInfo2Bare(sku)
|
||||
if singleStoreHandler == nil {
|
||||
bareSku.Stock = 0
|
||||
stockList = append(stockList, bareSku)
|
||||
} else {
|
||||
deleteList = append(deleteList, bareSku)
|
||||
@@ -555,15 +557,21 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
|
||||
}
|
||||
if sku.MergedStatus == model.SkuStatusNormal {
|
||||
onlineList = append(onlineList, bareSku)
|
||||
stockList = append(stockList, bareSku)
|
||||
// stockList = append(stockList, bareSku)
|
||||
} else {
|
||||
offlineList = append(offlineList, bareSku)
|
||||
// 因为京东平台以是否有库存表示是否关注,所以不论是否可售,都要设置库存
|
||||
if singleStoreHandler == nil {
|
||||
stockList = append(stockList, bareSku)
|
||||
}
|
||||
// if singleStoreHandler == nil {
|
||||
// stockList = append(stockList, bareSku)
|
||||
// }
|
||||
}
|
||||
}
|
||||
if model.IsSyncStatusStock(sku.SkuSyncStatus) {
|
||||
if bareSku == nil {
|
||||
bareSku = storeSkuSyncInfo2Bare(sku)
|
||||
}
|
||||
stockList = append(stockList, bareSku)
|
||||
}
|
||||
}
|
||||
isNeedReorder = model.IsSyncStatusSeq(sku.SkuSyncStatus)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/autonavi"
|
||||
@@ -61,6 +62,53 @@ func (x Store4UserList) Swap(i, j int) {
|
||||
x[i], x[j] = x[j], x[i]
|
||||
}
|
||||
|
||||
func GetNearSupplyGoodsStoreByStoreID(ctx *jxcontext.Context, storeID int) (store *model.Store, err error) {
|
||||
var (
|
||||
stores []*model.Store
|
||||
db = dao.GetDB()
|
||||
)
|
||||
store2, _ := dao.GetStoreDetail(db, storeID, model.VendorIDJX)
|
||||
if store2 == nil {
|
||||
return nil, fmt.Errorf("该门店未绑定京西平台!storeID: %v", storeID)
|
||||
}
|
||||
if store2.IsSupplyGoods == model.YES {
|
||||
return nil, fmt.Errorf("该门店已经是货源门店,无法从其他货源门店进货!storeID: %v", storeID)
|
||||
}
|
||||
sql := `
|
||||
SELECT a.*
|
||||
FROM store a
|
||||
JOIN store_map b ON b.store_id = a.id
|
||||
JOIN store c ON c.city_code = a.city_code AND c.id = ?
|
||||
WHERE a.deleted_at = ?
|
||||
AND b.deleted_at = ?
|
||||
AND b.vendor_id = ?
|
||||
AND b.is_supply_goods = ?
|
||||
AND a.status = ?
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
storeID,
|
||||
utils.DefaultTimeValue, utils.DefaultTimeValue,
|
||||
model.VendorIDJX, model.YES, model.StoreStatusOpened,
|
||||
}
|
||||
err = dao.GetRows(db, &stores, sql, sqlParams)
|
||||
if len(stores) > 0 {
|
||||
realDistance := float64(0)
|
||||
for _, v := range stores {
|
||||
distance := jxutils.EarthDistance(jxutils.IntCoordinate2Standard(v.Lng), jxutils.IntCoordinate2Standard(v.Lat), jxutils.IntCoordinate2Standard(store2.Lng), jxutils.IntCoordinate2Standard(store2.Lat))
|
||||
if realDistance == 0 {
|
||||
realDistance = distance
|
||||
store = v
|
||||
} else {
|
||||
if realDistance > distance {
|
||||
realDistance = distance
|
||||
store = v
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return store, err
|
||||
}
|
||||
|
||||
func GetStoreListByLocation(ctx *jxcontext.Context, lng, lat float64, maxRadius int, needWalkDistance, isJds bool) (storeList []*Store4User, err error) {
|
||||
const (
|
||||
maxStoreCount4User = 5
|
||||
|
||||
@@ -8,13 +8,12 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/act"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin"
|
||||
"git.rosy.net.cn/jx-callback/business/partner/delivery"
|
||||
"github.com/360EntSecGroup-Skylar/excelize"
|
||||
"github.com/qiniu/api.v7/storage"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/dadaapi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/mtwmapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
@@ -1585,76 +1584,18 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
|
||||
// fmt.Println("addList2", addList)
|
||||
// fmt.Println("updateList2", utils.Format4Output(updateList, false))
|
||||
// fmt.Println("deleteList2", deleteList)
|
||||
db := dao.GetDB()
|
||||
storeIDs := []int{
|
||||
667335,
|
||||
667321,
|
||||
667319,
|
||||
667260,
|
||||
667227,
|
||||
667167,
|
||||
667109,
|
||||
667094,
|
||||
667050,
|
||||
666898,
|
||||
666852,
|
||||
666815,
|
||||
666763,
|
||||
666761,
|
||||
666760,
|
||||
666759,
|
||||
666714,
|
||||
666708,
|
||||
666705,
|
||||
666669,
|
||||
103437,
|
||||
103425,
|
||||
103349,
|
||||
103123,
|
||||
103116,
|
||||
103107,
|
||||
103069,
|
||||
103019,
|
||||
102940,
|
||||
102890,
|
||||
102831,
|
||||
102772,
|
||||
102751,
|
||||
101870,
|
||||
101755,
|
||||
101176,
|
||||
100767,
|
||||
100754,
|
||||
100726,
|
||||
100699,
|
||||
100476,
|
||||
100369,
|
||||
100366,
|
||||
100361,
|
||||
100351,
|
||||
100350,
|
||||
}
|
||||
for _, storeID := range storeIDs {
|
||||
acts, _ := dao.QueryActs(db, 0, 0, 50, 0, "", -1, []int{1}, []int{0, 3, 4}, nil, storeID, nil, 0, utils.ZeroTimeValue, utils.ZeroTimeValue, utils.Str2Time("2020-05-30 00:00:00"), utils.Str2Time("2020-07-30 00:00:00"))
|
||||
for _, v := range acts.Data {
|
||||
var actStoreSkuParam []*act.ActStoreSkuParam
|
||||
_, actStoreSkus, _ := dao.GetActStoreSkuVendorList(db, v.ID, []int{0}, nil, nil, "", 0, 99999)
|
||||
for _, actStoreSku := range actStoreSkus {
|
||||
if actStoreSku.StoreID == storeID {
|
||||
aa := &act.ActStoreSkuParam{
|
||||
ActStoreSku: model.ActStoreSku{
|
||||
StoreID: storeID,
|
||||
SkuID: actStoreSku.SkuID,
|
||||
ActID: v.ID,
|
||||
},
|
||||
}
|
||||
actStoreSkuParam = append(actStoreSkuParam, aa)
|
||||
}
|
||||
}
|
||||
_, err = act.DeleteActStoreSkuBind(ctx, db, v.ID, actStoreSkuParam)
|
||||
if err == nil {
|
||||
_, err = act.SyncAct(ctx, nil, v.ID, nil, true)
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
)
|
||||
list, err := dao.GetStoreCourierList(db, nil, []int{model.VendorIDDada}, model.StoreStatusAll, model.StoreAuditStatusAll)
|
||||
for _, v := range list {
|
||||
sd, _ := api.DadaAPI.ShopDetail(v.VendorStoreID)
|
||||
if !strings.Contains(sd.StationName, globals.StoreName) {
|
||||
shopInfo := &dadaapi.ShopInfo{
|
||||
OriginShopID: v.VendorStoreID,
|
||||
StationName: globals.StoreName + "-" + sd.StationName,
|
||||
}
|
||||
api.DadaAPI.ShopUpdate(shopInfo)
|
||||
}
|
||||
}
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user