# Business Logic — JKKKyoseiDslRunCC.kktkSvcKei_KyoseiDsl() [233 LOC]

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

## 1. Role

### JKKKyoseiDslRunCC.kktkSvcKei_KyoseiDsl()

This method orchestrates the **mandatory (forced) cancellation of equipment-provided service contracts** — specifically, it handles the end-to-end business process for cancelling services that were provided by Fujitsu/K-Opticom (the provider) to customers, as opposed to customer-owned services. The method is part of the bulk forced cancellation batch system that terminates active subscriptions without customer consent, typically triggered by contractual breaches, non-payment, or mass cancellations.

The method implements a **routing/dispatch design pattern**: it first resolves the service contract context by querying agreement data, then branches based on the equipment type (multi-function router / Home Gateway vs. other devices such as ONUs, tablets, or cradles) and the current service status (acceptance, service-in-progress, cancellation-in-progress, or suspension). Each branch triggers the appropriate sequence of service-component (SC) calls to cancel service contracts, update usage records, and perform optional device-level deregistration.

It serves as a **shared utility called by many screens and batch jobs**. The method is the core procedural hub within the forced-DSL-cancellation subsystem (`JKKKyoseiDslRunCC`), receiving a session handle, request parameters, and a result hash, and returning a status code. It coordinates with nine distinct service component (SC) calls, two DSL-device-check methods, and optional equipment-update and discount-contract-cancellation logic. After the 2014 ANK-2054 enhancement, it also flags whether a service-level cancellation occurred, which may cascade into the equipment-option service forced cancellation (`kkopSvcKei_KyoseiDsl`).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["kktkSvcKei_KyoseiDsl Start"])
    CALL1["callEKK0341A010SC<br/>Equipment Provision Service Agreement"]
    CHK1{"statusCode != 0?"}
    GET1["Get eKK0341A010Hash from resultHash"]
    GET_PRM["Get prm_svc_kei_no from requestParam"]
    GET_KIKI_SVC["Get kiki_svc_kei_no, kiki_svc_kei_uw_no,<br/>kiki_kaisen_uw_no from eKK0341A010Hash"]
    CHK_SVC{"kiki_svc_kei_no != null<br/>&& not empty?"}
    CMP_SVC{"prm_svc_kei_no == kiki_svc_kei_no?"}
    CHK_UW{"kiki_svc_kei_uw_no != null<br/>&& not empty?"}
    GET_EKK161["Get eKK0161B004HashList from resultHash"]
    CHK_EKK161{"eKK0161B004HashList == null?"}
    CALL_EKK161["callEKK0161B004SC<br/>Service Detail List"]
    LOOP_EKK161["Loop: check kiki_svc_kei_uw_no ==<br/>SVC_KEI_UCWK_NO"]
    CHK_KAISEN{"kiki_kaisen_uw_no != null<br/>&& not empty?"}
    CALL_EKK251["callEKK0251B001SC<br/>Service Line Detail List"]
    LOOP_EKK251["Loop: check kiki_kaisen_uw_no ==<br/>SVC_KEI_KAISEN_UCWK_NO"]
    NO_MATCH["syoriFlg = false<br/>return 0 (No processing)"]
    MATCH["syoriFlg = true<br/>Match found"]
    CHK_DSL{"isDslTrgtByKaisucwk<br/>(DSL line device check)"}
    CHK_DSL_VONU{"isDslTrgtKaisucwkVonu<br/>(DSL line ONU check)"}
    GET_KKTK_STAT["Get kktk_svc_kei_stat"]
    CALL_EKK771["callEKK0771A010SC<br/>Equipment Provision Service Agreement"]
    GET_KKTK_CD["Get kktk_svc_cd"]
    CHK_SVC_CD{"kktk_svc_cd ends with<br/>C024 TAKINORT or<br/>C025 HGW?"}
    EXEC_UPD["executekkopUsekkUpdCC<br/>Equipment Lease Usage Update"]
    CHK_UKE_SHO{"kktk_svc_kei_stat is 010 UKE<br/>or 020 SHOSA?"}
    CALL_C330["callEKK0341C330SC<br/>Service Contract Cancellation"]
    SET_STAT1["Set svcKeiUpdDtm from C330"]
    SET_CANCEL1["isKktkSvcCancel = true"]
    CHK_ACTIVE{"kktk_svc_kei_stat is 030 TEIK,<br/>100 TKC, 220 STP, or 210 KYUS?"}
    CALL_C340["callEKK0341C340SC<br/>Service Contract Cancellation"]
    SET_STAT2["Set svcKeiUpdDtm from C340"]
    CALL_C350["callEKK0341C350SC<br/>Service Contract Cancellation Confirmation"]
    SET_STAT3["Set svcKeiUpdDtm from C350"]
    SET_CANCEL2["isKktkSvcCancel = true"]
    ADD_TANKI["addTaknkikiInfoList<br/>Add short-term device info"]
    CHK_IS_CANCEL{"isKktkSvcCancel == true?"}
    CALL_KKOP["kkopSvcKei_KyoseiDsl<br/>Equipment Option Service Cancellation"]
    GET_EKK0081["Get eKK0081A010Hash from resultHash"]
    GET_PRC["Get prc_grp_cd"]
    CHK_NET{"prc_grp_cd is 02 HM, 03 MZ, or 04 MN?"}
    CHK_PLUG{"kktkSvcCd is C021 TABLET or C022 CRADLE?"}
    CALL_KAPP["kappu_cancel<br/>Discount Contract Cancellation"]
    END_NODE(["Return 0"])

    START --> CALL1 --> CHK1 -->|Yes| NO_MATCH
    CHK1 -->|No| GET1 --> GET_PRM --> GET_KIKI_SVC --> CHK_SVC
    CHK_SVC -->|Yes| CMP_SVC
    CMP_SVC -->|Yes| MATCH
    CMP_SVC -->|No| CHK_UW
    CHK_SVC -->|No| CHK_UW
    CHK_UW -->|Yes| GET_EKK161 --> CHK_EKK161
    CHK_EKK161 -->|Yes| CALL_EKK161 --> GET_EKK161
    CHK_EKK161 -->|No| LOOP_EKK161
    LOOP_EKK161 -->|Match| MATCH
    LOOP_EKK161 -->|No match| CHK_KAISEN
    CHK_UW -->|No| CHK_KAISEN
    CHK_KAISEN -->|Yes| CALL_EKK251 --> LOOP_EKK251
    LOOP_EKK251 -->|Match| MATCH
    LOOP_EKK251 -->|No match| NO_MATCH
    CHK_KAISEN -->|No| NO_MATCH
    MATCH --> CHK_DSL -->|Yes| NO_MATCH
    CHK_DSL -->|No| CHK_DSL_VONU -->|Yes| NO_MATCH
    CHK_DSL_VONU -->|No| GET_KKTK_STAT --> CALL_EKK771 --> GET_KKTK_CD --> CHK_SVC_CD
    CHK_SVC_CD -->|Yes TAKINORT/HGW| EXEC_UPD --> CHK_UKE_SHO
    CHK_SVC_CD -->|No other| CHK_UKE_SHO
    CHK_UKE_SHO -->|Yes 010/020| CALL_C330 --> SET_STAT1 --> SET_CANCEL1 --> CHK_IS_CANCEL
    CHK_UKE_SHO -->|No other| CHK_ACTIVE
    CHK_ACTIVE -->|Yes 030/100/220/210| CALL_C340 --> SET_STAT2 --> CALL_C350 --> SET_STAT3 --> SET_CANCEL2 --> ADD_TANKI --> CHK_IS_CANCEL
    CHK_ACTIVE -->|No| CHK_IS_CANCEL
    CHK_IS_CANCEL -->|Yes| CALL_KKOP --> END_NODE
    CHK_IS_CANCEL -->|No| GET_EKK0081 --> GET_PRC --> CHK_NET -->|Yes net| CHK_PLUG
    CHK_NET -->|No| END_NODE
    CHK_PLUG -->|Yes tablet/cradle| CALL_KAPP --> END_NODE
    CHK_PLUG -->|No| END_NODE
