# Business Logic — JBSbatKKAdHenkoHoyuDataUpdOtr.execute() [225 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKAdHenkoHoyuDataUpdOtr` |
| Layer | Service |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKAdHenkoHoyuDataUpdOtr.execute()

This method serves as the main processing entry point for updating address-related records during a **change-determined work order** (`KK_T_CHG_AD_JGRTWK` — Change Address Judgment Result Work) processing flow. Its primary business purpose is to synchronize address data across related service tables whenever a work order triggers an address update for one of three distinct service categories: **Customer Consultation** (PROSCST, schema CK0051), **Spare Equipment Delivery** (YBKIKI_HAISO, schema DK0061), or **Prior Planning** (SENKO_DSGN, schema KU0101).

The method implements a **conditional dispatch pattern** — it examines the incoming schema ID to determine which target table requires an address update, then applies the appropriate address data (either the original or the new address) via a parameterized SQL define. Before performing any updates, the method validates the address using the 61-character address validation utility (`JPCAdCommonCheckUtil.ad61MojiChk`) to ensure data integrity. If validation fails, the work order's processing status is immediately marked as completed and the method exits early.

When the incoming address code matches the new address code, the method enriches the address data by querying the master address table (`ZM_M_AD`) to retrieve the previous-generation record, using a cache (`adBfList`) to avoid redundant database lookups. If the incoming address and old address fields differ (postal code, prefecture, city, oaza/aza), the method short-circuits by marking the work order as completed, since address reconciliation has already occurred through another mechanism.

