错误提示,门店评分修改

This commit is contained in:
苏尹岚
2019-12-12 13:38:06 +08:00
parent 4a4342def0
commit 19704b74bc
12 changed files with 86 additions and 65 deletions

View File

@@ -634,7 +634,7 @@ func (c *OrderManager) UpdateOrderFields(order *model.GoodsOrder, fieldList []st
return err return err
} }
func (c *OrderManager) RefreshHistoryOrdersEarningPrice(ctx *jxcontext.Context, vendorOrderID string, actID int, vendorIDs []int, storeID int, fromDate, toDate string, isAsync, isContinueWhenError bool) (hint string, err error) { func (c *OrderManager) RefreshHistoryOrdersEarningPrice(ctx *jxcontext.Context, vendorOrderID string, actID int, vendorIDs []int, storeID int, fromDate, toDate string, isAsync, isContinueWhenError bool) (hint string, errCode string, err error) {
var ( var (
orderList []*model.GoodsOrder orderList []*model.GoodsOrder
fromDateParam time.Time fromDateParam time.Time
@@ -652,10 +652,10 @@ func (c *OrderManager) RefreshHistoryOrdersEarningPrice(ctx *jxcontext.Context,
actBeginAt := actList.Data[0].BeginAt actBeginAt := actList.Data[0].BeginAt
actEndAt := actList.Data[0].EndAt actEndAt := actList.Data[0].EndAt
if fromDateParam.Sub(actBeginAt) > 0 && fromDateParam.Sub(actEndAt) > 0 { if fromDateParam.Sub(actBeginAt) > 0 && fromDateParam.Sub(actEndAt) > 0 {
return "", errors.New(fmt.Sprintf("结算活动有效时间范围与订单创建时间范围不一致!,活动时间范围:[%v] 至 [%v] ,订单创建时间范围 [%v] 至 [%v]", actBeginAt, actEndAt, fromDateParam, toDateParam)) return "", model.ErrCodeGeneralFailed, errors.New(fmt.Sprintf("结算活动有效时间范围与订单创建时间范围不一致!,活动时间范围:[%v] 至 [%v] ,订单创建时间范围 [%v] 至 [%v]", actBeginAt, actEndAt, fromDateParam, toDateParam))
} }
if actBeginAt.Sub(toDateParam) > 0 && actEndAt.Sub(toDateParam) > 0 { if actBeginAt.Sub(toDateParam) > 0 && actEndAt.Sub(toDateParam) > 0 {
return "", errors.New(fmt.Sprintf("结算活动有效时间范围与订单创建时间范围不一致!,活动时间范围:[%v] 至 [%v] ,订单创建时间范围 [%v] 至 [%v]", actBeginAt, actEndAt, fromDateParam, toDateParam)) return "", model.ErrCodeGeneralFailed, errors.New(fmt.Sprintf("结算活动有效时间范围与订单创建时间范围不一致!,活动时间范围:[%v] 至 [%v] ,订单创建时间范围 [%v] 至 [%v]", actBeginAt, actEndAt, fromDateParam, toDateParam))
} }
if fromDateParam.Sub(actBeginAt) > 0 { if fromDateParam.Sub(actBeginAt) > 0 {
beginAt = fromDateParam beginAt = fromDateParam
@@ -674,17 +674,17 @@ func (c *OrderManager) RefreshHistoryOrdersEarningPrice(ctx *jxcontext.Context,
} }
orderList, _ = dao.QueryOrders(db, vendorOrderID, actID, vendorIDs, storeID, beginAt, endAt) orderList, _ = dao.QueryOrders(db, vendorOrderID, actID, vendorIDs, storeID, beginAt, endAt)
} else { } else {
return "", errors.New(fmt.Sprintf("未查询到相关结算活动活动ID[%d]", actID)) return "", model.ErrCodeGeneralFailed, errors.New(fmt.Sprintf("未查询到相关结算活动活动ID[%d]", actID))
} }
} else if fromDate == "" && toDate == "" { } else if fromDate == "" && toDate == "" {
actList, _ := dao.QueryActs(db, actID, 0, math.MaxInt32, 0, "", -1, nil, nil, nil, 0, 0, 0, utils.DefaultTimeValue, utils.DefaultTimeValue, utils.DefaultTimeValue, utils.DefaultTimeValue) actList, _ := dao.QueryActs(db, actID, 0, math.MaxInt32, 0, "", -1, nil, nil, nil, 0, 0, 0, utils.DefaultTimeValue, utils.DefaultTimeValue, utils.DefaultTimeValue, utils.DefaultTimeValue)
if len(actList.Data) > 0 { if len(actList.Data) > 0 {
orderList, _ = dao.QueryOrders(db, vendorOrderID, actID, vendorIDs, storeID, actList.Data[0].BeginAt, actList.Data[0].EndAt) orderList, _ = dao.QueryOrders(db, vendorOrderID, actID, vendorIDs, storeID, actList.Data[0].BeginAt, actList.Data[0].EndAt)
} else { } else {
return "", errors.New(fmt.Sprintf("未查询到相关结算活动活动ID[%d]", actID)) return "", model.ErrCodeGeneralFailed, errors.New(fmt.Sprintf("未查询到相关结算活动活动ID[%d]", actID))
} }
} else { } else {
return "", errors.New(fmt.Sprintf("间隔时间必须完整!时间范围:[%v] 至 [%v]", fromDate, toDate)) return "", model.ErrCodeGeneralFailed, errors.New(fmt.Sprintf("间隔时间必须完整!时间范围:[%v] 至 [%v]", fromDate, toDate))
} }
} else { } else {
if fromDate != "" && toDate != "" { if fromDate != "" && toDate != "" {
@@ -692,15 +692,15 @@ func (c *OrderManager) RefreshHistoryOrdersEarningPrice(ctx *jxcontext.Context,
toDateParam = utils.Str2Time(toDate) toDateParam = utils.Str2Time(toDate)
//若未传入活动ID,且时间间隔大于10天则不允许查询 //若未传入活动ID,且时间间隔大于10天则不允许查询
if math.Ceil(toDateParam.Sub(fromDateParam).Hours()/24) > 10 { if math.Ceil(toDateParam.Sub(fromDateParam).Hours()/24) > 10 {
return "", errors.New(fmt.Sprintf("查询间隔时间不允许大于10天时间范围[%v] 至 [%v]", fromDate, toDate)) return "", model.ErrCodeGeneralFailed, errors.New(fmt.Sprintf("查询间隔时间不允许大于10天时间范围[%v] 至 [%v]", fromDate, toDate))
} }
orderList, _ = dao.QueryOrders(db, vendorOrderID, actID, vendorIDs, storeID, fromDateParam, toDateParam) orderList, _ = dao.QueryOrders(db, vendorOrderID, actID, vendorIDs, storeID, fromDateParam, toDateParam)
} else { } else {
return "", errors.New(fmt.Sprintf("若不按活动查询则间隔时间必须完整!时间范围:[%v] 至 [%v]", fromDate, toDate)) return "", model.ErrCodeGeneralFailed, errors.New(fmt.Sprintf("若不按活动查询则间隔时间必须完整!时间范围:[%v] 至 [%v]", fromDate, toDate))
} }
} }
if len(orderList) <= 0 { if len(orderList) <= 0 {
return "", errors.New(fmt.Sprintf("未查询到订单!,vendorOrderID : %s, actID : %d, 时间范围:[%v] 至 [%v]", vendorOrderID, actID, fromDate, toDate)) return "", model.ErrCodePoint, errors.New(fmt.Sprintf("所选活动没有要更新结算价的订单!,vendorOrderID : %s, actID : %d, 时间范围:[%v] 至 [%v]", vendorOrderID, actID, fromDate, toDate))
} }
task := tasksch.NewParallelTask("刷新历史订单结算价", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx, task := tasksch.NewParallelTask("刷新历史订单结算价", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
@@ -722,20 +722,23 @@ func (c *OrderManager) RefreshHistoryOrdersEarningPrice(ctx *jxcontext.Context,
} }
} }
jxutils.RefreshOrderSkuRelated(order) jxutils.RefreshOrderSkuRelated(order)
if _, err = dao.UpdateEntity(db, order, "EarningPrice"); err != nil { num, err := dao.UpdateEntity(db, order, "EarningPrice")
if err != nil {
return "", err return "", err
} }
dao.Commit(db) dao.Commit(db)
retVal = num
return retVal, err return retVal, err
}, orderList) }, orderList)
tasksch.HandleTask(task, nil, true).Run() tasksch.HandleTask(task, nil, true).Run()
if !isAsync { if !isAsync {
_, err = task.GetResult(0) resultNum, err2 := task.GetResult(0)
hint = "1" err = err2
hint = resultNum[0].(string)
} else { } else {
hint = task.GetID() hint = task.GetID()
} }
return hint, err return hint, model.ErrCodeSuccess, err
} }
func RefreshOrdersWithoutJxStoreID(ctx *jxcontext.Context, fromDate, toDate string, isAsync, isContinueWhenError bool) (hint string, err error) { func RefreshOrdersWithoutJxStoreID(ctx *jxcontext.Context, fromDate, toDate string, isAsync, isContinueWhenError bool) (hint string, err error) {

View File

@@ -2542,9 +2542,14 @@ func GetStorePriceScore(ctx *jxcontext.Context, storeIDs []int, fromScore, toSco
return pagedInfo, err return pagedInfo, err
} }
func CreateStorePriceScore(ctx *jxcontext.Context) (err error) { func CreateStorePriceScore(ctx *jxcontext.Context, forRefresh bool) (err error) {
db := dao.GetDB() db := dao.GetDB()
snapshotAt := utils.Time2Date(time.Now()) var snapshotAt time.Time
if forRefresh {
snapshotAt = utils.Time2Date(time.Now().AddDate(0, 0, -1))
} else {
snapshotAt = utils.Time2Date(time.Now())
}
storePriceScoreSnapshot, err := dao.GetStorePriceScoreSnapshot(db, snapshotAt) storePriceScoreSnapshot, err := dao.GetStorePriceScoreSnapshot(db, snapshotAt)
if len(storePriceScoreSnapshot) > 0 { if len(storePriceScoreSnapshot) > 0 {
dao.Begin(db) dao.Begin(db)
@@ -2556,7 +2561,10 @@ func CreateStorePriceScore(ctx *jxcontext.Context) (err error) {
} }
} }
}() }()
dao.DeleteEntity(db, storePriceScoreSnapshot[0], "SnapshotAt") priceReferSnapshotDeleteHis := &model.StorePriceScoreSnapshot{SnapshotAt: snapshotAt.AddDate(0, -1, 0)}
priceReferSnapshotDelete := &model.StorePriceScoreSnapshot{SnapshotAt: snapshotAt}
dao.DeleteEntity(db, priceReferSnapshotDeleteHis, "SnapshotAt")
dao.DeleteEntity(db, priceReferSnapshotDelete, "SnapshotAt")
for _, v := range storePriceScoreSnapshot { for _, v := range storePriceScoreSnapshot {
dao.WrapAddIDCULDEntity(v, ctx.GetUserName()) dao.WrapAddIDCULDEntity(v, ctx.GetUserName())
v.SnapshotAt = snapshotAt v.SnapshotAt = snapshotAt

View File

@@ -2143,6 +2143,9 @@ func GetTopCategorysByStoreIDs(ctx *jxcontext.Context, storeIDs []int) (skuCateg
func RefershStoreSkusMidPrice(ctx *jxcontext.Context, storeIDs []int) (err error) { func RefershStoreSkusMidPrice(ctx *jxcontext.Context, storeIDs []int) (err error) {
db := dao.GetDB() db := dao.GetDB()
_, err = dao.RefershStoreSkusMidPrice(db, storeIDs) _, err = dao.RefershStoreSkusMidPrice(db, storeIDs)
if err == nil {
CreateStorePriceScore(ctx, true)
}
return err return err
} }

View File

@@ -140,7 +140,7 @@ func Init() {
report.BeginSavePriceRefer(jxcontext.AdminCtx, nil, nil) report.BeginSavePriceRefer(jxcontext.AdminCtx, nil, nil)
}, createStorePriceTimeList) }, createStorePriceTimeList)
ScheduleTimerFunc("CreateStorePriceScore", func() { ScheduleTimerFunc("CreateStorePriceScore", func() {
cms.CreateStorePriceScore(jxcontext.AdminCtx) cms.CreateStorePriceScore(jxcontext.AdminCtx, false)
}, openRemoteStoreTimeList) }, openRemoteStoreTimeList)
} }
ScheduleTimerFunc("AutoSaleStoreSku", func() { ScheduleTimerFunc("AutoSaleStoreSku", func() {

View File

@@ -64,10 +64,14 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int) (err e
} }
} }
}() }()
dao.DeleteEntity(db, priceReferSnapshot[0], "SnapshotAt") priceReferSnapshotDeleteHis := &model.PriceReferSnapshot{SnapshotAt: snapshotAt.AddDate(0, -1, 0)}
priceReferSnapshotDelete := &model.PriceReferSnapshot{SnapshotAt: snapshotAt}
dao.DeleteEntity(db, priceReferSnapshotDeleteHis, "SnapshotAt")
dao.DeleteEntity(db, priceReferSnapshotDelete, "SnapshotAt")
for _, v := range priceReferSnapshot { for _, v := range priceReferSnapshot {
dao.WrapAddIDCULDEntity(v, ctx.GetUserName()) dao.WrapAddIDCULDEntity(v, ctx.GetUserName())
v.SnapshotAt = snapshotAt v.SnapshotAt = snapshotAt
fmt.Println(v)
if err = dao.CreateEntity(db, v); err != nil { if err = dao.CreateEntity(db, v); err != nil {
return err return err
} }

View File

@@ -188,22 +188,22 @@ func GetGetStatisticsReportForAfsOrders(db *DaoDB, storeIDs []int, fromDate time
func GetStatisticsReportForStoreSkusPrice(db *DaoDB, cityCodes, skuIDs []int) (priceReferSnapshot []*model.PriceReferSnapshot, err error) { func GetStatisticsReportForStoreSkusPrice(db *DaoDB, cityCodes, skuIDs []int) (priceReferSnapshot []*model.PriceReferSnapshot, err error) {
sql := ` sql := `
SELECT b.city_code,a.sku_id, SELECT b.city_code,a.sku_id,
MAX(a.price/100) max_price, MAX(a.price) max_price,
MIN(a.price/100) min_price, MIN(a.price) min_price,
ROUND(AVG(a.price/100),2) avg_price, ROUND(AVG(a.price)) avg_price,
ROUND(SUBSTRING_INDEX(SUBSTRING_INDEX(GROUP_CONCAT(a.price/100 ORDER BY a.price/100),',',Count(1)/2),',',-1),2) mid_price, ROUND(SUBSTRING_INDEX(SUBSTRING_INDEX(GROUP_CONCAT((a.price/IF(b.pay_percentage=0,100,b.pay_percentage))*100 ORDER BY (a.price/IF(b.pay_percentage=0,100,b.pay_percentage))*100),',',Count(1)/2),',',-1),2) mid_price,
MAX(a.jd_price/100) max_jd_price, MAX(a.jd_price) max_jd_price,
MIN(a.jd_price/100) min_jd_price, MIN(a.jd_price) min_jd_price,
ROUND(AVG(a.jd_price/100),2) avg_jd_price, ROUND(AVG(a.jd_price)) avg_jd_price,
ROUND(SUBSTRING_INDEX(SUBSTRING_INDEX(GROUP_CONCAT(a.jd_price/100 ORDER BY a.jd_price/100),',',Count(1)/2),',',-1),2) mid_jd_price, ROUND(SUBSTRING_INDEX(SUBSTRING_INDEX(GROUP_CONCAT(a.jd_price ORDER BY a.jd_price),',',Count(1)/2),',',-1),2) mid_jd_price,
MAX(a.ebai_price/100) max_ebai_price, MAX(a.ebai_price) max_ebai_price,
MIN(a.ebai_price/100) min_ebai_price, MIN(a.ebai_price) min_ebai_price,
ROUND(AVG(a.ebai_price/100),2) avg_ebai_price, ROUND(AVG(a.ebai_price)) avg_ebai_price,
ROUND(SUBSTRING_INDEX(SUBSTRING_INDEX(GROUP_CONCAT(a.ebai_price/100 ORDER BY a.ebai_price/100),',',Count(1)/2),',',-1),2) mid_ebai_price, ROUND(SUBSTRING_INDEX(SUBSTRING_INDEX(GROUP_CONCAT(a.ebai_price ORDER BY a.ebai_price),',',Count(1)/2),',',-1),2) mid_ebai_price,
MAX(a.mtwm_price/100) max_mtwm_price, MAX(a.mtwm_price) max_mtwm_price,
MIN(a.mtwm_price/100) min_mtwm_price, MIN(a.mtwm_price) min_mtwm_price,
ROUND(AVG(a.mtwm_price/100),2) avg_mtwm_price, ROUND(AVG(a.mtwm_price)) avg_mtwm_price,
ROUND(SUBSTRING_INDEX(SUBSTRING_INDEX(GROUP_CONCAT(a.mtwm_price/100 ORDER BY a.mtwm_price/100),',',Count(1)/2),',',-1),2) mid_mtwm_price, ROUND(SUBSTRING_INDEX(SUBSTRING_INDEX(GROUP_CONCAT(a.mtwm_price ORDER BY a.mtwm_price),',',Count(1)/2),',',-1),2) mid_mtwm_price,
t1.max_sale_price, t1.max_sale_price,
t1.min_sale_price, t1.min_sale_price,
t1.avg_sale_price, t1.avg_sale_price,
@@ -214,17 +214,18 @@ func GetStatisticsReportForStoreSkusPrice(db *DaoDB, cityCodes, skuIDs []int) (p
JOIN store b ON a.store_id = b.id AND b.deleted_at = ? JOIN store b ON a.store_id = b.id AND b.deleted_at = ?
JOIN sku d ON a.sku_id = d.id AND d.deleted_at = ? JOIN sku d ON a.sku_id = d.id AND d.deleted_at = ?
LEFT JOIN ( LEFT JOIN (
SELECT SUM(t1.count),t1.sku_id,MAX(t1.sale_price/100) max_sale_price,MIN(t1.sale_price/100) min_sale_price,ROUND(AVG(t1.sale_price/100),2) avg_sale_price,MAX(t1.vendor_price/100) max_vendor_price,MIN(t1.vendor_price/100) min_vendor_price,ROUND(AVG(t1.vendor_price/100),2) avg_vendor_price SELECT SUM(t1.count),t1.sku_id,MAX(t1.sale_price) max_sale_price,MIN(t1.sale_price) min_sale_price,ROUND(AVG(t1.sale_price)) avg_sale_price,MAX(t1.vendor_price) max_vendor_price,MIN(t1.vendor_price) min_vendor_price,ROUND(AVG(t1.vendor_price)) avg_vendor_price
FROM order_sku t1 FROM order_sku t1
WHERE t1.order_created_at BETWEEN ? AND NOW() WHERE t1.order_created_at BETWEEN ? AND NOW()
GROUP BY 2 GROUP BY 2
)t1 ON t1.sku_id = a.sku_id )t1 ON t1.sku_id = a.sku_id
WHERE 1=1 WHERE a.deleted_at = ?
` `
sqlParams := []interface{}{ sqlParams := []interface{}{
utils.DefaultTimeValue, utils.DefaultTimeValue,
utils.DefaultTimeValue, utils.DefaultTimeValue,
time.Now().AddDate(0, -1, 0), time.Now().AddDate(0, -1, 0),
utils.DefaultTimeValue,
} }
if len(skuIDs) > 0 { if len(skuIDs) > 0 {
sql += " AND a.sku_id IN (" + GenQuestionMarks(len(skuIDs)) + ")" sql += " AND a.sku_id IN (" + GenQuestionMarks(len(skuIDs)) + ")"

View File

@@ -522,7 +522,7 @@ func GetStorePriceScore(db *DaoDB, storeIDs []int, fromScore, toScore, sort int,
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.price/100 <= a.mid_price or NULL)/count(*)*100,2) score SELECT c.store_id,ROUND(count(c.price <= a.mid_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 = 1 AND c.deleted_at = ? JOIN store_sku_bind c ON c.sku_id = a.sku_id AND c.status = 1 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 != ?

View File

@@ -1033,18 +1033,18 @@ func RefershStoreSkusMidPrice(db *DaoDB, storeIDs []int) (count int64, err error
UPDATE store_sku_bind a UPDATE store_sku_bind a
JOIN store d ON d.id = a.store_id JOIN store d ON d.id = a.store_id
JOIN price_refer_snapshot b ON a.sku_id = b.sku_id AND b.snapshot_at = ? AND d.city_code = b.city_code JOIN price_refer_snapshot b ON a.sku_id = b.sku_id AND b.snapshot_at = ? AND d.city_code = b.city_code
SET a.price = b.mid_price*100 SET a.price = (b.mid_price*IF(d.pay_percentage=0,100,d.pay_percentage))/100
WHERE 1=1 WHERE 1=1
` `
sqlParams := []interface{}{ sqlParams := []interface{}{
utils.DefaultTimeValue, utils.Time2Date(time.Now().AddDate(0, 0, -1)),
} }
if len(storeIDs) > 0 { if len(storeIDs) > 0 {
sql += " AND a.store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")" sql += " AND a.store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")"
sqlParams = append(sqlParams, storeIDs) sqlParams = append(sqlParams, storeIDs)
} }
sql += ` sql += `
AND a.price > b.mid_price*100 AND (a.price/IF(d.pay_percentage=0,100,d.pay_percentage))*100 > b.mid_price
AND a.deleted_at = ? AND a.deleted_at = ?
AND a.status = ? AND a.status = ?
` `

View File

@@ -6,6 +6,7 @@ const (
ErrorCodeIgnore = "ignore" ErrorCodeIgnore = "ignore"
ErrCodeSuccess = "0" ErrCodeSuccess = "0"
ErrCodePoint = "1"
ErrCodeGeneralFailed = "-1" ErrCodeGeneralFailed = "-1"
ErrCodeTokenIsInvalid = "-2" ErrCodeTokenIsInvalid = "-2"
ErrCodeUserNotExist = "-3" ErrCodeUserNotExist = "-3"

View File

@@ -429,28 +429,28 @@ type PriceReferSnapshot struct {
SnapshotAt time.Time `orm:"type(datetime)" json:"snapshotAt"` // 这个不同于CreatedAtSnapshotAt是逻辑上的时间CreatedAt是实际存储的时间 SnapshotAt time.Time `orm:"type(datetime)" json:"snapshotAt"` // 这个不同于CreatedAtSnapshotAt是逻辑上的时间CreatedAt是实际存储的时间
CityCode int `json:"cityCode"` CityCode int `json:"cityCode"`
SkuID int `orm:"column(sku_id)" json:"skuId"` SkuID int `orm:"column(sku_id)" json:"skuId"`
MaxPrice float64 `json:"maxPrice"` MaxPrice int `json:"maxPrice"`
MinPrice float64 `json:"minPrice"` MinPrice int `json:"minPrice"`
AvgPrice float64 `json:"avgPrice"` AvgPrice int `json:"avgPrice"`
MidPrice float64 `json:"midPrice"` MidPrice int `json:"midPrice"`
MaxJdPrice float64 `json:"maxJdPrice"` MaxJdPrice int `json:"maxJdPrice"`
MinJdPrice float64 `json:"minJdPrice"` MinJdPrice int `json:"minJdPrice"`
AvgJdPrice float64 `json:"avgJdPrice"` AvgJdPrice int `json:"avgJdPrice"`
MidJdPrice float64 `json:"midJdPrice"` MidJdPrice int `json:"midJdPrice"`
MaxEbaiPrice float64 `json:"maxEbaiPrice"` MaxEbaiPrice int `json:"maxEbaiPrice"`
MinEbaiPrice float64 `json:"minEbaiPrice"` MinEbaiPrice int `json:"minEbaiPrice"`
AvgEbaiPrice float64 `json:"avgEbaiPrice"` AvgEbaiPrice int `json:"avgEbaiPrice"`
MidEbaiPrice float64 `json:"midEbaiPrice"` MidEbaiPrice int `json:"midEbaiPrice"`
MaxMtwmPrice float64 `json:"maxMtwmPrice"` MaxMtwmPrice int `json:"maxMtwmPrice"`
MinMtwmPrice float64 `json:"minMtwmPrice"` MinMtwmPrice int `json:"minMtwmPrice"`
AvgMtwmPrice float64 `json:"avgMtwmPrice"` AvgMtwmPrice int `json:"avgMtwmPrice"`
MidMtwmPrice float64 `json:"midMtwmPrice"` MidMtwmPrice int `json:"midMtwmPrice"`
MaxSalePrice float64 `json:"maxSalePrice"` MaxSalePrice int `json:"maxSalePrice"`
MinSalePrice float64 `json:"minSalePrice"` MinSalePrice int `json:"minSalePrice"`
AvgSalePrice float64 `json:"avgSalePrice"` AvgSalePrice int `json:"avgSalePrice"`
MaxVendorPrice float64 `json:"maxVendorPrice"` MaxVendorPrice int `json:"maxVendorPrice"`
MinVendorPrice float64 `json:"minVendorPrice"` MinVendorPrice int `json:"minVendorPrice"`
AvgVendorPrice float64 `json:"avgVendorPrice"` AvgVendorPrice int `json:"avgVendorPrice"`
} }
func (*PriceReferSnapshot) TableUnique() [][]string { func (*PriceReferSnapshot) TableUnique() [][]string {

View File

@@ -610,12 +610,13 @@ func (c *StoreController) GetStorePriceScore() {
// @Title 生成门店价格分数表 // @Title 生成门店价格分数表
// @Description 生成门店价格分数表 // @Description 生成门店价格分数表
// @Param token header string true "认证token" // @Param token header string true "认证token"
// @Param forRefresh formData bool true "是否是刷新中位价重新生成分数表"
// @Success 200 {object} controllers.CallResult // @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult
// @router /CreateStorePriceScore [post] // @router /CreateStorePriceScore [post]
func (c *StoreController) CreateStorePriceScore() { func (c *StoreController) CreateStorePriceScore() {
c.callCreateStorePriceScore(func(params *tStoreCreateStorePriceScoreParams) (retVal interface{}, errCode string, err error) { c.callCreateStorePriceScore(func(params *tStoreCreateStorePriceScoreParams) (retVal interface{}, errCode string, err error) {
err = cms.CreateStorePriceScore(params.Ctx) err = cms.CreateStorePriceScore(params.Ctx, params.ForRefresh)
return retVal, "", err return retVal, "", err
}) })
} }

View File

@@ -759,9 +759,9 @@ func (c *OrderController) RefreshHistoryOrdersEarningPrice() {
c.callRefreshHistoryOrdersEarningPrice(func(params *tOrderRefreshHistoryOrdersEarningPriceParams) (retVal interface{}, errCode string, err error) { c.callRefreshHistoryOrdersEarningPrice(func(params *tOrderRefreshHistoryOrdersEarningPriceParams) (retVal interface{}, errCode string, err error) {
var vendorIDList []int var vendorIDList []int
if err = jxutils.Strings2Objs(params.VendorIDs, &vendorIDList); err == nil { if err = jxutils.Strings2Objs(params.VendorIDs, &vendorIDList); err == nil {
retVal, err = orderman.FixedOrderManager.RefreshHistoryOrdersEarningPrice(params.Ctx, params.VendorOrderID, params.ActID, vendorIDList, params.StoreID, params.FromTime, params.ToTime, params.IsAsync, params.IsContinueWhenError) retVal, errCode, err = orderman.FixedOrderManager.RefreshHistoryOrdersEarningPrice(params.Ctx, params.VendorOrderID, params.ActID, vendorIDList, params.StoreID, params.FromTime, params.ToTime, params.IsAsync, params.IsContinueWhenError)
} }
return retVal, "", err return retVal, errCode, err
}) })
} }