diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 696dbc0e2..7a1316965 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -752,7 +752,7 @@ func RefreshOrdersWithoutJxStoreID(ctx *jxcontext.Context, fromDate, toDate stri return hint, err } -func GetOrdersSupplement(ctx *jxcontext.Context, storIDs, vendorIDs []int, vendorOrderID, fromTime, toTime string, status, stype, IsReverse, offset, pageSize int) (pageInfo *model.PagedInfo, err error) { +func GetOrdersSupplement(ctx *jxcontext.Context, storIDs, vendorIDs, statuss []int, vendorOrderID, fromTime, toTime string, stype, IsReverse, offset, pageSize int) (pageInfo *model.PagedInfo, err error) { var ( db = dao.GetDB() fromTimeP time.Time @@ -767,7 +767,7 @@ func GetOrdersSupplement(ctx *jxcontext.Context, storIDs, vendorIDs []int, vendo if fromTimeP.After(toTimeP) { return nil, fmt.Errorf("时间范围不合法!开始时间:[%v],结束时间:[%v]", fromTimeP, toTimeP) } - result, totalCount, err := dao.GetOrdersSupplement(db, storIDs, vendorIDs, vendorOrderID, fromTimeP, toTimeP, status, stype, IsReverse, offset, pageSize) + result, totalCount, err := dao.GetOrdersSupplement(db, storIDs, vendorIDs, statuss, vendorOrderID, fromTimeP, toTimeP, stype, IsReverse, offset, pageSize) pageInfo = &model.PagedInfo{ Data: result, TotalCount: totalCount, @@ -791,11 +791,16 @@ func AddUpdateOrdersSupplement(ctx *jxcontext.Context, ordersSupplement *model.O } }() if id > 0 { - if ordersSupplement.Status == 1 { + orderSupplementFee, _ := dao.GetOrdersSupplementNoPage(db, id, nil, nil, nil, "", utils.ZeroTimeValue, utils.ZeroTimeValue, 0, 0) + if len(orderSupplementFee) > 2 || len(orderSupplementFee) == 0 { + return 0, fmt.Errorf("查询扣款记录有误,请联系技术部!") + } + if orderSupplementFee[0].Status == 1 { return 0, fmt.Errorf("已结账的扣款信息不允许修改!门店ID:[%v],订单号:[%v]", ordersSupplement.StoreID, ordersSupplement.VendorOrderID) } ordersSupplement.UpdatedAt = time.Now() ordersSupplement.LastOperator = ctx.GetUserName() + ordersSupplement.CreatedAt = orderSupplementFee[0].CreatedAt if ordersSupplement.Status == -1 { ordersSupplement.DeletedAt = time.Now() } else { diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 0207aa87f..65bd5c91b 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -114,6 +114,7 @@ type tGetStoresSkusInfo struct { model.SkuName PayPercentage int `json:"-"` dao.StoreSkuExt + RealMidUnitPrice int `json:"realMidUnitPrice"` //真实的该商品的全国中位价 } type SheetParam struct { @@ -261,10 +262,12 @@ func getGetStoresSkusBaseSQL(db *dao.DaoDB, storeIDs, skuIDs []int, isFocus bool sql += ` JOIN store_sku_bind t4 ON t4.store_id = t3.id AND t4.sku_id = t2.id AND t4.deleted_at = ? LEFT JOIN sku_name_place_bind t5 ON t1.id = t5.name_id AND t3.city_code = t5.place_code + LEFT JOIN price_refer_snapshot t6 ON t6.city_code = 0 AND t6.sku_id = t2.id AND t6.snapshot_at = ? WHERE t1.deleted_at = ? AND (t1.is_global = 1 OR t5.id IS NOT NULL OR 1 = ?)/* AND t1.status = ?*/ ` sqlParams = append(sqlParams, []interface{}{ utils.DefaultTimeValue, + utils.Time2Date(time.Now().AddDate(0, 0, -1)), utils.DefaultTimeValue, utils.Bool2Int(isFocus), // model.SkuStatusNormal, @@ -493,7 +496,8 @@ func GetStoresSkusNew(ctx *jxcontext.Context, storeIDs, skuIDs []int, isFocus bo t4.jd_sync_status, t4.ebai_sync_status, t4.mtwm_sync_status, 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.status_sale_begin, t4.status_sale_end + t4.status_sale_begin, t4.status_sale_end, + t6.mid_unit_price real_mid_unit_price `, jdVendorIDField) + sql var tmpList []*tGetStoresSkusInfo beginTime := time.Now() @@ -512,11 +516,12 @@ func GetStoresSkusNew(ctx *jxcontext.Context, storeIDs, skuIDs []int, isFocus bo index := jxutils.Combine2Int(v.StoreID, v.ID) if isBySku || storeNameMap[index] == nil { storeName = &dao.StoreSkuNameExt{ - StoreID: v.StoreID, - StoreName: v.StoreName, - SkuName: v.SkuName, - UnitPrice: v.UnitPrice, - PayPercentage: v.PayPercentage, + StoreID: v.StoreID, + StoreName: v.StoreName, + SkuName: v.SkuName, + UnitPrice: v.UnitPrice, + PayPercentage: v.PayPercentage, + RealMidUnitPrice: v.RealMidUnitPrice, } if !isBySku { storeNameMap[index] = storeName @@ -2214,18 +2219,7 @@ func GetTopSkusByCityCode(ctx *jxcontext.Context, cityCode, storeID int) (skuNam JOIN sku b ON a.sku_id = b.id AND b.deleted_at = ? WHERE a.deleted_at = ? AND a.store_id = ? - AND a.status = ?) - UNION - SELECT DISTINCT a.name_id id,0 brand_id - FROM sku a - LEFT JOIN (SELECT DISTINCT b.name_id - FROM store_sku_bind a - JOIN sku b ON a.sku_id = b.id - WHERE a.deleted_at = ? - AND store_id = ?)b ON a.name_id = b.name_id - WHERE a.status = ? - AND a.deleted_at = ? - AND b.name_id IS NULL + AND a.status = ?) ` sqlParams := []interface{}{ utils.DefaultTimeValue, @@ -2236,23 +2230,31 @@ func GetTopSkusByCityCode(ctx *jxcontext.Context, cityCode, storeID int) (skuNam utils.DefaultTimeValue, storeID, model.StoreSkuBindStatusNormal, - utils.DefaultTimeValue, - storeID, - model.StoreSkuBindStatusNormal, - utils.DefaultTimeValue, } err = dao.GetRows(db, &skuNameList, sql, sqlParams...) var skuNameMap = make(map[int]*model.SkuName) for _, v := range skuNameList { skuNameMap[v.ID] = v } + store, err := dao.GetStoreDetail(db, storeID, -1) + if err != nil { + return nil, err + } + var payPercentage int + if store.PayPercentage < 50 { + payPercentage = 70 + } else { + payPercentage = store.PayPercentage + } for _, v := range skuNameAndPlace { if skuNameMap[v.ID] != nil { - priceReferList, _, _ := dao.GetPriceReferSnapshot(db, []int{cityCode}, nil, v.ID, utils.Time2Date(time.Now().AddDate(0, 0, -1)), 0, 9999) + priceReferList, _ := dao.GetPriceReferSnapshotNoPage(db, []int{cityCode}, nil, []int{v.ID}, utils.Time2Date(time.Now().AddDate(0, 0, -1))) if len(priceReferList) > 0 { - v.Price = priceReferList[0].MidUnitPrice + v.Price = priceReferList[0].MidUnitPrice * payPercentage / 100 } v.Type = skuNameMap[v.ID].BrandID + skuList, _ := dao.GetSkus(db, nil, []int{v.ID}, nil, nil) + v.Skus = skuList skuNameAndPlaceList = append(skuNameAndPlaceList, v) } } @@ -2955,9 +2957,15 @@ func FocusStoreSkusBySku(ctx *jxcontext.Context, skuIDs []int, isAsync, isContin if len(focusList) > 0 { price = focusList[0].UnitPrice } else { - priceReferList, _, _ := dao.GetPriceReferSnapshot(db, []int{store.CityCode}, nil, k, utils.Time2Date(time.Now().AddDate(0, 0, -1)), 0, 9999) + var payPercentage int + if store.PayPercentage < 50 { + payPercentage = 70 + } else { + payPercentage = store.PayPercentage + } + priceReferList, _ := dao.GetPriceReferSnapshotNoPage(db, []int{store.CityCode}, nil, []int{k}, utils.Time2Date(time.Now().AddDate(0, 0, -1))) if len(priceReferList) > 0 { - price = priceReferList[0].MidUnitPrice + price = priceReferList[0].MidUnitPrice * payPercentage / 100 } } skuBindInfo := &StoreSkuBindInfo{ @@ -2997,6 +3005,68 @@ func FocusStoreSkusBySku(ctx *jxcontext.Context, skuIDs []int, isAsync, isContin return hint, err } +func AutoFocusStoreSkusWithoutFocusForTopSkus(ctx *jxcontext.Context) (err error) { + db := dao.GetDB() + storeList, err := dao.GetStoreList(db, nil, nil, "") + for _, v := range storeList { + var ( + skuName []*model.SkuName + skuNameMap = make(map[int]int) + skuBindInfoList []*StoreSkuBindInfo + ) + sql := ` + SELECT DISTINCT a.name_id id + FROM sku a + LEFT JOIN (SELECT DISTINCT b.name_id + FROM store_sku_bind a + JOIN sku b ON a.sku_id = b.id + WHERE a.deleted_at = ? + AND store_id = ?)b ON a.name_id = b.name_id + WHERE a.status = ? + AND a.deleted_at = ? + AND b.name_id IS NULL + ` + sqlParams := []interface{}{ + utils.DefaultTimeValue, + v.ID, + model.SkuStatusNormal, + utils.DefaultTimeValue, + } + err = dao.GetRows(db, &skuName, sql, sqlParams...) + for _, v := range skuName { + skuNameMap[v.ID] = v.ID + } + skuNameAndPlaceList, err2 := GetTopSkusByCityCode(ctx, v.CityCode, v.ID) + if err2 != nil { + return err2 + } + var payPercentage int + if v.PayPercentage < 50 { + payPercentage = 70 + } else { + payPercentage = v.PayPercentage + } + if len(skuNameAndPlaceList) > 0 { + for _, v := range skuNameAndPlaceList { + if skuNameMap[v.ID] != 0 { + priceReferList, err := dao.GetPriceReferSnapshotNoPage(db, []int{v.CityCode}, nil, []int{v.ID}, utils.Time2Date(time.Now().AddDate(0, 0, -1))) + if err == nil && len(priceReferList) > 0 { + storeSkuBindInfo := &StoreSkuBindInfo{ + NameID: v.ID, + UnitPrice: priceReferList[0].MidUnitPrice * payPercentage / 100, + IsFocus: 1, + IsSale: 0, + } + skuBindInfoList = append(skuBindInfoList, storeSkuBindInfo) + } + } + } + } + UpdateStoreSkus(ctx, v.ID, skuBindInfoList, true, true) + } + return err +} + func AutoFocusStoreSkusWithoutFocus(ctx *jxcontext.Context, skuIDs []int, isSync bool) (err error) { var ( nameMap = make(map[int]*StoreSkuBindInfo) diff --git a/business/jxstore/report/report.go b/business/jxstore/report/report.go index 997dcce74..e2b9b8f78 100644 --- a/business/jxstore/report/report.go +++ b/business/jxstore/report/report.go @@ -97,8 +97,10 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int, isAsyn case 1: priceReferSnapshotList, err = dao.GetPriceReferSnapshotNoPage(db, nil, nil, nil, snapshotAt) var ( - citySkuMap = make(map[int]map[int][]int) - resultMap = make(map[int]map[int]*model.PriceReferSnapshot) + citySkuMap = make(map[int]map[int][]int) + countryMap = make(map[int][]int) + resultMap = make(map[int]map[int]*model.PriceReferSnapshot) + resultCountryMap = make(map[int]*model.PriceReferSnapshot) ) storeList, err := dao.GetStoreList(db, nil, nil, "") if err != nil { @@ -145,6 +147,7 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int, isAsyn if len(tList) > 0 { for _, vv := range tList { skuNameMap[vv.NameID] = append(skuNameMap[vv.NameID], vv.UnitPrice) + countryMap[vv.NameID] = append(countryMap[vv.NameID], vv.UnitPrice) } if citySkuMap[v.CityCode] != nil { for nameID, unitPriceList := range skuNameMap { @@ -159,6 +162,26 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int, isAsyn } } } + for k, v := range countryMap { + var midUnitPrice int + var avgUnitPrice int + sort.Ints(v) + if len(v)%2 == 0 { + midUnitPrice = v[len(v)/2-1] + } else { + midUnitPrice = v[len(v)/2] + } + for _, vv := range v { + avgUnitPrice += vv + } + priceRefer := &model.PriceReferSnapshot{ + MidUnitPrice: midUnitPrice, + MaxUnitPrice: v[len(v)-1], + MinUnitPrice: v[0], + AvgUnitPrice: avgUnitPrice / len(v), + } + resultCountryMap[k] = priceRefer + } for k1, v := range citySkuMap { skuNameMap := make(map[int]*model.PriceReferSnapshot) for k2, _ := range v { @@ -193,6 +216,16 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int, isAsyn }() if len(priceReferSnapshotList) > 0 { for _, v := range priceReferSnapshotList { + if v.CityCode == 0 { + if resultCountryMap[v.NameID] != nil { + v.MidUnitPrice = resultCountryMap[v.NameID].MidUnitPrice + v.MaxUnitPrice = resultCountryMap[v.NameID].MaxUnitPrice + v.AvgUnitPrice = resultCountryMap[v.NameID].AvgUnitPrice + v.MinUnitPrice = resultCountryMap[v.NameID].MinUnitPrice + dao.UpdateEntity(db, v, "MidUnitPrice", "MaxUnitPrice", "MinUnitPrice", "AvgUnitPrice") + } + continue + } if resultMap[v.CityCode][v.NameID] != nil { v.MidUnitPrice = resultMap[v.CityCode][v.NameID].MidUnitPrice v.MaxUnitPrice = resultMap[v.CityCode][v.NameID].MaxUnitPrice diff --git a/business/model/dao/dao_order.go b/business/model/dao/dao_order.go index 321ca7d9a..7339adfef 100644 --- a/business/model/dao/dao_order.go +++ b/business/model/dao/dao_order.go @@ -1053,7 +1053,7 @@ func GetWayBillByOrderID(db *DaoDB, orderStatus, vendorID, waybillVendorID int, return wayBillList, err } -func GetOrdersSupplement(db *DaoDB, storIDs, vendorIDs []int, vendorOrderID string, fromTime, toTime time.Time, status, stype, IsReverse, offset, pageSize int) (orderSupplementFee []*model.OrderSupplementFee, totalCount int, err error) { +func GetOrdersSupplement(db *DaoDB, storIDs, vendorIDs, statuss []int, vendorOrderID string, fromTime, toTime time.Time, stype, IsReverse, offset, pageSize int) (orderSupplementFee []*model.OrderSupplementFee, totalCount int, err error) { sql := ` SELECT SQL_CALC_FOUND_ROWS * FROM order_supplement_fee @@ -1083,9 +1083,9 @@ func GetOrdersSupplement(db *DaoDB, storIDs, vendorIDs []int, vendorOrderID stri sql += " AND vendor_order_id = ?" sqlParams = append(sqlParams, vendorOrderID) } - if status >= 0 { - sql += " AND status = ?" - sqlParams = append(sqlParams, status) + if len(statuss) > 0 { + sql += " AND status IN (" + GenQuestionMarks(len(statuss)) + ")" + sqlParams = append(sqlParams, statuss) } if stype > 0 { sql += " AND type = ?" @@ -1096,8 +1096,7 @@ func GetOrdersSupplement(db *DaoDB, storIDs, vendorIDs []int, vendorOrderID stri } else if IsReverse == 1 { sql += " AND link_id <> 0" } - sql += ` - LIMIT ? OFFSET ?` + sql += " LIMIT ? OFFSET ?" sqlParams = append(sqlParams, pageSize, offset) Begin(db) defer Commit(db) @@ -1106,3 +1105,54 @@ func GetOrdersSupplement(db *DaoDB, storIDs, vendorIDs []int, vendorOrderID stri } return orderSupplementFee, totalCount, err } + +func GetOrdersSupplementNoPage(db *DaoDB, ID int, storIDs, vendorIDs, statuss []int, vendorOrderID string, fromTime, toTime time.Time, stype, IsReverse int) (orderSupplementFee []*model.OrderSupplementFee, err error) { + sql := ` + SELECT * + FROM order_supplement_fee + WHERE 1=1 + AND deleted_at = ? + ` + sqlParams := []interface{}{ + utils.DefaultTimeValue, + } + if !utils.IsTimeZero(fromTime) { + sql += " AND supplement_time >= ?" + sqlParams = append(sqlParams, fromTime) + } + if !utils.IsTimeZero(toTime) { + sql += " AND supplement_time <= ?" + sqlParams = append(sqlParams, toTime) + } + if len(storIDs) > 0 { + sql += " AND store_id IN (" + GenQuestionMarks(len(storIDs)) + ")" + sqlParams = append(sqlParams, storIDs) + } + if len(vendorIDs) > 0 { + sql += " AND vendor_id IN (" + GenQuestionMarks(len(vendorIDs)) + ")" + sqlParams = append(sqlParams, vendorIDs) + } + if vendorOrderID != "" { + sql += " AND vendor_order_id = ?" + sqlParams = append(sqlParams, vendorOrderID) + } + if len(statuss) > 0 { + sql += " AND status IN (" + GenQuestionMarks(len(statuss)) + ")" + sqlParams = append(sqlParams, statuss) + } + if stype > 0 { + sql += " AND type = ?" + sqlParams = append(sqlParams, stype) + } + if ID > 0 { + sql += " AND id = ?" + sqlParams = append(sqlParams, ID) + } + if IsReverse == -1 { + sql += " AND link_id = 0" + } else if IsReverse == 1 { + sql += " AND link_id <> 0" + } + err = GetRows(db, &orderSupplementFee, sql, sqlParams...) + return orderSupplementFee, err +} diff --git a/business/model/dao/report.go b/business/model/dao/report.go index e65873b69..1d47e3c70 100644 --- a/business/model/dao/report.go +++ b/business/model/dao/report.go @@ -189,8 +189,11 @@ func GetGetStatisticsReportForAfsOrders(db *DaoDB, storeIDs []int, fromDate time } func GetStatisticsReportForStoreSkusPrice(db *DaoDB, cityCodes, skuIDs []int) (priceReferSnapshot []*model.PriceReferSnapshot, err error) { - sql := ` - SELECT b.city_code,a.sku_id,c.name_id, + var sql string + sql1 := ` + SELECT a.sku_id, c.name_id, + ` + sql2 := ` MAX(a.jd_price) max_jd_price, MIN(a.jd_price) min_jd_price, ROUND(AVG(a.jd_price)) avg_jd_price, @@ -220,6 +223,7 @@ func GetStatisticsReportForStoreSkusPrice(db *DaoDB, cityCodes, skuIDs []int) (p )t1 ON t1.sku_id = a.sku_id WHERE a.deleted_at = ? ` + sql = sql1 + "b.city_code, " + sql2 sqlParams := []interface{}{ utils.DefaultTimeValue, model.StoreStatusDisabled, @@ -234,7 +238,19 @@ func GetStatisticsReportForStoreSkusPrice(db *DaoDB, cityCodes, skuIDs []int) (p sql += " AND b.city_code IN (" + GenQuestionMarks(len(cityCodes)) + ")" sqlParams = append(sqlParams, cityCodes) } - sql += " GROUP BY 1,2,3" + sql += ` GROUP BY 1,2,3 + UNION ` + sql += sql1 + "0 city_code," + sql2 + if len(skuIDs) > 0 { + sql += " AND a.sku_id IN (" + GenQuestionMarks(len(skuIDs)) + ")" + sqlParams = append(sqlParams, skuIDs) + } + if len(cityCodes) > 0 { + sql += " AND b.city_code IN (" + GenQuestionMarks(len(cityCodes)) + ")" + sqlParams = append(sqlParams, cityCodes) + } + sql += " GROUP BY 1,2" + sqlParams = append(sqlParams, sqlParams...) if err = GetRows(db, &priceReferSnapshot, sql, sqlParams...); err == nil { return priceReferSnapshot, nil } @@ -243,9 +259,9 @@ func GetStatisticsReportForStoreSkusPrice(db *DaoDB, cityCodes, skuIDs []int) (p func GetPriceReferSnapshot(db *DaoDB, cityCodes, skuIDs []int, skuNameID int, snapDate time.Time, offset, pageSize int) (priceReferSnapshot []*PriceReferSnapshotExt, totalCount int, err error) { sql := ` - SELECT SQL_CALC_FOUND_ROWS a.*,b.name city_name + SELECT SQL_CALC_FOUND_ROWS a.*,IF(a.city_code = 0,'全国',b.name) city_name FROM price_refer_snapshot a - JOIN place b ON a.city_code = b.code + LEFT JOIN place b ON a.city_code = b.code WHERE 1=1 AND a.deleted_at = ? ` diff --git a/business/model/dao/store.go b/business/model/dao/store.go index f3a3e62a5..56a713cb3 100644 --- a/business/model/dao/store.go +++ b/business/model/dao/store.go @@ -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) { 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 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 != ? diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index a65324e24..2e8f0e352 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -138,6 +138,7 @@ type StoreSkuNameExt struct { PendingOpType int8 `json:"pendingOpType"` // 取值同 StoreOpRequest.Type PendingUnitPrice int `json:"pendingUnitPrice"` // 这个是待审核的价格申请 Status int + RealMidUnitPrice int `json:"realMidUnitPrice"` } // GetStoreSkus用 @@ -206,11 +207,12 @@ type StoreSkuExt struct { type SkuNameAndPlace struct { model.SkuName - CityCode int `json:"cityCode"` - CityName string `json:"cityName"` - Sequence int `json:"sequence"` - Count int `json:"count"` - Type int `json:"type"` + CityCode int `json:"cityCode"` + CityName string `json:"cityName"` + Sequence int `json:"sequence"` + Count int `json:"count"` + Type int `json:"type"` + Skus []*model.SkuAndName `json:"skus"` } type StoreSkuPriceAndWeight struct { diff --git a/business/model/order.go b/business/model/order.go index 0b1428818..71c300506 100644 --- a/business/model/order.go +++ b/business/model/order.go @@ -347,8 +347,8 @@ type OrderPayRefund struct { type OrderSupplementFee struct { ModelIDCULD StoreID int `orm:"column(store_id)" json:"storeID"` - VendorOrderID *string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"` - VendorID *string `orm:"column(vendor_id)" json:"vendorID"` + VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"` + VendorID *int `orm:"column(vendor_id);null" json:"vendorID"` Status int `json:"status"` //账单状态,若已结账则不允许再修改 ,暂时 0为未结账,1为已结账,-1为作废 LinkID int `orm:"column(link_id)" json:"linkID"` //作为冲账标志关联某条扣款记录 SupplementTime *time.Time `orm:"type(datetime);null" json:"supplementTime"` diff --git a/business/model/store.go b/business/model/store.go index 553f564b9..26ade2838 100644 --- a/business/model/store.go +++ b/business/model/store.go @@ -475,7 +475,7 @@ type PriceReferSnapshot struct { func (*PriceReferSnapshot) TableUnique() [][]string { return [][]string{ - []string{"CityCode", "SkuID", "SnapshotAt"}, + []string{"CityCode", "NameID", "SkuID", "SnapshotAt"}, } } diff --git a/controllers/cms_store_sku.go b/controllers/cms_store_sku.go index 9f6adbf28..9ad689e1c 100644 --- a/controllers/cms_store_sku.go +++ b/controllers/cms_store_sku.go @@ -467,7 +467,7 @@ func (c *StoreSkuController) GetMissingStoreSkuFromOrder() { // @Title 根据门店信息查找推荐商品(按销量) // @Description 根据门店信息查找推荐商品(按销量) -// @Param token header string true "认证token" +// @Param token header string false "认证token" // @Param storeIDs query string true "门店列表" // @Success 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult @@ -499,7 +499,7 @@ func (c *StoreSkuController) GetTopSkusByCityCode() { // @Title 根据门店信息查找推荐分类(按商品销量) // @Description 根据门店信息查找推荐分类(按商品销量) -// @Param token header string true "认证token" +// @Param token header string false "认证token" // @Param storeIDs query string true "门店列表" // @Success 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult diff --git a/controllers/jx_order.go b/controllers/jx_order.go index e9372bfab..dffe0768f 100644 --- a/controllers/jx_order.go +++ b/controllers/jx_order.go @@ -934,7 +934,7 @@ func (c *OrderController) ComplaintRider() { // @Param vendorIDs query string false "订单所属厂商ID列表" // @Param fromTime query string false "开始日期(包含),格式(2006-01-02),如果订单号为空此项必须要求" // @Param toTime query string false "结束日期(包含),格式(2006-01-02),如果订单号为空此项必须要求" -// @Param status query int false "账单状态,0是未结账,1是已结账" +// @Param statuss query string false "账单状态列表,0是未结账,1是已结账,-1为作废" // @Param type query int false "扣款类型,1为差评补贴,2为优惠券" // @Param isReverse query int false "只查冲账记录,0为默认都查,1为只查冲账,-1为不查冲账" // @Param offset query int false "结果起始序号(以0开始,缺省为0)" @@ -943,10 +943,10 @@ func (c *OrderController) ComplaintRider() { // @Failure 200 {object} controllers.CallResult // @router /GetOrdersSupplement [get] func (c *OrderController) GetOrdersSupplement() { - var vendorIDList, storeIDList []int + var vendorIDList, storeIDList, statusList []int c.callGetOrdersSupplement(func(params *tOrderGetOrdersSupplementParams) (retVal interface{}, errCode string, err error) { - if err = jxutils.Strings2Objs(params.VendorIDs, &vendorIDList, params.StoreIDs, &storeIDList); err == nil { - retVal, err = orderman.GetOrdersSupplement(params.Ctx, storeIDList, vendorIDList, params.VendorOrderID, params.FromTime, params.ToTime, params.Status, params.Type, params.IsReverse, params.Offset, params.PageSize) + if err = jxutils.Strings2Objs(params.VendorIDs, &vendorIDList, params.StoreIDs, &storeIDList, params.Statuss, &statusList); err == nil { + retVal, err = orderman.GetOrdersSupplement(params.Ctx, storeIDList, vendorIDList, statusList, params.VendorOrderID, params.FromTime, params.ToTime, params.Type, params.IsReverse, params.Offset, params.PageSize) } return retVal, "", err })