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

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKAdChgFinAddRun` |
| Layer | Service (Batch/Service Layer — `eo.business.service` package, resides under `koptBatch`) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKAdChgFinAddRun.executeKK_T_PRG_PKINSERT()

This method performs a **primary-key-based insert** into the progress management table `KK_T_PRG` in the database. It is a private utility method within the batch service layer that handles the creation of a new progress record for financial addition/change operations in the telecom order fulfillment domain. The method follows a **builder + delegate pattern**: it first maps 33 incoming parameter values into a `JBSbatCommonDBInterface` structured map (setting each field by its column key), then delegates the actual persistence to `db_KK_T_PRG.insertByPrimaryKeys()`. It does not perform any conditional branching, validation, or business-rule evaluation — its sole responsibility is to coordinate parameter-to-column mapping and invoke the insert operation. This makes it a **data-shaping adapter** that transforms a flat `Object[]` array into the structured format expected by the batch DAO's insert mechanism. It is used exclusively by `addPrg()` to persist progress information after processing decisions are made.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeKK_T_PRG_PKINSERT setParam"])
    START --> CREATE_MAP["Create JBSbatCommonDBInterface setMap"]

    CREATE_MAP --> SET_PRG["setMap setValue PRG_NO from setParam[0]"]
    SET_PRG --> SET_MSKM["setMap setValue MSKM_DTL_NO from setParam[1]"]
    SET_MSKM --> SET_SEIKY1["setMap setValue SEIKY_KEI_NO from setParam[2]"]
    SET_SEIKY1 --> SET_SEIKY2["setMap setValue SEIKY_WAY_NO_KOZA from setParam[3]"]
    SET_SEIKY2 --> SET_SEIKY3["setMap setValue SEIKY_WAY_NO_CRECARD from setParam[4]"]
    SET_SEIKY3 --> SET_SVC1["setMap setValue SVC_KEI_NO from setParam[5]"]
    SET_SVC1 --> SET_SVC2["setMap setValue SVC_KEI_UCWK_NO from setParam[6]"]
    SET_SVC2 --> SET_SVC3["setMap setValue SVC_KEI_KAISEN_UCWK_NO from setParam[7]"]
    SET_SVC3 --> SET_SVC4["setMap setValue KKTK_SVC_KEI_NO from setParam[8]"]
    SET_SVC4 --> SET_SVC5["setMap setValue OP_SVC_KEI_NO from setParam[9]"]
    SET_SVC5 --> SET_SVC6["setMap setValue SEIOPSVC_KEI_NO from setParam[10]"]
    SET_SVC6 --> SET_SVC7["setMap setValue SBOP_SVC_KEI_NO from setParam[11]"]
    SET_SVC7 --> SET_SVC8["setMap setValue WRIB_SVC_KEI_NO from setParam[12]"]
    SET_SVC8 --> SET_IDO["setMap setValue IDO_DIV and IDO_DTM from setParam[13-14]"]
    SET_IDO --> SET_STAT["setMap setValue PRG_STAT from setParam[15]"]
    SET_STAT --> SET_DTM["setMap setValue PRG_DTM from setParam[16]"]
    SET_DTM --> SET_MEMO["setMap setValue PRG_MEMO from setParam[17]"]
    SET_MEMO --> SET_TKJK["setMap setValue PRG_TKJK_1 and PRG_TKJK_2 from setParam[18-19]"]
    SET_TKJK --> SET_AUDIT["setMap setValue ADD/UPD/DEL fields from setParam[20-32]"]

    SET_AUDIT --> DB_INSERT["db_KK_T_PRG insertByPrimaryKeys setMap"]
    DB_INSERT --> END(["Return void"])
```

