# Business Logic — JKKUseStpRlsRunCC.isUseStpFukaCheck() [82 LOC]

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

## 1. Role

### JKKUseStpRlsRunCC.isUseStpFukaCheck()

This method determines whether a service contract's usage suspension revocation (利用停止解除) is **prohibited** based on the current service status and billing arrangement. It is a gatekeeping check within the broader "service contract usage suspension revocation" workflow — if it returns `true`, the revocation is blocked and the reason is recorded in the result list.

The method evaluates three distinct prohibition scenarios: (1) **Pay TV via CATV (KCN) billing group** — a hard block because CATV-delivered services cannot have their suspension reversed independently; (2) **Service in processing state** — the contract is currently being accepted (受注済), reviewed (照会済), or confirmed (締結済), so revocation must wait until processing completes; (3) **Service active or cancelled with no full-contract status** — if the service is being provided (提供中), suspended/interrupted (休止・中断中), terminated (解約済), or cancelled (キャンセル済), revocation is blocked unless a full-contract (全戸一括 / resident full-contract) arrangement exists, in which case the service contract's cancellation takes precedence.

The method implements a **guard clause / early-return pattern**: each prohibition condition sets a reason code into a hash map and flags `fuka_flg = true`, after which the forbidden-item details are appended to the target list. If none of the conditions fire, the method returns `false`, meaning the revocation is allowed and processing continues downstream. It plays the role of a **domain validation filter** shared by both `JKKUseStpRlsRunCC` (standard suspension revocation screen) and `JKKOrsjgsUseStpRlsRunCC` (order-target suspension revocation screen).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["isUseStpFukaCheck entry"])

    START --> EXTRACT["Extract eKK0081A010Hash from resultHash"]
    EXTRACT --> GET_PRC["Get prc_grp_cd from eKK0081A010Hash"]
    GET_PRC --> GET_SVC["Get svc_kei_stat from eKK0081A010Hash"]
    GET_SVC --> GET_MANS["Extract eKK0861B002Hash from resultHash"]
    GET_MANS --> CHECK_NULL{eKK0861B002Hash != null}

    CHECK_NULL -->|Yes| GET_PAY["Get KANYU_KEI_PAY_HOSHIKI_CD"]
    CHECK_NULL -->|No| CHECK_TV
    GET_PAY --> CHECK_TV{prc_grp_cd == PRC_GRP_CD_TV_KCN}

    CHECK_TV -->|Yes| SET_TV_KCN["Set fukaReson = 03 Pay TV via CATV restriction"]
    SET_TV_KCN --> SET_FLG["fuka_flg = true"]

    CHECK_TV -->|No| CHECK_STAT{svc_kei_stat in UKE SHOSA TEIK}

    CHECK_STAT -->|Yes| SET_KEITK["Set fukaReson = 02 Contract processing in progress"]
    SET_KEITK --> SET_FLG2["fuka_flg = true"]

    CHECK_STAT -->|No| CHECK_TKC{svc_kei_stat in TKC KYUS DSL CNCL}

    CHECK_TKC -->|Yes| CHECK_MANS{isMansBukken}

    CHECK_MANS -->|No| SET_IRAI["Set fukaReson = 01 Request cancellation"]
    CHECK_MANS -->|Yes| SKIP_IRAI["Skip revocation check"]
    SET_IRAI --> SET_FLG3["fuka_flg = true"]

    CHECK_TKC -->|No| CHECK_FLG{fuka_flg == true}
    SET_FLG --> CHECK_FLG
    SET_FLG2 --> CHECK_FLG
    SKIP_IRAI --> CHECK_FLG

    CHECK_FLG -->|Yes| POPULATE["Populate fukaTaiHash with contract details"]
    POPULATE --> ADD_LIST["Add fukaTaiHash to fukaUseStpRlsTrgtLst"]
    ADD_LIST --> RETURN_TRUE["return true revocation prohibited"]

    CHECK_FLG -->|No| RETURN_FALSE["return false revocation allowed"]

    RETURN_TRUE --> END(["End"])
    RETURN_FALSE --> END
