
# Business Logic — JKKOrsjgsUseStpRlsRunCC.executeSvcKei_UseStp() [240 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKOrsjgsUseStpRlsRunCC` |
| Layer | CC / Common Component (Custom business logic shared across screens and batch processes) |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKOrsjgsUseStpRlsRunCC.executeSvcKei_UseStp()

This method implements the **Service Contract Suspension Cancellation (Use Suspension Release) Process** for a Fujitsu telecom OSS/BSS system. Its primary business purpose is to reverse a previously suspended service contract, restoring it to active service provision. It first verifies that the targeted service contract (identified by `prm_svc_kei_no`) matches the contract in the preceding inquiry result (`svc_kei_no` from the EKK0321A010 template). It then queries the service contract details to confirm the contract is currently in suspended status (`"220"`), and branches cancellation handling based on the contract's pre-suspension state: if the contract was in "suspended/canceled" status (`"210"`) before the suspension, it invokes the *suspended-service cancellation* path; otherwise, it invokes the standard *suspension cancellation* path. For each service contract detail line that was individually suspended, the method iterates through all details, querying and cancelling each one individually using the same pre-suspension-state logic. When a network-type service contract line is in "agreed/completed" status (`"030"`), it queues a Service Order Data (SOD) issuance record. For Mobile EM-type services, it applies additional logic to determine whether SOD issuance is required based on the combination of pre-suspension and line-item pre-suspension states, as well as the SOD classification. This method uses a **routing/dispatch design pattern** — the same business goal (canceling a suspension) is achieved through different SC code paths depending on historical status, ensuring correct audit trail and state machine compliance. It acts as a **shared business component** called by the main suspension release orchestrator (`executeUseStpRlsMain`), used by both screen-driven and batch-driven suspension release flows.

