# Business Logic - JKKAdInfChgCC.setplaceAdUpd() [1879 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | com.fujitsu.futurity.bp.custom.common.JKKAdInfChgCC |
| Layer | CC / Common Component (Shared business logic component) |
| Module | common (Package: com.fujitsu.futurity.bp.custom.common) |

## 1. Role

### JKKAdInfChgCC.setplaceAdUpd()

This method performs the **Service Location Address Change** processing (利用場所住所変更処理) for the K-Opticom eo customer core system. It is the central orchestrator for updating addresses associated with customer service contracts when a customer changes their usage location address. The method iterates over a list of service location addresses to update, performing a multi-step workflow for each line item: first checking for conflicts with existing moving-line (transferred) data, then querying current address details, updating the address fields, handling related emergency address changes, and finally registering the migration.

The method handles **three service types** based on the `updateNaiyo` (update content) parameter: addresses-only updates (when not just phone or name), phone-only updates, and name-only updates. For address and phone updates, it routes through additional processing branches for equipment provision services (home device management system linkage) and emergency address synchronization.

It implements the **router/dispatch pattern** by branching on the `updateNaiyo` code (UPDATE_ALL, UPDATE_AD, UPDATE_TEL, UPDATE_NM, UPDATE_AD_TEL) to determine which data fields to process, and the **builder pattern** for constructing progress supplement edit text (`prg_tkjk`, `prg_tkjk2`) that records before/after changes for display to the operator. As a shared utility component, this method is called by multiple screen CBS (Custom Business Services) across the address change workflow.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setplaceAdUpd param, fixedText"])
    PREP["Initialize: condMap, paramMap, setplace_list"]
    MAPPER["Get JKKAdInfChgMapperCC, ServiceComponentRequestInvoker"]
    LOOP{"while setplace_list has next?"}
    EXTRACT["Extract keiyakuNo, kaisenUchiwakeNo from cur_setplace"]
    ITENS{"Check moving line via EKK2091B001"}
    SKIP["itensFlg=true, continue"]
    UPD_CHK{"updateSvcKeiKaisenUchwkNoMap contains kaisenUchiwakeNo?"}
    UPD_MAP["Update time maps, isUpdatedFlg=true"]
    E0251["EKK0251A010: Get service contract line item"]
    UPD_NAIYO{"updateNaiyo != UPDATE_TEL && != UPDATE_NM?"}
    VAL_SKS["Validate billing room number (FUNC_CODE_2)"]
    SET_FLG["Set KSH_AD_SAI_FLG, AD_CD"]
    CMP_PCD["Compare old/new postal code"]
    CMP_CITY["Compare old/new city name"]
    CMP_ADDR["Compare all address fields"]
    AD_FLG["AdChangeFlg=true, build prg_tkjk"]
    UPD_ALL_ADDR["Set all address fields in map"]
    UPD_TEL["Set KAISEN_PLACE_TELNO"]
    UPD_MI["Set MI_FIX, KKK_SEIRI, HSK_MEMO"]
    CHK_LVL["Set KISN_AD_CHK_LV=1"]
    SET_MAN["Set SETPLACE_AD_MAN_INPUT_FLG"]
    GET_NO["executeEKKA0020002_Kaisen for setPlaceNo"]
    UPD_KAISETU["Set KAISEN_PLACE_NO"]
    E0251C["EKK0251C030: Update service contract line item"]
    E040_LOOP{"emg_list has next?"}
    EMG_CHK{"matches svc_kei_no, svc_cd=TEL, not ignored?"}
    E0161["EKK0161A010: Get service contract details"]
    E0191["EKK0191A010: Get eo light phone contract"]
    SET_EMG["Set emergency address fields"]
    E0191C["EKK0191C060: Update eo light phone contract"]
    SOD["SOD issuance for emergency address change"]
    BWK["ETU0011B010/A010/C010: Bango work update"]
    E0081["EKK0081A010: Get service contract agreement"]
    KK_CHK{"prcGrpCd not mobile broadband?"}
    KK_LOOP{"kikilist has items?"}
    E0341["EKK0341A010: Get equipment provision service"]
    STAT_CHK{"KKTK status in allowed list?"}
    MAP_ADDR["Map place address to equipment address"]
    B007["EKK0081B007: Get contract number from line item"]
    SEL_DEV["Select kiki_svc_kei_no by device type"]
    CHG["chgIdodiv_EKK0341C200: Update equipment service"]
    TRIM["Trim prg_tkjk/prg_tkjk2 (max 256 chars)"]
    PRG_020["Set PRG_STAT = CD00647_E020"]
    E1091["EKK1091D010: Register migration (place address change)"]
    FIX_CHK{"SETPLACE_AD_MI_FIX == 1?"}
    REG["regPrg: Register process schema 1921"]
    UPD_GUIDE["Update guide_shs_list with update timestamp"]
    END(["return"])
    CATCH["Catch -> throw CCException"]

    START --> PREP --> MAPPER --> LOOP
    LOOP --> EXTRACT --> ITENS
    ITENS --> SKIP --> LOOP
    ITENS --> UPD_CHK
    UPD_CHK --> UPD_MAP --> E0251
    UPD_CHK --> E0251
    E0251 --> UPD_NAIYO
    UPD_NAIYO --> VAL_SKS --> SET_FLG --> CMP_PCD --> CMP_CITY --> CMP_ADDR
    CMP_ADDR --> AD_FLG --> UPD_ALL_ADDR --> UPD_TEL --> UPD_MI --> CHK_LVL --> SET_MAN --> GET_NO --> UPD_KAISETU --> E0251C
    E0251C --> E040_LOOP
    E040_LOOP --> EMG_CHK --> E0161 --> E0191 --> SET_EMG --> E0191C --> SOD --> BWK --> E0081
    E0081 --> KK_CHK --> KK_LOOP
    KK_LOOP --> E0341 --> STAT_CHK --> MAP_ADDR --> B007 --> SEL_DEV --> CHG --> TRIM --> PRG_020 --> E1091
    E1091 --> FIX_CHK --> REG --> UPD_GUIDE --> END
    LOOP --> END

    style START fill:#f9f,stroke:#333
    style END fill:#9f9,stroke:#333
    style CATCH fill:#f99,stroke:#333
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `IRequestParameterReadWrite` | Request parameter holder containing the model group and control map. It carries the setplace address list (PARAM_KEY_SETPLACE_AD_LIST), emergency address list (PARAM_KEY_EMG_LIST), update content code (PARAM_KEY_UPDATE_NAIYO), operation date (PARAM_KEY_OPE_DATE), migration division (PARAM_KEY_IDO_DIV), and function code (PARAM_KEY_FUNC_CD). |
| 2 | `fixedText` | `String` | User-optional string used as a key to retrieve data maps from the request parameter. It serves as the lookup key for `param.getData(fixedText)` to obtain the HashMap containing all business data for this processing session. |