The method operates as a shared utility within the K-Opticom customer backbone system, handling batch-triggered address harmonization workflows. It was created in September 2012 and has since received enhancements for address union-compatibility handling (ANK-3689-00-00, v45) and disability support (OM-2019-0001393, v47).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["execute inMap"])

    START --> READ["Read input parameters from inMap"]
    READ --> ADDR_EQ{adCd equals newAdCd}

    ADDR_EQ -->|Yes| CHECK_CACHE{adCd in adBfList cache}

    CHECK_CACHE -->|Yes| GET_CACHE["adMap = adBfList.get adCd"]
    CHECK_CACHE -->|No| EXEC_SELECT["executeZM_M_AD_KK_SELECT_012 whereParam"]
    EXEC_SELECT --> FETCH_AD["adMap = db_ZM_M_AD.selectNext"]
    FETCH_AD --> PUT_CACHE["adBfList.put adCd adMap"]
    GET_CACHE --> OVERWRITE_ADDR["Overwrite address fields from adMap"]
    PUT_CACHE --> OVERWRITE_ADDR
    OVERWRITE_ADDR --> ADDR_CHECK

    ADDR_EQ -->|No| ADDR_CHECK["Read address from input inMap"]

    ADDR_CHECK --> VALIDATE["JPCAdCommonCheckUtil.ad61MojiChk"]
    VALIDATE --> CHK_FAIL{ad61MojiChk result false}

    CHK_FAIL -->|Yes| UPDATE_STAT_FAIL["Update KK_T_CHG_AD_JGRTWK
AD_TOHAIGO_TRN_STAT_CD=9
WHERE CHG_AD_JGRTWK_NO"]
    UPDATE_STAT_FAIL --> EARLY_END_1["Return null"]

    CHK_FAIL -->|No| DIFF_CHECK{Any address difference}

    DIFF_CHECK -->|Yes| UPDATE_STAT_DIFF["Update KK_T_CHG_AD_JGRTWK
AD_TOHAIGO_TRN_STAT_CD=9
WHERE CHG_AD_JGRTWK_NO"]
    UPDATE_STAT_DIFF --> EARLY_END_2["Return null"]

    DIFF_CHECK -->|No| SKHEMA_CHECK{strSkemaId equals CK0051}

    SKHEMA_CHECK -->|Yes| ITEM_CHECK1{strItemName equals PROSCST_AD_CD}
    ITEM_CHECK1 -->|Yes| PROSCST_SET["Set dbList with address fields
PROSCST_NO
executeBySqlDefine KK_UPDATE_002"]
    ITEM_CHECK1 -->|No| LATE_UPDATE
    PROSCST_SET --> LATE_UPDATE

    SKHEMA_CHECK -->|No| YBKIKI_CHECK{strSkemaId equals DK0061}

    YBKIKI_CHECK -->|Yes| ITEM_CHECK2{strItemName equals YBKIKI_HISOS_AD_CD}
    ITEM_CHECK2 -->|Yes| YBKIKI_SET["Set dbList with address fields
YBKIKI_HAISO_NO
executeBySqlDefine KK_UPDATE_001"]
    ITEM_CHECK2 -->|No| LATE_UPDATE
    YBKIKI_SET --> LATE_UPDATE

    YBKIKI_CHECK -->|No| SENKO_CHECK{strSkemaId equals KU0101}

    SENKO_CHECK -->|Yes| ITEM_CHECK3{strItemName equals SETPLACE_AD_CD}
    ITEM_CHECK3 -->|Yes| SENKO_SET["Set dbList with address fields
SNKSKI_NO
executeBySqlDefine KK_UPDATE_001"]
    ITEM_CHECK3 -->|No| LATE_UPDATE
    SENKO_SET --> LATE_UPDATE

    SENKO_CHECK -->|No| LATE_UPDATE

    LATE_UPDATE["Update KK_T_CHG_AD_JGRTWK
AD_TOHAIGO_TRN_STAT_CD=9
WHERE CHG_AD_JGRTWK_NO"]
    LATE_UPDATE --> LATE_END(["Return null"])

    EARLY_END_1 --> LATE_END
    EARLY_END_2 --> LATE_END
```

**Processing Description:**

1. **Input Extraction** — Reads the change work order number, schema ID, and item name from the input map. Also extracts address fields (postal code, prefecture, city, oaza/aza) and their old counterparts.

2. **Address Enrichment** (OM-2019-0001393) — When the old address code equals the new address code, the method queries the master address table to retrieve the previous-generation address record. It uses a caching mechanism (`adBfList`) to avoid redundant lookups.

3. **Address Validation** — Calls the 61-character address validation utility. If validation fails (the check result is false), the work order processing status is set to "Processing Completed" (HENKO_ADD_CD_ZM = "9") and the method returns immediately.

4. **Address Difference Check** (ANK-3689-00-00) — If any of the key address fields (postal code, prefecture, city, oaza, aza) differ from their old values, the work order status is set to "Processing Completed" and the method returns, since the address has already been reconciled.

5. **Schema-Based Routing** — The method branches on three schema IDs:
   - **CK0051** (PROSCST_SKEMA_ID) — Customer Consultation table: updates the PROSCST address if the item name is `PROSCST_AD_CD`
   - **DK0061** (YBKIKI_HAISO_SKEMA_ID) — Spare Equipment Delivery table: updates the YBKIKI_HAISO address if the item name is `YBKIKI_HISOS_AD_CD`
   - **KU0101** (SENKO_DSGN_SKEMA_ID) — Prior Planning table: updates the SENKO_DSGN address if the item name is `SETPLACE_AD_CD`
   
   Each branch selects either the old address or the new address fields depending on whether `NEW_AD_CD` is present.

6. **Work Order Finalization** — After all conditional branches, the method always updates the work order processing status to "Processing Completed" (9) and returns null.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `inMap` | `JBSbatServiceInterfaceMap` | The input communication document carrying change address judgment work order data. It contains the change work order number (`CHG_AD_JGRTWK_NO`), the trigger schema ID (`CHG_TG_SCHEMA_ID`) that determines which target table to update, the target item name (`CHG_TG_KMK_NM_EINM`) that specifies which address field is being changed, old and new address codes (`AD_CD`, `NEW_AD_CD`), full old and new address components (postal code `PCD`, prefecture `STATE_NM`, city `CITY_NM`, oaza `OAZTSU_NM`, aza `AZCHO_NM`), and a reference number specific to the service type (`PROSCST_NO`, `YBKIKI_HAISO_NO`, or `SNKSKI_NO`). |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `adBfList` | `HashMap<String, JBSbatCommonDBInterface>` | Cache of previously looked-up address records, keyed by address code. Used to avoid repeated queries to the master address table for the same code within the same batch run. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JZMBatCommon.getInMapData` | JZMBatCommon | - | Reads input parameters from inMap: CHG_AD_JGRTWK_NO, CHG_TG_SCHEMA_ID, CHG_TG_KMK_NM_EINM |
| R | `JBSbatServiceInterfaceMap.getString` | JDKStructuredMap | - | Reads individual address fields from the input map |
| R | `JBSbatKKAdHenkoHoyuDataUpdOtr.getNullToStr` | JBSbatKKAdHenkoHoyuDataUpdOtr | - | Null-safe wrapper that returns empty string for null/blank values |
| C | `executeZM_M_AD_KK_SELECT_012` | - | `ZM_M_AD` (Master Address Table) | Executes SQL define KK_SELECT_012 — selects the previous-generation address record for a given address code (AD_CD) from ZM_M_AD where MK_FLG='0' and GENE_ADD_DTM is earlier than the current generation |
| R | `JBSbatCommonDBInterface.selectNext` | db_ZM_M_AD | `ZM_M_AD` | Fetches the next row from the SELECT result set into adMap |
| V | `JBSbatCommonDBInterface.getString` | adMap | - | Reads individual address fields from the address cache record |
| V | `JBSbatCommonDBInterface.setValue` | adMap / dbList / valueMap / whereMap | - | Sets values in interface objects for subsequent SQL execution |
| V | `JBSbatCommonDBInterface.setValue` | inMap data | - | Sets the reference number (PROSCST_NO, YBKIKI_HAISO_NO, SNKSKI_NO) into dbList |
| V | `JPCAdCommonCheckUtil.ad61MojiChk` | JPCAdCommonCheck | - | Validates address data — checks 61-character address format, consistency, and data quality across all address components |
| U | `db_CHG_AD_JGRTWK.updateByPrimaryKeys` | KK_T_CHG_AD_JGRTWK | `KK_T_CHG_AD_JGRTWK` (Change Address Judgment Result Work Table) | Updates the AD_TOHAIGO_TRN_STAT_CD field to "9" (HENKO_ADD_CD_ZM — Processing Completed) on the work order record identified by CHG_AD_JGRTWK_NO. Executed in three scenarios: validation failure, address difference detected, and finalization. |
| U | `db_CK_T_PROSCST.executeBySqlDefine` | KK_UPDATE_002 | `CK_T_PROSCST` (Customer Consultation Table) | Updates the consultation address fields (AD_CD, PCD, STATE_NM, CITY_NM, OAZTSU_NM, AZCHO_NM) and/or their NEW_ variants, identified by PROSCST_NO. Used when schema is CK0051 (Customer Consultation). |
| U | `db_DK_T_YBKIKI_HAISO.executeBySqlDefine` | KK_UPDATE_001 | `DK_T_YBKIKI_HAISO` (Spare Equipment Delivery Table) | Updates the delivery address fields for spare equipment, identified by YBKIKI_HAISO_NO. Used when schema is DK0061. |
| U | `db_KU_T_SENKO_DSGN.executeBySqlDefine` | KK_UPDATE_001 | `KU_T_SENKO_DSGN` (Prior Planning Table) | Updates the installation site address fields, identified by SNKSKI_NO. Used when schema is KU0101. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSbatKKAdHenkoHoyuDataUpdOtr | `JBSbatBusinessService.execute` -> `JBSbatKKAdHenkoHoyuDataUpdOtr.execute` | `db_CHG_AD_JGRTWK.updateByPrimaryKeys [U] KK_T_CHG_AD_JGRTWK`, `db_CK_T_PROSCST.executeBySqlDefine [U] CK_T_PROSCST`, `db_DK_T_YBKIKI_HAISO.executeBySqlDefine [U] DK_T_YBKIKI_HAISO`, `db_KU_T_SENKO_DSGN.executeBySqlDefine [U] KU_T_SENKO_DSGN`, `db_ZM_M_AD.selectBySqlDefine [R] ZM_M_AD` |

**Note:** This method is a batch service entry point. The search found no other files referencing `JBSbatKKAdHenkoHoyuDataUpdOtr` as a dependency of another class. It is invoked as a top-level batch service handler, likely triggered by the batch framework's service invocation mechanism (via `JBSbatBusinessService` parent class routing).

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] (L102) Input parameter extraction

> Extracts the core identifiers from the input map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `strChgAdJgrtwkNo = JZMBatCommon.getInMapData(inMap, "CHG_AD_JGRTWK_NO")` // Change work order number [-> CHG_AD_JGRTWK_NO (JBSbatKK_T_CHG_AD_JGRTWK.java:42)] |
| 2 | SET | `strSkemaId = JZMBatCommon.getInMapData(inMap, "CHG_TG_SCHEMA_ID")` // Schema ID determining target table [-> CHG_TG_SCHEMA_ID (JBSbatKK_T_CHG_AD_JGRTWK.java:45)] |
| 3 | SET | `strItemName = JZMBatCommon.getInMapData(inMap, "CHG_TG_KMK_NM_EINM").trim()` // Target item name (English) [-> CHG_TG_KMK_NM_EINM (JBSbatKK_T_CHG_AD_JGRTWK.java:48)] |

---

**Block 2** — [SET] (L105-129) Address field extraction (ANK-3689-00-00 ADD)

> Extracts current and old address components from the input map with null-to-empty safety.

| # | Type | Code |
|---|------|------|
| 1 | SET | `pcd = getNullToStr(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.PCD))` // Postal code [-> PCD (JBSbatKK_T_CHG_AD_JGRTWK.java:68)] |
| 2 | SET | `stateNm = getNullToStr(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.STATE_NM))` // Prefecture name [-> STATE_NM (JBSbatKK_T_CHG_AD_JGRTWK.java:71)] |
| 3 | SET | `cityNm = getNullToStr(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.CITY_NM))` // City/town/village name [-> CITY_NM (JBSbatKK_T_CHG_AD_JGRTWK.java:74)] |
| 4 | SET | `oaztsuNm = getNullToStr(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.OAZTSU_NM))` // Oaza (large district) name [-> OAZTSU_NM (JBSbatKK_T_CHG_AD_JGRTWK.java:77)] |
| 5 | SET | `azchoNm = getNullToStr(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.AZCHO_NM))` // Aza (small district) name [-> AZCHO_NM (JBSbatKK_T_CHG_AD_JGRTWK.java:80)] |
| 6 | SET | `oldPcd = getNullToStr(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.OLD_PCD))` // Old postal code [-> OLD_PCD (JBSbatKK_T_CHG_AD_JGRTWK.java:113)] |
| 7 | SET | `oldStateNm = getNullToStr(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.OLD_STATE_NM))` // Old prefecture name [-> OLD_STATE_NM (JBSbatKK_T_CHG_AD_JGRTWK.java:116)] |
| 8 | SET | `oldCityNm = getNullToStr(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.OLD_CITY_NM))` // Old city/town/village name [-> OLD_CITY_NM (JBSbatKK_T_CHG_AD_JGRTWK.java:119)] |
| 9 | SET | `oldOaztsuNm = getNullToStr(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.OLD_OAZTSU_NM))` // Old oaza name [-> OLD_OAZTSU_NM (JBSbatKK_T_CHG_AD_JGRTWK.java:122)] |
| 10 | SET | `oldAzchoNm = getNullToStr(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.OLD_AZCHO_NM))` // Old aza name [-> OLD_AZCHO_NM (JBSbatKK_T_CHG_AD_JGRTWK.java:125)] |

---

**Block 3** — (OM-2019-0001393 ADD) Address code equivalence check and enrichment

> If the old address code equals the new address code, retrieve the previous-generation address from the master address table.

| # | Type | Code |
|---|------|------|
| 1 | SET | `adCd = getNullToStr(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.AD_CD))` // Current address code [-> AD_CD (JBSbatKK_T_CHG_AD_JGRTWK.java:86)] |
| 2 | SET | `newAdCd = getNullToStr(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.NEW_AD_CD))` // New address code [-> NEW_AD_CD (JBSbatKK_T_CHG_AD_JGRTWK.java:92)] |
| 3 | IF | `adCd.equals(newAdCd)` [L128] // Old address code equals new address code — need to enrich from master table |

**Block 3.1** — [IF] Cache lookup (L132)

| # | Type | Code |
|---|------|------|
| 1 | IF | `adBfList.containsKey(adCd)` [L132] // Check if address code is already cached |

**Block 3.1.1** — [IF-TRUE] Use cached address record (L133-134)

| # | Type | Code |
|---|------|------|
| 1 | SET | `adMap = adBfList.get(adCd)` // Retrieve cached address record |

**Block 3.1.2** — [IF-FALSE] Query master address table (L136-140)

| # | Type | Code |
|---|------|------|
| 1 | SET | `whereParam = new String[]{adCd}` // Parameter array for address code lookup |
| 2 | CALL | `executeZM_M_AD_KK_SELECT_012(whereParam)` // Query ZM_M_AD for previous-generation record via SQL define KK_SELECT_012 |
| 3 | SET | `adMap = db_ZM_M_AD.selectNext()` // Fetch next row from SELECT result |
| 4 | EXEC | `adBfList.put(adCd, adMap)` // Cache the retrieved record for future use |

**Block 3.2** — [IF] Apply enriched address fields (L143-153)

> When adMap is non-null, overwrite the address fields from the master table record.

| # | Type | Code |
|---|------|------|
| 1 | IF | `adMap != null` [L143] // Master address record found |
| 2 | SET | `pcd = getNullToStr(adMap.getString(JBSbatZM_M_AD.PCD))` // Overwrite postal code from master [-> PCD (JBSbatZM_M_AD.java:34)] |
| 3 | SET | `stateNm = getNullToStr(adMap.getString(JBSbatZM_M_AD.STATE_NM))` // Overwrite prefecture name [-> STATE_NM (JBSbatZM_M_AD.java:37)] |
| 4 | SET | `cityNm = getNullToStr(adMap.getString(JBSbatZM_M_AD.CITY_NM))` // Overwrite city name [-> CITY_NM (JBSbatZM_M_AD.java:40)] |
| 5 | SET | `oaztsuNm = getNullToStr(adMap.getString(JBSbatZM_M_AD.OAZTSU_NM))` // Overwrite oaza name [-> OAZTSU_NM (JBSbatZM_M_AD.java:43)] |
| 6 | SET | `azchoNm = getNullToStr(adMap.getString(JBSbatZM_M_AD.AZCHO_NM))` // Overwrite aza name [-> AZCHO_NM (JBSbatZM_M_AD.java:46)] |

---

**Block 4** — [EXEC] Address validation (L159-168)

> Validates the address against the 61-character address standard.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ad61MojiChkMap = JPCAdCommonCheckUtil.ad61MojiChk(...)` // Validates AD_CD, PCD, STATE_NM, CITY_NM, OAZTSU_NM, AZCHO_NM, OLD_BNCHIGO [L160-168] |
| 2 | SET | Parameter 1: `inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.AD_CD)` // Address code |
| 3 | SET | Parameter 2: `inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.PCD)` // Postal code |
| 4 | SET | Parameter 3: `"0"` // Registration penalty flag (literal) |
| 5 | SET | Parameter 4: `inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.STATE_NM)` // Prefecture name |
| 6 | SET | Parameter 5: `inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.CITY_NM)` // City name |
| 7 | SET | Parameter 6: `inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.OAZTSU_NM)` // Oaza name |
| 8 | SET | Parameter 7: `inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.AZCHO_NM)` // Aza name |
| 9 | SET | Parameter 8: `inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.OLD_BNCHIGO)` // Old lot number [-> OLD_BNCHIGO (JBSbatKK_T_CHG_AD_JGRTWK.java:134)] |
| 10 | SET | Parameter 9: `""` // Empty string (old address note) |
| 11 | SET | Parameter 10: `""` // Empty string (old address room number) |

---

**Block 5** — [IF-ELSE] Address validation failure branch (L170-193)

> If the address validation result is false (validation failed), mark the work order as completed and exit.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!(Boolean)ad61MojiChkMap.get(JPCStrConst.ad61MojiChk)` [L170] // Validation check result is false |

