# Business Logic — JKKOrsjgsUseStpRunCC.svcKei_UseStp() [199 LOC]

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

## 1. Role

### JKKOrsjgsUseStpRunCC.svcKei_UseStp()

This method implements the **distributor service contract suspension workflow** (卸先事業者サービス契約利用停止 — "wholesaler/agent service contract usage suspension"). It is invoked when a wholesale distributor's service contract needs to be suspended (i.e., the distributor's ability to use the service is halted, but the contract itself is not yet terminated).

The method orchestrates a multi-step process: first, it validates the target service contract against an agreed-upon consultation result (from `EKK0321A010`), then retrieves the actual service agreement to obtain pricing group code and service status. It only proceeds if the service is actively running (`TKC = "100"`) or paused (`PAUSE = "210"`). Once validated, it suspends the top-level service agreement via `callEKK0081C050SC`, then iterates over all service agreement detail lines. For each active or paused detail, it performs an agreement consultation (`EKK0161A010`), suspends the detail (`EKK0161C040`), and conditionally decides whether to issue a Service Order Data (SOD) record. For non-active details, it delegates to `hakkoSodUcwk` to handle SOD issuance for number-change scenarios (番号変更 — "number change").

The method implements a **gateway-dispatch pattern**: the initial target-data check (`isSvcKeiTargetData`) acts as a guard gate, and the per-detail branching (active/paused vs. delivered vs. other) dispatches different business logic paths. SOD issuance is handled through a decision helper (`judgeHakkoSod`) that determines whether a downstream service order must be emitted. The `hakkoSODDataList` output parameter accumulates all SOD data that will be consumed by downstream processing.

