# Business Logic — JBSbatKKKjClDataInTrn.insertOpsvckei() [360 LOC]

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

## 1. Role

### JBSbatKKKjClDataInTrn.insertOpsvckei()

This method registers (inserts) an **Option Service Contract** (オプションサービス契約) record into the `KK_T_OP_SVC_KEI` table — the core option service contract entity. The option service contract is a secondary, add-on service tier layered on top of a customer's primary service contract (e.g., adding Netflix as a premium add-on to an eo Net broadband plan).

The method implements a **builder + delegation pattern**. It first performs a PK lookup on the `KK_T_OP_SVC_KEI` table to retrieve the existing option service contract record, then constructs a 79-element parameter array by extracting fields from the retrieved record. It sets the contract status to "910" (Canceled/Resolved) and applies Netflix-specific date logic when the call originates from the Netflix premium option cancellation flow.

The method serves as a **shared service utility** called by `dslNetflixOption()` and `execute()` within `JBSbatKKKjClDataInTrn` — the batch processing entry point. It plays a critical role in the service lifecycle management system, acting as the bridge between the Netflix premium option cancellation workflow and the permanent closure of the option service contract record in the database.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["insertOpsvckei(inMap, isDslNetFlix, kojiakFinYmd_151)"])
    START --> CHECK_NETFLIX{"isDslNetFlix?"}

    CHECK_NETFLIX -->|true| CALC_BEFORE["Calculate beforeDay = adjustDate(kojiakFinYmd_151, -1)"]
    CHECK_NETFLIX -->|false| SKIP_BEFORE["beforeDay = empty string"]

    CALC_BEFORE --> BUILD_WHERE["Build whereParam [opSvcKeiNo, geneAddDtm]"]
    SKIP_BEFORE --> BUILD_WHERE

    BUILD_WHERE --> PKSELECT["executeKK_T_OP_SVC_KEI_PKSELECT(whereParam)"]
    PKSELECT --> CHECK_NULL{"outMap == null?"}

    CHECK_NULL -->|true| RETURN_NIL["return (early exit)"]
    CHECK_NULL -->|false| GET_SYS["getSystemDateTimeStamp()"]

    GET_SYS --> BUILD_PARAM["Create param_add[] (79-element array)"]
    BUILD_PARAM --> POPULATE["Populate param_add[0..78] from outMap fields"]

    POPULATE --> NETFLIX_DATE1{"isDslNetFlix?"}

    NETFLIX_DATE1 -->|true| SET_NETFLIX_DATE1["param_add[23..24]: opeDate + RSV_CL_YMD"]
    NETFLIX_DATE1 -->|false| SET_NORM_DATE1["param_add[23..24]: RSV_APLY_YMD + empty"]

    SET_NETFLIX_DATE1 --> NETFLIX_DATE2{"isDslNetFlix?"}
    SET_NORM_DATE1 --> NETFLIX_DATE2

    NETFLIX_DATE2 -->|true| SET_NETFLIX_DATE2["param_add[27]: beforeDay"]
    NETFLIX_DATE2 -->|false| SET_NORM_DATE2["param_add[27]: opeDate"]

    SET_NETFLIX_DATE2 --> NETFLIX_DATE3{"isDslNetFlix?"}
    SET_NORM_DATE2 --> NETFLIX_DATE3

    NETFLIX_DATE3 -->|true| SET_NETFLIX_DATE3["param_add[29..30]: beforeDay + PLAN_END_SBT_CD_MSDDSL"]
    NETFLIX_DATE3 -->|false| SET_NORM_DATE3["param_add[29..30]: opeDate + PLAN_END_SBT_CD_CANCEL"]

    SET_NETFLIX_DATE3 --> NETFLIX_DATE4{"isDslNetFlix?"}
    SET_NORM_DATE3 --> NETFLIX_DATE4

    NETFLIX_DATE4 -->|true| SET_NETFLIX_DATE4["param_add[48]: beforeDay"]
    NETFLIX_DATE4 -->|false| SET_NORM_DATE4["param_add[48]: opeDate"]

    SET_NETFLIX_DATE4 --> NETFLIX_DATE5{"isDslNetFlix?"}
    SET_NORM_DATE4 --> NETFLIX_DATE5

    NETFLIX_DATE5 -->|true| SET_NETFLIX_DATE5["param_add[50]: beforeDay"]
    NETFLIX_DATE5 -->|false| SET_NORM_DATE5["param_add[50]: opeDate"]

    SET_NETFLIX_DATE5 --> NETFLIX_DATE6{"isDslNetFlix?"}
    SET_NORM_DATE5 --> NETFLIX_DATE6

    NETFLIX_DATE6 -->|true| SET_NETFLIX_DATE6["param_add[52]: SVC_DLRE_CD_NORMAL + empty flag"]
    NETFLIX_DATE6 -->|false| SET_NORM_DATE6["param_add[52]: SVC_DLRE_CD_CANCEL + outMap flag"]

    SET_NETFLIX_DATE6 --> NETFLIX_DATE7{"isDslNetFlix?"}
    SET_NORM_DATE6 --> NETFLIX_DATE7

    NETFLIX_DATE7 -->|true| SET_NETFLIX_DATE7["param_add[58]: empty"]
    NETFLIX_DATE7 -->|false| SET_NORM_DATE7["param_add[58]: outMap SVC_DSL_CL_YMD"]

    SET_NETFLIX_DATE7 --> NETFLIX_DATE8{"isDslNetFlix?"}
    SET_NORM_DATE7 --> NETFLIX_DATE8

    NETFLIX_DATE8 -->|true| SET_NETFLIX_PNLTY["param_add[62]: CD01375_PNLTY_HASSEI_CD_0 (no penalty)"]
    NETFLIX_DATE8 -->|false| SET_NORM_PNLTY["param_add[62]: outMap PNLTY_HASSEI_CD"]

    SET_NETFLIX_PNLTY --> MK_FLG_SET["param_add[72]: MK_FLG_YK (0 = valid)"]
    SET_NORM_PNLTY --> MK_FLG_SET

    MK_FLG_SET --> INSERT["executeKK_T_OP_SVC_KEI_PKINSERT(param_add)"]
    INSERT --> SUBTYPE["JKKBatCommon.createSubTypeKK0351(commonItem, opsvckeino, ...)"]
    SUBTYPE --> END(["Return / Next"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `inMap` | `JBSbatCommonDBInterface` | Input data carrier containing the option service contract search results — carries the option service contract number (`OP_SVC_KEI_NO`) and generated addition datetime (`GENE_ADD_DTM`) used for PK lookup |
| 2 | `isDslNetFlix` | `boolean` | Netflix Premium Option cancellation flag — `true` indicates the contract cancellation originates from the Netflix premium option cancellation flow (added in v52.00.00 for ANK-3987-00-00 Netflix integration); `false` for regular service contract cancellations |
| 3 | `kojiakFinYmd_151` | `String` | Work key settlement year/month/day (工事完了年月日) — used only when `isDslNetFlix` is `true` to compute the before-day date for Netflix cancellation date calculations; not set for non-Netflix cancellations |

**Instance fields read:**
| Field | Type | Business Description |
|-------|------|---------------------|
| `commonItem` | Instance field | Common item data carrier passed to `createSubTypeKK0351()` for subtype record creation |
| `opeDate` | Instance field | Operation date (String) — the system-determined business date used for plan end dates, service end dates, service cancellation dates, etc., when `isDslNetFlix` is `false` or as fallback for Netflix cancellations |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `executeKK_T_OP_SVC_KEI_PKSELECT(whereParam)` | — | `KK_T_OP_SVC_KEI` | Performs primary key SELECT on the option service contract table to retrieve the contract record for cancellation processing |
| C | `this.executeKK_T_OP_SVC_KEI_PKINSERT(param_add)` | — | `KK_T_OP_SVC_KEI` | Inserts the new option service contract record with status "910" (Canceled/Resolved) and Netflix-specific cancellation dates |
| C | `JKKBatCommon.createSubTypeKK0351(commonItem, opsvckeino, ...)` | — | `KK_T_OP_SVC_KEI` subtype | Creates the subtype record linked to the newly inserted option service contract number |
| - | `JBSbatDateUtil.adjustDate(kojiakFinYmd_151, -1)` | — | — | Date utility — computes the day before the work key settlement date for Netflix cancellation date derivation |
| - | `JBSbatDateUtil.getSystemDateTimeStamp()` | — | — | System utility — retrieves the current system datetime stamp for the record creation timestamp |
| - | `JBSbatStringUtil.Rtrim(String)` | — | — | String utility — trims trailing whitespace from all string values extracted from the outMap |
| - | `super.opeDate` | — | — | Accesses inherited instance field for the business operation date |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSbatKKKjClDataInTrn | `dslNetflixOption()` → `insertOpsvckei(inMap, isDslNetFlix=true, kojiakFinYmd_151)` | `executeKK_T_OP_SVC_KEI_PKINSERT` [C] `KK_T_OP_SVC_KEI`, `createSubTypeKK0351` [C] `KK_T_OP_SVC_KEI` subtype |
| 2 | Batch: JBSbatKKKjClDataInTrn | `execute()` → `insertOpsvckei(inMap, isDslNetFlix=false, ...)` | `executeKK_T_OP_SVC_KEI_PKINSERT` [C] `KK_T_OP_SVC_KEI`, `createSubTypeKK0351` [C] `KK_T_OP_SVC_KEI` subtype |
| 3 | Batch: JBSbatKKKjClDataInTrn | `insertOpsvckei()` (overload) → `insertOpsvckei(inMap, isDslNetFlix=false, null)` | `executeKK_T_OP_SVC_KEI_PKINSERT` [C] `KK_T_OP_SVC_KEI`, `createSubTypeKK0351` [C] `KK_T_OP_SVC_KEI` subtype |

## 6. Per-Branch Detail Blocks

**Block 1** — IF (condition) `isDslNetFlix` (L6790)

> If the Netflix Premium Option cancellation path, calculate the before-day date from the work key settlement date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `beforeDay = JBSbatDateUtil.adjustDate(kojiakFinYmd_151, -1);` // Compute the day before the Netflix cancellation work key settlement date [-> ISDSLNFLX=true] |

**Block 2** — SET (L6800)

> Prepare PK lookup parameters using the option service contract number and generated addition datetime.

| # | Type | Code |
|---|------|------|
| 1 | SET | `String[] whereParam = {inMap.getString(JBSbatKK_T_OP_SVC_KEI.OP_SVC_KEI_NO), JBSbatStringUtil.Rtrim(inMap.getString(JBSbatKK_T_OP_SVC_KEI.GENE_ADD_DTM))};` // PK lookup key: contract number + generated addition datetime |

**Block 3** — CALL + IF (L6803)

> Execute primary key SELECT on `KK_T_OP_SVC_KEI`. Early exit if no record found.

| # | Type | Code |
|---|------|------|
| 1 | SET | `JBSbatCommonDBInterface outMap = executeKK_T_OP_SVC_KEI_PKSELECT(whereParam);` // PK SELECT on KK_T_OP_SVC_KEI |
| 2 | IF | `if (outMap == null)` [L6804] |

**Block 3.1** — RETURN (L6805)

> Early exit — no matching option service contract record found.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return;` // No matching record; cancel processing |

**Block 4** — SET (L6810–6812)

> Allocate 79-element parameter array and get system datetime stamp.

| # | Type | Code |
|---|------|------|
| 1 | SET | `Object[] param_add = new Object[79];` // 79-element array for contract record parameters |
| 2 | SET | `String sysdate = JBSbatDateUtil.getSystemDateTimeStamp();` // System datetime for record creation timestamp |

**Block 5** — POPULATE (L6814–6816)

> Retrieve the option service contract number for later subtype creation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `String opsvckeino = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.OP_SVC_KEI_NO));` // Extract and trim contract number |

**Block 6** — POPULATE param_add[0] (L6818)

> Set the option service contract number as the first element.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[0] = opsvckeino;` // Option service contract number |

