# Eo / Web / Webview / Kkw05501sf

## Overview

The `KKW05501SF` package is the **View logic** layer for the **Request Destination Batch Consolidation screen** (請求先一括併合画面) in the eo Customer Base System. It handles the user-facing business logic for merging billing/invoicing destinations (請求先) across one or more service contracts into a single new destination. This allows operators to consolidate multiple contract billing destinations — each potentially with different payment methods, payee types, and addresses — into a unified billing arrangement.

The package spans three related screens: `KKW05501` (history list/search), `KKW05502` (update confirmation), and `KKW05503` (update completion). It integrates with backend services through data mappers (`KKSV0544`, `KKSV0545`, `KKSV0546`) for querying contract history, searching payees, and performing updates respectively.

## Key Classes and Interfaces

### KKW05501SFLogic — View Business Logic

Located at [KKW05501SFLogic](source/koptWebB/src/eo/web/webview/KKW05501SF/KKW05501SFLogic.java), this is the central class of the package. It extends `JCCWebBusinessLogic` and orchestrates all screen operations.

**Purpose:** Performs the View-layer business processing for the request destination batch consolidation screen, including initial display, search, validation, update confirmation, and completion flows.

**Key methods and what they do:**

- **`init()`** — Entry point on initial screen load. Retrieves screen info from the previous screen, extracts inherited customer contract data from the `HKTGI_CUST_KEI_HKTGI_LIST` bean array, determines whether the navigation came from a transfer selection screen, a popup, or a management contract list. Sets the service contract number, transfer division code, reason code, and operating date. Calls `callServiceKKSV0544` to fetch the contract history list. If the screen originated from the management list (`KKW12503`), sets a flag to use mansion-specific service contract numbers. Matches returned list items against the parameter service contract numbers to highlight selected entries. Displays a warning message if the customer is a partner member (ANK-3478-00-00), since billing destination splitting is not possible for partner members.

- **`seikyKeiSearch()`** — Handles the payee search button press. Invokes `callServiceKKSV0545` to search for billing destination information by criteria. If results are found, calls `setScreenData()` to populate display fields (code-to-name resolution for legal entity, address, payment method, credit card numbers). If no results, calls `setScreenClear()` to reset all fields. Also checks for partner member status to display appropriate warnings.

- **`openSeikyKeiSearch()` / `closeSeikyKeiSearch()`** — Navigate to and from the payee search screen (`KKW00704`). On close, retrieves the selected payee number from the returned result map and triggers a search to populate the screen with the selected payee's data.

- **`forwardUpdCfm()`** — Handles the "Update Confirmation" button. Performs input validation via `inputCheck()`, calls the update service (`callServiceUpdata` with `FUNC_CODE_2`) to prepare data for confirmation, runs warning checks, then navigates to screen `KKW05502`.

- **`forwardFix()`** — Handles the "Confirm" (determine) button. Calls `callServiceUpdata` with `FUNC_CODE_1` to perform the actual update, runs warnings, then navigates to screen `KKW05503` (completion screen).

- **`forwardShusei()`** — Handles the "Fix" (edit) button, returning the user to screen `KKW05501` to make corrections.

- **`forwardIdoDivSel()`** — Navigates to the transfer division selection screen (`KKW00145`).

- **`forwardCustListShokai()` / `forwardMansListShokai()`** — Navigate to customer list or mansion contract list screens for reference.

- **`inputCheck()`** — Critical validation method. Checks that the application date is not more than 3 months in the future. Validates contract type compatibility between the new billing destination and each selected source contract (individual-to-legal, legal-to-individual, and retail/wholesale mismatch checks). Verifies that the specified billing destination is valid (not in NG status codes `060E` or `080E`). Outputs warning messages for future-dated entries, promotional states, and net/hybrid payment type mismatches.

