# Business Logic — KKA16701SFLogic.isRouterSpeedCheckResult() [109 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKA16701SF.KKA16701SFLogic` |
| Layer | Service Component (Logic) |
| Module | `KKA16701SF` (Package: `eo.web.webview.KKA16701SF`) |

## 1. Role

### KKA16701SFLogic.isRouterSpeedCheckResult()

This method performs a **router speed validation check** (ルーター速度確認 — related check) as part of the service contract cancellation confirmation flow. It validates that the combination of the customer's currently held router code, the router speed type code, and the pricing course code is consistent and authorized. Specifically, it iterates through a delivery service line-item list and checks each record against known router types and speed tiers — Basic (01), Basic Giga (02), Old Wireless (03), New Wireless (04), and New Wireless Giga (05) — against their respective expected speed classifications (100M vs 1G). If the router type is one of the five recognized categories and the line item falls within the 10G course range (verified via `isRcrs10G`), the check passes. For standard router-speed pairings, it delegates to `isRcrsRouter10` or `isRcrsRouter20` to verify the pricing course code matches the expected speed tier. If any record fails validation, the method returns `false`, triggering a warning message (`EKB8820__Q`) to the user. If there is no provisioned service information, the router info is absent, or all records pass, it returns `true`. This method acts as a **data-integrity gate** within the cancellation confirmation screen logic, ensuring that the router and speed data on the order are coherent before allowing the user to proceed. It implements a **guard-clause pattern** for early returns (missing data) followed by a **loop-and-validate pattern** for structured line-item checks.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["isRouterSpeedCheckResult"])
    CHK1{outputMap contains KKSV039504CC?}
    RET1["Return true"]
    GET1["Get idoRsvMsg from outputMap.KKSV039504CC"]
    CHK2{idoRsvMsg is null?}
    RET2["Return true"]
    CHK3{idoRsvMsg contains old_pcrs_cd?}
    RET3["Return true"]
    GET2["curPcrsCd = idoRsvMsg.old_pcrs_cd"]
    CHK4{outputMap contains KKSV039502CC?}
    RET4["Return true"]
    GET3["Get kktksvMsg from outputMap.KKSV039502CC"]
    CHK5{kktksvMsg is null?}
    RET5["Return true"]
    GET4["workList = kktksvMsg.kktkSvKeiDelCCList"]
    INIT["checkFlg = false"]
    LOOP_START["for each workMap in workList"]
    CHK6{workMap hoyu_router_cd or router_speed_cd null?}
    CONT["continue skip"]
    SET1["hoyuRouterCd = workMap hoyu_router_cd"]
    SET2["routerSpeedSbtCd = workMap router_speed_cd"]
    BR_A{hoyuRouterCd in router types?}
    CHK_10G{Is 10G course?}
    CHECK_10G["isRcrs10G curPcrsCd"]
    SET_FLG1["checkFlg = true"]
    BRK1["break"]
    BR_B{hoyuRouterCd 01 and routerSpeedSbtCd 10?}
    CHK_R10["isRcrsRouter10 curPcrsCd"]
    SET_FLG2["checkFlg = true"]
    BRK2["break"]
    BR_C{hoyuRouterCd 02 and routerSpeedSbtCd 20?}
    CHK_R20_1["isRcrsRouter20 curPcrsCd"]
    SET_FLG3["checkFlg = true"]
    BRK3["break"]
    BR_D{hoyuRouterCd 03 and routerSpeedSbtCd 10?}
    CHK_R10_2["isRcrsRouter10 curPcrsCd"]
    SET_FLG4["checkFlg = true"]
    BRK4["break"]
    BR_E{hoyuRouterCd 04 and routerSpeedSbtCd 10?}
    CHK_R10_3["isRcrsRouter10 curPcrsCd"]
    SET_FLG5["checkFlg = true"]
    BRK5["break"]
    BR_F{hoyuRouterCd 05 and routerSpeedSbtCd 20?}
    BRK7["No action no-op"]
    LOOP_END{More items?}
    CHK_FLG{checkFlg is false?}
    RET6["Return true"]
    RET7["Return false"]

    START --> CHK1
    CHK1 -->|No| RET1
    CHK1 -->|Yes| GET1
    GET1 --> CHK2
    CHK2 -->|Yes| RET2
    CHK2 -->|No| CHK3
    CHK3 -->|No| RET3
    CHK3 -->|Yes| GET2
    GET2 --> CHK4
    CHK4 -->|No| RET4
    CHK4 -->|Yes| GET3
    GET3 --> CHK5
    CHK5 -->|Yes| RET5
    CHK5 -->|No| GET4
    GET4 --> INIT
    INIT --> LOOP_START
    LOOP_START --> CHK6
    CHK6 -->|Yes| CONT
    CONT --> LOOP_END
    CHK6 -->|No| SET1
    SET1 --> SET2
    SET2 --> BR_A
    BR_A -->|Yes| CHK_10G
    BR_A -->|No| BR_B
    CHK_10G -->|Yes| CHECK_10G
    CHECK_10G -->|true| SET_FLG1
    CHECK_10G -->|false| BR_B
    SET_FLG1 --> BRK1
    BRK1 --> BR_B
    BR_B -->|Yes| CHK_R10
    BR_B -->|No| BR_C
    CHK_R10 -->|true| SET_FLG2
    CHK_R10 -->|false| BRK2
    SET_FLG2 --> BRK2
    BRK2 --> BR_C
    BR_C -->|Yes| CHK_R20_1
    BR_C -->|No| BR_D
    CHK_R20_1 -->|true| SET_FLG3
    CHK_R20_1 -->|false| BRK3
    SET_FLG3 --> BRK3
    BRK3 --> BR_D
    BR_D -->|Yes| CHK_R10_2
    BR_D -->|No| BR_E
    CHK_R10_2 -->|true| SET_FLG4
    CHK_R10_2 -->|false| BRK4
    SET_FLG4 --> BRK4
    BRK4 --> BR_E
    BR_E -->|Yes| CHK_R10_3
    BR_E -->|No| BR_F
    CHK_R10_3 -->|true| SET_FLG5
    CHK_R10_3 -->|false| BRK5
    SET_FLG5 --> BRK5
    BRK5 --> BR_F
    BR_F -->|Yes| BRK7
    BR_F -->|No| LOOP_END
    BRK7 --> LOOP_END
    LOOP_END -->|Yes| CONT
    LOOP_END -->|No| CHK_FLG
    CHK_FLG -->|Yes| RET6
    CHK_FLG -->|No| RET7
    RET1 --> END(["Return"])
    RET2 --> END
    RET3 --> END
    RET4 --> END
    RET5 --> END
    RET6 --> END
    RET7 --> END
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `outputMap` | `HashMap<String, Object>` | Aggregate output container holding results from multiple service calls (SCs). Keys are SC identifiers (e.g., `KKSV039504CC`, `KKSV039502CC`) mapped to their respective result maps. Represents the cumulative processing results of the cancellation confirmation screen's upstream service calls. |
| 2 | `svcFormBean` | `X31SDataBeanAccess` | Screen form bean containing the current state of the service contract cancellation confirmation screen. Passed through for potential future use; the method does not directly access its fields in the current implementation. |