**Block 7** — POPULATE param_add[1] (L6820)

> Set the system datetime as the generation registration year/month/day/minute/second.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[1] = sysdate;` // Generation registration year/month/day/minute/second → system datetime |

**Block 8** — POPULATE param_add[2] — CONSTANT MODIFIED (L6821–6826)

> Set the option service contract status. Per v20.00.00 refactoring, uses constant `SVC_KEI_STAT_DLS_ZM` instead of hardcoded "910".

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[2] = JBSbatKKConst.SVC_KEI_STAT_DLS_ZM;` // Option service contract status → 910: Canceled/Resolved [-> SVC_KEI_STAT_DLS_ZM="910"] |

**Block 9** — POPULATE param_add[3]–param_add[22] (L6827–6856)

> Extract all remaining fields from the outMap (retrieved record) and populate positions 3 through 22 of the parameter array. These include service code, price code, plan code, parent contract discrimination code, service contract number, service contract detail number, legal person service contract reception number, SYSID, application detail number, trial entry dates, actual entry dates, service usage start preference dates, contract conclusion date, and review result sending code.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[3] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.OP_SVC_CD));` // Option service code |
| 2 | SET | `param_add[4] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.PCRS_CD));` // Price code |
| 3 | SET | `param_add[5] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.PPLAN_CD));` // Plan code |
| 4 | SET | `param_add[6] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.OYA_KEI_SKBT_CD));` // Parent contract discrimination code |
| 5 | SET | `param_add[7] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SVC_KEI_NO));` // Service contract number |
| 6 | SET | `param_add[8] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SVC_KEI_UCWK_NO));` // Service contract detail number |
| 7 | SET | `param_add[9] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.HOJIN_SVC_KEI_UK_NO));` // Legal person service contract reception number |
| 8 | SET | `param_add[10] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SYSID));` // SYSID |
| 9 | SET | `param_add[11] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.MSKM_DTL_NO));` // Application detail number |
| 10 | SET | `param_add[12] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.FTRIAL_KANYU_YMD));` // Trial entry year/month/day |
| 11 | SET | `param_add[13] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.FTRIAL_PRD_ENDYMD));` // Trial period end year/month/day |
| 12 | SET | `param_add[14] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.HONKANYU_YMD));` // Actual entry year/month/day |
| 13 | SET | `param_add[15] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.HONKANYU_IKO_KIGEN_YMD));` // Actual entry migration deadline |
| 14 | SET | `param_add[16] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SVC_USE_STA_KIBO_YMD));` // Service usage start preference |
| 15 | SET | `param_add[17] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.RSV_TSTA_KIBO_YMD));` // Reservation application start preference |
| 16 | SET | `param_add[18] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.OP_SVC_KEI_KZKWRK_REQYMD));` // Option service contract follow-up work request |
| 17 | SET | `param_add[19] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SHOSA_YMD));` // Review date |
| 18 | SET | `param_add[20] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SHOSA_CL_YMD));` // Review cancellation date |
| 19 | SET | `param_add[21] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SKEKKA_SEND_CD));` // Review result sending code |
| 20 | SET | `param_add[22] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.KEI_CNC_YMD));` // Contract conclusion date |

**Block 10** — IF/ELSE (condition) `isDslNetFlix` (L6857–6877)

> Netflix-specific logic for reservation application date (param_add[23]) and reservation cancellation date (param_add[24]).

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (isDslNetFlix)` [L6858] |