**Block 5.1** — [IF-TRUE] Mark work order status as completed (L172-192)

> Sets the work order processing status to "Processing Completed" (9 = HENKO_ADD_CD_ZM) and returns.

| # | Type | Code |
|---|------|------|
| 1 | SET | `valueMap = new JBSbatCommonDBInterface()` [L173] |
| 2 | SET | `valueMap.setValue("AD_TOHAIGO_TRN_STAT_CD", JKKBatConst.HENKO_ADD_CD_ZM)` // Set to "9" — Processing Completed [-> HENKO_ADD_CD_ZM="9" (JKKBatConst.java:1265)] |
| 3 | SET | `whereMap = new JBSbatCommonDBInterface()` [L176] |
| 4 | SET | `whereMap.setValue("CHG_AD_JGRTWK_NO", strChgAdJgrtwkNo)` // WHERE clause key [L179] |
| 5 | CALL | `db_CHG_AD_JGRTWK.updateByPrimaryKeys(whereMap, valueMap)` // Update work order status [L182] |
| 6 | RETURN | `return null;` [L184] |

---

**Block 6** — [IF] Address difference detection (ANK-3689-00-00 ADD) (L190-215)

> If any key address field has changed (the current value differs from the old value), mark the work order as completed since address reconciliation has already occurred.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!pcd.equals(oldPcd) \|\| !stateNm.equals(oldStateNm) \|\| !cityNm.equals(oldCityNm) \|\| !oaztsuNm.equals(oldOaztsuNm) \|\| !azchoNm.equals(oldAzchoNm)` [L195] // Any of the 5 address fields differs from old value |

**Block 6.1** — [IF-TRUE] Mark work order status as completed (L197-214)

| # | Type | Code |
|---|------|------|
| 1 | SET | `valueMap = new JBSbatCommonDBInterface()` [L198] |
| 2 | SET | `valueMap.setValue("AD_TOHAIGO_TRN_STAT_CD", JKKBatConst.HENKO_ADD_CD_ZM)` // Set to "9" — Processing Completed [-> HENKO_ADD_CD_ZM="9" (JKKBatConst.java:1265)] |
| 3 | SET | `whereMap = new JBSbatCommonDBInterface()` [L201] |
| 4 | SET | `whereMap.setValue("CHG_AD_JGRTWK_NO", strChgAdJgrtwkNo)` // WHERE clause key [L204] |
| 5 | CALL | `db_CHG_AD_JGRTWK.updateByPrimaryKeys(whereMap, valueMap)` // Update work order status [L207] |
| 6 | RETURN | `return null;` [L209] |

---

**Block 7** — [IF] Customer Consultation (PROSCST) schema routing (L212-235)

> Handles the Customer Consultation service category (schema ID CK0051). The Japanese comment reads "問合客" (Customer Consultation Customer).

| # | Type | Code |
|---|------|------|
| 1 | IF | `strSkemaId.equals(PROSCST_SKEMA_ID)` [L212] // Schema ID equals "CK0051" (PROSCST_SKEMA_ID) |

**Block 7.1** — [IF-TRUE] PROSCST address update (L214-235)

> When the item name is `PROSCST_AD_CD`, update the Customer Consultation table with the address data.

| # | Type | Code |
|---|------|------|
| 1 | IF | `strItemName.equals("PROSCST_AD_CD")` [L214] // Item name is Customer Consultation address code field |
| 2 | SET | `dbList = new JBSbatCommonDBInterface()` [L216] |
| 3 | IF | `null == inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.NEW_AD_CD)` [L217] // Check if NEW_AD_CD is null |

**Block 7.1.1** — [IF-TRUE] Use old address fields (L218-223)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.AD_CD))` // Old address code [-> AD_CD (JBSbatKK_T_CHG_AD_JGRTWK.java:86)] |
| 2 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.PCD))` // Old postal code [-> PCD (JBSbatKK_T_CHG_AD_JGRTWK.java:68)] |
| 3 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.STATE_NM))` // Old prefecture name [-> STATE_NM (JBSbatKK_T_CHG_AD_JGRTWK.java:71)] |
| 4 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.CITY_NM))` // Old city name [-> CITY_NM (JBSbatKK_T_CHG_AD_JGRTWK.java:74)] |
| 5 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.OAZTSU_NM))` // Old oaza name [-> OAZTSU_NM (JBSbatKK_T_CHG_AD_JGRTWK.java:77)] |
| 6 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.AZCHO_NM))` // Old aza name [-> AZCHO_NM (JBSbatKK_T_CHG_AD_JGRTWK.java:80)] |

**Block 7.1.2** — [IF-FALSE] Use new address fields (L224-229)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.NEW_AD_CD))` // New address code [-> NEW_AD_CD (JBSbatKK_T_CHG_AD_JGRTWK.java:92)] |
| 2 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.NEW_PCD))` // New postal code [-> NEW_PCD (JBSbatKK_T_CHG_AD_JGRTWK.java:95)] |
| 3 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.NEW_STATE_NM))` // New prefecture name [-> NEW_STATE_NM (JBSbatKK_T_CHG_AD_JGRTWK.java:98)] |
| 4 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.NEW_CITY_NM))` // New city name [-> NEW_CITY_NM (JBSbatKK_T_CHG_AD_JGRTWK.java:101)] |
| 5 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.NEW_OAZTSU_NM))` // New oaza name [-> NEW_OAZTSU_NM (JBSbatKK_T_CHG_AD_JGRTWK.java:104)] |
| 6 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.NEW_AZCHO_NM))` // New aza name [-> NEW_AZCHO_NM (JBSbatKK_T_CHG_AD_JGRTWK.java:107)] |

**Block 7.1.3** — [COMMON] Set reference number and execute update (L231-235)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `dbList.setValue(JZMBatCommon.getInMapData(inMap, "PROSCST_NO"))` // Set consultation reference number [-> PROSCST_NO (JBSbatKK_T_CHG_AD_JGRTWK.java:57)] |
| 2 | CALL | `db_CK_T_PROSCST.executeBySqlDefine(dbList, "KK_UPDATE_002")` // Execute SQL UPDATE on CK_T_PROSCST table [L235] |

---

**Block 8** — [IF] Spare Equipment Delivery (YBKIKI_HAISO) schema routing (L238-262)

> Handles the Spare Equipment Delivery service category (schema ID DK0061). The Japanese comment reads "予備機器配送" (Spare Equipment Delivery).

| # | Type | Code |
|---|------|------|
| 1 | IF | `strSkemaId.equals(YBKIKI_HAISO_SKEMA_ID)` [L238] // Schema ID equals "DK0061" (YBKIKI_HAISO_SKEMA_ID) |

**Block 8.1** — [IF-TRUE] YBKIKI_HAISO address update (L240-262)

> When the item name is `YBKIKI_HISOS_AD_CD`, update the Spare Equipment Delivery table.

| # | Type | Code |
|---|------|------|
| 1 | IF | `strItemName.equals("YBKIKI_HISOS_AD_CD")` [L240] // Item name is Spare Equipment Delivery address code field |
| 2 | SET | `dbList = new JBSbatCommonDBInterface()` [L242] |
| 3 | IF | `null == inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.NEW_AD_CD)` [L243] // Check if NEW_AD_CD is null |

**Block 8.1.1** — [IF-TRUE] Use old address fields (L244-249)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.AD_CD))` // Old address code |
| 2 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.PCD))` // Old postal code |
| 3 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.STATE_NM))` // Old prefecture name |
| 4 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.CITY_NM))` // Old city name |
| 5 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.OAZTSU_NM))` // Old oaza name |
| 6 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.AZCHO_NM))` // Old aza name |

**Block 8.1.2** — [IF-FALSE] Use new address fields (L250-255)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.NEW_AD_CD))` // New address code |
| 2 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.NEW_PCD))` // New postal code |
| 3 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.NEW_STATE_NM))` // New prefecture name |
| 4 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.NEW_CITY_NM))` // New city name |
| 5 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.NEW_OAZTSU_NM))` // New oaza name |
| 6 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.NEW_AZCHO_NM))` // New aza name |

**Block 8.1.3** — [COMMON] Set reference number and execute update (L257-262)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `dbList.setValue(JZMBatCommon.getInMapData(inMap, "YBKIKI_HAISO_NO"))` // Set spare equipment delivery reference number [-> YBKIKI_HAISO_NO (JBSbatKK_T_CHG_AD_JGRTWK.java:83)] |
| 2 | CALL | `db_DK_T_YBKIKI_HAISO.executeBySqlDefine(dbList, "KK_UPDATE_001")` // Execute SQL UPDATE on DK_T_YBKIKI_HAISO table [L262] |

---

**Block 9** — [IF] Prior Planning (SENKO_DSGN) schema routing (L265-289)

> Handles the Prior Planning service category (schema ID KU0101). The Japanese comment reads "先行設計" (Prior Planning / Preliminary Design).

| # | Type | Code |
|---|------|------|
| 1 | IF | `strSkemaId.equals(SENKO_DSGN_SKEMA_ID)` [L265] // Schema ID equals "KU0101" (SENKO_DSGN_SKEMA_ID) |

**Block 9.1** — [IF-TRUE] SENKO_DSGN address update (L267-289)

> When the item name is `SETPLACE_AD_CD`, update the Prior Planning table with installation site address data.

| # | Type | Code |
|---|------|------|
| 1 | IF | `strItemName.equals("SETPLACE_AD_CD")` [L267] // Item name is Installation Site address code field |
| 2 | SET | `dbList = new JBSbatCommonDBInterface()` [L269] |
| 3 | IF | `null == inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.NEW_AD_CD)` [L270] // Check if NEW_AD_CD is null |

**Block 9.1.1** — [IF-TRUE] Use old address fields (L271-276)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.AD_CD))` // Old address code |
| 2 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.PCD))` // Old postal code |
| 3 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.STATE_NM))` // Old prefecture name |
| 4 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.CITY_NM))` // Old city name |
| 5 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.OAZTSU_NM))` // Old oaza name |
| 6 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.AZCHO_NM))` // Old aza name |

**Block 9.1.2** — [IF-FALSE] Use new address fields (L277-282)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.NEW_AD_CD))` // New address code |
| 2 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.NEW_PCD))` // New postal code |
| 3 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.NEW_STATE_NM))` // New prefecture name |
| 4 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.NEW_CITY_NM))` // New city name |
| 5 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.NEW_OAZTSU_NM))` // New oaza name |
| 6 | EXEC | `dbList.setValue(inMap.getString(JBSbatKK_T_CHG_AD_JGRTWK.NEW_AZCHO_NM))` // New aza name |