**Instance fields read:** None directly by this method. All data flows through the `outputMap` parameter.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `KKA16701SFLogic.isRcrs10G` | KKA16701SFLogic | - | Reads pricing course data to determine if the customer's course is a 10G tier. Invoked when router type is one of the five recognized holding router categories (01–05). |
| R | `KKA16701SFLogic.isRcrsRouter10` | KKA16701SFLogic | - | Reads pricing course data to verify the customer's course matches a 100M speed tier. Invoked for router types: Basic (01), Old Wireless (03), New Wireless (04) with speed subtype 10. |
| R | `KKA16701SFLogic.isRcrsRouter20` | KKA16701SFLogic | - | Reads pricing course data to verify the customer's course matches a 1G speed tier. Invoked for router type: Basic Giga (02) with speed subtype 20. |

These three helper methods are internal logic methods within the same class (`KKA16701SFLogic`) that validate the current pricing course code against expected speed classifications. They do not directly access database tables from within `isRouterSpeedCheckResult` — they are called for their boolean return value indicating whether the course matches the expected speed tier.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 2 methods.
Terminal operations from this method: `isRcrsRouter10` [-], `isRcrsRouter10` [-], `isRcrsRouter20` [-], `isRcrsRouter10` [-], `isRcrs10G` [-]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS: `KKA16701SFLogic.forwardRsvClCfm()` | `forwardRsvClCfm()` → `isRouterSpeedCheckResult()` | `isRcrsRouter10 [R] -`, `isRcrsRouter20 [R] -`, `isRcrs10G [R] -` |