**Block 10.1** — Netflix branch (L6860–6862)

> Reservation application date = operation date (opeDate). Reservation cancellation date = original cancel date (RSV_CL_YMD).

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[23] = super.opeDate;` // Reservation application date → operation date for Netflix cancellation |
| 2 | SET | `param_add[24] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.RSV_CL_YMD));` // Reservation cancellation date → original cancel date |

**Block 10.2** — Else branch (L6865–6868)

> Reservation application date = current reservation application date. Reservation cancellation date = empty (not applicable for non-Netflix cancellations).

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[23] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.RSV_APLY_YMD));` // Reservation application date → current value |
| 2 | SET | `param_add[24] = "";` // Reservation cancellation date → NULL |

**Block 11** — POPULATE param_add[25] — CONSTANT MODIFIED (L6871–6876)

> Set the reservation application code. Per v20.00.00 refactoring, uses constant `RSV_APLY_CD_FIX` instead of hardcoded "2".

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[25] = JBSbatKKConst.RSV_APLY_CD_FIX;` // Reservation application code → Fixed [-> RSV_APLY_CD_FIX="2"] |

**Block 12** — POPULATE param_add[26] (L6878)

> Set the plan start year/month/day.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[26] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.PLAN_STAYMD));` // Plan start year/month/day |