This method is a **shared utility** called from `runUseStpProc()` within the same class, serving as the core service-termination processing for wholesale distributor contracts. It supports multiple service types: FTTH (fiber-to-the-home), mobile services (e-Mobile, Wi-Fi, UQ), and other telecommunications services classified by `prc_grp_cd` (e.g., net, mobile, TV).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["svcKei_UseStp(params)"])

    START --> INIT["Set statusCode = 0"]
    INIT --> GET_CONSULT["Get eKK0321A010Hash = resultHash[TEMPLATE_ID_EKK0321A010]"]
    GET_CONSULT --> GET_SVC_NO["Get svc_kei_no from eKK0321A010Hash[SVC_KEI_NO]"]
    GET_SVC_NO --> CHECK_TARGET{"isSvcKeiTargetData(prm_svc_kei_no, svc_kei_no)?"}
    CHECK_TARGET -- false --> RET_TARGET["Return statusCode (0) - not a target"]
    CHECK_TARGET -- true --> CALL_AGR_CONSULT["callEKK0081A010SC(param, handle, requestParam, resultHash, svc_kei_no)"]
    CALL_AGR_CONSULT --> CHECK_SC_FLG{"statusCode != 0?"}
    CHECK_SC_FLG -- true --> RET_SC_ERR["Return statusCode (error)"]
    CHECK_SC_FLG -- false --> GET_PRCSVC["Get prc_grp_cd and svc_kei_stat from eKK0081A010Hash"]
    GET_PRCSVC --> CHECK_STATE{"svc_kei_stat == 100 (TKC) or 210 (PAUSE)?"}
    CHECK_STATE -- false --> RET_STATE["Return statusCode (0) - not active/paused"]
    CHECK_STATE -- true --> CALL_SUSP["callEKK0081C050SC(param, handle, requestParam, resultHash)"]
    CALL_SUSP --> CHECK_SUSP_FLG{"statusCode != 0?"}
    CHECK_SUSP_FLG -- true --> RET_SUSP_ERR["Return statusCode (error)"]
    CHECK_SUSP_FLG -- false --> SET_EXEC_FLG["requestParam.put(SVC_KEI_USE_STP_EXEC_FLG = true)"]
    SET_EXEC_FLG --> CALL_DET_LIST["callEKK0161B004SC(param, handle, requestParam, resultHash, svc_kei_no)"]
    CALL_DET_LIST --> CHECK_DET_FLG{"statusCode != 0?"}
    CHECK_DET_FLG -- true --> RET_DET_ERR["Return statusCode (error)"]
    CHECK_DET_FLG -- false --> GET_DET_LIST["Get eKK0161B004HashList from resultHash[TEMPLATE_ID_EKK0161B004]"]
    GET_DET_LIST --> CHECK_LIST{"list.size() > 0?"}

    CHECK_LIST -- true --> LOOP_START["For each detail in list"]
    CHECK_LIST -- false --> ELSE_BLOCK

    subgraph DETAIL_LOOP["Loop: For each service agreement detail"]
        LOOP_START --> GET_DETAIL["Get svc_kei_ucwk_no, svc_kei_ucwk_stat from detail hash"]
        GET_DETAIL --> CHECK_DETAIL_STATE{"svc_kei_ucwk_stat == 100 (TKC) or 210 (PAUSE)?"}

        CHECK_DETAIL_STATE -- true --> CHECK_EMOBILE{"prc_grp_cd == 08 (MOB_EM)?"}
        CHECK_EMOBILE -- true --> GET_EMOBILE["eMobileSodKbn = getEMobileSodKbn(svc_kei_stat, svc_kei_ucwk_stat)"]
        CHECK_EMOBILE -- false --> GET_EMOBILE
        GET_EMOBILE --> CALL_AGREE["callEKK0161A010SC(param, handle, svc_kei_ucwk_no, resultHash)"]
        CALL_AGREE --> CHECK_AGREE_FLG{"statusCode != 0?"}
        CHECK_AGREE_FLG -- true --> RET_AGREE_ERR["Return statusCode (error)"]
        CHECK_AGREE_FLG -- false --> CALL_DETAIL_SUSP["callEKK0161C040SC(param, handle, eKK0161A010Hash, resultHash)"]
        CALL_DETAIL_SUSP --> CHECK_SUSP_FLG2{"statusCode != 0?"}
        CHECK_SUSP_FLG2 -- true --> RET_SUSP2_ERR["Return statusCode (error)"]
        CHECK_SUSP_FLG2 -- false --> GET_DET_RESULT["Get eKK0161C040Hash from resultHash"]
        GET_DET_RESULT --> JUDGE_SOD{"judgeHakkoSod(...) returns true?"}
        JUDGE_SOD -- true --> CREATE_SOD1["Create SODData: put sysid, svc_kei_no"]
        CREATE_SOD1 --> CHECK_KBN{"0 == eMobileSodKbn or EM_UCWK == 1 or UCWK == 4?"}
        CHECK_KBN -- true --> ADD_DETAIL_FLD["Add svc_kei_ucwk_no, add_dtm from eKK0161C040Hash"]
        CHECK_KBN -- false --> ADD_SOD1["hakkoSODDataList.add(SODData)"]
        ADD_DETAIL_FLD --> ADD_SOD1
        JUDGE_SOD -- false --> SKIP_DETAIL["No SOD - skip"]
        SKIP_DETAIL --> LOOP_NEXT

        CHECK_DETAIL_STATE -- false --> CHECK_TEIK{"svc_kei_ucwk_stat == 030 (TEIK) AND net group (02/03/04)?"}
        CHECK_TEIK -- true --> CREATE_SOD2["Create SODData: put sysid, svc_kei_no, svc_kei_ucwk_no, add_dtm from eKK0161B004Hash"]
        CREATE_SOD2 --> ADD_SOD2["hakkoSODDataList.add(SODData)"]
        ADD_SOD2 --> LOOP_NEXT
        CHECK_TEIK -- false --> CALL_HAKKO["hakkoSodUcwk(param, handle, requestParam, resultHash, detailHash, prc_grp_cd, hakkoSODDataList)"]
        CALL_HAKKO --> LOOP_NEXT
        ADD_SOD1 --> LOOP_NEXT
        LOOP_NEXT["Next iteration"]
        LOOP_NEXT --> LOOP_START
    end

    ELSE_BLOCK["If list empty: Check svc_kei_stat != 210 (PAUSE)"]
    ELSE_BLOCK --> CHECK_ELSE{"svc_kei_stat != PAUSE?"}
    CHECK_ELSE -- true --> CREATE_SOD3["Create SODData: put sysid, svc_kei_no"]
    CHECK_ELSE -- false --> ELSE_SKIP["No action - is paused"]
    CREATE_SOD3 --> ADD_SOD3["hakkoSODDataList.add(SODData)"]
    ADD_SOD3 --> RET_SUCCESS["Return 0 (success)"]
    ELSE_SKIP --> RET_SUCCESS
    RET_SUCCESS --> END_NODE(["End"])
