diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index e3a26d67e..8d736c421 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -2392,10 +2392,10 @@ func RefershStoreSkusMidPrice(ctx *jxcontext.Context, storeIDs []int) (err error return err } if len(priceReferList) > 0 { - if storeSku.UnitPrice > priceReferList[0].MidUnitPrice*payPercentage/100 { + if storeSku.UnitPrice > priceReferList[0].MidUnitPrice/payPercentage*100 { skuBindInfo := &StoreSkuBindInfo{ NameID: priceReferList[0].NameID, - UnitPrice: priceReferList[0].MidUnitPrice * payPercentage / 100, + UnitPrice: priceReferList[0].MidUnitPrice / payPercentage * 100, } skuBindInfos = append(skuBindInfos, skuBindInfo) } @@ -3013,7 +3013,7 @@ func FocusStoreSkusBySku(ctx *jxcontext.Context, skuBindInfos []*StoreSkuBindInf } priceReferList, _ := dao.GetPriceReferSnapshotNoPage(db, []int{store.CityCode}, nil, []int{skuList[0].NameID}, utils.Time2Date(time.Now().AddDate(0, 0, -1))) if len(priceReferList) > 0 { - price = priceReferList[0].MidUnitPrice * payPercentage / 100 + price = priceReferList[0].MidUnitPrice / payPercentage * 100 } } skuBindSkuInfo := &StoreSkuBindSkuInfo{ @@ -3121,7 +3121,7 @@ func AutoFocusStoreSkusForTopSkus(ctx *jxcontext.Context, isAsync, isContinueWhe } priceReferList, err := dao.GetPriceReferSnapshotNoPage(db, []int{vv.CityCode}, nil, []int{vv.ID}, utils.Time2Date(time.Now().AddDate(0, 0, -1))) if err == nil && len(priceReferList) > 0 { - storeSkuBindInfo.UnitPrice = priceReferList[0].MidUnitPrice * payPercentage / 100 + storeSkuBindInfo.UnitPrice = priceReferList[0].MidUnitPrice / payPercentage * 100 } skuBindInfoList = append(skuBindInfoList, storeSkuBindInfo) } diff --git a/business/jxstore/report/report.go b/business/jxstore/report/report.go index 312a1df26..649b536c5 100644 --- a/business/jxstore/report/report.go +++ b/business/jxstore/report/report.go @@ -107,9 +107,12 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int, isAsyn return result, err } for _, v := range storeList { + if v.PayPercentage < 50 { + continue + } var tList []*tStoreSkuBindAndSkuName sql := ` - SELECT DISTINCT b.city_code, a.store_id, Round(a.unit_price/IF(b.pay_percentage < 50 , 70, b.pay_percentage) * 100) AS unit_price, c.name_id + SELECT DISTINCT b.city_code, a.store_id, Round(a.unit_price * IF(b.pay_percentage < 50 , 70, b.pay_percentage) / 100) AS unit_price, c.name_id FROM store_sku_bind a JOIN store b ON b.id = a.store_id AND b.deleted_at = ? AND b.status != ? JOIN sku c ON c.id = a.sku_id diff --git a/business/model/dao/store.go b/business/model/dao/store.go index 8a76af7c0..a22c5e767 100644 --- a/business/model/dao/store.go +++ b/business/model/dao/store.go @@ -574,7 +574,7 @@ func GetStorePriceScore(db *DaoDB, storeIDs, vendorIDs []int, fromScore, toScore func GetStorePriceScoreSnapshot(db *DaoDB, snapDate time.Time) (storePriceScoreSnapshot []*model.StorePriceScoreSnapshot, err error) { sql := ` - 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 + 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 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 != ?