- **`warningCheck()`** — Post-update confirmation warnings. Checks for hybrid contract types that require attention, MVNO contract payment method conflicts, and eo electricity contract associations. Uses deduplication flags (`blAlrdyOutputEKBA880Q_Mado`, `blAlrdyOutputEKBA880Q_Koza`) to prevent duplicate warning messages.

- **`checkTypeInfo()`** — Validates payee type compatibility. Ensures that combining billing destinations from different customer divisions (individual, legal, maintenance, self-use) is not permitted. Checks retail/wholesale code consistency within the same division.

- **`callServiceKKSV0544()`** — Calls the backend service for fetching the contract history list on initial display. Uses `KKSV0544_KKSV0544OPDBMapper` to map input/output between the service bean and the service layer. Sets masked values for sensitive display fields.

- **`callServiceKKSV0545()`** — Calls the backend service for payee information search. Uses `KKSV0545_KKSV0545OPDBMapper`. Handles error cases: no results found, duplicate check errors (billing destination already being merged).

- **`callServiceUpdata()`** — Calls the backend service for update processing (both confirmation and actual update). Uses `KKSV0546_KKSV0546OPDBMapper`. Checks CIC integration flags for error conditions. Validates that the application date is not before the reserved application date returned from the service.

- **`setScreenData()`** — Translates code values to display names for dropdown lookups (legal entity status, legal entity type, forced window flag, payment method). Sets masked display values for all sensitive fields (credit card numbers, bank account numbers, addresses). Handles the credit card display formatting (hyphen insertion for 16-digit cards). Sets payment validity status based on payment method code and settlement result codes (bank transfer OK/NG, postal automatic transfer OK/NG, credit card approval).

- **`setScreenClear()`** — Resets all display fields to empty values, used when search returns no results.

- **`setJKKCrecaPaySkaJdgResult()`** — Performs credit card payment validity determination by calling `JKKCrecaPaySkaJdg.doCrecaPaySkaJdg()`. Uses the operation date, validation result division, credit card status, destination company code, invalid year-month, validity period, and transfer division to compute the payment result display string.

**Important constants defined in Logic:**

| Constant | Value | Meaning |
|---|---|---|
| `PAY_SKEKKA_CD_KOZA_OK` | `"20"` | Bank transfer application OK |
| `PAY_SKEKKA_CD_KOZA_NG` | `"21"` | Bank transfer application NG |
| `PAY_SKEKKA_CD_POST_OK` | `"30"` | Postal automatic transfer OK |
| `PAY_SKEKKA_CD_POST_NG` | `"31"` | Postal automatic transfer NG |
| `SEIKY_WAY_CD_1` | `"1"` | Window payment (counter) |
| `SEIKY_WAY_CD_2` | `"2"` | Bank transfer |
| `SEIKY_WAY_CD_3` | `"3"` | Postal automatic transfer |
| `SVC_CD_51` | `"51"` | MVNO service code |
| `SVC_KEI_STAT_CD_910` | `"910"` | Contract terminated |
| `SVC_KEI_STAT_CD_920` | `"920"` | Contract cancelled |
| `PTNR_MEMBER_FLG_ON` | `"1"` | Partner member flag active |
| `PTNR_MEMBER_FLG_OFF` | `"0"` | Partner member flag inactive |

### KKW05501SFBean — Main Screen DDO (Data Definition Object)

Located at [KKW05501SFBean](source/koptWebB/src/eo/web/webview/KKW05501SF/KKW05501SFBean.java), this is the main screen-level data bean. It extends `X33VViewBaseBean` and implements `X33VListedBeanInterface` and `X31CBaseBean`.

**Purpose:** Holds all form data for the main screen (`KKW05501`). Defines properties for every field displayed on the screen — approximately 200+ property fields, each with `_value`, `_enabled`, `_state`, and `_update` suffixes following the X33 DDO pattern.

**Key property groups:**