### External State Read

| Field | Type | Business Description |
|-------|------|---------------------|
| `keepSesHandle` | `ThreadLocal<Handle>` | Session handle maintained across SC (Service Component) calls for database transaction management |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JKKAdInfChgMapperCC.setEKK2091B001` | EKK2091B001 | KK_T_KISN_PLACE_AD (查询) | Query existing address records to check for moving-line (転居先) specification conflicts |
| R | `JKKAdInfChgMapperCC.setEKK0251A010` | EKK0251A010 | KK_T_SVC_KEI_KAIS_UCWK | Service contract line item inquiry - get current address and related data for the target line |
| R | `JKKAdInfChgMapperCC.setEKK0081A010` | EKK0081A010 | KK_T_SVC_KEI | Service contract agreement inquiry - retrieve contract status (SVC_KEI_STAT) and migration division |
| R | `JKKAdInfChgMapperCC.setEKK0081B007` | EKK0081B007 | KK_T_SVC_KEI_KAIS_UCWK | Get contract number from service contract line item number (for equipment provision routing) |
| R | `JKKAdInfChgMapperCC.setEKK1091B001` | EKK1091B001 | KK_T_IDO (migration) | Migration master list inquiry - obtain migration datetime when service contract status is accepted (010) |
| R | `JKKAdInfChgMapperCC.setEKK0161A010` | EKK0161A010 | KK_T_SVC_KEI_UCWK | Service contract details inquiry - get current service contract line item data for emergency address update |
| R | `JKKAdInfChgMapperCC.setEKK0191A010` | EKK0191A010 | KK_T_SVC_KEI_UCWK (eo光電話) | eo light phone contract inquiry - get current eo light phone service contract data |
| R | `JKKAdInfChgMapperCC.setEKK0341B504` | EKK0341B504 | KK_T_KKTK_SVC_KEI | Equipment provision service contract list inquiry (by service contract line item number) |
| R | `JKKAdInfChgMapperCC.setEKK0341A010` | EKK0341A010 | KK_T_KKTK_SVC_KEI | Equipment provision service contract agreement inquiry |
| R | `JKKAdInfChgMapperCC.setETU0011B010` | ETU0011B010 | KK_T_BANGO_KOJI (番地工事) | Bango (land parcel) work list inquiry |
| R | `JKKAdInfChgMapperCC.setETU0011A010` | ETU0011A010 | KK_T_BANGO_KOJI_DETAIL | Bango work agreement inquiry |
| U | `JKKAdInfChgMapperCC.setEKK0251C030` | EKK0251C030 | KK_T_SVC_KEI_KAIS_UCWK | Service contract line item content update |
| U | `JKKAdInfChgMapperCC.setEKK0191C060` | EKK0191C060 | KK_T_SVC_KEI_UCWK (eo光電話) | eo light phone service contract content update |
| U | `JKKAdInfChgMapperCC.setETU0011C010` | ETU0011C010 | KK_T_BANGO_KOJI | Bango work content update |
| U | `JKKAdInfChgCC.chgIdodiv_EKK0341C200` | EKK0341C200 | KK_T_KKTK_SVC_KEI | Equipment provision service contract update (home device management system linkage) |
| C | `JKKAdInfChgCC.hakkoSod` | SOD | SOD entity | Issue Service Order Data (SOD) for emergency address change |
| C | `JKKAdInfChgMapperCC.setEKK1091D010` | EKK1091D010 | KK_T_IDO (migration registration) | Register migration (migration registration for service location address change) |
| R | `JKKAdInfChgCC.getIdoRsnList` | - | - | Get migration reason list from request parameters |
| - | `JKKAdInfChgCC.regPrg` | PRG | PRG process schema | Register process schema for unfixed registration complete status |

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 method.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS: JKKAdInfChgCC | `JKKAdInfChgCC.setplaceAdUpd` (called at line 341) | `setEKK1091D010 [C] KK_T_IDO`, `setEKK0251C030 [U] KK_T_SVC_KEI_KAIS_UCWK`, `setEKK0191C060 [U] KK_T_SVC_KEI_UCWK`, `chgIdodiv_EKK0341C200 [U] KK_T_KKTK_SVC_KEI`, `hakkoSod [C] SOD`, `setETU0011C010 [U] KK_T_BANGO_KOJI` |

### Terminal operations from this method:

- `getMapString` [R] - internal utility for map access
- `regPrg` [C] - register process schema (CD00647_1921)
- `scResultCheck` [-] - validate SC execution result
- `getEKK1091B001` [R] - migration master list inquiry
- `run` [-] - ServiceComponentRequestInvoker.execute
- `setEKK1091D010` [C] - migration registration
- `getIdoRsnList` [R] - get migration reason list
- `getSysDateTimeStamp` [R] - system datetime retrieval (JCCBatCommon, JCCBPCommon)
- `getEKK1091B001` [R] - migration datetime query
- `run` [-] - SC invoker execution (multiple targets)

## 6. Per-Branch Detail Blocks

**Block 1** — INITIALIZATION (L2177)

> Prepare the working environment. Initialize maps, error flag holders, and retrieve the core component instances.

| # | Type | Code |
|---|------|------|
| 1 | SET | `condMap = new HashMap<>()` // Condition map reused for all SC queries |
| 2 | SET | `paramMap = (HashMap)param.getData(fixedText)` // Business data container |
| 3 | SET | `paramMap.put(PARAM_KEY_SKS_ADRRM_ERR_HT, "0")` // Initialize billing room number error flag (home type) |
| 4 | SET | `paramMap.put(PARAM_KEY_SKS_ADRRM_ERR_MT_NULL, "0")` // Initialize billing room number error flag (mansion type) |
| 5 | SET | `mapper = JKKAdInfChgMapperCC.getInstance()` // Get mapper component |
| 6 | SET | `scCall = new ServiceComponentRequestInvoker()` // SC request invoker |
| 7 | SET | `setplace_list = (ArrayList)paramMap.get(PARAM_KEY_SETPLACE_AD_LIST)` // Extract setplace address list |
| 8 | SET | `setplace_list_ite = setplace_list.iterator()` // Iterator for processing loop |
| 9 | SET | `updateSvcKeiKaisenUchwkNoMap = new HashMap<>()` // Completed line item update timestamp map |
| 10 | SET | `updateSvcKeiNoMap = new HashMap<>()` // Completed contract number update timestamp map |

**Block 2** — [WHILE LOOP] `(setplace_list_ite.hasNext())` (L2192)

> Iterate over each service location address in the setplace list.

| # | Type | Code |
|---|------|------|
| 1 | SET | `cur_setplace = setplace_list_ite.next()` // Current setplace record |
| 2 | SET | `keiyakuNo = (String)cur_setplace.get(PARAM_KEY_SETPLACE_AD_SVC_KEI_NO)` // Service contract number |
| 3 | SET | `kaisenUchiwakeNo = (String)cur_setplace.get(PARAM_KEY_SETPLACE_AD_SVC_KEI_KAISEN_UCWK_NO)` // Service contract line item number |
| 4 | SET | `prg_tkjk = ""` // Progress supplement edit text (before-change) |
| 5 | SET | `prg_tkjk2 = ""` // Progress supplement edit text (after-change) |

**Block 2.1** — [IF] Moving-line check via EKK2091B001 (L2210)

> Check if the current line item is a specified moving-line (転居先指定). If so, verify its ADCHG_STAT.

| # | Type | Code |
|---|------|------|
| 1 | SET | `itensFlg = false` // Moving-line judgment flag |
| 2 | EXEC | `condMap.put(KEY_ITENS_SVKEI_KISUW_NO, kaisenUchiwakeNo)` // Set query condition |
| 3 | CALL | `mapper.setEKK2091B001(param, fixedText, condMap)` // SC request setup |
| 4 | CALL | `scCall.run(reqMap, keepSesHandle.get())` // Execute SC |
| 5 | CALL | `kk2091_b001_list_Itns = mapper.getEKK2091B001(param, fixedText, resMap)` // Get results |
| 6 | CALL | `mapper.scResultCheck(param)` // Check SC result |

**Block 2.1.1** — [FOR LOOP] Over kk2091_b001_list_Itns (L2228)

> Check each moving-line record's ADCHG_STAT field.

| # | Type | Code |
|---|------|------|
| 1 | SET | `adchgStat = (String)kk2091_b001_map.get(ADCHG_STAT)` // Address change status |
| 2 | IF | `"001".equals(adchgStat)` // Address change in progress |
| 3 | SET | `itensFlg = true` // Skip this line item |

**Block 2.1.2** — [IF] `itensFlg == true` (L2243)

> If any moving-line record is "in progress," skip all subsequent processing for this setplace.

| # | Type | Code |
|---|------|------|
| 1 | SET | `continue` // Skip to next iteration |

**Block 2.2** — [IF] Previously updated line check (L2252)

> If the current line item was already updated in a previous iteration, update time maps and set isUpdatedFlg.

| # | Type | Code |
|---|------|------|
| 1 | IF | `updateSvcKeiKaisenUchwkNoMap.containsKey(kaisenUchiwakeNo)` |
| 2 | IF | `!updateSvcKeiNoMap.containsKey(keiyakuNo)` |
| 3 | SET | `updateSvcKeiNoMap.put(keiyakuNo, updateSvcKeiKaisenUchwkNoMap.get(kaisenUchiwakeNo))` |
| 4 | SET | `isUpdatedFlg = true` // Line item already updated |

**Block 2.3** — [IF] `!isUpdatedFlg` — Main address update branch (L2265)

> Only process when the line item has NOT been previously updated. Query current data via EKK0251A010.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setplace_svc_kei_no = (String)cur_setplace.get(PARAM_KEY_SETPLACE_AD_SVC_KEI_NO)` |
| 2 | SET | `setplace_svc_cd = (String)cur_setplace.get(PARAM_KEY_SETPLACE_AD_SVC_CD)` // Service code |
| 3 | SET | `updateNaiyo = (String)paramMap.get(PARAM_KEY_UPDATE_NAIYO)` // Update content code |
| 4 | SET | `condMap.put(COND_KEY_SVC_KEI_KAIS_UCWK_NO, kaisenUchiwakeNo)` |
| 5 | SET | `condMap.put(COND_KEY_OPEDATE, opeDate)` |
| 6 | CALL | `mapper.setEKK0251A010(param, fixedText, condMap)` // Query line item data |
| 7 | CALL | `scCall.run(reqMap, keepSesHandle.get())` |
| 8 | CALL | `kk0251_a010_map = mapper.getEKK0251A010(param, fixedText, resMap)` |
| 9 | CALL | `mapper.scResultCheck(param)` |

