mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-12-01 06:30:49 +00:00
鲜花2.0-类型软删除+统计接口修改
This commit is contained in:
parent
465b93e035
commit
c57304bad2
@ -55,7 +55,8 @@ class DailyStockRecordReport extends Command
|
|||||||
->select("business_order_items.external_sku_id"
|
->select("business_order_items.external_sku_id"
|
||||||
, DB::raw("sum(goods_number-already_cancel_number) as goods_total")
|
, DB::raw("sum(goods_number-already_cancel_number) as goods_total")
|
||||||
, DB::raw("ROUND(sum(goods_amount) / 100,2) as order_total_amount"))
|
, DB::raw("ROUND(sum(goods_amount) / 100,2) as order_total_amount"))
|
||||||
->whereBetween("business_order_items.created_at", [$startDateTime, $endDateTime])
|
->where('b.confirm_at', '>=', Carbon::parse($startDateTime)->getPreciseTimestamp(3))
|
||||||
|
->where('b.confirm_at', '<=', Carbon::parse($endDateTime)->getPreciseTimestamp(3))
|
||||||
->where("business_order_items.cancel_status", "=", 0)
|
->where("business_order_items.cancel_status", "=", 0)
|
||||||
->groupBy('external_sku_id')->get()->pluck(null, "external_sku_id")->toArray();
|
->groupBy('external_sku_id')->get()->pluck(null, "external_sku_id")->toArray();
|
||||||
|
|
||||||
|
|||||||
@ -44,7 +44,7 @@ class KttOrderAfterSaleQuery extends Command
|
|||||||
{
|
{
|
||||||
$shops = Shop::query()->where('plat_id', Shop::$PLAT_KTT)->where('status', Shop::$STATUS_AUTHORIZED)->get();
|
$shops = Shop::query()->where('plat_id', Shop::$PLAT_KTT)->where('status', Shop::$STATUS_AUTHORIZED)->get();
|
||||||
$endTime = DateTimeUtils::getMicroTime();
|
$endTime = DateTimeUtils::getMicroTime();
|
||||||
$beginTime = $endTime - (15 * 60 * 1000)-1000;//售后单每15min查询一次 多查询一次
|
$beginTime = $endTime - (15 * 60 * 1000)-1000;//售后单每15min查询一次 多查询一秒
|
||||||
foreach ($shops as $shop) {
|
foreach ($shops as $shop) {
|
||||||
BusinessFactory::init()->make($shop->plat_id)->setShop($shop)->downloadAfterSaleOrdersAndSave($beginTime, $endTime);
|
BusinessFactory::init()->make($shop->plat_id)->setShop($shop)->downloadAfterSaleOrdersAndSave($beginTime, $endTime);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,9 @@ use Illuminate\Support\Facades\Validator;
|
|||||||
|
|
||||||
class SaleDataService
|
class SaleDataService
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* sku维度的统计数据
|
||||||
|
*/
|
||||||
public static function saleStatistics(Request $request)
|
public static function saleStatistics(Request $request)
|
||||||
{
|
{
|
||||||
if (StaticTypeEnum::TODAY == $request->type) {
|
if (StaticTypeEnum::TODAY == $request->type) {
|
||||||
@ -31,7 +33,9 @@ class SaleDataService
|
|||||||
return static::skuSaleStatisticsByHistory($request);
|
return static::skuSaleStatisticsByHistory($request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* sku维度 今日实时统计
|
||||||
|
*/
|
||||||
public static function skuSaleStatisticsByToday(Request $request)
|
public static function skuSaleStatisticsByToday(Request $request)
|
||||||
{
|
{
|
||||||
[$startTime, $endTime] = static::getTimeRange($request);
|
[$startTime, $endTime] = static::getTimeRange($request);
|
||||||
@ -170,8 +174,7 @@ class SaleDataService
|
|||||||
return [$startTime, $endTime];
|
return [$startTime, $endTime];
|
||||||
}
|
}
|
||||||
|
|
||||||
public
|
public static function spuSaleStatisticsByToday(Request $request)
|
||||||
static function spuSaleStatisticsByToday(Request $request)
|
|
||||||
{
|
{
|
||||||
[$startTime, $endTime] = static::getTimeRange($request);
|
[$startTime, $endTime] = static::getTimeRange($request);
|
||||||
//实时统计 sku维度
|
//实时统计 sku维度
|
||||||
@ -182,7 +185,8 @@ class SaleDataService
|
|||||||
, DB::raw("sum(CASE WHEN b.shipping_status=0 THEN goods_number-already_cancel_number ELSE 0 END) as unshipping_num")
|
, DB::raw("sum(CASE WHEN b.shipping_status=0 THEN goods_number-already_cancel_number ELSE 0 END) as unshipping_num")
|
||||||
, DB::raw("sum(goods_number-already_cancel_number) as goods_total")
|
, DB::raw("sum(goods_number-already_cancel_number) as goods_total")
|
||||||
, DB::raw("ROUND(sum(goods_amount) / 100,2) as goods_total_amount"))
|
, DB::raw("ROUND(sum(goods_amount) / 100,2) as goods_total_amount"))
|
||||||
->whereBetween("business_order_items.created_at", [$startTime, $endTime])
|
->where('b.confirm_at', '>=', Carbon::parse($startTime)->getPreciseTimestamp(3))
|
||||||
|
->where('b.confirm_at', '<=', Carbon::parse($endTime)->getPreciseTimestamp(3))
|
||||||
->where("external_sku_id", "!=", "")
|
->where("external_sku_id", "!=", "")
|
||||||
->where("business_order_items.cancel_status", "=", 0)
|
->where("business_order_items.cancel_status", "=", 0)
|
||||||
->groupBy('external_sku_id')->get()->toArray();
|
->groupBy('external_sku_id')->get()->toArray();
|
||||||
@ -235,8 +239,7 @@ class SaleDataService
|
|||||||
* @param $endTime
|
* @param $endTime
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public
|
public static function spuSaleStatisticsByHistory($startTime, $endTime)
|
||||||
static function spuSaleStatisticsByHistory($startTime, $endTime)
|
|
||||||
{
|
{
|
||||||
$dailyAllRecord = DailyStockRecord::query()
|
$dailyAllRecord = DailyStockRecord::query()
|
||||||
->select("sku_id", DB::raw("sum(order_goods_num) as goods_total")
|
->select("sku_id", DB::raw("sum(order_goods_num) as goods_total")
|
||||||
@ -269,8 +272,12 @@ class SaleDataService
|
|||||||
})->values()->toArray();
|
})->values()->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public
|
/**
|
||||||
static function gmvStatistics(Request $request)
|
* gmv 统计
|
||||||
|
* @param Request $request
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function gmvStatistics(Request $request)
|
||||||
{
|
{
|
||||||
if (StaticTypeEnum::TODAY == $request->type) {
|
if (StaticTypeEnum::TODAY == $request->type) {
|
||||||
[$startTime, $endTime] = static::getTimeRange($request);
|
[$startTime, $endTime] = static::getTimeRange($request);
|
||||||
@ -319,8 +326,12 @@ class SaleDataService
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public
|
/**
|
||||||
static function lossRecordStatistics(Request $request)
|
* 报损统计
|
||||||
|
* @param Request $request
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function lossRecordStatistics(Request $request)
|
||||||
{
|
{
|
||||||
$startTime = Carbon::parse($request->input("start_time"))->toDateTimeString();
|
$startTime = Carbon::parse($request->input("start_time"))->toDateTimeString();
|
||||||
$endTime = Carbon::parse($request->input("end_time"))->toDateTimeString();
|
$endTime = Carbon::parse($request->input("end_time"))->toDateTimeString();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user