---

# Business Logic — JBSbatKKPlaceNoChgRnkiInfCst.getSysId() [16 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKPlaceNoChgRnkiInfCst` |
| Layer | Service (inferred from package `eo.business.service`) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKPlaceNoChgRnkiInfCst.getSysId()

This method retrieves the system identifier (SYSID) for a specific service contract record from the `KK_T_SVC_KEI` (Service Contract) table. In business terms, a service contract (`SVC_KEI`) represents an active subscription or agreement between a K-Opticom customer and a telecommunication service (such as FTTH, cable, or other IP-based services). The SYSID serves as the unique system-level identifier used throughout the customer core system to reference that particular contract instance across downstream processing steps, including batch jobs that generate invoices, provision equipment, or produce billing statements. The method implements a simple delegate-read pattern: it prepares a query with the contract number and operational date, executes the SQL query against the service contract table, and returns the SYSID if the contract is found. If no matching contract record exists for the given parameters (e.g., the contract has been deleted or the contract number is invalid), the method returns an empty string as a safe sentinel value. It is called by batch insertion routines (such as `JBSbatKKMansIfSksi.insertCust()`) and log message generators (such as `JBSbatKKPlaceNoChgRnkiInfCst.getLogMsgKojiStop()`), indicating that it is a shared internal utility used to resolve contract-level identifiers during customer management and order processing workflows.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["getSysId(svcKeiNo)"])
    STEP1["Create paramList (JBSbatCommonDBInterface)"]
    STEP2["Set svcKeiNo value"]
    STEP3["Set opeDate value"]
    STEP4["selectBySqlDefine(paramList, KK_SELECT_023)"]
    STEP5["selectNext() -> svcKei"]
    COND1{svcKei != null}
    YES1["Return svcKei.getString(SYSID)"]
    NO1["Return empty string"]
    END(["Return / Next"])

    START --> STEP1 --> STEP2 --> STEP3 --> STEP4 --> STEP5 --> COND1
    COND1 -->|true| YES1 --> END
    COND1 -->|false| NO1 --> END
```

**Processing flow:**

1. **Parameter object creation** — A `JBSbatCommonDBInterface` object (`paramList`) is instantiated to serve as the query parameter container. This object holds key-value pairs that will be bound to the SQL parameters.

2. **Set contract number** — The `svcKeiNo` parameter (Service Contract Number) is set as the first value in the parameter list. This identifies which service contract row to look up.

3. **Set operational date** — The `opeDate` instance field (the operational date, inherited from the parent `JBSbatBusinessService` class) is set as the second value. This provides a date context for the query, likely used to enforce temporal validity of the contract record (e.g., only return contracts active as of the given date).

4. **Execute SQL query** — The method invokes `selectBySqlDefine()` on the `db_KK_T_SVC_KEI` SQL access layer, passing the parameter list and the SQL define key `KK_T_SVC_KEI_KK_SELECT_023` (= `"KK_SELECT_023"`). This key references a pre-defined SQL SELECT statement configured in the batch system's SQL definition file, which queries the `KK_T_SVC_KEI` table for the matching contract record.

5. **Fetch the next row** — `selectNext()` retrieves the first result row from the executed query and returns it as a `JBSbatCommonDBInterface` (`svcKei`). If no row matched, it returns `null`.

6. **Conditional check** — If `svcKei` is not `null`, the method extracts the `SYSID` field value using `getString()` and returns it. If `svcKei` is `null` (no matching contract found), the method returns an empty string `""`.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `svcKeiNo` | `String` | Service Contract Number — the unique identifier for a service contract line item. This key links the contract to other related tables such as `KK_T_KKTK_SVC_KEI` (Device Provisioning Service Contract) and `KK_T_SVC_KEI_UCWK` (Service Contract Work Details). |

**Instance fields read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `opeDate` | `String` (inherited from `JBSbatBusinessService`) | Operational date — the reference date used in batch processing queries. It determines which version/record of a contract is returned when temporal filtering (e.g., effective dates) is part of the SELECT query. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JBSbatKK_T_SVC_KEI.getString` | — | `KK_T_SVC_KEI` (SYSID field) | Reads the `SYSID` field value from the retrieved service contract record |
| R | `JBSbatCommonDBInterface.setValue` | — | — | Sets query parameters (svcKeiNo, opeDate) into the parameter object |
| R | `JBSbatSQLAccess.selectBySqlDefine` | — | `KK_T_SVC_KEI` | Executes the SQL SELECT query defined by key `KK_SELECT_023` against the `KK_T_SVC_KEI` table |
| R | `JBSbatSQLAccess.selectNext` | — | `KK_T_SVC_KEI` | Fetches the next result row from the executed query |

**Analysis:**

- **R — `db_KK_T_SVC_KEI.selectBySqlDefine(paramList, KK_T_SVC_KEI_KK_SELECT_023)`**: Reads from the `KK_T_SVC_KEI` (Service Contract) table using SQL define key `"KK_SELECT_023"`. This is the primary data access operation — it queries for a service contract matching the given `SVC_KEI_NO` and `opeDate`.

- **R — `svcKei.selectNext()`**: Reads the next row from the result set returned by the previous SQL query. Returns `null` if no matching record exists.