```

### Constant Resolution

The following constants, defined within `JKKUseStpRlsRunCC.java`, control every conditional branch:

| Constant | Value | Business Meaning |
|----------|-------|-----------------|
| `PRC_GRP_CD_TV_KCN` | `"12"` | Price group code for Pay TV via CATV (放送向けCATV) — hard block for suspension revocation |
| `SVC_KEI_STAT_UKE` | `"010"` | Service contract status: Accepted (受注済) — processing in progress |
| `SVC_KEI_STAT_SHOSA` | `"020"` | Service contract status: Reviewed (照会済) — under review |
| `SVC_KEI_STAT_TEIK` | `"030"` | Service contract status: Confirmed/Contracted (締結済) — contract finalized |
| `SVC_KEI_STAT_TKC` | `"100"` | Service contract status: Being Provided (提供中) — active service |
| `SVC_KEI_STAT_KYUS` | `"210"` | Service contract status: Suspended/Interrupted (休止・中断中) |
| `SVC_KEI_STAT_DSL` | `"910"` | Service contract status: DSL (service-specific terminated state) |
| `SVC_KEI_STAT_CNCL` | `"920"` | Service contract status: Cancelled (キャンセル済) |
| `FUKA_RESON_RTN_IRAI_TORI` | `"01"` | Revocation prohibited reason: Request cancellation (依頼取り消し) |
| `FUKA_RESON_RTN_KEITK_CHU` | `"02"` | Revocation prohibited reason: Contract processing in progress (契約手続中) |
| `FUKA_RESON_RTN_TV_KCN` | `"03"` | Revocation prohibited reason: Pay TV via CATV restriction (有料放送向けCATV) |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `fukaUseStpRlsTrgtLst` | `ArrayList<HashMap<String, Object>>` | List of service contracts that are prohibited from suspension revocation. Items are added to this list when a prohibition condition is met. Each item is a `HashMap` containing the prohibition reason code, the billing contract number, the service contract number, and the service name. Passed by reference so the caller accumulates all prohibited items across multiple loop iterations. |
| 2 | `requestParam` | `HashMap<String, Object>` | Request parameters carrying the billing contract number (`SEIKY_KEI_NO`) needed to populate the prohibited-item detail when a prohibition is detected. Also carries any other request-level context. |
| 3 | `resultHash` | `HashMap<String, Object>` | Pre-populated result map containing cached data from prior SC (Service Component) calls. Contains `eKK0081A010` hash with service contract information (price group code, service status, service number, service name) and optionally `eKK0861B002` hash with billing arrangement information. |

**Instance fields / external state read:**
| Field | Description |
|-------|-------------|
| `TEMPLATE_ID_EKK0081A010` | Constant `"EKK0081A010"` — key used to retrieve service contract info hash from `resultHash`. |
| `FUKA_RESON` | Constant `"fuka_reson"` — key used to store the prohibition reason code in the result hash. |
| `FUKA_SEIKY_KEI_NO` | Constant `"seiky_kei_no"` — key for the billing contract number in the prohibition detail hash. |
| `FUKA_SVC_KEI_NO` | Constant `"svc_kei_no"` — key for the service contract number in the prohibition detail hash. |
| `FUKA_SVC_KEI_NAME` | Constant `"svc_kei_name"` — key for the service name in the prohibition detail hash. |
| `SEIKY_KEI_NO` | Constant `"seiky_kei_no"` — key in `requestParam` for the billing contract number. |

## 4. CRUD Operations / Called Services

This method does **not** directly invoke any external SC (Service Component) or CBS (Component Business Service) methods, nor does it perform database CRUD operations. It is a **pure in-memory validation** that reads from pre-populated `resultHash` data (fetched by prior SC calls in the caller) and writes to the `fukaUseStpRlsTrgtLst` list.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| N/A | (none) | — | — | This method performs only in-memory conditional checks and hash map operations. Data was previously fetched by the caller via `getEKK0081A010SC`, `getEKK0861B002SC` (in `JKKUseStpRlsRunCC`), or `callEKK0321B005SC` (in `JKKOrsjgsUseStpRlsRunCC`). |

**Indirect dependencies (data sources via `resultHash`):**

| Source | SC Code | Entity / DB | Access Description |
|--------|---------|-------------|--------------------|
| `eKK0081A010Hash` | EKK0081A010 | KK_T_SVC_KEI (Service contract table) | Service contract info retrieved by prior SC call — provides `prc_grp_cd` (price group code) and `svc_kei_stat` (service status) |
| `eKK0861B002Hash` | EKK0861B002 | KK_T_PAY_HOSHIKI (Billing arrangement table) | Billing arrangement info retrieved by prior SC call — provides `KANYU_KEI_PAY_HOSHIKI_CD` (payment method for usage-fee service contract) |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKSV0183 | `KKSV0183OPOperation.chshtUseStpRlsSvc` -> `JKKUseStpRlsRunCC.chshtUseStpRlsSvc` -> `JKKUseStpRlsRunCC.executeUseStpRlsMain` -> `JKKUseStpRlsRunCC.isUseStpFukaCheck` | `getEKK0081A010SC [R] KK_T_SVC_KEI`, `getEKK0861B002SC [R] KK_T_PAY_HOSHIKI` |
| 2 | Screen:KKSV0445 | `KKSV0445Operation.runUseStpRls` -> `JKKUseStpRlsRunCC.runUseStpRls` -> loop -> `JKKUseStpRlsRunCC.executeUseStpRlsMain` -> `JKKUseStpRlsRunCC.isUseStpFukaCheck` | `getEKK0081A010SC [R] KK_T_SVC_KEI`, `getEKK0861B002SC [R] KK_T_PAY_HOSHIKI`, `getEKK0321B002SC [R] KK_T_SVC_KEI_ISP` |
| 3 | Screen:KKSV0900 | `KKSV0900OPOperation.orsjgsRunUseStpRls` -> `JKKOrsjgsUseStpRlsRunCC.executeUseStpRlsMain` -> `JKKOrsjgsUseStpRlsRunCC.isUseStpFukaCheck` (duplicate method in Orsjgs class) | `getEKK0081A010SC [R] KK_T_SVC_KEI`, `getEKK0861B002SC [R] KK_T_PAY_HOSHIKI`, `callEKK0321B005SC [R] KK_T_SVC_KEI_ISP` |

**Notes:**
- KKSV0183 is the "Service Contract Usage Suspension Revocation Target Extraction OP" (サービス契約利用停止解除対象抽出OP) — a partial/concurrent revocation screen.
- KKSV0445 is the "Service Contract Usage Suspension Revocation OP" (サービス契約利用停止解除OP) — the standard revocation screen.
- KKSV0900 is the "Order-target Usage Suspension Revocation OP" (対象外利用停止解除OP) — handles revocation for out-of-target services from prior orders.
- The method is called **after** gathering service contract info (`getEKK0081A010SC` / `getEKK0861B002SC`) and **before** fetching billing/charge info (`getEKK0321B002SC` / `callEKK0321B005SC`), acting as an early gate: if revocation is prohibited, processing short-circuits and returns immediately.
- The `JKKOrsjgsUseStpRlsRunCC.isUseStpFukaCheck` is a **duplicated implementation** in the order-target variant class, functionally identical to this method.

## 6. Per-Branch Detail Blocks

**Block 1** — [LOCAL DECLARATION] (L1877)

> Initialize local variables for tracking prohibition status.

| # | Type | Code |
|---|------|------|
| 1 | SET | `fukaTaiHash = new HashMap<String, Object>()` // Hash to hold prohibition detail data |
| 2 | SET | `fuka_flg = false` // Flag: false = revocation allowed, true = revocation prohibited |

**Block 2** — [SET] Extract service contract info (L1881)

> Retrieve the pre-fetched service contract data from `resultHash`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0081A010Hash = (HashMap)resultHash.get(TEMPLATE_ID_EKK0081A010)` // [-> "EKK0081A010"] — Service contract information hash |