```

### Processing Overview

The method executes the following high-level steps:

1. **Query the equipment-provided service agreement** (`callEKK0341A010SC`) to retrieve the service contract details including service number (`svc_kei_no`), service detail work number (`svc_kei_ucwk_no`), and service line detail number (`svc_kei_kaisen_ucwk_no`).

2. **Resolve the service contract context** by comparing the request parameter's service number against the retrieved agreement data. If the service number does not directly match, it falls back to matching via the service detail work number (querying `callEKK0161B004SC`) or the service line detail number (querying `callEKK0251B001SC`). If no match is found, the method returns `0` immediately — no processing is performed for non-matching contracts.

3. **Check if the device is DSL-line-attached** (either a regular DSL router or a VONU). If so, the method returns `0` without performing the forced cancellation, because DSL-line devices require separate device-level deregistration handling.

4. **Query the equipment provision service agreement again** (`callEKK0771A010SC`) and then branch based on the **equipment type**:
   - **Multi-function router (Takinort, C024) or Home Gateway (HGW, C025)**: Calls `executekkopUsekkUpdCC` to update the equipment lease usage information.
   - **Other devices**: Branches further by the **service status code**:
     - **010 (Acceptance completed) / 020 (Processing)**: Calls `callEKK0341C330SC` (service contract cancellation), updates the update timestamp, and sets `isKktkSvcCancel = true`.
     - **030 (Service provision in progress), 100 (Cancellation in progress), 220 (Service suspension in progress), 210 (Service suspension)**: Calls `callEKK0341C340SC` (service contract cancellation), updates timestamp, then calls `callEKK0341C350SC` (service contract cancellation confirmation), updates timestamp again, adds short-term device info via `addTaknkikiInfoList`, and sets `isKktkSvcCancel = true`.

5. **If a service-level cancellation occurred** (`isKktkSvcCancel == true`), cascade into the equipment-option service forced cancellation (`kkopSvcKei_KyoseiDsl`).

6. **Check for discount contract cancellation** (eo Light Net services with tablet or cradle equipment): If the pricing group code indicates a net service (`02`, `03`, or `04`) and the service code is for a tablet (`C021`) or cradle (`C022`), calls `kappu_cancel` (discount contract cancellation).

7. **Return `0`** on success.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Session manager handle containing transaction context, database connections, and security credentials used throughout the cancellation processing chain. |
| 2 | `param` | `IRequestParameterReadWrite` | Parameter object carrying the model group and control map. Contains business input data such as the service number to cancel, request metadata, and validation flags. |
| 3 | `requestParam` | `HashMap<String, Object>` | Request parameter map containing the caller's input data, including `svc_kei_no` (the target service contract number) and `prc_grp_cd` (pricing group code for determining whether discount cancellation applies). |
| 4 | `resultHash` | `HashMap<String, Object>` | Output hash map shared across all SC calls. Receives results from each service component (eKK0341A010, eKK0161B004, eKK0251B001, eKK0771A010, eKK0341C330, eKK0341C340, eKK0341C350, eKK0081A010) keyed by template ID. Also modified by sub-methods. |
| 5 | `fixedText` | `String` | Fixed text template used in message construction for error reporting and audit logging during cancellation processing. |

**Instance fields / external state read by this method:**
| Field | Type | Business Description |
|-------|------|---------------------|
| `this.svcKeiUpdDtm` | `String` | Service contract update timestamp — set by SC calls (C330, C340, C350) to track when the service contract cancellation was performed. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `callEKK0341A010SC` | `EKK0341A010SC` | `KK_T_KKTK_SVC_KEI` (Equipment Provision Service Contract) | Read the equipment-provided service agreement to obtain contract details including service number, service detail work number, and service line detail number. |
| R | `callEKK0161B004SC` | `EKK0161B004SC` | `KK_T_SVC_KEI` (Service Contract Detail) | Read the service contract detail list to resolve the service detail work number when the main agreement lacks a direct service number. |
| R | `callEKK0251B001SC` | `EKK0251B001SC` | `KK_T_SVC_KEI_KAISEN` (Service Contract Line Detail) | Read the service line detail list to resolve the service line detail number when both service number and service detail work number are absent. |
| R | `callEKK0771A010SC` | `EKK0771A010SC` | `KK_T_KKTK_SVC_KEI` (Equipment Provision Service Agreement) | Re-query the equipment-provided service agreement to obtain the service status code and equipment service code (kktk_svc_cd) for routing. |
| U | `executekkopUsekkUpdCC` | `KKKopUsekkUpdSC` | `KK_T_KKOP_USEKK` (Equipment Option Usage Contract) | Update the equipment lease usage information for multi-function router or Home Gateway devices being cancelled. |
| U | `callEKK0341C330SC` | `EKK0341C330SC` | `KK_T_KKTK_SVC_KEI` (Equipment Provision Service Contract) | Execute the service contract cancellation — sets cancellation flag and updates timestamp for services in acceptance/processing status. |
| U | `callEKK0341C340SC` | `EKK0341C340SC` | `KK_T_KKTK_SVC_KEI` (Equipment Provision Service Contract) | Execute the service contract cancellation for services in active/provision/suspension status. |
| U | `callEKK0341C350SC` | `EKK0341C350SC` | `KK_T_KKTK_SVC_KEI` (Equipment Provision Service Contract) | Confirm the service contract cancellation — finalizes the cancellation state and updates the timestamp. |
| C | `addTaknkikiInfoList` | — | — (in-memory list) | Add short-term device information to the parameter list after successful cancellation confirmation for active service contracts. |
| R | `isDslTrgtByKaisucwk` | — | — | Determine whether the device is attached to a DSL line (by service line detail number), to skip forced cancellation for DSL-line devices. |
| R | `isDslTrgtKaisucwkVonu` | — | — | Determine whether the device is a VONU attached to a DSL line, to skip forced cancellation for DSL-line VONUs. |
| R | `kkopSvcKei_KyoseiDsl` | — | `KK_T_KKOP_SVC_KEI` (Equipment Option Service Contract) | Cascade into equipment-option service forced cancellation when a service-level cancellation was performed. |
| U | `kappu_cancel` | — | `KK_T_PRG_SVC_KEI` (Discount Service Contract) | Cancel the discount contract for tablet or cradle equipment on eo Light Net services. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `executeKyoseiDslProc()` | `executeKyoseiDslProc()` → `kktkSvcKei_KyoseiDsl()` | `kappu_cancel [U] KK_T_PRG_SVC_KEI`, `kkopSvcKei_KyoseiDsl [U] KK_T_KKOP_SVC_KEI`, `addTaknkikiInfoList [C]`, `callEKK0341C350SC [U] KK_T_KKTK_SVC_KEI`, `callEKK0341C340SC [U] KK_T_KKTK_SVC_KEI`, `callEKK0341C330SC [U] KK_T_KKTK_SVC_KEI`, `executekkopUsekkUpdCC [U] KK_T_KKOP_USEKK`, `callEKK0771A010SC [R] KK_T_KKTK_SVC_KEI`, `callEKK0251B001SC [R] KK_T_SVC_KEI_KAISEN`, `callEKK0161B004SC [R] KK_T_SVC_KEI`, `callEKK0341A010SC [R] KK_T_KKTK_SVC_KEI` |

No screen/batch entry points were found within 8 hops of this method. The method is called exclusively by `executeKyoseiDslProc()` within the same class, which serves as the batch processing entry point for the forced DSL cancellation job.

## 6. Per-Branch Detail Blocks

**Block 1** — [IF] Early return on error (L2677)

> After the initial service agreement query, check for any error.

| # | Type | Code |
|---|------|------|
| 1 | SET | `statusCode = callEKK0341A010SC(param, handle, requestParam, resultHash)` // Call equipment provision service agreement |
| 2 | IF | `statusCode != 0` [L2677] |
| 3 | RETURN | `return statusCode` // Propagate error up |

**Block 2** — [SET] Extract agreement data from result hash (L2682–L2686)

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0341A010Hash = (HashMap<String, Object>)resultHash.get(TEMPLATE_ID_EKK0341A010)` |
| 2 | SET | `prm_svc_kei_no = (String)requestParam.get(SVC_KEI_NO)` [-> "svc_kei_no"] |
| 3 | SET | `kiki_svc_kei_no = (String)eKK0341A010Hash.get(EKK0341A010CBSMsg1List.SVC_KEI_NO)` |
| 4 | SET | `kiki_svc_kei_uw_no = (String)eKK0341A010Hash.get(EKK0341A010CBSMsg1List.SVC_KEI_UCWK_NO)` |
| 5 | SET | `kiki_kaisen_uw_no = (String)eKK0341A010Hash.get(EKK0341A010CBSMsg1List.SVC_KEI_KAISEN_UCWK_NO)` |