- **R — `svcKei.getString(JBSbatKK_T_SVC_KEI.SYSID)`**: Reads the `SYSID` field from the retrieved record. The `SYSID` constant resolves to the string `"SYSID"` — the system identifier column of the `KK_T_SVC_KEI` table.

## 5. Dependency Trace

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

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: `JBSbatKKMansIfSksi.insertCust()` | `JBSbatKKMansIfSksi.insertCust()` -> `JBSbatKKPlaceNoChgRnkiInfCst.getSysId(svcKeiNo)` | `getString [R] KK_T_SVC_KEI (SYSID)` |
| 2 | Batch: `JBSbatKKPlaceNoChgRnkiInfCst.getLogMsgKojiStop()` | `JBSbatKKPlaceNoChgRnkiInfCst.getLogMsgKojiStop()` -> `JBSbatKKPlaceNoChgRnkiInfCst.getSysId(svcKeiNo)` | `getString [R] KK_T_SVC_KEI (SYSID)` |

**Trace analysis:**

This method is not directly called by any customer-facing screen or batch entry point. Instead, it is invoked internally by two callers:

1. **`JBSbatKKMansIfSksi.insertCust()`** — A batch customer insertion method that processes customer records. It calls `getSysId()` to resolve the SYSID of a service contract, likely to associate the new customer record with the correct service contract identifier.

2. **`JBSbatKKPlaceNoChgRnkiInfCst.getLogMsgKojiStop()`** — An internal method within the same class that generates log messages related to order processing stop conditions. It calls `getSysId()` to include the SYSID in log messages for traceability.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] `paramList = new JBSbatCommonDBInterface()` (L909)

> Creates a new database query parameter object to hold the service contract number and operational date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramList = new JBSbatCommonDBInterface()` // New query parameter container |

**Block 2** — [SET] `paramList.setValue(svcKeiNo)` (L910)

> Sets the service contract number as the first query parameter.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramList.setValue(svcKeiNo)` // Bind service contract number |

**Block 3** — [SET] `paramList.setValue(opeDate)` (L911)

> Sets the operational date as the second query parameter. `opeDate` is inherited from the parent `JBSbatBusinessService` class and represents the batch processing reference date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramList.setValue(opeDate)` // Bind operational date [inherited from JBSbatBusinessService] |

**Block 4** — [EXEC] `db_KK_T_SVC_KEI.selectBySqlDefine(paramList, KK_T_SVC_KEI_KK_SELECT_023)` (L914)

> Executes the SQL SELECT query against the `KK_T_SVC_KEI` table. The SQL define key `KK_T_SVC_KEI_KK_SELECT_023` resolves to `"KK_SELECT_023"`, which maps to a pre-defined SQL statement that retrieves a service contract record by contract number and date.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `db_KK_T_SVC_KEI.selectBySqlDefine(paramList, KK_SELECT_023)` // Query KK_T_SVC_KEI table [-> CONSTANT: KK_T_SVC_KEI_KK_SELECT_023="KK_SELECT_023"] |

**Block 5** — [SET] `svcKei = db_KK_T_SVC_KEI.selectNext()` (L915)

> Fetches the next result row from the query result set. Returns `null` if no matching record was found.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcKei = db_KK_T_SVC_KEI.selectNext()` // Get the matched contract record |

**Block 6** — [IF] `(svcKei != null)` (L916)

> Conditional branch: checks whether a matching service contract record was found.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `return svcKei.getString(JBSbatKK_T_SVC_KEI.SYSID)` // Return SYSID from found record [-> CONSTANT: SYSID="SYSID"] |

**Block 7** — [ELSE] `(svcKei == null)` (L918)

> Fallback branch: when no service contract is found (e.g., contract not found, deleted, or number is invalid). Returns an empty string as a safe sentinel value.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return ""` // No matching contract found, return empty string |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svcKeiNo` | Field | Service Contract Number — the unique identifier for a service contract line item. Used to link contracts to customers, equipment, and billing records. |
| `opeDate` | Field | Operational Date — the reference date used throughout batch processing. Determines temporal context for queries (e.g., "as of this date"). |
| `SYSID` | Field | System Identifier — the unique internal system-level ID for a service contract row, used across the customer core system for cross-referencing. |
| `KK_T_SVC_KEI` | Table | Service Contract table — stores master records for all active and historical service contracts (FTTH, cable, mail, etc.) for each customer. |
| `SVC_KEI_NO` | Field | Service Contract Number — primary key field in `KK_T_SVC_KEI` used to uniquely identify each contract row. |
| `KK_SELECT_023` | SQL Define | Pre-defined SQL SELECT query key that retrieves a service contract record from `KK_T_SVC_KEI` by contract number and operational date. |
| `JBSbatCommonDBInterface` | Class | Database query parameter object — holds key-value pairs (parameters) used in batch SQL queries. |
| `JBSbatSQLAccess` | Class | Database access layer — provides methods like `selectBySqlDefine()` and `selectNext()` for executing SQL queries and retrieving result sets in batch processing. |
| KK | Acronym | K-Opticom — the telecommunications service provider. Prefix used in table names (`KK_T_*`) to denote K-Opticom master tables. |
| SVC_KEI | Acronym | Service Contract — a customer's subscription/agreement for a telecommunication service. |
| FTTH | Business term | Fiber To The Home — fiber-optic broadband internet service offered by K-Opticom. |
| insertCust | Method | Customer insertion batch process — creates/registers new customer records in the system. |

---
