# Business Logic — JBSbatTUBmpKojiFinTrn.executeKK_T_KICJKN_PKINSERT() [39 LOC]

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

## 1. Role

### JBSbatTUBmpKojiFinTrn.executeKK_T_KICJKN_PKINSERT()

This method performs a **primary-key-based database insert** for the `KK_T_KICJKN` (Temporary Fee Contract Table) entity. It is a private helper method used exclusively by `insertBmpKoji()` during the batch phone number assignment procedure (電話番号割当手数料登録処理 — phone number assignment fee registration processing). The `insertBmpKoji` caller prepares temporary fee setting data by querying `KK_T_ICJKN_SETTE`, resolving the temporary fee amount (either from the full temporary payment price or half of it, depending on the fee setting code), and then builds a flat `Object[]` array (`setParamKichkn`) containing all 31 fields — including generated sequence numbers, mapped service contract IDs, calculated amounts, and audit fields — which is passed to this method. This method acts as a **data mapper + CRUD delegate**: it receives the flat array, constructs a `JBSbatCommonDBInterface` map by associating each 31 field name with the corresponding array element, and delegates the actual SQL `INSERT` to `db_KK_T_KICJKN.insertByPrimaryKeys(setMap)`. The method follows a **straight-through processing** design with no conditional branches, implementing the Builder and Data Mapper patterns. Its role in the larger system is the final persistence step of the temporary fee (一時金 — icchikin) contract registration flow within the batch process that completes phone number assignment work items (番ework完了処理部品).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeKK_T_KICJKN_PKINSERT(setParam)"])

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

    S1 --> S2["Map 31 fields from setParam array to setMap"]

    S2 --> S2A["Fields 0-10: KICJKN_NO through OWNR_KEI_NO"]
    S2A --> S2B["Fields 11-17: ICJKN_AMNT through MANS_ICJKN_HSI_OPTY_CD"]
    S2B --> S2C["Fields 18-30: Audit fields (ADD/UPD/DEL timestamps, operators, flags, transaction IDs)"]

    S2C --> DB["db_KK_T_KICJKN.insertByPrimaryKeys(setMap)"]

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

**Processing flow:**
1. **Initialize** — Create a new `JBSbatCommonDBInterface` instance (`setMap`) to serve as the DB parameter map.
2. **Map fields 0–10** — Map the core identity and contract reference fields: `KICJKN_NO` (Temporary Fee Number) through `OWNR_KEI_NO` (Owner Contract Number).
3. **Map fields 11–17** — Map the financial and status fields: `ICJKN_AMNT` (Temporary Fee Amount) through `MANS_ICJKN_HSI_OPTY_CD` (Apartment Trigger Code).
4. **Map fields 18–30** — Map the audit/tracking fields: `ADD_DTM` (Registration Timestamp) through `DEL_TRN_ID` (Deletion Transaction ID).
5. **Execute DB insert** — Call `db_KK_T_KICJKN.insertByPrimaryKeys(setMap)` to persist the record into the `KK_T_KICJKN` table using primary-key-based insertion.
6. **Return** — Method returns `void`; execution continues to the next step in the caller (`insertBmpKoji`).

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `setParam` | `Object[]` | A flat array of 31 elements carrying all field values for a single row insert into the Temporary Fee Contract table (`KK_T_KICJKN`). Index 0–10 carry identity and contract reference IDs (temporary fee number, service contract numbers, owner contract number). Index 11–17 carry financial data (fee amount) and business status codes (application status, cancellation linkage status, work order numbers, apartment-specific codes). Index 18–30 carry audit/tracking metadata (registration/update/deletion timestamps, operator accounts, inactivation flag, transaction tracking IDs). The values are prepared by the caller `insertBmpKoji()` which reads from `KK_T_ICJKN_SETTE` and generates a sequence number for the primary key. |

