# Business Logic — JKKKddiKeishaInfoCC.getKaisenInfoList() [410 LOC]

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

## 1. Role

### JKKKddiKeishaInfoCC.getKaisenInfoList()

This method is the central query orchestration routine for the KDDI line information lookup screen (iTas). Its primary business operation is to identify lines (回線) matching a given set of search conditions — specifically, a SYSID that scopes the service provider's domain, an optional used-address string (`tmp_tnmt_stbsho_jusho`) for address prefix matching, and an optional order/receipt number (`muskm_bngu`) for strict identification. It then constructs and returns a list of line objects that includes not only lines with no address change pending, but also lines in the midst of an address change (住所変更中), enriched with migration-origin and migration-destination identifiers.

The method handles three broad categories of service types by filtering on the pricing group code (PRC_GRP_CD): Home Type, Meson Type, and Mansion Type for broadband/net services (codes 02, 03, 04); and eo光電話 (eo optical telephone), eo光テレビ (K-CAT), and eo光テレビ (retransmission) for telecom services (codes 10, 11, 13). Only lines within these service categories are considered.

The design pattern employed is a multi-stage filter-and-enrich pipeline: it starts broad (query all contracts for a SYSID), progressively narrows (filter by review date, order number, address match, end date validity), and then enriches each surviving candidate with address change metadata and smart-validation (スマバリ) eligibility flags. It implements a builder-like accumulation pattern, collecting results into an `adchgList` of maps that are later stored in a session-scoped message map (`ccMsg`).

As a shared utility called by `getKddiKeishaInfo()`, this method plays a critical role in the KDDI customer information screen's data retrieval path. It ensures that the screen displays a complete picture of a customer's active lines, including those undergoing address changes, with appropriate flags for distinguishing which line (origin or destination) should be used for smart-validation output and address display.