**Processing description:**
1. Create a new `JBSbatCommonDBInterface` instance (`setMap`) as a structured column-value map — this is the data transfer object used by the batch DAO layer.
2. Set 33 field-value pairs into `setMap` by calling `setValue(columnKey, value)` for each index of the `setParam` array (indices 0 through 32). The mapping covers: progress identification (PRG_NO, MSKM_DTL_NO), billing contract references (SEIKY_KEI_NO, SEIKY_WAY_NO_KOZA, SEIKY_WAY_NO_CRECARD), all service contract identifiers (SVC_KEI_NO through WRIB_SVC_KEI_NO), status tracking (IDO_DIV, IDO_DTM, PRG_STAT, PRG_DTM), memo fields (PRG_MEMO, PRG_TKJK_1, PRG_TKJK_2), and full audit trail (ADD_DTM, ADD_OPEACNT, UPD_DTM, UPD_OPEACNT, DEL_DTM, DEL_OPEACNT, MK_FLG, ADD_UNYO_YMD, ADD_TRN_ID, UPD_UNYO_YMD, UPD_TRN_ID, DEL_UNYO_YMD, DEL_TRN_ID).
3. Call `db_KK_T_PRG.insertByPrimaryKeys(setMap)` to persist the mapped record into the `KK_T_PRG` table using primary-key-based insert. The batch DAO layer handles the actual SQL generation and execution.
4. Return void — no transformed data is returned; the caller (`addPrg()`) must rely on exception handling for success/failure signaling.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `setParam` | `Object[]` | An ordered array of 33 values representing all columns of a `KK_T_PRG` progress record. Index 0 is PRG_NO (progress number), indices 1–12 are business entity keys (MSKM_DTL_NO through WRIB_SVC_KEI_NO), indices 13–19 are status/memo fields, and indices 20–32 are audit trail columns. The caller must ensure correct positional mapping. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `db_KK_T_PRG` | `JBSbatCommonDBInterface` (or subclass) | The batch DAO interface for the `KK_T_PRG` progress table. Provides `insertByPrimaryKeys()` for PK-based insert. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C | `JDKBatCommon.insertByPrimaryKeys` | - | `KK_T_PRG` | Calls `insertByPrimaryKeys` on the `db_KK_T_PRG` DAO to insert a new progress record into the `KK_T_PRG` table using primary key values. |
| - | `JDKStructuredMap.setValue` | JDKStructuredMap | - | Calls `setValue` on `JBSbatCommonDBInterface` to set each column key-value pair in the structured map. Executed 33 times (indices 0–32). |

### Analysis:

This method performs exactly **one terminal CRUD operation**: a **Create (C)** into the `KK_T_PRG` (Progress Management) table via `insertByPrimaryKeys`. The `KK_T_PRG` table stores progress tracking records for batch processing of financial addition/change operations in the telecom service order domain.

The method contains **no Read (R), Update (U), or Delete (D)** operations. It is purely a create-path method.

All 33 `setValue()` calls are intermediate data-shaping operations that populate the parameter map before the insert. These are internal to the `JBSbatCommonDBInterface` class and do not represent independent database interactions.

## 5. Dependency Trace

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

**No screen/batch entry points found within 8 hops.** This method is called exclusively from the sibling private method `addPrg()` within the same class `JBSbatKKAdChgFinAddRun`. It is not directly invoked by any screen (KKSV*) or external CBS. The `addPrg()` method is itself a private utility, so the true entry points to this functionality flow through whatever public/batch methods call `addPrg()`.

## 6. Per-Branch Detail Blocks

This method has **no conditional branches**, **no loops**, and **no try-catch blocks**. It executes a linear sequence of 33 field assignments followed by one method call. The block analysis below represents the logical groupings within this linear flow.

---

**Block 1** — [SET / LINEAR FLOW] `(create setMap and populate fields)` (L1060)

