# Business Logic — JKKUsePlaceAdInfUpdCC.updateEmgContactAd() [289 LOC]

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

## 1. Role

### JKKUsePlaceAdInfUpdCC.updateEmgContactAd()

This method implements **Emergency Contact Address Update** for a K-Opticom (NTT east) customer's service contract. Its primary business purpose is to update the emergency contact address (緊急通報先住所) stored in the service contract detail records — a separate address used for emergency notifications when the primary residence address changes.

The method handles a single service line (telephone contract, service type `CD00130_02` = "02"). It retrieves the service contract detail list, then iterates over each service detail work record (svc_kei_ucwk) to update the emergency address fields across three data entities: the service contract agreement (EKK0161A010), the service detail work agreement for e-hikari telephone (EKK0191A010), and the service detail work information change (EKK0191C060). For each line, it also registers a progress record (EKK1091D010), triggers SOD (Service Order Data) issuance, and conditionally updates Banpo (番工 = installation work) work information if the customer has an existing work order with a same-number transfer flag (同番移転).

The method implements a **batch-processing-through-loop** pattern: it operates on every item in the `svc_kei_ucwk_list` with a single `for` loop, performing the same sequence of operations on each. It uses a **mapper-delegate** design, where `JKKAdInfChgMapperCC` prepares request maps and extracts response data, while `ServiceComponentRequestInvoker` (scCall) executes remote service component calls. It is a shared utility method called exclusively by `updateUsePlaceAd()` — the main residence address change flow — as part of a larger address modification workflow.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["updateEmgContactAd(params)"])
    A["Get svc_kei_list from paramMap"]
    B["getSvcKei for telephone contract (CD00130_02)"]
    C{"kk0081_a010_map
is null?"}
    D["Return early -
no telephone contract"]
    E["Get svc_kei_ucwk_list
from paramMap"]
    F["For each kk0191_b001_map
in svc_kei_ucwk_list"]
    G["condMap.clear"]
    H["setEKK0161A010 + scCall.run"]
    I["getEKK0161A010 +
scResultCheck"]
    J["setEKK0191A010 + scCall.run"]
    K["getEKK0191A010 +
scResultCheck"]
    L["Save chbfSvcKeiUcwkGeneAddDtm
(before update)"]
    M["Update kk0161_a010_map
fields"]
    N{"svc_kei_ucwk_stat
== 010?"}
    O{"MSKM_DTL_NO
not empty?"}
    P["Update MSKM_DTL_NO
and IDO_DIV"]
    Q["Save last_upd_dtm
into UPD_DT_SVC_KEI_UCWK_UPD_DTM_BEF"]
    R["createPrgTokkiMapEmgAd
prepare progress map"]
    S["Set EMG address fields
in kk0191_a010_map"]
    T["setEKK0191C060 +
scCall.run"]
    U["getEKK0191C060 +
scResultCheck"]
    V["Save chafSvcKeiUcwkGeneAddDtm
(after update)"]
    W["Get svcKeiStat
and idoDiv
from kk0081_a010_map"]
    X{"svcKeiStat
== 010?"}
    Y["setEKK1091B001 +
scCall.run + get + scResultCheck"]
    Z["Get idoDtm from
progress agreement"]
    AA["emgAdPrgMap.put
SVC_KEI_NO + SVC_KEI_UCWK_NO"]
    AB{"svcKeiStat
== 010?"}
    AC["Set IDO_DIV and
IDO_DTM from progress"]
    AD["Set IDO_DIV from param
and IDO_DTM from now"]
    AE["Set PRG_STAT to E040"]
    AF{"MSKM_DTL_NO
not empty?"}
    AG["emgAdPrgMap.put
MSKM_DTL_NO"]
    AH["setEKK1091D010 +
scCall.run + scResultCheck"]
    AI["hakkoSod
Issue SOD"]
    AJ["setETU0011B010 +
scCall.run + get + scResultCheck"]
    AK{"tu0011_b010_list
is null?"}
    AL["For each
tu0011_b010_map"]
    AM{"bmpKojiStat
in (000,010,011,021)?"}
    AN["continue -
skip this work"]
    AO["setETU0011A010 +
scCall.run + scResultCheck"]
    AP{"tu0011_a010_map
is null?"}
    AQ["continue -
skip"]
    AR{"pause_hyo_sohus_cd
== KAKI (3)?"}
    AS["continue -
no update fields"]
    AT["Get mskmJigKijiRan1
from work agreement"]
    AV{"mskmJigKijiRan1
contains '同番移転'?"}
    AW["Set knockan-itens
address fields in map"]
    AX["Set PAUSE_HYO_SOHUS_CD
fixed to 3"]
    AY["Set UPD_DTM_BF
(before update datetime)"]
    AZ["setETU0011C010 +
scCall.run + scResultCheck"]
    END(["End loop / Return"])

    START --> A --> B --> C -->|Yes| D --> END
    C -->|No| E --> F --> G --> H --> I --> J --> K --> L --> M --> N
    N -->|False| O
    O -->|Yes| P
    O -->|No| P
    P --> Q --> R --> S --> T --> U --> V --> W --> X
    X -->|Yes| Y --> Z
    X -->|No| AA
    Z --> AA
    AA --> AB
    AB -->|Yes| AC
    AB -->|No| AD
    AC --> AE
    AD --> AE
    AE --> AF
    AF -->|Yes| AG
    AF -->|No| AG
    AG --> AH --> AI --> AJ
    AJ --> AK
    AK -->|Yes| END
    AK -->|No| AL --> AM
    AM -->|No| AN
    AN --> AL
    AM -->|Yes| AO --> AP
    AP -->|Yes| AN
    AP -->|No| AR
    AR -->|No| AS
    AS --> AL
    AR -->|Yes| AT --> AV
    AV -->|Yes| AW --> AX --> AY --> AZ
    AV -->|No| AN
    AZ --> AL

    style START fill:#e1f5fe
    style END fill:#e1f5fe
    style D fill:#fff3e0
    style AN fill:#fff3e0
    style AS fill:#fff3e0
    style AQ fill:#fff3e0
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle for executing service component calls. Carries the database connection context (transaction, user, etc.) used when invoking remote CBS operations via `scCall.run()`. |
| 2 | `param` | `IRequestParameterReadWrite` | Request parameter object that holds model groups and control maps. Provides input data (emergency address fields), is used to build request maps for service components, and receives return values and error information (e.g., `ad_chk_lv_res`). |
| 3 | `fixedText` | `String` | User-defined string passed through to service component invocations. Used as a payload carrier that travels between the request map and the CBS layer — typically carries the operation context key for data serialization. |
| 4 | `scCall` | `ServiceComponentRequestInvoker` | Service component execution engine. Invokes remote CBS (Core Business System) operations via `run(reqMap, handle)`. Each service component call (EKK0161A010, EKK0191A010, EKK0191C060, etc.) is dispatched through this invoker. |
| 5 | `paramMap` | `HashMap<String, Object>` | Business data context map carrying the core input: `svc_kei_list` (service contract lines), `svc_kei_ucwk_list` (service detail work records), the emergency address fields (post code, prefecture, city, oazutsu, azcho, banchigo, building name, room number), operation date (`ope_date`), move division code (`ido_div`), and optional contract detail number (`mskm_dtl_no`). |

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

| Field | Description |
|-------|-------------|
| `PARAM_AD_PCD` | `"ad_pcd"` — Key for emergency contact postal code in paramMap |
| `PARAM_AD_STATE_NM` | `"ad_state"` — Key for emergency contact prefecture name |
| `PARAM_AD_CITY_NM` | `"ad_city"` — Key for emergency contact city/town/village name |
| `PARAM_AD_OAZTSU_NM` | `"ad_oaztsu"` — Key for emergency contact oazutsu (大字号) name |
| `PARAM_AD_AZCHO_NM` | `"ad_azcho"` — Key for emergency contact azcho (字丁目) name |
| `PARAM_AD_BNCHIGO` | `"ad_bnchigo"` — Key for emergency contact banchigo (番地号) number |
| `PARAM_AD_ADRTTM` | `"ad_adrttm"` — Key for emergency contact building name |
| `PARAM_AD_ADRRM` | `"ad_adrrm"` — Key for emergency contact room number |
| `KAISEN_PLACE_AD_CD` | `"kaisen_place_ad_cd"` — Key for updated residence address code |
| `SVC_KEI_LIST` | `"svc_kei_list"` — Key for service contract list in paramMap |
| `SVC_KEI_UCWK_LIST` | `"svc_kei_ucwk_list"` — Key for service detail work list in paramMap |
| `SVC_KEI_KAISEN_UW_MAP` | `"target_svc_kei_kaisen_uw_map"` — Key for target service detail work map |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JKKAdInfChgMapperCC.getSvcKei` | EKK0081A010SC | KK_T_SVC_KEI (Service Contract) | Retrieves telephone contract (service type "02") for the given service detail work number. Returns a map of contract fields. |
| R | `mapper.setEKK0161A010 + scCall.run` | EKK0161A010SC | KK_T_SVC_KEI_AGREEMENT (Service Contract Agreement) | Service component call to read the service contract agreement for the given service detail work number and operation date. |
| R | `mapper.getEKK0161A010` | EKK0161A010SC | KK_T_SVC_KEI_AGREEMENT | Extracts the agreement data map from the service component response for EKK0161A010. |
| R | `mapper.setEKK0191A010 + scCall.run` | EKK0191A010SC | KK_T_SVC_KEI_UCWK_AGREEMENT (Service Detail Work Agreement for e-hikari Tel) | Service component call to read the service detail work agreement for e-hikari telephone. |
| R | `mapper.getEKK0191A010` | EKK0191A010SC | KK_T_SVC_KEI_UCWK_AGREEMENT | Extracts the agreement data map from the service component response for EKK0191A010. |
| U | `kk0161_a010_map.put(...)` | - | - (in-memory) | Updates the in-memory agreement map with operation date, MSKM detail number, move division, and update timestamp backup. |
| U | `kk0191_a010_map.put(EMG_AD_CD)` | - | - (in-memory) | Sets the emergency address code (KAISEN_PLACE_AD_CD) in the service detail work agreement map. |
| U | `kk0191_a010_map.put(EMG_HOSEI_PCD)` | - | - (in-memory) | Sets the emergency contact postal code. |
| U | `kk0191_a010_map.put(EMG_STATE_NM)` | - | - (in-memory) | Sets the emergency contact prefecture name. |
| U | `kk0191_a010_map.put(EMG_CITY_NM)` | - | - (in-memory) | Sets the emergency contact city/town/village name. |
| U | `kk0191_a010_map.put(EMG_OAZTSU_NM)` | - | - (in-memory) | Sets the emergency contact oazutsu (大字号) name. |
| U | `kk0191_a010_map.put(EMG_AZCHO_NM)` | - | - (in-memory) | Sets the emergency contact azcho (字丁目) name. |
| U | `kk0191_a010_map.put(EMG_BNCHIGO)` | - | - (in-memory) | Sets the emergency contact banchigo (番地号) number. |
| U | `kk0191_a010_map.put(EMG_ADRTTM)` | - | - (in-memory) | Sets the emergency contact building name. |
| U | `kk0191_a010_map.put(EMG_ADRRM)` | - | - (in-memory) | Sets the emergency contact room number. |
| U | `kk0191_a010_map.put(EMG_AD_CHK_LV)` | - | - (in-memory) | Sets emergency address check level to "1". |
| U | `mapper.setEKK0191C060 + scCall.run` | EKK0191C060SC | KK_T_SVC_KEI_UCWK (Service Detail Work) | Service component call to update the service detail work record with the new emergency address fields. |
| R | `mapper.getEKK0191C060` | EKK0191C060SC | KK_T_SVC_KEI_UCWK | Extracts the updated service detail work record. |
| R | `paramMap.get(EMG_AD_CHK_LV_ERR)` | - | - | Retrieves the emergency address check level error result returned from the SC. |
| R | `mapper.setEKK1091B001 + scCall.run` | EKK1091B001SC | KK_T_PRG_AGREEMENT (Progress Agreement) | If service status is "010", reads the progress agreement list for the service line. |
| R | `mapper.getEKK1091B001` | EKK1091B001SC | KK_T_PRG_AGREEMENT | Extracts the progress agreement map. |
| C | `createPrgTokkiMapEmgAd` | - | - | Internal helper that creates a progress tooling map for the emergency address change. |
| C | `mapper.setEKK1091D010 + scCall.run` | EKK1091D010SC | KK_T_PRG_REG (Progress Registration) | Creates a progress registration record for the emergency address change. |
| R | `mapper.getEKK1091D010` | EKK1091D010SC | KK_T_PRG_REG | Extracts the progress registration result. |
| C | `hakkoSod` | - | - | Internal method that issues SOD (Service Order Data) using the before/after generation timestamps. |
| R | `mapper.setETU0011B010 + scCall.run` | ETU0011B010SC | KK_T_BMP_KOJI (Banpo/Installation Work) | Retrieves the Banpo work list for the service line and NTT kei-tel kaisen number. |
| R | `mapper.getETU0011B010` | ETU0011B010SC | KK_T_BMP_KOJI | Extracts the list of Banpo work records. |
| R | `mapper.setETU0011A010 + scCall.run` | ETU0011A010SC | KK_T_BMP_KOJI_AGREEMENT (Banpo Work Agreement) | Reads the Banpo work agreement for eligible work items (work status 000/010/011/021). |
| R | `mapper.getETU0011A010` | ETU0011A010SC | KK_T_BMP_KOJI_AGREEMENT | Extracts the Banpo work agreement map. |
| U | `tu0011_a010_map.put(KNKN_ITENS_*)` | - | - (in-memory) | Updates the Banpo work agreement map with knockan-itens (権限移転先) address fields when same-number transfer is detected. |
| U | `tu0011_a010_map.put(PAUSE_HYO_SOHUS_CD)` | - | - (in-memory) | Sets the pause notice delivery destination code to fixed value "3" (subsequent address). |
| U | `tu0011_a010_map.put(UPD_DTM_BF)` | - | - (in-memory) | Sets the before-update datetime from the work record. |
| U | `mapper.setETU0011C010 + scCall.run` | ETU0011C010SC | KK_T_BMP_KOJI_DTL (Banpo Work Detail) | Updates the Banpo work detail record with the new knockan-itens address. |
| R | `mapper.getETU0011C010` | ETU0011C010SC | KK_T_BMP_KOJI_DTL | Extracts the updated Banpo work detail. |
| JCCBatCommon.getSysDateTimeStamp | `JCCBatCommon` | - | - | Gets the system date/time stamp. Called once for IDO_DTM when service status is not "010". |

### CRUD Summary Table:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `getSvcKei` | EKK0081A010SC | KK_T_SVC_KEI | Get telephone contract (service type "02") for precondition check |
| R | `setEKK0161A010 + run` | EKK0161A010SC | KK_T_SVC_KEI_AGREEMENT | Read service contract agreement (emergency contact address change) |
| R | `setEKK0191A010 + run` | EKK0191A010SC | KK_T_SVC_KEI_UCWK_AGREEMENT | Read service detail work agreement (e-hikari telephone) |
| U | `setEKK0191C060 + run` | EKK0191C060SC | KK_T_SVC_KEI_UCWK | Update service detail work with emergency address fields |
| R | `setEKK1091B001 + run` | EKK1091B001SC | KK_T_PRG_AGREEMENT | Read progress agreement list (if status is "010") |
| C | `setEKK1091D010 + run` | EKK1091D010SC | KK_T_PRG_REG | Create progress registration for emergency address change |
| C | `hakkoSod` | - | - | Issue SOD (Service Order Data) for the service contract |
| R | `setETU0011B010 + run` | ETU0011B010SC | KK_T_BMP_KOJI | Read Banpo work list for this service line |
| R | `setETU0011A010 + run` | ETU0011A010SC | KK_T_BMP_KOJI_AGREEMENT | Read Banpo work agreement for eligible works |
| U | `setETU0011C010 + run` | ETU0011C010SC | KK_T_BMP_KOJI_DTL | Update Banpo work detail with knockan-itens address |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `JKKUsePlaceAdInfUpdCC.updateUsePlaceAd()` | `updateUsePlaceAd()` -> `updateEmgContactAd()` | EKK0161A010SC [R] KK_T_SVC_KEI_AGREEMENT, EKK0191A010SC [R] KK_T_SVC_KEI_UCWK_AGREEMENT, EKK0191C060SC [U] KK_T_SVC_KEI_UCWK, EKK1091D010SC [C] KK_T_PRG_REG, ETU0011B010SC [R] KK_T_BMP_KOJI, ETU0011C010SC [U] KK_T_BMP_KOJI_DTL |

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] (L1267)
Initialize local data structures and obtain mapper instance.

| # | Type | Code |
|---|------|------|
| 1 | SET | `condMap = new HashMap<String, String>()` |
| 2 | SET | `reqMap` (declared, assigned later) |
| 3 | SET | `resMap` (declared, assigned later) |
| 4 | EXEC | `mapper = JKKAdInfChgMapperCC.getInstance()` |
| 5 | SET | `svc_kei_list = (ArrayList)paramMap.get(SVC_KEI_LIST)` |

**Block 2** — [CALL] Get Telephone Contract (L1272)
Retrieve the telephone contract (service type "02") from the service contract list to verify a telephone service exists.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `kk0081_a010_map = getSvcKei(paramMap, CD00130_02)` |

**Block 3** — [IF] Early Return Check (L1273)
If no telephone contract is found, skip all processing.

> No telephone contract exists — processing is skipped.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return;` |

**Block 4** — [SET] Get Service Detail Work List (L1279)
Retrieve the list of service detail work records (each representing a line item within a service contract).

| # | Type | Code |
|---|------|------|
| 1 | SET | `kk0191_b001_list = (ArrayList)paramMap.get(SVC_KEI_UCWK_LIST)` |

**Block 5** — [FOR LOOP] Iterate Over Service Detail Work Items (L1283)
Process each service detail work record for emergency contact address update. The loop body covers the entire emergency address update flow for one line item.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kk0191_b001_map` (loop variable) |

**Block 5.1** — [IF] EKK0161A010 Service Contract Agreement Read (L1289)
Read the service contract agreement for this service detail work.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `condMap.clear()` |
| 2 | SET | `condMap.put(COND_KEY_SVC_KEI_UCWK_NO, kk0191_b001_map.get(SVC_KEI_UCWK_NO))` |
| 3 | SET | `condMap.put(COND_KEY_OPEDATE, paramMap.get(PARAM_KEY_OPE_DATE))` |
| 4 | EXEC | `reqMap = mapper.setEKK0161A010(param, fixedText, condMap)` |
| 5 | CALL | `resMap = scCall.run(reqMap, handle)` |
| 6 | EXEC | `kk0161_a010_map = mapper.getEKK0161A010(param, fixedText, resMap)` |
| 7 | EXEC | `mapper.scResultCheck(param)` |

**Block 5.2** — [IF] EKK0191A010 Service Detail Work Agreement Read (L1298)
Read the service detail work agreement for e-hikari telephone.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `condMap.clear()` |
| 2 | SET | `condMap.put(COND_KEY_SVC_KEI_UCWK_NO, kk0191_b001_map.get(SVC_KEI_UCWK_NO))` |
| 3 | SET | `condMap.put(COND_KEY_OPEDATE, paramMap.get(PARAM_KEY_OPE_DATE))` |
| 4 | EXEC | `reqMap = mapper.setEKK0191A010(param, fixedText, condMap)` |
| 5 | CALL | `resMap = scCall.run(reqMap, handle)` |
| 6 | EXEC | `kk0191_a010_map = mapper.getEKK0191A010(param, fixedText, resMap)` |
| 7 | EXEC | `mapper.scResultCheck(param)` |
| 8 | SET | `chbfSvcKeiUcwkGeneAddDtm = kk0191_a010_map.get(GENE_ADD_DTM)` // SOD generation datetime (before update) |

**Block 5.3** — [SET] Update Service Contract Agreement Fields (L1308)
Apply updated fields to the service contract agreement map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kk0161_a010_map.put(RSV_APLY_YMD, paramMap.get(PARAM_KEY_OPE_DATE))` |

**Block 5.4** — [IF] Conditional Update Based on Service Contract Status (L1311)
If the service contract detail work status is NOT "010" (processed), update the contract detail number and move division.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svc_kei_ucwk_stat = kk0161_a010_map.get(SVC_KEI_UCWK_STAT)` |
| 2 | IF | `!SVC_KEI_STAT_010.equals(svc_kei_ucwk_stat)` `[SVC_KEI_STAT_010="010"]` |

**Block 5.4.1** — [IF] Conditional MSKM Detail Number Update (L1313)
Only update MSKM detail number if it is provided in the input.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!StringUtils.isEmpty(paramMap.get(PARAM_KEY_MSKM_DTL_NO))` |

**Block 5.4.1.1** — [SET] Update MSKM Detail Number (L1315)

| # | Type | Code |
|---|------|------|
| 1 | SET | `kk0161_a010_map.put(MSKM_DTL_NO, paramMap.get(PARAM_KEY_MSKM_DTL_NO))` |

**Block 5.4.2** — [SET] Update Move Division (L1318)
Always update move division when status is not "010".

| # | Type | Code |
|---|------|------|
| 1 | SET | `kk0161_a010_map.put(IDO_DIV, paramMap.get(PARAM_KEY_IDO_DIV))` |

**Block 5.4.3** — [SET] Save Before-Update Timestamp (L1321)
Save the last update datetime as backup for SOD generation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kk0161_a010_map.put(UPD_DT_SVC_KEI_UCWK_UPD_DTM_BEF, kk0161_a010_map.get(LAST_UPD_DTM))` |

**Block 5.5** — [SET] Create Emergency Address Progress Map (L1324)
Create a progress tooling map containing the emergency address change progress data.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `emgAdPrgMap = createPrgTokkiMapEmgAd(kk0191_a010_map, paramMap)` |

**Block 5.6** — [SET] Populate Emergency Address Fields (L1329)
Set all emergency contact address fields in the service detail work agreement map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kk0191_a010_map.put(EMG_AD_CD, paramMap.get(KAISEN_PLACE_AD_CD))` // Emergency address code |
| 2 | SET | `kk0191_a010_map.put(EMG_HOSEI_PCD, paramMap.get(PARAM_AD_PCD))` // Postal code |
| 3 | SET | `kk0191_a010_map.put(EMG_STATE_NM, paramMap.get(PARAM_AD_STATE_NM))` // Prefecture name |
| 4 | SET | `kk0191_a010_map.put(EMG_CITY_NM, paramMap.get(PARAM_AD_CITY_NM))` // City/town/village name |
| 5 | SET | `kk0191_a010_map.put(EMG_OAZTSU_NM, paramMap.get(PARAM_AD_OAZTSU_NM))` // Oazutsu name |
| 6 | SET | `kk0191_a010_map.put(EMG_AZCHO_NM, paramMap.get(PARAM_AD_AZCHO_NM))` // Azcho name |
| 7 | SET | `kk0191_a010_map.put(EMG_BNCHIGO, paramMap.get(PARAM_AD_BNCHIGO))` // Banchigo number |
| 8 | SET | `kk0191_a010_map.put(EMG_ADRTTM, paramMap.get(PARAM_AD_ADRTTM))` // Building name |
| 9 | SET | `kk0191_a010_map.put(EMG_ADRRM, paramMap.get(PARAM_AD_ADRRM))` // Room number |
| 10 | SET | `kk0191_a010_map.put(EMG_AD_CHK_LV, "1")` // Check level = 1 |

**Block 5.7** — [IF] EKK0191C060 Service Detail Work Update (L1339)
Call the service component to update the service detail work record with the new emergency address.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `reqMap = mapper.setEKK0191C060(param, fixedText, kk0161_a010_map, kk0191_a010_map)` |
| 2 | CALL | `resMap = scCall.run(reqMap, handle)` |
| 3 | EXEC | `kk0191_c060_map = mapper.getEKK0191C060(param, fixedText, resMap)` |
| 4 | EXEC | `mapper.scResultCheck(param)` |
| 5 | SET | `kk0191_b001_map.put(PARAM_KEY_EMG_UPD_DTM_AF, kk0191_c060_map.get(UPD_DTM))` |
| 6 | SET | `ad_chk_lv_res = paramMap.get(EMG_AD_CHK_LV_ERR)` |
| 7 | SET | `if not empty: paramMap.put("ad_chk_lv_res", ad_chk_lv_res)` // Return check result to caller |
| 8 | SET | `chafSvcKeiUcwkGeneAddDtm = kk0191_c060_map.get(KK0161_GENE_ADD_DTM)` // SOD generation datetime (after update) |

**Block 5.8** — [SET] Get Service Line Metadata (L1350)
Retrieve the service contract status and move division for downstream progress registration logic.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcKeiStat = getMapString(kk0081_a010_map, SVC_KEI_STAT)` |
| 2 | SET | `idoDiv = getMapString(kk0081_a010_map, IDO_DIV)` |
| 3 | SET | `idoDtm = new String()` |

**Block 5.9** — [IF] Read Progress Agreement (L1354)
If the service contract status is "010" (processed), retrieve the existing progress agreement data to get the move datetime.

| # | Type | Code |
|---|------|------|
| 1 | IF | `SVC_KEI_STAT_010.equals(svcKeiStat)` `[SVC_KEI_STAT_010="010"]` |

**Block 5.9.1** — [IF] EKK1091B001 Progress Agreement Read (L1356)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `condMap.clear()` |
| 2 | SET | `condMap.put("key_svc_kei_no", kk0081_a010_map.get(SVC_KEI_NO))` |
| 3 | EXEC | `reqMap = mapper.setEKK1091B001(param, fixedText, condMap)` |
| 4 | CALL | `resMap = scCall.run(reqMap, handle)` |
| 5 | EXEC | `kk1091_a010_map = mapper.getEKK1091B001(param, fixedText, resMap)` |
| 6 | EXEC | `mapper.scResultCheck(param)` |
| 7 | SET | `idoDtm = getMapString(kk1091_a010_map, IDO_DTM)` |

**Block 5.10** — [SET] Build Progress Registration Map (L1366)
Prepare the progress registration data for emergency address change.

| # | Type | Code |
|---|------|------|
| 1 | SET | `emgAdPrgMap.put(SVC_KEI_NO, kk0081_a010_map.get(SVC_KEI_NO))` |
| 2 | SET | `emgAdPrgMap.put(SVC_KEI_UCWK_NO, kk0191_b001_map.get(SVC_KEI_UCWK_NO))` |

**Block 5.11** — [IF/ELSE] Set Move Division Based on Status (L1368)
If service status is "010", use the progress agreement data; otherwise, use param values and set IDO_DTM to current time.

| # | Type | Code |
|---|------|------|
| 1 | IF | `SVC_KEI_STAT_010.equals(svcKeiStat)` `[SVC_KEI_STAT_010="010"]` |

**Block 5.11.1** — [SET] Use Progress Agreement Data (L1370)

| # | Type | Code |
|---|------|------|
| 1 | SET | `emgAdPrgMap.put(IDO_DIV, idoDiv)` |
| 2 | SET | `emgAdPrgMap.put(IDO_DTM, idoDtm)` |

**Block 5.11.2** — [SET] Use Param Values with Current Timestamp (L1374)

| # | Type | Code |
|---|------|------|
| 1 | SET | `emgAdPrgMap.put(IDO_DIV, paramMap.get(PARAM_KEY_IDO_DIV))` |
| 2 | SET | `emgAdPrgMap.put(IDO_DTM, JCCBPCommon.getSysDateTimeStamp())` |

**Block 5.12** — [SET] Finalize Progress Registration Map (L1378)
Set the progress status and optional MSKM detail number.

| # | Type | Code |
|---|------|------|
| 1 | SET | `emgAdPrgMap.put(PRG_STAT, CD00647_E040)` `[CD00647_E040="E040"]` |
| 2 | IF | `!StringUtils.isEmpty(paramMap.get(PARAM_KEY_MSKM_DTL_NO))` |

**Block 5.12.1** — [SET] Set MSKM Detail Number (L1380)

| # | Type | Code |
|---|------|------|
| 1 | SET | `emgAdPrgMap.put(MSKM_DTL_NO, paramMap.get(PARAM_KEY_MSKM_DTL_NO))` |

**Block 5.13** — [IF] EKK1091D010 Progress Registration (L1384)
Register the progress record for the emergency address change.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `reqMap = mapper.setEKK1091D010(param, fixedText, emgAdPrgMap, getIdoRsnList(param, fixedText))` |
| 2 | CALL | `resMap = scCall.run(reqMap, handle)` |
| 3 | EXEC | `mapper.getEKK1091D010(param, fixedText, resMap)` |
| 4 | EXEC | `mapper.scResultCheck(param)` |

**Block 5.14** — [CALL] Issue SOD (L1392)
Trigger SOD (Service Order Data) issuance using the before and after generation timestamps.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `hakkoSod(handle, param, paramMap, svc_kei_no, kk0191_b001_map, chbfSvcKeiUcwkGeneAddDtm, chafSvcKeiUcwkGeneAddDtm)` |

**Block 5.15** — [IF] Banpo Work List Read (L1396)
Read the Banpo (番工, installation work) work list for this service line.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `condMap.clear()` |
| 2 | SET | `condMap.put(KEY_SVC_KEI_NO, kk0081_a010_map.get(SVC_KEI_NO))` |
| 3 | SET | `condMap.put(KEY_NTT_KEI_TEL_KAISEN_NO, kk0191_a010_map.get(TELNO))` |
| 4 | EXEC | `reqMap = mapper.setETU0011B010(param, fixedText, condMap)` |
| 5 | CALL | `resMap = scCall.run(reqMap, handle)` |
| 6 | EXEC | `tu0011_b010_list = mapper.getETU0011B010(param, fixedText, resMap)` |
| 7 | EXEC | `mapper.scResultCheck(param)` |

**Block 5.16** — [IF] Check Banpo Work List (L1401)
If no Banpo work records exist, skip the Banpo update section entirely.

| # | Type | Code |
|---|------|------|
| 1 | IF | `tu0011_b010_list != null` |

**Block 5.17** — [FOR LOOP] Iterate Over Banpo Work Records (L1403)
Process each Banpo work record to check if the knockan-itens (権限移転先, transfer destination) address needs to be updated.

| # | Type | Code |
|---|------|------|
| 1 | SET | `tu0011_b010_map` (loop variable) |

**Block 5.18** — [IF] Work Status Filter (L1417)
Only process works with status: "000" (work date not entered), "010" (other vendor confirmation required), "011" (other vendor request pending), or "021" (other vendor adjustment impossible). Skip all other statuses.

| # | Type | Code |
|---|------|------|
| 1 | SET | `bmpKojiStat = tu0011_b010_map.get(BMP_KOJI_STAT)` |
| 2 | IF | `!("000".equals(bmpKojiStat) \|\| "010".equals(bmpKojiStat) \|\| "011".equals(bmpKojiStat) \|\| "021".equals(bmpKojiStat))` |

**Block 5.18.1** — [EXEC] Skip This Work (L1419)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `continue` |

**Block 5.19** — [IF] Banpo Work Agreement Read (L1424)
Read the Banpo work agreement for the eligible work item.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `condMap.clear()` |
| 2 | SET | `condMap.put("key_bmp_koji_no", tu0011_b010_map.get(BMP_KOJI_NO))` |
| 3 | EXEC | `reqMap = mapper.setETU0011A010(param, fixedText, condMap)` |
| 4 | CALL | `resMap = scCall.run(reqMap, handle)` |
| 5 | EXEC | `tu0011_a010_map = mapper.getETU0011A010(param, fixedText, resMap)` |
| 6 | EXEC | `mapper.scResultCheck(param)` |

**Block 5.20** — [IF] Null Agreement Check (L1430)
If the work agreement record is null, skip this work.

| # | Type | Code |
|---|------|------|
| 1 | IF | `tu0011_a010_map == null` |

**Block 5.20.1** — [EXEC] Skip This Work (L1432)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `continue` |

**Block 5.21** — [IF] Pause Notice Delivery Check (ANK-4494-27-00) (L1438)
Only process works where the pause notice delivery destination code equals "3" (send to subsequent address). If not, skip — there are no fields to update.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!JTUStrConst.PAUSE_HYO_SOHUS_CD_KAKI.equals(tu0011_a010_map.get(PAUSE_HYO_SOHUS_CD))` `[PAUSE_HYO_SOHUS_CD_KAKI="3"]` |

**Block 5.21.1** — [EXEC] Skip (No Update Fields) (L1440)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `continue` |

**Block 5.22** — [SET] Get Work Agreement Column Data (L1446)
Retrieve the service business record column 1 from the Banpo work agreement to check for same-number transfer.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mskmJigKijiRan1 = tu0011_a010_map.get(MSKMJIG_KIJIRAN_1)` |

**Block 5.23** — [IF] Same-Number Transfer Detection (ANK-4494-27-00 modified) (L1452)
Check if the work agreement column 1 contains "同番移転" (same-number transfer). If yes, update the knockan-itens address; if not, leave the agreement as-is.

| # | Type | Code |
|---|------|------|
| 1 | IF | `mskmJigKijiRan1 != null && !"".equals(mskmJigKijiRan1) && mskmJigKijiRan1.indexOf("同番移転") > -1` |

**Block 5.23.1** — [SET] Update Knockan-Itens Address Fields (L1455)
Populate the transfer destination address fields with the emergency contact address data.

| # | Type | Code |
|---|------|------|
| 1 | SET | `tu0011_a010_map.put(KNKN_ITNSAD_MAN_INPUT_FLG, "0")` // Manual entry flag = disabled |
| 2 | SET | `tu0011_a010_map.put(KANYKN_ITENS_AD_CD, paramMap.get(KAISEN_PLACE_AD_CD))` // Transfer destination address code |
| 3 | SET | `tu0011_a010_map.put(KANYKN_ITENS_PCD, paramMap.get(PARAM_AD_PCD))` // Postal code |
| 4 | SET | `tu0011_a010_map.put(KANYKN_ITENS_STATE_NM, paramMap.get(PARAM_AD_STATE_NM))` // Prefecture |
| 5 | SET | `tu0011_a010_map.put(KANYKN_ITENS_CITY_NM, paramMap.get(PARAM_AD_CITY_NM))` // City/town/village |
| 6 | SET | `tu0011_a010_map.put(KANYKN_ITENS_OAZTSU_NM, paramMap.get(PARAM_AD_OAZTSU_NM))` // Oazutsu |
| 7 | SET | `tu0011_a010_map.put(KANYKN_ITENS_AZCHO_NM, paramMap.get(PARAM_AD_AZCHO_NM))` // Azcho |
| 8 | SET | `tu0011_a010_map.put(KANYKN_ITENS_BNCHIGO, paramMap.get(PARAM_AD_BNCHIGO))` // Banchigo |
| 9 | SET | `tu0011_a010_map.put(KANYKN_ITENS_ADRTTM, paramMap.get(PARAM_AD_ADRTTM))` // Building name |
| 10 | SET | `tu0011_a010_map.put(KANYKN_ITENS_ADRRM, kk0191_b001_map.get(PARAM_AD_ADRRM))` // Room number |
| 11 | SET | `tu0011_a010_map.put(PAUSE_HYO_SOHUS_CD, "3")` // Fixed: send pause notice to subsequent address |

**Block 5.24** — [SET] Set Before-Update Timestamp (L1475)

| # | Type | Code |
|---|------|------|
| 1 | SET | `tu0011_a010_map.put(UPD_DTM_BF, tu0011_b010_map.get(UPD_DTM))` |

**Block 5.25** — [IF] ETU0011C010 Banpo Work Detail Update (L1479)
Update the Banpo work detail with the knockan-itens address data.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `reqMap = mapper.setETU0011C010(param, fixedText, tu0011_a010_map)` |
| 2 | CALL | `resMap = scCall.run(reqMap, handle)` |
| 3 | EXEC | `mapper.getETU0011C010(param, fixedText, resMap)` |
| 4 | EXEC | `mapper.scResultCheck(param)` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `emgAdPrgMap` | Field | Emergency address progress tooling map — data structure holding progress registration data for the emergency address change operation |
| `svc_kei_list` | Field | Service contract list — list of active service contracts for the customer |
| `svc_kei_ucwk_list` | Field | Service detail work list — list of service line items (each containing contract details) within a service contract |
| `svc_kei_ucwk_no` | Field | Service detail work number — unique identifier for a service line item within a contract |
| `svc_kei_no` | Field | Service contract line number — identifier for a service contract line |
| `kk0081_a010_map` | Field | Service contract data map — contains telephone contract (CD00130_02) information including service status and move division |
| `kk0161_a010_map` | Field | Service contract agreement map — data for the service contract agreement record (EKK0161A010) |
| `kk0191_a010_map` | Field | Service detail work agreement map — data for the e-hikari telephone service detail work agreement (EKK0191A010) |
| `kk0191_b001_map` | Field | Service detail work record map — iteration variable holding one service detail work record from the list |
| `kk0191_c060_map` | Field | Service detail work updated map — data returned after updating the service detail work with emergency address (EKK0191C060) |
| `IDO_DIV` | Field | Move division code — classifies the type of address move (e.g., "00048": full address update) |
| `IDO_DTM` | Field | Move datetime — timestamp of the move event, retrieved from progress agreement or set to current time |
| `MSKM_DTL_NO` | Field | Contract detail number — optional detail number for a specific contract item |
| `KAISEN_PLACE_AD_CD` | Field | Updated residence address code — the new address code used as the emergency contact address |
| `PARAM_AD_PCD` | Field | Emergency contact postal code |
| `PARAM_AD_STATE_NM` | Field | Emergency contact prefecture name |
| `PARAM_AD_CITY_NM` | Field | Emergency contact city/town/village name |
| `PARAM_AD_OAZTSU_NM` | Field | Emergency contact oazutsu (大字号) name — traditional Japanese address component for large street/area designation |
| `PARAM_AD_AZCHO_NM` | Field | Emergency contact azcho (字丁目) name — traditional Japanese address component for district/block designation |
| `PARAM_AD_BNCHIGO` | Field | Emergency contact banchigo (番地号) number — land parcel number in Japanese addressing |
| `PARAM_AD_ADRTTM` | Field | Emergency contact building name |
| `PARAM_AD_ADRRM` | Field | Emergency contact room number |
| `PRG_STAT` | Field | Progress status — status code for the progress registration record |
| `CD00647_E040` | Constant | `"E040"` — Progress status code for emergency address change |
| `SVC_KEI_STAT_010` | Constant | `"010"` — Service contract detail work status indicating "processed" state |
| `CD00130_02` | Constant | `"02"` — Service type code for telephone service |
| `bmpKojiStat` | Field | Banpo work status — work execution status for installation jobs; values: "000" (date not entered), "010" (vendor confirm required), "011" (vendor pending), "021" (vendor adjustment impossible) |
| `mskmJigKijiRan1` | Field | Service business record column 1 — free-text field in the Banpo work agreement used to detect same-number transfer |
| `同番移転` | Japanese term | Same-number transfer — a telephone service where the phone number is retained after moving to a new address |
| `番工` (Banko) | Japanese term | Banpo (installation work) — physical installation/maintenance work records for customer premises |
| `権限移転先` (Ken-i Ten) | Japanese term | Transfer destination (authority) — the new address to which service authority is transferred during a same-number move |
| `緊急通報先住所` | Japanese term | Emergency contact address — a secondary address used for emergency notifications, separate from the primary residence address |
| `SOD` | Acronym | Service Order Data — internal order data issued when a service contract change takes effect; triggers downstream fulfillment workflows |
| `BC` | Acronym | Business Change — change operation in telecom service management |
| `CBS` | Acronym | Core Business System — back-end transaction processing system |
| `SC` | Acronym | Service Component — a remote service interface (typically EJB) for CBS operations |
| `KK_T_SVC_KEI` | Database | Service Contract table — stores active service contract header data |
| `KK_T_SVC_KEI_AGREEMENT` | Database | Service Contract Agreement table — stores service contract agreement details including emergency contact information |
| `KK_T_SVC_KEI_UCWK` | Database | Service Detail Work table — stores service detail work records (line items within a contract) |
| `KK_T_SVC_KEI_UCWK_AGREEMENT` | Database | Service Detail Work Agreement table — stores agreement details for service detail work items |
| `KK_T_PRG_REG` | Database | Progress Registration table — stores progress registration records for BC operations |
| `KK_T_PRG_AGREEMENT` | Database | Progress Agreement table — stores progress agreement data (move datetime, status, etc.) |
| `KK_T_BMP_KOJI` | Database | Banpo Work table — stores installation work records |
| `KK_T_BMP_KOJI_AGREEMENT` | Database | Banpo Work Agreement table — stores agreement details for installation work |
| `KK_T_BMP_KOJI_DTL` | Database | Banpo Work Detail table — stores detailed work data including address information |
| EKK0081A010SC | SC Code | Service Contract read component — retrieves telephone contract information |
| EKK0161A010SC | SC Code | Service Contract Agreement read component for emergency contact address change |
| EKK0191A010SC | SC Code | Service Detail Work Agreement read component for e-hikari telephone |
| EKK0191C060SC | SC Code | Service Detail Work update component — writes emergency address fields to the service detail work |
| EKK1091B001SC | SC Code | Progress Agreement read component |
| EKK1091D010SC | SC Code | Progress Registration component — creates progress records for BC operations |
| ETU0011A010SC | SC Code | Banpo Work Agreement read component |
| ETU0011B010SC | SC Code | Banpo Work list read component |
| ETU0011C010SC | SC Code | Banpo Work Detail update component |
| `getSvcKei` | Method | Helper method that retrieves a service contract record from the service contract list by service type code |
| `getMapString` | Method | Helper method that safely retrieves a String value from a map with null-checking |
| `createPrgTokkiMapEmgAd` | Method | Creates a progress tooling map for emergency address change operations |
| `hakkoSod` | Method | Issues SOD (Service Order Data) by invoking the SOD issuance CC with before/after generation timestamps |
| `getIdoRsnList` | Method | Builds a list of move reason records for progress registration |
| `PAUSE_HYO_SOHUS_CD_KAKI` | Constant | `"3"` — Pause notice delivery destination code meaning "send to subsequent address" |
| `JCCBPCommon.getSysDateTimeStamp` | Method | Returns the current system date/time as a formatted string |