The `forwardRsvClCfm()` method is a public business method within the same class that handles the forward/cancellation confirmation flow. When the router speed check returns `false`, it sets a warning message (`EKB8820__Q`) to alert the user that the router speed combination is invalid. This is the primary entry point that uses this method in the KKA16701SF module. Note: `KKW02701SFLogic` contains a copy of this method, but it is a separate class with its own copy — not a cross-reference call.

## 6. Per-Branch Detail Blocks

**Block 1** — [IF] `(outputMap does not contain key "KKSV039504CC")` (L1944)
> Early-return guard: if there is no provisioned service information map, the check passes by default (no service to validate).

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true;` // No provisioned service info — skip validation |

**Block 2** — [SET] `(retrieve idoRsvMsg from outputMap)` (L1948)

| # | Type | Code |
|---|------|------|
| 1 | SET | `idoRsvMsg = (HashMap)outputMap.get("KKSV039504CC");` // Get provisioned service info map |
| 2 | SET | `// local variable HashMap<String, Object> idoRsvMsg` |

**Block 3** — [IF] `(idoRsvMsg is null)` (L1949)
> Early-return guard: if the service info map is null, there is no router data to validate.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true;` // Null service info — skip validation |

**Block 4** — [IF] `(!idoRsvMsg.containsKey("old_pcrs_cd"))` (L1953)
> Early-return guard: if the pricing course code is missing, the check passes.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true;` // Missing old_pcrs_cd — skip validation |

**Block 5** — [SET] `(extract curPcrsCd)` (L1956)

| # | Type | Code |
|---|------|------|
| 1 | SET | `curPcrsCd = idoRsvMsg.get("old_pcrs_cd").toString();` // Current pricing course code from provisioned service info |

**Block 6** — [IF] `(!outputMap.containsKey("KKSV039502CC"))` (L1958)
> Early-return guard: if there is no delivery service info map, the check passes.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true;` // No delivery service info — skip validation |

**Block 7** — [SET] `(retrieve kktksvMsg from outputMap)` (L1962)

| # | Type | Code |
|---|------|------|
| 1 | SET | `kktksvMsg = (HashMap)outputMap.get("KKSV039502CC");` // Get delivery service info map |

**Block 8** — [IF] `(kktksvMsg is null)` (L1963)
> Early-return guard: if the delivery service map is null, there is no line-item data to validate.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true;` // Null delivery service info — skip validation |

**Block 9** — [SET] `(extract workList)` (L1966)

| # | Type | Code |
|---|------|------|
| 1 | SET | `workList = (ArrayList)kktksvMsg.get("kktkSvKeiDelCCList");` // Delivery service line-item list |
| 2 | SET | `checkFlg = false;` // Flag to track if any line-item passes the speed check |

**Block 10** — [FOR] `(iterate over workList)` (L1967)
> Iterates through each delivery service line-item to validate the router/speed/course combination.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `for (HashMap workMap : workList)` // For each delivery service line-item |

**Block 10.1** — [IF] `(workMap.hoyu_router_cd or router_speed_cd is null)` (L1969)
> Skip incomplete records — if either the holding router code or router speed type code is missing, skip this line-item.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `continue;` // Skip line-item with missing router data |

**Block 10.2** — [SET] `(extract router fields)` (L1973)

| # | Type | Code |
|---|------|------|
| 1 | SET | `hoyuRouterCd = workMap.get("hoyu_router_cd").toString();` // Holding router code |
| 2 | SET | `routerSpeedSbtCd = workMap.get("router_speed_cd").toString();` // Router speed subtype code |

**Block 10.3** — [IF] `(hoyuRouterCd matches TKCD043_BASIC/02/03/04/05)` `(IT2-2016-0000004 2016/02/22 ADD)` (L1976)
> Checks if the holding router is one of the five recognized types: 01 (Basic), 02 (Basic Giga), 03 (Old Wireless), 04 (New Wireless), 05 (New Wireless Giga).

