| @@ -0,0 +1,13 @@ | |||||
| <?php | |||||
| namespace App\Codes\Model; | |||||
| /** | |||||
| * QRサービス券利用方法 | |||||
| */ | |||||
| enum QRServiceUsage: string | |||||
| { | |||||
| case その他 = "その他"; | |||||
| case 認証方式 = "認証方式"; | |||||
| case 印字方式 = "印字方式"; | |||||
| } | |||||
| @@ -2,6 +2,7 @@ | |||||
| namespace App\Http\Controllers\Web\QRService\Certification; | namespace App\Http\Controllers\Web\QRService\Certification; | ||||
| use App\Codes\Model\QRServiceUsage; | |||||
| use App\Exceptions\GeneralErrorMessageException; | use App\Exceptions\GeneralErrorMessageException; | ||||
| use App\Http\Controllers\Web\WebController; | use App\Http\Controllers\Web\WebController; | ||||
| use App\Logics\QRService\QRCryptoLogic; | use App\Logics\QRService\QRCryptoLogic; | ||||
| @@ -42,8 +43,11 @@ class CheckDataFormatController extends WebController | |||||
| $data = DataConverter::read($param->data); | $data = DataConverter::read($param->data); | ||||
| // 対象の駐車場か判定 | // 対象の駐車場か判定 | ||||
| $relation = ShopNoRelation::whereShopId($this->sessionUser->shopId()) | |||||
| ->whereParkingManagementCode($data->駐車場管理コード) | |||||
| $relation = ShopNoRelation::byKey( | |||||
| $this->sessionUser->shopId(), | |||||
| $data->駐車場管理コード, | |||||
| QRServiceUsage::認証方式 | |||||
| ) | |||||
| ->first(); | ->first(); | ||||
| if ($relation === null) { | if ($relation === null) { | ||||
| @@ -2,6 +2,7 @@ | |||||
| namespace App\Http\Controllers\Web\Shop\Config\Certification; | namespace App\Http\Controllers\Web\Shop\Config\Certification; | ||||
| use App\Codes\Model\QRServiceUsage; | |||||
| use App\Http\Controllers\Web\WebController; | use App\Http\Controllers\Web\WebController; | ||||
| use App\Models\HtpmsCustomer\Mst\ShopNoRelation; | use App\Models\HtpmsCustomer\Mst\ShopNoRelation; | ||||
| use App\Models\HtpmsCustomer\QRService\CertificationAvailableSetting; | use App\Models\HtpmsCustomer\QRService\CertificationAvailableSetting; | ||||
| @@ -36,11 +37,13 @@ class DeleteController extends WebController | |||||
| ->whereParkingManagementCode($param->parkingManagementCode) | ->whereParkingManagementCode($param->parkingManagementCode) | ||||
| ->get(); | ->get(); | ||||
| $relation = ShopNoRelation::whereShopId($param->shopId) | |||||
| ->whereParkingManagementCode($param->parkingManagementCode) | |||||
| $relation = ShopNoRelation::byKey( | |||||
| $param->shopId, | |||||
| $param->parkingManagementCode, | |||||
| RServiceUsage::認証方式 | |||||
| ) | |||||
| ->firstOrFail(); | ->firstOrFail(); | ||||
| foreach ($settings as $setting) { | foreach ($settings as $setting) { | ||||
| $setting->delete(); | $setting->delete(); | ||||
| } | } | ||||
| @@ -2,6 +2,7 @@ | |||||
| namespace App\Http\Controllers\Web\Shop\Config\Certification; | namespace App\Http\Controllers\Web\Shop\Config\Certification; | ||||
| use App\Codes\Model\QRServiceUsage; | |||||
| use App\Exceptions\ParamException; | use App\Exceptions\ParamException; | ||||
| use App\Http\Controllers\Web\WebController; | use App\Http\Controllers\Web\WebController; | ||||
| use App\Models\ColumnName; | use App\Models\ColumnName; | ||||
| @@ -44,6 +45,7 @@ class RegisterController extends WebController | |||||
| $relation->shop_id = $param->shopId; | $relation->shop_id = $param->shopId; | ||||
| $relation->parking_management_code = $param->parkingManagementCode; | $relation->parking_management_code = $param->parkingManagementCode; | ||||
| $relation->shop_no = $param->shopNo; | $relation->shop_no = $param->shopNo; | ||||
| $relation->qr_service_useage = QRServiceUsage::認証方式; | |||||
| $relation->save(); | $relation->save(); | ||||
| @@ -2,6 +2,7 @@ | |||||
| namespace App\Http\Controllers\Web\Shop\Config\Certification; | namespace App\Http\Controllers\Web\Shop\Config\Certification; | ||||
| use App\Codes\Model\QRServiceUsage; | |||||
| use App\Http\Controllers\Web\WebController; | use App\Http\Controllers\Web\WebController; | ||||
| use App\Models\HtpmsCustomer\Mst\ShopNoRelation; | use App\Models\HtpmsCustomer\Mst\ShopNoRelation; | ||||
| use Illuminate\Http\JsonResponse; | use Illuminate\Http\JsonResponse; | ||||
| @@ -30,8 +31,11 @@ class UpdateController extends WebController | |||||
| { | { | ||||
| $param = $this->param; | $param = $this->param; | ||||
| $relation = ShopNoRelation::whereShopId($param->shopId) | |||||
| ->whereParkingManagementCode($param->parkingManagementCode) | |||||
| $relation = ShopNoRelation::byKey( | |||||
| $param->shopId, | |||||
| $param->parkingManagementCode, | |||||
| QRServiceUsage::認証方式 | |||||
| ) | |||||
| ->firstOrFail(); | ->firstOrFail(); | ||||
| $relation->shop_no = $param->shopNo; | $relation->shop_no = $param->shopNo; | ||||
| @@ -3,6 +3,7 @@ | |||||
| namespace App\Logics\QRService; | namespace App\Logics\QRService; | ||||
| use App\Codes\DepositTransferReason; | use App\Codes\DepositTransferReason; | ||||
| use App\Codes\Model\QRServiceUsage; | |||||
| use App\Exceptions\AppCommonException; | use App\Exceptions\AppCommonException; | ||||
| use App\Models\HtpmsCustomer\Mst\ShopNoRelation; | use App\Models\HtpmsCustomer\Mst\ShopNoRelation; | ||||
| use App\Models\HtpmsCustomer\QRService\CertificationAvailableSetting; | use App\Models\HtpmsCustomer\QRService\CertificationAvailableSetting; | ||||
| @@ -52,8 +53,11 @@ class CertificateLogic | |||||
| $qr->discount_ticket_code = $discountTicketCode; | $qr->discount_ticket_code = $discountTicketCode; | ||||
| // 店舗番号の解決 | // 店舗番号の解決 | ||||
| $relation = ShopNoRelation::whereShopId($shopId) | |||||
| ->whereParkingManagementCode($parkingManagementCode) | |||||
| $relation = ShopNoRelation::byKey( | |||||
| $shopId, | |||||
| $parkingManagementCode, | |||||
| QRServiceUsage::認証方式 | |||||
| ) | |||||
| ->first(); | ->first(); | ||||
| if ($relation instanceof ShopNoRelation === false) { | if ($relation instanceof ShopNoRelation === false) { | ||||
| throw new AppCommonException("店舗番号紐づけ未設定"); | throw new AppCommonException("店舗番号紐づけ未設定"); | ||||
| @@ -2,6 +2,7 @@ | |||||
| namespace App\Models\HtpmsCustomer\Mst; | namespace App\Models\HtpmsCustomer\Mst; | ||||
| use App\Codes\Model\QRServiceUsage; | |||||
| use App\Models\ColumnName; | use App\Models\ColumnName; | ||||
| use App\Models\HtpmsCustomer\HtpmsCustomerAppModel; | use App\Models\HtpmsCustomer\HtpmsCustomerAppModel; | ||||
| @@ -13,11 +14,23 @@ class ShopNoRelation extends HtpmsCustomerAppModel | |||||
| const COL_NAME_SHOP_ID = ColumnName::SHOP_ID; | const COL_NAME_SHOP_ID = ColumnName::SHOP_ID; | ||||
| const COL_NAME_PARKING_MANAGEMENT_CODE = ColumnName::PARKING_MANAGEMENT_CODE; | const COL_NAME_PARKING_MANAGEMENT_CODE = ColumnName::PARKING_MANAGEMENT_CODE; | ||||
| const COL_NAME_SHOP_NO = ColumnName::SHOP_NO; | const COL_NAME_SHOP_NO = ColumnName::SHOP_NO; | ||||
| const COL_NAME_QR_SERVICE_USEAGE = "qr_service_useage"; | |||||
| protected $table = "tbl3_mst_shop_no_relations"; | protected $table = "tbl3_mst_shop_no_relations"; | ||||
| protected $casts = [ | |||||
| self::COL_NAME_QR_SERVICE_USEAGE => QRServiceUsage::class, | |||||
| ]; | |||||
| public function getModelName(): string | public function getModelName(): string | ||||
| { | { | ||||
| return "店舗番号紐づけ"; | return "店舗番号紐づけ"; | ||||
| } | } | ||||
| public static function byKey(string $shopId, string $parkingManagementCode, QRServiceUsage $qrServiceUsage) | |||||
| { | |||||
| return static::whereShopId($shopId) | |||||
| ->whereParkingManagementCode($parkingManagementCode) | |||||
| ->whereQrServiceUseage($qrServiceUsage); | |||||
| } | |||||
| } | } | ||||
| @@ -2,6 +2,7 @@ | |||||
| namespace App\Repositories; | namespace App\Repositories; | ||||
| use App\Codes\Model\QRServiceUsage; | |||||
| use App\Models\ColumnName; | use App\Models\ColumnName; | ||||
| use App\Models\HtpmsCustomer\Existing\Parking; | use App\Models\HtpmsCustomer\Existing\Parking; | ||||
| use App\Models\HtpmsCustomer\Mst\ShopNoRelation; | use App\Models\HtpmsCustomer\Mst\ShopNoRelation; | ||||
| @@ -30,7 +31,8 @@ class CertificationAvailableSettingRepository extends BaseRepository | |||||
| public function get(array $condition): Collection | public function get(array $condition): Collection | ||||
| { | { | ||||
| $table = ShopNoRelation::getBuilder(static::TABLE_RELATION); | |||||
| $table = ShopNoRelation::getBuilder(static::TABLE_RELATION) | |||||
| ->where(ShopNoRelation::COL_NAME_QR_SERVICE_USEAGE, QRServiceUsage::認証方式->value); | |||||
| $table->leftJoinSub(CertificationAvailableSetting::getBuilder(), static::TABLE_SETTING, function (JoinClause $join) { | $table->leftJoinSub(CertificationAvailableSetting::getBuilder(), static::TABLE_SETTING, function (JoinClause $join) { | ||||
| $join->on( | $join->on( | ||||
| @@ -0,0 +1,65 @@ | |||||
| <?php | |||||
| use App\Codes\Model\QRServiceUsage; | |||||
| use App\Models\ColumnName; | |||||
| use App\Util\MigrationHelper; | |||||
| use Illuminate\Database\Migrations\Migration; | |||||
| use Illuminate\Database\Schema\Blueprint; | |||||
| use Illuminate\Support\Facades\DB; | |||||
| use Illuminate\Support\Facades\Schema; | |||||
| return new class extends Migration | |||||
| { | |||||
| protected $connection = "htpms_customer"; | |||||
| /** | |||||
| * Run the migrations. | |||||
| */ | |||||
| public function up(): void | |||||
| { | |||||
| // バックアップ | |||||
| $backup = DB::connection($this->connection)->table("tbl3_mst_shop_no_relations")->get(); | |||||
| // テーブル削除 | |||||
| Schema::drop("tbl3_mst_shop_no_relations"); | |||||
| Schema::drop("tbl3_mst_shop_no_relation_histories"); | |||||
| // テーブル作成 | |||||
| $schema = function (Blueprint $table, MigrationHelper $helper) { | |||||
| $helper->baseColumn() | |||||
| ->shopId() | |||||
| ->parkinManagementCode() | |||||
| ->shopNo(); | |||||
| $table->string("qr_service_useage")->comment("QRサービス券利用方法"); | |||||
| $helper->index(1, [ColumnName::PARKING_MANAGEMENT_CODE]); | |||||
| }; | |||||
| MigrationHelper::createTable("tbl3_mst_shop_no_relations", $schema, "HTD 店舗コード紐づけ"); | |||||
| MigrationHelper::createTable("tbl3_mst_shop_no_relation_histories", $schema, "HTD 店舗コード紐づけ履歴"); | |||||
| // ユニーク制約作成 | |||||
| MigrationHelper::addUnique("tbl3_mst_shop_no_relations", 1, [ | |||||
| ColumnName::SHOP_ID, | |||||
| ColumnName::PARKING_MANAGEMENT_CODE, | |||||
| "qr_service_useage", | |||||
| ]); | |||||
| // データ移行 | |||||
| foreach ($backup as $data) { | |||||
| DB::connection($this->connection)->table("tbl3_mst_shop_no_relations")->insert( | |||||
| [ | |||||
| ...json_decode(json_encode($data), true), | |||||
| "qr_service_useage" => QRServiceUsage::認証方式->value, | |||||
| ] | |||||
| ); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Reverse the migrations. | |||||
| */ | |||||
| public function down(): void | |||||
| { | |||||
| } | |||||
| }; | |||||