CompanyReportDetailExport
This commit is contained in:
parent
f099092865
commit
837bd9f86d
@ -11,6 +11,7 @@ use Dipper\Excel\Concerns\FromQuery;
|
|||||||
use App\Exceptions\NotAllowedException;
|
use App\Exceptions\NotAllowedException;
|
||||||
use Dipper\Excel\Concerns\WithHeadings;
|
use Dipper\Excel\Concerns\WithHeadings;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Dipper\Excel\Concerns\WithCustomChunkSize;
|
||||||
use Dipper\Excel\Concerns\WithCustomQuerySize;
|
use Dipper\Excel\Concerns\WithCustomQuerySize;
|
||||||
use Dipper\Excel\Concerns\WithColumnFormatting;
|
use Dipper\Excel\Concerns\WithColumnFormatting;
|
||||||
use App\Domains\Virtual\Services\CompanyService;
|
use App\Domains\Virtual\Services\CompanyService;
|
||||||
@ -18,7 +19,7 @@ use App\Domains\Virtual\Services\PackageService;
|
|||||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||||
use App\Domains\Virtual\Repositories\OrderCardPartitionRepository;
|
use App\Domains\Virtual\Repositories\OrderCardPartitionRepository;
|
||||||
|
|
||||||
class CompanyReportDetailExport extends AbstractExport implements FromQuery, WithHeadings, WithRows, WithColumnFormatting, WithCustomQuerySize
|
class CompanyReportDetailExport extends AbstractExport implements FromQuery, WithHeadings, WithRows, WithColumnFormatting, WithCustomQuerySize, WithCustomChunkSize
|
||||||
{
|
{
|
||||||
public $conditions;
|
public $conditions;
|
||||||
|
|
||||||
@ -30,6 +31,11 @@ class CompanyReportDetailExport extends AbstractExport implements FromQuery, Wit
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function chunkSize(): int
|
||||||
|
{
|
||||||
|
return 150000;
|
||||||
|
}
|
||||||
|
|
||||||
public function querySize(): int
|
public function querySize(): int
|
||||||
{
|
{
|
||||||
return app(OrderCardPartitionRepository::class)->withConditions($this->conditions)->applyConditions()->count();
|
return app(OrderCardPartitionRepository::class)->withConditions($this->conditions)->applyConditions()->count();
|
||||||
|
@ -5,6 +5,45 @@ use App\Domains\Virtual\Services\PropertyService;
|
|||||||
|
|
||||||
require_once realpath(dirname(__FILE__) . '/TestCase.php');
|
require_once realpath(dirname(__FILE__) . '/TestCase.php');
|
||||||
|
|
||||||
|
$sql = <<< EOF
|
||||||
|
select
|
||||||
|
"sim" ,
|
||||||
|
"company_id",
|
||||||
|
"package_id",
|
||||||
|
"type",
|
||||||
|
case
|
||||||
|
"type"
|
||||||
|
when 3 then sum(counts)
|
||||||
|
else count(*)
|
||||||
|
end as counts ,
|
||||||
|
"unit_price"
|
||||||
|
from
|
||||||
|
"virtual_order_cards_partition"
|
||||||
|
where
|
||||||
|
("type" in (0)
|
||||||
|
and "company_id" in (23)
|
||||||
|
and "package_id" in (98)
|
||||||
|
and "unit_price" = 14400
|
||||||
|
and ("service_start_at" <= '2019-10-31 23:59:59'
|
||||||
|
and "service_end_at" >= '2019-10-01 00:00:00'))
|
||||||
|
and "virtual_order_cards_partition"."deleted_at" is null
|
||||||
|
and "refunded_at" is null
|
||||||
|
group by
|
||||||
|
"company_id" ,
|
||||||
|
"package_id",
|
||||||
|
"type",
|
||||||
|
"unit_price" ,
|
||||||
|
"sim"
|
||||||
|
order by
|
||||||
|
"sim" asc
|
||||||
|
limit 100000
|
||||||
|
EOF;
|
||||||
|
|
||||||
|
|
||||||
|
$res = DB::select($sql);
|
||||||
|
|
||||||
|
dd($res);
|
||||||
|
|
||||||
$test = PropertyService::load('1', '1');
|
$test = PropertyService::load('1', '1');
|
||||||
|
|
||||||
dd($test);
|
dd($test);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user