> Create the `JBSbatCommonDBInterface` map and set the first 14 fields: progress identification, billing contract references, and service contract keys.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setMap = new JBSbatCommonDBInterface();` // Create structured map for DB parameter |
| 2 | SET | `setMap.setValue("PRG_NO", setParam[0]);` // Progress number — unique identifier for this batch progress record |
| 3 | SET | `setMap.setValue("MSKM_DTL_NO", setParam[1]);` // Subscription detail number — links to the subscription order detail |
| 4 | SET | `setMap.setValue("SEIKY_KEI_NO", setParam[2]);` // Billing contract number — identifies the billing contract |
| 5 | SET | `setMap.setValue("SEIKY_WAY_NO_KOZA", setParam[3]);` // Billing method number (bank account) — payment via bank transfer |
| 6 | SET | `setMap.setValue("SEIKY_WAY_NO_CRECARD", setParam[4]);` // Billing method number (credit card) — payment via credit card |
| 7 | SET | `setMap.setValue("SVC_KEI_NO", setParam[5]);` // Service contract number — primary service contract identifier |
| 8 | SET | `setMap.setValue("SVC_KEI_UCWK_NO", setParam[6]);` // Service contract detail work number — sub-ID for service contract lines |
| 9 | SET | `setMap.setValue("SVC_KEI_KAISEN_UCWK_NO", setParam[7]);` // Service contract line detail number — specific circuit/line within the contract |
| 10 | SET | `setMap.setValue("KKTK_SVC_KEI_NO", setParam[8]);` // Equipment provision service contract number — for service bundles with hardware |
| 11 | SET | `setMap.setValue("OP_SVC_KEI_NO", setParam[9]);` // Option service contract number — optional/add-on services |
| 12 | SET | `setMap.setValue("SEIOPSVC_KEI_NO", setParam[10]);` // Billing option service contract number — billed add-on services |
| 13 | SET | `setMap.setValue("SBOP_SVC_KEI_NO", setParam[11]);` // Sub-option service contract number — secondary add-on services |
| 14 | SET | `setMap.setValue("WRIB_SVC_KEI_NO", setParam[12]);` // Discount service contract number — discount/charge reduction agreements |

---

**Block 2** — [SET / LINEAR FLOW] `(status and memo fields)` (L1074)

> Set the status tracking, movement (IDO) fields, and memo/comment fields.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setMap.setValue("IDO_DIV", setParam[13]);` // Movement classification — indicates the type of status transition (e.g., new, update, cancel) |
| 2 | SET | `setMap.setValue("IDO_DTM", setParam[14]);` // Movement date/time — timestamp of the status transition |
| 3 | SET | `setMap.setValue("PRG_STAT", setParam[15]);` // Progress status — current processing state of the batch job step |
| 4 | SET | `setMap.setValue("PRG_DTM", setParam[16]);` // Progress date/time — timestamp of the current progress record |
| 5 | SET | `setMap.setValue("PRG_MEMO", setParam[17]);` // Progress memo — free-form comment field for processing notes |
| 6 | SET | `setMap.setValue("PRG_TKJK_1", setParam[18]);` // Progress special item 1 — extended free-form comment field 1 |
| 7 | SET | `setMap.setValue("PRG_TKJK_2", setParam[19]);` // Progress special item 2 — extended free-form comment field 2 |

---

**Block 3** — [SET / LINEAR FLOW] `(audit trail fields)` (L1081)