**Block 13** — IF/ELSE (condition) `isDslNetFlix` (L6880–6893)

> Netflix-specific logic for plan end date (param_add[27]).

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (isDslNetFlix)` [L6881] |

**Block 13.1** — Netflix branch (L6883–6884)

> Plan end date = before the work key settlement date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[27] = beforeDay;` // Plan end date → day before work key settlement date for Netflix cancellation |

**Block 13.2** — Else branch (L6887–6888)

> Plan end date = operation date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[27] = super.opeDate;` // Plan end date → operation date for regular cancellation |

**Block 14** — POPULATE param_add[28] (L6897)

> Set the plan charge start year/month/day.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[28] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.PLAN_CHRG_STAYMD));` // Plan charge start year/month/day |

**Block 15** — IF/ELSE (condition) `isDslNetFlix` (L6899–6920)

> Netflix-specific logic for plan charge end date (param_add[29]) and plan end type code (param_add[30]).

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (isDslNetFlix)` [L6900] |

**Block 15.1** — Netflix branch (L6902–6904)

> Plan charge end = before the work key settlement date. Plan end type = termination by contract cancellation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[29] = beforeDay;` // Plan charge end date → day before work key settlement for Netflix cancellation |
| 2 | SET | `param_add[30] = JBSbatKKConst.PLAN_END_SBT_CD_MSDDSL;` // Plan end type code → Termination by contract cancellation [-> PLAN_END_SBT_CD_MSDDSL="2"] |

**Block 15.2** — Else branch (L6907–6912)