**Instance fields / external state read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `db_KK_T_KICJKN` | `JBSbatSQLAccess` | Database access object initialized with the `KK_T_KICJKN` table name. Used to execute the primary-key insert operation. Initialized in the parent method's constructor/setup block via `new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_KICJKN)`. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| I | `db_KK_T_KICJKN.insertByPrimaryKeys` | - | `KK_T_KICJKN` (Temporary Fee Contract Table) | Primary-key-based insert of a temporary fee contract record. The `setMap` contains all 31 fields mapped from the `setParam` array. This is the sole data persistence operation of this method. |

**Classification reasoning:**
- `insertByPrimaryKeys` is an insert (C) operation — it inserts a new row into the database using primary key columns as the unique identifier.
- The target table is `KK_T_KICJKN` as confirmed by the `D_TBL_NAME_KK_T_KICJKN` constant defined in this class (line 51).
- No SC (Service Component) or CBS (Component Business Service) codes are directly referenced — this method uses the `JBSbatSQLAccess` abstraction layer directly rather than calling SC-level methods.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: `JBSbatTUBmpKojiFinTrn.insertBmpKoji` | `insertBmpKoji(inMap)` -> `executeKK_T_KICJKN_PKINSERT(setParamKichkn)` | `insertByPrimaryKeys [C] KK_T_KICJKN` |

**Full call chain:**
The caller `insertBmpKoji()` is a private method of the same class `JBSbatTUBmpKojiFinTrn`. It is invoked during the batch phone number assignment completion process. Within `insertBmpKoji`, a `setParamKichkn` Object array (31 elements) is built by querying the `KK_T_ICJKN_SETTE` table, applying conditional fee amount resolution (full amount vs. half amount based on `ICJKN_SETTE_CD`), and then calling `executeKK_T_KICJKN_PKINSERT(setParamKichkn)`. This method serves as the persistence bridge between the business logic in `insertBmpKoji` and the database layer. No screen-level entry points were found; this method is exclusively invoked from batch processing context.

## 6. Per-Branch Detail Blocks

> This method has **no conditional branches** — it follows a straight-through processing pattern with sequential field mappings and a single DB call.

**Block 1** — [PROCESS] Field Mapping Setup (L408)