```

### Key Business Rules Reflected in Flow

1. **Target Data Check**: The method first checks if the input service contract number (`prm_svc_kei_no`) matches the actual contract number from the consultation result. If not, it returns immediately (no-op).

2. **Active/Paused Gate**: Service suspension processing only proceeds if the contract status is "service providing" (TKC = "100") or "paused/interrupted" (PAUSE = "210"). All other statuses (delivered, canceled, etc.) are skipped.

3. **Per-Detail Processing**: For each service agreement detail line:
   - **Active/Paused details**: Consultation → Suspension → SOD issuance decision
   - **Delivered + net group**: SOD issuance (completed contract scenario for network services)
   - **Other (number-change)**: Delegates to `hakkoSodUcwk` for SOD issuance during number changes

4. **e-Mobile Branch**: When the pricing group is mobile e-Mobile (`prc_grp_cd == "08"`), the method calls `getEMobileSodKbn` to determine the e-Mobile SOD issuance classification, which controls what fields are populated in the SOD data.

5. **Empty List Handling**: If there are no detail lines, it checks whether the contract is in a non-paused state and creates an SOD record at the top level.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle carrying connection context, transaction state, and system identifiers. Used for all service component invocations and SOD processing. |
| 2 | `param` | `IRequestParameterReadWrite` | Request parameter object carrying model group data and control map. Used to invoke service components and passed through to `hakkoSodUcwk`. |
| 3 | `requestParam` | `HashMap<String, Object>` | Request parameter map passed to service components. A flag `SVC_KEI_USE_STP_EXEC_FLG` is set to `true` before the detail list query, signaling that service agreement suspension is actively being executed. |
| 4 | `resultHash` | `HashMap<String, Object>` | Result hash map that accumulates return values from service component calls. Populated with `eKK0321A010Hash`, `eKK0081A010Hash`, `eKK0161A010Hash`, `eKK0161C040Hash`, and others during processing. |
| 5 | `hakkoSODDataList` | `ArrayList<HashMap<String, Object>>` | Output list accumulating SOD (Service Order Data) records to be issued downstream. Each entry is a HashMap containing `INFO_SYSID`, `INFO_SVC_KEI_NO`, and optionally `INFO_SVC_KEI_UCWK_NO` and `INFO_CHAF_SVC_KEI_UCWK_GENE_ADD_DTM`. |
| 6 | `prm_svc_kei_no` | `String` | Target service contract number to be suspended. This is the service contract ID that the caller requests to have its usage stopped. Used in the target data check (`isSvcKeiTargetData`) and passed to `callEKK0161B004SC` to fetch details. |

### Instance Fields Read

| Field | Type | Business Description |
|-------|------|---------------------|
| `oPE_DATE` | `String` | Operation date — runtime date for business processing (read but not modified in this method). |
| `wk_Fuka_flg` | `boolean` | Processing result flag — indicates whether processing is in a non-eligible state (read but not modified in this method). |
| `SVC_KEI_STAT_TKC` | `static final String = "100"` | Service status "service providing" — the gate condition for processing. |
| `SVC_KEI_STAT_PAUSE` | `static final String = "210"` | Service status "paused/interrupted" — the alternate gate condition. |
| `SVC_KEI_STAT_TEIK` | `static final String = "030"` | Service status "delivered/completed" — used to detect completed contracts eligible for SOD. |
| `SVC_KEI_USE_STP_EXEC_FLG` | `static final String = "svc_kei_use_stp_exec_flg"` | Flag key set in `requestParam` to indicate suspension execution is active. |
| `EMOBILE_SOD_KBN_EM_UCWK` | `static final int = 1` | e-Mobile SOD classification: EM detail line active. |
| `EMOBILE_SOD_KBN_EM` | `static final int = 2` | e-Mobile SOD classification: EM top-level active. |
| `EMOBILE_SOD_KBN_NONE` | `static final int = 3` | e-Mobile SOD classification: none applicable. |
| `EMOBILE_SOD_KBN_UCWK` | `static final int = 4` | e-Mobile SOD classification: UCWK detail line active. |
| `TEMPLATE_ID_EKK0321A010` | `static final String = "EKK0321A010"` | Template ID for billing inquiry consultation. |
| `TEMPLATE_ID_EKK0081A010` | `static final String = "EKK0081A010"` | Template ID for service agreement consultation. |
| `TEMPLATE_ID_EKK0161A010` | `static final String = "EKK0161A010"` | Template ID for service agreement detail consultation. |
| `TEMPLATE_ID_EKK0161B004` | `static final String = "EKK0161B004"` | Template ID for service agreement detail list. |
| `TEMPLATE_ID_EKK0161C040` | `static final String = "EKK0161C040"` | Template ID for service agreement detail suspension result. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `callEKK0321A010SC` | EKK0321A010SC | E_KK_T_SEIKY (Billing Inquiry Table) | Reads billing consultation result to obtain the actual service contract number (`svc_kei_no`) from the `EKK0321A010` template hash. The result is stored in `resultHash` and used for target data validation. |
| R | `callEKK0081A010SC` | EKK0081A010SC | E_KK_T_SVC_KEI (Service Agreement Table) | Reads service agreement consultation. Retrieves pricing group code (`prc_grp_cd`) and service contract status (`svc_kei_stat`) for the contract being suspended. Used to gate processing and determine SOD issuance. |
| U | `callEKK0081C050SC` | EKK0081C050SC | E_KK_T_SVC_KEI (Service Agreement Table) | **Service Agreement Suspension** — Updates the top-level service agreement record to suspension status. Sets `SVC_KEI_USE_STP_EXEC_FLG` in `requestParam` immediately after. |
| R | `callEKK0161B004SC` | EKK0161B004SC | E_KK_T_SVC_KEI_UCWK (Service Agreement Detail Table) | Reads the list of all service agreement detail lines for the given `svc_kei_no`. Each detail has its own status and will be processed individually. |
| R | `callEKK0161A010SC` | EKK0161A010SC | E_KK_T_SVC_KEI_UCWK (Service Agreement Detail Table) | For each active/paused detail, reads the detail agreement consultation data before suspending it. The result hash (`eKK0161A010Hash`) is passed to the suspension call. |
| U | `callEKK0161C040SC` | EKK0161C040SC | E_KK_T_SVC_KEI_UCWK (Service Agreement Detail Table) | **Service Agreement Detail Suspension** — Suspends each individual detail line. Sets the detail to suspension status and populates the result hash with suspension results. |
| R | `getEMobileSodKbn` | Internal | - | Internal helper that classifies e-Mobile SOD issuance based on top-level and detail status combinations. Returns `EMOBILE_SOD_KBN_*` constants. |
| - | `judgeHakkoSod` | Internal | - | Internal SOD issuance decision helper. Returns `true` if a Service Order Data record should be created for the detail line, based on business rules. |
| C | `hakkoSodUcwk` | - | SOD tables | Delegates SOD issuance for number-change scenarios. Creates SOD records when the detail line has been delivered or is in another non-active state that requires SOD processing. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Class:JKKOrsjgsUseStpRunCC | `runUseStpProc()` → `svcKei_UseStp(handle, param, requestParam, resultHash, hakkoSODDataList, prm_svc_kei_no)` | `hakkoSodUcwk [C] SOD`, `judgeHakkoSod [-]`, `getEMobileSodKbn [R]`, `callEKK0161C040SC [U] E_KK_T_SVC_KEI_UCWK`, `callEKK0161A010SC [R] E_KK_T_SVC_KEI_UCWK`, `callEKK0161B004SC [R] E_KK_T_SVC_KEI_UCWK`, `callEKK0081C050SC [U] E_KK_T_SVC_KEI`, `callEKK0081A010SC [R] E_KK_T_SVC_KEI`, `callEKK0321A010SC [R] E_KK_T_SEIKY` |

## 6. Per-Branch Detail Blocks

### Block 1 — INIT (Status Code Setup) (L689)

> Initialize the return status code to zero.

| # | Type | Code |
|---|------|------|
| 1 | SET | `statusCode = 0` // Status code initialized |

### Block 2 — INIT (Get Billing Consultation Hash) (L694)

> Retrieve the billing consultation result hash from `resultHash` using the template ID.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0321A010Hash = (HashMap)resultHash.get(TEMPLATE_ID_EKK0321A010)` // [-> `TEMPLATE_ID_EKK0321A010` = "EKK0321A010"] |