## 2. Processing Pattern (Detailed Business Logic)

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

    START --> GetEKK0321["Get EKK0321A010 Hash"]
    GetEKK0321 --> GetSvcNo["Get svc_kei_no"]
    GetSvcNo --> CheckTarget{"isSvcKeiTargetData
check"}

    CheckTarget -->|"false"| EarlyRet1["Return statusCode"]
    CheckTarget -->|"true"| Call0081["Call getEKK0081A010SC
Svc Contract Inquiry"]

    Call0081 --> CheckStat1{statusCode != 0}
    CheckStat1 -->|"yes"| EarlyRet2["Return statusCode error"]
    CheckStat1 -->|"no"| Extract["Extract prc_grp_cd svc_kei_stat"]
    Extract --> CheckSuspend{"svc_kei_stat == 220"}

    CheckSuspend -->|"no"| EarlyRet3["Return statusCode not suspended"]
    CheckSuspend -->|"yes"| GetBeforeStat["Get useStpBfSvcKeiStat"]
    GetBeforeStat --> CheckBefore{"useStpBfSvcKeiStat == 210"}

    CheckBefore -->|"yes"| CallC061["Call getEKK0081C061SC
Suspended Cancellation"]
    CheckBefore -->|"no"| CallC060["Call getEKK0081C060SC
Suspension Cancellation"]

    CallC061 --> SetFlag["Set SVC_KEI_USE_STP_RLS_EXEC_FLG true"]
    CallC060 --> SetFlag

    SetFlag --> CallB004["Call getEKK0161B004SC
Detail List Inquiry"]

    CallB004 --> CheckStat2{statusCode != 0}
    CheckStat2 -->|"yes"| EarlyRet4["Return statusCode error"]
    CheckStat2 -->|"no"| GetDetailList["Get eKK0161B004 Hash List"]
    GetDetailList --> CheckListEmpty{List size > 0}

    CheckListEmpty -->|"no"| NoDetail["Set SODData
SYSID SVC_KEI_NO"]
    NoDetail --> AddSodEmpty["Add SODData to hakkoSODDataList"]
    AddSodEmpty --> FINISH(["Return 0"])

    CheckListEmpty -->|"yes"| ForLoop["Loop each detail"]
    ForLoop --> GetDetailFields["Get svc_kei_ucwk_no svc_kei_ucwk_stat"]
    GetDetailFields --> CheckDetailStat{"svc_kei_ucwk_stat == 220"}

    CheckDetailStat -->|"no"| CheckDetailTeik{"svc_kei_ucwk_stat == 030
and net group"}
    CheckDetailStat -->|"yes"| CallA010["Call callEKK0161A010SC
Detail Cancellation Inquiry"]

    CallA010 --> CheckStat3{statusCode != 0}
    CheckStat3 -->|"yes"| EarlyRet5["Return statusCode error"]
    CheckStat3 -->|"no"| GetA010Hash["Get EKK0161A010 Hash"]
    GetA010Hash --> GetLineItemBf["Call getUseStpBfSvcKeiStat"]
    GetLineItemBf --> GetLineStat["Get useStpBfSvcKeiUcwkStat"]

    GetLineStat --> CheckLineBefore{"useStpBfSvcKeiUcwkStat == 210"}

    CheckLineBefore -->|"yes"| CallC051["Call getEKK0161C051SC
Suspended Detail Cancellation"]
    CheckLineBefore -->|"no"| CallC050["Call getEKK0161C050SC
Detail Suspension Cancellation"]

    CallC051 --> GetC051Hash["Get EKK0161C051 Hash"]
    CallC050 --> GetC050Hash["Get EKK0161C050 Hash"]
    GetC051Hash --> GetEMobile["Determine eMobileSodKbn"]
    GetC050Hash --> GetEMobile

    GetEMobile --> CheckEMob{"prc_grp_cd == 08"}
    CheckEMob -->|"yes"| EmKbnCheck{eMobileSodKbn
in 0 1 4}
    CheckEMob -->|"no"| NonEmCheck{useStpBfSvcKeiUcwkStat == 210}

    EmKbnCheck -->|"yes"| SetHakko1["isHakkoSod true"]
    EmKbnCheck -->|"no"| SetNoHakko1["isHakkoSod false"]

    NonEmCheck -->|"yes"| SetNoHakko2["isHakkoSod false"]
    NonEmCheck -->|"no"| SetHakko2["isHakkoSod true"]

    SetNoHakko1 --> CheckHakko{isHakkoSod == true}
    SetHakko1 --> CheckHakko
    SetNoHakko2 --> CheckHakko
    SetHakko2 --> CheckHakko

    CheckHakko -->|"no"| LoopNext["Loop next item"]
    CheckHakko -->|"yes"| BuildSod["Build SODData
SYSID SVC_KEI_NO UCWK_NO GENE_ADD_DTM"]
    BuildSod --> AddSod1["Add SODData to hakkoSODDataList"]
    AddSod1 --> LoopNext

    LoopNext --> ForLoop

    CheckDetailTeik -->|"no"| LoopNext2["Loop next item"]
    CheckDetailTeik -->|"yes"| BuildNetSod["Build SODData
SYSID SVC_KEI_NO UCWK_NO GENE_ADD_DTM"]
    BuildNetSod --> AddSod2["Add SODData to hakkoSODDataList"]
    AddSod2 --> LoopNext2

    LoopNext2 --> ForLoop
```

**Constant Resolution Key:**

| Constant | Resolved Value | Business Meaning |
|----------|---------------|-----------------|
| `SVC_KEI_STAT_STP` | `"220"` | Service contract status: Suspended (利用停止中) |
| `SVC_KEI_STAT_KYUS` | `"210"` | Service contract status: Suspended/Canceled (休止・中断中) |
| `SVC_KEI_STAT_TEIK` | `"030"` | Service contract status: Agreed/Completed (接続済み) |
| `PRC_GRP_CD_NET_HM` | `"02"` | Pricing group: EO Fiber Net Home Type (FTTH Home) |
| `PRC_GRP_CD_NET_MT` | `"04"` | Pricing group: EO Fiber Net Mansion Type (FTTH Apartment) |
| `PRC_GRP_CD_NET_MZ` | `"03"` | Pricing group: EO Fiber Net Mesh Type (FTTH Mesh) |
| `PRC_GRP_CD_MOB_EM` | `"08"` | Pricing group: EO Mobile (EM) |
| `EMOBILE_SOD_KBN_NONE` | `3` | Emobile SOD Classification: None — no SOD issuance |
| `EMOBILE_SOD_KBN_EM_UCWK` | `1` | Emobile SOD Classification: EM detail line SOD |
| `EMOBILE_SOD_KBN_EM` | `2` | Emobile SOD Classification: EM-level SOD |
| `EMOBILE_SOD_KBN_UCWK` | `4` | Emobile SOD Classification: Basic detail line SOD |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Session handle carrying database connections, transaction context, and system metadata used for all SC calls and data retrieval operations. |
| 2 | `param` | `IRequestParameterReadWrite` | Request parameter object containing model groups and control maps; used as input/output carrier for all SC (Service Component) method calls within this method. |
| 3 | `requestParam` | `HashMap<String, Object>` | Request parameter map used to set business flags (e.g., `svc_kei_use_stp_rls_exec_flg = true` to indicate suspension cancellation execution) that downstream processes check. |
| 4 | `resultHash` | `HashMap<String, Object>` | Result hash map that accumulates SC query results keyed by template ID strings (e.g., `"EKK0321A010"`, `"EKK0081A010"`, `"EKK0161B004"`). This is the shared data bus between SC calls. |
| 5 | `hakkoSODDataList` | `ArrayList<HashMap<String, Object>>` | Output list used to collect Service Order Data (SOD) issuance information. Each entry is a HashMap containing `INFO_SYSID`, `INFO_SVC_KEI_NO`, optionally `INFO_SVC_KEI_UCWK_NO` and `INFO_CHAF_SVC_KEI_UCWK_GENE_ADD_DTM`. This list is consumed by the SOD issuance component. |
| 6 | `prm_svc_kei_no` | `String` | The target service contract number being processed for suspension cancellation. This is the primary business key passed into the method from the caller, used to identify which service line to operate on. |

**Internal fields referenced:**
| Field | Type | Description |
|-------|------|-------------|
| `MAP_KEY_GET_SVKEI_STAT` | `String` (`"JKKGetSvkeiStat"`) | Key for retrieving pre-suspension status data from `resultHash`. |
| `SVC_KEI_USE_STP_RLS_EXEC_FLG` | `String` (`"svc_kei_use_stp_rls_exec_flg"`) | Flag key set in `requestParam` to signal that suspension cancellation was executed. |
| `SVC_KEI_STAT_KYUS` | `String` (`"210"`) | Local constant for "suspended/canceled" service status. |
| `SVC_KEI_STAT_STP` | `String` (`"220"`) | Local constant for "suspended" service status. |
| `SVC_KEI_STAT_TEIK` | `String` (`"030"`) | Local constant for "agreed/completed" service status. |
| `EMOBILE_SOD_KBN_NONE` | `int` (`3`) | Classification constant: no Emobile SOD. |
| `EMOBILE_SOD_KBN_EM_UCWK` | `int` (`1`) | Classification constant: EM detail line SOD. |
| `EMOBILE_SOD_KBN_EM` | `int` (`2`) | Classification constant: EM-level SOD. |
| `EMOBILE_SOD_KBN_UCWK` | `int` (`4`) | Classification constant: basic detail line SOD. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JKKOrsjgsUseStpRlsRunCC.callEKK0161A010SC` | `EKK0161A010SC` | `KK_T_OPSVKEI_UCWK` (Service Contract Detail Line) | Calls SC to inquire/detail the suspension cancellation of a service contract line item. Returns EKK0161A010 template with cancellation inquiry results. |
| R | `JKKOrsjgsUseStpRlsRunCC.getEKK0081A010SC` | `EKK0081A010SC` | `KK_T_OPSVKEI` (Service Contract) | Calls SC to inquire the service contract details (pricing group code, service status). Returns EKK0081A010 template. |
| R | `JKKOrsjgsUseStpRlsRunCC.getEKK0081C060SC` | `EKK0081C060SC` | `KK_T_OPSVKEI` (Service Contract) | Calls SC to perform service contract suspension cancellation (standard path). Returns EKK0081C060 template. |
| R | `JKKOrsjgsUseStpRlsRunCC.getEKK0081C061SC` | `EKK0081C061SC` | `KK_T_OPSVKEI` (Service Contract) | Calls SC to perform service contract suspension cancellation for a contract that was in suspended/canceled status before suspension. Returns EKK0081C061 template. |
| R | `JKKOrsjgsUseStpRlsRunCC.getEKK0161B004SC` | `EKK0161B004SC` | `KK_T_OPSVKEI_UCWK` (Service Contract Detail Line) | Calls SC to retrieve the list of service contract detail lines. Returns EKK0161B004 template with a list of detail line records. |
| R | `JKKOrsjgsUseStpRlsRunCC.getEKK0161C050SC` | `EKK0161C050SC` | `KK_T_OPSVKEI_UCWK` (Service Contract Detail Line) | Calls SC to perform service contract line item suspension cancellation (standard path). Returns EKK0161C050 template. |
| R | `JKKOrsjgsUseStpRlsRunCC.getEKK0161C051SC` | `EKK0161C051SC` | `KK_T_OPSVKEI_UCWK` (Service Contract Detail Line) | Calls SC to perform service contract line item suspension cancellation for a line that was in suspended/canceled status before suspension. Returns EKK0161C051 template. |
| R | `JKKOrsjgsUseStpRlsRunCC.getEMobileSodKbn` | `JKKOrsjgsUseStpRlsRunCC.getEMobileSodKbn` | - | Internal method that computes the Emobile SOD classification code based on pre-suspension service status and line-item pre-suspension status. Returns integer classification (0, 1, 2, 3, or 4). |
| R | `JKKOrsjgsUseStpRlsRunCC.getUseStpBfSvcKeiStat` | `JKKOrsjgsUseStpRlsRunCC.getUseStpBfSvcKeiStat` | - | Internal method that retrieves the pre-suspension service status (before the suspension was applied) for the given service contract number and line item. Returns a map containing `last_kk0081_stat` and `last_kk0161_stat`. |
| - | `JKKOrsjgsUseStpRlsRunCC.isSvcKeiTargetData` | `JKKOrsjgsUseStpRlsRunCC.isSvcKeiTargetData` | - | Internal method that compares `prm_svc_kei_no` (target) against `svc_kei_no` (from preceding inquiry) to verify the correct service contract is being processed. Returns boolean. |

## 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: `getEMobileSodKbn` [R], `getEKK0161C050SC` [R], `getEKK0161C051SC` [R], `getUseStpBfSvcKeiStat` [R], `callEKK0161A010SC` [R], `getEKK0161B004SC` [R], `getEKK0081C060SC` [R], `getEKK0081C061SC` [R], `getEKK0081A010SC` [R], `isSvcKeiTargetData` [-]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Method: `JKKOrsjgsUseStpRlsRunCC.executeUseStpRlsMain()` | `executeUseStpRlsMain()` → `executeSvcKei_UseStp(handle, param, requestParam, resultHash, hakkoSODDataList, prm_svc_kei_no)` | `getEKK0081A010SC [R] KK_T_OPSVKEI`<br>`getEKK0081C060SC [R] KK_T_OPSVKEI`<br>`getEKK0081C061SC [R] KK_T_OPSVKEI`<br>`getEKK0161B004SC [R] KK_T_OPSVKEI_UCWK`<br>`callEKK0161A010SC [R] KK_T_OPSVKEI_UCWK`<br>`getEKK0161C050SC [R] KK_T_OPSVKEI_UCWK`<br>`getEKK0161C051SC [R] KK_T_OPSVKEI_UCWK` |

**Notes:**
- This method is a **common business component** called exclusively by `executeUseStpRlsMain()` within the same class (`JKKOrsjgsUseStpRlsRunCC`).
- No screen (KKSV*) or batch entry points were found within 8 hops of the call graph.
- The method does not directly invoke external CBS (CBS = Common Business Services); instead, it routes through its own internal SC wrapper methods.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Initialize status code (L836)

> Sets the initial return code. This is the default success/early-return value.

| # | Type | Code |
|---|------|------|
| 1 | SET | `statusCode = 0` // Status code, default 0 (success/early return) |

**Block 2** — [EXEC] Get EKK0321A010 Hash (L840)

> Retrieves the result of the preceding service contract inquiry from `resultHash`. The comment says: "Get settlement advance agreement result" (課金先同意照会結果取得).

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

**Block 3** — [EXEC] Get service contract number from inquiry result (L843)

> Extracts the service contract number from the EKK0321A010 result. Comment: "Get service contract number (settlement address)" (サービス契約番号取得（決済先）).

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

**Block 4** — [IF] Verify target service contract matches (L850–L858)

> Comment: "Determine if the service contract number is the target for suspension" (利用停止対象サービス契約番号か判定する). Compares the passed-in target `prm_svc_kei_no` against the inquiry result `svc_kei_no`. If they do not match, the method returns immediately — the caller should verify which contract was being targeted before calling this method.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `isSvcKeiTargetData(prm_svc_kei_no, svc_kei_no)` // Verify target contract match |
| 2 | IF | `!isSvcKeiTargetData(...)` → return statusCode |

**Block 5** — [IF-ELSE] Conditional early return when not matching (L854)

> If the target service contract number does not match the inquiry result, skip all processing.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return statusCode` // (L856) — contract mismatch, abort |

**Block 6** — [EXEC] Service contract inquiry (L860–L867)

> Comment: "Service contract agreement inquiry" (サービス契約同意照会). Calls the SC to fetch current service contract details including status and pricing group.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `statusCode = getEKK0081A010SC(param, handle, requestParam, resultHash, svc_kei_no)` // Service contract inquiry |
| 2 | IF | `statusCode != 0` → return statusCode (error path) |

**Block 7** — [EXEC] Extract fields from EKK0081A010 result (L869–L874)

> Comment: "Get price group code" (料金グルーコード取得) and "Get service contract status" (サービス契約ステータス取得).

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0081A010Hash = (HashMap) resultHash.get(TEMPLATE_ID_EKK0081A010)` // [-> `TEMPLATE_ID_EKK0081A010 = "EKK0081A010"`] |
| 2 | SET | `prc_grp_cd = (String) eKK0081A010Hash.get(EKK0081A010CBSMsg1List.PRC_GRP_CD)` // Pricing group code |
| 3 | SET | `svc_kei_stat = (String) eKK0081A010Hash.get(EKK0081A010CBSMsg1List.SVC_KEI_STAT)` // Service contract status |

**Block 8** — [IF] Check if service is suspended (L878–L884)

> Comment: "If not suspended" (停止外の場合). The service contract must be in suspended status (`"220"`) to proceed with suspension cancellation. If not, return immediately.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!SVC_KEI_STAT_STP.equals(svc_kei_stat)` [`SVC_KEI_STAT_STP = "220"` (Suspended)] → return statusCode |

**Block 9** — [IF-ELSE] Pre-suspension state branching for service contract (L906–L936)

> The method retrieves the pre-suspension service status. If the contract was in "suspended/canceled" (`"210"`) status before suspension, it follows the **suspended-service cancellation** path (休止中サービス契約停止解除). Otherwise, it follows the **standard suspension cancellation** path (サービス契約停止解除).

| # | Type | Code |
|---|------|------|
| 1 | SET | `svkeiStatMap = (HashMap) resultHash.get(MAP_KEY_GET_SVKEI_STAT)` // [-> `MAP_KEY_GET_SVKEI_STAT = "JKKGetSvkeiStat"`] |
| 2 | SET | `useStpBfSvcKeiStat = (String) svkeiStatMap.get(JKKGetSvkeiStatConstCC.LAST_KK0081_STAT)` // [-> `LAST_KK0081_STAT = "last_kk0081_stat"`] |
| 3 | IF | `SVC_KEI_STAT_KYUS.equals(useStpBfSvcKeiStat)` [`SVC_KEI_STAT_KYUS = "210"` (Suspended/Canceled)] |

**Block 9.1** — [IF branch] Suspended-service cancellation (L913–L921)

> Comment: "Suspended service contract suspension cancellation" (休止中サービス契約停止解除). The contract was in suspended/canceled status before the suspension was applied, requiring a special cancellation flow.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `statusCode = getEKK0081C061SC(param, handle, requestParam, resultHash)` // Suspended service cancellation |
| 2 | IF | `statusCode != 0` → return statusCode |

**Block 9.2** — [ELSE branch] Standard suspension cancellation (L926–L934)

> Comment: "Service contract suspension cancellation" (サービス契約停止解除). The contract was in active status before suspension, using the standard cancellation flow.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `statusCode = getEKK0081C060SC(param, handle, requestParam, resultHash)` // Standard suspension cancellation |
| 2 | IF | `statusCode != 0` → return statusCode |

**Block 10** — [SET] Set execution flag (L937)

> Comment: "Service contract use suspension execution flag" (サービス契約利用停止実施フラグ). Sets a flag in `requestParam` that downstream processes check to know suspension cancellation was executed.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `requestParam.put(SVC_KEI_USE_STP_RLS_EXEC_FLG, (Boolean)true)` // [-> `SVC_KEI_USE_STP_RLS_EXEC_FLG = "svc_kei_use_stp_rls_exec_flg"`] |

**Block 11** — [EXEC] Service contract detail list inquiry (L940–L949)

> Comment: "Service contract detail list inquiry" (サービス契約内訳一覧照会). Retrieves all detail lines (sub-items) of the service contract so each suspended line item can be processed individually.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `statusCode = getEKK0161B004SC(param, handle, requestParam, resultHash, svc_kei_no)` |
| 2 | IF | `statusCode != 0` → return statusCode |

**Block 12** — [EXEC] Get detail list (L951)

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0161B004HashList = (ArrayList) resultHash.get(TEMPLATE_ID_EKK0161B004)` // [-> `TEMPLATE_ID_EKK0161B004 = "EKK0161B004"`] |

**Block 13** — [IF] Check if detail list is non-empty (L953–L1046)

> The method branches into two major paths: (a) when there are detail lines — iterate through each one; (b) when there are no detail lines — build a minimal SOD data entry with just the service contract-level data.

**Block 13.1** — [IF branch] Detail lines exist (L954–L1044)

**Block 13.1.A** — [FOR] Loop through detail lines (L957–L1043)

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0161B004Hash = eKK0161B004HashList.get(idx_su)` // Current detail line |
| 2 | SET | `svc_kei_ucwk_no = (String) eKK0161B004Hash.get(EKK0161B004CBSMsg1List.SVC_KEI_UCWK_NO)` // Service contract detail number |
| 3 | SET | `svc_kei_ucwk_stat = (String) eKK0161B004Hash.get(EKK0161B004CBSMsg1List.SVC_KEI_UCWK_STAT)` // Service contract detail status |

**Block 13.1.A.1** — [IF] Detail line is suspended (L962–L1030)

> Comment: "If suspended" (停止中の場合). The detail line is in suspended status and needs cancellation processing.

| # | Type | Code |
|---|------|------|
| 1 | IF | `SVC_KEI_STAT_STP.equals(svc_kei_ucwk_stat)` [`"220"` (Suspended)] |

**Block 13.1.A.1.1** — [EXEC] Detail cancellation inquiry (L967–L971)

> Comment: "Service contract detail agreement inquiry" (サービス契約内訳同意照会). Queries the detail line cancellation to prepare for the cancellation operation.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `callEKK0161A010SC(param, handle, svc_kei_ucwk_no, resultHash)` |
| 2 | IF | `statusCode != 0` → return statusCode |

**Block 13.1.A.1.2** — [EXEC] Get detail inquiry result (L973)

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

**Block 13.1.A.1.3** — [EXEC] Get pre-suspension line item status (L977)

> Comment: "Get service contract detail suspension cancellation result" (サービス契約内訳停止解除結果取得) and "Get service contract detail status before suspension" (利用停止前のサービス契約内訳ステータスを取得).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `svkeiStatMap = getUseStpBfSvcKeiStat(handle, param, prm_svc_kei_no, svc_kei_ucwk_no)` |
| 2 | SET | `useStpBfSvcKeiUcwkStat = (String) svkeiStatMap.get(JKKGetSvkeiStatConstCC.LAST_KK0161_STAT)` // [-> `LAST_KK0161_STAT = "last_kk0161_stat"`] |

**Block 13.1.A.1.4** — [IF-ELSE] Pre-suspension line item state branching (L980–L1009)

> Similar to Block 9: if the line item was in suspended/canceled status (`"210"`) before suspension, use the suspended-service cancellation path; otherwise use the standard path.

| # | Type | Code |
|---|------|------|
| 1 | IF | `SVC_KEI_STAT_KYUS.equals(useStpBfSvcKeiUcwkStat)` [`"210"` (Suspended/Canceled)] |

**Block 13.1.A.1.4.1** — [IF branch] Suspended line item cancellation (L987–L994)

> Comment: "Suspended service contract detail suspension cancellation" (休止中サービス契約内訳停止解除).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `statusCode = getEKK0161C051SC(param, handle, eKK0161A010Hash, resultHash)` |
| 2 | IF | `statusCode != 0` → return statusCode |
| 3 | SET | `eKK0161C05XHash = (HashMap) resultHash.get(TEMPLATE_ID_EKK0161C051)` // [-> `TEMPLATE_ID_EKK0161C051 = "EKK0161C051"`] |

**Block 13.1.A.1.4.2** — [ELSE branch] Standard line item cancellation (L999–L1006)

> Comment: "Service contract detail suspension cancellation" (サービス契約内訳停止解除).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `statusCode = getEKK0161C050SC(param, handle, eKK0161A010Hash, resultHash)` |
| 2 | IF | `statusCode != 0` → return statusCode |
| 3 | SET | `eKK0161C05XHash = (HashMap) resultHash.get(TEMPLATE_ID_EKK0161C050)` // [-> `TEMPLATE_ID_EKK0161C050 = "EKK0161C050"`] |

**Block 13.1.A.1.5** — [SET] Initialize SOD issuance decision (L1008)

> Comment: none explicit. Default to `isHakkoSod = true`, `eMobileSodKbn = 0`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `isHakkoSod = true` // Initialize: SOD issuance needed |
| 2 | SET | `eMobileSodKbn = 0` // Default SOD classification code |

**Block 13.1.A.1.6** — [IF-ELSE] Determine Emobile SOD classification (L1009–L1028)

> If the pricing group is EM mobile (`"08"`), compute the SOD classification code based on pre-suspension statuses. For non-EM pricing groups, set `isHakkoSod = false` if the line item was in suspended/canceled status (`"210"`) before suspension.

| # | Type | Code |
|---|------|------|
| 1 | IF | `JKKSvcConst.PRC_GRP_CD_MOB_EM.equals(prc_grp_cd)` [`"08"` (EO Mobile EM)] |

**Block 13.1.A.1.6.1** — [IF branch] EM mobile pricing group (L1010–L1016)

> Calls `getEMobileSodKbn()` to determine whether SOD issuance is needed based on the Emobile-specific classification rules.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eMobileSodKbn = getEMobileSodKbn(useStpBfSvcKeiStat, useStpBfSvcKeiUcwkStat)` |
| 2 | IF | `EMOBILE_SOD_KBN_NONE == eMobileSodKbn` [`3`] → `isHakkoSod = false` |

**Block 13.1.A.1.6.2** — [ELSE branch] Non-EM pricing group (L1018–L1025)

> For non-EM pricing groups, SOD issuance is skipped if the line item was in suspended/canceled status (`"210"`) before suspension.

| # | Type | Code |
|---|------|------|
| 1 | IF | `SVC_KEI_STAT_KYUS.equals(useStpBfSvcKeiUcwkStat)` [`"210"`] → `isHakkoSod = false` |

**Block 13.1.A.1.7** — [IF] Build and queue SOD data (L1029–L1035)

> If SOD issuance is needed (`isHakkoSod = true`), build a SOD data HashMap and add it to the output list. For basic (non-EM) or specific EM classifications (`0`, `1`, `4`), include the detail line number and generation timestamp from the cancellation result.

| # | Type | Code |
|---|------|------|
| 1 | IF | `isHakkoSod` → build SODData |
| 1.1 | SET | `SODData = new HashMap<String, Object>()` |
| 1.2 | SET | `SODData.put(JKKHakkoSODConstCC.INFO_SYSID, eKK0081A010Hash.get(...SYSID))` |
| 1.3 | SET | `SODData.put(JKKHakkoSODConstCC.INFO_SVC_KEI_NO, eKK0081A010Hash.get(...SVC_KEI_NO))` |
| 1.4 | IF | `0 == eMobileSodKbn \|\| EMOBILE_SOD_KBN_EM_UCWK == eMobileSodKbn \|\| EMOBILE_SOD_KBN_UCWK == eMobileSodKbn` → put `INFO_SVC_KEI_UCWK_NO` and `INFO_CHAF_SVC_KEI_UCWK_GENE_ADD_DTM` from `eKK0161C05XHash` |
| 1.5 | EXEC | `hakkoSODDataList.add(SODData)` |

**Block 13.1.A.2** — [ELSE-IF] Detail line is "agreed/completed" + net pricing group (L1037–L1046)

> Comment: "Handle network service change suspension" (ネットの変更中利用停止に対応) and "When service is 'net' and agreed/completed" (サービスが"ネット"かつ接続済みの場合). For network-type services (FTTH Home=02, FTTH Apartment=03, FTTH Mesh=04) that are in agreed/completed status (`"030"`), build SOD data using the current (non-canceled) detail line information.

| # | Type | Code |
|---|------|------|
| 1 | IF | `SVC_KEI_STAT_TEIK.equals(svc_kei_ucwk_stat)` [`"030"` (Agreed/Completed)] AND net pricing group check |
| 1.1 | SET | `SODData = new HashMap<String, Object>()` |
| 1.2 | SET | `SODData.put(INFO_SYSID, eKK0081A010Hash.get(SYSID))` |
| 1.3 | SET | `SODData.put(INFO_SVC_KEI_NO, eKK0081A010Hash.get(SVC_KEI_NO))` |
| 1.4 | SET | `SODData.put(INFO_SVC_KEI_UCWK_NO, eKK0161B004Hash.get(EKK0161B004CBSMsg1List.SVC_KEI_UCWK_NO))` |
| 1.5 | SET | `SODData.put(INFO_CHAF_SVC_KEI_UCWK_GENE_ADD_DTM, eKK0161B004Hash.get(EKK0161B004CBSMsg1List.GENE_ADD_DTM))` |
| 1.6 | EXEC | `hakkoSODDataList.add(SODData)` |

**Block 13.1.A.3** — [ELSE] Skip non-targeted detail lines (L1050)

> Comment: "Otherwise, not a processing target" (以外の場合、処理対象外). Detail lines that are neither suspended nor (net + agreed) are skipped via `continue`.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `continue` // Skip this detail line iteration |

**Block 13.2** — [ELSE branch] No detail lines (L1048–L1054)

> When the service contract has no detail lines, build a minimal SOD data entry with only the service contract level information (SYSID and SVC_KEI_NO).

| # | Type | Code |
|---|------|------|
| 1 | SET | `SODData = new HashMap<String, Object>()` |
| 2 | SET | `SODData.put(INFO_SYSID, eKK0081A010Hash.get(SYSID))` |
| 3 | SET | `SODData.put(INFO_SVC_KEI_NO, eKK0081A010Hash.get(SVC_KEI_NO))` |
| 4 | EXEC | `hakkoSODDataList.add(SODData)` |

**Block 14** — [RETURN] Return success (L1056)

> Always returns `0` indicating successful processing.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return 0` // Success |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service contract number — unique identifier for a service contract (e.g., FTTH line, mobile plan) |
| `svc_kei_stat` | Field | Service contract status — current state of the service contract (e.g., "100"=provisioning, "220"=suspended, "030"=agreed/completed) |
| `svc_kei_ucwk_no` | Field | Service contract detail work number — unique identifier for a detail line/item within a service contract |
| `svc_kei_ucwk_stat` | Field | Service contract detail status — current state of a detail line item |
| `prm_svc_kei_no` | Field | Target service contract number — the service contract being operated on by the caller |
| `prc_grp_cd` | Field | Pricing group code — classifies the type of pricing plan (e.g., "02"=FTTH Home, "08"=Mobile EM, "04"=FTTH Apartment) |
| `useStpBfSvcKeiStat` | Field | Pre-suspension service contract status — the status of the service contract before the suspension was applied |
| `useStpBfSvcKeiUcwkStat` | Field | Pre-suspension service contract detail status — the status of a detail line before suspension |
| `hakkoSODDataList` | Field | SOD issuance data list — output list of Service Order Data records to be processed by downstream SOD issuance |
| `SVC_KEI_STAT_STP` | Constant | Service contract status: "220" — Suspended (利用停止中) |
| `SVC_KEI_STAT_KYUS` | Constant | Service contract status: "210" — Suspended/Canceled (休止・中断中) |
| `SVC_KEI_STAT_TEIK` | Constant | Service contract status: "030" — Agreed/Completed (接続済み) |
| `PRC_GRP_CD_NET_HM` | Constant | Pricing group: "02" — EO Fiber Net Home Type (FTTH Home, ホームタイプ) |
| `PRC_GRP_CD_NET_MT` | Constant | Pricing group: "04" — EO Fiber Net Mansion Type (FTTH Apartment, マンションタイプ) |
| `PRC_GRP_CD_NET_MZ` | Constant | Pricing group: "03" — EO Fiber Net Mesh Type (FTTH Mesh, メッシュタイプ) |
| `PRC_GRP_CD_MOB_EM` | Constant | Pricing group: "08" — EO Mobile (EM) |
| `EMOBILE_SOD_KBN_NONE` | Constant | Emobile SOD classification: "3" — No SOD issuance required |
| `EMOBILE_SOD_KBN_EM_UCWK` | Constant | Emobile SOD classification: "1" — EM detail line SOD |
| `EMOBILE_SOD_KBN_EM` | Constant | Emobile SOD classification: "2" — EM-level SOD |
| `EMOBILE_SOD_KBN_UCWK` | Constant | Emobile SOD classification: "4" — Basic detail line SOD |
| SOD | Acronym | Service Order Data — telecom order fulfillment entity used for service provisioning workflows |
| SC | Acronym | Service Component — a service layer class that handles database queries and business logic invocations |
| CBS | Acronym | Common Business Service — a shared business service, often used in Fujitsu's middleware architecture |
| FTTH | Business term | Fiber To The Home — fiber-optic broadband internet service type |
| EKK | Acronym | Fujitsu internal SC naming prefix (e.g., EKK0081A010SC) — typically denotes Service Contract related operations |
| KK_T_OPSVKEI | Entity | Service contract master table — stores main service contract records |
| KK_T_OPSVKEI_UCWK | Entity | Service contract detail line table — stores detail line/sub-item records within a service contract |
| `INFO_SYSID` | Field | System ID — identifies the system that generated the SOD data |
| `INFO_CHAF_SVC_KEI_UCWK_GENE_ADD_DTM` | Field | Chaf service contract detail generation addition date/time — timestamp of when the detail line was generated, used for SOD issuance tracking |
| `MAP_KEY_GET_SVKEI_STAT` | Constant | Map key: "JKKGetSvkeiStat" — key to retrieve pre-suspension status data from resultHash |
| `SVC_KEI_USE_STP_RLS_EXEC_FLG` | Constant | Flag key: "svc_kei_use_stp_rls_exec_flg" — indicates suspension cancellation was executed |
| `isHakkoSod` | Variable | SOD issuance flag — determines whether a Service Order Data record should be queued for issuance |
| `eMobileSodKbn` | Variable | Emobile SOD classification — integer code (0-4) classifying what type of SOD is needed for EM mobile services |
