# Business Logic — JKKUsePlaceAdInfUpdCC.setupInitData() [237 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKUsePlaceAdInfUpdCC` |
| Layer | CC / Common Component (Controller/Common Component — shared initialization logic) |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKUsePlaceAdInfUpdCC.setupInitData()

This method performs **initial data setup for a use-place address update** operation in a Japanese telecommunications service management system (NTT West / Futurity platform). It is the data-preparation gatekeeper for the "Change of Service User Address" screen (KKSV0004), ensuring that all required entity data is loaded into the request parameter map before the actual address update process proceeds.

The method handles a **multi-step data consolidation** workflow: it queries the service contract line item for the target line, validates that the line item exists and that the address has genuinely changed from the stored value, retrieves all linked service contracts (and their agreements), loads customer agreement data, resolves the new address code from the address master, and — if a phone service is associated with the account — validates that all phone line numbers match the area code of the new address. It also checks for any in-process moving destination lines that would conflict with the update.

This method implements a **validation-first, data-gathering pattern**: it reads data in a specific order designed to fail fast (early return codes 5001–5006) if any validation fails, and only accumulates mapped data in the `paramMap` when all validations pass. The design pattern is a **facade/router**, delegating data retrieval to the `JKKAdInfChgMapperCC` mapper component and the `ServiceComponentRequestInvoker` SC invoker, while orchestrating the business logic itself. Its role in the larger system is as the **shared initialization entry point** — called once by `JKKUsePlaceAdInfUpdCC.execute()` — that establishes all the context data needed for downstream update and submission logic.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setupInitData(handle, param, fixedText)"])
    INIT["Initialize: condMap, mapper, scCall, paramMap"]
    GET_SVC_LINE["Retrieve Service Contract Line Item<br/>EKK0251A010"]
    CHECK_EXIST["Line Item Exists?"]
    ERR_NO_LINE["Return 5001<br/>No line item found"]
    CHECK_CHANGED["Address Changed?<br/>isChanged()"]
    ERR_NO_CHANGE["Return 5005<br/>No address change"]
    MAP_LINE["Map line item to paramMap<br/>SVC_KEI_KAISEN_UW_MAP"]
    GET_CONTRACTS["Retrieve Service Contracts<br/>EKK0241B002"]
    LOOP_CONTRACTS["Loop: Filter by reject state<br/>CD00037_DSL_ZM=910 / CD00037_CANCEL_ZM=911"]
    CHECK_TEL["Phone Service (CD00130_02)?"]
    ERR_MULTI_TEL["Return 5004<br/>Multiple phone services"]
    GET_SVC_AGREEMENT["Retrieve Service Agreement<br/>EKK0081A010"]
    ADD_TO_LIST["Add to svcList"]
    CHECK_SVC_LIST["svcList Empty?"]
    ERR_NO_SVC["Return 5006<br/>No valid services"]
    MAP_SVC_LIST["Map svcList to paramMap<br/>SVC_KEI_LIST"]
    SET_SYSID["Set baseSysid from svcList<br/>getBaseSysid()"]
    GET_CUSTOMER["Retrieve Customer Agreement<br/>ECK0011A010"]
    GET_ADDR_CODE["Retrieve Address Code<br/>EZM0081B050 from address master"]
    CHECK_ADDR["Address Code Valid?"]
    ERR_ADDR["Return 5002<br/>Address code not found"]
    SET_ADDR_CD["Set KAISEN_PLACE_AD_CD"]
    SET_FIX_FLG["Set KISN_PLC_AD_MI_FIX_FLG = CD00467_AD_FIX"]
    CHECK_KEEPER["Check keeper address diff<br/>checkKeishaAd()"]
    IF_PHONE["Phone service exists?"]
    GET_MA_LIST["Retrieve Numbering Code List<br/>EZM0091B010"]
    GET_LINE_LIST["Retrieve Phone Lines<br/>EKK0191B001"]
    LOOP_LINES["Loop: Check area code per phone number"]
    ERR_AREA["Return 5003<br/>Area code mismatch"]
    ADD_UCWK["Add to ucwkList if not ignored"]
    GET_MOVING_LINE["Check moving destination lines<br/>EKK2091B001"]
    CHECK_MOVING["Moving lines with ADCHG_STAT=001?"]
    ERR_MOVING["Return 5001<br/>In-process moving destination"]
    MAP_UCWK["Map ucwkList to paramMap<br/>SVC_KEI_UCWK_LIST"]
    SET_OPE_DATE["Set PARAM_KEY_OPE_DATE"]
    SET_IDO_DIV["Set PARAM_KEY_IDO_DIV = CD00576_AD_IKT_UPD"]
    SET_MAN_FLG["Set MAN_INPUT_FLG = CD01239_IS_NOT_MAN_INPUT"]
    SET_IDO_RSN["Set PARAM_KEY_IDO_RSN_LIST = new ArrayList"]
    SET_FUNC_CD["Set PARAM_KEY_FUNC_CD = 1"]
    END_SUCCESS["Return 0"]
    CATCH["Catch Exception<br/>Throw CCException"]

    START --> INIT
    INIT --> GET_SVC_LINE
    GET_SVC_LINE --> CHECK_EXIST
    CHECK_EXIST -->|No| ERR_NO_LINE
    CHECK_EXIST -->|Yes| CHECK_CHANGED
    CHECK_CHANGED -->|Not changed| ERR_NO_CHANGE
    CHECK_CHANGED -->|Changed| MAP_LINE
    MAP_LINE --> GET_CONTRACTS
    GET_CONTRACTS --> LOOP_CONTRACTS
    LOOP_CONTRACTS --> CHECK_TEL
    CHECK_TEL -->|Yes + multiple| ERR_MULTI_TEL
    CHECK_TEL -->|Yes, first| GET_SVC_AGREEMENT
    CHECK_TEL -->|No service| GET_SVC_AGREEMENT
    GET_SVC_AGREEMENT --> ADD_TO_LIST
    ADD_TO_LIST --> CHECK_SVC_LIST
    CHECK_SVC_LIST -->|Yes| ERR_NO_SVC
    CHECK_SVC_LIST -->|No| MAP_SVC_LIST
    MAP_SVC_LIST --> SET_SYSID
    SET_SYSID --> GET_CUSTOMER
    GET_CUSTOMER --> GET_ADDR_CODE
    GET_ADDR_CODE --> CHECK_ADDR
    CHECK_ADDR -->|null| ERR_ADDR
    CHECK_ADDR -->|valid| SET_ADDR_CD
    SET_ADDR_CD --> SET_FIX_FLG
    SET_FIX_FLG --> CHECK_KEEPER
    CHECK_KEEPER --> IF_PHONE
    IF_PHONE -->|Yes| GET_MA_LIST
    IF_PHONE -->|No| GET_MOVING_LINE
    GET_MA_LIST --> GET_LINE_LIST
    GET_LINE_LIST --> LOOP_LINES
    LOOP_LINES --> ERR_AREA
    LOOP_LINES --> ADD_UCWK
    ADD_UCWK --> GET_MOVING_LINE
    GET_MOVING_LINE --> CHECK_MOVING
    CHECK_MOVING -->|Yes| ERR_MOVING
    CHECK_MOVING -->|No| MAP_UCWK
    MAP_UCWK --> SET_OPE_DATE
    SET_OPE_DATE --> SET_IDO_DIV
    SET_IDO_DIV --> SET_MAN_FLG
    SET_MAN_FLG --> SET_IDO_RSN
    SET_IDO_RSN --> SET_FUNC_CD
    SET_FUNC_CD --> END_SUCCESS
    CATCH --> END(["End"])
    ERR_NO_LINE --> END
    ERR_NO_CHANGE --> END
    ERR_MULTI_TEL --> END
    ERR_NO_SVC --> END
    ERR_ADDR --> END
    ERR_AREA --> END
    ERR_MOVING --> END
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle for executing SC (Service Component) invocations and transactions. Carries the user's session context including authentication and tenant information. |
| 2 | `param` | `IRequestParameterReadWrite` | Request parameter map container used throughout the request lifecycle. Holds all input data from the screen and accumulates the initialized output data (service contracts, customer info, address codes, operation metadata). The `getData(fixedText)` method retrieves a nested HashMap from this container. |
| 3 | `fixedText` | `String` | A text key / namespace identifier used to scope parameter lookups within `param.getData()`. It acts as a namespace prefix to isolate data belonging to this specific service line item from other concurrent data in the same request parameter container. |