| # | Type | Code |
|---|------|------|
| 1 | IF | `JKKCommonConst.TKCD043_BASIC.equals(hoyuRouterCd)` `[TKCD043_BASIC="01" (Basic)]` |
| 2 | IF | `JKKCommonConst.TKCD043_BASICGIGA.equals(hoyuRouterCd)` `[TKCD043_BASICGIGA="02" (Basic Giga)]` |
| 3 | IF | `JKKCommonConst.TKCD043_KYUMUSEN.equals(hoyuRouterCd)` `[TKCD043_KYUMUSEN="03" (Old Wireless)]` |
| 4 | IF | `JKKCommonConst.TKCD043_SHINMUSEN.equals(hoyuRouterCd)` `[TKCD043_SHINMUSEN="04" (New Wireless)]` |
| 5 | IF | `JKKCommonConst.TKCD043_SHINMUSENGIGA.equals(hoyuRouterCd)` `[TKCD043_SHINMUSENGIGA="05" (New Wireless Giga)]` |
| 6 | EXEC | (OR condition — any one match enters this branch) |

**Block 10.3.1** — [IF] `(isRcrs10G(curPcrsCd))` (L1978)
> When the router is one of the five recognized types, checks if the pricing course is a 10G course. The comment says: "When holding router: 01 (Basic), 02 (Basic Giga), 03 (Old Wireless), 04 (New Wireless), or 05 (New Wireless Giga) — is this a 10G course?"

| # | Type | Code |
|---|------|------|
| 1 | CALL | `isRcrs10G(curPcrsCd)` // Check if pricing course is 10G tier |
| 2 | SET | `checkFlg = true;` // Line-item passed validation |
| 3 | EXEC | `break;` // Stop iterating — one passing line-item is sufficient |

**Block 10.4** — [ELSE-IF] `(hoyuRouterCd == "01" && routerSpeedSbtCd == "10")` (L1984)
> Holding router: 01 (Basic) + Router speed: 10 (100M). Comment: "When holding router: 01 (Basic) / router speed subtype: 10 (100M)."

| # | Type | Code |
|---|------|------|
| 1 | IF | `JKKCommonConst.TKCD043_BASIC.equals(hoyuRouterCd) && ROUTER_SPEED_SBT_CD_10.equals(routerSpeedSbtCd)` `[TKCD043_BASIC="01", ROUTER_SPEED_SBT_CD_10="10" (100M)]` |
| 2 | CALL | `isRcrsRouter10(curPcrsCd)` // Verify pricing course matches 100M speed tier |
| 3 | SET | `checkFlg = true;` // Line-item passed validation |
| 4 | EXEC | `break;` // Stop iterating |

**Block 10.5** — [ELSE-IF] `(hoyuRouterCd == "02" && routerSpeedSbtCd == "20")` (L1991)
> Holding router: 02 (Basic Giga) + Router speed: 20 (1G). Comment: "When holding router: 02 (Basic Giga) / router speed subtype: 20 (1G)."

| # | Type | Code |
|---|------|------|
| 1 | IF | `JKKCommonConst.TKCD043_BASICGIGA.equals(hoyuRouterCd) && ROUTER_SPEED_SBT_CD_20.equals(routerSpeedSbtCd)` `[TKCD043_BASICGIGA="02", ROUTER_SPEED_SBT_CD_20="20" (1G)]` |
| 2 | CALL | `isRcrsRouter20(curPcrsCd)` // Verify pricing course matches 1G speed tier |
| 3 | SET | `checkFlg = true;` // Line-item passed validation |
| 4 | EXEC | `break;` // Stop iterating |

**Block 10.6** — [ELSE-IF] `(hoyuRouterCd == "03" && routerSpeedSbtCd == "10")` (L1998)
> Holding router: 03 (Old Wireless) + Router speed: 10 (100M). Comment: "When holding router: 03 (Old Wireless) / router speed subtype: 10 (100M)."

| # | Type | Code |
|---|------|------|
| 1 | IF | `JKKCommonConst.TKCD043_KYUMUSEN.equals(hoyuRouterCd) && ROUTER_SPEED_SBT_CD_10.equals(routerSpeedSbtCd)` `[TKCD043_KYUMUSEN="03", ROUTER_SPEED_SBT_CD_10="10" (100M)]` |
| 2 | CALL | `isRcrsRouter10(curPcrsCd)` // Verify pricing course matches 100M speed tier |
| 3 | SET | `checkFlg = true;` // Line-item passed validation |
| 4 | EXEC | `break;` // Stop iterating |

**Block 10.7** — [ELSE-IF] `(hoyuRouterCd == "04" && routerSpeedSbtCd == "10")` (L2007)
> Holding router: 04 (New Wireless) + Router speed: 10 (100M). Comment: "When holding router: 04 (New Wireless) / router speed subtype: 10 (100M)."

