冲突
This commit is contained in:
@@ -1367,3 +1367,32 @@ func GetOrderStoreSkusCount(db *DaoDB, storeID, skuID int, fromTime, toTime time
|
||||
}
|
||||
return count, err
|
||||
}
|
||||
func GetSupplySupportStoreSkus(db *DaoDB, fromDate, toDate time.Time, fromStoreID, storeID int, percentage float64) (orderSkus []*model.OrderSku, err error) {
|
||||
sql := `
|
||||
SELECT c.sku_id,CEIL(c.count) count,CEIL(c.count) * d.jx_price sale_price
|
||||
FROM
|
||||
(
|
||||
SELECT a.sku_id,SUM(a.count * ? ) count FROM order_sku a
|
||||
JOIN goods_order b ON b.vendor_order_id = a.vendor_order_id AND a.vendor_id = b.vendor_id
|
||||
WHERE b.order_created_at > ?
|
||||
AND b.order_created_at < ?
|
||||
AND a.sku_id <> ?
|
||||
AND IF(b.store_id = 0,b.jx_store_id,b.store_id) = ?
|
||||
GROUP BY 1
|
||||
)c
|
||||
JOIN store_sku_bind d ON d.store_id = ? AND d.sku_id = c.sku_id AND d.deleted_at = ?
|
||||
ORDER BY c.count desc
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
percentage,
|
||||
fromDate,
|
||||
toDate,
|
||||
6039481, //葱姜蒜
|
||||
fromStoreID,
|
||||
storeID, utils.DefaultTimeValue,
|
||||
}
|
||||
if err = GetRows(db, &orderSkus, sql, sqlParams); err == nil {
|
||||
return orderSkus, err
|
||||
}
|
||||
return orderSkus, err
|
||||
}
|
||||
|
||||
@@ -49,8 +49,9 @@ type StoreDetail struct {
|
||||
OperatorName2 string `json:"operatorName2"`
|
||||
OperatorName3 string `json:"operatorName3"`
|
||||
|
||||
JdStoreLevel string `json:"jdStoreLevel"` //京东门店等级
|
||||
IsOrder int `json:"isOrder"` //是否是下预订单门店
|
||||
JdStoreLevel string `json:"jdStoreLevel"` //京东门店等级
|
||||
IsOrder int `json:"isOrder"` //是否是下预订单门店
|
||||
IsSupplyGoods int `json:"isSupplyGoods"`
|
||||
|
||||
YbAppID string `orm:"column(yb_app_id)" json:"ybAppID"`
|
||||
YbAppKey string `json:"ybAppKey"`
|
||||
@@ -99,7 +100,7 @@ func getStoreDetail(db *DaoDB, storeID, vendorID int, vendorStoreID string) (sto
|
||||
SELECT t1.*,
|
||||
t2.vendor_store_id, t2.status vendor_status, t2.delivery_fee_deduction_sill, t2.delivery_fee_deduction_fee, t2.sync_status, t2.vendor_org_code,
|
||||
t2.price_percentage, t2.auto_pickup, t2.delivery_type, t2.delivery_competition, t2.is_sync, t2.vendor_store_name, t2.is_order, t2.yb_app_id, t2.yb_app_key, t2.yb_store_prefix,
|
||||
t2.jds_street_code, t2.jds_street_name,
|
||||
t2.jds_street_code, t2.jds_street_name, t2.is_supply_goods,
|
||||
t3.value price_percentage_pack_str,
|
||||
t4.value freight_deduction_pack_str,
|
||||
province.name province_name,
|
||||
@@ -204,7 +205,7 @@ func GetStoreDetail2(db *DaoDB, storeID int, vendorStoreID string, vendorID int)
|
||||
return storeDetail, err
|
||||
}
|
||||
|
||||
func GetStoreCourierList(db *DaoDB, storeIDs []int, status, auditStatus int) (courierStoreList []*model.StoreCourierMap, err error) {
|
||||
func GetStoreCourierList(db *DaoDB, storeIDs, vendorIDs []int, status, auditStatus int) (courierStoreList []*model.StoreCourierMap, err error) {
|
||||
sql := `
|
||||
SELECT t1.*
|
||||
FROM store_courier_map t1
|
||||
@@ -217,6 +218,10 @@ func GetStoreCourierList(db *DaoDB, storeIDs []int, status, auditStatus int) (co
|
||||
sql += " AND t1.store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")"
|
||||
sqlParams = append(sqlParams, storeIDs)
|
||||
}
|
||||
if len(vendorIDs) > 0 {
|
||||
sql += " AND t1.vendor_id IN (" + GenQuestionMarks(len(vendorIDs)) + ")"
|
||||
sqlParams = append(sqlParams, vendorIDs)
|
||||
}
|
||||
if status != model.StoreStatusAll {
|
||||
sql += " AND t1.status = ?"
|
||||
sqlParams = append(sqlParams, status)
|
||||
|
||||
@@ -62,6 +62,7 @@ type StoreSkuSyncInfo struct {
|
||||
|
||||
Price int64
|
||||
UnitPrice int64
|
||||
Stock int
|
||||
|
||||
// 平台相关的store sku信息
|
||||
StoreSkuStatus int
|
||||
@@ -212,6 +213,7 @@ type StoreSkuExt struct {
|
||||
SkuSpecUnit string `orm:"size(8)" json:"specUnit"` // 质量或容量
|
||||
Weight int `json:"weight"` // 重量/质量,单位为克,当相应的SkuName的SpecUnit为g或kg时,必须等于SpecQuality
|
||||
SkuStatus int `json:"status"`
|
||||
Stock int `json:"stock"`
|
||||
|
||||
BindCreatedAt time.Time `orm:"auto_now_add;type(datetime)" json:"createdAt"`
|
||||
BindUpdatedAt time.Time `orm:"auto_now;type(datetime)" json:"updatedAt"`
|
||||
@@ -429,7 +431,7 @@ func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, mustDirty boo
|
||||
t14.vendor_id, t14.vendor_org_code,
|
||||
t1.id bind_id, t1.sku_id, t1.price, t1.unit_price, t1.status store_sku_status,
|
||||
%s vendor_sku_id, t1.%s_sync_status sku_sync_status, t1.%s_price vendor_price, t1.%s_lock_time lock_time,
|
||||
t1.store_id, t1.deleted_at bind_deleted_at,t1.status_sale_begin,t1.status_sale_end, t1.jds_ware_id,
|
||||
t1.store_id, t1.deleted_at bind_deleted_at,t1.status_sale_begin,t1.status_sale_end, t1.jds_ware_id, t1.stock,
|
||||
t2.*,
|
||||
t3.id name_id, t3.prefix, t3.name, t3.unit, t3.upc, t3.status name_status, t3.category_id name_category_id, t3.yb_name_suffix,
|
||||
t3.jds_stock_switch, t3.preparation_time, t3.img_watermark, t3.ex_vendor_id, t3.img img_origin,
|
||||
@@ -1106,7 +1108,8 @@ func GetTopSkusByStoreIDs(db *DaoDB, storeIDs []int) (storeSkuNameExt []*StoreSk
|
||||
t4.sub_store_id, t4.price bind_price, IF(t4.unit_price IS NOT NULL, t4.unit_price, t1.price) unit_price, t4.status store_sku_status, t4.auto_sale_at,
|
||||
t4.ebai_id, t4.mtwm_id,
|
||||
t4.ebai_sync_status, t4.mtwm_sync_status,
|
||||
t4.jd_price, t4.ebai_price, t4.mtwm_price, t4.jx_price, a.spec_quality sku_spec_quality, a.spec_unit sku_spec_unit
|
||||
t4.jd_price, t4.ebai_price, t4.mtwm_price, t4.jx_price, t4.stock,
|
||||
a.spec_quality sku_spec_quality, a.spec_unit sku_spec_unit
|
||||
FROM sku a
|
||||
JOIN sku_name t1 ON a.name_id = t1.id AND t1.deleted_at = ?
|
||||
JOIN store_sku_bind t4 ON t4.sku_id = a.id AND t4.deleted_at = ?
|
||||
|
||||
@@ -17,7 +17,7 @@ func TestGetStoreDetail(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetStoreCourierList(t *testing.T) {
|
||||
storeCourierList, err := GetStoreCourierList(GetDB(), []int{100119}, model.StoreStatusOpened, model.StoreAuditStatusOnline)
|
||||
storeCourierList, err := GetStoreCourierList(GetDB(), []int{100119}, nil, model.StoreStatusOpened, model.StoreAuditStatusOnline)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -117,6 +117,10 @@ func IsSyncStatusPrice(syncStatus int8) bool {
|
||||
return (syncStatus & SyncFlagPriceMask) != 0
|
||||
}
|
||||
|
||||
func IsSyncStatusStock(syncStatus int8) bool {
|
||||
return (syncStatus & SyncFlagStockMask) != 0
|
||||
}
|
||||
|
||||
func IsSyncStatusSeq(syncStatus int8) bool {
|
||||
return (syncStatus & SyncFlagSeqMask) != 0
|
||||
}
|
||||
|
||||
@@ -26,6 +26,12 @@ const (
|
||||
EarningTypePoints = 2 //扣点模式
|
||||
)
|
||||
|
||||
const (
|
||||
OrderTypeNormal = 0 //普通订单
|
||||
OrderTypeMatter = 0 //物料订单
|
||||
OrderTypeSupplyGoods = 2 //进货订单
|
||||
)
|
||||
|
||||
var (
|
||||
PayStatusName = map[int]string{
|
||||
PayStatusNo: "待支付",
|
||||
@@ -111,6 +117,7 @@ type GoodsOrder struct {
|
||||
EclpOutID string `orm:"column(eclp_out_id)" json:"eclpOutID"` //物料配送的出库单号
|
||||
AddressID int64 `orm:"column(address_id)" json:"addressID"` //配送地址ID
|
||||
EarningType int `json:"earningType"` //订单结算方式,2为扣点,1为报价
|
||||
OrderType int `json:"orderType"` //订单类型,0为普通订单,1为物料订单,2为进货订单
|
||||
|
||||
// 以下只是用于传递数据
|
||||
OriginalData string `orm:"-" json:"-"`
|
||||
|
||||
@@ -438,13 +438,13 @@ type StoreMap struct {
|
||||
JdsStreetCode int `orm:"default(0)" json:"jdsStreetCode"` //京东商城直辖市街道code
|
||||
JdsStreetName string `orm:"size(32)" json:"jdsStreetName"` //京东商城直辖市街道
|
||||
|
||||
IsOrder int `orm:"default(0)" json:"isOrder"` //是否是下预订单门店
|
||||
IsOrder int `orm:"default(0)" json:"isOrder"` //是否是下预订单门店
|
||||
IsSysCat int `orm:"default(0)" json:"isSysCat"` //是否使用京西分类
|
||||
IsSupplyGoods int `orm:"default(0)" json:"isSupplyGoods"` // 是否是货源门店
|
||||
|
||||
YbAppID string `orm:"column(yb_app_id);size(255)" json:"ybAppID"`
|
||||
YbAppKey string `orm:"size(255)" json:"ybAppKey"`
|
||||
YbStorePrefix string `orm:"size(255)" json:"ybStorePrefix"`
|
||||
|
||||
IsSysCat int `orm:"default(0)" json:"isSysCat"` //是否使用京西分类
|
||||
}
|
||||
|
||||
func (*StoreMap) TableUnique() [][]string {
|
||||
|
||||
Reference in New Issue
Block a user