**Block 2.3.1** — [IF] `updateNaiyo != UPDATE_TEL && != UPDATE_NM` (L2290)

> When update content is not phone-only or name-only, process address-specific fields.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!JKKAdInfChgConstCC.UPDATE_TEL.equals(updateNaiyo) && !JKKAdInfChgConstCC.UPDATE_NM.equals(updateNaiyo)` |

**Block 2.3.1.1** — Billing Room Number Validation (FUNC_CODE_2) (L2295)

> For CHECK-ONLY mode (FUNC_CODE_2="2"), validate billing room number requirements by line type.

| # | Type | Code |
|---|------|------|
| 1 | SET | `funcCd = getMapString(paramData, PARAM_KEY_FUNC_CD)` |
| 2 | IF | `FUNC_CODE_2.equals(funcCd)` |
| 3 | SET | `getKaisenCd = kk0251_a010_map.get(KAISEN_CD)` // Line code |
| 4 | SET | `sks_adrrm = cur_setplace.get(PARAM_KEY_SETPLACE_SKS_ADRRM)` // Billing room number |
| 5 | IF | `"1001".equals(getKaisenCd) && sks_adrrm.length() > 0` // FTTH line with room number |
| 6 | SET | `paramMap.put(PARAM_KEY_SKS_ADRRM_ERR_HT, "1")` // Error: home type has room number set |
| 7 | IF | `("1002"||"1003"||"1004"||"1005").equals(getKaisenCd) && sks_adrrm.length() == 0` // VDSL/Isenet/PD/DOCSIS without room number |
| 8 | SET | `paramMap.put(PARAM_KEY_SKS_ADRRM_ERR_MT_NULL, "1")` // Error: mansion type missing room number |

**Block 2.3.1.2** — Address Change Detection and Progress Supplement Build (L2325)

> For each address field, compare old (DB) vs new (setplace) values. If changed, build progress supplement text in format: `固定文言(変更前〇〇:) + 変更前DB値 + 固定文言(、)`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `AdChangeFlg = false` // Address change flag |
| 2 | SET | `kk0251_a010_map.put(KAISEN_PLACE_AD_CD, cur_setplace.get(PARAM_KEY_SETPLACE_AD_AD_CD))` |
| 3 | IF | Postal code comparison (4 branches: both null, old null, new null, different) |
| 4 | SET | `prg_tkjk = prg_tkjk + PCG_RIYOBASHO_PCD_TEXT + oldVal + PCG_KUTEN_CANMA` // Before-change text |
| 5 | SET | `prg_tkjk2 = prg_tkjk2 + PCG_RIYOBASHO_PCD_TEXT_AF + newVal + PCG_KUTEN_CANMA` // After-change text |
| 6 | IF | City name comparison (same 4-branch pattern) |
| 7 | IF | Oozutsu (district) comparison |
| 8 | IF | Azacho (town) comparison |
| 9 | IF | Banchi-go (lot number) comparison |
| 10 | IF | Adrttm (building name) comparison |
| 11 | IF | Adrrm (room number) comparison |
| 12 | IF | `AdChangeFlg == true` → Build full address text with all fields concatenated |
| 13 | SET | Update all address fields in kk0251_a010_map with new values from cur_setplace |

**Block 2.3.1.3** — Unfixed Registration and Administrative Flags (L2449)

> Handle the unfixed flag (MI_FIX), district consolidation flag (KKK_SEIRI_CHU_FLG), and memo fields.

| # | Type | Code |
|---|------|------|
| 1 | IF | KISN_PLC_AD_MI_FIX_FLG comparison (null/empty/old/new/different) |
| 2 | SET | Build prg_tkjk with appropriate text: "変更前○:", "未定", "固定", etc. |
| 3 | SET | `kk0251_a010_map.put(KISN_PLC_AD_MI_FIX_FLG, cur_setplace.get(PARAM_KEY_SETPLACE_AD_MI_FIX))` |
| 4 | IF | KISN_PLC_KKK_SEIRI_CHU_FLG comparison |
| 5 | SET | Build prg_tkjk with "区画整理中:有/無" text |
| 6 | SET | `kk0251_a010_map.put(KISN_PLC_KKK_SEIRI_CHU_FLG, cur_setplace.get(PARAM_KEY_SETPLACE_AD_KKK_SEIRI))` |
| 7 | IF | KISN_PLC_HSK_MEMO comparison |
| 8 | SET | Build prg_tkjk with memo change text |
| 9 | SET | `kk0251_a010_map.put(KISN_PLC_HSK_MEMO, cur_setplace.get(PARAM_KEY_SETPLACE_AD_MEMO))` |

**Block 2.3.1.4** — Check Level and Additional Fields (L2521)

| # | Type | Code |
|---|------|------|
| 1 | SET | `kk0251_a010_map.put(KISN_AD_CHK_LV, "1")` // Validation check level |
| 2 | IF | SKS_YO_KISN_PLACE_AD_RM_NO (billing room number) comparison |
| 3 | SET | prg_tkjk + prg_tkjk2 with billing room number change text |
| 4 | SET | `kk0251_a010_map.put(SKS_YO_KISN_PLACE_AD_RM_NO, cur_setplace.get(PARAM_KEY_SETPLACE_SKS_ADRRM))` |

**Block 2.3.1.5** — Phone Number Update (L2556)

| # | Type | Code |
|---|------|------|
| 1 | IF | `updateNaiyo != UPDATE_TEL && != UPDATE_NM` |
| 2 | IF | KAISEN_PLACE_TELNO comparison (3 branches) |
| 3 | SET | prg_tkjk + prg_tkjk2 with phone number change text |
| 4 | SET | `kk0251_a010_map.put(KAISEN_PLACE_TELNO, cur_setplace.get(PARAM_KEY_SETPLACE_AD_TELNO))` |

**Block 2.3.1.6** — MSKM Detail Number and Set Place Number (L2583)

| # | Type | Code |
|---|------|------|
| 1 | IF | `!StringUtils.isEmpty(mskmDtlNo)` |
| 2 | SET | `kk0251_a010_map.put(MSKM_DTL_NO, mskmDtlNo)` |
| 3 | SET | `kk0251_a010_map.put(UPD_DT_KEI_KAIS_UCWK_UPD_DTM_BEF, kk0251_a010_map.get(LAST_UPD_DTM))` |
| 4 | SET | `kk0251_a010_map.put(KEY_SETPLACE_AD_MAN_INPUT_FLG, getMapString(cur_setplace, PARAM_KEY_SETPLACE_AD_MAN_INPUT_FLG))` |
| 5 | SET | `setPlaceNo = executeEKKA0020002_Kaisen(param, fixedText, kk0251_a010_map)` |
| 6 | IF | `!StringUtils.isEmpty(setPlaceNo)` |
| 7 | SET | `kk0251_a010_map.put(KAISEN_PLACE_NO, setPlaceNo)` |

**Block 2.3.1.7** — Execute EKK0251C030 (L2597)

> Update the service contract line item content via SC.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setEKK0251C030(param, fixedText, kk0251_a010_map)` |
| 2 | CALL | `scCall.run(reqMap, keepSesHandle.get())` |
| 3 | CALL | `kk0251_c030_map = mapper.getEKK0251C030(param, fixedText, resMap)` |
| 4 | CALL | `mapper.scResultCheck(param)` |
| 5 | SET | `updateSvcKeiKaisenUchwkNoMap.put(kaisenUchiwakeNo, kk0251_c030_map.get(UPD_DTM))` |
| 6 | SET | `updateSvcKeiNoMap.put(keiyakuNo, updateSvcKeiKaisenUchwkNoMap.get(kaisenUchiwakeNo))` |
| 7 | SET | `cur_setplace.put(PARAM_KEY_SETPLACE_AD_UPD_DTM_AF, kk0251_c030_map.get(UPD_DTM))` |
| 8 | SET | `ad_chk_lv_res = paramMap.get(KISN_AD_CHK_LV_ERR)` |
| 9 | SET | `paramMap.put("ad_chk_lv_res", ad_chk_lv_res)` |