**Block 3** — [SET] Extract price group code and service status (L1884-1887)

> Pull two critical fields from the service contract hash to drive the decision tree.

| # | Type | Code |
|---|------|------|
| 1 | SET | `prc_grp_cd = (String)eKK0081A010Hash.get(EKK0081A010CBSMsg1List.PRC_GRP_CD)` // Price group code — determines billing method |
| 2 | SET | `svc_kei_stat = (String)eKK0081A010Hash.get(EKK0081A010CBSMsg1List.SVC_KEI_STAT)` // Service contract status code |

**Block 4** — [SET] Extract billing arrangement info (L1890)

> Retrieve the billing arrangement hash for full-contract detection.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0861B002Hash = (HashMap)resultHash.get(TEMPLATE_ID_EKK0861B002)` // [-> "EKK0861B002"] — Billing arrangement information |

**Block 5** — [SET] Initialize full-contract flag (L1892)

| # | Type | Code |
|---|------|------|
| 1 | SET | `isMansBukken = false` // True if full-contract (all households / resident full-contract) |

**Block 6** — [IF] Check if billing arrangement data exists (L1895)

> Conditionally extract payment method code if billing arrangement data is available. Note: a previous check using `PAY_HOSHIKI_CD` was removed per change request OM-2016-0000297; the current check uses `KANYU_KEI_PAY_HOSHIKI_CD` instead.

| # | Type | Code |
|---|------|------|
| 1 | IF | `eKK0861B002Hash != null` |
| 2 | SET | `payHoshikiCd = (String)eKK0861B002Hash.get(EKK0861B002CBSMsg1List.KANYU_KEI_PAY_HOSHIKI_CD)` // Payment method code for usage-fee service contract |

**Block 7** — [IF-ELSE IF-ELSE IF-ELSE IF] Prohibition check cascade (L1906-1935)

> This is the core decision logic. Branches are evaluated in priority order:
> 1. CATV Pay TV → hard block
> 2. Processing states (accepted/reviewed/confirmed) → block with "processing in progress" reason
> 3. Active/terminated/cancelled states → block with "request cancellation" reason, unless full-contract

**Block 7.1** — [IF] CATV Pay TV hard block `[PRC_GRP_CD_TV_KCN="12"]` (L1906)

> If the price group code indicates Pay TV via CATV (放送向けCATV), revocation is **always prohibited** regardless of service status. This is a hard business rule specific to CATV-delivered pay channels.

| # | Type | Code |
|---|------|------|
| 1 | IF | `PRC_GRP_CD_TV_KCN.equals(prc_grp_cd)` // [-> "12"] |
| 2 | SET | `fukaTaiHash.put(FUKA_RESON, FUKA_RESON_RTN_TV_KCN)` // [-> "03"] — Pay TV via CATV restriction |
| 3 | SET | `fuka_flg = true` // Set prohibition flag |

**Block 7.2** — [ELSE IF] Service in processing state `[UKE="010" / SHOSA="020" / TEIK="030"]` (L1912)

> If the service contract is in any of these processing states, revocation is prohibited because the contract is not yet finalized or is undergoing processing.

| # | Type | Code |
|---|------|------|
| 1 | ELSE IF | `SVC_KEI_STAT_UKE.equals(svc_kei_stat) || SVC_KEI_STAT_SHOSA.equals(svc_kei_stat) || SVC_KEI_STAT_TEIK.equals(svc_kei_stat)` // [-> "010", "020", "030"] |
| 2 | SET | `fukaTaiHash.put(FUKA_RESON, FUKA_RESON_RTN_KEITK_CHU)` // [-> "02"] — Contract processing in progress (契約手続中) |
| 3 | SET | `fuka_flg = true` // Set prohibition flag |

**Block 7.3** — [ELSE IF] Service active, suspended, terminated, or cancelled `[TKC="100" / KYUS="210" / DSL="910" / CNCL="920"]` (L1920)

> If the service is in any of these terminal or active states, revocation is prohibited **unless** this is a full-contract case. The rationale: in a full-contract scenario, the entire contract's cancellation takes priority over individual service revocation.

| # | Type | Code |
|---|------|------|
| 1 | ELSE IF | `SVC_KEI_STAT_TKC.equals(svc_kei_stat) \|\| SVC_KEI_STAT_KYUS.equals(svc_kei_stat) \|\| SVC_KEI_STAT_DSL.equals(svc_kei_stat) \|\| SVC_KEI_STAT_CNCL.equals(svc_kei_stat)` // [-> "100", "210", "910", "920"] |
| 2 | IF | `!isMansBukken` (L1930) |
| 3 | SET | `fukaTaiHash.put(FUKA_RESON, FUKA_RESON_RTN_IRAI_TORI)` // [-> "01"] — Request cancellation (依頼取り消し) |
| 4 | SET | `fuka_flg = true` // Set prohibition flag |

**Block 8** — [IF] Append prohibition details if prohibited (L1938)

> If any prohibition condition was met (`fuka_flg == true`), populate the prohibition detail hash with the billing contract number, service contract number, and service name, then add it to the target list.

| # | Type | Code |
|---|------|------|
| 1 | IF | `fuka_flg` // True if any prohibition condition was met |
| 2 | SET | `fukaTaiHash.put(FUKA_SEIKY_KEI_NO, requestParam.get(SEIKY_KEI_NO))` // [-> "seiky_kei_no"] — Billing contract number |
| 3 | SET | `fukaTaiHash.put(FUKA_SVC_KEI_NO, eKK0081A010Hash.get(EKK0081A010CBSMsg1List.SVC_KEI_NO))` // [-> "svc_kei_no"] — Service contract number |
| 4 | SET | `fukaTaiHash.put(FUKA_SVC_KEI_NAME, eKK0081A010Hash.get(EKK0081A010CBSMsg1List.SVC_CD_NM))` // [-> "svc_kei_name"] — Service name |
| 5 | SET | `fukaUseStpRlsTrgtLst.add(fukaTaiHash)` // Append prohibition detail to the target list |

**Block 9** — [RETURN] (L1946)

> Return the prohibition flag.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `fuka_flg` // false = revocation allowed, true = revocation prohibited |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|-----------------|
| 利用停止解除 (Riyō Teishi Kaijo) | Business term | Usage Suspension Revocation — the process of lifting a previously imposed service suspension, restoring full service to the subscriber |
| 利用停止解除不可 (Riyō Teishi Kaijo Fuka) | Domain concept | Revocation Prohibited — the condition where a service's suspension cannot be lifted due to business rules (active processing, service status, billing type, etc.) |
| 利用停止解除不可対象リスト (Riyō Teishi Kaijo Fuka Taishō Risuto) | Field | Prohibition Target List — the list (`fukaUseStpRlsTrgtLst`) that accumulates service contracts that cannot be revoked, along with their prohibition reasons |
| SVC_KEI_STAT (サービス契約ステータス) | Field | Service Contract Status — a code indicating the current lifecycle stage of a service contract |
| UKE (受注) | Code | Accepted — order received and registered in the system |
| SHOSA (照会) | Code | Reviewed — inquiry/confirmation under review |
| TEIK (締結) | Code | Confirmed/Contracted — contract finalized and binding |
| TKC (提供中) | Code | Being Provided — service is actively being delivered to the subscriber |
| KYUS (休止・中断) | Code | Suspended/Interrupted — service temporarily halted (not permanently cancelled) |
| DSL (910) | Code | DSL-specific terminated state — service-specific final status for DSL services |
| CNCL (キャンセル済) | Code | Cancelled — contract cancelled, service not active |
| PRC_GRP_CD (価格グループコード) | Field | Price Group Code — classifies the billing/price group for a service contract |
| PRC_GRP_CD_TV_KCN = "12" | Constant | Pay TV via CATV — indicates the service is delivered as a pay channel through CATV infrastructure |
| KANYU_KEI_PAY_HOSHIKI_CD (兼務系支払方式コード) | Field | Payment method code for usage-fee service contracts — indicates how the service is billed (e.g., combined with other services) |
| isMansBukken (全戸一括) | Field | Full-contract — indicates whether all households or all residents in a building are under a single billing arrangement |
| SEIKY_KEI_NO (請求契約番号) | Field | Billing Contract Number — the unique identifier for the billing contract |
| SVC_KEI_NO (サービス契約番号) | Field | Service Contract Number — the unique identifier for the service contract |
| SVC_CD_NM (サービス種別名称) | Field | Service Type Name — human-readable name of the service |
| FUKA_RESON (不可理由) | Field | Prohibition Reason Code — stores the reason why revocation is blocked |
| FUKA_RESON_RTN_IRAI_TORI = "01" | Constant | Request Cancellation — revocation is blocked because the original request has been cancelled |
| FUKA_RESON_RTN_KEITK_CHU = "02" | Constant | Contract Processing In Progress — revocation is blocked because the contract is still being processed |
| FUKA_RESON_RTN_TV_KCN = "03" | Constant | Pay TV via CATV Restriction — revocation is hard-blocked for CATV-delivered pay services |
| eKK0081A010 | SC Code | Service Contract Inquiry SC — retrieves service contract details including status and price group |
| eKK0861B002 | SC Code | Billing Arrangement Inquiry SC — retrieves billing/payment arrangement details |
| EKK0081A010CBSMsg1List | Class | Message list constants for EKK0081A010 SC — defines field keys like `PRC_GRP_CD`, `SVC_KEI_STAT`, `SVC_KEI_NO`, `SVC_CD_NM` |
| EKK0861B002CBSMsg1List | Class | Message list constants for EKK0861B002 SC — defines field keys like `KANYU_KEI_PAY_HOSHIKI_CD` |
| KK_T_SVC_KEI | DB Table | Service Contract table — stores service contract records |
| KK_T_PAY_HOSHIKI | DB Table | Payment Method table — stores billing arrangement and payment method data |
| KKSV0183 | Screen | Service Contract Usage Suspension Revocation Target Extraction OP — partial/concurrent revocation screen |
| KKSV0445 | Screen | Service Contract Usage Suspension Revocation OP — standard revocation screen |
| KKSV0900 | Screen | Order-target Usage Suspension Revocation OP — handles revocation for out-of-target services |
| CC | Technical term | Common Component — a shared business logic component in the Fujitsu Futurity framework |
| fuka_flg (不可フラグ) | Field | Prohibition Flag — internal boolean; `false` means revocation is allowed, `true` means it is prohibited |