**Block 3** — [IF/ELSE-IF/ELSE] Resolve service contract via three-level fallback (L2689–L2736)

> Compare the request parameter's service number against the agreement data. If the service number does not match, fall back to matching via the service detail work number, then via the service line detail number.

**Block 3.1** — [IF] Direct service number match (L2689–L2696)

> If `kiki_svc_kei_no` is not null and not empty, compare directly with the request's `prm_svc_kei_no`.

| # | Type | Code |
|---|------|------|
| 1 | IF | `kiki_svc_kei_no != null && !"".equals(kiki_svc_kei_no)` [L2690] |
| 2 | IF | `prm_svc_kei_no.equals(kiki_svc_kei_no)` [L2693] |
| 3 | SET | `syoriFlg = true` // Direct match — processing target |

**Block 3.2** — [ELSE-IF] Match via service detail work number (L2697–L2718)

> If `kiki_svc_kei_uw_no` is not null and not empty, query the service detail list and loop through it to find a matching `svc_kei_ucwk_no`.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `kiki_svc_kei_uw_no != null && !"".equals(kiki_svc_kei_uw_no)` [L2698] |
| 2 | SET | `eKK0161B004HashList = (ArrayList<HashMap<String, Object>>)resultHash.get(TEMPLATE_ID_EKK0161B004)` [-> "EKK0161B004"] |
| 3 | IF | `eKK0161B004HashList == null` [L2700] |
| 4 | SET | `statusCode = callEKK0161B004SC(param, handle, requestParam, resultHash)` |
| 5 | IF | `statusCode != 0` [L2703] |
| 6 | RETURN | `return statusCode` |
| 7 | SET | `eKK0161B004HashList = (ArrayList<HashMap<String, Object>>)resultHash.get(TEMPLATE_ID_EKK0161B004)` |
| 8 | FOR | `for(int i=0; eKK0161B004HashList!=null && i<eKK0161B004HashList.size(); i++)` |
| 9 | IF | `kiki_svc_kei_uw_no.equals((String)eKK0161B004HashList.get(i).get(EKK0161B004CBSMsg1List.SVC_KEI_UCWK_NO))` |
| 10 | SET | `syoriFlg = true` // Service detail match |
| 11 | EXEC | `break` |