**Block 2.4** — [IF] Emergency address change loop (L2618)

> Only when `updateNaiyo != UPDATE_TEL && != UPDATE_NM`. Process emergency address records.

| # | Type | Code |
|---|------|------|
| 1 | SET | `emg_list = (ArrayList)cur_setplace.get(PARAM_KEY_EMG_LIST)` // Emergency address list |
| 2 | SET | `ignoreUcwkList = getIgnoreUcwkList(param, fixedText, kaisenUchiwakeNo)` |
| 3 | SET | `emg_list_ite = emg_list.iterator()` |
| 4 | SET | `prg_tkjk_e040 = ""` // Progress supplement for E040 emergency change |
| 5 | SET | `prg_tkjk2_e040 = ""` |

**Block 2.4.1** — [WHILE LOOP] Over emg_list (L2627)

| # | Type | Code |
|---|------|------|
| 1 | SET | `cur_emg = emg_list_ite.next()` |
| 2 | IF | `!setplace_svc_kei_no.equals(cur_emg.get(PARAM_KEY_EMG_SVC_KEI_NO))` → `continue` |
| 3 | IF | `!SVC_CD_TEL.equals(setplace_svc_cd)` → `continue` |
| 4 | IF | `ignoreUcwkList.contains(cur_emg.get(PARAM_KEY_EMG_SVC_KEI_UCWK_NO))` → `continue` |

