# Business Logic — JBSbatKKBndWdtOvrSendPstCrd.getMltNinshoId() [30 LOC]

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

## 1. Role

### JBSbatKKBndWdtOvrSendPstCrd.getMltNinshoId()

This method retrieves the **multi-session authentication ID** (`MLTISE_NINSHO_ID`) for a given FTTH (Fiber To The Home) service contract, enabling concurrent multi-session connectivity under a single service agreement. It operates as a **data lookup delegator** within the batch processing service layer, querying the `KK_T_OP_SVC_KEI` (Operation Service Contract) table to extract the authentication credential needed for multi-session operations. The method filters results by three keys: the **service contract number** (`svcKeiNo`), the **operation date** (`opeDate`), and the **operation service code** (`B015`, which corresponds to FTTH service). It is called internally by `updateFtthTsrckJsk()` to obtain the authentication ID required before locking FTTH communication volume records. If no matching contract record exists, the method safely returns an empty string rather than throwing an exception, ensuring downstream processing can handle the absence gracefully.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["getMltNinshoId(svcKeiNo)"])
    START --> CREATE_PARAM["Create JBSbatCommonDBInterface param (first instance, discarded)"]
    CREATE_PARAM --> RECREATE_PARAM["Create JBSbatCommonDBInterface param (re-instantiated)"]
    RECREATE_PARAM --> SET_SVC["Set svcKeiNo (Service Contract Number)"]
    SET_SVC --> SET_OPE1["Set opeDate (Operation Date)"]
    SET_OPE1 --> SET_SVC_CODE["Set OpSvcCd = B015 (FTTH Service)"]
    SET_SVC_CODE --> SET_OPE2["Set opeDate (Operation Date) again"]
    SET_OPE2 --> EXEC_SELECT["Execute executeKK_T_OP_SVC_KEI_KK_SELECT_054(param)"]
    EXEC_SELECT --> SELECT_NEXT["db_KK_T_OP_SVC_KEI.selectNext() -> opSvcKeiInfo"]
    SELECT_NEXT --> CHECK_NULL{opSvcKeiInfo != null}
    CHECK_NULL -->|true| GET_MLT["Set mltiNinshoId = opSvcKeiInfo.getString(MLTISE_NINSHO_ID)"]
    CHECK_NULL -->|false| SET_EMPTY["mltiNinshoId = empty string"]
    GET_MLT --> RETURN_ID["Return mltiNinshoId"]
    SET_EMPTY --> RETURN_ID
```

**Processing Summary:**

1. A `JBSbatCommonDBInterface` parameter object is created and populated with four values: the service contract number (`svcKeiNo`), the operation date (`opeDate`), the operation service code (`B015` for FTTH), and the operation date again.
2. The select query `executeKK_T_OP_SVC_KEI_KK_SELECT_054` is executed, querying the `KK_T_OP_SVC_KEI` (Operation Service Contract) table.
3. The next result row is fetched from the database cursor via `db_KK_T_OP_SVC_KEI.selectNext()`.
4. If a matching record is found, the multi-session authentication ID (`MLTISE_NINSHO_ID`) is extracted and returned. If no record is found, an empty string is returned.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `svcKeiNo` | `String` | Service Contract Number — the unique identifier for a service contract line item within the FTTH service system. This key is used to locate the exact contract record in the `KK_T_OP_SVC_KEI` table. |

| No | Name | Type | Business Description |
|----|------|------|---------------------|
| 1 | `super.opeDate` | `Date` | Operation Date — the processing date carried from the parent class, used as a filter to locate the most recent or relevant contract record for the given operational day. |
| 2 | `db_KK_T_OP_SVC_KEI` | Database Mapper | The database access object for the `KK_T_OP_SVC_KEI` table, providing the `selectNext()` method to fetch the next result row from the query execution. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `executeKK_T_OP_SVC_KEI_KK_SELECT_054` | EKK (derived from KK_T_OP_SVC_KEI_KK_SELECT_054) | `KK_T_OP_SVC_KEI` (Operation Service Contract table) | Executes a database SELECT query to retrieve the operation service contract record matching the given service contract number, operation date, and service code B015 (FTTH service). |
| R | `db_KK_T_OP_SVC_KEI.selectNext` | - | `KK_T_OP_SVC_KEI` | Fetches the next row from the active query result set cursor, returning a `JBSbatCommonDBInterface` representing the contract record. |

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

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS: JBSbatKKBndWdtOvrSendPstCrd.updateFtthTsrckJsk | `updateFtthTsrckJsk` -> `getMltNinshoId(svcKeiNo)` | `selectNext [R] KK_T_OP_SVC_KEI` -> `getString [R] MLTISE_NINSHO_ID` |

**Call Chain Detail:**
- `updateFtthTsrckJsk()` is a private method within `JBSbatKKBndWdtOvrSendPstCrd` that locks FTTH communication volume records. Before performing the lock, it calls `getMltNinshoId()` to retrieve the multi-session authentication ID associated with the service contract.

## 6. Per-Branch Detail Blocks

**Block 1** — [VARIABLE DECLARATION] (L738)

> Initializes a parameter object (first instance, later discarded).

| # | Type | Code |
|---|------|------|
| 1 | SET | `JBSbatCommonDBInterface param = new JBSbatCommonDBInterface()` // Create initial param, unused |

**Block 2** — [COMMENT: Multi-Session Authentication ID Retrieval] (L741-742)

> Japanese comment: 「オプションサービス契約からマルチセッション用認証IDを取得する」
> ("Retrieve multi-session authentication ID from the option service contract")

**Block 3** — [RE-INITIALIZATION] (L744)

> Re-creates the parameter object; the first instance from Block 1 is discarded.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param = new JBSbatCommonDBInterface()` // Re-instantiate (first instance discarded) |