- **Header fields:** `seiky_kei_no` (billing destination number), `seiky_payway_aply_in` (application date input), `ido_div` (transfer division), `stdardymd` (operating date), `popup_mode`
- **Sender info:** `shs_nm`, `shs_nm_kana`, `shs_bkm`, `shs_tntsha_nm`, `shs_telno`, `shs_pcd`, `shs_place`, `shs_state`, `shs_city`, etc. (postal code, address fields)
- **Payment info:** `pay_payway_cd` (payment method code), `pay_skekka_cd` (settlement result code), `pay_seiky_kei_kana` (payee name in katakana), `pay_first_seiky` (first billing month)
- **Bank account info:** `yokin_bank_cd`, `yokin_shiten_cd`, `yokin_koza_no`, `yokin_shumoku_cd`, `post_tsucho_symbol`, `post_tsucho_no`
- **Credit card info:** `crdt_card_kind_cd`, `crdt_card_no`, `crdt_yk_kigen`, `crdt_mk_kigen`, `crdt_card_azkri_id` (card reservation ID)
- **Masked display fields:** Each sensitive field has a corresponding `_MSK` property for masked display (e.g., `crdt_card_no_msk1`, `yokin_bank_cd_msk`)
- **List data beans:** `rireki_svc_kei_list_list` (service contract history list), `shs_hojin_zengo_list`, `shs_hojin_list`, `pay_kyosei_madoguchi_list`, `pay_seikyus_hakko_yh_list`, `yokin_shumoku_list`, `crdt_card_kind_list`

The bean is referenced by 3 XML configuration files and 3 JSP views.

### KKW05501SF01DBean — Code Table DDO

Located at [KKW05501SF01DBean](source/koptWebB/src/eo/web/webview/KKW05501SF/KKW05501SF01DBean.java), this bean handles code table (lookup) data.

**Purpose:** Manages code table dropdown data used for displaying human-readable names next to code values on the screen. Implements `X33VDataTypeBeanInterface` for dynamic data binding.

**Key properties:**
- `cd_div_cd_list_list` — Code table value list (code values)
- `cd_div_nm_list_list` — Code table name list (display names)
- `default_cd_list` — Default code settings list

**Key methods:**
- **`loadModelData(key, subkey)`** — Dynamic data loader. Takes a key (e.g., "コードタイプコード") and subkey (e.g., "value", "enable", "state") and routes to the appropriate getter. Also handles indexed list access for `default_cd`, `cd_div_cd_list`, and `cd_div_nm_list` (supports `*` for list size).
- **`storeModelData(key, subkey, in_value)`** — Dynamic data setter. The inverse of `loadModelData`, routes set operations to the correct setter based on the key/subkey combination.
- **`addListDataInstance(key)`** — Adds a new element instance to a list property, returns the index of the added element.
- **`removeElementFromListData(key, index)`** — Removes an element at the specified index from a list.
- **`clearListDataInstance(key)`** — Clears all elements from a list.
- **`typeModelData(key, subkey)`** — Returns the Class type for a given key/subkey pair, used for type-safe data binding.
- **`listKoumokuIds()`** — Returns the list of all property names defined in this bean.

### KKW05501SF02DBean — List DDO (Contract History List)

Located at [KKW05501SF02DBean](source/koptWebB/src/eo/web/webview/KKW05501SF/KKW05501SF02DBean.java), this bean represents a single row in the service contract history list displayed on the screen.

**Purpose:** Holds data for each row in the `rireki_svc_kei_list` (service contract history list). Each row represents a service contract that can be selected for billing destination consolidation.

