소스 검색

店舗番号紐づけにQRサービス券利用方法を追加

develop
sosuke.iwabuchi 1 년 전
부모
커밋
6ae5b73a84
9개의 변경된 파일120개의 추가작업 그리고 10개의 파일을 삭제
  1. +13
    -0
      app/Codes/Model/QRServiceUsage.php
  2. +6
    -2
      app/Http/Controllers/Web/QRService/Certification/CheckDataFormatController.php
  3. +6
    -3
      app/Http/Controllers/Web/Shop/Config/Certification/DeleteController.php
  4. +2
    -0
      app/Http/Controllers/Web/Shop/Config/Certification/RegisterController.php
  5. +6
    -2
      app/Http/Controllers/Web/Shop/Config/Certification/UpdateController.php
  6. +6
    -2
      app/Logics/QRService/CertificateLogic.php
  7. +13
    -0
      app/Models/HtpmsCustomer/Mst/ShopNoRelation.php
  8. +3
    -1
      app/Repositories/CertificationAvailableSettingRepository.php
  9. +65
    -0
      database/migrations/2024_04_04_085800_add_column_tbl3_mst_shop_no_relations.php

+ 13
- 0
app/Codes/Model/QRServiceUsage.php 파일 보기

@@ -0,0 +1,13 @@
<?php

namespace App\Codes\Model;

/**
* QRサービス券利用方法
*/
enum QRServiceUsage: string
{
case その他 = "その他";
case 認証方式 = "認証方式";
case 印字方式 = "印字方式";
}

+ 6
- 2
app/Http/Controllers/Web/QRService/Certification/CheckDataFormatController.php 파일 보기

@@ -2,6 +2,7 @@

namespace App\Http\Controllers\Web\QRService\Certification;

use App\Codes\Model\QRServiceUsage;
use App\Exceptions\GeneralErrorMessageException;
use App\Http\Controllers\Web\WebController;
use App\Logics\QRService\QRCryptoLogic;
@@ -42,8 +43,11 @@ class CheckDataFormatController extends WebController
$data = DataConverter::read($param->data);

// 対象の駐車場か判定
$relation = ShopNoRelation::whereShopId($this->sessionUser->shopId())
->whereParkingManagementCode($data->駐車場管理コード)
$relation = ShopNoRelation::byKey(
$this->sessionUser->shopId(),
$data->駐車場管理コード,
QRServiceUsage::認証方式
)
->first();

