# Business Logic — JBSbatKKTokutIdoOptyCmpEnd.executeKK_T_PRG_PKINSERT() [41 LOC]

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

## 1. Role

### JBSbatKKTokutIdoOptyCmpEnd.executeKK_T_PRG_PKINSERT()

This method performs a **primary key-based insert operation** into the `KK_T_PRG` (progress management) table. It serves as a data-mapping and delegation layer within the batch processing service for advance payment optional service contract transfer operations. The method accepts an `Object[]` array containing 33 field values, maps each value to a structured data interface (`JBSbatCommonDBInterface`), and delegates the actual database write to `db_KK_T_PRG.insertByPrimaryKeys()`. It is a private utility method called exclusively by `insertPrg()` within the same class. The design pattern used is a thin **builder-delegation** pattern: it constructs the database entity from flat input and passes it to a pre-configured SQL access component. The `KK_T_PRG` table tracks progress of contract transfer operations, storing fields such as progress numbers, status timestamps, operator accounts, and various service contract identifiers.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeKK_T_PRG_PKINSERT(setParam)"])
    STEP1["Create JBSbatCommonDBInterface map (setMap)"]
    STEP2["Set 33 fields from setParam array:
PRG_NO[0], MSKM_DTL_NO[1], SEIKY_KEI_NO[2],
SEIKY_WAY_NO_KOZA[3], SEIKY_WAY_NO_CRECARD[4],
SVC_KEI_NO[5], SVC_KEI_UCWK_NO[6],
SVC_KEI_KAISEN_UCWK_NO[7], KKTK_SVC_KEI_NO[8],
OP_SVC_KEI_NO[9], SEIOPSVC_KEI_NO[10],
SBOP_SVC_KEI_NO[11], WRIB_SVC_KEI_NO[12],
IDO_DIV[13], IDO_DTM[14], PRG_STAT[15],
PRG_DTM[16], PRG_MEMO[17], PRG_TKJK_1[18],
PRG_TKJK_2[19], ADD_DTM[20], ADD_OPEACNT[21],
UPD_DTM[22], UPD_OPEACNT[23], DEL_DTM[24],
DEL_OPEACNT[25], MK_FLG[26], ADD_UNYO_YMD[27],
ADD_TRN_ID[28], UPD_UNYO_YMD[29], UPD_TRN_ID[30],
DEL_UNYO_YMD[31], DEL_TRN_ID[32]"]
    STEP3["db_KK_T_PRG.insertByPrimaryKeys(setMap)"]
    END_NODE(["Return / Next"])

    START --> STEP1 --> STEP2 --> STEP3 --> END_NODE
```

The method executes a straightforward three-step linear flow with **no conditional branches**:

1. **Map creation** — A new `JBSbatCommonDBInterface` instance (`setMap`) is instantiated to act as the structured data carrier for the database insert.
2. **Field mapping** — All 33 fields from the input `setParam` array (indices 0–32) are transferred into `setMap` via `setValue()` calls. Each field name is a hard-coded string literal corresponding to a column in the `KK_T_PRG` table.
3. **Database insert** — The pre-configured `db_KK_T_PRG` access object (a `JBSbatSQLAccess` instance, initialized in the constructor with the table name `D_TBL_NAME_KK_T_PRG`) executes the primary-key-based insert via `insertByPrimaryKeys()`.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `setParam` | `Object[]` | An array of 33 field values representing all columns of the `KK_T_PRG` progress management table. Each element carries a specific domain value — from progress identifiers and service contract numbers to timestamps, operator accounts, and audit flags. The array order is strictly positional: index 0 maps to `PRG_NO` (progress number), index 1 to `MSKM_DTL_NO` (application detail number), through index 32 to `DEL_TRN_ID` (delete processing ID). |
| 2 | `db_KK_T_PRG` (instance field) | `JBSbatSQLAccess` | The database access object wired to the `KK_T_PRG` table. Pre-initialized in the class constructor with the table name constant `D_TBL_NAME_KK_T_PRG`. Used to execute primary-key-based SQL inserts. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C | `db_KK_T_PRG.insertByPrimaryKeys` | - | `KK_T_PRG` | Performs a primary-key-based insert of a progress management record into the `KK_T_PRG` table |
| - | `JBSbatCommonDBInterface.setValue` | - | - | Sets each of the 33 field values on the structured data interface |

**Details:**
- **`db_KK_T_PRG.insertByPrimaryKeys(setMap)`** — This is the terminal database operation. The `db_KK_T_PRG` field is a `JBSbatSQLAccess` instance configured with the `KK_T_PRG` table (via the table name constant `D_TBL_NAME_KK_T_PRG`). The `insertByPrimaryKeys` method constructs and executes an `INSERT` statement using all field values from the `setMap` object. This creates a new row in the progress management table, recording the full state of a contract transfer operation.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 method.
Terminal operations from this method: `insertByPrimaryKeys` [C], `setValue` [-] (x33 times)

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Method: `insertPrg` | `JBSbatKKTokutIdoOptyCmpEnd.insertPrg()` -> `JBSbatKKTokutIdoOptyCmpEnd.executeKK_T_PRG_PKINSERT(setParam)` | `insertByPrimaryKeys [C] KK_T_PRG` |

The method is a **private** utility and is called exclusively by `insertPrg()` within the same class (`JBSbatKKTokutIdoOptyCmpEnd`). No external screens or batch entry points call this method directly. The `insertPrg()` method likely prepares the parameter array and delegates to `executeKK_T_PRG_PKINSERT` to persist progress records.

## 6. Per-Branch Detail Blocks

The method has **no conditional branches**. It follows a single linear execution path.

**Block 1** — [PROCESS] `(no condition)` (L1089)

> Create a new JBSbatCommonDBInterface map and populate it with 33 field values from the input array. This maps the flat `Object[]` parameter into a structured data carrier that the database access layer can consume.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setMap = new JBSbatCommonDBInterface();` // Create the structured map |
| 2 | EXEC | `setMap.setValue("PRG_NO", setParam[0]);` // Progress number |
| 3 | EXEC | `setMap.setValue("MSKM_DTL_NO", setParam[1]);` // Application detail number |
| 4 | EXEC | `setMap.setValue("SEIKY_KEI_NO", setParam[2]);` // Billing contract number |
| 5 | EXEC | `setMap.setValue("SEIKY_WAY_NO_KOZA", setParam[3]);` // Billing method number (bank account) |
| 6 | EXEC | `setMap.setValue("SEIKY_WAY_NO_CRECARD", setParam[4]);` // Billing method number (credit card) |
| 7 | EXEC | `setMap.setValue("SVC_KEI_NO", setParam[5]);` // Service contract number |
| 8 | EXEC | `setMap.setValue("SVC_KEI_UCWK_NO", setParam[6]);` // Service contract detail number |
| 9 | EXEC | `setMap.setValue("SVC_KEI_KAISEN_UCWK_NO", setParam[7]);` // Service contract line detail number |
| 10 | EXEC | `setMap.setValue("KKTK_SVC_KEI_NO", setParam[8]);` // Equipment provision service contract number |
| 11 | EXEC | `setMap.setValue("OP_SVC_KEI_NO", setParam[9]);` // Optional service contract number |
| 12 | EXEC | `setMap.setValue("SEIOPSVC_KEI_NO", setParam[10]);` // Billing optional service contract number |
| 13 | EXEC | `setMap.setValue("SBOP_SVC_KEI_NO", setParam[11]);` // Sub optional service contract number |
| 14 | EXEC | `setMap.setValue("WRIB_SVC_KEI_NO", setParam[12]);` // Discount service contract number |
| 15 | EXEC | `setMap.setValue("IDO_DIV", setParam[13]);` // Transfer classification |
| 16 | EXEC | `setMap.setValue("IDO_DTM", setParam[14]);` // Transfer date/time |
| 17 | EXEC | `setMap.setValue("PRG_STAT", setParam[15]);` // Progress status |
| 18 | EXEC | `setMap.setValue("PRG_DTM", setParam[16]);` // Progress date/time |
| 19 | EXEC | `setMap.setValue("PRG_MEMO", setParam[17]);` // Progress memo |
| 20 | EXEC | `setMap.setValue("PRG_TKJK_1", setParam[18]);` // Progress special item 1 |
| 21 | EXEC | `setMap.setValue("PRG_TKJK_2", setParam[19]);` // Progress special item 2 |
| 22 | EXEC | `setMap.setValue("ADD_DTM", setParam[20]);` // Registration date/time |
| 23 | EXEC | `setMap.setValue("ADD_OPEACNT", setParam[21]);` // Registration operator account |
| 24 | EXEC | `setMap.setValue("UPD_DTM", setParam[22]);` // Update date/time |
| 25 | EXEC | `setMap.setValue("UPD_OPEACNT", setParam[23]);` // Update operator account |
| 26 | EXEC | `setMap.setValue("DEL_DTM", setParam[24]);` // Delete date/time |
| 27 | EXEC | `setMap.setValue("DEL_OPEACNT", setParam[25]);` // Delete operator account |
| 28 | EXEC | `setMap.setValue("MK_FLG", setParam[26]);` // Invalid flag |
| 29 | EXEC | `setMap.setValue("ADD_UNYO_YMD", setParam[27]);` // Registration operation date |
| 30 | EXEC | `setMap.setValue("ADD_TRN_ID", setParam[28]);` // Registration processing ID |
| 31 | EXEC | `setMap.setValue("UPD_UNYO_YMD", setParam[29]);` // Update operation date |
| 32 | EXEC | `setMap.setValue("UPD_TRN_ID", setParam[30]);` // Update processing ID |
| 33 | EXEC | `setMap.setValue("DEL_UNYO_YMD", setParam[31]);` // Delete operation date |
| 34 | EXEC | `setMap.setValue("DEL_TRN_ID", setParam[32]);` // Delete processing ID |

**Block 2** — [PROCESS] `(no condition)` (L1116)

> Execute the primary-key-based insert into the `KK_T_PRG` table using the populated map. This persists the progress management record to the database.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `db_KK_T_PRG.insertByPrimaryKeys(setMap);` // Insert record into KK_T_PRG table |
| 2 | RETURN | `// method returns void — no explicit return statement` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `KK_T_PRG` | Table | Progress Management Table — stores the state and history of contract transfer operations |
| `PRG_NO` | Field | Progress Number — unique identifier for a progress record |
| `MSKM_DTL_NO` | Field | Application Detail Number — identifies the specific line item within a subscription application |
| `SEIKY_KEI_NO` | Field | Billing Contract Number — identifier for the billing contract associated with this transfer |
| `SEIKY_WAY_NO_KOZA` | Field | Billing Method Number (Bank Account) — specifies the bank account used for billing |
| `SEIKY_WAY_NO_CRECARD` | Field | Billing Method Number (Credit Card) — specifies the credit card used for billing |
| `SVC_KEI_NO` | Field | Service Contract Number — the primary service contract identifier |
| `SVC_KEI_UCWK_NO` | Field | Service Contract Detail Number — sub-identifier within a service contract |
| `SVC_KEI_KAISEN_UCWK_NO` | Field | Service Contract Line Detail Number — identifies specific lines within a service contract |
| `KKTK_SVC_KEI_NO` | Field | Equipment Provision Service Contract Number — for contracts involving equipment provision |
| `OP_SVC_KEI_NO` | Field | Optional Service Contract Number — for optional service add-ons |
| `SEIOPSVC_KEI_NO` | Field | Billing Optional Service Contract Number — optional services billed through the main invoice |
| `SBOP_SVC_KEI_NO` | Field | Sub Optional Service Contract Number — secondary optional service tier |
| `WRIB_SVC_KEI_NO` | Field | Discount Service Contract Number — discount plan or rebate contract identifiers |
| `IDO_DIV` | Field | Transfer Classification — indicates the type of contract transfer (e.g., new, change, cancellation) |
| `IDO_DTM` | Field | Transfer Date/Time — timestamp when the transfer operation occurred |
| `PRG_STAT` | Field | Progress Status — current status of the transfer progress |
| `PRG_DTM` | Field | Progress Date/Time — timestamp of the progress record update |
| `PRG_MEMO` | Field | Progress Memo — free-text notes for the transfer progress |
| `PRG_TKJK_1` | Field | Progress Special Item 1 — additional optional note field 1 |
| `PRG_TKJK_2` | Field | Progress Special Item 2 — additional optional note field 2 |
| `ADD_DTM` | Field | Registration Date/Time — timestamp when this record was originally created |
| `ADD_OPEACNT` | Field | Registration Operator Account — the operator who created this record |
| `UPD_DTM` | Field | Update Date/Time — timestamp of the last modification |
| `UPD_OPEACNT` | Field | Update Operator Account — the operator who last modified this record |
| `DEL_DTM` | Field | Delete Date/Time — timestamp when this record was logically deleted |
| `DEL_OPEACNT` | Field | Delete Operator Account — the operator who performed the deletion |
| `MK_FLG` | Field | Invalid Flag — marks the record as valid (`0`) or invalid (`1`); a logical delete indicator |
| `ADD_UNYO_YMD` | Field | Registration Operation Date — date of the registration processing operation |
| `ADD_TRN_ID` | Field | Registration Processing ID — unique ID of the registration transaction |
| `UPD_UNYO_YMD` | Field | Update Operation Date — date of the update processing operation |
| `UPD_TRN_ID` | Field | Update Processing ID — unique ID of the update transaction |
| `DEL_UNYO_YMD` | Field | Delete Operation Date — date of the deletion processing operation |
| `DEL_TRN_ID` | Field | Delete Processing ID — unique ID of the deletion transaction |
| `JBSbatCommonDBInterface` | Class | Common database interface — a structured data carrier that holds key-value pairs for DB operations |
| `JBSbatSQLAccess` | Class | SQL access base class — provides database operations (insert, update, delete) for a specific table |
| `insertByPrimaryKeys` | Method | Inserts a record into the database using all fields as the primary key; ensures no duplicate records |
| `executeKK_T_PRG_PKINSERT` | Method | Performs PK-based insert into the progress management table using the full set of mapped fields |
| `insertPrg` | Method | Caller of `executeKK_T_PRG_PKINSERT`; prepares the parameter array and delegates the insert operation |