**Key properties (each with `update`, `value`, `enabled`, `state` variants):**
- `l_sysid` — System ID
- `l_keisha_type_cd` — Contract type code (1=Individual, 2=Legal, 3=Maintenance, 4=Self-use)
- `l_naihan_gaihan_cd` — Retail/wholesale code
- `l_naihan_comp_skbt_cd` — Retail company identification code
- `l_prc_grp_cd` — Price group code
- `l_pplan_cd` / `l_pplan_nm` — Price plan code and name
- `l_color` — Background color
- `l_tokusoku_no` / `l_tokusoku_stat` — Promotion number and status
- `l_svc_kei_no` — Service contract number
- `l_mskm_dtl_no` — Application detail number
- `l_seiky_kei_no` — Billing destination number
- `l_kakins_no` — Charge number
- `l_last_upd_dtm` — Last update datetime
- `l_ido_div` — Transfer division
- `l_svc_kei_kaisen_ucwk_no` — Contract withdrawal detail number
- `l_svc_cd` — Service code
- `l_svc_kei_stat_cd` — Contract status code
- `l_checked_sel` — Checkbox selection value ("1" = selected)

### KKW05501SF03DBean — Inheritance Data DDO

Located at [KKW05501SF03DBean](source/koptWebB/src/eo/web/webview/KKW05501SF/KKW05501SF03DBean.java), this bean holds customer contract inheritance data.

**Purpose:** Manages the inherited customer contract information passed between screens. Contains fields for system ID, service contract number, transfer division, transfer reason code/memo, transaction division, mansion detail number, specified ID info, popup mode, and mansion-specific data.

**Key properties:** `hktgi_sysid`, `hktgi_svc_kei_no`, `hktgi_ido_div`, `hktgi_ido_rsn_cd`, `hktgi_ido_rsn_memo`, `hktgi_op_svc_kei_no`, `hktgi_tran_div`, `hktgi_mskm_no`, `hktgi_mskm_dtl_no`, `hktgi_popup_mode`, `hktgi_mans_nm`, `hktgi_mans_ad_nm`, `hktgi_pid`, `hktgi_mans_id`, `hktgi_catid`. Also includes three `X33VDataTypeList` properties for dropdown data: `hktgi_ido_rsn_cd_list`, `hktgi_op_svc_kei_no_list`, `hktgi_mskm_svc_kei_no_list`.

### KKW05501SF04DBean — Type Info DDO

Located at [KKW05501SF04DBean](source/koptWebB/src/eo/web/webview/KKW05501SF/KKW05501SF04DBean.java), this bean holds contract type information for payee validation.

**Purpose:** Holds data used by `checkTypeInfo()` to validate that the selected billing destination's contract type (customer type, retail/wholesale code) is compatible with each source contract's contract type. This prevents mixing incompatible customer divisions (e.g., an individual contract billing destination cannot be used with a legal entity contract, and vice versa).

**Key properties:** `type_svc_kei_no`, `type_svc_cd`, `type_tk_hoshiki_kei_no`, `type_keisha_type_cd`, `type_naihan_gaihan_cd`, `type_naihan_comp_skbt_cd`, `type_svc_kei_kaisen_ucwk_no`, `type_replica_moto_tk_hsk_kei_no`, `type_mansion_id`, `type_catid`, `type_kaisen_use_kei_type_cd`, `type_mans_naihan_gaihan_cd`, `type_mans_naihan_comp_skbt_cd`, `type_ownr_kei_no`, and address-related fields.

### KKW05501SFChecker — GUI Validation

Located at [KKW05501SFChecker](source/koptWebB/src/eo/web/webview/KKW05501SF/KKW05501SFChecker.java), this class implements `X31SGuiCheckBase`.

**Purpose:** Provides GUI-level input validation. Currently, the `checkMethod()` delegates to `patternID` routing but returns `true` (valid) for all patterns. The actual business-level validation is performed in `KKW05501SFLogic.inputCheck()` rather than in this checker class. The checker receives a reference to the business logic class (`KKW05501SFLogic`) through its constructor.

### KKW05501SFConst — Constants

Located at [KKW05501SFConst](source/koptWebB/src/eo/web/webview/KKW05501SF/KKW05501SFConst.java), this utility class holds all string constants used throughout the package.

**Purpose:** Centralizes Japanese display labels, field names, code prefixes, and mask field names. All constants are `public static final` String fields. The constructor is private to prevent instantiation (utility class pattern).