**Block 2.4.2** — EKK0161A010 and EKK0191A010 Queries (L2647)

| # | Type | Code |
|---|------|------|
| 1 | SET | `condMap.put(COND_KEY_SVC_KEI_UCWK_NO, emgSvcKeiUcwkNo)` |
| 2 | SET | `condMap.put(COND_KEY_OPEDATE, opeDate)` |
| 3 | CALL | `mapper.setEKK0161A010(param, fixedText, condMap)` // Service contract details |
| 4 | CALL | `scCall.run(reqMap, keepSesHandle.get())` |
| 5 | CALL | `kk0161_a010_map = mapper.getEKK0161A010(param, fixedText, resMap)` |
| 6 | CALL | `mapper.scResultCheck(param)` |
| 7 | CALL | `mapper.setEKK0191A010(...)` // eo light phone contract details |
| 8 | CALL | `scCall.run(reqMap, keepSesHandle.get())` |
| 9 | CALL | `kk0191_a010_map = mapper.getEKK0191A010(param, fixedText, resMap)` |
| 10 | CALL | `mapper.scResultCheck(param)` |
| 11 | SET | `chbfSvcKeiUcwkGeneAddDtm = kk0191_a010_map.get(GENE_ADD_DTM)` // Pre-update registration datetime for SOD |

**Block 2.4.3** — Emergency Address Field Updates (L2663)

