# Business Logic — JBSbatKKMiStcKikiInfStku.getStatNm() [50 LOC]

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

## 1. Role

### JBSbatKKMiStcKikiInfStku.getStatNm()

This method translates a service contract status code (`stat_key`) into its human-readable display name. It operates as a shared utility called by batch processing entry points (`executeKKtkAndUcwk`, `executeKktkSvcNo`) within `JBSbatKKMiStcKikiInfStku`, enabling consistent status-name rendering across multiple batch report and data-display scenarios. The method implements a routing/dispatch pattern: it retrieves the raw status code from the passed data map, trims whitespace, and then dispatches through five conditional branches, each mapping a specific service contract status code (e.g., "010", "020", "910", "920", "110") to its Japanese display name (e.g., "受付済" meaning Accepted, "照査済" meaning Verified, "解約済" meaning Terminated, "キャンセル済" meaning Cancelled, "契約変更中" meaning Contract Change in Progress). If none of the known codes match, the method falls back to returning the raw code unchanged, ensuring no null or empty results are ever produced. The method was updated in v22.00.00 to use the canonical `JBSbatKKConst.SVC_KEI_STAT_*` constants, replacing deprecated `KEI_STAT_*` constants that were kept as commented-out legacy code.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["getStatNm(db_map, stat_key)"])
    TRIM["TRIM stat_cd from db_map.getString(stat_key)"]
    INIT["INIT stat_nm = stat_cd (fallback to raw code)"]

    START --> TRIM --> INIT

    INIT --> COND{"stat_cd value"}

    COND -->|SVC_KEI_STAT_UK_ZM = 010| SET1["SET stat_nm to Accepted"]
    COND -->|SVC_KEI_STAT_SHOSA_ZM = 020| SET2["SET stat_nm to Verified"]
    COND -->|SVC_KEI_STAT_DLS_ZM = 910| SET3["SET stat_nm to Terminated"]
    COND -->|SVC_KEI_STAT_CNCL_ZM = 920| SET4["SET stat_nm to Cancelled"]
    COND -->|SVC_KEI_STAT_SVCCHG_CHU = 110| SET5["SET stat_nm to Contract Change in Progress"]
    COND -->|otherwise| NOOP["No branch matches - stat_nm retains stat_cd"]

    SET1 --> RETURN(["Return stat_nm"])
    SET2 --> RETURN
    SET3 --> RETURN
    SET4 --> RETURN
    SET5 --> RETURN
    NOOP --> RETURN
```

**CRITICAL — Constant Resolution:**
All five conditional branches reference constants from `JBSbatKKConst`:
- `SVC_KEI_STAT_UK_ZM = "010"` — Service contract status: Accepted (受付済)
- `SVC_KEI_STAT_SHOSA_ZM = "020"` — Service contract status: Verified (照査済)
- `SVC_KEI_STAT_DLS_ZM = "910"` — Service contract status: Terminated (解約済)
- `SVC_KEI_STAT_CNCL_ZM = "920"` — Service contract status: Cancelled (キャンセル済)
- `SVC_KEI_STAT_SVCCHG_CHU = "110"` — Service contract status: Contract Change in Progress (契約変更中)

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `db_map` | `JBSbatCommonDBInterface` | A data map interface containing search results from the database. It holds the raw service contract status code under the key specified by `stat_key`. The method retrieves the value via `getString(stat_key)` and trims whitespace using `JBSbatStringUtil.Rtrim`. |
| 2 | `stat_key` | `String` | The key (column name or map key) that identifies where the service contract status code is stored within `db_map`. This key references a field in the database result set that holds a 3-digit status code such as "010", "020", "910", "920", or "110". |

No instance fields or external state are read by this method.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JBSbatFUCaseFileRnkData.getString` | JBSbatFUCaseFileRnkData | - | Calls `getString` in `JBSbatFUCaseFileRnkData` |
| R | `JBSbatFUMoveNaviData.getString` | JBSbatFUMoveNaviData | - | Calls `getString` in `JBSbatFUMoveNaviData` |
| R | `JBSbatZMAdDataSet.getString` | JBSbatZMAdDataSet | - | Calls `getString` in `JBSbatZMAdDataSet` |
| R | `JESC0101B010TPMA.getString` | JESC0101B010TPMA | - | Calls `getString` in `JESC0101B010TPMA` |
| R | `JESC0101B020TPMA.getString` | JESC0101B020TPMA | - | Calls `getString` in `JESC0101B020TPMA` |
| - | `JBSbatStringUtil.Rtrim` | JBSbatStringUtil | - | Calls `Rtrim` utility method to trim whitespace |
| - | `JBSbatInterface.Rtrim` | JBSbatInterface | - | Calls `Rtrim` in `JBSbatInterface` |
| - | `JPCEditString.Rtrim` | JPCEditString | - | Calls `Rtrim` in `JPCEditString` |
| - | `JPCUtilCommon.Rtrim` | JPCUtilCommon | - | Calls `Rtrim` in `JPCUtilCommon` |