**Instance fields / external state read by this method:**

| Field / External | Source | Business Description |
|-----------------|--------|---------------------|
| `JKKAdInfChgConstCC.COND_KEY_SVC_KEI_KAIS_UCWK_NO` | Constant | `"cond_key_svc_kei_kais_ucwk_no"` — Condition key for service contract line work number |
| `JKKAdInfChgConstCC.COND_KEY_OPEDATE` | Constant | `"cond_key_opedate"` — Condition key for operation date |
| `JKKAdInfChgConstCC.COND_KEY_SYSID` | Constant | `"cond_key_sysid"` — Condition key for system ID |
| `JKKAdInfChgConstCC.PARAM_KEY_SYSID` | Constant | `"param_key_sysid"` — Parameter key storing resolved SYSID |
| `JKKAdInfChgConstCC.PARAM_KEY_OPE_DATE` | Constant | Operation date parameter key |
| `JKKAdInfChgConstCC.PARAM_KEY_IDO_DIV` | Constant | `"param_key_ido_div"` — Movement division code parameter key |
| `JKKAdInfChgConstCC.PARAM_KEY_IDO_RSN_LIST` | Constant | Movement reason list parameter key |
| `JKKAdInfChgConstCC.PARAM_KEY_FUNC_CD` | Constant | Function code parameter key |
| `JKKStrConst.CD00037_DSL_ZM` | Constant | `"910"` — DSL line disconnection status (used for filtering) |
| `JKKStrConst.CD00037_CANCEL_ZM` | Constant | `"911"` — Cancellation completed status (used for filtering) |
| `JKKStrConst.CD00130_02` | Constant | `"02"` — Service code for Telephone service |
| `JKKStrConst.CD00130_01` | Constant | `"01"` — Service code for Internet service |
| `JKKStrConst.CD00467_AD_FIX` | Constant | Address fix flag constant |
| `JKKStrConst.CD00576_AD_IKT_UPD` | Constant | `"00039"` — "Address + Internal update" movement division code |
| `JKKStrConst.CD01239_IS_NOT_MAN_INPUT` | Constant | Manual input not-fulfilled flag |
| `JKKSvcConst.SVC_KEI_STAT_010` | Constant | `"010"` — Service agreement accepted status |
| `PARAM_SVC_KEI_KAISEN_UCWK_NO` | Field | Parameter key for service contract line work number |
| `PARAM_AD_STATE_NM`, `PARAM_AD_CITY_NM`, `PARAM_AD_OAZTSU_NM`, `PARAM_AD_AZCHO_NM`, `PARAM_AD_PCD`, `PARAM_AD_BNCHIGO`, `PARAM_AD_ADRTTM`, `PARAM_AD_ADRRM` | Fields | Address field parameter keys (prefecture, city, town, district, postal code, branch code, room building, room number) |
| `SVC_KEI_KAISEN_UW_MAP`, `SVC_KEI_LIST`, `SVC_KEI_UCWK_LIST`, `KAISEN_PLACE_AD_CD`, `KISN_PLC_AD_MI_FIX_FLG`, `MAN_INPUT_FLG` | Fields | Parameter keys for storing initialized data in paramMap |
| `ServiceComponentRequestInvoker` | Local | SC invocation bridge for calling back-end service components |