Key constant categories:
- **Display labels:** `SEIKY_KEI_NO` ("請求先番号"), `SHS_NM` ("送付先名"), `PAY_PAYWAY` ("支払方法"), etc.
- **Code table keys:** `SHS_HOJIN_ZENGO` ("法人格前後"), `SHS_HOJIN` ("法人格"), `PAY_KYOSEI_MADOGUCHI` ("強制窓口")
- **List data prefixes:** `L_SVC_KEI_NO_02` ("お买家ID"), `L_CHECKED_SEL_02` ("チェックボックス選択値"), `L_KEISHA_TYPE_CD_02` ("契約者タイプコード")
- **Mask display field names:** `CRDT_CARD_NO_MSK1`, `YOKIN_BANK_CD_MSK`, `PAY_PAYWAY_MSK`, etc.
- **Type info keys:** `TYPE_INFO_LIST`, `TYPE_KEISHA_TYPE_CD_04`, `TYPE_NAIHAN_GAIHAN_CD_04`, etc.
- **Code table indices:** `CD_DIV_CD_01`, `CD_DIV_NM_01`, `SELECT_INDEX_01`, `DEFAULT_CD_01`, `CD_DIV_CD_LIST_01`, `CD_DIV_NM_LIST_01`

## How It Works

### Request Flow: Initial Screen Display

```
User navigates to KKW05501
       |
       v
KKW05501SFLogic.init()
       |
       +-- Get screen info from JCCWebCommon.getScreenInfo()
       +-- Get service form bean and common info bean
       +-- Get previous screen ID to determine navigation source
       +-- Extract inherited customer contract data from HKTGI_CUST_KEI_HKTGI_LIST
       +-- Determine service contract number (single or multi-item)
       +-- Set transfer division, reason code, operating date, application date defaults
       +-- Set popup_mode if navigating from popup
       +-- Check if coming from management list (KKW12503) to set mansion flag
       |
       v
callServiceKKSV0544()
       |
       +-- Configure KKSV0544 mapper with all input parameters
       +-- Invoke backend service via invokeService()
       +-- Map results back to service bean
       +-- Check search error flag (KKSV054408CC)
       +-- Set masked values for sensitive fields
       +-- Set RESULT_UM flag
       |
       v
Match parameter list against returned history
       |
       +-- For each contract in the list, compare against parameter service contract numbers
       +-- Set L_SVC_KEI_NO_PARAM_02 = "1" for matching items (highlighted)
       |
       v
SetMyScreen() -- Navigate back to self (KKW05501)
```

### Request Flow: Payee Search and Consolidation

```
User clicks "Payee Search" button
       |
       v
seikyKeiSearch() or closeSeikyKeiSearch()
       |
       +-- Call callServiceKKSV0545() to search for billing destination
       +-- If found: setScreenData() to populate fields
       +-- If not found: setScreenClear() to reset
       |
       v
User selects contracts from list and sets application date
       |
       v
User clicks "Update Confirmation" button
       |
       v
forwardUpdCfm()
       |
       +-- inputCheck() -- validate:
       |     - Application date within 3 months
       |     - Payee type compatibility for each selected contract
       |     - NG status checks (060E, 080E)
       |     - Future date warnings
       |     - Net/hybrid payment type mismatch warnings
       |     - MVNO contract warnings
       |     - eo electricity contract warnings
       +-- callServiceUpdata(FUNC_CODE_2) -- preparation update
       +-- warningCheck() -- additional post-preparation warnings
       |
       v
Navigate to KKW05502 (confirmation screen)
       |
       v
User reviews and clicks "Confirm"
       |
       v
forwardFix()
       |
       +-- callServiceUpdata(FUNC_CODE_1) -- actual update
       +-- Check CIC integration flags
       +-- Validate application date vs. reserved date
       +-- warningCheck() for final warnings
       +-- AxM linkage service call (CKSV9001) if date is not in future
       |
       v
Navigate to KKW05503 (completion screen)
```

