1
This commit is contained in:
@@ -6584,7 +6584,16 @@ func CopyMtToJd(ctx *jxcontext.Context, mtStoreID, mtOrgCode, jdStoreID, jdOrgCo
|
|||||||
step := batchItemList[0].(int)
|
step := batchItemList[0].(int)
|
||||||
switch step {
|
switch step {
|
||||||
case 0:
|
case 0:
|
||||||
globals.SugarLogger.Debugf("-----------------11111")
|
jdCatList, _ := jd.QueryCategoriesByOrgCode()
|
||||||
|
catList, _ := mtapi.RetailCatList(mtStoreID)
|
||||||
|
for _, jdc := range jdCatList {
|
||||||
|
for _, mtc := range catList {
|
||||||
|
if jdc.Name == mtc.Name {
|
||||||
|
catMap[mtc.Code] = utils.Int64ToStr(jdc.Id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//建分类 ,账号存在分类,不在创建分类
|
//建分类 ,账号存在分类,不在创建分类
|
||||||
//jdCatList, _ := jd.QueryCategoriesByOrgCode()
|
//jdCatList, _ := jd.QueryCategoriesByOrgCode()
|
||||||
//if len(jdCatList) == 0 {
|
//if len(jdCatList) == 0 {
|
||||||
@@ -6594,7 +6603,7 @@ func CopyMtToJd(ctx *jxcontext.Context, mtStoreID, mtOrgCode, jdStoreID, jdOrgCo
|
|||||||
// if catID != "" {
|
// if catID != "" {
|
||||||
// catMap[catList[i].Code] = catID
|
// catMap[catList[i].Code] = catID
|
||||||
// }
|
// }
|
||||||
// //LoopCatChild(catList[i].Code, catID, catList[i].Children)
|
// LoopCatChild(catList[i].Code, catID, catList[i].Children)
|
||||||
// //美团好像只能建两级分类?
|
// //美团好像只能建两级分类?
|
||||||
// for j := len(catList[i].Children) - 1; j > -1; j-- {
|
// for j := len(catList[i].Children) - 1; j > -1; j-- {
|
||||||
// catID2, _ := jd.AddShopCategory(utils.Str2Int64(catID), catList[i].Children[j].Name, catList[i].Children[j].Level, catList[i].Children[j].Sequence, "")
|
// catID2, _ := jd.AddShopCategory(utils.Str2Int64(catID), catList[i].Children[j].Name, catList[i].Children[j].Level, catList[i].Children[j].Sequence, "")
|
||||||
@@ -6643,20 +6652,23 @@ func CopyMtToJd(ctx *jxcontext.Context, mtStoreID, mtOrgCode, jdStoreID, jdOrgCo
|
|||||||
vendorCategoryId, _ := handler.GetSkuCategoryIdByName(jdOrgCode, mtSku.Name)
|
vendorCategoryId, _ := handler.GetSkuCategoryIdByName(jdOrgCode, mtSku.Name)
|
||||||
if vendorCategoryId != "" {
|
if vendorCategoryId != "" {
|
||||||
param.CategoryID = utils.Str2Int64(vendorCategoryId) // 其他水果
|
param.CategoryID = utils.Str2Int64(vendorCategoryId) // 其他水果
|
||||||
} else {
|
} else if utils.Str2Int64(vendorCategoryId) > 25048 { // 只有水果,後面刪除
|
||||||
param.CategoryID = 22410 // 其他水果
|
param.CategoryID = 22410 // 其他水果
|
||||||
}
|
}
|
||||||
param.ShopCategories = append(param.ShopCategories, 33313305) // 暂无分类
|
|
||||||
if mtSku.SecondaryCategoryCode != "" {
|
if mtSku.SecondaryCategoryCode != "" {
|
||||||
param.ShopCategories = append(param.ShopCategories, utils.Str2Int64(catMap[mtSku.SecondaryCategoryCode]))
|
param.ShopCategories = append(param.ShopCategories, utils.Str2Int64(catMap[mtSku.SecondaryCategoryCode]))
|
||||||
} else if mtSku.CategoryCode != "" {
|
} else if mtSku.CategoryCode != "" {
|
||||||
param.ShopCategories = append(param.ShopCategories, utils.Str2Int64(catMap[mtSku.CategoryCode]))
|
param.ShopCategories = append(param.ShopCategories, utils.Str2Int64(catMap[mtSku.CategoryCode]))
|
||||||
|
} else {
|
||||||
|
param.ShopCategories = append(param.ShopCategories, 33313305) // 暂无分类
|
||||||
|
}
|
||||||
|
if mtSku.PictureContents != "" {
|
||||||
|
param.ProductDesc = fmt.Sprintf(`<img src="%s" alt="一张图片" />`, mtSku.PictureContents)
|
||||||
}
|
}
|
||||||
param.ProductDesc = fmt.Sprintf(`<img src="%s" alt="一张图片" />`, mtSku.PictureContents)
|
|
||||||
globals.SugarLogger.Debugf("-------------skuname := %s", param.SkuName)
|
|
||||||
skuID, err := jd.AddSku2(param)
|
skuID, err := jd.AddSku2(param)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
globals.SugarLogger.Debugf("---------AddSku2 := %s,%v", skuID, err)
|
globals.SugarLogger.Debugf("-------------skuname := %s", param.SkuName)
|
||||||
|
globals.SugarLogger.Debugf("---------AddSku2 := %s,%s,%v", param.SkuName, skuID, err)
|
||||||
}
|
}
|
||||||
if skuID != "" {
|
if skuID != "" {
|
||||||
jd.UpdateCurrentQty(ctx.GetTrackInfo(), jdStoreID, utils.Str2Int64(skuID), utils.Str2Int(mtSku.SkuList[0].Stock))
|
jd.UpdateCurrentQty(ctx.GetTrackInfo(), jdStoreID, utils.Str2Int64(skuID), utils.Str2Int(mtSku.SkuList[0].Stock))
|
||||||
|
|||||||
@@ -1666,10 +1666,13 @@ func StatisticsIncome(db *DaoDB, startTime, endTime time.Time, storeId int, bran
|
|||||||
SELECT t1.jx_store_id id,t3.name,
|
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),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.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
|
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,
|
||||||
|
count(t1.vendor_order_id) order_count,
|
||||||
|
sum(os.sale_price *os.count) order_sku_price
|
||||||
FROM goods_order t1
|
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 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
|
LEFT JOIN store t3 ON t1.jx_store_id = t3.id
|
||||||
|
LEFT JOIN order_sku os ON t1.vendor_order_id = os.vendor_order_id
|
||||||
WHERE t1.order_created_at >= ? AND t1.order_created_at <= ? AND t1.status = 110 `
|
WHERE t1.order_created_at >= ? AND t1.order_created_at <= ? AND t1.status = 110 `
|
||||||
parma = append(parma, startTime, endTime)
|
parma = append(parma, startTime, endTime)
|
||||||
if storeId != model.NO {
|
if storeId != model.NO {
|
||||||
@@ -1689,7 +1692,7 @@ func StatisticsIncome(db *DaoDB, startTime, endTime time.Time, storeId int, bran
|
|||||||
parma = append(parma, vendorId)
|
parma = append(parma, vendorId)
|
||||||
}
|
}
|
||||||
|
|
||||||
sql += ` GROUP BY t1.jx_store_id`
|
sql += ` GROUP BY t1.jx_store_id ORDER BY order_count desc `
|
||||||
|
|
||||||
incomeInfo := make([]*StatisticsIncomeInfo, 0, 0)
|
incomeInfo := make([]*StatisticsIncomeInfo, 0, 0)
|
||||||
if err := GetRows(db, &incomeInfo, sql, parma...); err != nil {
|
if err := GetRows(db, &incomeInfo, sql, parma...); err != nil {
|
||||||
|
|||||||
@@ -147,9 +147,11 @@ type StatisticsOrder struct {
|
|||||||
|
|
||||||
// StatisticsIncomeInfo 统计门店收入情况
|
// StatisticsIncomeInfo 统计门店收入情况
|
||||||
type StatisticsIncomeInfo struct {
|
type StatisticsIncomeInfo struct {
|
||||||
ID int64 `json:"id"`
|
ID int64 `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
TotalIncome float64 `json:"total_income"`
|
TotalIncome float64 `json:"total_income"`
|
||||||
JxIncome float64 `json:"jx_income"`
|
JxIncome float64 `json:"jx_income"`
|
||||||
MarketIncome float64 `json:"market_income"`
|
MarketIncome float64 `json:"market_income"`
|
||||||
|
OrderCount float64 `json:"order_count"` // 有效订单数
|
||||||
|
OrderSkuPrice float64 `json:"order_sku_price"` // 营业额(售卖价)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user