# Business Logic — JBSbatKKMiStcKikiInfStku.isSvcStat() [18 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKMiStcKikiInfStku` |
| Layer | Service |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKMiStcKikiInfStku.isSvcStat()

The `isSvcStat` method performs a business status determination for a service contract. In the telecom order fulfillment domain, every service contract (e.g., FTTH, DSL, mail service) has an associated status code that describes its current lifecycle stage. This method checks whether the given contract status falls into one of three active or transitional states: "030" (Contracting Completed — the contract has been finalized and is fully executed), "100" (Service Provisioning — the service is currently active and being provided to the customer), or "110" (Contract Modification — a change is being made to the existing contract). If the status matches any of these values, the method returns `true`, signaling that the service is in a valid state for further processing such as routing, provisioning, or modification. Otherwise, it returns `false`. This method serves as a shared utility predicate called within the same class's `executeKktkSvcNo` method to gate downstream logic, ensuring that only contracts in acceptable states proceed to service-number assignment or routing.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["isSvcStat db_map stat_key"])
    START --> GET_SVC_STAT["Get svc_stat from db_map.getString stat_key and Rtrim"]
    GET_SVC_STAT --> COND{svc_stat equals
SVC_KEI_STAT_CNC_ZM
or SVC_KEI_STAT_SVCCHG_CHU
or SVC_KEI_STAT_SVCTK_CHU}
    COND --> |Yes| RETURN_TRUE["Return true"]
    COND --> |No| RETURN_FALSE["Return false"]
    RETURN_TRUE --> END(("End"))
    RETURN_FALSE --> END
```

**CRITICAL — Constant Resolution:**

| Constant | Actual Value | Business Meaning |
|----------|-------------|------------------|
| `JBSbatKKConst.SVC_KEI_STAT_CNC_ZM` | `"030"` | Contracting Completed (締結済) — the contract is finalized and fully executed |
| `JBSbatKKConst.SVC_KEI_STAT_SVCTK_CHU` | `"100"` | Service Provisioning (サービス提供中) — the service is currently active and being delivered to the customer |
| `JBSbatKKConst.SVC_KEI_STAT_SVCCHG_CHU` | `"110"` | Contract Modification (契約変更中) — an existing contract is undergoing modification |

The method was refactored in v22.00.00 to consolidate three previously separate status checks. Earlier versions (v7.00.01 through v21.x) used local constants `KEI_STAT_CNC` and `KEI_STAT_CHG`, and an intermediate version (v22.00.00 change start) added `KEI_STAT_SVCTKCHU` before migrating to the centralized `JBSbatKKConst` constants shown above.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `db_map` | `JBSbatCommonDBInterface` | A database map interface containing the search result data. It holds key-value pairs where keys correspond to database field names or entity property identifiers. The method uses it to retrieve the service contract status value via `getString(stat_key)`. |
| 2 | `stat_key` | `String` | The key (field name / map key) used to look up the service contract status value within the `db_map`. It identifies which field in the search result data represents the current contract status code. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `db_map.getString(stat_key)` | — | — | Reads the contract status value from the database map using the provided key |
| - | `JBSbatStringUtil.Rtrim(...)` | — | — | Trims trailing whitespace from the retrieved status string |

The method performs a single data read (`getString`) from the provided `db_map` interface, then applies a string utility (`Rtrim`) to normalize whitespace. No database tables, SC (Service Component) codes, or CBS (Common Business Service) calls are directly invoked — this is a pure predicate method that operates on already-fetched data.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: `Rtrim` [-], `getString` [R]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `executeKktkSvcNo` (Batch processing method) | `executeKktkSvcNo` → `isSvcStat(db_map, stat_key)` | `getString` [R] — reads contract status from db_map |

The `isSvcStat` method is a private utility called internally by `executeKktkSvcNo` within the same class. The `executeKktkSvcNo` method is invoked multiple times (routed through `KKTK_SVC_KEI_NO_ROUTER` and various `KKTK_SVC_KEI_NO_PLC_*` keys) during batch service-number processing, where it gates downstream logic based on whether the service contract is in a valid active or transitional state.

## 6. Per-Branch Detail Blocks

**Block 1** — IF `[condition: svc_stat matches any of three contract statuses]` (L792)

> Retrieves and normalizes the service contract status from the database map, then evaluates it against three accepted status values.

| # | Type | Code |
|---|------|------|
| 1 | SET | `String svc_stat = JBSbatStringUtil.Rtrim(db_map.getString(stat_key))` | `Rtrim` removes trailing whitespace from the status string retrieved from the database map using the provided `stat_key` |
| 2 | IF | `if (svc_stat.equals(JBSbatKKConst.SVC_KEI_STAT_CNC_ZM) || JBSbatKKConst.SVC_KEI_STAT_SVCCHG_CHU.equals(svc_stat) || JBSbatKKConst.SVC_KEI_STAT_SVCTK_CHU.equals(svc_stat))` | `[-> SVC_KEI_STAT_CNC_ZM = "030" (Contracting Completed)] [-> SVC_KEI_STAT_SVCCHG_CHU = "110" (Contract Modification)] [-> SVC_KEI_STAT_SVCTK_CHU = "100" (Service Provisioning)]` |
| 3 | RETURN | `return true;` | Contract status is in an acceptable state (contracting completed, service provisioning, or contract modification) — allow downstream processing |

**Block 2** — ELSE `[default: status does not match any accepted value]` (L805)

> Returns `false` for any status value that does not match the three accepted contract states (e.g., suspension, termination, or other inactive statuses).

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return false;` | Contract status is NOT in an acceptable state — block further processing |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_stat` | Variable | Service contract status — the current lifecycle state of a service contract, stored as a numeric string code |
| `stat_key` | Parameter | Status key — the field name or map key used to look up the service contract status value in the database result map |
| `db_map` | Parameter | Database result map — a key-value interface holding search result data returned from a database query |
| `SVC_KEI_STAT_CNC_ZM` | Constant | Service contract status - Contracting Completed (締結済) — code `"030"`, indicates the contract has been fully executed |
| `SVC_KEI_STAT_SVCTK_CHU` | Constant | Service contract status - Service Provisioning (サービス提供中) — code `"100"`, indicates the service is actively being delivered |
| `SVC_KEI_STAT_SVCCHG_CHU` | Constant | Service contract status - Contract Modification (契約変更中) — code `"110"`, indicates an existing contract is being modified |
| `Rtrim` | Utility | Right-trim — removes trailing whitespace from a string |
| `isSvcStat` | Method | Is Service Status — determines whether a service contract is in an acceptable state for further processing |
| `executeKktkSvcNo` | Method | Execute KK TK Service No — batch method that assigns service numbers, gated by status checks |
| KKTK | Abbreviation | KK (likely "Keiyaku" / 契約, contract) TK (likely "Teiki" / 定額, regular monthly fee) SVC NO — service number assignment context |
| `JBSbatKKConst` | Class | KK business constants — centralized constant definitions for the KK (contract/keiyaku) domain |
| `JBSbatStringUtil` | Class | String utility — provides string manipulation methods including `Rtrim` |
| `JBSbatCommonDBInterface` | Interface | Common database interface — abstract interface for accessing database result data via key-value operations |