## 4. CRUD Operations / Called Services

### Pre-computed evidence from code analysis graph:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JKKAdInfChgMapperCC.getInstance` | JKKAdInfChgMapperCC | - | Retrieves singleton mapper for address change data mapping |
| R | `JCCBPCommon.getOpeDate` | JCCBPCommon | - | Retrieves the current operational date used as a query condition across multiple SC calls |
| R | `JKKAdInfChgMapperCC.setEKK0251A010` | EKK0251A010SC | KK_T_OPSVKEI_ISP (Service Contract Line Items) | Sets query condition to retrieve the service contract line item for the given work number |
| R | `JKKAdInfChgMapperCC.getEKK0251A010List` | EKK0251A010SC | KK_T_OPSVKEI_ISP | Retrieves the service contract line item list mapped from the SC response |
| - | `JKKAdInfChgMapperCC.scResultCheck` | - | - | Validates the SC call result; throws on error |
| R | `JKKAdInfChgMapperCC.setEKK0241B002` | EKK0241B002SC | KK_T_SVKEI (Service Contracts) | Sets query condition to retrieve all service contracts linked to the work number |
| R | `JKKAdInfChgMapperCC.getEKK0241B002` | EKK0241B002SC | KK_T_SVKEI | Retrieves the service contract list |
| R | `JKKAdInfChgMapperCC.setEKK0081A010` | EKK0081A010SC | KK_T_SVKEI_AGREEMENT (Service Agreement) | Sets query condition to retrieve the service agreement for a specific service contract number |
| R | `JKKAdInfChgMapperCC.getEKK0081A010` | EKK0081A010SC | KK_T_SVKEI_AGREEMENT | Retrieves the single service agreement record |
| R | `JKKAdInfChgMapperCC.setECK0011A010` | ECK0011A010SC | KK_T_CUST_AGREEMENT (Customer Agreement) | Sets query condition to retrieve the customer agreement by SYSID |
| R | `JKKAdInfChgMapperCC.getECK0011A010` | ECK0011A010SC | KK_T_CUST_AGREEMENT | Retrieves the customer agreement record (includes keeper address) |
| R | `JKKAdInfChgMapperCC.setEZM0081B050` | EZM0081B050SC | M_ADDR_CD_MST (Address Code Master) | Sets query condition to find address code from address components (prefecture, city, town, district) |
| R | `JKKAdInfChgMapperCC.getEZM0081B050` | EZM0081B050SC | M_ADDR_CD_MST | Retrieves the address code master list |
| R | `JKKAdInfChgMapperCC.setEZM0091B010` | EZM0091B010SC | M_NO_KUKAKU_MST (Numbering Area Code Master) | Sets query condition to retrieve numbering area codes for a given address code |
| R | `JKKAdInfChgMapperCC.getEZM0091B010` | EZM0091B010SC | M_NO_KUKAKU_MST | Retrieves the numbering area code list |
| R | `JKKAdInfChgMapperCC.setEKK0191B001` | EKK0191B001SC | KK_T_SVKEI_LINE (Service Contract Lines / Phone Lines) | Sets query condition to retrieve phone lines for a given service contract number |
| R | `JKKAdInfChgMapperCC.getEKK0191B001` | EKK0191B001SC | KK_T_SVKEI_LINE | Retrieves the phone line records |
| R | `JKKAdInfChgMapperCC.setEZM0301A010` | EZM0301A010SC | M_KYOKU_MST (Prefix Code Master) | Sets query condition to retrieve the prefix code entry by prefix number (first 6 digits of phone) |
| R | `JKKAdInfChgMapperCC.getEZM0301A010` | EZM0301A010SC | M_KYOKU_MST | Retrieves the prefix code master entry |
| R | `JKKAdInfChgMapperCC.setEKK2091B001` | EKK2091B001SC | KK_T_ADCHG_MV_LINE (Address Change Moving Lines) | Sets query condition to retrieve moving destination lines for the target work number |
| R | `JKKAdInfChgMapperCC.getEKK2091B001` | EKK2091B001SC | KK_T_ADCHG_MV_LINE | Retrieves the moving destination line list |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Controller: `JKKUsePlaceAdInfUpdCC.execute()` | `JKKUsePlaceAdInfUpdCC.execute()` → `JKKUsePlaceAdInfUpdCC.setupInitData()` | `getEKK0251A010List [R] KK_T_OPSVKEI_ISP`, `getEKK0241B002 [R] KK_T_SVKEI`, `getEKK0081A010 [R] KK_T_SVKEI_AGREEMENT`, `getECK0011A010 [R] KK_T_CUST_AGREEMENT`, `getEZM0081B050 [R] M_ADDR_CD_MST`, `getEZM0091B010 [R] M_NO_KUKAKU_MST`, `getEKK0191B001 [R] KK_T_SVKEI_LINE`, `getEZM0301A010 [R] M_KYOKU_MST`, `getEKK2091B001 [R] KK_T_ADCHG_MV_LINE` |