**Method-specific analysis:**

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `db_map.getString(stat_key)` | (param method) | - | Reads the raw status code value from the data map using the provided key |
| - | `JBSbatStringUtil.Rtrim(...)` | (utility) | - | Trims leading/trailing whitespace from the retrieved status code string |

No Create, Update, or Delete operations are performed. This method is purely a read-only transformation utility.

## 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: `Rtrim` [-], `getString` [R]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS: JBSbatKKMiStcKikiInfStku | `executeKKtkAndUcwk()` -> `getStatNm(db_map, stat_key)` | `getString[R] db_map, Rtrim[-] JBSbatStringUtil` |
| 2 | CBS: JBSbatKKMiStcKikiInfStku | `executeKktkSvcNo()` -> `getStatNm(db_map, stat_key)` | `getString[R] db_map, Rtrim[-] JBSbatStringUtil` |

**Instructions:**
Both callers are CBS (Common Business Service) methods within the same class `JBSbatKKMiStcKikiInfStku`. They are batch processing entry points invoked as part of the KK (presumably a business unit or service line) batch job flow.

## 6. Per-Branch Detail Blocks

**Block 1** — SET `(initialization)` (L1153)

> Retrieve and normalize the status code from the data map, then initialize the display name with the raw code as a fallback.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `stat_cd = JBSbatStringUtil.Rtrim(db_map.getString(stat_key))` // Retrieve status code from map and trim whitespace [-> String] |
| 2 | SET | `stat_nm = stat_cd` // Initialize display name; raw code used as fallback if no branch matches [-> String] |

**Block 2** — IF-ELSE-IF chain `(SVC_KEI_STAT_UK_ZM = "010" — Accepted)` (L1169)