**Block 9.1.3** — [COMMON] Set reference number and execute update (L284-289)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `dbList.setValue(JZMBatCommon.getInMapData(inMap, "SNKSKI_NO"))` // Set prior planning reference number [-> SNKSKI_NO (JBSbatKK_T_CHG_AD_JGRTWK.java:62)] |
| 2 | CALL | `db_KU_T_SENKO_DSGN.executeBySqlDefine(dbList, "KK_UPDATE_001")` // Execute SQL UPDATE on KU_T_SENKO_DSGN table [L289] |

---

**Block 10** — [SET] Work order finalization (L292-315)

> After all conditional branches (whether any schema-specific update was performed or not), the work order processing status is always set to "Processing Completed" (9).

| # | Type | Code |
|---|------|------|
| 1 | SET | `valueMap = new JBSbatCommonDBInterface()` [L293] // Reuse variable name (redeclared as local) |
| 2 | SET | `valueMap.setValue("AD_TOHAIGO_TRN_STAT_CD", JKKBatConst.HENKO_ADD_CD_ZM)` // Set to "9" — Processing Completed [-> HENKO_ADD_CD_ZM="9" (JKKBatConst.java:1265)] |
| 3 | SET | `whereMap = new JBSbatCommonDBInterface()` [L296] |
| 4 | SET | `whereMap.setValue("CHG_AD_JGRTWK_NO", strChgAdJgrtwkNo)` // WHERE clause key |
| 5 | CALL | `db_CHG_AD_JGRTWK.updateByPrimaryKeys(whereMap, valueMap)` // Finalize work order status |
| 6 | RETURN | `return null;` [L318] |

