| @@ -0,0 +1,27 @@ | |||
| <?php | |||
| namespace App\Email\Members; | |||
| class ParkingCertificateOrderNotice extends Members | |||
| { | |||
| public function __construct() | |||
| { | |||
| } | |||
| public function getTemplateName(): string | |||
| { | |||
| return 'emails.members.parking_certificate_order_notice'; | |||
| } | |||
| public function getSubject(): string | |||
| { | |||
| return "車庫証明発行申請受付のお知らせ"; | |||
| } | |||
| public function getMemberParams(): array | |||
| { | |||
| return []; | |||
| } | |||
| } | |||
| @@ -2,9 +2,12 @@ | |||
| namespace App\Http\Controllers\Web\Customer; | |||
| use App\Email\Members\ParkingCertificateOrderNotice; | |||
| use App\Http\Controllers\Web\WebController; | |||
| use App\Logic\EmailManager; | |||
| use Illuminate\Http\JsonResponse; | |||
| use Illuminate\Http\Request; | |||
| use Illuminate\Support\Facades\Auth; | |||
| class UpdateUserInfoOrderController extends WebController | |||
| { | |||
| @@ -28,6 +31,13 @@ class UpdateUserInfoOrderController extends WebController | |||
| protected function run(Request $request): JsonResponse | |||
| { | |||
| $user = Auth::user(); | |||
| $mailer = (new ParkingCertificateOrderNotice()) | |||
| ->setUser($user); | |||
| (new EmailManager($mailer))->confirm(); | |||
| return $this->successResponse(); | |||
| } | |||
| } | |||
| @@ -2,9 +2,13 @@ | |||
| namespace App\Http\Controllers\Web\SeasonTicketContract; | |||
| use App\Email\Members\ParkingCertificateOrderNotice; | |||
| use App\Http\Controllers\Web\WebController; | |||
| use App\Kintone\Models\GeneralApplication; | |||
| use App\Logic\EmailManager; | |||
| use Illuminate\Http\JsonResponse; | |||
| use Illuminate\Http\Request; | |||
| use Illuminate\Support\Facades\Auth; | |||
| class ParkingCertificateOrderController extends WebController | |||
| { | |||
| @@ -28,6 +32,13 @@ class ParkingCertificateOrderController extends WebController | |||
| protected function run(Request $request): JsonResponse | |||
| { | |||
| $user = Auth::user(); | |||
| $mailer = (new ParkingCertificateOrderNotice()) | |||
| ->setUser($user); | |||
| (new EmailManager($mailer))->confirm(); | |||
| return $this->successResponse(); | |||
| } | |||
| } | |||
| @@ -3,9 +3,15 @@ | |||
| namespace App\Http\Controllers\Web\SeasonTicketContract; | |||
| use App\Http\Controllers\Web\WebController; | |||
| use App\Kintone\Models\Customer; | |||
| use App\Kintone\Models\Parking; | |||
| use App\Kintone\Models\SeasonTicketContract; | |||
| use App\Kintone\Models\SeasonTicketReOrderApplication; | |||
| use App\Logic\GeneralApplicationManager; | |||
| use Illuminate\Http\JsonResponse; | |||
| use Illuminate\Http\Request; | |||
| class SeasonTicketReOrderController extends WebController | |||
| { | |||
| @@ -28,6 +34,25 @@ class SeasonTicketReOrderController extends WebController | |||
| protected function run(Request $request): JsonResponse | |||
| { | |||
| $param = $this->param; | |||
| $parking = Parking::findByParkingName($param->parkingName); | |||
| $customer = Customer::getSelf(); | |||
| $seasonTicketContract = SeasonTicketContract::find($param->seasonTicketContractRecordNo); | |||
| $application = new SeasonTicketReOrderApplication(); | |||
| $manager = new GeneralApplicationManager($application); | |||
| $manager | |||
| ->setCustomer($customer) | |||
| ->setSeasonTicketContract($seasonTicketContract) | |||
| ->setParking($parking) | |||
| ->makeApplication(); | |||
| $application->reason = $param->reason; | |||
| $application->memo = $param->memo; | |||
| $application->save(); | |||
| return $this->successResponse(); | |||
| } | |||
| } | |||
| @@ -3,10 +3,12 @@ | |||
| namespace App\Http\Controllers\Web\SeasonTicketContract; | |||
| use App\Http\Controllers\Web\BaseParam; | |||
| use App\Kintone\Models\GeneralApplication; | |||
| /** | |||
| * @property string $seasonTicketContractRecordNo | |||
| * @property string $parkingName | |||
| * @property string $reason | |||
| * @property string $memo | |||
| */ | |||
| class SeasonTicketReOrderParams extends BaseParam | |||
| { | |||
| @@ -14,6 +16,9 @@ class SeasonTicketReOrderParams extends BaseParam | |||
| { | |||
| return [ | |||
| 'season_ticket_contract_record_no' => $this->str(), | |||
| 'parking_name' => $this->str(), | |||
| 'reason' => $this->str(), | |||
| 'memo' => $this->str(true), | |||
| ]; | |||
| } | |||
| } | |||
| @@ -4,9 +4,10 @@ namespace App\Http\Controllers\Web\SeasonTicketContract; | |||
| use App\Http\Controllers\Web\WebController; | |||
| use App\Kintone\Models\Customer; | |||
| use App\Kintone\Models\GeneralApplication; | |||
| use App\Kintone\Models\Parking; | |||
| use App\Kintone\Models\SeasonTicketContract; | |||
| use App\Kintone\Models\TerminateApplication; | |||
| use App\Logic\GeneralApplicationManager; | |||
| use Auth; | |||
| use Illuminate\Http\JsonResponse; | |||
| use Illuminate\Http\Request; | |||
| @@ -24,7 +25,7 @@ class TerminationOrderController extends WebController | |||
| } | |||
| public function __construct(protected TerminationOrderParams $param, private GeneralApplicationManager $manager) | |||
| public function __construct(protected TerminationOrderParams $param) | |||
| { | |||
| parent::__construct(); | |||
| $this->middleware('auth:sanctum'); | |||
| @@ -34,16 +35,25 @@ class TerminationOrderController extends WebController | |||
| { | |||
| $param = $this->param; | |||
| $parking = Parking::findByParkingName($param->parkingName); | |||
| $customer = Customer::getSelf(); | |||
| $seasonTicketContract = SeasonTicketContract::find($param->seasonTicketContractRecordNo); | |||
| $attr = [ | |||
| GeneralApplication::FIELD_SEASON_TICKET_CONTRACT_RECORD_NO => $param->seasonTicketContractRecordNo, | |||
| GeneralApplication::FIELD_TERMINATE_DATE => $param->date, | |||
| GeneralApplication::FIELD_MEMO => $param->memo, | |||
| ]; | |||
| $this->manager->forTerminate($attr) | |||
| $application = new TerminateApplication(); | |||
| $manager = new GeneralApplicationManager($application); | |||
| $manager | |||
| ->setCustomer($customer) | |||
| ->register(); | |||
| ->setSeasonTicketContract($seasonTicketContract) | |||
| ->setParking($parking) | |||
| ->makeApplication(); | |||
| $application->terminateDate = $param->terminateDate; | |||
| $application->reason = explode(",", $param->reason); | |||
| $application->reasonDetail = $param->reasonDetail; | |||
| $application->opinion = $param->opinion; | |||
| $application->memo = $param->memo; | |||
| $application->save(); | |||
| return $this->successResponse(); | |||
| } | |||
| @@ -25,7 +25,7 @@ class TerminationOrderOptionsController extends WebController | |||
| } | |||
| public function __construct(protected TerminationOrderOptionsParams $param, private GeneralApplicationManager $manager) | |||
| public function __construct(protected TerminationOrderOptionsParams $param) | |||
| { | |||
| parent::__construct(); | |||
| $this->middleware('auth:sanctum'); | |||
| @@ -35,12 +35,6 @@ class TerminationOrderOptionsController extends WebController | |||
| { | |||
| $param = $this->param; | |||
| $customer = Customer::getSelf(); | |||
| $seasonTicketContract = SeasonTicketContract::getAccess()->find($param->seasonTicketContractRecordNo); | |||
| // $parking = $seasonTicketContract->parkingRoom(); | |||
| $monthes = []; | |||
| foreach (range(0, 3) as $m) { | |||
| @@ -3,13 +3,16 @@ | |||
| namespace App\Http\Controllers\Web\SeasonTicketContract; | |||
| use App\Http\Controllers\Web\BaseParam; | |||
| use App\Kintone\Models\DropDown\GeneralApplicationType; | |||
| use Illuminate\Validation\Rules\Enum; | |||
| use Illuminate\Support\Carbon; | |||
| /** | |||
| * @property string $seasonTicketContractRecordNo | |||
| * @property string $date | |||
| * @property ?string $memo | |||
| * @property string $parkingName | |||
| * @property Carbon $terminateDate | |||
| * @property string reason | |||
| * @property ?string reasonDetail | |||
| * @property ?string opinion | |||
| * @property ?string memo | |||
| */ | |||
| class TerminationOrderParams extends BaseParam | |||
| { | |||
| @@ -17,7 +20,11 @@ class TerminationOrderParams extends BaseParam | |||
| { | |||
| return [ | |||
| 'season_ticket_contract_record_no' => $this->str(), | |||
| 'date' => $this->date(), | |||
| 'parking_name' => $this->str(), | |||
| 'terminate_date' => $this->date(), | |||
| 'reason' => $this->str(), | |||
| 'reason_detail' => $this->str(true), | |||
| 'opinion' => $this->str(true), | |||
| 'memo' => $this->str(true), | |||
| ]; | |||
| } | |||
| @@ -3,6 +3,11 @@ | |||
| namespace App\Http\Controllers\Web\SeasonTicketContract; | |||
| use App\Http\Controllers\Web\WebController; | |||
| use App\Kintone\Models\Customer; | |||
| use App\Kintone\Models\Parking; | |||
| use App\Kintone\Models\SeasonTicketContract; | |||
| use App\Kintone\Models\VehicleInfoUpdateApplication; | |||
| use App\Logic\GeneralApplicationManager; | |||
| use Illuminate\Http\JsonResponse; | |||
| use Illuminate\Http\Request; | |||
| @@ -28,6 +33,29 @@ class UpdateVehicleInfoOrderController extends WebController | |||
| protected function run(Request $request): JsonResponse | |||
| { | |||
| $param = $this->param; | |||
| $parking = Parking::findByParkingName($param->parkingName); | |||
| $customer = Customer::getSelf(); | |||
| $seasonTicketContract = SeasonTicketContract::find($param->seasonTicketContractRecordNo); | |||
| $application = new VehicleInfoUpdateApplication(); | |||
| $manager = new GeneralApplicationManager($application); | |||
| $manager | |||
| ->setCustomer($customer) | |||
| ->setSeasonTicketContract($seasonTicketContract) | |||
| ->setParking($parking) | |||
| ->makeApplication(); | |||
| $application->changeDate = $param->changeDate; | |||
| $application->vehicleNoBefore = $seasonTicketContract->vehicleNo; | |||
| $application->vehicleNoAfter = $param->vehicleNo; | |||
| $application->registerNoBefore = $seasonTicketContract->registerNo; | |||
| $application->registerNoAfter = $param->registerNo; | |||
| $application->memo = $param->memo; | |||
| $application->save(); | |||
| return $this->successResponse(); | |||
| } | |||
| } | |||
| @@ -3,9 +3,15 @@ | |||
| namespace App\Http\Controllers\Web\SeasonTicketContract; | |||
| use App\Http\Controllers\Web\BaseParam; | |||
| use Illuminate\Support\Carbon; | |||
| /** | |||
| * @property string $seasonTicketContractRecordNo | |||
| * @property string $parkingName | |||
| * @property Carbon $changeDate | |||
| * @property string $vehicleNo | |||
| * @property string $registerNo | |||
| * @property string $memo | |||
| */ | |||
| class UpdateVehicleInfoOrderParams extends BaseParam | |||
| { | |||
| @@ -13,6 +19,11 @@ class UpdateVehicleInfoOrderParams extends BaseParam | |||
| { | |||
| return [ | |||
| 'season_ticket_contract_record_no' => $this->str(), | |||
| 'parking_name' => $this->str(), | |||
| 'change_date' => $this->date(), | |||
| 'vehicle_no' => $this->str(true), | |||
| 'register_no' => $this->str(true), | |||
| 'memo' => $this->str(true), | |||
| ]; | |||
| } | |||
| } | |||
| @@ -6,11 +6,11 @@ use Illuminate\Support\Facades\Auth; | |||
| /** | |||
| * アプリ名 顧客マスタ | |||
| * @property string $customerCode | |||
| * @property string $customerName | |||
| * @property string $customerNameKana | |||
| * @property string $email | |||
| * @property string $phone_number | |||
| * @property string customerCode | |||
| * @property string customerName | |||
| * @property string customerNameKana | |||
| * @property string email | |||
| * @property string phoneNumber | |||
| */ | |||
| class Customer extends KintoneModel | |||
| { | |||
| @@ -21,6 +21,8 @@ class Customer extends KintoneModel | |||
| const FIELD_CUSTOMER_NAME_KANA = "顧客名カナ"; | |||
| const FIELD_EMAIL = "メールアドレス"; | |||
| const FIELD_PHONE_NUMBER = "電話番号"; | |||
| const FIELD_ZIP_CODE = "契約者_郵便番号"; | |||
| const FIELD_ADDRESS = "住所"; | |||
| protected const FIELDS = [ | |||
| ...parent::FIELDS, | |||
| @@ -29,12 +31,17 @@ class Customer extends KintoneModel | |||
| self::FIELD_CUSTOMER_NAME_KANA => FieldType::SINGLE_LINE_TEXT, | |||
| self::FIELD_EMAIL => FieldType::LINK, | |||
| self::FIELD_PHONE_NUMBER => FieldType::LINK, | |||
| self::FIELD_ZIP_CODE => FieldType::SINGLE_LINE_TEXT, | |||
| self::FIELD_ADDRESS => FieldType::SINGLE_LINE_TEXT, | |||
| ]; | |||
| protected const FIELD_NAMES = [ | |||
| ...parent::FIELD_NAMES, | |||
| self::FIELD_CUSTOMER_NAME => 'customer_name', | |||
| self::FIELD_EMAIL => 'email', | |||
| self::FIELD_ZIP_CODE => 'zip_code', | |||
| self::FIELD_ADDRESS => 'address', | |||
| self::FIELD_PHONE_NUMBER => 'phone_no', | |||
| ]; | |||
| public static function getSelf(): static | |||
| @@ -82,6 +82,9 @@ abstract class KintoneModel | |||
| return new KintoneRecordQuery($target); | |||
| } | |||
| /** | |||
| * @return static | |||
| */ | |||
| public static function find(string $recordId) | |||
| { | |||
| return static::getAccess()->find($recordId); | |||
| @@ -7,6 +7,8 @@ use LogicException; | |||
| /** | |||
| * アプリ名 車室情報管理 | |||
| * @property string seasonTicketSeqNo | |||
| * @property string vehicleNo | |||
| * @property string registerNo | |||
| */ | |||
| class SeasonTicketContract extends KintoneModel | |||
| { | |||
| @@ -15,6 +17,7 @@ class SeasonTicketContract extends KintoneModel | |||
| const FIELD_CUSTOMER_CODE = "顧客コード"; | |||
| const FIELD_SEASON_TICKET_SEQ_NO = "定期券番号_0"; | |||
| const FIELD_VEHICLE_NO = "車両番号"; | |||
| const FIELD_REGISTER_NO = "防犯登録番号"; | |||
| const FIELD_CONTRACT_START_DATE = "契約日"; | |||
| const FIELD_CONTRACT_END_DATE = "解約日"; | |||
| const FIELD_CONTRACT_AMOUNT = "契約金額"; | |||
| @@ -29,6 +32,7 @@ class SeasonTicketContract extends KintoneModel | |||
| self::FIELD_CUSTOMER_CODE => FieldType::NUMBER, | |||
| self::FIELD_SEASON_TICKET_SEQ_NO => FieldType::SINGLE_LINE_TEXT, | |||
| self::FIELD_VEHICLE_NO => FieldType::SINGLE_LINE_TEXT, | |||
| self::FIELD_REGISTER_NO => FieldType::SINGLE_LINE_TEXT, | |||
| self::FIELD_CONTRACT_START_DATE => FieldType::DATE, | |||
| self::FIELD_CONTRACT_END_DATE => FieldType::DATE, | |||
| self::FIELD_CONTRACT_AMOUNT => FieldType::NUMBER, | |||
| @@ -42,6 +46,7 @@ class SeasonTicketContract extends KintoneModel | |||
| ...parent::FIELD_NAMES, | |||
| self::FIELD_SEASON_TICKET_SEQ_NO => 'season_ticket_seq_no', | |||
| self::FIELD_VEHICLE_NO => 'vehicle_no', | |||
| self::FIELD_REGISTER_NO => 'register_no', | |||
| self::FIELD_CONTRACT_START_DATE => 'contract_start_date', | |||
| self::FIELD_CONTRACT_END_DATE => 'contract_end_date', | |||
| self::FIELD_CONTRACT_AMOUNT => 'contract_amount', | |||
| @@ -2,8 +2,15 @@ | |||
| namespace App\Kintone\Models; | |||
| use Illuminate\Support\Carbon; | |||
| /** | |||
| * アプリ名 各種申請 [解約申請] | |||
| * @property Carbon terminateDate | |||
| * @property array reason | |||
| * @property string reasonDetail | |||
| * @property string opinion | |||
| * @property string memo | |||
| */ | |||
| class TerminateApplication extends GeneralApplication | |||
| { | |||
| @@ -15,7 +22,7 @@ class TerminateApplication extends GeneralApplication | |||
| protected const FIELDS = [ | |||
| ...parent::FIELDS, | |||
| self::FIELD_TERMINATE_DATE => FieldType::DATETIME, | |||
| self::FIELD_TERMINATE_DATE => FieldType::DATE, | |||
| self::FIELD_REASON => FieldType::CHECK_BOX, | |||
| self::FIELD_REASON_DETAIL => FieldType::MULTI_LINE_TEXT, | |||
| self::FIELD_OPINION => FieldType::MULTI_LINE_TEXT, | |||
| @@ -4,6 +4,13 @@ namespace App\Kintone\Models; | |||
| /** | |||
| * アプリ名 各種申請 [車両番号・防犯番号変更申請] | |||
| * @property ?Carbon changeDate | |||
| * @property string vehicleNoBefore | |||
| * @property string vehicleNoAfter | |||
| * @property string vehicleNoBefore | |||
| * @property string registerNoBefore | |||
| * @property string registerNoAfter | |||
| * @property string memo | |||
| */ | |||
| class VehicleInfoUpdateApplication extends GeneralApplication | |||
| { | |||
| @@ -2,6 +2,7 @@ | |||
| namespace App\Logic; | |||
| use App\Exceptions\AppCommonException; | |||
| use App\Kintone\Models\Customer; | |||
| use App\Kintone\Models\GeneralApplication; | |||
| use App\Kintone\Models\Parking; | |||
| @@ -112,6 +113,19 @@ class GeneralApplicationManager | |||
| private function getApplicationNo(): string | |||
| { | |||
| return sprintf("%s-%06d", DateUtil::now()->format('Ymd'), rand(1, 999999)); | |||
| /** | |||
| * 申請番号を発番する。重複チェックを一定回数行う。 | |||
| */ | |||
| for ($i = 0; $i < 10; $i++) { | |||
| $no = sprintf("%s-%06d", DateUtil::now()->format('Ymd'), rand(1, 999999)); | |||
| $check = GeneralApplication::getAccess()->some(GeneralApplication::getQuery()->where(GeneralApplication::FIELD_APPLICATION_NO, $no)); | |||
| if ($check->isEmpty()) { | |||
| return $no; | |||
| } | |||
| } | |||
| throw new AppCommonException('申請番号取得失敗'); | |||
| } | |||
| } | |||
| @@ -27,6 +27,7 @@ return [ | |||
| 'applications' => [ | |||
| ...App\Kintone\Models\Customer::setConfig(), | |||
| ...App\Kintone\Models\Parking::setConfig(), | |||
| ...App\Kintone\Models\ParkingRoom::setConfig(), | |||
| ...App\Kintone\Models\SeasonTicketContract::setConfig(), | |||
| ...App\Kintone\Models\PaymentPlan::setConfig(), | |||