### Block 3 — INIT (Get Service Contract Number) (L697)

> Extract the actual service contract number from the billing consultation result.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svc_kei_no = (String)eKK0321A010Hash.get(EKK0321A010CBSMsg1List.SVC_KEI_NO)` // [-> `EKK0321A010CBSMsg1List.SVC_KEI_NO`] |

### Block 4 — IF (Target Data Check) (L701)

> Check if the input service contract number is a valid target for suspension. This acts as a guard gate: if the input does not match the actual contract number, the method returns immediately.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `isSvcKeiTargetData(prm_svc_kei_no, svc_kei_no)` // Returns true if this is a valid target |
| 2 | IF | `!isSvcKeiTargetData(...)` |
| 3 | RETURN | `return statusCode;` // Not a target — no-op |

### Block 5 — CALL (Service Agreement Consultation) (L708)

> Consult the service agreement to obtain the pricing group code and current service status.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `statusCode = callEKK0081A010SC(param, handle, requestParam, resultHash, svc_kei_no)` // Service agreement consultation |
| 2 | IF | `statusCode != 0` |
| 3 | RETURN | `return statusCode;` // Error — propagate |
| 4 | SET | `eKK0081A010Hash = (HashMap)resultHash.get(TEMPLATE_ID_EKK0081A010)` // [-> `TEMPLATE_ID_EKK0081A010` = "EKK0081A010"] |

### Block 6 — INIT (Extract Pricing Group and Status) (L710-711)

> Extract the pricing group code and service contract status from the agreement consultation result.

| # | Type | Code |
|---|------|------|
| 1 | SET | `prc_grp_cd = (String)eKK0081A010Hash.get(EKK0081A010CBSMsg1List.PRC_GRP_CD)` // [-> `EKK0081A010CBSMsg1List.PRC_GRP_CD`] |
| 2 | SET | `svc_kei_stat = (String)eKK0081A010Hash.get(EKK0081A010CBSMsg1List.SVC_KEI_STAT)` // [-> `EKK0081A010CBSMsg1List.SVC_KEI_STAT`] |

### Block 7 — IF (Active/Paused Status Gate) (L717)

> Only proceed if the service contract is actively providing service or paused. This gate ensures suspension is only applied to contracts that are either live or in a suspended-but-recoverable state.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!SVC_KEI_STAT_TKC.equals(svc_kei_stat) && !SVC_KEI_STAT_PAUSE.equals(svc_kei_stat)` // [-> `SVC_KEI_STAT_TKC` = "100", `SVC_KEI_STAT_PAUSE` = "210"] |
| 2 | RETURN | `return statusCode;` // Not active/paused — no processing |