The method has several conditional branches:
- Lines are filtered by service type (pricing group code).
- Lines are filtered by the customer's entered order/receipt number if provided.
- Lines are filtered by address prefix match against the "used address" search condition.
- Lines are filtered by end-date validity (not past the operational date).
- For in-transit lines, smart-validation eligibility determines whether the origin (0: 移転元) or destination (1: 移転先) line is selected for display.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["getKaisenInfoList"])

    START --> INIT["Initialize scCall, svcKeiKaisenUcwkNoList"]
    INIT --> QUERY1["EKK0081B016: Query service contract list by SYSID"]

    QUERY1 --> LOOP1["Loop through EKK0081B016 results"]
    LOOP1 --> PRCTYPE["Filter by PRC_GRP_CD"]
    PRCTYPE -->|net/telecom types| QUERY_SVC
    PRCTYPE -->|other| LOOP1_NEXT

    QUERY_SVC["EKK0081A010: Query service agreement"]
    QUERY_SVC --> CHECK1{"EKK0081A010 empty?"}
    CHECK1 -->|yes| LOOP1_NEXT
    CHECK1 -->|no| CHECK2{"SHOSA_YMD empty?"}
    CHECK2 -->|yes| LOOP1_NEXT
    CHECK2 -->|no| CHECK3{"muskm_bngu given?"}

    CHECK3 -->|yes| CHECK4["Check muskm_bngu vs svcKeiNo"]
    CHECK4 -->|match| QUERY_LINES
    CHECK4 -->|no match| LOOP1_NEXT
    CHECK3 -->|no| QUERY_LINES

    QUERY_LINES["EKK0251B001: Query line breakdown"]
    QUERY_LINES --> LOOP2["Loop through breakdowns"]
    LOOP2 --> CHECK_TMP{"tmpSvc filter active?"}
    CHECK_TMP -->|yes| TMP_MATCH{"Match?"}
    TMP_MATCH -->|no| LOOP2_NEXT
    TMP_MATCH -->|yes| CHECK_END
    CHECK_TMP -->|no| CHECK_END

    CHECK_END{"UseEnd < opeDate?"}
    CHECK_END -->|yes| LOOP2_NEXT
    CHECK_END -->|no| CHECK_DUP{"In list?"}
    CHECK_DUP -->|no| ADD["Add to svcKeiKaisenUcwkNoList"]
    ADD --> LOOP2_NEXT
    CHECK_DUP -->|yes| LOOP2_NEXT

    LOOP2_NEXT["Next loop"] --> LOOP2
    LOOP1_NEXT["Next loop"] --> LOOP1

    QUERY1 --> LOOP1
    QUERY_SVC --> QUERY_LINES
    LOOP2 --> LOOP1
    LOOP1 --> END_LOOP1{"Done?"}
    END_LOOP1 -->|no| LOOP1

    END_LOOP1 -->|yes| QUERY2["EKK0251A010: Query line agreement"]
    QUERY2 --> CHECK_ADDR{"address starts with search addr?"}
    CHECK_ADDR -->|yes| ADD_HIT["Add to svcKeiKaisenUcwkNoHitList"]
    ADD_HIT --> END_ADDR
    CHECK_ADDR -->|no| END_ADDR

    END_ADDR["Continue"] --> END_QUERY2{"Done?"}
    END_QUERY2 -->|no| QUERY2

    END_QUERY2 -->|yes| ADCHG_CHECK["Address change check"]
    ADCHG_CHECK --> ADCHG_MOVE_TO["Search 移転先 via EKK2091B001"]
    ADCHG_MOVE_TO --> ADCHG_MOVE_FROM["Search 移転元 via EKK2091B001"]
    ADCHG_MOVE_FROM --> ADCHG_BUILD["Build adchgList maps"]

    ADCHG_BUILD --> ADCHG_DETAILS["EKK2101B001: Address change details"]
    ADCHG_DETAILS --> ADCHG_LISTS["Build 移転元/移転先 svc lists"]
    ADCHG_LISTS --> SMART_CHECK["SM approval validation"]
    SMART_CHECK --> GET_SMART["getSmartValueMskmKhMap: Get SM params"]
    GET_SMART --> GET_MOTO_SMART["getSmartValueMskmKh for 移転元"]
    GET_MOTO_SMART --> JUDGE_SMART{"net AND tel both '可'?"}
    JUDGE_SMART -->|yes| SET_MOVE_TO["smrt_val_mskm_judge_flg=0"]
    JUDGE_SMART -->|no| SET_MOVE_FROM["smrt_val_mskm_judge_flg=1"]

    SET_MOVE_TO --> PLACE_CHECK{"net AND tel both '可'?"}
    SET_MOVE_FROM --> PLACE_CHECK
    PLACE_CHECK -->|yes| GET_SAKI_SMART["getSmartValueMskmKh for 移転先"]
    GET_SAKI_SMART --> SAKI_JUDGE{"Saki net AND tel both '可'?"}
    SAKI_JUDGE -->|yes| SET_SAKI0["kaisen_place_ad_judge_flg=0"]
    SAKI_JUDGE -->|no| SET_SAKI0A["kaisen_place_ad_judge_flg=0"]
    SET_SAKI0 --> END_SAKI
    SET_SAKI0A --> END_SAKI
    PLACE_CHECK -->|no| SET_OTHER["kaisen_place_ad_judge_flg=0"]
    SET_OTHER --> END_SAKI

    END_SAKI["End SM validation"] --> END_ADCHG{"Done with adchgList?"}
    END_ADCHG -->|no| GET_MOTO_SMART

    END_ADCHG -->|yes| NON_ADCHG_CHECK{"adchg line?"}
    NON_ADCHG_CHECK -->|no| EKK0241["EKK0241B002: Query service list"]
    EKK0241 --> FILTER_ENDYMD{"endymd==20991231?"}
    FILTER_ENDYMD -->|yes| ADD_SVC["Add svc_kei_no"]
    ADD_SVC --> BUILD_RESULT["Build result map"]
    BUILD_RESULT --> ADD_RESULT["Add to adchgList"]
    FILTER_ENDYMD -->|no| END_NON

    NON_ADCHG_CHECK -->|yes| END_NON
    END_NON["Continue"] --> END_NON_ADCHG{"Done?"}
    END_NON_ADCHG -->|no| NON_ADCHG_CHECK

    END_NON_ADCHG -->|yes| FINALIZE["Save to ccMsg and return"]
    FINALIZE --> END(["Return / Next"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | The session context handle providing database connection and transaction management for SC invocations. |
| 2 | `param` | `IRequestParameterReadWrite` | Request/response parameter interface for passing data between the screen and business logic. Used to retrieve the `fixedText` message map and to store results. |
| 3 | `fixedText` | `String` | A fixed key string used to retrieve the `ccMsg` map from `param` via `param.getData(fixedText)`. This map serves as the session-scoped message carrier where results are stored (`ccMsg.put("sysid_" + sysid, adchgList)`). |
| 4 | `sysid` | `String` | The service ID that scopes the service contract search. It is used as the key to query EKK0081B016 (service contract list) — effectively identifying which customer or account's contracts to retrieve. |
| 5 | `tmp_tnmt_stbsho_jusho` | `String` | [Search condition] Used address (利用場所住所) — a partial address string for prefix matching against the line's physical address. Lines whose address starts with this value are retained. If empty, all lines pass this filter. |
| 6 | `muskm_bngu` | `String` | [Search condition] EO order number / reception number (eo申込番号/受付番号). If provided, it must match the service contract's oldest order number or order detail number; otherwise the line is excluded. |
| 7 | `tmpSvcKeiKaisenUcwkNo` | `String` | [Search condition] A specific line breakdown number that narrows the search to a particular line. If provided and non-empty, only lines matching this exact number are retained. |

**Instance fields / external state read:**
- `ccMsg` retrieved from `param.getData(fixedText)` — used as a session-scoped message carrier for storing results and the operational date (`opeDate`).
- `SC` constants defined in the same class: `PRC_GRP_CD_NET`, `KK_MSKM_PSB_NET`, `KK_MSKM_PSB_TEL`, `KEY_NET_MSKM_FL`, `KEY_TEL_MSKM_FL` — used for service type filtering and SM validation parameter keys.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `callSC(handle, scCall, param, fixedText, ekk0081b016IN).getCAANMsgList(EKK0081B016CBSMSG1LIST)` | EKK0081B016CBS | KK_T_SVC_KEI (service contract) | Query service contract list by SYSID for pricing group code filtering |
| R | `callSC(handle, scCall, param, fixedText, ekk0081a010IN).getCAANMsgList(EKK0081A010CBSMSG1LIST)` | EKK0081A010CBS | KK_T_SVC_KEI_AGREEMENT (service contract agreement) | Query service contract agreement details including review date (SHOSA_YMD) |
| R | `callSC(handle, scCall, param, fixedText, ekk0251b001IN).getCAANMsgList(EKK0251B001CBSMSG1LIST)` | EKK0251B001CBS | KK_T_SVC_KEI_KAISEN_DETAIL (service contract line breakdown) | Query service contract line breakdown details including end date |
| R | `getEKK0251A010(handle, param, fixedText, svcKeiKaisenUcwkNo)` | EKK0251A010CBS | KK_T_SVC_KEI_KAISEN (service contract line) | Query service contract line agreement including physical address |
| R | `callSC(handle, scCall, param, fixedText, ekk2091b001IN).getCAANMsgList(EKK2091B001CBSMSG1LIST)` | EKK2091B001CBS | KK_T_ADCHG (address change header) | Query address change list — first for 移転先 (destination) lookup, then for 移転元 (origin) lookup |
| R | `callSC(handle, scCall, param, fixedText, ekk2101b001IN).getCAANMsgList(EKK2101B001CBSMSG1LIST)` | EKK2101B001CBS | KK_T_ADCHG_DTL (address change detail) | Query address change detail lines to get migration origin/destination service contract numbers |
| R | `callSC(handle, scCall, param, fixedText, ekk0241b002IN).getCAANMsgList(EKK0241B002CBSMSG1LIST)` | EKK0241B002CBS | KK_T_SVC_KEI (service contract by line) | Query service contract list for non-adchg lines |
| R | `getSmartValueMskmKhMap(handle, param, fixedText, null, workParamKeyMap)` | — | — | Get business parameter approval flags for net and tel SM (スマバリ) |
| R | `getSmartValueMskmKh(handle, param, fixedText, itenMotoSvcKeiNoList, itnmSvkeiKisuwNo)` | — | — | Get SM approval status for a specific set of migration origin lines |
| R | `getSmartValueMskmKh(handle, param, fixedText, itenSakiSvcKeiNoList, itensSvkeiKisuwNo)` | — | — | Get SM approval status for a specific set of migration destination lines |
| R | `JKKKddiKeishaInfoCC.isEqualMuskmBngu` | — | — | Check if the entered order/receipt number matches the service contract's order number or detail number |
| R | `JKKKddiKeishaInfoCC.getNullToStr` | — | — | Null-safe string conversion utility |
| R | `JKKKddiKeishaInfoCC.getSmartValueMskmKhMap` | — | — | Get smart validation parameter map from business parameters |
| R | `JKKKddiKeishaInfoCC.getSmartValueMskmKh` | — | — | Get smart validation eligibility for specific lines |
| R | `JPCUtilCommon.isPastDate` | — | — | Utility for comparing YMD date strings to determine if one date is before another |
| R | `JZMAdOutputEdit.getPtn01` | — | — | Utility to assemble an address from state, city, district, zone, building number, building name, room name |
| C | `JKKKddiKeishaInfoCC.createParamEKK0081B016` | — | — | Build input parameters for EKK0081B016 (service contract list by SYSID) |
| C | `JKKKddiKeishaInfoCC.createParamEKK0081A010` | — | — | Build input parameters for EKK0081A010 (service contract agreement) |
| C | `JKKKddiKeishaInfoCC.createParamEKK0251B001` | — | — | Build input parameters for EKK0251B001 (service contract line breakdown list) |
| C | `JKKKddiKeishaInfoCC.createParamEKK2091B001` | — | — | Build input parameters for EKK2091B001 (address change list) |
| C | `JKKKddiKeishaInfoCC.createParamEKK2101B001` | — | — | Build input parameters for EKK2101B001 (address change detail list) |
| C | `JKKKddiKeishaInfoCC.createParamEKK0241B002` | — | — | Build input parameters for EKK0241B002 (service contract list by line) |
| C | `JKKKddiKeishaInfoCC.getEKK0251A010` | — | — | Build and execute query for EKK0251A010 (service contract line agreement) |
| D | `JKKKddiKeishaInfoCC.removeSpace` | — | — | Remove whitespace from address string for comparison |
| R | `JKKKddiKeishaInfoCC.callSC` | — | — | Generic service component invocation wrapper |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Method:JKKKddiKeishaInfoCC.getKddiKeishaInfo | `getKddiKeishaInfo` -> `getKaisenInfoList` | `callSC [R] KK_T_SVC_KEI`, `createParamEKK0241B002 [C] KK_T_SVC_KEI`, `getNullToStr [R] -`, `getString [R] -` |

**Terminal operations from this method:**

| # | Terminal Operation | Type | Entity/Description |
|---|-------------------|------|---------------------|
| 1 | `getString(EKK0081B016CBSMsg1List.PRC_GRP_CD)` | R | Pricing group code from service contract list |
| 2 | `getString(EKK0081B016CBSMsg1List.SVC_KEI_NO)` | R | Service contract number |
| 3 | `getString(EKK0081A010CBSMsg1List.SHOSA_YMD)` | R | Review YMD date from service agreement |
| 4 | `getString(EKK0251B001CBSMsg1List.SVC_KEI_KAISEN_UCWK_NO)` | R | Service contract line breakdown number |
| 5 | `getString(EKK0251B001CBSMsg1List.KAISEN_UCWK_USE_ENDYMD)` | R | Line breakdown use end date |
| 6 | `getString(EKK0251A010CBSMsg1List.KAISEN_PLACE_*)` | R | Line physical address fields (state, city, district, etc.) |
| 7 | `getString(EKK2091B001CBSMsg1List.ADCHG_STAT)` | R | Address change status |
| 8 | `getString(EKK2091B001CBSMsg1List.ADCHG_NO)` | R | Address change number |
| 9 | `getString(EKK2091B001CBSMsg1List.ITNM_SVKEI_KISUW_NO)` | R | Migration origin service contract line number |
| 10 | `getString(EKK2091B001CBSMsg1List.ITENS_SVKEI_KISUW_NO)` | R | Migration destination service contract line number |
| 11 | `getString(EKK2101B001CBSMsg1List.CHAF_SKBT_NO)` | R | Migration destination service contract number (detail) |
| 12 | `getString(EKK2101B001CBSMsg1List.CHBF_SKBT_NO)` | R | Migration origin service contract number (detail) |
| 13 | `getString(EKK0241B002CBSMsg1List.KAISEN_UCWK_USE_ENDYMD)` | R | Line breakdown use end date (non-adchg) |
| 14 | `getString(EKK0241B002CBSMsg1List.SVC_KEI_NO)` | R | Service contract number (non-adchg) |
| 15 | `callSC(EKK0081B016)` | R | Service contract list by SYSID |
| 16 | `callSC(EKK0081A010)` | R | Service contract agreement |
| 17 | `callSC(EKK0251B001)` | R | Service contract line breakdown list |
| 18 | `callSC(EKK2091B001)` | R | Address change list |
| 19 | `callSC(EKK2101B001)` | R | Address change detail list |
| 20 | `callSC(EKK0241B002)` | R | Service contract list by line |
| 21 | `createParamEKK0241B002` | C | Parameter construction |
| 22 | `getNullToStr` | R | Null-safe conversion |
| 23 | `getSmartValueMskmKh` | R | SM approval status retrieval |
| 24 | `getSmartValueMskmKhMap` | R | SM parameter map retrieval |

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Initialize working variables (L1256-L1260)

> Create the service component request invoker and initialize the service contract line breakdown number list for collecting candidates.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ccMsg = param.getData(fixedText)` // Retrieve session-scoped message map |
| 2 | SET | `scCall = new ServiceComponentRequestInvoker()` // Instantiate SC caller |
| 3 | SET | `svcKeiKaisenUcwkNoList = new ArrayList<>()` // Initialize line breakdown number list |

**Block 2** — [CALL] Query service contract list by SYSID (L1263-L1265)

> Invoke EKK0081B016 to retrieve all service contracts for the given SYSID. This is the broad starting point for the search.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0081b016IN = createParamEKK0081B016(sysid)` // [-> EKK0081B016CBS] Build SYSID-based input params |
| 2 | CALL | `callSC(handle, scCall, param, fixedText, ekk0081b016IN).getCAANMsgList(EKK0081B016CBSMSG1LIST)` // [-> KK_T_SVC_KEI] Query service contracts |

**Block 3** — [FOR LOOP] Loop through EKK0081B016 results (L1267-L1355)

> Iterate over each service contract returned by EKK0081B016.

| # | Type | Code |
|---|------|------|
| 1 | SET | `prcGrpCd = ekk0081b016MsgList[i].getString(PRC_GRP_CD)` // Extract pricing group code |

**Block 3.1** — [IF] Service type filter (L1272-L1278)

> Only process contracts belonging to net/telecom service types. The PRC_GRP_CD_NET list contains codes "02" (Home Type), "03" (Meson Type), "04" (Mansion Type). Additional codes "10" (eo光電話), "11" (eo光テレビ K-CAT), "13" (eo光テレビ 再送信) are checked directly against JKKStrConst.
> [-> PRC_GRP_CD_NET = LinkedList{"02"(Home), "03"(Meson), "04"(Mansion)} (JKKKddiKeishaInfoCC.java:217)]
> [-> JKKStrConst.CD00133_10 = "10" (eo光電話) (JKKStrConst.java:395)]
> [-> JKKStrConst.CD00133_11 = "11" (eo光テレビ K-CAT) (JKKStrConst.java:397)]
> [-> JKKStrConst.CD00133_13 = "13" (eo光テレビ 再送信) (JKKStrConst.java:401)]

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcKeiNo = ekk0081b016MsgList[i].getString(SVC_KEI_NO)` // Extract service contract number |

**Block 3.2** — [CALL] Query service contract agreement (L1280-L1285)

> [-> EKK0081A010CBS] Query service agreement for the extracted service contract number.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0081a010IN = createParamEKK0081A010(ccMsg, svcKeiNo)` // [-> EKK0081A010CBS] Build input params |
| 2 | CALL | `callSC(handle, scCall, param, fixedText, ekk0081a010IN).getCAANMsgList(EKK0081A010CBSMSG1LIST)` // [-> KK_T_SVC_KEI_AGREEMENT] Query agreement |

**Block 3.3** — [IF] Check EKK0081A010 empty (L1287-L1290)

> If no agreement record found, skip this contract.

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

**Block 3.4** — [IF] Check SHOSA_YMD empty (L1295-L1298)

> If the review date (SHOSA_YMD) is empty, the contract has not been reviewed — skip it.

| # | Type | Code |
|---|------|------|
| 1 | SET | `shosaYMD = ekk0081a010MsgList[0].getString(SHOSA_YMD)` // Extract review YMD |
| 2 | EXEC | `continue` // Skip if empty (no review date set) |

**Block 3.5** — [IF] muskm_bngu filtering (L1302-L1313)

> If the customer entered an order/receipt number on the iTas screen, it must match the service contract's order number.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `isEqualMuskmBngu(handle, param, fixedText, muskm_bngu, svcKeiNo)` // [-> null] Check order number match |
| 2 | EXEC | `continue` // Exclude if numbers do not match |

**Block 3.6** — [CALL] Query service contract line breakdown (L1317-L1321)

> [-> EKK0251B001CBS] Query line breakdown details for the service contract, including use end dates (20991231 means active).

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0251b001IN = createParamEKK0251B001(svcKeiNo)` // [-> EKK0251B001CBS] Build input params |
| 2 | CALL | `callSC(handle, scCall, param, fixedText, ekk0251b001IN).getCAANMsgList(EKK0251B001CBSMSG1LIST)` // [-> KK_T_SVC_KEI_KAISEN_DETAIL] Query breakdowns |

**Block 3.7** — [FOR LOOP] Loop through line breakdowns (L1323-L1353)

> Iterate through each line breakdown within the service contract.

**Block 3.7.1** — [IF] tmpSvcKeiKaisenUcwkNo filter (L1330-L1337)

> If a specific line breakdown number is provided, only keep matching ones.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcKeiKaisenUcwkNo = ekk0251b001MsgList[j].getString(SVC_KEI_KAISEN_UCWK_NO)` |
| 2 | EXEC | `continue` // Exclude if numbers differ |

**Block 3.7.2** — [IF] Check use end date vs operational date (L1342-L1349)

> If the line's use end date is before the operational date, it is a past/retired line and should be excluded.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kaisenUcwkUseEndymd = ekk0251b001MsgList[j].getString(KAISEN_UCWK_USE_ENDYMD)` // Line breakdown end date |
| 2 | SET | `opeDate = ccMsg.get("opeDate")` // Operational date from session |
| 3 | EXEC | `JPCUtilCommon.isPastDate(kaisenUcwkUseEndymd, opeDate, "0")` // Compare: endDate < opeDate |
| 4 | EXEC | `continue` // Exclude past lines |

**Block 3.7.3** — [IF] Dedup check (L1351-L1354)

> Skip lines already collected to avoid duplicates.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `svcKeiKaisenUcwkNoList.contains(svcKeiKaisenUcwkNo)` // Check for existing |
| 2 | SET | `svcKeiKaisenUcwkNoList.add(svcKeiKaisenUcwkNo)` // Add new candidate |

**Block 4** — [FOR LOOP] Address prefix match for hit lines (L1360-L1398)

> For each candidate line breakdown number, query its full address and check if it starts with the search address. This narrows results to lines at or near the specified location.

**Block 4.1** — [CALL] Query line agreement (L1365-L1367)

> [-> EKK0251A010CBS] Get the service contract line agreement including physical address.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `getEKK0251A010(handle, param, fixedText, svcKeiKaisenUcwkNo)` // [-> KK_T_SVC_KEI_KAISEN] Query line |

**Block 4.2** — [IF] Search result exists (L1369-L1397)

> If the line was found, extract and assemble the full address.

| # | Type | Code |
|---|------|------|
| 1 | SET | `state = getNullToStr(ekk0251a010Msg.getString(KAISEN_PLACE_STATE_NM))` |
| 2 | SET | `city = getNullToStr(ekk0251a010Msg.getString(KAISEN_PLACE_CITY_NM))` |
| 3 | SET | `oaztsu = getNullToStr(ekk0251a010Msg.getString(KAISEN_PLACE_OAZTSU_NM))` |
| 4 | SET | `azcho = getNullToStr(ekk0251a010Msg.getString(KAISEN_PLACE_AZCHO_NM))` |
| 5 | SET | `bnchigo = getNullToStr(ekk0251a010Msg.getString(KAISEN_PLACE_BNCHIGO))` |
| 6 | SET | `adrttm = getNullToStr(ekk0251a010Msg.getString(KAISEN_PLACE_ADRTTM))` |
| 7 | SET | `adrrm = getNullToStr(ekk0251a010Msg.getString(KAISEN_PLACE_ADRRM))` |
| 8 | EXEC | `kaisenAddress = JZMAdOutputEdit.getPtn01(state, city, oaztsu, azcho, bnchigo, adrttm, adrrm)` // Assemble full address |
| 9 | SET | `tmp_kaisenAddress = removeSpace(kaisenAddress)` // Remove spaces |

**Block 4.3** — [IF] Address prefix match (L1378-L1383)

> If the line address starts with the search address (utilized location), this line is considered a hit. If no search address is entered, this evaluates to true (empty string matches any prefix).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `tmp_kaisenAddress.startsWith(tmp_tnmt_stbsho_jusho)` // Prefix match check |
| 2 | SET | `svcKeiKaisenUcwkNoHitList.add(svcKeiKaisenUcwkNo)` // Retain as hit |

**Block 5** — [FOR LOOP] Address change check: find 移転先 (destination) lines (L1399-L1435)

> For each hit line, query the address change list (EKK2091B001) to find any address change transactions where this line is the 移転先 (destination).

**Block 5.1** — [CALL] Query address change list (L1406-L1408)

> [-> EKK2091B001CBS] Search for address change records with the hit line as the 移転先. Input params: `("", "", svcKeiKaisenUcwkNo, "")`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk2091b001IN = createParamEKK2091B001("", "", svcKeiKaisenUcwkNo, "")` // [-> EKK2091B001CBS] Search by 移転先 |
| 2 | CALL | `callSC(handle, scCall, param, fixedText, ekk2091b001IN).getCAANMsgList(EKK2091B001CBSMSG1LIST)` // [-> KK_T_ADCHG] |

**Block 5.2** — [IF] Search result exists (L1411-L1434)

> Process each address change record that has status "001: 登録済" (registered).

**Block 5.2.1** — [IF] Address change status is "001" (L1416-L1421)

> Only process records where the address change is fully registered (not in progress).

| # | Type | Code |
|---|------|------|
| 1 | SET | `adchgStat = ekk2091b001MsgList[j].getString(ADCHG_STAT)` // Status: "001" = registered |
| 2 | EXEC | `continue` // Skip if not "001" (not fully registered) |

**Block 5.2.2** — [SET] Build adchgList map (L1423-L1428)

> Store the address change number, migration origin, and migration destination service contract line numbers.

| # | Type | Code |
|---|------|------|
| 1 | SET | `map = new HashMap<>()` |
| 2 | SET | `map.put("adchg_no", adchgNo)` // [-> ADCHG_NO] Address change number |
| 3 | SET | `map.put("itnm_svkei_kisuw_no", itnmSvkeiKisuwNo)` // [-> ITNM_SVKEI_KISUW_NO] Migration origin line number |
| 4 | SET | `map.put("itens_svkei_kisuw_no", itensSvkeiKisuwNo)` // [-> ITENS_SVKEI_KISUW_NO] Migration destination line number |
| 5 | EXEC | `adchgList.add(map)` // Add to adchg list |

**Block 6** — [FOR LOOP] Address change check: find 移転元 (origin) lines (L1437-L1481)

> For each hit line, check if it is a 移転元 (origin) in any address change. If not, search for address change records with this line as the 移転元 (origin). This builds a bidirectional mapping of migration origin-destination pairs.

**Block 6.1** — [IF] Skip if already a 移転先 (L1441-L1449)

> If this line is already found as a 移転先 in adchgList, no need to search for it as 移転元.

| # | Type | Code |
|---|------|------|
| 1 | SET | `map = adchgList.get(j)` |
| 2 | EXEC | `svcKeiKaisenUcwkNo.equals(map.get("itens_svkei_kisuw_no"))` // Check if it is a 移転先 |
| 3 | SET | `searchExecFlag = false` // Skip this line |

**Block 6.2** — [IF] searchExecFlag is true (L1451-L1481)

> For lines not found as 移転先, search for address change records where this line is the 移転元 (origin).

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk2091b001IN = createParamEKK2091B001("", "", "", svcKeiKaisenUcwkNo)` // [-> EKK2091B001CBS] Search by 移転元 |
| 2 | CALL | `callSC(handle, scCall, param, fixedText, ekk2091b001IN).getCAANMsgList(EKK2091B001CBSMSG1LIST)` // [-> KK_T_ADCHG] |

Same processing as Block 5.2 for status check and map building.

**Block 7** — [FOR LOOP] Build address change detail lists (L1483-L1520)

> For each address change record in adchgList, query the address change detail table (EKK2101B001) to get the actual service contract numbers for the migration origin and destination.

**Block 7.1** — [CALL] Query address change details (L1492-L1494)

> [-> EKK2101B001CBS] Query detail lines with `adchgNo` and detail type code "01" (service contract number).

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk2101b001IN = createParamEKK2101B001(adchgNo, "01")` // [-> EKK2101B001CBS] Detail type = "01" |
| 2 | CALL | `callSC(handle, scCall, param, fixedText, ekk2101b001IN).getCAANMsgList(EKK2101B001CBSMSG1LIST)` // [-> KK_T_ADCHG_DTL] |

**Block 7.2** — [IF] Migration destination service contract number exists (L1498-L1506)

> Build the list of service contract numbers for the migration destination.

| # | Type | Code |
|---|------|------|
| 1 | SET | `itenSakiSvcKeiNo = ekk2101b001MsgList[j].getString(CHAF_SKBT_NO)` // [-> CHAF_SKBT_NO] |
| 2 | SET | `itenSakiMap = new HashMap<>()` |
| 3 | SET | `itenSakiMap.put("svc_kei_no", itenSakiSvcKeiNo)` // [-> SVC_KEI_NO] |
| 4 | EXEC | `itenSakiSvcKeiNoList.add(itenSakiMap)` |

**Block 7.3** — [IF] Migration origin service contract number exists (L1508-L1516)

> Build the list of service contract numbers for the migration origin.

| # | Type | Code |
|---|------|------|
| 1 | SET | `itenMotoSvcKeiNo = ekk2101b001MsgList[j].getString(CHBF_SKBT_NO)` // [-> CHBF_SKBT_NO] |
| 2 | SET | `itenMotoMap = new HashMap<>()` |
| 3 | SET | `itenMotoMap.put("svc_kei_no", itenMotoSvcKeiNo)` // [-> SVC_KEI_NO] |
| 4 | EXEC | `itenMotoSvcKeiNoList.add(itenMotoMap)` |

**Block 7.4** — [SET] Attach lists to map (L1517-L1518)

| # | Type | Code |
|---|------|------|
| 1 | SET | `map.put("iten_saki_svc_kei_no_list", itenSakiSvcKeiNoList)` // [-> iten_saki_svc_kei_no_list] Migration dest list |
| 2 | SET | `map.put("iten_moto_svc_kei_no_list", itenMotoSvcKeiNoList)` // [-> iten_moto_svc_kei_no_list] Migration origin list |

**Block 8** — [SET] Initialize SM (Smart Validation) parameter map (L1523-L1528)

> Set up the parameter keys for net and telephone SM validation flags.

| # | Type | Code |
|---|------|------|
| 1 | SET | `workParamKeyMap = new HashMap<>()` |
| 2 | SET | `workParamKeyMap.put(KEY_NET_MSKM_FL, KK_MSKM_PSB_NET)` // [-> KK_MSKM_PSB_NET = "KK_MSKM_PSB_NET"] Net SM: eligible |
| 3 | SET | `workParamKeyMap.put(KEY_TEL_MSKM_FL, KK_MSKM_PSB_TEL)` // [-> KK_MSKM_PSB_TEL = "KK_MSKM_PSB_TEL"] Tel SM: eligible |

**Block 9** — [CALL] Get SM approval flags (L1531-L1532)

> Query business parameters to get the SM eligibility flag values for net and telephone services.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `getSmartValueMskmKhMap(handle, param, fixedText, null, workParamKeyMap)` // [-> Business parameters] Get net/tel SM flag values |

**Block 10** — [FOR LOOP] SM validation for each address change record (L1535-L1612)

> For each address change record, determine which line (origin or destination) should be used for SM validation output based on whether both net and telephone SM eligibility is confirmed ("可") for the migration origin.

**Block 10.1** — [CALL] Get SM status for migration origin lines (L1544-L1545)

> Query the SM eligibility for the specific migration origin lines.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `getSmartValueMskmKh(handle, param, fixedText, itenMotoSvcKeiNoList, itnmSvkeiKisuwNo)` // SM status for origin |
| 2 | SET | `netSmartValueMskmKh = getNullToStr(work_ccMsg.get("out_prmt9"))` // Output param 9 = net SM |
| 3 | SET | `telSmartValueMskmKh = getNullToStr(work_ccMsg.get("out_prmt18"))` // Output param 18 = tel SM |

**Block 10.2** — [IF/ELSE] SM eligibility judgment for output line (L1548-L1559)

> If both net and telephone SM are eligible ("可"/`KK_MSKM_PSB_NET`/`KK_MSKM_PSB_TEL`), select the migration origin line (0: 移転元) for SM validation output. Otherwise, select the migration destination line (1: 移転先).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `netSmartValueMskmKh.equals(workmap.get(KEY_NET_MSKM_FL)) && telSmartValueMskmKh.equals(workmap.get(KEY_TEL_MSKM_FL))` // Both must match "可" |
| 2 | SET | `map.put("smrt_val_mskm_judge_flg", "0")` // [-> 0: 移転元] Select migration origin |
| 3 | SET | `map.put("smrt_val_mskm_judge_flg", "1")` // [-> 1: 移転先] Select migration destination (ELSE branch) |

**Block 10.3** — [IF/ELSE] Address output line judgment (L1560-L1612)

> ANK-2228-00-00 MOD: If both net and telephone SM are eligible for the migration origin, check the migration destination's SM eligibility. If both are also eligible, still select the migration origin line (0: 移転元) for address output. Otherwise, also select the migration origin.

**Block 10.3.1** — [IF] Net AND tel both eligible for origin (L1561-L1600)

> [-> net AND tel both "可"] When origin qualifies, get SM status for migration destination lines.

| # | Type | Code |
|---|------|------|
| 1 | SET | `itensSvkeiKisuwNo = (String)map.get("itens_svkei_kisuw_no")` |
| 2 | CALL | `getSmartValueMskmKh(handle, param, fixedText, itenSakiSvcKeiNoList, itensSvkeiKisuwNo)` // SM for destination |
| 3 | SET | `itenSakiNetSmaValMskmKh = getNullToStr(itenSaki_work_ccMsg.get("out_prmt9"))` |
| 4 | SET | `itenSakiTelSmaValMskmKh = getNullToStr(itenSaki_work_ccMsg.get("out_prmt18"))` |

**Block 10.3.1.1** — [IF] Destination net AND tel both eligible (L1573-L1580)

> ANK-2228-00-00 MOD: Even if destination qualifies, set to 0 (移転元) per the modification.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `itenSakiNetSmaValMskmKh.equals(workmap.get(KEY_NET_MSKM_FL)) && itenSakiTelSmaValMskmKh.equals(workmap.get(KEY_TEL_MSKM_FL))` |
| 2 | SET | `map.put("kaisen_place_ad_judge_flg", "0")` // [-> 0: 移転元] Always select origin for address |

**Block 10.3.2** — [ELSE] Origin NOT both eligible (L1598-L1605)

> When the migration origin does not have both net and telephone SM eligible, the migration destination line is used. ANK-2228-00-00 MOD sets it to 0 (移転元) instead of the original "1: 移転先".

| # | Type | Code |
|---|------|------|
| 1 | SET | `map.put("kaisen_place_ad_judge_flg", "0")` // [-> 0: 移転元] Select origin (post-mod) |

**Block 11** — [FOR LOOP] Process non-adchg lines and finalize (L1616-L1653)

> For hit lines that are NOT part of any address change, query their service contract details and add them to the result list.

**Block 11.1** — [IF] Is this an adchg line? (L1620-L1631)

> Check if the line is already in adchgList as either 移転元 or 移転先.

| # | Type | Code |
|---|------|------|
| 1 | SET | `map = adchgList.get(j)` |
| 2 | SET | `itnmSvkeiKisuwNo = map.get("itnm_svkei_kisuw_no")` |
| 3 | SET | `itensSvkeiKisuwNo = map.get("itens_svkei_kisuw_no")` |
| 4 | EXEC | `svcKeiKaisenUcwkNo.equals(itnmSvkeiKisuwNo) || svcKeiKaisenUcwkNo.equals(itensSvkeiKisuwNo)` // Match found |
| 5 | SET | `adchgKaisenUmuFlag = true` // This is an adchg line |

**Block 11.2** — [IF] Not an adchg line (L1633-L1650)

> For lines not involved in address change, query service contract details and filter by end date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcKeiNoList = new ArrayList<>()` // Initialize service contract number list |

**Block 11.2.1** — [CALL] Query service contract list by line (L1638-L1640)

> [-> EKK0241B002CBS] Query service contracts associated with this line. Filtered to only those with `kaisenUcwkUseEndymd == "20991231"` (not terminated).

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0241b002IN = createParamEKK0241B002(svcKeiKaisenUcwkNo)` // [-> EKK0241B002CBS] Build input |
| 2 | CALL | `callSC(handle, scCall, param, fixedText, ekk0241b002IN).getCAANMsgList(EKK0241B002CBSMSG1LIST)` // [-> KK_T_SVC_KEI] Query |

**Block 11.2.2** — [IF] Use end date is "20991231" (L1642-L1649)

> OM-2022-0000665 ADD: Only add service contracts where the line breakdown end date is the default "20991231" (meaning active/not retired).

| # | Type | Code |
|---|------|------|
| 1 | SET | `kaisenUcwkUseEndymd = ekk0241b002MsgList[j].getString(KAISEN_UCWK_USE_ENDYMD)` |
| 2 | EXEC | `JKKStrConst.END_YMD_DEFAULT.equals(kaisenUcwkUseEndymd)` // [-> END_YMD_DEFAULT = "20991231"] (JKKStrConst.java:2283) |
| 3 | SET | `svcKeiMap = new HashMap<>()` |
| 4 | SET | `svcKeiMap.put("svc_kei_no", svcKeiNo)` // [-> SVC_KEI_NO] |
| 5 | EXEC | `svcKeiNoList.add(svcKeiMap)` |

**Block 11.3** — [SET] Build final result map (L1651-L1653)

> Assemble the final result map for this non-adchg line and add it to the result list.

| # | Type | Code |
|---|------|------|
| 1 | SET | `map = new HashMap<>()` |
| 2 | SET | `map.put("svc_kei_kaisen_ucwk_no", svcKeiKaisenUcwkNo)` // [-> svc_kei_kaisen_ucwk_no] Non-adchg line breakdown number |
| 3 | SET | `map.put("svc_kei_no_list", svcKeiNoList)` // [-> svc_kei_no_list] List of service contract numbers |
| 4 | EXEC | `adchgList.add(map)` // Add to result |

**Block 12** — [SET] Store results and return (L1656-L1658)

> Store the assembled result list in the session-scoped message map under the key `"sysid_" + sysid`, and also store the tmpSvcKeiKaisenUcwkNo.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ccMsg.put("sysid_" + sysid, adchgList)` // Store result in session map |
| 2 | SET | `ccMsg.put("tmpSvcKeiKaisenUcwkNo", tmpSvcKeiKaisenUcwkNo)` |
| 3 | RETURN | `return adchgList` // Return the line list |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_kaisen_ucwk_no` | Field | Service contract line breakdown number — unique identifier for a line within a service contract, used to track individual lines |
| `svc_kei_no` | Field | Service contract number — identifies a service contract |
| `svc_kei_no_list` | Field | List of service contract numbers associated with a line breakdown |
| `adchg_no` | Field | Address change number — unique identifier for an address change transaction |
| `itnm_svkei_kisuw_no` | Field | Migration origin service contract line number — the line number before address change (移転元の回線) |
| `itens_svkei_kisuw_no` | Field | Migration destination service contract line number — the line number after address change (移転先の回線) |
| `smrt_val_mskm_judge_flg` | Field | Smart validation output line judgment flag — "0" = migration origin (移転元), "1" = migration destination (移転先) |
| `kaisen_place_ad_judge_flg` | Field | Address output line judgment flag — "0" = migration origin (移転元), "1" = migration destination (移転先) |
| `iten_moto_svc_kei_no_list` | Field | List of service contract numbers associated with migration origin lines (移転元の回線に紐づくサービス契約番号) |
| `iten_saki_svc_kei_no_list` | Field | List of service contract numbers associated with migration destination lines (移転先の回線に紐づくサービス契約番号) |
| `tmp_tnmt_stbsho_jusho` | Field | Used address (利用場所住所) — search condition for partial address matching |
| `muskm_bngu` | Field | EO order number / reception number (eo申込番号/受付番号) — order identification for strict matching |
| `tmpSvcKeiKaisenUcwkNo` | Field | Specified line breakdown number — narrows search to a specific line |
| `sysid` | Field | Service ID — scopes the search to a specific service provider/account |
| `shosa_ymd` | Field | Review YMD (調査年月日) — the date when the service contract was reviewed |
| `opeDate` | Field | Operational date — the current operational date used for date comparisons |
| `PRC_GRP_CD` | Field | Pricing group code (料金グループコード) — classifies the type of pricing/service group |
| `PRC_GRP_CD_NET` | Constant | LinkedList of net service pricing group codes: "02" (Home Type), "03" (Meson Type), "04" (Mansion Type) |
| `KK_MSKM_PSB_NET` | Constant | "KK_MSKM_PSB_NET" — SM submission eligible (net) flag value |
| `KK_MSKM_PSB_TEL` | Constant | "KK_MSKM_PSB_TEL" — SM submission eligible (telephone) flag value |
| `KEY_NET_MSKM_FL` | Constant | "KEY_NET_MSKM_FL" — key for net SM approval flag in work parameter map |
| `KEY_TEL_MSKM_FL` | Constant | "KEY_TEL_MSKM_FL" — key for telephone SM approval flag in work parameter map |
| `END_YMD_DEFAULT` | Constant | "20991231" — default end date meaning "not terminated / active" |
| `CD00133_02` | Constant | "02" — Pricing group code: eo optical network Home Type (eo光ネットホームタイプ) |
| `CD00133_03` | Constant | "03" — Pricing group code: eo optical network Meson Type (eo光ネットメゾンタイプ) |
| `CD00133_04` | Constant | "04" — Pricing group code: eo optical network Mansion Type (eo光ネットマンションタイプ) |
| `CD00133_10` | Constant | "10" — Pricing group code: eo optical telephone (eo光電話) |
| `CD00133_11` | Constant | "11" — Pricing group code: eo optical television K-CAT (eo光テレビ K-CAT) |
| `CD00133_13` | Constant | "13" — Pricing group code: eo optical television retransmission (eo光テレビ 再送信) |
| `ADCHG_STAT` | Field | Address change status — "001" means fully registered (登録済) |
| `KAISEN_UCWK_USE_ENDYMD` | Field | Line breakdown use end date — when the line breakdown's usage ends |
| `KAISEN_PLACE_STATE_NM` | Field | Line location state name (回線住所：都道府県名) |
| `KAISEN_PLACE_CITY_NM` | Field | Line location city name (回線住所：市区町村名) |
| `KAISEN_PLACE_OAZTSU_NM` | Field | Line location district name (回線住所：大字名) |
| `KAISEN_PLACE_AZCHO_NM` | Field | Line location zone name (回線住所：字名) |
| `KAISEN_PLACE_BNCHIGO` | Field | Line location building code (回線住所：丁丁目番号) |
| `KAISEN_PLACE_ADRTTM` | Field | Line location building name (回線住所：建物名) |
| `KAISEN_PLACE_ADRRM` | Field | Line location room number (回線住所：部屋番号) |
| `CHAF_SKBT_NO` | Field | Migration destination service contract number (転居先サービス契約番号) from address change detail |
| `CHBF_SKBT_NO` | Field | Migration origin service contract number (転居元サービス契約番号) from address change detail |
| EKK0081B016CBS | CBS | Service contract list inquiry — queries service contracts by SYSID |
| EKK0081A010CBS | CBS | Service contract agreement inquiry — queries service contract agreement details |
| EKK0251B001CBS | CBS | Service contract line breakdown list inquiry — queries line breakdown details by service contract |
| EKK0251A010CBS | CBS | Service contract line agreement inquiry — queries line agreement by line breakdown number |
| EKK2091B001CBS | CBS | Address change list inquiry — queries address change records |
| EKK2101B001CBS | CBS | Address change detail inquiry — queries address change detail lines |
| EKK0241B002CBS | CBS | Service contract list by line inquiry — queries service contracts for a given line |
| SM (スマバリ) | Acronym | Smart Validation (スマートバリデーション) — a simplified account verification method for telecommunications services |
| 住所変更中 | Business term | In the midst of address change — a state where a customer's address has been changed but the migration is in progress |
| 移転元 | Business term | Migration origin — the line number/location before an address change |
| 移転先 | Business term | Migration destination — the line number/location after an address change |
| 回線 | Business term | Line — a physical telecommunications connection (e.g., fiber optic line) |
| サービス契約 | Business term | Service contract — an agreement for telecom services |
| サービス契約回線内訳番号 | Business term | Service contract line breakdown number — identifies individual lines within a service contract |
| ホームタイプ | Business term | Home Type — residential single-family housing service type |
| メゾンタイプ | Business term | Meson Type — mid-size apartment/double-unit housing service type |
| マンションタイプ | Business term | Mansion Type — large apartment/condominium housing service type |
| eo光電話 | Business term | eo optical telephone — fiber-optic telephone service by eo |
| eo光テレビ (K-CAT) | Business term | eo optical television (K-CAT) — fiber-optic television service via K-CAT set-top box |
| eo光テレビ (再送信) | Business term | eo optical television (retransmission) — fiber-optic television service via signal retransmission |
| 登録済 | Business term | Fully registered — address change status "001" meaning the change is complete |
| 20991231 | Constant | Default end date — indicates a line is still active/valid |
| KK_T_SVC_KEI | Entity | Service contract table |
| KK_T_SVC_KEI_KAISEN_DETAIL | Entity | Service contract line breakdown table |
| KK_T_SVC_KEI_KAISEN | Entity | Service contract line table |
| KK_T_ADCHG | Entity | Address change header table |
| KK_T_ADCHG_DTL | Entity | Address change detail table |
