| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- namespace App\Services;
- use App\OwnerAreaReport;
- use App\OwnerBillReport;
- use App\Traits\ServiceAppAop;
- use App\Traits\SettlementBillTrait;
- class SettlementBillsAreaFeeService implements \App\Interfaces\SettlementBillDetailInterface
- {
- /** @var $archiveService OwnerBillReportArchiveService */
- private $archiveService;
- const TYPE = '仓储费';
- use ServiceAppAop;
- /**
- * @param array $kvPairs
- * @return array
- */
- public function get(array $kvPairs): array
- {
- $this->archiveService = app('OwnerBillReportArchiveService');
- $counting_month = $kvPairs['counting_month'];
- $owner_id = $kvPairs['owner_id'];
- if ($this->archiveService->isArchived($kvPairs['counting_month'], $kvPairs['owner_id'], $kvPairs['type']) == 1) {
- $archived = $this->archiveService->get($kvPairs);
- $areaReports = collect($archived->information['areaReports']);
- $billReport = collect($archived->information['billReport']);
- } else {
- $areaReports = OwnerAreaReport::query()
- ->with(['ownerStoragePriceModel' => function ($query) {
- $query->selectRaw("id,using_type,price,unit_id,unit_id,time_unit_id,name,minimum_area")
- ->with(['unit:id,name', 'timeUnit:id,name']);
- }])
- ->where('owner_id', $owner_id)
- ->where('counting_month', $counting_month)
- ->get();
- $billReport = OwnerBillReport::query()
- ->select(['storage_fee', 'id'])
- ->where('owner_id', $owner_id)
- ->where('counting_month', $counting_month)
- ->firstOr(function () {
- return new OwnerBillReport();
- });
- }
- return array($areaReports, $billReport);
- }
- public function getSql($owner_id, $counting_month): \Illuminate\Database\Eloquent\Builder
- {
- // TODO: Implement getSql() method.
- }
- public function getTotalFee($owner_id, $counting_month)
- {
- return OwnerBillReport::query()
- ->where('owner_id', $owner_id)
- ->where('counting_month', $counting_month)
- ->first();
- }
- public function switchType($type)
- {
- // TODO: Implement switchType() method.
- }
- public function buildExport($details): array
- {
- // TODO: Implement buildExport() method.
- }
- public function add(array $model)
- {
- // TODO: Implement add() method.
- }
- }
|