**Block 3.3** — [ELSE-IF] Match via service line detail number (L2719–L2736)

> If `kiki_kaisen_uw_no` is not null and not empty, query the service line detail list and loop through it to find a matching `svc_kei_kaisen_ucwk_no`.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `kiki_kaisen_uw_no != null && !"".equals(kiki_kaisen_uw_no)` [L2720] |
| 2 | SET | `statusCode = callEKK0251B001SC(param, handle, requestParam, resultHash)` |
| 3 | IF | `statusCode != 0` |
| 4 | RETURN | `return statusCode` |
| 5 | SET | `eKK0251B001HashList = (ArrayList<HashMap<String, Object>>)resultHash.get(TEMPLATE_ID_EKK0251B001)` |
| 6 | FOR | `for(int i=0; eKK0251B001HashList!=null && i<eKK0251B001HashList.size(); i++)` |
| 7 | IF | `kiki_kaisen_uw_no.equals((String)eKK0251B001HashList.get(i).get(EKK0251B001CBSMsg1List.SVC_KEI_KAISEN_UCWK_NO))` |
| 8 | SET | `syoriFlg = true` // Service line detail match |
| 9 | EXEC | `break` |

**Block 4** — [IF] No match found — early exit (L2738–L2740)

> If no service number, service detail work number, or service line detail number matched, return without processing.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!syoriFlg` [L2739] |
| 2 | RETURN | `return 0` // No matching contract — no processing |

**Block 5** — [IF] Skip DSL-line-attached devices — regular (L2743–L2746)

> Check if the device is attached to a DSL line. If so, return without cancellation (DSL devices require separate handling).

| # | Type | Code |
|---|------|------|
| 1 | IF | `isDslTrgtByKaisucwk(kiki_kaisen_uw_no, handle, param, requestParam, resultHash)` [L2745] |
| 2 | RETURN | `return 0` // DSL-line device — skip forced cancellation |

**Block 6** — [IF] Skip DSL-line-attached devices — VONU (L2749–L2753)

> Check if the device is a VONU (Virtual ONU) attached to a DSL line. If so, return without cancellation.

| # | Type | Code |
|---|------|------|
| 1 | IF | `isDslTrgtKaisucwkVonu(kiki_kaisen_uw_no, handle, param, requestParam, resultHash)` [L2751] |
| 2 | RETURN | `return 0` // VONU on DSL line — skip forced cancellation |

**Block 7** — [SET] Query service status and equipment code (L2756–L2769)

> Retrieve the service status code and equipment service code, then re-query the equipment provision service agreement.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kktk_svc_kei_stat = (String)eKK0341A010Hash.get(EKK0341A010CBSMsg1List.KKTK_SVC_KEI_STAT)` |
| 2 | SET | `statusCode = callEKK0771A010SC(param, handle, requestParam, resultHash)` |
| 3 | IF | `statusCode != 0` |
| 4 | RETURN | `return statusCode` |
| 5 | SET | `kktk_svc_cd = (String)eKK0341A010Hash.get(EKK0341A010CBSMsg1List.KKTK_SVC_CD)` |

