Browse Source

HTAPI駐車場取得ロジックの修正 (途中)

HT側が対応完了後に再着手予定
develop
sosuke.iwabuchi 2 years ago
parent
commit
34e463fd7b
6 changed files with 39 additions and 16 deletions
  1. +4
    -1
      app/Http/Controllers/Web/Custom/HelloTechno/CreateReceiptIssuingOrderController.php
  2. +3
    -1
      app/Http/Controllers/Web/Custom/HelloTechno/ParkingByCodeController.php
  3. +10
    -1
      app/Http/Controllers/Web/Custom/HelloTechno/ParkingsController.php
  4. +6
    -3
      app/Http/Controllers/Web/Custom/HelloTechno/ParkingsParam.php
  5. +4
    -1
      app/Jobs/Other/Custom/HelloTechno/CacheParkingName.php
  6. +12
    -9
      app/Util/Custom/HelloTechno/API.php

+ 4
- 1
app/Http/Controllers/Web/Custom/HelloTechno/CreateReceiptIssuingOrderController.php View File

@@ -54,7 +54,10 @@ class CreateReceiptIssuingOrderController extends HelloTechnoController
->where('customer_code', $param->customerCode) ->where('customer_code', $param->customerCode)
->firstOrFail(); ->firstOrFail();
// 駐車場情報取得 // 駐車場情報取得
$parking = collect(API::getParkings($param->customerCode, $param->parkingManagementCode))
$parking = collect(API::getParkings([
API::CONDITION_CUSTOMER_CODDE => $param->customerCode,
API::CONDITION_PARKING_MANAGEMENT_CODDE => $param->parkingManagementCode,
]))
->where('parking_management_code', $param->parkingManagementCode) ->where('parking_management_code', $param->parkingManagementCode)
->firstOrFail(); ->firstOrFail();




+ 3
- 1
app/Http/Controllers/Web/Custom/HelloTechno/ParkingByCodeController.php View File

@@ -38,7 +38,9 @@ class ParkingByCodeController extends HelloTechnoController
{ {
$param = $this->param; $param = $this->param;


$parking = Arr::first(API::getParkings(null, $param->parkingManagementCode));
$parking = Arr::first(API::getParkings([
API::CONDITION_PARKING_MANAGEMENT_CODDE => $param->parkingManagementCode
]));


if ($parking === null) { if ($parking === null) {
throw new AppCommonException("駐車場情報取得不正"); throw new AppCommonException("駐車場情報取得不正");


+ 10
- 1
app/Http/Controllers/Web/Custom/HelloTechno/ParkingsController.php View File

@@ -36,7 +36,16 @@ class ParkingsController extends HelloTechnoController
{ {
$param = $this->param; $param = $this->param;


$list = API::getParkings($param->customerCode, $param->parkingManagementCode);
$a = $param->toArray();
$r = $request->all();

$condition = [
API::CONDITION_CUSTOMER_CODDE => $param->customerCode,
API::CONDITION_PARKING_MANAGEMENT_CODDE => $param->parkingManagementCode,
API::CONDITION_PARKING_NAME => $param->parkingName,
];

$list = API::getParkings($condition);


return $this->successResponse(['records' => $list]); return $this->successResponse(['records' => $list]);
} }


+ 6
- 3
app/Http/Controllers/Web/Custom/HelloTechno/ParkingsParam.php View File

@@ -3,18 +3,21 @@
namespace App\Http\Controllers\Web\Custom\HelloTechno; namespace App\Http\Controllers\Web\Custom\HelloTechno;


use App\Http\Controllers\Web\BaseParam; use App\Http\Controllers\Web\BaseParam;
use App\Util\Custom\HelloTechno\API;


/** /**
* @property string $customerCode
* @property ?string $customerCode
* @property ?string $parkingManagementCode * @property ?string $parkingManagementCode
* @property ?string $parkingName
*/ */
class ParkingsParam extends BaseParam class ParkingsParam extends BaseParam
{ {
public function rules(): array public function rules(): array
{ {
return [ return [
'customer_code' => $this->str(),
'parking_management_code' => $this->str(true)
API::CONDITION_CUSTOMER_CODDE => $this->str(true),
API::CONDITION_PARKING_MANAGEMENT_CODDE => $this->str(true),
API::CONDITION_PARKING_NAME => $this->str(true)
]; ];
} }
} }

+ 4
- 1
app/Jobs/Other/Custom/HelloTechno/CacheParkingName.php View File

@@ -35,7 +35,10 @@ class CacheParkingName extends BaseJob
->where('customer_code', $this->customerCode) ->where('customer_code', $this->customerCode)
->firstOrFail(); ->firstOrFail();
// 駐車場情報取得 // 駐車場情報取得
$parking = collect(API::getParkings($this->customerCode, $this->parkingManagementCode))
$parking = collect(API::getParkings([
API::CONDITION_CUSTOMER_CODDE => $this->customerCode,
API::CONDITION_PARKING_MANAGEMENT_CODDE => $this->parkingManagementCode,
]))
->where('parking_management_code', $this->parkingManagementCode) ->where('parking_management_code', $this->parkingManagementCode)
->firstOrFail(); ->firstOrFail();




+ 12
- 9
app/Util/Custom/HelloTechno/API.php View File

@@ -6,6 +6,7 @@ use App\Exceptions\AppCommonException;
use App\Models\ReceiptIssuingHTParkingCustomOrder; use App\Models\ReceiptIssuingHTParkingCustomOrder;
use App\Models\ReceiptIssuingOrder; use App\Models\ReceiptIssuingOrder;
use Exception; use Exception;
use Illuminate\Support\Arr;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
@@ -13,6 +14,10 @@ use Illuminate\Support\Facades\Log;
class API class API
{ {


const CONDITION_CUSTOMER_CODDE = 'customer_code';
const CONDITION_PARKING_MANAGEMENT_CODDE = 'parking_management_code';
const CONDITION_PARKING_NAME = 'parking_name';

private const RESULT_CODE = 'result_code'; private const RESULT_CODE = 'result_code';
private const RESULT_CODE_SUCCESS = 'SUCCESS'; private const RESULT_CODE_SUCCESS = 'SUCCESS';
private const FIELD_DATA = 'data'; private const FIELD_DATA = 'data';
@@ -35,16 +40,14 @@ class API
return static::get(static::getCustomersUrl(), $query); return static::get(static::getCustomersUrl(), $query);
} }


public static function getParkings(?string $customerCode, ?string $parkingManagementCode = null)
public static function getParkings(array $condition)
{ {

if ($customerCode) {
$query['customer_code'] = $customerCode;
}
if ($parkingManagementCode) {
$query['parking_management_code'] = $parkingManagementCode;
}
return static::get(static::getParkingsUrl(), $query);
$condition = Arr::only($condition, [
self::CONDITION_CUSTOMER_CODDE,
self::CONDITION_PARKING_MANAGEMENT_CODDE,
self::CONDITION_PARKING_NAME,
]);
return static::get(static::getParkingsUrl(), $condition);
} }


public static function getAdjustData(string $customerCode, string $parkingManagementCode, int $adjustSeqNo) public static function getAdjustData(string $customerCode, string $parkingManagementCode, int $adjustSeqNo)


Loading…
Cancel
Save