### Key Validation Rules

1. **Application Date:** Must not be more than 3 months in the future from the operating date. A warning is shown if the date is in the future but within 3 months.

2. **Payee Type Compatibility:** The `checkTypeInfo()` method enforces strict rules:
   - Individual (1) can mix with Individual (1) if both are retail (001), but cannot mix with Legal (2), Maintenance (3), or Self-use (4)
   - Legal (2) can mix with Legal (2) if both retail (001), or with Individual (1) if both retail (001)
   - Legal (2) with different retail codes requires matching retail company IDs (002 = 002)
   - Maintenance (3) can only be used with Maintenance (3)
   - Self-use (4) can only be used with Self-use (4)

3. **MVNO Contract Warnings:** If a selected contract is an active MVNO contract (SVC_CD = "51"), the payment method must be consistent:
   - Window payment (`SEIKY_WAY_CD_1`) is incompatible with active MVNO contracts
   - Bank transfer (`SEIKY_WAY_CD_2`) or postal automatic transfer (`SEIKY_WAY_CD_3`) requires the new code (`NEW_CD`) to be "0" (continue)

4. **eo Electricity Warnings:** If a selected contract is an eo electricity contract (code `00130_05`) and the status is not terminated/cancelled, window payment triggers a warning.

5. **Partner Member Restriction:** When the `PTNR_MEMBER_FLG` is active, a warning is displayed that billing destination number and system ID cannot be split during consolidation.

## Data Model

### Main Screen Fields (KKW05501SFBean)

The main bean organizes approximately 200+ properties into logical groups:

**Billing Header:**
| Field | Description |
|---|---|
| `seiky_kei_no` | Billing destination number (key identifier) |
| `seiky_kei_no_back` | Return billing destination number |
| `seiky_payway_aply_in` | Application date (full YYYYMMDD) |
| `seiky_payway_aply_year/mon/day` | Application date components |

**Sender Information:**
| Field | Description |
|---|---|
| `shs_hojin_zengo_cd` | Legal entity before/after code |
| `shs_hojin_cd` | Legal entity type code |
| `shs_nm` / `shs_nm_kana` | Sender name (kanji/kana) |
| `shs_bkm` | Department name |
| `shs_tntsha_nm` | Contact person |
| `shs_telno` | Phone number |
| `shs_pcd` / `shs_pcd_kami` / `shs_pcd_shimo` | Postal code |
| `shs_place` / `shs_state` / `shs_city` / `shs_oaztsu` / `shs_azcho` / `shs_bnchigo` / `shs_adrttm` / `shs_adrrm` | Full address |

**Payment Information:**
| Field | Description |
|---|---|
| `pay_payway_cd` | Payment method code (1=Window, 2=Bank transfer, 3=Postal, 4=Credit) |
| `pay_skekka_cd` | Settlement result code |
| `pay_seiky_kei_kana` | Payee name (katakana) |
| `pay_first_seiky` | First billing month |
| `pay_seikyus_hakko_yh_cd` | Invoice generation requirement code |
| `pay_aply` | Billing destination application date |

**Bank Account Information:**
| Field | Description |
|---|---|
| `yokin_bank_cd` | Financial institution code |
| `yokin_shiten_cd` | Branch code |
| `yokin_koza_no` | Account number |
| `yokin_shumoku_cd` | Account type code |
| `post_tsucho_symbol` | Deposit symbol |
| `post_tsucho_no` | Deposit number |

**Credit Card Information:**
| Field | Description |
|---|---|
| `crdt_card_kind_cd` | Card type code |
| `crdt_card_no` | Card number (displayed with hyphens) |
| `crdt_yk_kigen` | Validity period (YYMM) |
| `crdt_mk_kigen` | Invalid year-month |
| `crdt_card_azkri_id` | Card reservation ID |