### Block 8 — CALL (Service Agreement Suspension) (L725)

> Execute the top-level service agreement suspension. This updates the main service agreement record.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `statusCode = callEKK0081C050SC(param, handle, requestParam, resultHash)` // Service agreement suspension |
| 2 | IF | `statusCode != 0` |
| 3 | RETURN | `return statusCode;` // Error — propagate |

### Block 9 — SET (Set Suspension Execution Flag) (L731)

> Set the suspension execution flag in the request parameter map to signal downstream components that suspension is active.

| # | Type | Code |
|---|------|------|
| 1 | SET | `requestParam.put(SVC_KEI_USE_STP_EXEC_FLG, true)` // [-> `SVC_KEI_USE_STP_EXEC_FLG` = "svc_kei_use_stp_exec_flg"] |

### Block 10 — CALL (Service Agreement Detail List Query) (L735)

> Retrieve all service agreement detail lines for the contract.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `statusCode = callEKK0161B004SC(param, handle, requestParam, resultHash, svc_kei_no)` // Service agreement detail list |
| 2 | IF | `statusCode != 0` |
| 3 | RETURN | `return statusCode;` // Error — propagate |
| 4 | SET | `eKK0161B004HashList = (ArrayList)resultHash.get(TEMPLATE_ID_EKK0161B004)` // [-> `TEMPLATE_ID_EKK0161B004` = "EKK0161B004"] |

### Block 11 — IF (List Empty Check) (L737)

> Branch between processing detail lines vs. handling the case where there are no details.

| # | Type | Code |
|---|------|------|
| 1 | IF | `eKK0161B004HashList.size() > 0` |
| 2 | FOR | `for(int idx_su = 0; idx_su < eKK0161B004HashList.size(); idx_su++)` |

### Block 11.1 — FOR BODY (Get Detail Data) (L742-743)

> Retrieve each service agreement detail's contract number and status.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0161B004Hash = eKK0161B004HashList.get(idx_su)` |
| 2 | SET | `svc_kei_ucwk_no = (String)eKK0161B004Hash.get(EKK0161B004CBSMsg1List.SVC_KEI_UCWK_NO)` // [-> `EKK0161B004CBSMsg1List.SVC_KEI_UCWK_NO`] |
| 3 | SET | `svc_kei_ucwk_stat = (String)eKK0161B004Hash.get(EKK0161B004CBSMsg1List.SVC_KEI_UCWK_STAT)` // [-> `EKK0161B004CBSMsg1List.SVC_KEI_UCWK_STAT`] |

### Block 11.2 — IF (Detail Active/Paused Check) (L747)

> For each detail, check if it is actively providing service or paused. These details require full consultation → suspension → SOD issuance processing.

