显示中位价
This commit is contained in:
@@ -495,8 +495,7 @@ func GetStoresSkusNew(ctx *jxcontext.Context, storeIDs, skuIDs []int, isFocus bo
|
|||||||
t4.jd_price, t4.ebai_price, t4.mtwm_price, t4.jx_price,
|
t4.jd_price, t4.ebai_price, t4.mtwm_price, t4.jx_price,
|
||||||
t4.jd_lock_time, t4.ebai_lock_time, t4.mtwm_lock_time, t4.jx_lock_time,
|
t4.jd_lock_time, t4.ebai_lock_time, t4.mtwm_lock_time, t4.jx_lock_time,
|
||||||
t4.status_sale_begin, t4.status_sale_end,
|
t4.status_sale_begin, t4.status_sale_end,
|
||||||
t6.mid_unit_price real_mid_unit_price,
|
t6.mid_unit_price real_mid_unit_price
|
||||||
ROUND(t6.mid_unit_price * IF(t3.pay_percentage < 50,70,t3.pay_percentage) /100) mid_unit_price
|
|
||||||
`, jdVendorIDField) + sql
|
`, jdVendorIDField) + sql
|
||||||
var tmpList []*tGetStoresSkusInfo
|
var tmpList []*tGetStoresSkusInfo
|
||||||
beginTime := time.Now()
|
beginTime := time.Now()
|
||||||
@@ -515,11 +514,12 @@ func GetStoresSkusNew(ctx *jxcontext.Context, storeIDs, skuIDs []int, isFocus bo
|
|||||||
index := jxutils.Combine2Int(v.StoreID, v.ID)
|
index := jxutils.Combine2Int(v.StoreID, v.ID)
|
||||||
if isBySku || storeNameMap[index] == nil {
|
if isBySku || storeNameMap[index] == nil {
|
||||||
storeName = &dao.StoreSkuNameExt{
|
storeName = &dao.StoreSkuNameExt{
|
||||||
StoreID: v.StoreID,
|
StoreID: v.StoreID,
|
||||||
StoreName: v.StoreName,
|
StoreName: v.StoreName,
|
||||||
SkuName: v.SkuName,
|
SkuName: v.SkuName,
|
||||||
UnitPrice: v.UnitPrice,
|
UnitPrice: v.UnitPrice,
|
||||||
PayPercentage: v.PayPercentage,
|
PayPercentage: v.PayPercentage,
|
||||||
|
RealMidUnitPrice: v.RealMidUnitPrice,
|
||||||
}
|
}
|
||||||
if !isBySku {
|
if !isBySku {
|
||||||
storeNameMap[index] = storeName
|
storeNameMap[index] = storeName
|
||||||
|
|||||||
@@ -566,7 +566,7 @@ func GetStorePriceScore(db *DaoDB, storeIDs, vendorIDs []int, fromScore, toScore
|
|||||||
|
|
||||||
func GetStorePriceScoreSnapshot(db *DaoDB, snapDate time.Time) (storePriceScoreSnapshot []*model.StorePriceScoreSnapshot, err error) {
|
func GetStorePriceScoreSnapshot(db *DaoDB, snapDate time.Time) (storePriceScoreSnapshot []*model.StorePriceScoreSnapshot, err error) {
|
||||||
sql := `
|
sql := `
|
||||||
SELECT c.store_id,ROUND(count(c.unit_price/IF(d.pay_percentage < 50 , 70, d.pay_percentage) <= a.mid_unit_price or NULL)/count(*)*100,2) score
|
SELECT c.store_id,ROUND(count(c.unit_price/IF(d.pay_percentage < 50 , 70, d.pay_percentage)*100 <= a.mid_unit_price or NULL)/count(*)*100,2) score
|
||||||
FROM price_refer_snapshot a
|
FROM price_refer_snapshot a
|
||||||
JOIN store_sku_bind c ON c.sku_id = a.sku_id AND c.status = ? AND c.deleted_at = ?
|
JOIN store_sku_bind c ON c.sku_id = a.sku_id AND c.status = ? AND c.deleted_at = ?
|
||||||
JOIN store d ON c.store_id = d.id AND d.city_code = a.city_code AND d.deleted_at = ? AND d.status != ?
|
JOIN store d ON c.store_id = d.id AND d.city_code = a.city_code AND d.deleted_at = ? AND d.status != ?
|
||||||
|
|||||||
@@ -134,7 +134,6 @@ type StoreSkuNameExt struct {
|
|||||||
PendingUnitPrice int `json:"pendingUnitPrice"` // 这个是待审核的价格申请
|
PendingUnitPrice int `json:"pendingUnitPrice"` // 这个是待审核的价格申请
|
||||||
Status int
|
Status int
|
||||||
RealMidUnitPrice int `json:"realMidUnitPrice"`
|
RealMidUnitPrice int `json:"realMidUnitPrice"`
|
||||||
midUnitPrice int `json:"midUnitPrice"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetStoreSkus用
|
// GetStoreSkus用
|
||||||
@@ -159,8 +158,9 @@ type StoreSkuExt struct {
|
|||||||
BindLastOperator string `orm:"size(32)" json:"lastOperator"` // 最后操作员
|
BindLastOperator string `orm:"size(32)" json:"lastOperator"` // 最后操作员
|
||||||
BindDeletedAt time.Time `orm:"type(datetime)" json:"deletedAt"`
|
BindDeletedAt time.Time `orm:"type(datetime)" json:"deletedAt"`
|
||||||
SubStoreID int `orm:"column(sub_store_id)" json:"subStoreID"`
|
SubStoreID int `orm:"column(sub_store_id)" json:"subStoreID"`
|
||||||
BindPrice int `json:"price"` // 单位为分,不用int64的原因是这里不需要累加
|
BindPrice int `json:"price"` // 单位为分,不用int64的原因是这里不需要累加
|
||||||
UnitPrice int `json:"unitPrice"` // 这个是一斤的门店商品价,放在这里的原因是避免额外增加一张store sku_name表,逻辑上要保证同一SKU NAME中的所有SKU这个字段的数据一致
|
UnitPrice int `json:"unitPrice"` // 这个是一斤的门店商品价,放在这里的原因是避免额外增加一张store sku_name表,逻辑上要保证同一SKU NAME中的所有SKU这个字段的数据一致
|
||||||
|
RealMidUnitPrice int `json:"realMidUnitPrice"` //真实的该商品的全国中位价
|
||||||
StoreSkuStatus int `json:"storeSkuStatus"`
|
StoreSkuStatus int `json:"storeSkuStatus"`
|
||||||
|
|
||||||
EbaiID string `orm:"column(ebai_id);index" json:"ebaiID"`
|
EbaiID string `orm:"column(ebai_id);index" json:"ebaiID"`
|
||||||
|
|||||||
Reference in New Issue
Block a user