This commit is contained in:
邹宗楠
2025-05-06 17:49:03 +08:00
parent 16137f911e
commit f4baef1533
2 changed files with 6 additions and 16 deletions

View File

@@ -3,7 +3,6 @@ package dao
import (
"errors"
"fmt"
"git.rosy.net.cn/jx-callback/globals"
"sort"
"strings"
"time"
@@ -1664,7 +1663,7 @@ func StatisticsAfsOrderInfo(db *DaoDB, startTime, endTime time.Time, storeId int
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,
SELECT t1.jx_store_id id,t1.vendor_order_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,
@@ -1693,12 +1692,13 @@ func StatisticsIncome(db *DaoDB, startTime, endTime time.Time, storeId int, bran
parma = append(parma, vendorId)
}
sql += ` GROUP BY t1.jx_store_id`
sql += ` GROUP BY t1.jx_store_id,t1.vendor_order_id`
sql2 := ` select settle.id,count(settle.vendor_order_id) order_count,settle.name name,sum(settle.total_income) total_income,sum(settle.jx_income) jx_income,sum(settle.market_income) market_income, sum(settle.order_sku_price) order_sku_price from ( ` + sql + `) AS settle GROUP BY id ORDER BY order_count desc`
sql2 := ` SELECT settle.id,COUNT(settle.vendor_order_id) order_count,settle.name name,
SUM(settle.total_income) total_income,SUM(settle.jx_income) jx_income,
SUM(settle.market_income) market_income, SUM(settle.order_sku_price) order_sku_price
FROM ( ` + sql + `) AS settle GROUP BY id ORDER BY order_count DESC`
globals.SugarLogger.Debugf("-----sql := %s", sql2)
globals.SugarLogger.Debugf("-----parma := %s", utils.Format4Output(parma, false))
incomeInfo := make([]*StatisticsIncomeInfo, 0, 0)
if err := GetRows(db, &incomeInfo, sql2, parma...); err != nil {
return nil, err

View File

@@ -9,7 +9,6 @@ import (
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
"git.rosy.net.cn/jx-callback/business/jxstore/permission"
"git.rosy.net.cn/jx-callback/business/partner/delivery"
"git.rosy.net.cn/jx-callback/globals"
"strings"
"time"
@@ -551,15 +550,6 @@ func (c *OrderController) StaleIndexInfo() {
return retVal, "", fmt.Errorf("于该用户%s,暂无门店信息", ctx.GetUserName())
}
if params.Ctx.GetUserID() == "68F2F1F41BF211F0A561525400E86DC0" {
globals.SugarLogger.Debugf("---------timeList:= %s,%s", utils.Time2Str(timeList[0]), utils.Time2Str(timeList[1]))
globals.SugarLogger.Debugf("---------timeList:= %s,%s", utils.Time2Str(timeList[0]), utils.Time2Str(timeList[1]))
globals.SugarLogger.Debugf("---------StoreID:= %d", params.StoreID)
globals.SugarLogger.Debugf("---------brandIds:= %s", utils.Format4Output(brandIds, false))
globals.SugarLogger.Debugf("---------vendors:= %s", utils.Format4Output(vendors, false))
globals.SugarLogger.Debugf("---------dataList:= %s", utils.Format4Output(dataList, false))
}
retVal, err = orderman.FixedOrderManager.GetStoresOrderSaleInfo2(params.Ctx, timeList[0], timeList[1], params.StoreID, brandIds, vendors, dataList)
return retVal, "", err
})