| # | Type | Code |
|---|------|------|
| 1 | IF | `SVC_KEI_STAT_TKC.equals(svc_kei_ucwk_stat) \|\| SVC_KEI_STAT_PAUSE.equals(svc_kei_ucwk_stat)` // [-> `SVC_KEI_STAT_TKC` = "100", `SVC_KEI_STAT_PAUSE` = "210"] |

#### Block 11.2.1 — CALL (Detail Agreement Consultation) (L751)

> Consult the specific detail line agreement before suspension.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `callEKK0161A010SC(param, handle, svc_kei_ucwk_no, resultHash)` // Detail agreement consultation |
| 2 | IF | `statusCode != 0` |
| 3 | RETURN | `return statusCode;` // Error — propagate |

#### Block 11.2.2 — INIT (Get Consultation Hash) (L756)

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0161A010Hash = (HashMap)resultHash.get(TEMPLATE_ID_EKK0161A010)` // [-> `TEMPLATE_ID_EKK0161A010` = "EKK0161A010"] |

#### Block 11.2.3 — CALL (Detail Suspension) (L761)

> Suspend the specific detail line.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `statusCode = callEKK0161C040SC(param, handle, eKK0161A010Hash, resultHash)` // Detail suspension |
| 2 | IF | `statusCode != 0` |
| 3 | RETURN | `return statusCode;` // Error — propagate |

#### Block 11.2.4 — INIT (Get Suspension Result) (L767)

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0161C040Hash = (HashMap)resultHash.get(TEMPLATE_ID_EKK0161C040)` // [-> `TEMPLATE_ID_EKK0161C040` = "EKK0161C040"] |

#### Block 11.2.5 — IF (e-Mobile Classification) (L769-771)