**Contract History List (Row Items):**
Each row in `rireki_svc_kei_list_list` contains: `l_sysid`, `l_keisha_type_cd`, `l_naihan_gaihan_cd`, `l_naihan_comp_skbt_cd`, `l_prc_grp_cd`, `l_pplan_cd`, `l_color`, `l_tokusoku_no`, `l_tokusoku_stat`, `l_svc_kei_no`, `l_mskm_dtl_no`, `l_seiky_kei_no`, `l_kakins_no`, `l_last_upd_dtm`, `l_ido_div`, `l_svc_kei_kaisen_ucwk_no`, `l_svc_cd`, `l_svc_kei_stat_cd`, `l_checked_sel`, and many mansion-specific fields.

### Backend Service Interfaces

The package interacts with three backend services through mapper classes:

| Mapper | Use Case | Purpose |
|---|---|---|
| `KKSV0544` | Initial display | Fetches contract history list for the customer |
| `KKSV0545` | Payee search | Searches and retrieves billing destination information |
| `KKSV0546` | Update | Performs the actual billing destination consolidation update |

## Dependencies and Integration

### Inbound (What uses this module)

| Consumer | What it uses |
|---|---|
| `KKW055010PJP.jsp` | `KKW05501SF02DBean`, `KKW05501SFBean` |
| `KKW055020PJP.jsp` | `KKW05501SF02DBean`, `KKW05501SFBean` |
| `KKW055030PJP.jsp` | `KKW05501SFBean` |
| `WEBGAMEN_KKW055010PJP.xml` | `KKW05501SFBean`, `KKW05501SFLogic` |
| `WEBGAMEN_KKW055020PJP.xml` | `KKW05501SFBean`, `KKW05501SFLogic` |
| `WEBGAMEN_KKW055030PJP.xml` | `KKW05501SFBean`, `KKW05501SFLogic` |
| `x31business_logic_KKW05501SF.xml` | `KKW05501SFLogic` |

### Outbound (What this module calls)

| Dependency | Purpose |
|---|---|
| `KKSV0544_KKSV0544OPDBMapper` | Initial history list search |
| `KKSV0545_KKSV0545OPDBMapper` | Payee information search |
| `KKSV0546_KKSV0546OPDBMapper` | Billing destination update |
| `JCCWebBusinessLogic` | Parent class providing framework services |
| `JCCWebCommon` | Common web utilities (screen info, error messages) |
| `JCCMessageCache` | Message cache management |
| `JCCAuthorityCtrlStatus` | Authority control |
| `JPCUtilCommon` | Date/time utilities (future date checking, month addition) |
| `JZMCommonUtil` | String utilities (masking, formatting) |
| `JKKCrecaPaySkaJdg` | Credit card payment validity determination |
| `CommonInfoCFConst` | Shared screen info constants |
| `JKKScreenConst` / `JCKScreenConst` | Screen ID and name constants |
| `JKKCommonConst` | Common business constants |

### Module Relationships

The `KKW05501SF` package is part of a larger screen flow:

```
Flowchart:
+-----------+     +-----------+     +-----------+
| KKW05501  |---->| KKW05502  |---->| KKW05503  |
| History   |     | Confirm   |     | Complete  |
| & Select  |     |           |     |           |
+-----------+     +-----------+     +-----------+
      ^    |            |
      |    v            |
      |  KKW00704       |
      |  Payee Search   |
      |                 |
      v                 v
   KKW00145          KKW05501 (edit return)
   Transfer Div      (from confirmation)
   Selection
```

## Notes for Developers

### Architecture Notes

- **X33/X31 Framework:** This package follows the Fujitsu Futurity X33/X31 web framework pattern. The `Logic` class extends `JCCWebBusinessLogic` (X31 layer), while the Data Beans extend `X33VViewBaseBean` (X33 DDO layer). The framework handles data binding between JSP views and data beans automatically.