> Create the database parameter map object that will hold all 31 field values.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setMap = new JBSbatCommonDBInterface()` // Initialize empty DB interface map for the 31 fields |

**Block 2** — [PROCESS] Core Identity & Contract References (L409–L419)

> Map the first 11 fields (indices 0–10) that identify the temporary fee record and its associated contract references. These fields form the business identity of the record.

| # | Type | Code | Code (continued) |
|---|------|------|------|
| 1 | SET | `setMap.setValue("KICJKN_NO", setParam[0])` // Temporary Fee Number [-> Field 0: Generated sequence number from SEQ_KICJKN_NO] |
| 2 | SET | `setMap.setValue("TMP_PAY_PRC_NO", setParam[1])` // Temporary Payment Price Number [-> Field 1: From KK_T_ICJKN_SETTE.TMP_PAY_PRC_NO] |
| 3 | SET | `setMap.setValue("ICJKN_SETTE_NO", setParam[2])` // Fee Setting Number [-> Field 2: From KK_T_ICJKN_SETTE.ICJKN_SETTE_NO] |
| 4 | SET | `setMap.setValue("SVC_KEI_NO", setParam[3])` // Service Contract Number [-> Field 3: From KK_T_ICJKN_SETTE.SVC_KEI_NO] |
| 5 | SET | `setMap.setValue("SVC_KEI_UCWK_NO", setParam[4])` // Service Contract Detail Number [-> Field 4: From KK_T_ICJKN_SETTE.SVC_KEI_UCWK_NO] |
| 6 | SET | `setMap.setValue("KKTK_SVC_KEI_NO", setParam[5])` // Equipment Provision Service Contract Number [-> Field 5: From KK_T_ICJKN_SETTE.KKTK_SVC_KEI_NO] |
| 7 | SET | `setMap.setValue("OP_SVC_KEI_NO", setParam[6])` // Option Service Contract Number [-> Field 6: From KK_T_ICJKN_SETTE.OP_SVC_KEI_NO] |
| 8 | SET | `setMap.setValue("SBOP_SVC_KEI_NO", setParam[7])` // Sub-Option Service Contract Number [-> Field 7: From KK_T_ICJKN_SETTE.SBOP_SVC_KEI_NO] |
| 9 | SET | `setMap.setValue("SEIOPSVC_KEI_NO", setParam[8])` // Billing Option Service Contract Number [-> Field 8: From KK_T_ICJKN_SETTE.SEIOPSVC_KEI_NO] |
| 10 | SET | `setMap.setValue("WRIB_SVC_KEI_NO", setParam[9])` // Discount Service Contract Number [-> Field 9: From KK_T_ICJKN_SETTE.WRIB_SVC_KEI_NO] |
| 11 | SET | `setMap.setValue("OWNR_KEI_NO", setParam[10])` // Owner Contract Number [-> Field 10: Always null (not used for this record type)] |

**Block 3** — [PROCESS] Financial Data & Business Status (L420–L426)

> Map the financial amount and business status fields. The `ICJKN_AMNT` value is calculated upstream by `insertBmpKoji()` — either the full temporary payment price amount or half of it (rounded down), depending on the fee setting code (`ICJKN_SETTE_CD`).

| # | Type | Code |
|---|------|------|
| 1 | SET | `setMap.setValue("ICJKN_AMNT", setParam[11])` // Temporary Fee Amount [-> Field 11: Full or half amount resolved by ICJKN_SETTE_CD in caller] |
| 2 | SET | `setMap.setValue("ICJKN_SETTE_APLY_MON", setParam[12])` // Fee Setting Application Month [-> Field 12: Month the fee setting takes effect] |
| 3 | SET | `setMap.setValue("APLY_STAT_CD", setParam[13])` // Application Status Code [-> Field 13: Current state of the application] |
| 4 | SET | `setMap.setValue("CL_RENKEI_STAT_CD", setParam[14])` // Cancellation Linkage Status Code [-> Field 14: Status of cancellation integration] |
| 5 | SET | `setMap.setValue("HSI_KIIN_KJAK_NO", setParam[15])` // Occurrence-Inspired Work Order Number [-> Field 15: Work order that triggered this fee] |
| 6 | SET | `setMap.setValue("MANS_ICJKN_HSI_MT_KEI_SKCD", setParam[16])` // Apartment Temporary Fee Occurrence Source Contract Identification Code [-> Field 16: Apartment-specific source contract code] |
| 7 | SET | `setMap.setValue("MANS_ICJKN_HSI_OPTY_CD", setParam[17])` // Apartment Temporary Fee Occurrence Trigger Code [-> Field 17: Trigger code for the fee occurrence] |

**Block 4** — [PROCESS] Audit & Tracking Fields (L427–L439)

> Map the 13 audit and system tracking fields that support operational integrity. These cover registration, update, and deletion lifecycle management including timestamps, operator accounts, the inactivation flag (`MK_FLG`), business day tracking, and transaction correlation IDs.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setMap.setValue("ADD_DTM", setParam[18])` // Registration Date/Time [-> Field 18: Timestamp of record creation] |
| 2 | SET | `setMap.setValue("ADD_OPEACNT", setParam[19])` // Registration Operator Account [-> Field 19: User who created the record] |
| 3 | SET | `setMap.setValue("UPD_DTM", setParam[20])` // Update Date/Time [-> Field 20: Timestamp of last update] |
| 4 | SET | `setMap.setValue("UPD_OPEACNT", setParam[21])` // Update Operator Account [-> Field 21: User who last updated the record] |
| 5 | SET | `setMap.setValue("DEL_DTM", setParam[22])` // Deletion Date/Time [-> Field 22: Timestamp of logical deletion] |
| 6 | SET | `setMap.setValue("DEL_OPEACNT", setParam[23])` // Deletion Operator Account [-> Field 23: User who deleted the record] |
| 7 | SET | `setMap.setValue("MK_FLG", setParam[24])` // Inactivation Flag [-> Field 24: Whether the record is marked inactive] |
| 8 | SET | `setMap.setValue("ADD_UNYO_YMD", setParam[25])` // Registration Business Day [-> Field 25: Business date of registration] |
| 9 | SET | `setMap.setValue("ADD_TRN_ID", setParam[26])` // Registration Transaction ID [-> Field 26: Transaction correlation ID for registration] |
| 10 | SET | `setMap.setValue("UPD_UNYO_YMD", setParam[27])` // Update Business Day [-> Field 27: Business date of last update] |
| 11 | SET | `setMap.setValue("UPD_TRN_ID", setParam[28])` // Update Transaction ID [-> Field 28: Transaction correlation ID for update] |
| 12 | SET | `setMap.setValue("DEL_UNYO_YMD", setParam[29])` // Deletion Business Day [-> Field 29: Business date of deletion] |
| 13 | SET | `setMap.setValue("DEL_TRN_ID", setParam[30])` // Deletion Transaction ID [-> Field 30: Transaction correlation ID for deletion] |

