SettlementBillReportJob.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. /**
  18. * @Deprecated 月度账单生成
  19. */
  20. class SettlementBillReportJob implements ShouldQueue
  21. {
  22. use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  23. public $timeout = 3600;
  24. public $maxExceptions = 3;
  25. public $tries = 2;
  26. //生成报告的日期 2021-08-01 生成8月份的报告
  27. public $init_date;
  28. /**
  29. * 初始化的货主,填[]为全部
  30. * @var $ownerIds array
  31. */
  32. public $ownerIds;
  33. /**
  34. * @param $init_date
  35. * @param $ownerIds
  36. */
  37. public function __construct($init_date, $ownerIds)
  38. {
  39. $this->init_date = $init_date;
  40. $this->ownerIds = $ownerIds;
  41. }
  42. /**
  43. * Execute the job.
  44. *
  45. * @return void
  46. */
  47. public function handle()
  48. {
  49. //快递
  50. /** @var OwnerLogisticFeeReportService $expressFeeReportService */
  51. $expressFeeReportService = app('OwnerLogisticFeeReportService');
  52. $expressFeeReportService->recordReport($this->init_date, $this->ownerIds);
  53. //入库
  54. /** @var OwnerStoreFeeReportService $storeFeeReportService */
  55. $storeFeeReportService = app('OwnerStoreFeeReportService');
  56. $storeFeeReportService->recordReport($this->init_date, $this->ownerIds);
  57. //出库
  58. /** @var OwnerStoreOutFeeReportService $storeOutFeeReportService */
  59. $storeOutFeeReportService = app('OwnerStoreOutFeeReportService');
  60. $storeOutFeeReportService->recordReport($this->init_date, $this->ownerIds);
  61. //总账单
  62. /** @var OwnerFeeTotalService $feeTotal */
  63. $feeTotal = app('OwnerFeeTotalService');
  64. $feeTotal->record($this->init_date, $this->ownerIds);
  65. }
  66. }