**Block 4** — [PARAMETER POPULATION] (L746-755)

> Japanese comments: 「サービス契約番号」, 「運用日」, 「オプションサービスコード」
> ("Service Contract Number", "Operation Date", "Option Service Code")

| # | Type | Code |
|---|------|------|
| 1 | SET | `param.setValue(svcKeiNo)` // Service Contract Number [-> svcKeiNo parameter value] |
| 2 | SET | `param.setValue(super.opeDate)` // Operation Date [-> inherited field] |
| 3 | SET | `param.setValue("B015")` // Option Service Code [-> B015 = FTTH Service] |
| 4 | SET | `param.setValue(super.opeDate)` // Operation Date set again |

**Block 5** — [SELECT QUERY EXECUTION] (L757)

> Executes the database select operation against the `KK_T_OP_SVC_KEI` table using the populated parameter.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `executeKK_T_OP_SVC_KEI_KK_SELECT_054(param.getList().toArray())` // Execute SELECT query |

**Block 6** — [RESULT FETCH] (L759)

> Retrieves the next row from the query result set.

| # | Type | Code |
|---|------|------|
| 1 | SET | `JBSbatCommonDBInterface opSvcKeiInfo = db_KK_T_OP_SVC_KEI.selectNext()` // Fetch next contract record |

**Block 7** — [RETURN VALUE INIT] (L761)

> Initializes the return variable to an empty string, ensuring a default value if no record is found.

| # | Type | Code |
|---|------|------|
| 1 | SET | `String mltiNinshoId = ""` // Default to empty string |

**Block 8** — [NULL CHECK / EXTRACT] (L762-765)

> If a matching contract record exists, extract the multi-session authentication ID.

| # | Type | Code |
|---|------|------|
| 1 | IF | `null != opSvcKeiInfo` |

**Block 8.1** — [TRUE BRANCH] `(L764)`

> Extract the multi-session authentication ID from the contract record.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mltiNinshoId = opSvcKeiInfo.getString(JBSbatKK_T_OPSVKEI_ISP.MLTISE_NINSHO_ID)` // Extract MLTISE_NINSHO_ID field [-> MLTISE_NINSHO_ID = "MLTISE_NINSHO_ID"] |

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

> Returns the retrieved authentication ID (or empty string if no record matched).

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return mltiNinshoId` // Multi-session authentication ID or empty string |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svcKeiNo` | Field | Service Contract Number — the unique identifier for a service contract line item in the FTTH service system |
| `opeDate` | Field | Operation Date — the batch processing date, used as a filter for retrieving the relevant contract record |
| `opSvcCd` | Field | Option Service Code — a classification code identifying the type of option service; `B015` specifically denotes FTTH (Fiber To The Home) service |
| `MLTISE_NINSHO_ID` | Field | Multi-Session Authentication ID — the authentication credential allowing multiple concurrent sessions under a single FTTH service contract |
| `MLTISE_NINSHO_ID_PWD` | Field | Multi-Session Authentication ID Password — the password associated with the multi-session authentication ID |
| `B015` | Constant | FTTH Service Code — the operation service code identifier for Fiber To The Home service in the option service catalog |
| `KK_T_OP_SVC_KEI` | Table | Operation Service Contract table — the database table storing records of option service contracts, including service codes and authentication details |
| `KK_T_OP_SVC_KEI_KK_SELECT_054` | SQL | Select SQL definition — the database query used to retrieve operation service contract records by service contract number, operation date, and service code |
| `JBSbatCommonDBInterface` | Class | Common database interface — a parameter/result container class used to pass structured data between service methods and database operations |
| FTTH | Business term | Fiber To The Home — a fiber-optic broadband internet service providing high-speed connectivity directly to customer premises |
| Multi-Session | Business term | A service feature allowing a single service contract to support multiple concurrent device sessions, each requiring its own authentication ID |
| `db_KK_T_OP_SVC_KEI` | Field | Database mapper for the `KK_T_OP_SVC_KEI` table — provides query execution and result iteration methods |

---