**Block 8** — [IF/ELSE] Branch by equipment type (L2772–L2815)

> Determine whether the equipment is a multi-function router/Taking Router (C024) or Home Gateway (C025), which requires a special equipment lease update path, vs. other devices which follow the standard cancellation flow.

**Block 8.1** — [IF] Multi-function router or Home Gateway (L2773–L2791)

> [KKTK_SVC_CD_TAKINORT="C024"] [KKTK_SVC_CD_HGW="C025"]

| # | Type | Code |
|---|------|------|
| 1 | IF | `JKKStrConst.KKTK_SVC_CD_TAKINORT.endsWith(kktk_svc_cd) \|\| JKKStrConst.KKTK_SVC_CD_HGW.endsWith(kktk_svc_cd)` [L2773] |
| 2 | SET | `workkkopUsekkDataKey = "KKkopSvcUseKeiUpdCC"` |
| 3 | SET | `statusCode = executekkopUsekkUpdCC(handle, param, requestParam, resultHash, fixedText, workkkopUsekkDataKey)` |
| 4 | IF | `statusCode != 0` |
| 5 | RETURN | `return statusCode` |

**Block 8.2** — [ELSE] Other devices — further branch by service status (L2792–L2840)

> For non-router/non-HGW devices, branch by service status.

**Block 8.2.1** — [IF] Service in acceptance (010) or processing (020) (L2793–L2805)