**Terminal operations reached from this method:**

| Terminal | Type | Entity / Table | Description |
|----------|------|----------------|-------------|
| `getEKK0251A010List` | R | KK_T_OPSVKEI_ISP | Service contract line items (target line) |
| `getEKK0241B002` | R | KK_T_SVKEI | Service contracts |
| `getEKK0081A010` | R | KK_T_SVKEI_AGREEMENT | Service agreements |
| `getECK0011A010` | R | KK_T_CUST_AGREEMENT | Customer agreements |
| `getEZM0081B050` | R | M_ADDR_CD_MST | Address code master |
| `getEZM0091B010` | R | M_NO_KUKAKU_MST | Numbering area code master |
| `getEKK0191B001` | R | KK_T_SVKEI_LINE | Phone service lines |
| `getEZM0301A010` | R | M_KYOKU_MST | Prefix code master (phone area code) |
| `getEKK2091B001` | R | KK_T_ADCHG_MV_LINE | Moving destination lines |
| `getOpeDate` | R | - | Operational date lookup (used as query condition) |
| `scResultCheck` | - | - | SC result validation (error check) |

## 6. Per-Branch Detail Blocks

**Block 1** — TRY-BLOCK `(entire method body)` (L449)

> The main try-catch block encompassing all initialization logic.

| # | Type | Code |
|---|------|------|
| 1 | SET | `condMap = new HashMap<String, String>()` // Reusable query condition map |
| 2 | SET | `reqMap` (local, uninit) |
| 3 | SET | `resMap` (local, uninit) |
| 4 | SET | `scCall = new ServiceComponentRequestInvoker()` |
| 5 | SET | `mapper = JKKAdInfChgMapperCC.getInstance()` |
| 6 | SET | `paramMap = (HashMap)param.getData(fixedText)` // Retrieves scoped parameter map |
| 7 | SET | `rejectStateList = Arrays.asList(CD00037_DSL_ZM="910", CD00037_CANCEL_ZM="911")` // Filter out disconnected/cancelled lines |

**Block 1.1** — [Step 1] Retrieve Service Contract Line Item (EKK0251A010) (L463)

> Fetches the service contract line item for the target work number to confirm the line exists.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `condMap.clear()` |
| 2 | SET | `condMap.put(COND_KEY_SVC_KEI_KAIS_UCWK_NO, paramMap.get(PARAM_SVC_KEI_KAISEN_UCWK_NO))` |
| 3 | SET | `condMap.put(COND_KEY_OPEDATE, JCCBPCommon.getOpeDate(null))` |
| 4 | CALL | `reqMap = mapper.setEKK0251A010(param, fixedText, condMap)` |
| 5 | CALL | `resMap = scCall.run(reqMap, handle)` // Invokes SC EKK0251A010 |
| 6 | CALL | `kk0251_a010_list = mapper.getEKK0251A010List(param, fixedText, resMap)` |
| 7 | CALL | `mapper.scResultCheck(param)` |

**Block 1.2** — IF `(kk0251_a010_list.size() == 0)` (L471) `[No Line Item Found]`

> Validation: If no service contract line item exists for the given work number, return error 5001.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return 5001` // "対象の回線内訳番号が存在しない" — Target line item number does not exist |

**Block 1.3** — IF `(!isChanged(kk0251_a010_list.get(0), paramMap))` (L477) `[No Address Change]`

> Validation: Checks whether the address from the screen input differs from the stored address in the line item. Calls `isChanged()` which compares 7 address fields.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return 5005` // "住所に変更がない" — No address change (address is identical to existing) |

**Block 1.4** — [Step 2] Map Line Item (L483)