> Similar to main address change: compare old vs new values, build progress supplement text, set changed flags.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kk0161_a010_map.put(RSV_APLY_YMD, opeDate)` |
| 2 | SET | `kk0161_a010_map.put(IDO_DIV, paramMap.get(PARAM_KEY_IDO_DIV))` |
| 3 | SET | `kk0161_a010_map.put(MSKM_DTL_NO, mskmDtlNo)` (conditional on SVC_KEI_STAT != 010) |
| 4 | SET | `kk0191_a010_map.put(EMG_AD_CD, cur_emg.get(PARAM_KEY_EMG_AD_CD))` |
| 5 | IF | EMG_HOSEI_PCD comparison (3 branches) → build prg_tkjk_e040/prg_tkjk2_e040 |
| 6 | SET | `AdChangFlg = true` if any address field differs |
| 7 | IF | Compare EMG_STATE_NM, EMG_CITY_NM, EMG_OAZTSU_NM, EMG_AZCHO_NM, EMG_BNCHIGO, EMG_ADRTTM, EMG_ADRRM (each with 3-4 branches) |
| 8 | IF | `AdChangFlg == true` → Build full address text in prg_tkjk_e040/prg_tkjk2_e040 |
| 9 | SET | Update all EMG_* fields in kk0191_a010_map |
| 10 | SET | `kk0191_a010_map.put(NTT_KSH_AD_KSH_AD_SAI_FLG, getKshAdSaiFlg(paramMap))` |
| 11 | SET | `kk0191_a010_map.put(EMG_AD_CHK_LV, "1")` |

**Block 2.4.4** — Execute EKK0191C060 (L2789)

> Update the eo light phone service contract.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setEKK0191C060(param, fixedText, kk0161_a010_map, kk0191_a010_map)` |
| 2 | CALL | `scCall.run(reqMap, keepSesHandle.get())` |
| 3 | CALL | `kk0191_c060_map = mapper.getEKK0191C060(param, fixedText, resMap)` |
| 4 | CALL | `mapper.scResultCheck(param)` |
| 5 | SET | `cur_emg.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 | `chafSvcKeiUcwkGeneAddDtm = kk0191_c060_map.get(KK0161_GENE_ADD_DTM)` |

**Block 2.4.5** — Trim and Finalize Progress Supplement Text (L2813)

| # | Type | Code |
|---|------|------|
| 1 | SET | `prg_tkjk_length = prg_tkjk_e040.length()` |
| 2 | IF | `prg_tkjk_e040 != null && !empty && length > 0` → strip trailing delimiter |
| 3 | IF | `length - 1 > PRG_TKJK_MAX_VALUE (128)` → truncate to 128 chars |
| 4 | (repeat for prg_tkjk2_e040) |

**Block 2.4.6** — Service Contract Agreement + Migration Registration (E040) (L2831)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setEKK0081A010(...)` // Service contract agreement |
| 2 | CALL | `scCall.run(...)` |
| 3 | CALL | `kk0081_a010_map = mapper.getEKK0081A010(...)` |
| 4 | SET | `svcKeiStat = kk0081_a010_map.get(SVC_KEI_STAT)` |
| 5 | SET | `idoDiv = kk0081_a010_map.get(IDO_DIV)` |
| 6 | IF | `JKKSvcConst.SVC_KEI_STAT_010.equals(svcKeiStat)` → call EKK1091B001 for migration datetime |
| 7 | SET | `parent_map.put(SVC_KEI_NO, setplace_svc_kei_no)` |
| 8 | SET | `parent_map.put(SVC_KEI_UCWK_NO, cur_emg.get(PARAM_KEY_EMG_SVC_KEI_UCWK_NO))` |
| 9 | IF | `SVC_KEI_STAT_010.equals(svcKeiStat)` → `parent_map.put(IDO_DIV, idoDiv), (IDO_DTM, idoDtm)` |
| 10 | ELSE → `parent_map.put(IDO_DIV, PARAM_KEY_IDO_DIV), (IDO_DTM, JCCBPCommon.getSysDateTimeStamp())` |
| 11 | SET | `parent_map.put(PRG_STAT, CD00647_E040)` // Progress status = E040 (emergency address change) |
| 12 | SET | `parent_map.put(PRG_TKJK_1, prg_tkjk_e040)` |
| 13 | SET | `parent_map.put(PRG_TKJK_2, prg_tkjk2_e040)` |
| 14 | IF | `!StringUtils.isEmpty(mskmDtlNo)` → `parent_map.put(MSKM_DTL_NO, mskmDtlNo)` |
| 15 | CALL | `mapper.setEKK1091D010(param, fixedText, parent_map, getIdoRsnList(...))` // Migration registration |
| 16 | CALL | `scCall.run(reqMap, keepSesHandle.get())` |
| 17 | CALL | `mapper.getEKK1091D010(...)` |
| 18 | CALL | `mapper.scResultCheck(param)` |
| 19 | CALL | `hakkoSod(param, paramMap, cur_emg, chbfSvcKeiUcwkGeneAddDtm, chafSvcKeiUcwkGeneAddDtm)` // SOD issuance |

**Block 2.4.7** — Bango Work Agreement Processing (L2888)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setETU0011B010(...)` // Bango work list |
| 2 | CALL | `scCall.run(...)` |
| 3 | CALL | `tu0011_b010_list = mapper.getETU0011B010(...)` |
| 4 | CALL | `mapper.scResultCheck(param)` |
| 5 | FOR | `for (tu0011_b010_map : tu0011_b010_list)` |
| 6 | IF | `bmpKojiStat != "000" && "010" && "011" && "021"` → `continue` |
| 7 | CALL | `mapper.setETU0011A010(...)` // Bango work agreement |
| 8 | CALL | `scCall.run(...)` |
| 9 | CALL | `tu0011_a010_map = mapper.getETU0011A010(...)` |
| 10 | IF | `PAUSE_HYO_SOHUS_CD != "3"` → `continue` |
| 11 | IF | `itnmTsjgsCd == NTT && dobanitenUm == ARI` → update KANYKN_ITENS_* fields |
| 12 | SET | `tu0011_a010_map.put(KNKN_ITNSAD_MAN_INPUT_FLG, "0")` |
| 13 | SET | Map cur_setplace (new) address to KANYKN_ITENS_* fields |
| 14 | SET | `tu0011_a010_map.put(UPD_DTM_BF, tu0011_b010_map.get(UPD_DTM))` |
| 15 | CALL | `mapper.setETU0011C010(param, fixedText, tu0011_a010_map)` // Bango work content update |
| 16 | CALL | `scCall.run(...)` |
| 17 | CALL | `mapper.getETU0011C010(...)` |
| 18 | CALL | `mapper.scResultCheck(param)` |

**Block 2.5** — [IF] Equipment provision service update (L2978)

> Only when `updateNaiyo != UPDATE_TEL && != UPDATE_NM`. Check if prcGrpCd is NOT mobile broadband (PRC_GRP_CD_07/08/09/16).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setEKK0081A010(...)` // Service contract agreement |
| 2 | SET | `prcGrpCd = kk0081_a010_map.get(PRC_GRP_CD)` |
| 2 | IF | `!PRC_GRP_CD_07 && !PRC_GRP_CD_08 && !PRC_GRP_CD_09 && !PRC_GRP_CD_16` |

**Block 2.5.1** — Equipment Line Item Loop (L3046)

> Query equipment provision service contracts by line item number.