if ($relation === null) {


+ 6
- 3
app/Http/Controllers/Web/Shop/Config/Certification/DeleteController.php 파일 보기

@@ -2,6 +2,7 @@

namespace App\Http\Controllers\Web\Shop\Config\Certification;

use App\Codes\Model\QRServiceUsage;
use App\Http\Controllers\Web\WebController;
use App\Models\HtpmsCustomer\Mst\ShopNoRelation;
use App\Models\HtpmsCustomer\QRService\CertificationAvailableSetting;
@@ -36,11 +37,13 @@ class DeleteController extends WebController
->whereParkingManagementCode($param->parkingManagementCode)
->get();

$relation = ShopNoRelation::whereShopId($param->shopId)
->whereParkingManagementCode($param->parkingManagementCode)
$relation = ShopNoRelation::byKey(
$param->shopId,
$param->parkingManagementCode,
RServiceUsage::認証方式
)
->firstOrFail();


foreach ($settings as $setting) {
$setting->delete();
}


+ 2
- 0
app/Http/Controllers/Web/Shop/Config/Certification/RegisterController.php 파일 보기

@@ -2,6 +2,7 @@

namespace App\Http\Controllers\Web\Shop\Config\Certification;

use App\Codes\Model\QRServiceUsage;
use App\Exceptions\ParamException;
use App\Http\Controllers\Web\WebController;
use App\Models\ColumnName;
@@ -44,6 +45,7 @@ class RegisterController extends WebController
$relation->shop_id = $param->shopId;
$relation->parking_management_code = $param->parkingManagementCode;
$relation->shop_no = $param->shopNo;
$relation->qr_service_useage = QRServiceUsage::認証方式;
$relation->save();




+ 6
- 2
app/Http/Controllers/Web/Shop/Config/Certification/UpdateController.php 파일 보기

@@ -2,6 +2,7 @@

namespace App\Http\Controllers\Web\Shop\Config\Certification;

use App\Codes\Model\QRServiceUsage;
use App\Http\Controllers\Web\WebController;
use App\Models\HtpmsCustomer\Mst\ShopNoRelation;
use Illuminate\Http\JsonResponse;
@@ -30,8 +31,11 @@ class UpdateController extends WebController
{
$param = $this->param;

$relation = ShopNoRelation::whereShopId($param->shopId)
->whereParkingManagementCode($param->parkingManagementCode)
$relation = ShopNoRelation::byKey(
$param->shopId,
$param->parkingManagementCode,
QRServiceUsage::認証方式
)
->firstOrFail();

$relation->shop_no = $param->shopNo;


+ 6
- 2
app/Logics/QRService/CertificateLogic.php 파일 보기

@@ -3,6 +3,7 @@
namespace App\Logics\QRService;

use App\Codes\DepositTransferReason;
use App\Codes\Model\QRServiceUsage;
use App\Exceptions\AppCommonException;
use App\Models\HtpmsCustomer\Mst\ShopNoRelation;
use App\Models\HtpmsCustomer\QRService\CertificationAvailableSetting;
@@ -52,8 +53,11 @@ class CertificateLogic
$qr->discount_ticket_code = $discountTicketCode;

// 店舗番号の解決
$relation = ShopNoRelation::whereShopId($shopId)
->whereParkingManagementCode($parkingManagementCode)
$relation = ShopNoRelation::byKey(
$shopId,
$parkingManagementCode,
QRServiceUsage::認証方式
)
->first();
if ($relation instanceof ShopNoRelation === false) {
throw new AppCommonException("店舗番号紐づけ未設定");


+ 13
- 0
app/Models/HtpmsCustomer/Mst/ShopNoRelation.php 파일 보기

@@ -2,6 +2,7 @@

namespace App\Models\HtpmsCustomer\Mst;

use App\Codes\Model\QRServiceUsage;
use App\Models\ColumnName;
use App\Models\HtpmsCustomer\HtpmsCustomerAppModel;

@@ -13,11 +14,23 @@ class ShopNoRelation extends HtpmsCustomerAppModel
const COL_NAME_SHOP_ID = ColumnName::SHOP_ID;
const COL_NAME_PARKING_MANAGEMENT_CODE = ColumnName::PARKING_MANAGEMENT_CODE;
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 $casts = [
self::COL_NAME_QR_SERVICE_USEAGE => QRServiceUsage::class,
];

public function getModelName(): string
{
return "店舗番号紐づけ";
}

public static function byKey(string $shopId, string $parkingManagementCode, QRServiceUsage $qrServiceUsage)
{
return static::whereShopId($shopId)
->whereParkingManagementCode($parkingManagementCode)
->whereQrServiceUseage($qrServiceUsage);
}
}

+ 3
- 1
app/Repositories/CertificationAvailableSettingRepository.php 파일 보기

@@ -2,6 +2,7 @@

namespace App\Repositories;

use App\Codes\Model\QRServiceUsage;
use App\Models\ColumnName;
use App\Models\HtpmsCustomer\Existing\Parking;
use App\Models\HtpmsCustomer\Mst\ShopNoRelation;
@@ -30,7 +31,8 @@ class CertificationAvailableSettingRepository extends BaseRepository
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) {
$join->on(


+ 65
- 0
database/migrations/2024_04_04_085800_add_column_tbl3_mst_shop_no_relations.php 파일 보기

@@ -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
{
}
};

Loading…
취소
저장