> When the pricing group is e-Mobile, classify the e-Mobile SOD issuance type.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eMobileSodKbn = 0` |
| 2 | IF | `JKKSvcConst.PRC_GRP_CD_MOB_EM.equals(prc_grp_cd)` // [-> `JKKSvcConst.PRC_GRP_CD_MOB_EM` = "08"] |
| 3 | CALL | `eMobileSodKbn = getEMobileSodKbn(svc_kei_stat, svc_kei_ucwk_stat)` |

#### Block 11.2.6 — IF (SOD Issuance Decision) (L773)

> Decide whether to issue an SOD record based on business rules.

| # | Type | Code |
|---|------|------|
| 1 | IF | `judgeHakkoSod(param, handle, requestParam, resultHash, svc_kei_ucwk_no, prc_grp_cd, eMobileSodKbn)` |
| 2 | SET | `SODData = new HashMap<String, Object>()` |
| 3 | SET | `SODData.put(JKKHakkoSODConstCC.INFO_SYSID, eKK0081A010Hash.get(EKK0081A010CBSMsg1List.SYSID))` // [-> `INFO_SYSID` = "sysid"] |
| 4 | SET | `SODData.put(JKKHakkoSODConstCC.INFO_SVC_KEI_NO, eKK0081A010Hash.get(EKK0081A010CBSMsg1List.SVC_KEI_NO))` // [-> `INFO_SVC_KEI_NO` = "svc_kei_no"] |

##### Block 11.2.6.1 — IF (e-Mobile SOD Classification) (L777-779)

> When the e-Mobile classification is not EM detail-only, populate the detail-level fields in the SOD data.

| # | Type | Code |
|---|------|------|
| 1 | IF | `0 == eMobileSodKbn \|\| EMOBILE_SOD_KBN_EM_UCWK == eMobileSodKbn \|\| EMOBILE_SOD_KBN_UCWK == eMobileSodKbn` // [-> `EMOBILE_SOD_KBN_EM_UCWK` = 1, `EMOBILE_SOD_KBN_UCWK` = 4] |
| 2 | SET | `SODData.put(JKKHakkoSODConstCC.INFO_SVC_KEI_UCWK_NO, eKK0161C040Hash.get(EKK0161C040CBSMsg.SVC_KEI_UCWK_NO))` // [-> `INFO_SVC_KEI_UCWK_NO` = "svc_kei_ucwk_no"] |
| 3 | SET | `SODData.put(JKKHakkoSODConstCC.INFO_CHAF_SVC_KEI_UCWK_GENE_ADD_DTM, eKK0161C040Hash.get(EKK0161C040CBSMsg.GENE_ADD_DTM))` // [-> `INFO_CHAF_SVC_KEI_UCWK_GENE_ADD_DTM` = "chaf_svc_kei_ucwk_gene_add_dtm"] |

##### Block 11.2.6.2 — SET (Add SOD to List) (L781)

| # | Type | Code |
|---|------|------|
| 1 | SET | `hakkoSODDataList.add(SODData)` |

### Block 11.3 — ELSE IF (Delivered + Net Group) (L784-793)

> Handle delivered contracts on net service groups. For FTTH (net home, net metro, net mansion) services where the contract is completed (TEIK = "030"), create an SOD record at the top level.

| # | Type | Code |
|---|------|------|
| 1 | ELSE IF | `SVC_KEI_STAT_TEIK.equals(svc_kei_ucwk_stat) && (JKKSvcConst.PRC_GRP_CD_NET_HM.equals(prc_grp_cd) \|\| JKKSvcConst.PRC_GRP_CD_NET_MT.equals(prc_grp_cd) \|\| JKKSvcConst.PRC_GRP_CD_NET_MZ.equals(prc_grp_cd))` // [-> `SVC_KEI_STAT_TEIK` = "030", `PRC_GRP_CD_NET_HM` = "02", `PRC_GRP_CD_NET_MT` = "04", `PRC_GRP_CD_NET_MZ` = "03"] |
| 2 | SET | `SODData = new HashMap<String, Object>()` |
| 3 | SET | `SODData.put(JKKHakkoSODConstCC.INFO_SYSID, eKK0081A010Hash.get(EKK0081A010CBSMsg1List.SYSID))` |
| 4 | SET | `SODData.put(JKKHakkoSODConstCC.INFO_SVC_KEI_NO, eKK0081A010Hash.get(EKK0081A010CBSMsg1List.SVC_KEI_NO))` |
| 5 | SET | `SODData.put(JKKHakkoSODConstCC.INFO_SVC_KEI_UCWK_NO, eKK0161B004Hash.get(EKK0161B004CBSMsg1List.SVC_KEI_UCWK_NO))` |
| 6 | SET | `SODData.put(JKKHakkoSODConstCC.INFO_CHAF_SVC_KEI_UCWK_GENE_ADD_DTM, eKK0161B004Hash.get(EKK0161B004CBSMsg1List.GENE_ADD_DTM))` // [-> `GENE_ADD_DTM` = "gene_add_dtm"] |
| 7 | SET | `hakkoSODDataList.add(SODData)` |

### Block 11.4 — ELSE (Number Change SOD) (L796-804)

> For non-active details that are not delivered+net-group, delegate SOD issuance to `hakkoSodUcwk`. This handles number-change scenarios where SOD issuance may be required.

| # | Type | Code |
|---|------|------|
| 1 | ELSE | (number-change scenario) |
| 2 | CALL | `hakkoSodUcwk(param, handle, requestParam, resultHash, eKK0161B004Hash, prc_grp_cd, hakkoSODDataList)` |

### Block 12 — ELSE (No Detail Lines) (L808)

> When there are no service agreement detail lines, handle the top-level contract directly. Only create an SOD record if the contract is not in paused status.

| # | Type | Code |
|---|------|------|
| 1 | ELSE | (no detail lines) |
| 2 | IF | `!SVC_KEI_STAT_PAUSE.equals(svc_kei_stat)` // [-> `SVC_KEI_STAT_PAUSE` = "210"] |
| 3 | SET | `SODData = new HashMap<String, Object>()` |
| 4 | SET | `SODData.put(JKKHakkoSODConstCC.INFO_SYSID, eKK0081A010Hash.get(EKK0081A010CBSMsg1List.SYSID))` |
| 5 | SET | `SODData.put(JKKHakkoSODConstCC.INFO_SVC_KEI_NO, eKK0081A010Hash.get(EKK0081A010CBSMsg1List.SVC_KEI_NO))` |
| 6 | SET | `hakkoSODDataList.add(SODData)` |

### Block 13 — RETURN (Success) (L817)

> Return success code.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return 0;` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service contract number — unique identifier for a service contract (the "upper-level" contract that may have multiple detail lines). |
| `svc_kei_ucwk_no` | Field | Service detail contract number — unique identifier for a specific service agreement detail line (sub-contract under the main service contract). |
| `svc_kei_stat` | Field | Service contract status — code indicating the state of the service agreement (e.g., "100" = service providing, "210" = paused). |
| `svc_kei_ucwk_stat` | Field | Service detail contract status — code indicating the state of a specific detail line. |
| `prm_svc_kei_no` | Parameter | Target service contract number — the service contract ID that the caller requests to suspend. |
| `prc_grp_cd` | Field | Pricing group code — classifies the type of service (e.g., "02" = FTTH home, "08" = e-Mobile). |
| SOD | Acronym | Service Order Data — a downstream record that triggers order fulfillment actions (e.g., service provisioning changes). |
| `hakkoSODDataList` | Parameter | SOD issuance data list — output list that accumulates SOD records to be processed by downstream systems. |
| `hakkoSodUcwk` | Method | SOD issuance for number change — helper method that handles SOD creation when service numbers are changed. |
| `judgeHakkoSod` | Method | SOD issuance decision helper — determines whether an SOD record should be created for a given detail line. |
| `getEMobileSodKbn` | Method | e-Mobile SOD classification helper — classifies the type of e-Mobile SOD issuance based on service status combinations. |
| TKC | Status Code | "100" — Service Providing — the service is actively running and available to the customer. |
| PAUSE | Status Code | "210" — Paused/Interrupted — the service is suspended but may be recoverable (not fully terminated). |
| TEIK | Status Code | "030" — Delivered/Completed — the contract has been delivered and is in a completed state. |
| STP | Status Code | "220" — Suspended — the service is in a fully suspended state. |
| DKL (DSL) | Status Code | "910" — Terminated — the service contract has been fully terminated. |
| CNCL | Status Code | "920" — Canceled — the service contract has been canceled. |
| EKK0321A010 | CBS | Billing Inquiry Consultation — retrieves billing-related contract information including service contract numbers. |
| EKK0081A010 | SC | Service Agreement Consultation — reads the main service agreement record including pricing group and status. |
| EKK0081C050 | SC | Service Agreement Suspension — updates the top-level service agreement to suspension status. |
| EKK0161A010 | SC | Service Agreement Detail Consultation — reads a specific detail line's agreement data before suspension. |
| EKK0161B004 | SC | Service Agreement Detail List — retrieves all detail lines for a service contract. |
| EKK0161C040 | SC | Service Agreement Detail Suspension — updates a specific detail line to suspension status. |
| `PRC_GRP_CD_NET_HM` | Constant | Pricing group code "02" — FTTH (Fiber To The Home) home type network service. |
| `PRC_GRP_CD_NET_MT` | Constant | Pricing group code "04" — FTTH (Fiber To The Home) mansion type network service. |
| `PRC_GRP_CD_NET_MZ` | Constant | Pricing group code "03" — FTTH (Fiber To The Home) metro type network service. |
| `PRC_GRP_CD_MOB_EM` | Constant | Pricing group code "08" — e-Mobile service — mobile telecommunications service. |
| `EMOBILE_SOD_KBN_EM` | Constant | e-Mobile SOD classification "2" — EM (top-level) active. |
| `EMOBILE_SOD_KBN_EM_UCWK` | Constant | e-Mobile SOD classification "1" — EM detail line active. |
| `EMOBILE_SOD_KBN_UCWK` | Constant | e-Mobile SOD classification "4" — UCWK (detail line) active. |
| `EMOBILE_SOD_KBN_NONE` | Constant | e-Mobile SOD classification "3" — no e-Mobile SOD applicable. |
| INFO_SYSID | Constant | SOD basic info key "sysid" — system identifier stored in SOD data. |
| INFO_SVC_KEI_NO | Constant | SOD basic info key "svc_kei_no" — service contract number stored in SOD data. |
| INFO_SVC_KEI_UCWK_NO | Constant | SOD basic info key "svc_kei_ucwk_no" — service detail contract number stored in SOD data. |
| INFO_CHAF_SVC_KEI_UCWK_GENE_ADD_DTM | Constant | SOD basic info key "chaf_svc_kei_ucwk_gene_add_dtm" — generation/addition timestamp for service detail contract stored in SOD data. |
| SVC_KEI_USE_STP_EXEC_FLG | Constant | "svc_kei_use_stp_exec_flg" — flag indicating that service agreement suspension is actively being executed. |
| isSvcKeiTargetData | Method | Target data check — validates whether the input service contract number matches the actual contract and is eligible for suspension processing. |
| 卸先事業者 | Domain term | Distributor/Wholesaler — a business partner (agent) that resells the company's telecom services to end customers. |
| 利用停止 | Domain term | Usage Suspension — the business operation of halting a service contract's availability without fully terminating the contract. |
| SERVICE AGREEMENT DETAIL | Domain concept | A sub-line under a main service contract. Each detail can have its own status and be suspended independently. |
| NUMBER CHANGE (番号変更) | Domain term | Service number reassignment — scenario where a service contract's identifier is changed, requiring SOD issuance for tracking. |