| # | Type | Code |
|---|------|------|
| 1 | IF | `JKKCommonConst.TKCD043_SHINMUSEN.equals(hoyuRouterCd) && ROUTER_SPEED_SBT_CD_10.equals(routerSpeedSbtCd)` `[TKCD043_SHINMUSEN="04", ROUTER_SPEED_SBT_CD_10="10" (100M)]` |
| 2 | CALL | `isRcrsRouter10(curPcrsCd)` // Verify pricing course matches 100M speed tier |
| 3 | SET | `checkFlg = true;` // Line-item passed validation |
| 4 | EXEC | `break;` // Stop iterating |

**Block 10.8** — [ELSE-IF] `(hoyuRouterCd == "05" && routerSpeedSbtCd == "20")` (L2016)
> Holding router: 05 (New Wireless Giga) + Router speed: 20 (1G). Comment: "No judgment" (no additional processing needed — the 10G course check in Block 10.3 already covers the 10G case for this router type).

| # | Type | Code |
|---|------|------|
| 1 | IF | `hoyuRouterCd.equals(JKKCommonConst.TKCD043_SHINMUSENGIGA) && routerSpeedSbtCd.equals(ROUTER_SPEED_SBT_CD_20)` `[TKCD043_SHINMUSENGIGA="05", ROUTER_SPEED_SBT_CD_20="20" (1G)]` |
| 2 | EXEC | `// No action (no-op)` // Comment: 判定無し — no additional processing required |
| 3 | EXEC | `break;` // Exit the loop |

**Block 10.9** — [ELSE-IF] `(all other combinations)`
> Any router type or speed subtype combination not matching the above patterns. The loop simply continues to the next iteration (no action taken — the record is implicitly skipped).

**Block 11** — [IF] `(!checkFlg)` (L2021)
> After iterating all line-items: if no record passed the validation (`checkFlg` remains `false`), the overall check passes by returning `true`.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true;` // No line-item matched — check passes (no mismatch detected) |

**Block 12** — [RETURN] (L2024)
> Final fallback: if `checkFlg` is `true` (at least one line-item matched and passed validation), return `false` — indicating a mismatch was detected.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return false;` // A matching line-item was found — this signals a speed check failure |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `hoyu_router_cd` | Field | Holding router code — identifies the type of router the customer currently holds or is contracted for |
| `router_speed_cd` | Field | Router speed subtype code — classifies the router's speed tier (e.g., 10 = 100M, 20 = 1G) |
| `old_pcrs_cd` | Field | Old pricing course code — the customer's current pricing course, used to determine speed tier eligibility |
| `kktkSvKeiDelCCList` | Field | Delivery service detail cancellation confirmation list — a list of service line-items being processed during cancellation confirmation |
| `checkFlg` | Field | Check flag — boolean indicator that at least one line-item's router/speed/course combination was validated as inconsistent |
| TKCD043_BASIC | Constant | Holding router code "01" — Basic router type |
| TKCD043_BASICGIGA | Constant | Holding router code "02" — Basic Giga router type (higher-tier basic) |
| TKCD043_KYUMUSEN | Constant | Holding router code "03" — Old Wireless router type |
| TKCD043_SHINMUSEN | Constant | Holding router code "04" — New Wireless router type |
| TKCD043_SHINMUSENGIGA | Constant | Holding router code "05" — New Wireless Giga router type |
| ROUTER_SPEED_SBT_CD_10 | Constant | Router speed subtype code "10" — 100M speed tier |
| ROUTER_SPEED_SBT_CD_20 | Constant | Router speed subtype code "20" — 1G speed tier |
| KKSV039504CC | Key | SC output map key for provisioned service information |
| KKSV039502CC | Key | SC output map key for delivery service information |
| isRcrs10G | Method | Check if the pricing course is a 10G tier course |
| isRcrsRouter10 | Method | Check if the pricing course matches a 100M speed router course |
| isRcrsRouter20 | Method | Check if the pricing course matches a 1G speed router course |
| forwardRsvClCfm | Method | Forward/router speed cancellation confirmation — the parent business method that calls this check |
| EKB8820__Q | Message Key | Warning message key displayed when router speed validation fails |
| 10G course | Business term | A 10-gigabit pricing course tier for high-speed internet service |
| KKA16701SF | Module | Course history verification screen module — handles service contract cancellation confirmation |
