# Business Logic — JBSbatKKCampaignIktAdd.executeKK_T_WRIB_SVC_KEI_PKINSERT() [72 LOC]

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

## 1. Role

### JBSbatKKCampaignIktAdd.executeKK_T_WRIB_SVC_KEI_PKINSERT()

This method is a **primary-key-based record insertion** service method for the Discount Service Contract (`WRIB_SVC_KEI`) domain. Its sole responsibility is to accept a flat `Object[]` array of 64 field values, map each value to a named key in a business data interface (`JBSbatCommonDBInterface`), and then perform a single database insert operation via `insertByPrimaryKeys` on the `db_KK_T_WRIB_SVC_KEI` data-access component.

In business terms, this method handles **new discount service contract registration** — that is, creating a new row in the `KK_T_WRIB_SVC_KEI` table representing a discount/service-contract agreement. The caller (the parent `execute()` method) prepares the 64-element parameter array with all fields including the discount service contract number, generation timestamp, service status, service codes, plan details, usage dates, reservation flags, cancellation history, operator metadata, and audit columns. This method is the **dedicated PK-insert delegate** within the `JBSbatKKCampaignIktAdd` batch service, implementing the **delegation pattern** by forwarding a fully-populated data map to the underlying DAO layer for database persistence.

The method has no conditional branches — it performs a single linear path of parameter extraction and database insertion. It is private and called exclusively by `JBSbatKKCampaignIktAdd.execute()`, making it an internal work-horse method within the batch campaign processing pipeline.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeKK_T_WRIB_SVC_KEI_PKINSERT(params)"])

    START --> STEP1["Create JBSbatCommonDBInterface setMap"]

    STEP1 --> MAPBUILDER["Populate setMap with 64 key-value pairs
from setParam array (WRIB_SVC_KEI_NO through DEL_TRN_ID)"]

    MAPBUILDER --> DBINSERT["db_KK_T_WRIB_SVC_KEI.insertByPrimaryKeys(setMap)"]

    DBINSERT --> END_NODE(["Return / Next"])
```

**CRITICAL — Constant Resolution:**
- The database table target is `KK_T_WRIB_SVC_KEI`, resolved from the constant `JKKBatConst.D_TBL_NAME_KK_T_WRIB_SVC_KEI` = `"KK_T_WRIB_SVC_KEI"`.
- The SC Code for the insert operation is `KK_INSERT_001`, defined as `JKKBatConst.KK_T_WRIB_SVC_KEI_KK_INSERT_001`.
- All 64 field key strings (e.g., `WRIB_SVC_KEI_NO`, `WRIB_SVC_CD`, `GENE_ADD_DTM`, etc.) are literal key names used in the `setValue()` calls, corresponding to the columns of the `KK_T_WRIB_SVC_KEI` table.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `setParam` | `Object[]` | A flat array of 64 elements containing all field values for a single Discount Service Contract record. Index 0 is the discount service contract number, index 1 is the generation timestamp, and the array continues through all contract detail fields, plan fields, reservation fields, cancellation history fields, operator metadata, and audit columns. The caller (parent `execute()` method) is responsible for preparing this array with the correct order and types. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `db_KK_T_WRIB_SVC_KEI` | `JBSbatCommonDBInterface` (inherited) | The data-access component for the `KK_T_WRIB_SVC_KEI` table. Provides the `insertByPrimaryKeys()` method that persists the mapped record to the database using primary-key-based insert. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C | `insertByPrimaryKeys` (JDKBatCommon) | `KK_INSERT_001` | `KK_T_WRIB_SVC_KEI` | Inserts a new Discount Service Contract record into the `KK_T_WRIB_SVC_KEI` table using primary-key-based insert, with all 64 fields from the populated `setMap`. |
| - | `setValue` (JBSbatCommonDBInterface) | - | - | Sets each of the 64 key-value pairs in the `setMap` object, mapping column names to their corresponding values from the `setParam` array. |

**Analysis:**
- The sole database operation is **Create (C)** — a single insert via `insertByPrimaryKeys`.
- The 64 `setValue` calls are data-preparation operations on a local map object (`JBSbatCommonDBInterface`), not database operations. They populate the business data interface with field names and their corresponding values before the insert call.

## 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: `insertByPrimaryKeys` [C], `setValue` [-], `setValue` [-], `setValue` [-], `setValue` [-], `setValue` [-], `setValue` [-], `setValue` [-], `setValue` [-], `setValue` [-], `setValue` [-], `setValue` [-], `setValue` [-], `setValue` [-], `setValue` [-], `setValue` [-], `setValue` [-], `setValue` [-], `setValue` [-], `setValue` [-], `setValue` [-]  # NOSONAR

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: `JBSbatKKCampaignIktAdd.execute()` | `JBSbatKKCampaignIktAdd.execute()` -> `executeKK_T_WRIB_SVC_KEI_PKINSERT` | `insertByPrimaryKeys [C] KK_T_WRIB_SVC_KEI` | # NOSONAR

**Analysis:**
- This method is called exclusively by its parent class's `execute()` method (`JBSbatKKCampaignIktAdd.execute()`).
- The caller prepares the 64-element `setParam` array and then invokes this method to perform the actual database insertion.
- The terminal operation is `insertByPrimaryKeys` on the `KK_T_WRIB_SVC_KEI` table (CRUD type: Create).
- No screen entry points (KKSV) or additional batch entry points reference this method directly.

## 6. Per-Branch Detail Blocks

This method has **no conditional branches** — it follows a single linear execution path:

**Block 1** — [SET] `(map creation and population)` (L1711)

> The method creates a business data interface object and populates it with all 64 field values from the input parameter array. Each `setValue()` call maps a column-name key to its corresponding value from the `setParam` array.

| # | Type | Code |
|---|------|------|
| 1 | SET | `JBSbatCommonDBInterface setMap = new JBSbatCommonDBInterface();` // Create map object [-> `new JBSbatCommonDBInterface()`] |
| 2 | SET | `setMap.setValue("WRIB_SVC_KEI_NO", setParam[0]);` // Discount service contract number |
| 3 | SET | `setMap.setValue("GENE_ADD_DTM", setParam[1]);` // Generation registration year/month/day/hour/minute/second |
| 4 | SET | `setMap.setValue("WRIB_SVC_KEI_STAT", setParam[2]);` // Discount service contract status |
| 5 | SET | `setMap.setValue("SYSID", setParam[3]);` // System ID |
| 6 | SET | `setMap.setValue("WRIB_SVC_CD", setParam[4]);` // Discount service code |
| 7 | SET | `setMap.setValue("PCRS_CD", setParam[5]);` // Price course code |
| 8 | SET | `setMap.setValue("PPLAN_CD", setParam[6]);` // Price plan code |
| 9 | SET | `setMap.setValue("SVC_USE_STA_KIBO_YMD", setParam[7]);` // Service usage start desired date |
| 10 | SET | `setMap.setValue("RSV_TSTA_KIBO_YMD", setParam[8]);` // Reservation application start desired date |
| 11 | SET | `setMap.setValue("MSKM_DTL_NO", setParam[9]);` // Application detail number |
| 12 | SET | `setMap.setValue("SHOSA_YMD", setParam[10]);` // Examination date |
| 13 | SET | `setMap.setValue("SHOSA_CL_YMD", setParam[11]);` // Examination cancellation date |
| 14 | SET | `setMap.setValue("RSV_APLY_YMD", setParam[12]);` // Reservation application date |
| 15 | SET | `setMap.setValue("RSV_CL_YMD", setParam[13]);` // Reservation cancellation date |
| 16 | SET | `setMap.setValue("RSV_APLY_CD", setParam[14]);` // Reservation application code |
| 17 | SET | `setMap.setValue("APLY_JUN", setParam[15]);` // Immediate application flag |
| 18 | SET | `setMap.setValue("PLAN_STAYMD", setParam[16]);` // Plan start year/month |
| 19 | SET | `setMap.setValue("PLAN_ENDYMD", setParam[17]);` // Plan end year/month |
| 20 | SET | `setMap.setValue("PLAN_CHRG_STAYMD", setParam[18]);` // Plan billing start year/month |
| 21 | SET | `setMap.setValue("PLAN_CHRG_ENDYMD", setParam[19]);` // Plan billing end year/month |
| 22 | SET | `setMap.setValue("PLAN_END_SBT_CD", setParam[20]);` // Plan end type code |
| 23 | SET | `setMap.setValue("SVC_CANCEL_YMD", setParam[21]);` // Service cancellation year/month/day |
| 24 | SET | `setMap.setValue("SVC_CANCEL_RSN_CD", setParam[22]);` // Service cancellation reason code |
| 25 | SET | `setMap.setValue("SVC_STA_YMD", setParam[23]);` // Service start year/month/day |
| 26 | SET | `setMap.setValue("SVC_CHRG_STAYMD", setParam[24]);` // Service billing start year/month |
| 27 | SET | `setMap.setValue("SVC_ENDYMD", setParam[25]);` // Service end year/month/day |
| 28 | SET | `setMap.setValue("SVC_CHRG_ENDYMD", setParam[26]);` // Service billing end year/month/day |
| 29 | SET | `setMap.setValue("SVC_DSL_YMD", setParam[27]);` // Service disconnection year/month/day |
| 30 | SET | `setMap.setValue("SVC_DLRE_CD", setParam[28]);` // Service disconnection reason code |
| 31 | SET | `setMap.setValue("SVC_DLRE_MEMO", setParam[29]);` // Service disconnection reason memo |
| 32 | SET | `setMap.setValue("SVC_DSL_TTDKI_FIN_FLG", setParam[30]);` // Service disconnection procedure completion flag |
| 33 | SET | `setMap.setValue("KAIHK_YMD", setParam[31]);` // Recovery year/month/day |
| 34 | SET | `setMap.setValue("SVC_CANCEL_CL_YMD", setParam[32]);` // Service cancellation cancellation year/month/day |
| 35 | SET | `setMap.setValue("SVC_DSL_CL_YMD", setParam[33]);` // Service disconnection cancellation year/month/day |
| 36 | SET | `setMap.setValue("CHRG_STA_YMD_HOSEI_UM", setParam[34]);` // Billing start date correction flag |
| 37 | SET | `setMap.setValue("SKEKKA_SEND_CD", setParam[35]);` // Review result transmission code |
| 38 | SET | `setMap.setValue("PNLTY_HASSEI_CD", setParam[36]);` // Penalty occurrence code |
| 39 | SET | `setMap.setValue("IDO_DIV", setParam[37]);` // Movement classification |
| 40 | SET | `setMap.setValue("SHOSA_DSL_FIN_CD", setParam[38]);` // Examination disconnection completion code |
| 41 | SET | `setMap.setValue("KEI_CNC_YMD", setParam[39]);` // Contract closure year/month/day |
| 42 | SET | `setMap.setValue("GRP_CD", setParam[40]);` // Group code |
| 43 | SET | `setMap.setValue("INTR_CD", setParam[41]);` // Referral code |
| 44 | SET | `setMap.setValue("MSKM_KISAN_YMD", setParam[42]);` // Application origin year/month/day |
| 45 | SET | `setMap.setValue("WRIB_ADD_OPTY_CD", setParam[43]);` // Discount registration trigger code |
| 46 | SET | `setMap.setValue("WRIB_DSL_CNCL_OPTY_CD", setParam[44]);` // Discount disconnection cancellation trigger code |
| 47 | SET | `setMap.setValue("WRIB_SVC_KEI_AT_KEIZK_SKCD", setParam[45]);` // Discount service contract auto-continuation identification code |
| 48 | SET | `setMap.setValue("WRIB_AMNT_SNST_STDARDYMD", setParam[46]);` // Discount amount calculation standard year/month/day |
| 49 | SET | `setMap.setValue("WRIB_CHRG_STA_MON_STI_CD", setParam[47]);` // Discount billing start month designation code |
| 50 | SET | `setMap.setValue("WRIB_ADD_YMD", setParam[48]);` // Discount registration year/month/day |
| 51 | SET | `setMap.setValue("WRTGKEI_SVC_PAUSE_YMD", setParam[49]);` // Discount target contract service pause year/month/day |
| 52 | SET | `setMap.setValue("WRTGKEI_SVC_PAUSE_RLS_YMD", setParam[50]);` // Discount target contract service pause release year/month/day |
| 53 | SET | `setMap.setValue("ADD_DTM", setParam[51]);` // Registration year/month/day/hour/minute/second |
| 54 | SET | `setMap.setValue("ADD_OPEACNT", setParam[52]);` // Registering operator account |
| 55 | SET | `setMap.setValue("UPD_DTM", setParam[53]);` // Update year/month/day/hour/minute/second |
| 56 | SET | `setMap.setValue("UPD_OPEACNT", setParam[54]);` // Updating operator account |
| 57 | SET | `setMap.setValue("DEL_DTM", setParam[55]);` // Deletion year/month/day/hour/minute/second |
| 58 | SET | `setMap.setValue("DEL_OPEACNT", setParam[56]);` // Deleting operator account |
| 59 | SET | `setMap.setValue("MK_FLG", setParam[57]);` // Invalid flag |
| 60 | SET | `setMap.setValue("ADD_UNYO_YMD", setParam[58]);` // Registration operation year/month |
| 61 | SET | `setMap.setValue("ADD_TRN_ID", setParam[59]);` // Registration process ID |
| 62 | SET | `setMap.setValue("UPD_UNYO_YMD", setParam[60]);` // Update operation year/month |
| 63 | SET | `setMap.setValue("UPD_TRN_ID", setParam[61]);` // Update process ID |
| 64 | SET | `setMap.setValue("DEL_UNYO_YMD", setParam[62]);` // Deletion operation year/month |
| 65 | SET | `setMap.setValue("DEL_TRN_ID", setParam[63]);` // Deletion process ID |

**Block 2** — [CALL] `(database insert)` (L1777)

> Calls the data-access component's primary-key-based insert method to persist the fully-populated record to the `KK_T_WRIB_SVC_KEI` database table.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `db_KK_T_WRIB_SVC_KEI.insertByPrimaryKeys(setMap);` // Execute DB access — inserts the discount service contract record using primary keys [-> SC Code: `KK_INSERT_001`, Table: `KK_T_WRIB_SVC_KEI`] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `WRIB_SVC_KEI_NO` | Field | Discount service contract number — unique identifier for a discount/service-contract agreement |
| `WRIB_SVC_KEI_STAT` | Field | Discount service contract status — current state of the contract (e.g., active, cancelled) |
| `WRIB_SVC_CD` | Field | Discount service code — classification code for the type of discount service |
| `PCRS_CD` | Field | Price course code — identifies the pricing plan/course selected |
| `PPLAN_CD` | Field | Price plan code — identifies the specific price plan within a course |
| `GENE_ADD_DTM` | Field | Generation registration datetime — timestamp when the record was originally generated/created |
| `SVC_USE_STA_KIBO_YMD` | Field | Service usage start desired date — date the customer wishes to begin using the service |
| `RSV_TSTA_KIBO_YMD` | Field | Reservation application start desired date — date the customer wishes the reservation to take effect |
| `MSKM_DTL_NO` | Field | Application detail number — internal tracking number for the application detail line |
| `SHOSA_YMD` | Field | Examination date — date of the application review/examination |
| `SHOSA_CL_YMD` | Field | Examination cancellation date — date the examination was cancelled |
| `RSV_APLY_YMD` | Field | Reservation application date — date the reservation was applied |
| `RSV_CL_YMD` | Field | Reservation cancellation date — date the reservation was cancelled |
| `RSV_APLY_CD` | Field | Reservation application code — classification code for the reservation application type |
| `APLY_JUN` | Field | Immediate application flag — indicates whether the service is applied immediately |
| `PLAN_STAYMD` | Field | Plan start year/month — when the billing plan starts |
| `PLAN_ENDYMD` | Field | Plan end year/month — when the billing plan ends |
| `PLAN_CHRG_STAYMD` | Field | Plan billing start year/month — when billing for the plan begins |
| `PLAN_CHRG_ENDYMD` | Field | Plan billing end year/month — when billing for the plan ends |
| `PLAN_END_SBT_CD` | Field | Plan end type code — classification of how/why the plan ended |
| `SVC_CANCEL_YMD` | Field | Service cancellation year/month/day — date the service was cancelled |
| `SVC_CANCEL_RSN_CD` | Field | Service cancellation reason code — reason classification for the cancellation |
| `SVC_STA_YMD` | Field | Service start year/month/day — date the service became active |
| `SVC_CHRG_STAYMD` | Field | Service billing start year/month — date billing for the service started |
| `SVC_ENDYMD` | Field | Service end year/month/day — date the service ended |
| `SVC_CHRG_ENDYMD` | Field | Service billing end year/month/day — date billing for the service ended |
| `SVC_DSL_YMD` | Field | Service disconnection year/month/day — date the service was disconnected |
| `SVC_DLRE_CD` | Field | Service disconnection reason code — reason code for the disconnection |
| `SVC_DLRE_MEMO` | Field | Service disconnection reason memo — free-text notes about the disconnection |
| `SVC_DSL_TTDKI_FIN_FLG` | Field | Service disconnection procedure completion flag — indicates if disconnection procedure is finished |
| `KAIHK_YMD` | Field | Recovery year/month/day — date the service was recovered/restored |
| `SVC_CANCEL_CL_YMD` | Field | Service cancellation cancellation date — date a prior cancellation was itself cancelled (reversed) |
| `SVC_DSL_CL_YMD` | Field | Service disconnection cancellation date — date a prior disconnection was cancelled (reversed) |
| `CHRG_STA_YMD_HOSEI_UM` | Field | Billing start date correction flag — indicates whether the billing start date was corrected |
| `SKEKKA_SEND_CD` | Field | Review result transmission code — code indicating whether review results were transmitted |
| `PNLTY_HASSEI_CD` | Field | Penalty occurrence code — indicates if/when penalty charges apply |
| `IDO_DIV` | Field | Movement classification — indicates account movement type (e.g., transfer, change) |
| `SHOSA_DSL_FIN_CD` | Field | Examination disconnection completion code — indicates examination disconnection status |
| `KEI_CNC_YMD` | Field | Contract closure year/month/day — date the contract was formally closed |
| `GRP_CD` | Field | Group code — identifies the customer group or campaign group |
| `INTR_CD` | Field | Referral code — code for the referral source that brought in the customer |
| `MSKM_KISAN_YMD` | Field | Application origin year/month/day — date from which the application is calculated |
| `WRIB_ADD_OPTY_CD` | Field | Discount registration trigger code — what event triggered this discount registration |
| `WRIB_DSL_CNCL_OPTY_CD` | Field | Discount disconnection cancellation trigger code — what event triggered the discount disconnection cancellation |
| `WRIB_SVC_KEI_AT_KEIZK_SKCD` | Field | Discount service contract auto-continuation identification code — identifies auto-renewing contracts |
| `WRIB_AMNT_SNST_STDARDYMD` | Field | Discount amount calculation standard year/month/day — the date used as standard for discount amount calculation |
| `WRIB_CHRG_STA_MON_STI_CD` | Field | Discount billing start month designation code — code specifying which month billing starts |
| `WRIB_ADD_YMD` | Field | Discount registration year/month/day — date the discount was registered |
| `WRTGKEI_SVC_PAUSE_YMD` | Field | Discount target contract service pause date — date the service was put on pause |
| `WRTGKEI_SVC_PAUSE_RLS_YMD` | Field | Discount target contract service pause release date — date the service pause was lifted |
| `ADD_DTM` | Field | Registration datetime — timestamp of record creation |
| `ADD_OPEACNT` | Field | Registering operator account — account ID of who created the record |
| `UPD_DTM` | Field | Update datetime — timestamp of last record modification |
| `UPD_OPEACNT` | Field | Updating operator account — account ID of who last modified the record |
| `DEL_DTM` | Field | Deletion datetime — timestamp of record soft-deletion |
| `DEL_OPEACNT` | Field | Deleting operator account — account ID of who deleted the record |
| `MK_FLG` | Field | Invalid flag — indicates whether the record is marked as invalid/deleted |
| `ADD_UNYO_YMD` | Field | Registration operation year/month — business operation date of registration |
| `ADD_TRN_ID` | Field | Registration process ID — transaction/process ID for the registration |
| `UPD_UNYO_YMD` | Field | Update operation year/month — business operation date of update |
| `UPD_TRN_ID` | Field | Update process ID — transaction/process ID for the update |
| `DEL_UNYO_YMD` | Field | Deletion operation year/month — business operation date of deletion |
| `DEL_TRN_ID` | Field | Deletion process ID — transaction/process ID for the deletion |
| `KK_T_WRIB_SVC_KEI` | Table | Discount service contract table — database table storing discount service contract agreements |
| `WRIB` | Acronym | Discount (from Japanese 割引 — waribiki) — relates to discount/promotional service contracts |
| `KEI` | Acronym | Contract (from Japanese 契約 — keiyaku) — relates to contractual agreements |
| `SVC` | Acronym | Service — abbreviation for service-related fields |
| `DS` | Acronym | Discount Service — the domain entity representing a discount/service-contract agreement |
| `KK_INSERT_001` | SC Code | Insert service component code for the `KK_T_WRIB_SVC_KEI` table |
| `JBSbatCommonDBInterface` | Class | Business data interface — a common data-mapping object that holds key-value pairs of column names to values for batch database operations |
| `insertByPrimaryKeys` | Method | Batch database insert operation that creates a record using primary-key-based insertion |
| JBSbat | Module | Japanese Batch system — batch processing module in the enterprise application |
| KK | Module prefix | Contract/Campaign domain prefix — identifies this class as part of the contract/campaign batch processing |