> Set the full audit trail: registration (ADD), update (UPD), deletion (DEL) timestamps, operator account IDs, logical delete flag (MK_FLG), and operation metadata.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setMap.setValue("ADD_DTM", setParam[20]);` // Registration date/time — timestamp when this record was created |
| 2 | SET | `setMap.setValue("ADD_OPEACNT", setParam[21]);` // Registering operator account — the operator/user who created this record |
| 3 | SET | `setMap.setValue("UPD_DTM", setParam[22]);` // Update date/time — timestamp of the last update |
| 4 | SET | `setMap.setValue("UPD_OPEACNT", setParam[23]);` // Updating operator account — the operator/user who last updated this record |
| 5 | SET | `setMap.setValue("DEL_DTM", setParam[24]);` // Deletion date/time — timestamp when this record was logically deleted |
| 6 | SET | `setMap.setValue("DEL_OPEACNT", setParam[25]);` // Deleting operator account — the operator/user who deleted this record |
| 7 | SET | `setMap.setValue("MK_FLG", setParam[26]);` // In-use flag — logical delete indicator (active/inactive) |
| 8 | SET | `setMap.setValue("ADD_UNYO_YMD", setParam[27]);` // Registration operation date — business date of registration |
| 9 | SET | `setMap.setValue("ADD_TRN_ID", setParam[28]);` // Registration transaction ID — batch transaction identifier for registration |
| 10 | SET | `setMap.setValue("UPD_UNYO_YMD", setParam[29]);` // Update operation date — business date of update |
| 11 | SET | `setMap.setValue("UPD_TRN_ID", setParam[30]);` // Update transaction ID — batch transaction identifier for update |
| 12 | SET | `setMap.setValue("DEL_UNYO_YMD", setParam[31]);` // Deletion operation date — business date of deletion |
| 13 | SET | `setMap.setValue("DEL_TRN_ID", setParam[32]);` // Deletion transaction ID — batch transaction identifier for deletion |

---

**Block 4** — [CALL] `(execute DB insert)` (L1094)

> Execute the primary-key-based insert into the KK_T_PRG table. This is the sole database operation performed by this method.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `db_KK_T_PRG.insertByPrimaryKeys(setMap);` // Insert the complete progress record into KK_T_PRG table using primary key values |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `KK_T_PRG` | Table | Progress Management Table — stores progress tracking records for batch processing of telecom financial operations |
| `PRG_NO` | Field | Progress Number — unique identifier for a batch progress record |
| `MSKM_DTL_NO` | Field | Subscription Detail Number — links the progress record to the subscription order detail |
| `SEIKY_KEI_NO` | Field | Billing Contract Number — identifies the billing contract in the telecom billing system |
| `SEIKY_WAY_NO_KOZA` | Field | Billing Method Number (Bank Account) — payment method via bank transfer/automated debit |
| `SEIKY_WAY_NO_CRECARD` | Field | Billing Method Number (Credit Card) — payment method via credit card |
| `SVC_KEI_NO` | Field | Service Contract Number — primary service contract identifier in the telecom system |
| `SVC_KEI_UCWK_NO` | Field | Service Contract Detail Work Number — sub-identifier for service contract line items |
| `SVC_KEI_KAISEN_UCWK_NO` | Field | Service Contract Line Detail Number — specific circuit/line identifier within a service contract |
| `KKTK_SVC_KEI_NO` | Field | Equipment Provision Service Contract Number — contract for service bundles that include hardware/equipment |
| `OP_SVC_KEI_NO` | Field | Option Service Contract Number — optional or add-on service contracts |
| `SEIOPSVC_KEI_NO` | Field | Billing Option Service Contract Number — add-on services that appear on the billing statement |
| `SBOP_SVC_KEI_NO` | Field | Sub-Option Service Contract Number — secondary-tier add-on services |
| `WRIB_SVC_KEI_NO` | Field | Discount Service Contract Number — contracts for discount or charge reduction agreements |
| `IDO_DIV` | Field | Movement Classification — indicates the type of status transition (e.g., 新規=new, 更新=update, 取消=cancel) |
| `IDO_DTM` | Field | Movement Date/Time — timestamp when the status transition occurred |
| `PRG_STAT` | Field | Progress Status — current processing state of the batch job step (e.g., pending, completed, error) |
| `PRG_DTM` | Field | Progress Date/Time — timestamp of the current progress record |
| `PRG_MEMO` | Field | Progress Memo — free-form comment field for processing notes |
| `PRG_TKJK_1` | Field | Progress Special Item 1 — extended free-form comment field 1 |
| `PRG_TKJK_2` | Field | Progress Special Item 2 — extended free-form comment field 2 |
| `ADD_DTM` | Field | Registration Date/Time — timestamp when this record was created |
| `ADD_OPEACNT` | Field | Registering Operator Account — the operator/user ID who created this record |
| `UPD_DTM` | Field | Update Date/Time — timestamp of the last update to this record |
| `UPD_OPEACNT` | Field | Updating Operator Account — the operator/user ID who last updated this record |
| `DEL_DTM` | Field | Deletion Date/Time — timestamp when this record was logically deleted |
| `DEL_OPEACNT` | Field | Deleting Operator Account — the operator/user ID who deleted this record |
| `MK_FLG` | Field | In-Use Flag — logical delete indicator (true=active/in-use, false=inactive/retired) |
| `ADD_UNYO_YMD` | Field | Registration Operation Date — business date associated with the registration |
| `ADD_TRN_ID` | Field | Registration Transaction ID — batch job transaction identifier for registration traceability |
| `UPD_UNYO_YMD` | Field | Update Operation Date — business date associated with the update |
| `UPD_TRN_ID` | Field | Update Transaction ID — batch job transaction identifier for update traceability |
| `DEL_UNYO_YMD` | Field | Deletion Operation Date — business date associated with the deletion |
| `DEL_TRN_ID` | Field | Deletion Transaction ID — batch job transaction identifier for deletion traceability |
| `JBSbatCommonDBInterface` | Class | Batch service DB interface — a structured map that holds column-name to value mappings for batch DAO operations |
| `insertByPrimaryKeys` | Method | Batch DAO method that inserts a record using primary key-based SQL generation |
| Batch | Context | This method operates in a batch processing context (koptBatch package) for deferred financial operations in telecom order fulfillment |
