---

# Business Logic — JBSbatKKDelRun.execute() [67 LOC]

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

## 1. Role

### JBSbatKKDelRun.execute()

This method is the central entry point for the **customer deletion batch** (K-Opticom customer base system deletion processing). It orchestrates the complete lifecycle of a customer or service contract cancellation, routing to specialized downstream handlers based on the deletion processing type and the type of object being deleted.

The method implements a **dispatch/router pattern** — it reads two key control parameters from the input: `delTranSbt` (deletion processing type) which determines whether to perform SOD (Service Order Data) issuance, aging registration update, or both; and `delTrgtSbt` (deletion target type) which identifies the specific business entity being deleted (e.g., ISP authentication ID, SIP user ID, email address, URL, etc.).

Its role in the larger system is as the **primary batch orchestrator** for service cancellation. It performs input validation (single-item check), system datetime acquisition, exclusion checks (ensuring service contract lines are eligible for deletion), and then dispatches to three core processing tracks: **SOD issuance** (creating deletion records in downstream order systems), **aging registration update** (updating penalty/aging tables), and **deletion execution date/time registration** (recording when the deletion was actually carried out for various entity types — customers, service contracts, service contract lines, optional services).

If any guard check fails — single-item validation, or exclusion check for service contract line deletions — the method sets an error flag and aborts early.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["execute() Entry"])

    START --> CHECK_SINGLE["Check isSingleCheckKKIFM161_INF1"]
    CHECK_SINGLE --> SINGLE_PASS{"Single item
check passed?"}
    SINGLE_PASS -->|No| SET_ERR["Set errFlg=true"]
    SET_ERR --> RETURN_ERR["Return null
(abort)"]

    SINGLE_PASS -->|Yes| GET_SYS_DATE["Get system datetimeStamp"]
    GET_SYS_DATE --> GET_DEL_SBT["Get delTranSbt"]
    GET_DEL_SBT --> GET_DEL_TRGT["Get delTrgtSbt"]

    GET_DEL_TRGT --> TRGT_CHECK{"delTrgtSbt is
SIP_USER_ID(17) / OLD_ISP(02) / OABJ_TELNO(09)?"}
    TRGT_CHECK -->|Yes| CHECK_HAITA["Check checkSvkeiuwHaita
(exclusion validation)"]
    CHECK_HAITA --> HAITA_PASS{"Exclusion
check passed?"}
    HAITA_PASS -->|No| RETURN_NULL_1["Return null
(abort)"]
    HAITA_PASS -->|Yes| PROC_DEL_SOD

    TRGT_CHECK -->|No| PROC_DEL_SOD

    PROC_DEL_SOD{"delTranSbt is
DEL_SOD_HAKKO(1) /
DEL_SOD_AGING_UPD(3)?"}
    PROC_DEL_SOD -->|Yes| CALL_DEL_SOD["Call delSodHakko(inMap)"]
    CALL_DEL_SOD --> PROC_AGING

    PROC_DEL_SOD -->|No| PROC_AGING

    PROC_AGING{"delTranSbt is
AGING_UPD(2) /
DEL_SOD_AGING_UPD(3)?"}
    PROC_AGING -->|Yes| CALL_AGING["Call agingUpd(inMap)"]
    CALL_AGING --> CALL_UPDATE_JSSI

    PROC_AGING -->|No| CALL_UPDATE_JSSI

    CALL_UPDATE_JSSI["Call updateDelTrnJssiDtm(inMap)"] --> RETURN_END["Return null"]
    RETURN_END --> END_NODE(["End"])
```

**CRITICAL — Constant Resolution:**

| Constant | Value | Business Meaning |
|----------|-------|-----------------|
| `DEL_TRAN_SBT_DEL_ONLY` | `"0"` | Deletion processing type (deletion only) |
| `DEL_TRAN_SBT_DEL_SOD_HAKKO` | `"1"` | Deletion processing type (delete + SOD issuance) |
| `DEL_TRAN_SBT_AGING_UPD` | `"2"` | Deletion processing type (aging update) |
| `DEL_TRAN_SBT_DEL_SOD_AGING_UPD` | `"3"` | Deletion processing type (delete + SOD issuance + aging update) |
| `DEL_TRGT_SBT_SIP_USER_ID` | `"17"` | Deletion target type (SIP User ID) |
| `DEL_TRGT_SBT_ISP_NINSYO_ID_OLD` | `"02"` | Deletion target type ((Old) ISP Authentication ID) |
| `DEL_TRGT_SBT_OABJ_TELNO` | `"09"` | Deletion target type (OABJ Phone Number) |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `inMap` | `JBSbatServiceInterfaceMap` | The input message carrying all deletion request parameters. Contains fields such as `DEL_TRAN_SBT` (deletion processing type: 0–3), `DEL_TRGT_SBT` (deletion target type identifying the entity being deleted), `SVKEI_NO` (service contract number), `SVKEI_GADTM` (service contract generation registration datetime), `SVKEIUW_NO` (service contract line number), `SVKEIUW_GADTM` (service contract line generation registration datetime), and `AGING_NO` (aging number). The map drives all conditional branching in the method. |

**Instance fields read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `this.sysDate` | `String` | System date/time timestamp obtained from the database, used as the recovery period end datetime in aging update processing |
| `super.opeDate` | `String` | Batch operation date, inherited from parent class, used in exclusion checks |
| `super.commonItem` | `JBSbatCommonItem` | Common item holding error flags and error message state |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JBSbatDateUtil.getSystemDateTimeStamp` | - | - | Calls `getSystemDateTimeStamp` to retrieve the current system date/time stamp |
| R | `JBSbatKKDelRun.isSingleCheckKKIFM161_INF1` | - | - | Calls single-item validation (required field, character count, range checks on `DEL_TRAN_SBT` and `DEL_TRGT_SBT`) |
| R | `JBSbatKKDelRun.getItemvalueMap` | - | - | Retrieves the item value mapping configuration map |
| R | `JBSbatKKIFM161.getString` | - | - | Extracts string values from the input map (e.g., `DEL_TRAN_SBT`, `DEL_TRGT_SBT`) |
| R | `checkSvkeiuwHaita` | KK_T_SVC_KEI_UCWK SELECT | KK_T_SVC_KEI_UCWK | Performs exclusion check: queries service contract line table to verify generation registration datetime matches input (prevents deleting lines being concurrently modified) |
| - | `JBSbatKKDelRun.agingUpd` | ZM_T_AGING KK_UPDATE | ZM_T_AGING | Updates the aging (penalty) table with recovery period end datetime |
| - | `JBSbatKKDelRun.checkSvkeiuwHaita` | KK_T_SVC_KEI_UCWK SELECT | KK_T_SVC_KEI_UCWK | Exclusion check for service contract line deletions — verifies no concurrent modifications |
| - | `JBSbatKKDelRun.delSodHakko` | Various SOD issuance SCs | KK_T_ODR_HAKKO_JOKEN, KK_T_ODR_INF_SKSI_WK | Dispatches to specific SOD issuance handlers based on deletion target type (ISP auth ID, email address, URL, PPP auth ID, etc.) |
| R | `JBSbatKKDelRun.getItemvalueMap` | - | - | Retrieves item value map for single-item validation |
| - | `JBSbatKKDelRun.isSingleCheckKKIFM161_INF1` | - | - | Validates input fields: required checks, character count validation, range validation |
| U | `JBSbatKKDelRun.updateDelTrnJssiDtm` | Various update SCs | CK_T_CUST, KK_T_SVC_KEI, KK_T_SVC_KEI_UCWK, KK_T_OP_SVC_KEI | Updates deletion execution datetime for the target entity type (customer, service contract, service contract line, or optional service) |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSbatKKDelRun | Batch entry -> `execute(inMap)` | `delSodHakko [C] KK_T_ODR_HAKKO_JOKEN`<br>`agingUpd [U] ZM_T_AGING`<br>`updateDelTrnJssiDtm [U] CK_T_CUST / KK_T_SVC_KEI / KK_T_SVC_KEI_UCWK / KK_T_OP_SVC_KEI` |

**Notes:**
- This method is a **standalone batch entry point** — no screen or CBS layer calls it directly. It is invoked by the batch scheduling framework (Spring Batch) using the `JBSbatKKDelRun` class as the job step's processor.
- The `delSodHakko` method further dispatches to 12+ target-specific SOD issuance methods (e.g., `delSodHakkoIspNinsyoId`, `delSodHakkoMlad`, `delSodHakkoUrl`), each performing inserts into `KK_T_ODR_HAKKO_JOKEN` and `KK_T_ODR_INF_SKSI_WK`.

## 6. Per-Branch Detail Blocks

**Block 1** — IF [single-item validation] (L363)

> Validates that required input fields pass single-item checks. If validation fails, sets the error flag and aborts.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `isSingleCheckKKIF161_INF1(inMap.getMap(), getItemvalueMap())` // Single-item validation: checks required fields, character count, range |
| 2 | SET | `super.commonItem.setErrFlg(true)` // Set error flag on validation failure [-> errFlg=true] |
| 3 | RETURN | `return null` // Abort — return null to signal error |

**Block 2** — EXEC [system datetime acquisition] (L372)

> Retrieves the current system date/time from the database for use in aging updates and deletion timestamps.

| # | Type | Code |
|---|------|------|
| 1 | SET | `this.sysDate = JBSbatDateUtil.getSystemDateTimeStamp()` // Get system date/time stamp |

**Block 3** — EXEC [delete processing type acquisition] (L375)

> Reads the deletion processing type from the input map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `delTranSbt = inMap.getString(JBSbatKKIFM161.DEL_TRAN_SBT)` // Get deletion processing type |

**Block 4** — EXEC [delete target type acquisition] (L378)

> Reads the deletion target type (OM-2014-0003405 — adds aging acquisition error on deletion eligibility check).

| # | Type | Code |
|---|------|------|
| 1 | SET | `delTrgtSbt = inMap.getString(JBSbatKKIFM161.DEL_TRGT_SBT)` // Get deletion target type [-> OM-2014-0003405 ADD] |

**Block 5** — IF [exclusion check trigger] (L379)

> When the deletion target is a service contract line (SIP user ID, old ISP auth ID, or OABJ phone number), an exclusion check is required to ensure the line is not being modified concurrently.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `checkSvkeiuwHaita(inMap)` // Exclusion check — verify service contract line has no concurrent modifications [-> DEL_TRGT_SBT_SIP_USER_ID="17", DEL_TRGT_SBT_ISP_NINSYO_ID_OLD="02", DEL_TRGT_SBT_OABJ_TELNO="09"] |
| 2 | RETURN | `return null` // Abort on exclusion failure |

**Block 5.1** — IF-ELSE-IF [delTrgtSbt branch conditions] (L379–L384)

> Determines whether the exclusion check is needed based on the deletion target type.

| # | Type | Code |
|---|------|------|
| 1 | IF | `delTrgtSbt.equals(DEL_TRGT_SBT_SIP_USER_ID)` // [-> "17"] SIP User ID |
| 2 | OR | `delTrgtSbt.equals(DEL_TRGT_SBT_ISP_NINSYO_ID_OLD)` // [-> "02"] (Old) ISP Authentication ID |
| 3 | OR | `delTrgtSbt.equals(DEL_TRGT_SBT_OABJ_TELNO)` // [-> "09"] OABJ Phone Number |

**Block 6** — IF [SOD issuance processing] (L397)

> When the deletion processing type is "Delete + SOD Issuance" (`"1"`) or "Delete + SOD Issuance + Aging Update" (`"3"`), this block dispatches to the SOD issuance handler.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `delSodHakko(inMap)` // Delete SOD issuance — creates deletion records in downstream order systems [-> DEL_TRAN_SBT_DEL_SOD_HAKKO="1", DEL_TRAN_SBT_DEL_SOD_AGING_UPD="3"] |

**Block 7** — IF [aging update processing] (L409)

> When the deletion processing type is "Aging Update" (`"2"`) or "Delete + SOD Issuance + Aging Update" (`"3"`), this block dispatches to the aging update handler.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `agingUpd(inMap)` // Aging registration update — updates the penalty/aging table with recovery period end datetime [-> DEL_TRAN_SBT_AGING_UPD="2", DEL_TRAN_SBT_DEL_SOD_AGING_UPD="3"] |

**Block 8** — EXEC [deletion execution date/time registration] (L421)

> Always executed (unconditional). Records the deletion execution date/time for the target entity type. Branches internally based on `delTrgtSbt`:

| # | Type | Code |
|---|------|------|
| 1 | CALL | `updateDelTrnJssiDtm(inMap)` // Registration of deletion execution date/time. Internally dispatches to: `updateDelTrnJssiDtmCust` (eoID/"11", Nickname/"12"), `updateDelTrnJssiDtmSvcKei` (PPP auth/"06", ISP auth/"01", ADSL auth/"16"), `updateDelTrnJssiDtmSvkeiuw` (SIP user/"17", old ISP/"02", OABJ phone/"09"), `updateDelTrnJssiDtmOpsvkei` (optional services) |

**Block 9** — RETURN [end] (L423)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null` // Normal completion — null is the conventional success return for this batch method |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `delTranSbt` | Field | Deletion processing type — control flag determining which processing track to follow (delete only, delete + SOD, aging update, or all three) |
| `delTrgtSbt` | Field | Deletion target type — identifies which business entity is being deleted (e.g., ISP auth ID, SIP user ID, email address) |
| SOD | Acronym | Service Order Data — downstream order fulfillment records created for deletion/cancellation |
| SOD HAKKO | Japanese | SOD issuance (`SOD` + `hakko`/発行 = issuance) — creation of deletion order records in downstream systems |
| AGING UPD | Japanese | Aging registration update (`aging` + `upd`/更新 = update) — updates penalty/aging registration in the ZM_T_AGING table |
| JISSI DTM | Japanese | Execution datetime (`jissi`/実施 = execution, `dtm` = datetime) — records when a deletion was actually performed |
| SVKEI_NO | Field | Service contract number — internal identifier for a service contract |
| SVKEIUW_NO | Field | Service contract line number — internal identifier for a line item within a service contract |
| SVKEIUW_GADTM | Field | Service contract line generation registration datetime — timestamp when the service contract line was created/last modified |
| ISP | Business term | Internet Service Provider — broadband internet service |
| PPP | Acronym | Point-to-Point Protocol — legacy dial-up authentication method |
| SIP | Acronym | Session Initiation Protocol — VoIP (voice over IP) user identifier |
| OABJ | Business term | eo All-in-1 Bundle — bundled telecom package (phone + internet) |
| eoID | Business term | K-Opticom customer ID — unique customer identifier |
| NICKNAME | Field | Customer nickname — display name associated with the account |
| KK_T_ODR_HAKKO_JOKEN | Entity | Order issuance conditions table — stores conditions for order issuance in the deletion workflow |
| KK_T_ODR_INF_SKSI_WK | Entity | Order information creation work table — working table for constructing order information |
| ZM_T_AGING | Entity | Aging (penalty) registration table — stores penalty/aging registration records with recovery period end dates |
| CK_T_CUST | Entity | Customer master table — core customer master data |
| KK_T_SVC_KEI | Entity | Service contract table — service contract header data |
| KK_T_SVC_KEI_UCWK | Entity | Service contract line work table — service contract line item data (used in exclusion checks) |
| KK_T_OP_SVC_KEI | Entity | Optional service contract table — optional/add-on service contract data |
| DEL_ONLY | Constant | Deletion processing type "0" — deletion only (no SOD, no aging) |
| DEL_SOD_HAKKO | Constant | Deletion processing type "1" — deletion + SOD issuance |
| AGING_UPD | Constant | Deletion processing type "2" — aging update only |
| DEL_SOD_AGING_UPD | Constant | Deletion processing type "3" — deletion + SOD issuance + aging update |

---