> [SVC_KEI_STAT_UKE="010"] [SVC_KEI_STAT_SHOSA="020"]

| # | Type | Code |
|---|------|------|
| 1 | IF | `SVC_KEI_STAT_UKE.equals(kktk_svc_kei_stat) \|\| SVC_KEI_STAT_SHOSA.equals(kktk_svc_kei_stat)` [L2793] |
| 2 | SET | `statusCode = callEKK0341C330SC(param, handle, requestParam, resultHash)` // Service contract cancellation |
| 3 | IF | `statusCode != 0` |
| 4 | RETURN | `return statusCode` |
| 5 | SET | `eKK0341C330Hash = (HashMap<String, Object>)resultHash.get(TEMPLATE_ID_EKK0341C330)` |
| 6 | SET | `this.svcKeiUpdDtm = (String)eKK0341C330Hash.get(EKK0341C330CBSMsg.UPD_DTM)` |
| 7 | SET | `isKktkSvcCancel = true` // Flag that service-level cancellation was performed |

**Block 8.2.2** — [ELSE-IF] Service in active/suspension status (030/100/220/210) (L2807–L2833)

> [SVC_KEI_STAT_TEIK="030"] [SVC_KEI_STAT_TKC="100"] [SVC_KEI_STAT_STP="220"] [SVC_KEI_STAT_KYUS="210"]

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `SVC_KEI_STAT_TEIK.equals(kktk_svc_kei_stat) \|\| SVC_KEI_STAT_TKC.equals(kktk_svc_kei_stat) \|\| SVC_KEI_STAT_STP.equals(kktk_svc_kei_stat) \|\| SVC_KEI_STAT_KYUS.equals(kktk_svc_kei_stat)` [L2807] |
| 2 | SET | `statusCode = callEKK0341C340SC(param, handle, requestParam, resultHash)` // Service contract cancellation |
| 3 | IF | `statusCode != 0` |
| 4 | RETURN | `return statusCode` |
| 5 | SET | `eKK0341C340Hash = (HashMap<String, Object>)resultHash.get(TEMPLATE_ID_EKK0341C340)` |
| 6 | SET | `this.svcKeiUpdDtm = (String)eKK0341C340Hash.get(EKK0341C340CBSMsg.UPD_DTM)` |
| 7 | SET | `statusCode = callEKK0341C350SC(param, handle, requestParam, resultHash)` // Cancellation confirmation |
| 8 | IF | `statusCode != 0` |
| 9 | RETURN | `return statusCode` |
| 10 | SET | `eKK0341C350Hash = (HashMap<String, Object>)resultHash.get(TEMPLATE_ID_EKK0341C350)` |
| 11 | SET | `this.svcKeiUpdDtm = (String)eKK0341C350Hash.get(EKK0341C350CBSMsg.UPD_DTM)` |
| 12 | SET | `isKktkSvcCancel = true` |
| 13 | EXEC | `addTaknkikiInfoList(param, eKK0341C350Hash)` // Add short-term device info |