> Stores the first (and only) line item map in paramMap for downstream use.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap.put(SVC_KEI_KAISEN_UW_MAP, kk0251_a010_list.get(0))` |

**Block 1.5** — [Step 3] Retrieve Service Contracts (EKK0241B002) (L486)

> Fetches all service contracts linked to the target work number.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `condMap.clear()` |
| 2 | SET | `condMap.put(COND_KEY_SVC_KEI_KAIS_UCWK_NO, paramMap.get(PARAM_SVC_KEI_KAISEN_UCWK_NO))` |
| 3 | CALL | `reqMap = mapper.setEKK0241B002(param, fixedText, condMap)` |
| 4 | CALL | `resMap = scCall.run(reqMap, handle)` // Invokes SC EKK0241B002 |
| 5 | CALL | `kk0241_b002_list = mapper.getEKK0241B002(param, fixedText, resMap)` |
| 6 | CALL | `mapper.scResultCheck(param)` |

**Block 1.6** — FOR LOOP `(kk0241_b002_list)` (L494) `[Filter Service Contracts]`

> Iterates over all service contracts, filtering out disconnected/cancelled ones, and checking for multiple phone services.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcList = new ArrayList<HashMap<String, Object>>()` |
| 2 | SET | `svcKeiNoTel = null` |

**Block 1.6.1** — IF `(rejectStateList.contains(svcKeiStat))` (L499) `[CD00037_DSL_ZM="910" / CD00037_CANCEL_ZM="911"]`

> Skips service contracts that have been disconnected or cancelled.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `continue` // Skip this contract |

**Block 1.6.2** — IF `(JKKStrConst.CD00130_02.equals(svcCd))` (L503) `[Service Code = "02" — Telephone Service]`

> Checks if this is a telephone service contract. If multiple valid telephone services exist for the same location, return error 5004.

| # | Type | Code |
|---|------|------|
| 1 | IF | `svcKeiNoTel != null` (L505) — Multiple phone services |
| 1.1 | RETURN | `return 5004` // "同一場所に有効な電話が複数ある場合はSYSIDが異なるのでエラー" — Multiple valid phones at same location, SYSIDs differ |
| 1.2 | SET | `svcKeiNoTel = kk0241_b010_map.get(SVC_KEI_NO)` (L508) // Store first phone service contract number |

**Block 1.6.3** — [Step 4] Retrieve Service Agreement per Contract (EKK0081A010) (L514)

> For each valid service contract, fetch its agreement record.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `condMap.clear()` |
| 2 | SET | `condMap.put("key_svc_kei_no", kk0241_b010_map.get(SVC_KEI_NO))` |
| 3 | SET | `condMap.put("key_rsv_aply_ymd", JCCBPCommon.getOpeDate(null))` |
| 4 | CALL | `reqMap = mapper.setEKK0081A010(param, fixedText, condMap)` |
| 5 | CALL | `resMap = scCall.run(reqMap, handle)` // Invokes SC EKK0081A010 |
| 6 | CALL | `kk0081_a010_map = mapper.getEKK0081A010(param, fixedText, resMap)` |
| 7 | CALL | `mapper.scResultCheck(param)` |
| 8 | SET | `svcList.add(kk0081_a010_map)` |

**Block 1.7** — IF `(svcList.size() == 0)` (L525) `[No Valid Services]`

> After filtering, if no valid service agreements remain, return error 5006.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return 5006` // "有効なサービス契約が存在しない" — No valid service contract exists |

**Block 1.8** — [Step 5] Map Service List & Set SYSID (L530)

> Stores the filtered service agreement list and resolves the primary SYSID.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap.put(SVC_KEI_LIST, svcList)` |
| 2 | SET | `paramMap.put(PARAM_KEY_SYSID, getBaseSysid(svcList))` // Delegates to getBaseSysid() which prioritizes phone over internet, then falls back to first SYSID |

**Block 1.9** — [Step 6] Retrieve Customer Agreement (ECK0011A010) (L533)

> Fetches customer information to compare the registered address (keeper address) with the new address.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `condMap.clear()` |
| 2 | SET | `condMap.put(COND_KEY_SYSID, paramMap.get(PARAM_KEY_SYSID))` |
| 3 | SET | `condMap.put(COND_KEY_OPEDATE, JCCBPCommon.getOpeDate(null))` |
| 4 | CALL | `reqMap = mapper.setECK0011A010(param, fixedText, condMap)` |
| 5 | CALL | `resMap = scCall.run(reqMap, handle)` // Invokes SC ECK0011A010 |
| 6 | CALL | `ck0011_a010_map = mapper.getECK0011A010(param, fixedText, resMap)` |
| 7 | CALL | `mapper.scResultCheck(param)` |

**Block 1.10** — [Step 7] Resolve Address Code (EZM0081B050) (L540)

