SettlementBillReportTask.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace App\Jobs;
  3. use App\Services\OwnerFeeTotalService;
  4. use App\Services\OwnerLogisticFeeReportService;
  5. use App\Services\OwnerStoreFeeReportService;
  6. use App\Services\OwnerStoreOutFeeReportService;
  7. use Illuminate\Bus\Queueable;
  8. use Illuminate\Contracts\Queue\ShouldQueue;
  9. use Illuminate\Foundation\Bus\Dispatchable;
  10. use Illuminate\Queue\InteractsWithQueue;
  11. use Illuminate\Queue\SerializesModels;
  12. /**
  13. * 快递 出库 入库 统计报表生成任务
  14. * Class SettlementBillReportTask
  15. * @package App\Jobs
  16. */
  17. class SettlementBillReportTask implements ShouldQueue
  18. {
  19. use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  20. public $timeout = 3600;
  21. public $maxExceptions = 3;
  22. public $tries = 2;
  23. public $init_date;
  24. /**
  25. * @param $init_date
  26. */
  27. public function __construct($init_date)
  28. {
  29. $this->init_date = $init_date;
  30. }
  31. /**
  32. * Execute the job.
  33. *
  34. * @return void
  35. */
  36. public function handle()
  37. {
  38. //快递
  39. /** @var OwnerLogisticFeeReportService $expressFeeReportService */
  40. $expressFeeReportService = app('OwnerLogisticFeeReportService');
  41. $expressFeeReportService->recordReport($this->init_date);
  42. //入库
  43. /** @var OwnerStoreFeeReportService $storeFeeReportService */
  44. $storeFeeReportService = app('OwnerStoreFeeReportService');
  45. $storeFeeReportService->recordReport($this->init_date);
  46. //出库
  47. /** @var OwnerStoreOutFeeReportService $storeOutFeeReportService */
  48. $storeOutFeeReportService = app('OwnerStoreOutFeeReportService');
  49. $storeOutFeeReportService->recordReport($this->init_date);
  50. //总账单
  51. /** @var OwnerFeeTotalService $feeTotal */
  52. $feeTotal = app('OwnerFeeTotalService');
  53. $feeTotal->record($this->init_date);
  54. }
  55. }