| # | Type | Code |
|---|------|------|
| 1 | SET | `work_kaisen_ucwk_cd = getMapString(cur_setplace, PARAM_KEY_SETPLACE_AD_SVC_KEI_KAISEN_UCWK_NO)` |
| 2 | CALL | `mapper.setEKK0341B504(param, fixedText, condMap)` // Equipment provision service list |
| 3 | CALL | `scCall.run(...)` |
| 4 | CALL | `kk341_b504_lst = mapper.getEKK0341B504(...)` |
| 5 | CALL | `mapper.scResultCheck(param)` |
| 6 | FOR | `for (cur_kikiTk_list : kk341_b504_lst)` |
| 7 | SET | `kktkSvcKeiNo = getMapString(cur_kikiTk_list, KKTK_SVC_KEI_NO)` |
| 8 | CALL | `mapper.setEKK0341A010(param, fixedText, condMap)` // Equipment contract agreement |
| 9 | CALL | `scCall.run(...)` |
| 10 | CALL | `kk341_a010_map = mapper.getEKK0341A010(...)` |
| 11 | CALL | `mapper.scResultCheck(param)` |
| 12 | SET | `tgtStatList = [010, 020, 030, 100, 110, 210, 220]` // Allowed KKTK statuses |
| 13 | IF | `KKTK_SVC_KEI_STAT in tgtStatList` → continue |
| 14 | SET | Map all address fields from cur_setplace to kk341_a010_map |
| 15 | SET | `kk341_a010_map.put(KIKI_STC_AD_CHK_LV, "1")` |
| 16 | SET | `kk341_a010_map.put(UPD_DT_KKTK_SVC_KEI_UPD_DTM_BEF, kk341_a010_map.get(UPD_DTM))` |
| 17 | IF | `UPDATE_ALL || UPDATE_AD_TEL` → set KIKI_STC_SK_TELNO |
| 18 | SET | `kk341_a010_map.put(AD_MI_FIX_FLG, cur_setplace.get(PARAM_KEY_SETPLACE_AD_MI_FIX))` |
| 19 | CALL | `EKK0081B007` to get svc_kei_no from kaisen_ucwk_cd |
| 20 | SET | Select `kiki_svc_kei_no` by device type (E0=TV→03, 60/70/90/D0/R0/S0=NET→01) |
| 21 | CALL | `chgIdodiv_EKK0341C200(param, fixedText, kk341_a010_map, kiki_svc_kei_no)` |

**Block 2.5.2** — Equipment Service by Contract Number (L3183)

> Query equipment provision services by contract number (not line item number).

| # | Type | Code |
|---|------|------|
| 1 | SET | `kiki_svc_kei_no = cur_kikisetplace.get(PARAM_KEY_SETPLACE_AD_SVC_KEI_NO)` |
| 2 | IF | `!StringUtils.isEmpty(kiki_svc_kei_no)` |
| 3 | CALL | `mapper.setEKK0341B002(param, fixedText, condMap)` // Equipment service list by contract no |
| 4 | CALL | `scCall.run(...)` |
| 5 | CALL | `kk341_b002_lst = mapper.getEKK0341B002(...)` |
| 6 | FOR | `for (cur_kikiTk_list : kk341_b002_lst)` |
| 7-21 | Same pattern as Block 2.5.1 steps 7-21 |

**Block 2.6** — Trim Final Progress Supplement Text (L3243)

| # | Type | Code |
|---|------|------|
| 1 | SET | `prg_tkjk_length = prg_tkjk.length()` |
| 2 | IF | `prg_tkjk != null && !empty && length > 0` → strip trailing delimiter, truncate to 128 chars if > PRG_TKJK_MAX_VALUE |
| 3 | (repeat for prg_tkjk2) |

**Block 2.7** — Main Migration Registration (L3270)