> Looks up the address code from the address master using the new address components (prefecture, city, town, district) provided in the input.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `condMap.clear()` |
| 2 | SET | `condMap.put(COND_KEY_STATE_NM, paramMap.get(PARAM_AD_STATE_NM))` |
| 3 | SET | `condMap.put(COND_KEY_CITY_NM, paramMap.get(PARAM_AD_CITY_NM))` |
| 4 | SET | `condMap.put(COND_KEY_OAZTSU_NM, paramMap.get(PARAM_AD_OAZTSU_NM))` |
| 5 | SET | `condMap.put(COND_KEY_AZCHO_NM, paramMap.get(PARAM_AD_AZCHO_NM))` |
| 6 | CALL | `reqMap = mapper.setEZM0081B050(param, fixedText, condMap)` |
| 7 | CALL | `resMap = scCall.run(reqMap, handle)` // Invokes SC EZM0081B050 |
| 8 | CALL | `zm0081_b050_list = mapper.getEZM0081B050(param, fixedText, resMap)` |
| 9 | CALL | `mapper.scResultCheck(param)` |

**Block 1.11** — IF `(zm0081_b050_map == null)` (L552) `[Address Code Not Found]`

> Calls `getAdressMaster()` which matches the list by postal code. If no match, return error 5002.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return 5002` // "住所コードが取れないか、郵便番号が一致しない" — Address code not found or postal code mismatch |

**Block 1.12** — [Step 8] Set Derived Address Fields (L557)

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap.put(KAISEN_PLACE_AD_CD, zm0081_b050_map.get(AD_CD))` |
| 2 | SET | `paramMap.put(KISN_PLC_AD_MI_FIX_FLG, JKKStrConst.CD00467_AD_FIX)` // Fixed address determination flag |
| 3 | SET | `paramMap.put(KAISEN_PLC_KSH_AD_SAI_FLG, checkKeishaAd(ck0011_a010_map, paramMap))` // Delegates to checkKeishaAd() — returns "1" if keeper's address differs from new address, "0" otherwise |

**Block 1.13** — IF `(svcKeiNoTel != null)` (L565) `[Phone Service Exists — Additional Validation]`

> When a phone service is associated, performs additional validation: checks that phone line numbers match the area code of the new address.

**Block 1.13.1** — [Step 9] Get Ignore List (L569)

| # | Type | Code |
|---|------|------|
| 1 | SET | `ignoreList = getIgnoreUcwkList(handle, param, fixedText, paramMap.get(PARAM_SVC_KEI_KAISEN_UCWK_NO))` |

**Block 1.13.2** — [Step 10] Retrieve Numbering Area Codes (EZM0091B010) (L574)

> Gets all valid numbering (area code) codes for the new address.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `condMap.clear()` |
| 2 | SET | `condMap.put(COND_KEY_AD_CD, paramMap.get(KAISEN_PLACE_AD_CD))` |
| 3 | CALL | `reqMap = mapper.setEZM0091B010(param, fixedText, condMap)` |
| 4 | CALL | `resMap = scCall.run(reqMap, handle)` // Invokes SC EZM0091B010 |
| 5 | CALL | `zm0091_b010_list = mapper.getEZM0091B010(param, fixedText, resMap)` |
| 6 | CALL | `mapper.scResultCheck(param)` |

**Block 1.13.3** — FOR LOOP `(zm0091_b010_list)` (L582) `[Build Numbering Code Check List]`

> Collects all valid numbering area codes into a list for later comparison.

| # | Type | Code |
|---|------|------|
| 1 | SET | `maCheckList = new ArrayList<String>()` |
| 2 | SET | `maCheckList.add(zm0091_b010_map.get(NO_KUKAKU_CD))` // Per iteration |

**Block 1.13.4** — [Step 11] Retrieve Phone Lines (EKK0191B001) (L590)

> Gets all phone lines for the telephone service contract.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `condMap.clear()` |
| 2 | SET | `condMap.put(COND_KEY_SVC_KEI_NO, svcKeiNoTel)` |
| 3 | CALL | `reqMap = mapper.setEKK0191B001(param, fixedText, condMap)` |
| 4 | CALL | `resMap = scCall.run(reqMap, handle)` // Invokes SC EKK0191B001 |
| 5 | CALL | `kk0191_b001_list = mapper.getEKK0191B001(param, fixedText, resMap)` |
| 6 | CALL | `mapper.scResultCheck(param)` |

**Block 1.13.5** — FOR LOOP `(kk0191_b001_list)` (L597) `[Validate Area Code per Phone Number]`

> For each phone line, extracts the first 6 digits of the phone number (prefix code / 局番) and checks it against the valid numbering area codes of the new address.

| # | Type | Code |
|---|------|------|
| 1 | IF | `rejectStateList.contains(svcKeiUWStat)` (L601) — Skip disconnected/cancelled lines |
| 1.1 | EXEC | `continue` |
| 2 | SET | `tel = kk0191_b001_map.get(TELNO)` |

**Block 1.13.5.1** — [Step 12] Validate Phone Prefix Code (EZM0301A010) (L611)