- **DDO Properties Pattern:** Every field in a DDO bean follows the `_value`, `_enabled`, `_state`, `_update` suffix convention. The DDO framework uses reflection to bind these to JSP form elements. The `loadModelData`/`storeModelData` methods in `01DBean` enable dynamic property access by name.

- **Masked Display:** Sensitive data (credit card numbers, bank accounts, etc.) is displayed in two ways: the original value and a masked version. The Logic class formats the masked versions using `JZMCommonUtil` methods (`stdMask`, `crecardExcBL1`, `crecardExcHyphen`, etc.) before setting the `_MSK` properties.

- **Service Mapping:** All backend service calls go through mapper classes in the `eo.web.webview.mapping` package. The mappers handle the set/get data transfer between the service bean and the input/output parameter maps.

- **Function Codes:** `FUNC_CODE_1` indicates actual update (fix), while `FUNC_CODE_2` indicates update preparation (confirmation). This distinction affects both service-side processing and warning message output.

### Important Business Rules

1. **Partner Member Restriction (ANK-3478-00-00):** When `PTNR_MEMBER_FLG` is "1", the billing destination number and system ID cannot be split during consolidation. A warning message `EKBF270-KW` is displayed throughout the flow.

2. **Credit Card Payment Validation (ANK-3971-00-00):** Credit card payment results are computed dynamically via `JKKCrecaPaySkaJdg.doCrecaPaySkaJdg()` using operation date, card validity, card status, and other factors. The hardcoded credit card result codes (`PAY_SKEKKA_CD_CRE_OK`, `PAY_SKEKKA_CD_CRE_NG`) were removed in ANK-3971-00-00 in favor of the dynamic computation.

3. **Reserved Application Date Warning (ANK-2661-00-00):** After the update service returns a reserved application date, the Logic checks if it's earlier than the user-entered application date. If so, a warning (`EKBA170--Q`) is shown. The same check applies to the merged-original contract's reserved date.

4. **CIC Integration (ANK-2273-00-00):** The package checks CIC (Credit Information Center) integration flags returned from the update service. If the flag `cic_chk_flg` is true for either the original or new billing destination, an error is displayed.

5. **AxM Linkage:** When the application date is not in the future, the Logic calls the AxM linkage service `CKSV9001` for each selected contract to update the linkage system.

6. **MVNO and eo Electricity Warnings:** Added in ANK-1584-00-00, ANK-2480-00-00, and ANK-1661-00-00, these checks warn when combining active MVNO or eo electricity contracts with certain payment methods.

### Extension Points

- **New payment methods:** The `setScreenData()` method contains a switch-like pattern based on `pay_payway_cd` (values 1, 2, 3, 4). Adding a new payment method code requires updating this switch.
- **New warning messages:** The `warningCheck()` method uses `JCCWebCommon.setMessageInfo()` for all warnings. Adding new warnings follows the same pattern.
- **New contract type validations:** The `checkTypeInfo()` method has a series of if/else branches for each contract type combination. New type rules are added by extending these branches.
- **Code table lookups:** The `setScreenData()` method resolves codes to names using `getSelectCodeIndex()`. New code tables are handled by calling this method with the appropriate key.

### Common Pitfalls

- The `inputCheck()` method modifies `seiky_payway_aply_in` at the end with the concatenated application date — this value is then used by `callServiceUpdata()`. Do not modify it prematurely.
- The `warningCheck()` method uses a `blAlrdyOutput` boolean array to deduplicate `EKBA880--Q` warning messages. When adding new warning conditions, consider whether deduplication is needed.
- The `checkTypeInfo()` method handles mansion-specific contract types (type code "5") by retrieving override fields (`type_kaisen_use_kei_type_cd`, `type_mans_naihan_gaihan_cd`, `type_mans_naihan_comp_skbt_cd`). Ensure these fields are populated in the type info list before calling this method.
- When modifying the application date validation, note that the threshold was changed in v4.01.00 from "1" (strict) to "0" (inclusive) in the `JPCUtilCommon.isFutureDate()` call.