> Plan charge end = operation date. Plan end type = cancellation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[29] = super.opeDate;` // Plan charge end date → operation date for regular cancellation |
| 2 | SET | `param_add[30] = JBSbatKKConst.PLAN_END_SBT_CD_CANCEL;` // Plan end type code → Cancellation [-> PLAN_END_SBT_CD_CANCEL="4"] |

**Block 16** — POPULATE param_add[31]–param_add[47] (L6916–6957)

> Extract all service-level fields: service cancellation date, reason code, service start date/time, display service provision start date, service charge start date, service stop date/reason/resume date/reason code/memo, and pause date/reason/resume date/reason memo.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[31] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SVC_CANCEL_YMD));` // Service cancellation date |
| 2 | SET | `param_add[32] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SVC_CANCEL_RSN_CD));` // Service cancellation reason code |
| 3 | SET | `param_add[33] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SVC_STAYMD));` // Service start year/month/day |
| 4 | SET | `param_add[34] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SVC_STA_HMS));` // Service start minute/second |
| 5 | SET | `param_add[35] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.DSP_SVCTK_STAYMD));` // Display service provision start date |
| 6 | SET | `param_add[36] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SVC_CHRG_STAYMD));` // Service charge start date |
| 7 | SET | `param_add[37] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SVC_STP_YMD));` // Service stop date |
| 8 | SET | `param_add[38] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SVC_STP_RSN_CD));` // Service stop reason code |
| 9 | SET | `param_add[39] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SVC_STP_RLS_YMD));` // Service stop resume date |
| 10 | SET | `param_add[40] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SVC_STP_RLS_RSN_CD));` // Service stop resume reason code |
| 11 | SET | `param_add[41] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.PAUSE_STP_CD));` // Pause interruption code |
| 12 | SET | `param_add[42] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SVC_PAUSE_YMD));` // Service pause date |
| 13 | SET | `param_add[43] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SVC_PAUSE_RSN_CD));` // Service pause reason code |
| 14 | SET | `param_add[44] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SVC_PAUSE_RSN_MEMO));` // Service pause reason memo |
| 15 | SET | `param_add[45] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SVC_PAUSE_RLS_YMD));` // Service pause resume date |
| 16 | SET | `param_add[46] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SVC_PAUSE_RLS_RSN_CD));` // Service pause resume reason code |
| 17 | SET | `param_add[47] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SVC_PAUSE_RLS_RSN_MEMO));` // Service pause resume reason memo |

**Block 17** — IF/ELSE (condition) `isDslNetFlix` (L6960–6973)

> Netflix-specific logic for service end date (param_add[48]).

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (isDslNetFlix)` [L6961] |

**Block 17.1** — Netflix branch (L6963–6964)

> Service end date = before the work key settlement date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[48] = beforeDay;` // Service end date → day before work key settlement for Netflix cancellation |

**Block 17.2** — Else branch (L6967–6968)

> Service end date = operation date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[48] = super.opeDate;` // Service end date → operation date for regular cancellation |

**Block 18** — POPULATE param_add[49] (L6971)

> Set the service end minute/second.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[49] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SVC_END_HMS));` // Service end minute/second |

**Block 19** — IF/ELSE (condition) `isDslNetFlix` (L6974–6987)

> Netflix-specific logic for service charge end date (param_add[50]).

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (isDslNetFlix)` [L6975] |

**Block 19.1** — Netflix branch (L6977–6978)

> Service charge end date = before the work key settlement date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[50] = beforeDay;` // Service charge end date → day before work key settlement for Netflix cancellation |

**Block 19.2** — Else branch (L6981–6982)

> Service charge end date = operation date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[50] = super.opeDate;` // Service charge end date → operation date for regular cancellation |

**Block 20** — POPULATE param_add[51] (L6986)

> Set the service dissolution date to operation date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[51] = super.opeDate;` // Service dissolution date → operation date |

**Block 21** — IF/ELSE (condition) `isDslNetFlix` (L6988–7007)

> Netflix-specific logic for service dissolution reason code (param_add[52]).

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (isDslNetFlix)` [L6989] |

**Block 21.1** — Netflix branch (L6991–6993)

> Dissolution reason = "Normal Dissolution" (01).

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[52] = JBSbatKKConst.SVC_DLRE_CD_NORMAL;` // Service dissolution reason code → Normal Dissolution [-> SVC_DLRE_CD_NORMAL="01"] |

**Block 21.2** — Else branch (L6996–7001)

> Dissolution reason = Cancellation (03).

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[52] = JBSbatKKConst.SVC_DLRE_CD_CANCEL;` // Service dissolution reason code → Cancellation [-> SVC_DLRE_CD_CANCEL="03"] |

**Block 22** — POPULATE param_add[53]–param_add[55] (L7004–7019)

> Set the dissolution memo, dissolution responsible user ID, and dissolution procedure completion flag.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[53] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SVC_DLRE_MEMO));` // Service dissolution reason memo |
| 2 | SET | `param_add[54] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.DSL_TNT_USER_ID));` // Dissolution responsible user ID |
| 3 | IF | `if (isDslNetFlix)` [L7010] |

**Block 22.1** — Netflix branch (L7012–7013)

> Dissolution procedure completion flag = empty (not applicable for Netflix cancellation).

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[55] = "";` // Service dissolution procedure completion flag → empty for Netflix cancellation |

**Block 22.2** — Else branch (L7016–7017)

> Dissolution procedure completion flag = extracted from outMap.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[55] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SVC_DSL_TTDKI_FIN_FLG));` // Service dissolution procedure completion flag from outMap |