> Maps the "Accepted" status code "010" to its Japanese display name "受付済" (meaning the service contract has been received/accepted).

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (JBSbatKKConst.SVC_KEI_STAT_UK_ZM.equals(stat_cd))` [-> `SVC_KEI_STAT_UK_ZM = "010" (Accepted)`] |
| 2 | SET | `stat_nm = "受付済"` // "Accepted" — the contract has been received [-> String] |

**Block 3** — ELSE-IF `(SVC_KEI_STAT_SHOSA_ZM = "020" — Verified)` (L1173)

> Maps the "Verified" status code "020" to its Japanese display name "照査済" (meaning the contract has been reviewed/verified).

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `else if (JBSbatKKConst.SVC_KEI_STAT_SHOSA_ZM.equals(stat_cd))` [-> `SVC_KEI_STAT_SHOSA_ZM = "020" (Verified)`] |
| 2 | SET | `stat_nm = "照査済"` // "Verified" — the contract has been reviewed and verified [-> String] |

**Block 4** — ELSE-IF `(SVC_KEI_STAT_DLS_ZM = "910" — Terminated)` (L1177)

> Maps the "Terminated" status code "910" to its Japanese display name "解約済" (meaning the contract has been terminated/cancelled by the customer).

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `else if (JBSbatKKConst.SVC_KEI_STAT_DLS_ZM.equals(stat_cd))` [-> `SVC_KEI_STAT_DLS_ZM = "910" (Terminated)`] |
| 2 | SET | `stat_nm = "解約済"` // "Terminated" — the contract has been terminated [-> String] |

**Block 5** — ELSE-IF `(SVC_KEI_STAT_CNCL_ZM = "920" — Cancelled)` (L1181)

> Maps the "Cancelled" status code "920" to its Japanese display name "キャンセル済" (meaning the contract has been cancelled, e.g., due to order cancellation).

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `else if (JBSbatKKConst.SVC_KEI_STAT_CNCL_ZM.equals(stat_cd))` [-> `SVC_KEI_STAT_CNCL_ZM = "920" (Cancelled)`] |
| 2 | SET | `stat_nm = "キャンセル済"` // "Cancelled" — the contract has been cancelled [-> String] |

**Block 6** — ELSE-IF `(SVC_KEI_STAT_SVCCHG_CHU = "110" — Contract Change in Progress)` (L1185)

> Maps the "Contract Change in Progress" status code "110" to its Japanese display name "契約変更中" (meaning a modification is being processed on the existing contract).

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `else if (JBSbatKKConst.SVC_KEI_STAT_SVCCHG_CHU.equals(stat_cd))` [-> `SVC_KEI_STAT_SVCCHG_CHU = "110" (Contract Change in Progress)`] |
| 2 | SET | `stat_nm = "契約変更中"` // "Contract Change in Progress" — a contract modification is being processed [-> String] |

**Block 7** — RETURN `(stat_nm)` (L1190)

> Returns the resolved status name. If none of the five conditional branches matched, the original raw code is returned as-is.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return stat_nm;` // Returns the human-readable status name, or the raw code if no match [-> String] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `SVC_KEI_STAT_UK_ZM` | Constant | Service Contract Status — Accepted (受付済); code "010" |
| `SVC_KEI_STAT_SHOSA_ZM` | Constant | Service Contract Status — Verified (照査済); code "020" |
| `SVC_KEI_STAT_DLS_ZM` | Constant | Service Contract Status — Terminated (解約済); code "910" |
| `SVC_KEI_STAT_CNCL_ZM` | Constant | Service Contract Status — Cancelled (キャンセル済); code "920" |
| `SVC_KEI_STAT_SVCCHG_CHU` | Constant | Service Contract Status — Contract Change in Progress (契約変更中); code "110" |
| `stat_cd` | Variable | Status Code — the raw 3-digit service contract status code retrieved from the data map |
| `stat_nm` | Variable | Status Name — the human-readable Japanese display name mapped from the status code |
| `stat_key` | Parameter | Status Key — the map key identifying where the status code is stored in the data map |
| `db_map` | Parameter | Data Map — a `JBSbatCommonDBInterface` object containing database search result data |
| 受付済 (UK-ZM) | Business term | Accepted — the service contract has been received and accepted into the system |
| 照査済 (SHOSA-ZM) | Business term | Verified — the service contract has been reviewed and verified |
| 解約済 (DLS-ZM) | Business term | Terminated — the service contract has been terminated by the customer |
| キャンセル済 (CNCL-ZM) | Business term | Cancelled — the service contract has been cancelled |
| 契約変更中 (SVCCHG-CHU) | Business term | Contract Change in Progress — a modification to an existing contract is being processed |
| SVC_KEI | Domain | Service Contract — refers to a service contract line item in the telecom billing/ordering domain |
| ZM | Abbreviation | 済み (Completed/済) — suffix indicating the action has been completed |
| CHU | Abbreviation | 中 (In Progress) — suffix indicating the action is in progress |
| Rtrim | Utility | Right Trim — removes trailing whitespace from a string |
| CBS | Abbreviation | Common Business Service — a shared business logic component |
| KK | Domain | Business unit/service line identifier (used in class naming, e.g., JBSbatKK*) |