---

**Block 11** — [METHOD] `executeZM_M_AD_KK_SELECT_012` (L365-375)

> Private helper method. Executes a parameterized SELECT on the master address table (ZM_M_AD) to retrieve the previous-generation address record for a given address code. Used for address enrichment.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramList = new JBSbatCommonDBInterface()` [L368] |
| 2 | SET | `paramList.setValue(param[0].toString())` // Bind address code parameter [L369] |
| 3 | CALL | `db_ZM_M_AD.selectBySqlDefine(paramList, "KK_SELECT_012")` // Execute SELECT on ZM_M_AD via SQL define [L372] |

**SQL define KK_SELECT_012 on ZM_M_AD:**
- Selects: PCD, STATE_NM, CITY_NM, OAZTSU_NM, AZCHO_NM
- From: `ZM_M_AD`
- Where: `AD_CD = ?` AND `MK_FLG = '0'` AND `GENE_ADD_DTM < (SELECT MAX(GENE_ADD_DTM) FROM ZM_M_AD WHERE AD_CD = ? AND MK_FLG = '0')`
- Purpose: Retrieves the most recent prior-generation record for the given address code (i.e., the address record from before the current generation)

---

**Block 12** — [METHOD] `getNullToStr` (L379-388)

> Private helper method. Returns an empty string when the input is null or blank, otherwise returns the input as-is. Provides null-safety for address field extraction.

| # | Type | Code |
|---|------|------|
| 1 | IF | `str == null || "".equals(str.trim())` [L382] // Null or blank check |
| 2 | RETURN | `return "";` [L383] |
| 3 | RETURN | `return str;` [L386] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `CHG_AD_JGRTWK_NO` | Field | Change Address Judgment Result Work Order Number — internal tracking ID for a work order that has been determined to require an address change |
| `CHG_TG_SCHEMA_ID` | Field | Change Target Schema ID — identifies which service table requires an address update (CK0051, DK0061, or KU0101) |
| `CHG_TG_KMK_NM_EINM` | Field | Change Target Item Name (English) — specifies which address field is the target of the update |
| `AD_CD` | Field | Address Code — the current address identifier (old address code) |
| `NEW_AD_CD` | Field | New Address Code — the updated address identifier, populated when an address change is being applied |
| `PCD` | Field | Postal Code — Japanese postal code (郵便番号) |
| `STATE_NM` | Field | Prefecture Name — Japanese prefecture (都道府県名) |
| `CITY_NM` | Field | City/Town/Village Name — municipal name (市区町村名) |
| `OAZTSU_NM` | Field | Oaza Name — large district name within a city (大字通称名) |
| `AZCHO_NM` | Field | Aza Name — small district name within an oaza (字丁目名) |
| `OLD_PCD` / `OLD_STATE_NM` / etc. | Field | Old address fields — the pre-change values of the address components |
| `OLD_BNCHIGO` | Field | Old Lot Number — the pre-change lot/bangachi number (旧番地番号) |
| `AD_TOHAIGO_TRN_STAT_CD` | Field | Address Dismantling Process Status Code — tracks the processing state of address harmonization; "9" = Processing Completed (処理完了), "4" = Update Not Possible (更新不可) |
| `HENKO_ADD_CD_ZM` | Constant | "9" — Address change/addition status code meaning "Processing Completed" (処理完了) [-> HENKO_ADD_CD_ZM="9" (JKKBatConst.java:1265)] |
| `HENKO_ADD_CD_FUKA` | Constant | "4" — Address change/addition status code meaning "Update Not Possible" (更新不可) [-> HENKO_ADD_CD_FUKA="4" (JKKBatConst.java:1262)] |
| `PROSCST_SKEMA_ID` | Constant | "CK0051" — Schema ID for Customer Consultation service (問合客) |
| `YBKIKI_HAISO_SKEMA_ID` | Constant | "DK0061" — Schema ID for Spare Equipment Delivery service (予備機器配送) |
| `SENKO_DSGN_SKEMA_ID` | Constant | "KU0101" — Schema ID for Prior Planning service (先行設計) |
| `PROSCST_NO` | Field | Customer Consultation Number (問合客番号) — reference number for consultation records |
| `YBKIKI_HAISO_NO` | Field | Spare Equipment Delivery Number (予備機器配送番号) — reference number for spare equipment delivery records |
| `SNKSKI_NO` | Field | Prior Planning Number (先行設計番号) — reference number for preliminary planning records |
| `PROSCST_AD_CD` | Field | Customer Consultation Address Code — item name indicating the PROSCST table's address field is being updated |
| `YBKIKI_HISOS_AD_CD` | Field | Spare Equipment Delivery Address Code — item name indicating the YBKIKI_HAISO table's address field is being updated |
| `SETPLACE_AD_CD` | Field | Installation Site Address Code — item name indicating the SENKO_DSGN table's address field is being updated |
| `ZM_M_AD` | Table | Master Address Table (住所マスター) — reference table containing valid Japanese addresses with generation tracking (GENE_ADD_DTM) |
| `KK_T_CHG_AD_JGRTWK` | Table | Change Address Judgment Result Work Table — intermediate work table holding address change determination results |
| `CK_T_PROSCST` | Table | Customer Consultation Table — stores consultation customer address data |
| `DK_T_YBKIKI_HAISO` | Table | Spare Equipment Delivery Table — stores spare equipment delivery address data |
| `KU_T_SENKO_DSGN` | Table | Prior Planning Table — stores installation site preliminary planning address data |
| `KK_SELECT_012` | SQL Define | Parameterized SELECT on ZM_M_AD to retrieve the previous-generation address record for a given address code |
| `KK_UPDATE_001` | SQL Define | Parameterized UPDATE on CK_T_PROSCST, DK_T_YBKIKI_HAISO, or KU_T_SENKO_DSGN tables |
| `KK_UPDATE_002` | SQL Define | Parameterized UPDATE on CK_T_PROSCST table (used for PROSCST address updates) |
| `ad61MojiChk` | Function | 61-character address validation utility — validates address format, consistency, and data quality |
| `adBfList` | Field | Address Before-list — cache of previously looked-up address records from the master address table |
| `adMap` | Variable | Address Map — JBSbatCommonDBInterface object holding a single address record from the master table |
| `db_CHG_AD_JGRTWK` | Field | Database access object for the Change Address Judgment Result Work table |
| `db_CK_T_PROSCST` | Field | Database access object for the Customer Consultation table |
| `db_DK_T_YBKIKI_HAISO` | Field | Database access object for the Spare Equipment Delivery table |
| `db_KU_T_SENKO_DSGN` | Field | Database access object for the Prior Planning table |
| `db_ZM_M_AD` | Field | Database access object for the Master Address table |
| JPCAdCommonCheckUtil | Class | Address common check utility — provides address validation functions including ad61MojiChk |
| ad61MojiChk | Method | Validates Japanese address data against the 61-character standard format |
| `getNullToStr` | Method | Null-safe wrapper that converts null or blank strings to empty string |
| `executeZM_M_AD_KK_SELECT_012` | Method | Private helper that executes the KK_SELECT_012 SQL define on the ZM_M_AD table |
| JBSbatCommonDBInterface | Class | Database interface object used for constructing SQL parameter sets and result sets |
| JBSbatServiceInterfaceMap | Class | Input communication document interface for passing data into batch services |
| JBSbatBusinessService | Class | Abstract base class for batch business services providing common initialization and routing |
| Batch | Context | This method operates in the K-Opticom batch processing layer (koptBatch), which handles bulk address data processing |
| 住所統廃合処理 | Japanese term | Address Union/Dismantling Processing — the overall business process of harmonizing address data following municipal mergers or address reorganization |
| 変更対象住所一覧ワーク | Japanese term | Change Target Address List Work — the work order table (KK_T_CHG_AD_JGRTWK) holding address changes that need to be propagated |
| 問合客 | Japanese term | Customer Consultation Customer — a customer who has been flagged for consultation, requiring address updates in the PROSCST table |
| 予備機器配送 | Japanese term | Spare Equipment Delivery — logistics for delivering backup/alternate telecom equipment, tracked in the YBKIKI_HAISO table |
| 先行設計 | Japanese term | Prior Planning / Preliminary Design — the pre-installation planning stage where installation site addresses are recorded in the SENKO_DSGN table |