> Extracts the first 6 digits of the phone number and looks up the prefix code master.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `condMap.clear()` |
| 2 | SET | `condMap.put(COND_KEY_KYOKU_NO, tel.substring(0, 6))` |
| 3 | CALL | `reqMap = mapper.setEZM0301A010(param, fixedText, condMap)` |
| 4 | CALL | `resMap = scCall.run(reqMap, handle)` // Invokes SC EZM0301A010 |
| 5 | CALL | `zm0301_a010_list = mapper.getEZM0301A010(param, fixedText, resMap)` |
| 6 | CALL | `mapper.scResultCheck(param)` |

**Block 1.13.5.2** — IF `(!maCheckList.contains(zm0301_a010_list.get(NO_KUKAKU_CD)))` (L619) `[Area Code Mismatch]`

> If the phone number's numbering area code is NOT in the valid list for the new address, return error 5003.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return 5003` // "区域番号が一致しない" — Area code (numbering section code) does not match |

**Block 1.13.5.3** — IF `(!ignoreList.contains(kk0191_b001_map.get(SVC_KEI_UCWK_NO)))` (L621)

> If the line is not in the ignore list, add it to the detail work list.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ucwkList.add(kk0191_b001_map)` |

**Block 1.14** — [Step 13] Check Moving Destination Lines (EKK2091B001) (L628)

> Checks if there are any moving destination lines in-process that could conflict with this address update. This ensures the same line is not simultaneously being moved elsewhere.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `condMap.clear()` |
| 2 | SET | `condMap.put(EKK2091B001CBSMsg.KEY_ITENS_SVKEI_KISUW_NO, paramMap.get(PARAM_SVC_KEI_KAISEN_UCWK_NO))` |
| 3 | CALL | `reqMap = mapper.setEKK2091B001(param, fixedText, condMap)` |
| 4 | CALL | `resMap = scCall.run(reqMap, handle)` // Invokes SC EKK2091B001 |
| 5 | CALL | `kk2091_b001_list_Itns = mapper.getEKK2091B001(param, fixedText, resMap)` |
| 6 | CALL | `mapper.scResultCheck(param)` |

**Block 1.14.1** — IF `(kk2091_b001_list_Itns != null)` (L633)

| # | Type | Code |
|---|------|------|
| 1 | IF | `kk2091_b001_list_Itns.size() > 0` (L636) |
| 1.1 | FOR | `kk2091_b001_map in kk2091_b001_list_Itns` |
| 1.1.1 | SET | `adchgStat = kk2091_b001_map.get(ADCHG_STAT)` |

**Block 1.14.1.1** — IF `("001".equals(adchgStat))` (L638) `[In-Process Moving Destination]`

> If any moving destination line has ADCHG_STAT = "001" (in-process), return error.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return 5001` // "住所変更中の転居先回線は住所を変更できない" — Cannot change address when moving destination line is in-process |

**Block 1.15** — [Step 14] Finalize paramMap with Accumulated Data (L650)