**Block 9** — [IF] Cascade to equipment-option service cancellation (L2843–L2845)

> If a service-level cancellation was performed (flag set in Block 8.2.1 or 8.2.2), cascade into the equipment-option service forced cancellation.

| # | Type | Code |
|---|------|------|
| 1 | IF | `isKktkSvcCancel` [L2843] |
| 2 | SET | `kkopSvcKei_KyoseiDsl(handle, param, requestParam, resultHash, fixedText, (String)eKK0341A010Hash.get(EKK0341A010CBSMsg1List.KKTK_SVC_KEI_NO))` |

**Block 10** — [IF] Discount contract cancellation for tablet/cradle (L2850–L2867)

> Check if the service belongs to an eo Light Net pricing group (02 HM, 03 MZ, 04 MN) and the equipment is a tablet (C021) or cradle (C022). If so, cancel the discount contract.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0081A010Hash = (HashMap<String, Object>)resultHash.get(TEMPLATE_ID_EKK0081A010)` |
| 2 | SET | `prc_grp_cd = (String)eKK0081A010Hash.get(EKK0081A010CBSMsg1List.PRC_GRP_CD)` |
| 3 | IF | `PRC_GRP_CD_NET_HM.equals(prc_grp_cd) \|\| PRC_GRP_CD_NET_MZ.equals(prc_grp_cd) \|\| PRC_GRP_CD_NET_MN.equals(prc_grp_cd)` [L2855] — [02=HM, 03=MZ, 04=MN] |
| 4 | SET | `kktkSvcCd = (String)eKK0341A010Hash.get(EKK0341A010CBSMsg1List.KKTK_SVC_CD)` |
| 5 | IF | `JKKSvcConst.KKTK_SVC_CD_TABLET.equals(kktkSvcCd) \|\| JKKSvcConst.KKTK_SVC_CD_CRADLE.equals(kktkSvcCd)` [C021, C022] |
| 6 | SET | `statusCode = kappu_cancel(handle, param, requestParam, resultHash)` // Discount contract cancellation |
| 7 | IF | `statusCode != 0` |
| 8 | RETURN | `return statusCode` |

**Block 11** — [RETURN] Success (L2869)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return 0` // All processing completed successfully |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `kktkSvcKei_KyoseiDsl` | Method | Equipment-provided service mandatory cancellation method |
| `svc_kei_no` | Field | Service contract number — unique identifier for a service agreement |
| `svc_kei_ucwk_no` | Field | Service detail work number — internal tracking ID for service contract line items |
| `svc_kei_kaisen_ucwk_no` | Field | Service line detail number — tracks the wiring/line-level service detail within a contract |
| `kktk_svc_kei_stat` | Field | Equipment-provided service contract status code — indicates current state of the service agreement |
| `kktk_svc_cd` | Field | Equipment-provided service code — classifies the type of equipment/service provided |
| `prc_grp_cd` | Field | Pricing group code — categorizes the billing/pricing structure for a service |
| `syoriFlg` | Field | Processing flag — boolean indicating whether the service contract matches the cancellation target |
| `isKktkSvcCancel` | Field | Equipment-provided service cancellation flag — set to true when a service-level cancellation was performed |
| `isDslTrgtByKaisucwk` | Method | DSL-line target check by service line detail number — determines if a device is attached to a DSL line |
| `isDslTrgtKaisucwkVonu` | Method | DSL-line VONU target check — determines if the device is a VONU on a DSL line |
| KKTK | Acronym | Kyouki Teikyou (Equipment Provision) — Fujitsu/K-Opticom provided equipment/service category |
| Kyosei | Business term | Mandatory/forced cancellation — service termination performed without customer consent |
| DSL | Acronym | Digital Subscriber Line — copper-wire broadband technology |
| ONU | Acronym | Optical Network Unit — fiber-optic customer-premises equipment |
| VONU | Acronym | Virtual Optical Network Unit — virtual ONU associated with a DSL service line |
| TAKINORT | Business term | Multi-function router (Taking Router) — a specific Fujitsu router model, service code C024 |
| HGW | Acronym | Home Gateway — a specific Fujitsu home gateway model, service code C025 |
| UKE (010) | Field | Uketsume-zumi (Acceptance completed) — service contract has been accepted but not yet activated |
| SHOSA (020) | Field | Shori-chuu (Processing) — service contract is being processed |
| TEIK (030) | Field | Teikyou-chuu (Service provision in progress) — service is actively being provided |
| TKC (100) | Field | Teikyou Teikyo-chuu (Cancellation in progress) — service cancellation is in progress |
| STP (220) | Field | Teishi-chuu (Service suspension in progress) — service is temporarily suspended |
| KYUS (210) | Field | Teishi (Service suspension) — service is suspended |
| NET_HM (02) | Field | eo Light Net Home & Mobile — pricing group for home/mobile fiber services |
| NET_MZ (03) | Field | eo Light Net Zone — pricing group for zone-based fiber services |
| NET_MN (04) | Field | eo Light Net Mobile — pricing group for mobile fiber services |
| TABLET (C021) | Business term | Tablet device — service code for tablet equipment provided with net services |
| CRADLE (C022) | Business term | Tablet cradle — service code for tablet cradle equipment |
| eKK0341A010SC | SC Code | Equipment Provision Service Agreement read SC |
| eKK0341C330SC | SC Code | Service Contract Cancellation SC — cancellable states (acceptance/processing) |
| eKK0341C340SC | SC Code | Service Contract Cancellation SC — active/suspension state cancellation |
| eKK0341C350SC | SC Code | Service Contract Cancellation Confirmation SC — finalizes cancellation |
| eKK0771A010SC | SC Code | Equipment Provision Service Agreement (status query) SC |
| kappu_cancel | Method | Discount contract cancellation — cancels promotional/discount service agreements |
| kkopSvcKei_KyoseiDsl | Method | Equipment-option service forced cancellation — cascades when service-level cancellation occurs |
| eKK0161B004SC | SC Code | Service Detail List read SC — queries service contract detail records |
| eKK0251B001SC | SC Code | Service Line Detail List read SC — queries service line detail records |
| eKK0081A010 | Template | Pricing group / service classification query template |
| EXECUTE | — | (Executed) |
| addTaknkikiInfoList | Method | Adds short-term device information to the cancellation result after confirmation |