**Block 23** — POPULATE param_add[56]–param_add[57] (L7020–7025)

> Set the recovery date (hardcoded empty per OM-2014-0000400対応) and service cancellation reversal date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[56] = "";` // Recovery date → empty [-> OM-2014-0000400対応] |
| 2 | SET | `param_add[57] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SVC_CANCEL_CL_YMD));` // Service cancellation reversal date |

**Block 24** — IF/ELSE (condition) `isDslNetFlix` (L7027–7042)

> Netflix-specific logic for service dissolution reversal date (param_add[58]).

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (isDslNetFlix)` [L7028] |

**Block 24.1** — Netflix branch (L7030–7031)

> Service dissolution reversal date = empty.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[58] = "";` // Service dissolution reversal date → empty for Netflix cancellation |

**Block 24.2** — Else branch (L7034–7035)

> Service dissolution reversal date = extracted from outMap.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[58] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SVC_DSL_CL_YMD));` // Service dissolution reversal date from outMap |

**Block 25** — POPULATE param_add[59]–param_add[61] (L7038–7041)

> Set the charge start date correction existence, service pause charge start date, and option service contract occurrence date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[59] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.CHRG_STA_YMD_HOSEI_UM));` // Charge start date correction existence |
| 2 | SET | `param_add[60] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SVC_PAUSE_CHRG_STA_YMD));` // Service pause charge start date |
| 3 | SET | `param_add[61] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.OP_SVC_KEI_HKHASYMD));` // Option service contract occurrence date |

**Block 26** — IF/ELSE (condition) `isDslNetFlix` (L7043–7058)

> Netflix-specific logic for penalty occurrence code (param_add[62]).

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (isDslNetFlix)` [L7044] |

**Block 26.1** — Netflix branch (L7046–7047)

> Penalty occurrence code = "0" (no penalty). Netflix cancellations are exempt from penalty charges.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[62] = JBSbatKKConst.CD01375_PNLTY_HASSEI_CD_0;` // Penalty occurrence code → "0" (no penalty) for Netflix cancellation [-> CD01375_PNLTY_HASSEI_CD_0="0"] |

**Block 26.2** — Else branch (L7050–7051)

> Penalty occurrence code = extracted from outMap (penalty applies for non-Netflix cancellations).

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[62] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.PNLTY_HASSEI_CD));` // Penalty occurrence code from outMap |

**Block 27** — POPULATE param_add[63]–param_add[71] (L7054–7075)

> Set the remaining administrative fields: discrepancy division, review dissolution completion code, service provision disposal processing datetime stamp, and audit fields (registration/update/delete dates/timestamps and operators) — all set to empty strings.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[63] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.IDO_DIV));` // Discrepancy division |
| 2 | SET | `param_add[64] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SHOSA_DSL_FIN_CD));` // Review dissolution completion code |
| 3 | SET | `param_add[65] = JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.SVCTK_BUT_DEL_TRN_JSSI_DTM));` // Service provision disposal processing datetime |
| 4 | SET | `param_add[66] = "";` // Registration date timestamp → empty |
| 5 | SET | `param_add[67] = "";` // Registration operator account → empty |
| 6 | SET | `param_add[68] = "";` // Update date timestamp → empty |
| 7 | SET | `param_add[69] = "";` // Update operator account → empty |
| 8 | SET | `param_add[70] = "";` // Delete date timestamp → empty |
| 9 | SET | `param_add[71] = "";` // Delete operator account → empty |

**Block 28** — POPULATE param_add[72] — CONSTANT MODIFIED (L7076–7081)

> Set the invalid flag. Per v20.00.00 refactoring, uses constant `MK_FLG_YK` instead of hardcoded "0".

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[72] = JBSbatKKConst.MK_FLG_YK;` // Invalid flag → 0: Valid [-> MK_FLG_YK="0"] |

**Block 29** — POPULATE param_add[73]–param_add[78] (L7082–7092)