**Block 5** — [EXEC] Primary-Key Insert (L442)

> Execute the database insert. This is the terminal operation of this method.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `db_KK_T_KICJKN.insertByPrimaryKeys(setMap)` // Insert record into KK_T_KICJKN using primary keys. Table: KK_T_KICJKN. SC: - |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `KICJKN_NO` | Field | Temporary Fee Number — unique identifier for a temporary fee contract record, generated via sequence `SEQ_KICJKN_NO` (12-digit formatted) |
| `ICJKN` | Abbreviation | Temporary Fee (一時金) — a one-time fee charged in addition to regular service charges |
| `TMP_PAY_PRC_NO` | Field | Temporary Payment Price Number — references the temporary payment price master record that defines the fee amount |
| `ICJKN_SETTE_NO` | Field | Fee Setting Number — links to the temporary fee setting configuration record in `KK_T_ICJKN_SETTE` |
| `ICJKN_SETTE_CD` | Field | Fee Setting Code — classification code determining fee calculation mode: `YK` (full amount) or `HALF` (half amount) |
| `SVC_KEI_NO` | Field | Service Contract Number — primary identifier for the customer's service contract |
| `SVC_KEI_UCWK_NO` | Field | Service Contract Detail Number — line-item identifier within a service contract (UCWK = 内訳, detail/breakdown) |
| `KKTK_SVC_KEI_NO` | Field | Equipment Provision Service Contract Number — contract for equipment provision services (機器提供サービス) |
| `OP_SVC_KEI_NO` | Field | Option Service Contract Number — contract for optional/add-on services |
| `SBOP_SVC_KEI_NO` | Field | Sub-Option Service Contract Number — nested optional service contract |
| `SEIOPSVC_KEI_NO` | Field | Billing Option Service Contract Number — option services associated with billing |
| `WRIB_SVC_KEI_NO` | Field | Discount Service Contract Number — contracts related to service discounts (割引) |
| `OWNR_KEI_NO` | Field | Owner Contract Number — reference to the property owner's contract; null for temporary fee records |
| `ICJKN_AMNT` | Field | Temporary Fee Amount — the monetary value of the one-time fee, derived from the temporary payment price (full or half based on setting code), rounded down to integer |
| `ICJKN_SETTE_APLY_MON` | Field | Fee Setting Application Month — the month when the fee setting becomes effective |
| `APLY_STAT_CD` | Field | Application Status Code — current processing status of the application |
| `CL_RENKEI_STAT_CD` | Field | Cancellation Linkage Status Code — tracks integration status with cancellation processing (取消連携) |
| `HSI_KIIN_KJAK_NO` | Field | Occurrence-Inspired Work Order Number — work order number that triggered the fee occurrence (発生起因工事案件) |
| `MANS_ICJKN_HSI_MT_KEI_SKCD` | Field | Apartment Temporary Fee Occurrence Source Contract Identification Code — apartment-specific contract identification code for fee triggers |
| `MANS_ICJKN_HSI_OPTY_CD` | Field | Apartment Temporary Fee Occurrence Trigger Code — code identifying the trigger event for the apartment fee |
| `ADD_DTM` | Field | Registration Date/Time — timestamp when the record was created (ADD = 登録) |
| `ADD_OPEACNT` | Field | Registration Operator Account — user account that created the record |
| `UPD_DTM` | Field | Update Date/Time — timestamp of the last modification (UPD = 更新) |
| `UPD_OPEACNT` | Field | Update Operator Account — user account that last modified the record |
| `DEL_DTM` | Field | Deletion Date/Time — timestamp of logical deletion (DEL = 削除) |
| `DEL_OPEACNT` | Field | Deletion Operator Account — user account that deleted the record |
| `MK_FLG` | Field | Inactivation Flag — marks the record as inactive rather than hard-deleting it (無効フラグ) |
| `ADD_UNYO_YMD` | Field | Registration Business Day — business date (運用年月日) of record creation |
| `ADD_TRN_ID` | Field | Registration Transaction ID — transaction correlation ID for audit tracing |
| `UPD_UNYO_YMD` | Field | Update Business Day — business date of last update |
| `UPD_TRN_ID` | Field | Update Transaction ID — transaction correlation ID for update tracing |
| `DEL_UNYO_YMD` | Field | Deletion Business Day — business date of deletion |
| `DEL_TRN_ID` | Field | Deletion Transaction ID — transaction correlation ID for deletion tracing |
| `KK_T_KICJKN` | DB Table | Temporary Fee Contract Table — database table storing temporary fee contract records |
| `KK_T_ICJKN_SETTE` | DB Table | Temporary Fee Setting Table — reference table containing temporary fee configuration and setting definitions |
| `insertBmpKoji` | Method | Batch Phone Number Assignment Fee Registration Processing (電話番号割当手数料登録処理) — caller method that orchestrates the temporary fee registration flow |
| `JBSbatCommonDBInterface` | Class | Common database interface — framework class used to build parameter maps for DB operations |
| `JBSbatSQLAccess` | Class | SQL access abstraction — framework class providing `insertByPrimaryKeys`, `selectNext`, etc. for database interaction |
| `insertByPrimaryKeys` | Method | Primary-key-based insert operation — inserts a row using primary key columns as the unique row identifier |
| 一時金 (Isshikin) | Japanese term | One-time fee / temporary charge — a non-recurring fee charged at contract activation or service changes |
| 一時支払料金 (Ichiji Shihara Ryokin) | Japanese term | Temporary payment price — the reference price record from which the actual temporary fee amount is derived |
| 一時金設定 (Isshikin Settei) | Japanese term | Temporary fee setting — the configuration record that defines how temporary fees are calculated and applied |
| 番ework完了処理 (Bangō Kanryō Shori) | Japanese term | Phone number completion processing — the batch process phase that finalizes phone number assignment work items |
| 手数料登録処理 (Shuteryo Touroku Shori) | Japanese term | Fee registration processing — the process of registering fees associated with service operations |
| `D_TBL_NAME_KK_T_KICJKN` | Constant | Table name constant — resolves to `"KK_T_KICJKN"`, used to initialize the SQL access object |
| `SEQ_KICJKN_NO` | Constant | Sequence name constant — resolves to a sequence identifier for generating 12-digit formatted temporary fee numbers |
| `JTUStrConst.TEL_WARIATE_CMS` | Constant | CMS placeholder constant — used as a fixed filter value in the WHERE clause of the setting record query |
| `ICJKN_SETTE_CD_YK` | Constant | Fee setting code for full amount — when matched, the full temporary payment price is used as the fee amount |
| `ICJKN_SETTE_CD_HALF` | Constant | Fee setting code for half amount — when matched, half the temporary payment price (rounded down) is used as the fee amount |