> Register the migration for the service location address change (PRG_STAT = CD00647_E020).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setEKK0081A010(...)` // Service contract agreement |
| 2 | SET | `svcKeiStat = kk0081_a010_map.get(SVC_KEI_STAT)` |
| 3 | SET | `idoDiv = kk0081_a010_map.get(IDO_DIV)` |
| 4 | IF | `JKKSvcConst.SVC_KEI_STAT_010.equals(svcKeiStat)` → call EKK1091B001, get `idoDtm` |
| 5 | SET | `parent_map.put(SVC_KEI_NO, setplace_svc_kei_no)` |
| 6 | SET | `parent_map.put(SVC_KEI_KAISEN_UCWK_NO, cur_setplace.get(PARAM_KEY_SETPLACE_AD_SVC_KEI_KAISEN_UCWK_NO))` |
| 7 | IF | `SVC_KEI_STAT_010.equals(svcKeiStat)` → `(IDO_DIV, idoDiv), (IDO_DTM, idoDtm)` |
| 8 | ELSE → `(IDO_DIV, PARAM_KEY_IDO_DIV), (IDO_DTM, JCCBPCommon.getSysDateTimeStamp())` |
| 9 | SET | `parent_map.put(PRG_STAT, CD00647_E020)` // Progress status = E020 (service location address change) |
| 10 | SET | `parent_map.put(PRG_TKJK_1, prg_tkjk)` |
| 11 | SET | `parent_map.put(PRG_TKJK_2, prg_tkjk2)` |
| 12 | IF | `!StringUtils.isEmpty(mskmDtlNo)` → `parent_map.put(MSKM_DTL_NO, mskmDtlNo)` |
| 13 | CALL | `mapper.setEKK1091D010(param, fixedText, parent_map, getIdoRsnList(...))` // Migration registration |
| 14 | CALL | `scCall.run(reqMap, keepSesHandle.get())` |
| 15 | CALL | `mapper.getEKK1091D010(...)` |
| 16 | CALL | `mapper.scResultCheck(param)` |

**Block 2.8** — Unfixed Registration Complete Process Schema (L3323)

| # | Type | Code |
|---|------|------|
| 1 | IF | `!UPDATE_TEL && !UPDATE_NM` AND `SETPLACE_AD_MI_FIX == "1"` |
| 2 | CALL | `regPrg(param, fixedText, setplace_svc_kei_no, CD00647_1921, null)` // Register schema 1921 |

**Block 2.9** — Update Guide Delivery Address Timestamps (L3340)

> After processing all setplace records, propagate update timestamps to guide delivery address list.

| # | Type | Code |
|---|------|------|
| 1 | IF | `setplace_list.size() < 1` → `return` |
| 2 | SET | `guide_shs_list = (ArrayList)paramMap.get(PARAM_KEY_GUIDE_SHS_AD_LIST)` |
| 3 | FOR | `for (guideMap : guide_shs_list)` |
| 4 | SET | `keiNo = guideMap.get(PARAM_KEY_GUIDE_SHS_AD_SVC_KEI_NO)` |
| 5 | IF | `updateSvcKeiNoMap.containsKey(keiNo)` → `guideMap.put(UPD_DTM_BF, updateSvcKeiNoMap.get(keiNo))` |

**Block 3** — [CATCH] (L3364)

| # | Type | Code |
|---|------|------|
| 1 | CATCH | `Exception ex` |
| 2 | THROW | `throw new CCException(ERR_STR_RESULT_CD, ex.getCause())` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `setplace_ad_list` | Field | Service location address list — array of location records to update, each containing address fields, service contract number, and line item number |
| `svc_kei_no` | Field | Service contract number — unique identifier for a customer service contract |
| `svc_kei_kaisen_ucwk_no` | Field | Service contract line item number — unique identifier for a specific line within a service contract |
| `update_naiyo` | Field | Update content code — determines which fields to process (0=all, 1=address only, 2=phone only, 3=name only, 4=address+phone) |
| `ido_div` | Field | Migration division code — classifies the type of migration (address change, phone change, etc.) |
| `prg_tkjk` | Field | Progress supplement edit text (before-change) — formatted string recording pre-update values for operator display |
| `prg_tkjk2` | Field | Progress supplement edit text (after-change) — formatted string recording post-update values for operator display |
| `prg_tkjk_max_value` | Constant | 128 — maximum character length for progress supplement text (half of 256 screen limit) |
| `itensFlg` | Field | Moving-line judgment flag — true when the line item is a specified transfer destination that is currently "in progress" |
| `adChangeFlg` | Field | Address change flag — true when any address field has changed (postal code, city, town, lot, building, room) |
| `kk0251_a010_map` | Field | Service contract line item inquiry result map containing current DB values and updated fields |
| `kk0191_a010_map` | Field | eo light phone contract inquiry result map containing current emergency address values |
| `kk0161_a010_map` | Field | Service contract details map used for emergency address update |
| `CD00647_E010` | Constant | "E010" — Progress status: Contract address change |
| `CD00647_E020` | Constant | "E020" — Progress status: Service location address change |
| `CD00647_E040` | Constant | "E040" — Progress status: Emergency address change |
| `CD00647_1921` | Constant | "1921" — Progress status: Unfixed registration complete (住所未確定登録完了) |
| `UPDATE_ALL` | Constant | "0" — Update content: All fields |
| `UPDATE_AD` | Constant | "1" — Update content: Address only |
| `UPDATE_TEL` | Constant | "2" — Update content: Phone only |
| `UPDATE_NM` | Constant | "3" — Update content: Name only |
| `UPDATE_AD_TEL` | Constant | "4" — Update content: Address + Phone |
| `FUNC_CODE_1` | Constant | "1" — Function code: Check & Register |
| `FUNC_CODE_2` | Constant | "2" — Function code: Check only |
| `SVC_CD_NET` | Constant | "01" — Service code: Internet service |
| `SVC_CD_TEL` | Constant | "02" — Service code: Telephone service |
| `SVC_CD_TV` | Constant | "03" — Service code: TV service |
| `PRC_GRP_CD_07` | Constant | "07" — Price group: eo Mobile Broadband (Wi-Fi) |
| `PRC_GRP_CD_08` | Constant | "08" — Price group: eo Mobile Broadband (EM) |
| `PRC_GRP_CD_09` | Constant | "09" — Price group: eo Mobile Broadband (UQ-WiMAX) |
| `PRC_GRP_CD_16` | Constant | "16" — Price group: eo Mobile Broadband (Mail Address) |
| `KAISEN_CD` | Field | Line code — "1001"=FTTH (光回線), "1002"=VDSL, "1003"=Isenet, "1004"=PD, "1005"=DOCSIS |
| `KISN_AD_CHK_LV` | Field | Check level — set to "1" for validation during update |
| `SKS_ADRRM_ERR_HT` | Field | Billing room number error flag (home type) — "1" indicates error |
| `SKS_ADRRM_ERR_MT_NULL` | Field | Billing room number error flag (mansion type) — "1" indicates error |
| `KKTK_SVC_KEI_STAT` | Field | Equipment provision service status — "010"(received), "020"(inspected), "030"(contracted), "100"(in service), "110"(change in progress), "210"(suspended/interrupted), "220"(stopped) |
| `RSV_APLY_YMD` | Field | Reservation application date — set to default "20991231" for future reservations |
| `GENE_ADD_DTM` | Field | Generation registration datetime — timestamp used for SOD (Service Order Data) issuance |
| `KK0161_GENE_ADD_DTM` | Field | Updated generation registration datetime — post-update timestamp for SOD |
| `BMP_KOJI_STAT` | Field | Bango work status — "000"(not entered), "010"(requested), "011"(other company confirmed), "021"(adjustment pending) |
| `PAUSE_HYO_SOHUS_CD` | Field | Pause ticket delivery address code — "3" means "send to downstream" |
| `itnmTsjgsCd` | Field | Pre-transfer telecom provider code — "1" = NTT |
| `dobanitenUm` | Field | Same-number transfer presence — "1" (ARI) = has same-number transfer |
| `NTT_KSH_AD_KSH_AD_SAI_FLG` | Field | NTT contract address vs actual address discrepancy flag |
| SOD | Acronym | Service Order Data — telecom service order fulfillment entity issued during address changes |
| SC | Acronym | Service Component — remote service layer called via ServiceComponentRequestInvoker |
| CBS | Acronym | Custom Business Service — screen entry point layer |
| KK | Prefix | K-Opticom entity/table prefix |
| EKK | Prefix | Address/Service contract entity prefix |
| ETU | Prefix | Bango work entity prefix |
| EKKA | Prefix | Equipment provision entity prefix |
| ADCHG_STAT | Field | Address change status — "001" means address change in progress |
| `KEEP_SES_HANDLE` | External | ThreadLocal database session handle maintained for transaction continuity across SC calls |