> Sets all remaining operation metadata into the paramMap for downstream processing by the actual update logic.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap.put(SVC_KEI_UCWK_LIST, ucwkList)` // Phone detail work list |
| 2 | SET | `paramMap.put(PARAM_KEY_OPE_DATE, JCCBPCommon.getOpeDate(null))` // Current operation date |
| 3 | SET | `paramMap.put(PARAM_KEY_IDO_DIV, JKKStrConst.CD00576_AD_IKT_UPD)` // `"00039"` — "Address + Internal update" movement division |
| 4 | SET | `paramMap.put(MAN_INPUT_FLG, JKKStrConst.CD01239_IS_NOT_MAN_INPUT)` // Manual input flag |
| 5 | SET | `paramMap.put(PARAM_KEY_IDO_RSN_LIST, new ArrayList<HashMap<String, Object>>())` // Empty movement reason list |
| 6 | SET | `paramMap.put(PARAM_KEY_FUNC_CD, "1")` // Process code = 1 (address update) |

**Block 1.16** — CATCH `(Exception ex)` (L678)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `throw new CCException(JKKAdInfChgConstCC.ERR_STR_RESULT_CD, ex.getCause())` // Maps generic exception to CCException |

**Block 1.17** — RETURN (L682)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return 0` // Success — all validations passed, data mapped into paramMap |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `setupInitData` | Method | Initial data setup for address update — loads and validates all prerequisite data |
| `svc_kei_kais_ucwk_no` | Field | Service contract line work number — unique identifier for a specific line item within a service contract (the target of the address update) |
| `svc_kei_no` | Field | Service contract number — identifier for the overall service contract |
| `svc_kei_stat` | Field | Service status code — current state of a service contract (e.g., active, cancelled, disconnected) |
| `svc_kei_ucwk_stat` | Field | Service work status — status of a specific work item within a service |
| `svc_cd` | Field | Service code — classifies the type of service (01 = Internet, 02 = Telephone, 03 = TV, 04 = Hosting per CD00130) |
| `svc_kei_ucwk_list` | Field | Service detail work list — list of phone line detail records for the update |
| `svc_kei_list` | Field | Service agreement list — list of service agreement maps for all valid contracts |
| `kaissen_place_ad_cd` | Field | Changed/updated place address code — the resolved address code from the address master |
| `kaissen_plc_ksh_ad_sai_flg` | Field | Changed place vs. keeper address difference flag — "1" if keeper's registered address differs from new address, "0" if same |
| `kisn_plc_ad_mi_fix_flg` | Field | Existing place address determination flag — fixed value indicating address has been determined |
| `sysid` | Field | System ID — unique identifier for a customer account (subscriber) |
| `adchg_stat` | Field | Address change status — status code for address change operations ("001" = in-process) |
| `ad_cd` | Field | Address code — unique code for a geographic address location in the address master |
| `no_kukaku_cd` | Field | Numbering area code — the numbering section code for a telephone area (maps a prefix code to a valid numbering region) |
| `kyoku_no` | Field | Prefix number — the first 6 digits of a phone number (exchange code + subscriber prefix), used to look up the numbering area |
| `telno` | Field | Telephone number — the full phone number of a service line |
| `pcd` | Field | Postal code — Japanese postal code used to match address records |
| `state_nm` | Field | Prefecture name — administrative region name (都道府県名) |
| `city_nm` | Field | City name — city/municipality name |
| `oaztsu_nm` | Field | Town name — town/district name (大字名) |
| `azcho_nm` | Field | District name — district/block name (区町名) |
| `bnchigo` | Field | Branch code — supplementary address code for building/plot identification |
| `adrttm` / `adrrm` | Field | Room building / Room number — detailed room-level address fields |
| `ido_div` | Field | Movement division code — classifies the type of move/change (CD00576_AD_IKT_UPD = "00039" = address + internal update) |
| `ido_rsn_list` | Field | Movement reason list — list of codes explaining why the address is being changed |
| `mskm_sbt_cd` | Field | Submission content type code — code classifying the type of application submission |
| `keisha_ad` | Field | Keeper's (contractor's) address — the registered address on file for the customer |
| `reject_state_list` | Field | Filter list for rejected states — contains disconnected (910) and cancelled (911) statuses |
| `ignore_list` | Field | List of line work numbers to ignore during phone number validation (e.g., lines already being updated) |
| CD00037_DSL_ZM | Constant | `"910"` — DSL line disconnection completed status |
| CD00037_CANCEL_ZM | Constant | `"911"` — Cancellation completed status |
| CD00130_01 | Constant | `"01"` — Service type: Internet |
| CD00130_02 | Constant | `"02"` — Service type: Telephone |
| CD00130_03 | Constant | `"03"` — Service type: TV |
| CD00576_AD_IKT_UPD | Constant | `"00039"` — Movement division: Address + Internal update |
| CD01239_IS_NOT_MAN_INPUT | Constant | Manual input not-fulfilled flag (non-manual entry) |
| CD00467_AD_FIX | Constant | Address fix flag — indicates address has been confirmed/determined |
| SVC_KEI_STAT_010 | Constant | `"010"` — Service agreement accepted/confirmed status |
| EKK0251A010SC | SC Code | Query service contract line items (KK_T_OPSVKEI_ISP) |
| EKK0241B002SC | SC Code | Query service contracts by work number (KK_T_SVKEI) |
| EKK0081A010SC | SC Code | Query service agreement by service contract number (KK_T_SVKEI_AGREEMENT) |
| ECK0011A010SC | SC Code | Query customer agreement by SYSID (KK_T_CUST_AGREEMENT) |
| EZM0081B050SC | SC Code | Query address code from address components (M_ADDR_CD_MST) |
| EZM0091B010SC | SC Code | Query numbering area codes by address code (M_NO_KUKAKU_MST) |
| EKK0191B001SC | SC Code | Query phone lines by service contract number (KK_T_SVKEI_LINE) |
| EZM0301A010SC | SC Code | Query prefix code master by prefix number (M_KYOKU_MST) |
| EKK2091B001SC | SC Code | Query moving destination lines for address change (KK_T_ADCHG_MV_LINE) |
| KK_T_OPSVKEI_ISP | DB Table | Service contract line items table — stores ISP/service line detail records |
| KK_T_SVKEI | DB Table | Service contracts table — stores service contract header records |
| KK_T_SVKEI_AGREEMENT | DB Table | Service agreements table — stores per-contract agreement records |
| KK_T_CUST_AGREEMENT | DB Table | Customer agreements table — stores customer/contractor registration data |
| KK_T_SVKEI_LINE | DB Table | Service contract lines table — stores per-line details including phone numbers |
| KK_T_ADCHG_MV_LINE | DB Table | Address change moving lines table — tracks lines in the process of being moved |
| M_ADDR_CD_MST | DB Table | Address code master — master reference table mapping address components to codes |
| M_NO_KUKAKU_MST | DB Table | Numbering area code master — reference table mapping addresses to valid numbering regions |
| M_KYOKU_MST | DB Table | Prefix code master — reference table mapping phone prefix codes to numbering areas |
| KKSV0004 | Screen | Change of Service User Address screen — the business screen that invokes this initialization |
| SC (Service Component) | Term | Fujitsu middleware component for calling back-end business logic (service layer) |
| SYSID | Term | System ID — the unique identifier for a customer/account in the telecommunications system |
| NTT West / Futurity | Term | Japanese telecommunications platform; the domain context for this code |
