1
This commit is contained in:
@@ -883,7 +883,7 @@ func (c *OrderManager) GetStoresOrderSaleInfo(ctx *jxcontext.Context, storeIDLis
|
||||
return c.GetStoresOrderSaleInfoNew(ctx, storeIDList, fromTime, toTime, statusList)
|
||||
}
|
||||
|
||||
func (c *OrderManager) GetStoresOrderSaleInfo2(ctx *jxcontext.Context, fromTime time.Time, toTime time.Time, storeId int, brandId, vendorId, storeList []int, mapStoreData map[int]int) (map[string]interface{}, error) {
|
||||
func (c *OrderManager) GetStoresOrderSaleInfo2(ctx *jxcontext.Context, fromTime time.Time, toTime time.Time, storeId int, brandId, vendorId, storeList []int) (map[string]interface{}, error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
)
|
||||
@@ -914,7 +914,13 @@ func (c *OrderManager) GetStoresOrderSaleInfo2(ctx *jxcontext.Context, fromTime
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return map[string]interface{}{"storeStatus": storeStatus, "orderStatus": orderStatus, "afsOrderStatus": afsOrderStatus}, nil
|
||||
// 统计收益
|
||||
incomeStatics, err := dao.StatisticsIncome(db, fromTime, toTime, storeId, brandId, vendorId, storeList)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return map[string]interface{}{"storeStatus": storeStatus, "orderStatus": orderStatus, "afsOrderStatus": afsOrderStatus, "incomeStatics": incomeStatics}, nil
|
||||
}
|
||||
|
||||
func (c *OrderManager) GetStoresOrderSaleInfoNew(ctx *jxcontext.Context, storeIDList []int, fromTime time.Time, toTime time.Time, statusList []int) (saleInfoList []*dao.StoresOrderSaleInfo, err error) {
|
||||
|
||||
@@ -12,100 +12,6 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
)
|
||||
|
||||
// 带购物平台信息的
|
||||
type StoreDetail struct {
|
||||
model.Store
|
||||
|
||||
VendorOrgCode string `orm:"size(32)" json:"vendorOrgCode"` // 同一平台下不同的商户代码,如果只有一个,可以为空
|
||||
|
||||
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"`
|
||||
VendorStoreName string `json:"vendorStoreName"`
|
||||
VendorStatus int `json:"vendor_status"` // 取值同Store.Status
|
||||
VendorPayPercentage int `json:"vendorPayPercentage"` //平台结算比例,大于50是报价门店
|
||||
DeliveryFeeDeductionSill int `json:"deliveryFeeDeductionSill"`
|
||||
DeliveryFeeDeductionFee int `json:"deliveryFeeDeductionFee"`
|
||||
SyncStatus int8 `orm:"default(2)" json:"syncStatus"`
|
||||
|
||||
PricePercentage int16 `orm:"default(100)" json:"pricePercentage"` // todo 厂商价格相对于本地价格的百分比,这个字段的修改会比较特殊,因为可能需要刷新厂商价格
|
||||
PricePercentagePackStr string `orm:"size(4096)" json:"-"` //
|
||||
PricePercentagePackObj model.PricePercentagePack `orm:"-" json:"-"`
|
||||
CreateDeliveryType int `orm:"default(0)" json:"createDeliveryType"` //默认0系统(品牌)发单,1为门店发单
|
||||
|
||||
FreightDeductionPackStr string `orm:"size(4096)" json:"-"` //
|
||||
FreightDeductionPackObj *model.FreightDeductionPack `orm:"-" json:"-"`
|
||||
|
||||
AutoPickup int8 `orm:"default(1)" json:"autoPickup"` // 是否自动拣货
|
||||
DeliveryType int8 `orm:"default(0)" json:"deliveryType"` // 配送类型
|
||||
DeliveryCompetition int8 `orm:"default(1)" json:"deliveryCompetition"` // 是否支持配送竞争
|
||||
IsSync int8 `orm:"default(1)" json:"isSync"` // 是否同步
|
||||
IsService int `orm:"default(0)" json:"isService"` // 默认0非服务商,1服务商
|
||||
|
||||
DistrictName string `json:"districtName"`
|
||||
CityName string `json:"cityName"`
|
||||
ProvinceName string `json:"provinceName"` //省名
|
||||
ProvinceCode int `json:"provinceCode"` //省名
|
||||
JdCityCode int `json:"jdCityCode"` //京东市code
|
||||
JdCode int `json:"jdCode"` //京东区code
|
||||
JdsCode int `json:"jdsCode"` //京东商城地址代码
|
||||
JdsStreetCode int `json:"jdsStreetCode"` //京东商城直辖市街道code
|
||||
JdsStreetName string `json:"jdsStreetName"` //京东商城直辖市街道
|
||||
|
||||
IsAutoOrder int8 `json:"isAutoOrder"` // 平台是否自动接单,-1:否,0:未知,1:是
|
||||
MarketManName string `json:"marketManName"` //市场负责人
|
||||
OperatorName string `json:"operatorName"` //运营负责人
|
||||
OperatorName2 string `json:"operatorName2"`
|
||||
OperatorName3 string `json:"operatorName3"`
|
||||
|
||||
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"`
|
||||
YbStorePrefix string `json:"ybStorePrefix"` //vendorID=14 暂存打包费 / vendorID = 1 暂存美团门店地址
|
||||
|
||||
MtwmToken string `json:"mtwmToken"` // 当vendor为美团时存储美团token,为抖店时存储抖店token,也储存淘鲜达token,其他品牌门店授权时appkey相同时token不相同
|
||||
EbaiSupplierID string `json:"ebaiSupplierID"`
|
||||
|
||||
BrandName string `json:"brandName"` //品牌信息
|
||||
BrandLogo string `json:"brandLogo"`
|
||||
BrandIsOpen int `json:"brandIsOpen"`
|
||||
BrandIsPrint int `json:"brandIsPrint"`
|
||||
}
|
||||
|
||||
// 带快递门店信息的
|
||||
type StoreDetail2 struct {
|
||||
model.Store
|
||||
|
||||
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
|
||||
VendorStoreID string `orm:"column(vendor_store_id)" json:"vendorStoreID"` // 这个其实是京西快递门店ID的概念
|
||||
CourierStatus int `json:"courierStatus"`
|
||||
AuditStatus int `json:"auditStatus"`
|
||||
|
||||
DistrictName string `json:"districtName"`
|
||||
CityName string `json:"cityName"`
|
||||
}
|
||||
|
||||
type CityBrankBranch struct {
|
||||
CityCode int
|
||||
PayeeBankBranchName string `orm:"size(255)" json:"payeeBankBranchName"` // 开户支行
|
||||
PayeeBankCode string `orm:"size(8)" json:"payeeBankCode"` // 开户行代码
|
||||
}
|
||||
|
||||
type StorePriceScore struct {
|
||||
StoreID int `orm:"column(store_id)" json:"storeID"`
|
||||
StoreName string `json:"storeName"`
|
||||
StoreScore float64 `json:"storeScore"`
|
||||
CityName string `json:"cityName"`
|
||||
DirectDownCount int `json:"directDownCount"`
|
||||
SecKillCount int `json:"secKillCount"`
|
||||
}
|
||||
|
||||
type StorePriceScoreEx struct {
|
||||
StorePriceScoreList []*StorePriceScore `json:"storePriceScoreList"`
|
||||
TotalCount int `json:"totalCount"`
|
||||
}
|
||||
|
||||
func (s *StoreDetail) GetPricePerentage(price int) (pricePercentage int) {
|
||||
return pricePercentage
|
||||
}
|
||||
@@ -196,9 +102,11 @@ func getStoreDetail(db *DaoDB, storeID, vendorID int, vendorStoreID, vendorOrgCo
|
||||
func GetStoreDetail(db *DaoDB, storeID, vendorID int, vendorOrgCode string) (storeDetail *StoreDetail, err error) {
|
||||
return getStoreDetail(db, storeID, vendorID, "", vendorOrgCode)
|
||||
}
|
||||
|
||||
func GetStoreDetailForDD(db *DaoDB, storeID, vendorID int, vendorStoreID, vendorOrgCode string) (storeDetail *StoreDetail, err error) {
|
||||
return getStoreDetail(db, storeID, vendorID, vendorStoreID, vendorOrgCode)
|
||||
}
|
||||
|
||||
func GetStoreDetailByVendorStoreID(db *DaoDB, vendorStoreID string, vendorID int, vendorOrgCode string) (storeDetail *StoreDetail, err error) {
|
||||
if vendorID != model.VendorIDJX {
|
||||
return getStoreDetail(db, 0, vendorID, vendorStoreID, vendorOrgCode)
|
||||
@@ -475,13 +383,6 @@ func GetRebindPrinterStoreList(db *DaoDB) (storeList []*model.Store, err error)
|
||||
return storeList, err
|
||||
}
|
||||
|
||||
// 容错用
|
||||
type tPricePercentageItemFloat struct {
|
||||
BeginPrice float64 `json:"beginPrice"` // 起始价格区间(包括)
|
||||
PricePercentage float64 `json:"pricePercentage"` // 调价比例
|
||||
PriceAdd float64 `json:"priceAdd"` // 调价额定值
|
||||
}
|
||||
|
||||
func PricePercentagePack2Obj(packStr string) (obj model.PricePercentagePack) {
|
||||
if packStr != "" {
|
||||
var floatObj []*tPricePercentageItemFloat
|
||||
@@ -956,12 +857,6 @@ func GetStoreAudit(db *DaoDB, auditStatuss []int, userID, keyword string) (store
|
||||
return storeAudit, err
|
||||
}
|
||||
|
||||
type tStoreAudit struct {
|
||||
model.StoreAudit
|
||||
UserName string `json:"userName"`
|
||||
CityName string `json:"cityName"`
|
||||
}
|
||||
|
||||
func GetStoreAuditPage(db *DaoDB, statuss []int, keyword string, applyTimeStart, applyTimeEnd, auditTimeStart, auditTimeEnd time.Time, pageSize, offset int) (pagedInfo *model.PagedInfo, err error) {
|
||||
var requestList []*tStoreAudit
|
||||
sql := `
|
||||
@@ -1206,14 +1101,6 @@ func GetStoreAcctExpendLastCreateWayBillFee(db *DaoDB, vendorOrderID string) (ex
|
||||
return expend, lastFee, err
|
||||
}
|
||||
|
||||
type GetStoreManageStateResult struct {
|
||||
StoreName string `json:"storeName"`
|
||||
VendorStoreID string `orm:"column(vendor_store_id)" json:"vendorStoreID"`
|
||||
MarketScale int `json:"marketScale"` //市场规模
|
||||
Comment string `json:"comment"`
|
||||
model.StoreManageState
|
||||
}
|
||||
|
||||
func GetStoreManageState(db *DaoDB, storeIDs, brandIDs []int, vendorID, sortType, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) {
|
||||
var (
|
||||
requestList []*GetStoreManageStateResult
|
||||
@@ -1350,11 +1237,6 @@ func GetStoreMapAudit(db *DaoDB, storeIDs, vendorIDs, auditStatuss []int, fromTi
|
||||
return page, err
|
||||
}
|
||||
|
||||
type GetBrandUserResult struct {
|
||||
model.BrandUser
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
func GetBrandUser(db *DaoDB, brandID int, userID string) (brandUsers []*GetBrandUserResult, err error) {
|
||||
sql := `
|
||||
SELECT a.*, b.name
|
||||
@@ -1560,10 +1442,6 @@ func InsertBrandCategories(db *DaoDB, userName string, brandID int) (err error)
|
||||
// }
|
||||
//}
|
||||
|
||||
type RefundOrder struct {
|
||||
OrderId string
|
||||
}
|
||||
|
||||
func GetBrandBill2(db *DaoDB, brandID int, vendorOrderID string, billType, feeType int, vendorWaybillOrderID string, createAt string) (result []*RefundOrder, err error) {
|
||||
vendor := []int{101, 102, 103}
|
||||
brandID2 := []int{131, 132, 137, 139}
|
||||
@@ -1580,11 +1458,6 @@ func GetBrandBill2(db *DaoDB, brandID int, vendorOrderID string, billType, feeTy
|
||||
return data, err
|
||||
}
|
||||
|
||||
type BrandInfos struct {
|
||||
Name string
|
||||
Logo string
|
||||
}
|
||||
|
||||
//获取门店品牌信息
|
||||
func GetStoreBrandInfos(storeID int) (date *BrandInfos, err error) {
|
||||
var detail *BrandInfos
|
||||
@@ -1599,8 +1472,6 @@ func GetStoreBrandInfos(storeID int) (date *BrandInfos, err error) {
|
||||
return detail, err
|
||||
}
|
||||
|
||||
var FreightTemplateMap = make(map[int]*model.FreightTemplate)
|
||||
|
||||
// 查询FreightTemplate
|
||||
func QueryStoreBindInfo(storeID int) (*model.FreightTemplate, error) {
|
||||
if storeID == model.NO {
|
||||
@@ -1692,11 +1563,6 @@ func GetStoreBaseByVendorStoreID(vendorStoreID string, vendorID int) (storeDetai
|
||||
return storeDetail, err
|
||||
}
|
||||
|
||||
type StatisticsStore struct {
|
||||
Count int `json:"count"` // 条数
|
||||
Status int `json:"status"` // 状态
|
||||
}
|
||||
|
||||
// StatisticsStoreInfo 统计所有的门店信息
|
||||
func StatisticsStoreInfo(db *DaoDB, brandId, vendorId, storeList []int) ([]*StatisticsStore, error) {
|
||||
statistics := make([]*StatisticsStore, 0, 0)
|
||||
@@ -1726,12 +1592,6 @@ func StatisticsStoreInfo(db *DaoDB, brandId, vendorId, storeList []int) ([]*Stat
|
||||
return statistics, nil
|
||||
}
|
||||
|
||||
type StatisticsOrder struct {
|
||||
Count int `json:"count"` // 条数
|
||||
Status int `json:"status"` // 状态
|
||||
TotalShopMoney int `json:"total_shop_money"` // 订单金额
|
||||
}
|
||||
|
||||
// StatisticsOrderInfo 统计订单信息
|
||||
func StatisticsOrderInfo(db *DaoDB, startTime, endTime time.Time, storeId int, brandId, vendorId, storeList []int) ([]*StatisticsOrder, error) {
|
||||
parma := []interface{}{}
|
||||
@@ -1796,3 +1656,43 @@ func StatisticsAfsOrderInfo(db *DaoDB, startTime, endTime time.Time, storeId int
|
||||
}
|
||||
return orderStatistics, nil
|
||||
}
|
||||
|
||||
// StatisticsIncome 统计平台和市场收入
|
||||
func StatisticsIncome(db *DaoDB, startTime, endTime time.Time, storeId int, brandId, vendorId, storeList []int) ([]*StatisticsIncomeInfo, error) {
|
||||
parma := []interface{}{}
|
||||
sql := `
|
||||
SELECT t1.jx_store_id id,t3.name,
|
||||
SUM(ROUND(IF(t1.earning_type = 1, t1.total_shop_money-t1.earning_price-IFNULL(t2.desired_fee,0), t1.total_shop_money *(t1.order_pay_percentage/2)/100),3)) total_income,
|
||||
SUM(ROUND(IF(t1.earning_type = 1, t1.total_shop_money-t1.earning_price-IFNULL(t2.desired_fee,0), t1.total_shop_money *(t1.order_pay_percentage/2)/100) * (t3.jx_brand_fee_factor/10),3)) jx_income,
|
||||
SUM(ROUND(IF(t1.earning_type = 1, t1.total_shop_money-t1.earning_price-IFNULL(t2.desired_fee,0), t1.total_shop_money *(t1.order_pay_percentage/2)/100) * (t3.market_add_fee_factor/10),3)) market_income
|
||||
FROM goods_order t1
|
||||
LEFT JOIN waybill t2 ON t1.vendor_waybill_id = t2.vendor_waybill_id AND t1.waybill_vendor_id = t2.waybill_vendor_id AND t1.vendor_order_id = t2.vendor_order_id
|
||||
LEFT JOIN store t3 ON t1.jx_store_id = t3.id
|
||||
WHERE t1.order_created_at >= ? AND t1.order_created_at <= ? AND t1.status = 110 `
|
||||
parma = append(parma, startTime, endTime)
|
||||
if storeId != model.NO {
|
||||
sql += ` AND t1.jx_store_id = ?`
|
||||
parma = append(parma, storeId)
|
||||
} else if len(storeList) != model.NO {
|
||||
sql += ` AND t1.jx_store_id IN (` + GenQuestionMarks(len(storeList)) + `)`
|
||||
parma = append(parma, storeList)
|
||||
}
|
||||
|
||||
if len(brandId) != model.NO {
|
||||
sql += ` AND t3.brand_id IN (` + GenQuestionMarks(len(storeList)) + `)`
|
||||
parma = append(parma, brandId)
|
||||
}
|
||||
if len(vendorId) != model.NO {
|
||||
sql += ` AND t1.vendor_id IN (` + GenQuestionMarks(len(vendorId)) + `)`
|
||||
parma = append(parma, brandId)
|
||||
}
|
||||
|
||||
sql += ` GROUP BY t1.jx_store_id`
|
||||
|
||||
incomeInfo := make([]*StatisticsIncomeInfo, 0, 0)
|
||||
if err := GetRows(db, &incomeInfo, sql, parma...); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return incomeInfo, nil
|
||||
}
|
||||
|
||||
155
business/model/dao/store_model.go
Normal file
155
business/model/dao/store_model.go
Normal file
@@ -0,0 +1,155 @@
|
||||
package dao
|
||||
|
||||
import "git.rosy.net.cn/jx-callback/business/model"
|
||||
|
||||
// 带购物平台信息的
|
||||
type StoreDetail struct {
|
||||
model.Store
|
||||
|
||||
VendorOrgCode string `orm:"size(32)" json:"vendorOrgCode"` // 同一平台下不同的商户代码,如果只有一个,可以为空
|
||||
|
||||
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"`
|
||||
VendorStoreName string `json:"vendorStoreName"`
|
||||
VendorStatus int `json:"vendor_status"` // 取值同Store.Status
|
||||
VendorPayPercentage int `json:"vendorPayPercentage"` //平台结算比例,大于50是报价门店
|
||||
DeliveryFeeDeductionSill int `json:"deliveryFeeDeductionSill"`
|
||||
DeliveryFeeDeductionFee int `json:"deliveryFeeDeductionFee"`
|
||||
SyncStatus int8 `orm:"default(2)" json:"syncStatus"`
|
||||
|
||||
PricePercentage int16 `orm:"default(100)" json:"pricePercentage"` // todo 厂商价格相对于本地价格的百分比,这个字段的修改会比较特殊,因为可能需要刷新厂商价格
|
||||
PricePercentagePackStr string `orm:"size(4096)" json:"-"` //
|
||||
PricePercentagePackObj model.PricePercentagePack `orm:"-" json:"-"`
|
||||
CreateDeliveryType int `orm:"default(0)" json:"createDeliveryType"` //默认0系统(品牌)发单,1为门店发单
|
||||
|
||||
FreightDeductionPackStr string `orm:"size(4096)" json:"-"` //
|
||||
FreightDeductionPackObj *model.FreightDeductionPack `orm:"-" json:"-"`
|
||||
|
||||
AutoPickup int8 `orm:"default(1)" json:"autoPickup"` // 是否自动拣货
|
||||
DeliveryType int8 `orm:"default(0)" json:"deliveryType"` // 配送类型
|
||||
DeliveryCompetition int8 `orm:"default(1)" json:"deliveryCompetition"` // 是否支持配送竞争
|
||||
IsSync int8 `orm:"default(1)" json:"isSync"` // 是否同步
|
||||
IsService int `orm:"default(0)" json:"isService"` // 默认0非服务商,1服务商
|
||||
|
||||
DistrictName string `json:"districtName"`
|
||||
CityName string `json:"cityName"`
|
||||
ProvinceName string `json:"provinceName"` //省名
|
||||
ProvinceCode int `json:"provinceCode"` //省名
|
||||
JdCityCode int `json:"jdCityCode"` //京东市code
|
||||
JdCode int `json:"jdCode"` //京东区code
|
||||
JdsCode int `json:"jdsCode"` //京东商城地址代码
|
||||
JdsStreetCode int `json:"jdsStreetCode"` //京东商城直辖市街道code
|
||||
JdsStreetName string `json:"jdsStreetName"` //京东商城直辖市街道
|
||||
|
||||
IsAutoOrder int8 `json:"isAutoOrder"` // 平台是否自动接单,-1:否,0:未知,1:是
|
||||
MarketManName string `json:"marketManName"` //市场负责人
|
||||
OperatorName string `json:"operatorName"` //运营负责人
|
||||
OperatorName2 string `json:"operatorName2"`
|
||||
OperatorName3 string `json:"operatorName3"`
|
||||
|
||||
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"`
|
||||
YbStorePrefix string `json:"ybStorePrefix"` //vendorID=14 暂存打包费 / vendorID = 1 暂存美团门店地址
|
||||
|
||||
MtwmToken string `json:"mtwmToken"` // 当vendor为美团时存储美团token,为抖店时存储抖店token,也储存淘鲜达token,其他品牌门店授权时appkey相同时token不相同
|
||||
EbaiSupplierID string `json:"ebaiSupplierID"`
|
||||
|
||||
BrandName string `json:"brandName"` //品牌信息
|
||||
BrandLogo string `json:"brandLogo"`
|
||||
BrandIsOpen int `json:"brandIsOpen"`
|
||||
BrandIsPrint int `json:"brandIsPrint"`
|
||||
}
|
||||
|
||||
// 带快递门店信息的
|
||||
type StoreDetail2 struct {
|
||||
model.Store
|
||||
|
||||
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
|
||||
VendorStoreID string `orm:"column(vendor_store_id)" json:"vendorStoreID"` // 这个其实是京西快递门店ID的概念
|
||||
CourierStatus int `json:"courierStatus"`
|
||||
AuditStatus int `json:"auditStatus"`
|
||||
|
||||
DistrictName string `json:"districtName"`
|
||||
CityName string `json:"cityName"`
|
||||
}
|
||||
|
||||
type CityBrankBranch struct {
|
||||
CityCode int
|
||||
PayeeBankBranchName string `orm:"size(255)" json:"payeeBankBranchName"` // 开户支行
|
||||
PayeeBankCode string `orm:"size(8)" json:"payeeBankCode"` // 开户行代码
|
||||
}
|
||||
|
||||
type StorePriceScore struct {
|
||||
StoreID int `orm:"column(store_id)" json:"storeID"`
|
||||
StoreName string `json:"storeName"`
|
||||
StoreScore float64 `json:"storeScore"`
|
||||
CityName string `json:"cityName"`
|
||||
DirectDownCount int `json:"directDownCount"`
|
||||
SecKillCount int `json:"secKillCount"`
|
||||
}
|
||||
|
||||
type StorePriceScoreEx struct {
|
||||
StorePriceScoreList []*StorePriceScore `json:"storePriceScoreList"`
|
||||
TotalCount int `json:"totalCount"`
|
||||
}
|
||||
|
||||
// 容错用
|
||||
type tPricePercentageItemFloat struct {
|
||||
BeginPrice float64 `json:"beginPrice"` // 起始价格区间(包括)
|
||||
PricePercentage float64 `json:"pricePercentage"` // 调价比例
|
||||
PriceAdd float64 `json:"priceAdd"` // 调价额定值
|
||||
}
|
||||
|
||||
type tStoreAudit struct {
|
||||
model.StoreAudit
|
||||
UserName string `json:"userName"`
|
||||
CityName string `json:"cityName"`
|
||||
}
|
||||
type GetStoreManageStateResult struct {
|
||||
StoreName string `json:"storeName"`
|
||||
VendorStoreID string `orm:"column(vendor_store_id)" json:"vendorStoreID"`
|
||||
MarketScale int `json:"marketScale"` //市场规模
|
||||
Comment string `json:"comment"`
|
||||
model.StoreManageState
|
||||
}
|
||||
type GetBrandUserResult struct {
|
||||
model.BrandUser
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
var FreightTemplateMap = make(map[int]*model.FreightTemplate)
|
||||
|
||||
type RefundOrder struct {
|
||||
OrderId string
|
||||
}
|
||||
|
||||
// BrandInfos 门店品牌信息
|
||||
type BrandInfos struct {
|
||||
Name string
|
||||
Logo string
|
||||
}
|
||||
|
||||
// StatisticsStore 门店信息统计
|
||||
type StatisticsStore struct {
|
||||
Count int `json:"count"` // 条数
|
||||
Status int `json:"status"` // 状态
|
||||
}
|
||||
|
||||
// StatisticsOrder 订单统计
|
||||
type StatisticsOrder struct {
|
||||
Count int `json:"count"` // 条数
|
||||
Status int `json:"status"` // 状态
|
||||
TotalShopMoney int `json:"total_shop_money"` // 订单金额
|
||||
}
|
||||
|
||||
// StatisticsIncomeInfo 统计门店收入情况
|
||||
type StatisticsIncomeInfo struct {
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
TotalIncome float64 `json:"total_income"`
|
||||
JxIncome float64 `json:"jx_income"`
|
||||
MarketIncome float64 `json:"market_income"`
|
||||
}
|
||||
@@ -14,7 +14,7 @@ dadaAppSecret = "7f97d8f258b70b450f04e7ab274ed8f8"
|
||||
|
||||
mtwmAppID = "589"
|
||||
mtwmSecret = "a81eb3df418d83d6a1a4b7c572156d2f"
|
||||
mtwmCallbackURL = "http://callback.jxc4.com"
|
||||
mtwmCallbackURL = "http:020c0aa40371cd112eecc034bb3dc094907ff925CreateSupermarketSigncallback.jxc4.com"
|
||||
|
||||
mtwmAppID2 = "5873"
|
||||
mtwmSecret2 = "41c479790a76f86326f89e8048964739"
|
||||
|
||||
@@ -506,6 +506,15 @@ func (c *OrderController) GetStoresOrderSaleInfo() {
|
||||
// @router /StaleIndexInfo [get]
|
||||
func (c *OrderController) StaleIndexInfo() {
|
||||
c.callStaleIndexInfo(func(params *tOrderStaleIndexInfoParams) (retVal interface{}, code string, err error) {
|
||||
var (
|
||||
storeList []*dao.StoreWithCityName
|
||||
dataList = make([]int, 0, len(storeList))
|
||||
mapDataList = make(map[int]int, len(storeList))
|
||||
isAdmin = false
|
||||
vendors []int
|
||||
brandIds []int
|
||||
)
|
||||
|
||||
timeList, err := jxutils.BatchStr2Time(params.FromTime, params.ToTime)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
@@ -520,26 +529,33 @@ func (c *OrderController) StaleIndexInfo() {
|
||||
return nil, "", fmt.Errorf("不能得到用户手机号,%s,%s", userID, mobile)
|
||||
}
|
||||
|
||||
var storeList []*dao.StoreWithCityName
|
||||
dataList := make([]int, 0, len(storeList))
|
||||
mapDataList := make(map[int]int, len(storeList))
|
||||
if storeList, err = cms.GetStoreList4User(ctx, mobile, userID); err == nil && len(storeList) > 0 {
|
||||
// todo,应该用通用方法
|
||||
for _, v := range storeList {
|
||||
dataList = append(dataList, v.Store.ID)
|
||||
mapDataList[v.Store.ID] = model.YES
|
||||
userRoles, err := dao.GetUserRole(dao.GetDB(), []string{userID}, nil)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
for _, role := range userRoles {
|
||||
if role.RoleID == model.YES {
|
||||
isAdmin = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if params.StoreID != 0 && mapDataList[params.StoreID] != model.YES {
|
||||
return retVal, "", fmt.Errorf("此门店%d,不归属于该用户%s", params.StoreID, ctx.GetUserName())
|
||||
|
||||
if !isAdmin {
|
||||
if storeList, err = cms.GetStoreList4User(ctx, mobile, userID); err == nil && len(storeList) > 0 {
|
||||
for _, v := range storeList {
|
||||
dataList = append(dataList, v.Store.ID)
|
||||
mapDataList[v.Store.ID] = model.YES
|
||||
}
|
||||
}
|
||||
if params.StoreID != 0 && mapDataList[params.StoreID] != model.YES {
|
||||
return retVal, "", fmt.Errorf("此门店%d,不归属于该用户%s", params.StoreID, ctx.GetUserName())
|
||||
}
|
||||
}
|
||||
|
||||
var vendors []int
|
||||
var brandIds []int
|
||||
if err := jxutils.Strings2Objs(params.VendorIds, &vendors, params.BrandIds, &brandIds); err != nil {
|
||||
return retVal, "", err
|
||||
}
|
||||
retVal, err = orderman.FixedOrderManager.GetStoresOrderSaleInfo2(params.Ctx, timeList[0], timeList[1], params.StoreID, brandIds, vendors, dataList, mapDataList)
|
||||
retVal, err = orderman.FixedOrderManager.GetStoresOrderSaleInfo2(params.Ctx, timeList[0], timeList[1], params.StoreID, brandIds, vendors, dataList)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user