> Set the administrative operation fields to empty strings.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param_add[73] = "";` // Registration operation year/month/day → empty |
| 2 | SET | `param_add[74] = "";` // Registration processing ID → empty |
| 3 | SET | `param_add[75] = "";` // Update operation year/month/day → empty |
| 4 | SET | `param_add[76] = "";` // Update processing ID → empty |
| 5 | SET | `param_add[77] = "";` // Delete operation year/month/day → empty |
| 6 | SET | `param_add[78] = "";` // Delete processing ID → empty |

**Block 30** — INSERT (L7095–7097)

> Execute the insert of the option service contract record into `KK_T_OP_SVC_KEI`.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `this.executeKK_T_OP_SVC_KEI_PKINSERT(param_add);` // Insert the option service contract record |

**Block 31** — SUBTYPE (L7100–7102)

> Create the subtype record linked to the newly inserted option service contract.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JKKBatCommon.createSubTypeKK0351(commonItem, opsvckeino, JBSbatStringUtil.Rtrim(outMap.getString(JBSbatKK_T_OP_SVC_KEI.GENE_ADD_DTM)), sysdate);` // Register subtype of option service contract |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `op_svc_kei_no` | Field | Option service contract number — unique identifier for an option service contract line item in `KK_T_OP_SVC_KEI` |
| `svc_kei_stat` | Field | Service contract status — "910" indicates Canceled/Resolved (SVC_KEI_STAT_DLS_ZM) |
| `opc_svc_cd` | Field | Option service code — classifies the type of option service |
| `pcrs_cd` | Field | Price code — identifies the pricing plan associated with the contract |
| `ppplan_cd` | Field | Plan code — identifies the specific service plan |
| `oya_kei_skbt_cd` | Field | Parent contract discrimination code — links the option service contract to its parent service contract |
| `svc_kei_no` | Field | Service contract number — the primary (parent) contract this option is attached to |
| `svc_kei_ucwk_no` | Field | Service contract detail number — internal tracking ID for service contract line items |
| `hojin_svc_kei_uk_no` | Field | Legal person service contract reception number — contract number for corporate customer service contracts |
| `mskm_dtl_no` | Field | Application detail number — identifies the specific application request |
| `ftrial_kanyu_ymd` | Field | Trial entry year/month/day — date when trial period started |
| `ftrial_prd_endymd` | Field | Trial period end year/month/day — end date of trial period |
| `honkanyu_ymd` | Field | Actual entry year/month/day — date when actual service was provisioned |
| `honykanyu_iko_kigen_ymd` | Field | Actual entry migration deadline — deadline for actual entry migration |
| `svc_use_sta_kibo_ymd` | Field | Service usage start preference date — preferred start date for service usage |
| `rsv_tsta_kibo_ymd` | Field | Reservation application start preference date — preferred date for reservation application start |
| `op_svc_kei_kzkwrk_reqymd` | Field | Option service contract follow-up work request date — date when follow-up work is requested |
| `shosa_ymd` | Field | Review date — date when contract review was performed |
| `shosa_cl_ymd` | Field | Review cancellation date — date when review was canceled |
| `skekka_send_cd` | Field | Review result sending code — code for how review results were sent |
| `kei_cnc_ymd` | Field | Contract conclusion date — date when the contract was concluded |
| `rsv_aply_ymd` | Field | Reservation application date — date when reservation was applied |
| `rsv_cl_ymd` | Field | Reservation cancellation date — date when reservation was canceled |
| `plan_staymd` | Field | Plan start year/month/day — date when the service plan starts |
| `plan_end_sbt_cd` | Field | Plan end type code — "2" for termination by contract cancellation (PLAN_END_SBT_CD_MSDDSL), "4" for cancellation (PLAN_END_SBT_CD_CANCEL) |
| `plan_chrg_staymd` | Field | Plan charge start year/month/day — date when plan charging starts |
| `plan_chrg_end_ymd` | Field | Plan charge end year/month/day — date when plan charging ends |
| `svc_cancel_ymd` | Field | Service cancellation year/month/day — date when the service is canceled |
| `svc_cancel_rsn_cd` | Field | Service cancellation reason code — reason for service cancellation |
| `svc_staymd` | Field | Service start year/month/day — date when the service starts |
| `svc_sta_hms` | Field | Service start minute/second — time portion of service start |
| `dsp_svctk_staymd` | Field | Display service provision start year/month/day — date when service becomes visible to customer |
| `svc_chrg_staymd` | Field | Service charge start year/month/day — date when service charging begins |
| `svc_stp_ymd` | Field | Service stop year/month/day — date when the service is stopped |
| `svc_stp_rsn_cd` | Field | Service stop reason code — reason for service stop |
| `svc_stp_rls_ymd` | Field | Service stop resume year/month/day — date when service stop is lifted |
| `svc_stp_rls_rsn_cd` | Field | Service stop resume reason code — reason for lifting service stop |
| `pause_stp_cd` | Field | Pause interruption code — code for service pause state |
| `svc_pause_ymd` | Field | Service pause year/month/day — date when service is paused |
| `svc_pause_rsn_cd` | Field | Service pause reason code — reason for service pause |
| `svc_pause_rsn_memo` | Field | Service pause reason memo — memo for service pause reason |
| `svc_pause_rls_ymd` | Field | Service pause resume year/month/day — date when pause is lifted |
| `svc_pause_rls_rsn_cd` | Field | Service pause resume reason code — reason for lifting service pause |
| `svc_pause_rls_rsn_memo` | Field | Service pause resume reason memo — memo for pause resume reason |
| `svc_end_hms` | Field | Service end minute/second — time portion of service end |
| `svc_dlre_ymd` | Field | Service dissolution year/month/day — date when the service is dissolved |
| `svc_dlre_rsn_cd` | Field | Service dissolution reason code — "01" Normal Dissolution, "03" Cancellation |
| `svc_dlre_memo` | Field | Service dissolution reason memo — memo for dissolution reason |
| `dsl_tnt_user_id` | Field | Dissolution responsible user ID — user ID of the dissolution handler |
| `svc_dsl_ttdki_fin_flg` | Field | Service dissolution procedure completion flag — flag indicating dissolution procedure is complete |
| `kaihk_ymd` | Field | Recovery year/month/day — date for recovery (legacy, currently hardcoded empty) |
| `svc_cancel_cl_ymd` | Field | Service cancellation reversal year/month/day — date when cancellation is reversed |
| `svc_dsl_cl_ymd` | Field | Service dissolution reversal year/month/day — date when dissolution is reversed |
| `chrg_sta_ymd_hosei_um` | Field | Charge start date correction existence — flag for whether charge start date was corrected |
| `svc_pause_chrg_sta_ymd` | Field | Service pause charge start year/month/day — date when charging starts during pause |
| `op_svc_kei_hkhasymd` | Field | Option service contract occurrence date — date when the option service contract occurred |
| `pnlty_hassei_cd` | Field | Penalty occurrence code — "0" means no penalty; "1" means penalty applies |
| `ido_div` | Field | Discrepancy division — code for discrepancy classification |
| `shosa_dsl_fin_cd` | Field | Review dissolution completion code — code indicating review dissolution is complete |
| `svctk_but_del_trn_jssi_dtm` | Field | Service provision disposal processing datetime stamp — timestamp of disposal processing |
| `mk_flg_yk` | Field | Invalid flag — "0" means valid (MK_FLG_YK) |
| `gene_add_dtm` | Field | Generated addition datetime — system-generated datetime for record creation |
| `opeDate` | Instance field | Operation date — business date set on the system instance, used as the effective date for cancellations |
| `commonItem` | Instance field | Common item data carrier — shared data structure passed to subtype creation for cross-table linkage |
| RSV_APLY_CD_FIX | Constant | Reservation application code: "2" = Fixed (RSV_APLY_CD_FIX) |
| SVC_KEI_STAT_DLS_ZM | Constant | Service contract status: "910" = Canceled/Resolved (SVC_KEI_STAT_DLS_ZM) |
| PLAN_END_SBT_CD_MSDDSL | Constant | Plan end type code: "2" = Termination by contract cancellation (PLAN_END_SBT_CD_MSDDSL) |
| PLAN_END_SBT_CD_CANCEL | Constant | Plan end type code: "4" = Cancellation (PLAN_END_SBT_CD_CANCEL) |
| SVC_DLRE_CD_NORMAL | Constant | Service dissolution reason code: "01" = Normal Dissolution (SVC_DLRE_CD_NORMAL) |
| SVC_DLRE_CD_CANCEL | Constant | Service dissolution reason code: "03" = Cancellation (SVC_DLRE_CD_CANCEL) |
| CD01375_PNLTY_HASSEI_CD_0 | Constant | Penalty occurrence code: "0" = No penalty (CD01375_PNLTY_HASSEI_CD_0) |
| MK_FLG_YK | Constant | Invalid flag: "0" = Valid (MK_FLG_YK) |
| KK_T_OP_SVC_KEI | Table | Option service contract table — stores option service contract records |
| Netflix Premium Option | Business term | A premium streaming service add-on bundled with eo Net broadband plans (added in v52.00.00, ANK-3987-00-00) |
| 工事完了 (KojiKan) | Japanese term | Work completion — refers to the settlement date of network installation work (工事完了年月日) |
| 解約 (Kaiya) | Japanese term | Cancellation/Dissolution — the act of canceling a service contract |
| 契約 (Keiyaku) | Japanese term | Contract — the legal agreement for service provision |
| 契約変更 (Keiyaku Henko) | Japanese term | Contract change — modification of an existing contract (status code "110") |
| 予約適用 (Yoyaku Tekiyo) | Japanese term | Reservation application — applying a reservation to an active contract |
| 予約取消 (Yoyaku Torikeshi) | Japanese term | Reservation cancellation — canceling a reservation |
| 違約金 (Iyakukin) | Japanese term | Penalty fee — charge applied for early contract termination |
| 解約担当 (Kaiya Tantou) | Japanese term | Dissolution handler — the user responsible for processing the dissolution |
| 工事キャンセル (Koji Kyanseru) | Japanese term | Work cancellation — cancellation of planned installation work |
| JBSbatKKConst | Class | Contract management system constant class — central definition of all business constant values for the e0 customer core system |
