# Business Logic — JBSbatKKKktsvKkChgTtdkFin.execKKSV0532() [72 LOC]

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

## 1. Role

### JBSbatKKKktsvKkChgTtdkFin.execKKSV0532()

This method implements the **Equipment Provision Service Contract Equipment Change Procedure Completion** workflow. It acts as a service invocation bridge that extracts equipment change procedure data from a service interface map, assembles it into a structured request payload, and delegates the actual business processing to the external service layer via `JCCBatchEsbInterface.invokeService`. The method specifically handles the `KKSV0532` use case, routing the request to service component `KKSV053201SC`.

The design follows a **delegation and aggregation pattern**: the method does not contain any business logic itself but serves as an adapter that translates the incoming `JBSbatServiceInterfaceMap` into the service invocation contract expected by the downstream service layer. It extracts five key fields (equipment provision service contract number, generation registration datetime, reservation application date, reservation application code, and pre-update datetime), maps them into a data map with fixed values for reservation application code (`2` = fixed) and function code (`1`), then invokes the service and propagates the result — logging a business error if the service returns a non-zero return code.

In the larger system, this method serves as the **screen-facing service call entry point** for the `KKSV0532` batch operation, connecting the batch screen `KKSV0532` (Equipment Provision Service Contract Equipment Change Procedure) to the underlying service infrastructure.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["execKKSV0532 called"])
    STEP1["Extract kktkSvcKeiNo from inMap"]
    STEP2["Extract geneAddDtm from inMap"]
    STEP3["Extract rsvAplyYmd from inMap"]
    STEP4["Extract updDtmBf from inMap"]
    STEP5["Create paramMap0532 and set USECASE_ID to KKSV0532"]
    STEP6["Create inputMap0532 and dataMap0532"]
    STEP7["Populate dataMap0532 with parameters"]
    STEP8["Set rsv_aply_cd to RSV_APLY_CD_FIX 2"]
    STEP9["Set func_code to 1"]
    STEP10["Put dataMap0532 into inputMap0532 keyed by KKSV053201SC"]
    STEP11["Create outputMapOpn532"]
    STEP12["Invoke JCCBatchEsbInterface.invokeService"]
    STEP13["Extract RETURN_CODE from outputMapOpn532"]
    STEP14["Log RETURN_CODE"]
    COND{"RETURN_CODE == 0000?"}
    ERROR_LOG["Log business error EKKB0010CW"]
    RETURN["Return outputMapOpn532"]

    START --> STEP1 --> STEP2 --> STEP3 --> STEP4 --> STEP5 --> STEP6 --> STEP7 --> STEP8 --> STEP9 --> STEP10 --> STEP11 --> STEP12 --> STEP13 --> STEP14 --> COND
    COND -->|Yes| RETURN
    COND -->|No| ERROR_LOG --> RETURN
```

**CRITICAL — Constant Resolution:**
- `JBSbatKKConst.RSV_APLY_CD_FIX = "2"` — Reservation application code fixed value (meaning: the reservation is explicitly applied/fixed, not pending).

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `inMap` | `JBSbatServiceInterfaceMap` | The service interface map carrying equipment change procedure data. Contains fields extracted from the batch screen: equipment provision service contract number (`KKTK_SVC_KEI_NO`), generation registration datetime (`GENE_ADD_DTM`), reservation application date (`RSV_APLY_YMD`), and pre-update datetime (`UPD_DTM_BF`). |
| - | `super.commonItem` | (inherited field) | Common batch processing item, passed to `invokeService` for cross-cutting concerns (logging, transaction context, etc.). |
| - | `super.logPrint` | (inherited field) | Logging utility for debug and business error log output. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JBSbatKKIFM163.getString` | - | - | Reads equipment provision service contract number, generation registration datetime, reservation application date, and pre-update datetime from the input map. |
| - | `JCCBatchEsbInterface.invokeService` | KKSV053201SC | - | Invokes the external service to process the equipment change procedure completion. Receives `paramMap0532`, `inputMap0532`, and populates `outputMapOpn532` with service results. |
| - | `JCCBatchEsbInterface.printDebugLog` | - | - | Debug log output for diagnostic tracing. |
| - | `JCCBatCommon.printDebugLog` | - | - | Debug log output for diagnostic tracing. |
| - | `JCKLcsRenkeiUtil.printDebugLog` | - | - | Debug log output for cross-system coordination tracing. |
| - | `JKKBatOneTimeLogWriter.printBusinessErrorLog` | - | - | Writes business error logs when service processing fails. |
| - | `JKKHttpCommunicator.printBusinessErrorLog` | - | - | Writes business error logs via HTTP communication layer. |
| - | `JKKHttpCommunicator.printDebugLog` | - | - | Debug log output for HTTP communication layer tracing. |
| - | `JBSbatKKCashPostAddMail.printDebugLog` | - | - | Debug log output in cash post-processing mail context. |
| - | `JBSbatKKEMoneyTktnIraiRnk.printBusinessErrorLog` | - | - | Writes business error log in money withdrawal receipt context. |
| - | `JBSbatKKEMoneyTkyoTchMailSksi.printBusinessErrorLog` | - | - | Writes business error log in Tokyo charge mail context. |
| - | `JBSbatZMAdDataSet.getString` | - | - | Reads data from ZM Ad Data Set. |
| - | `JESC0101B010TPMA.getString` | - | - | Reads data from ESC report data set. |
| - | `JESC0101B020TPMA.getString` | - | - | Reads data from ESC report data set. |

**Notes:**
- The primary SC invoked is `KKSV053201SC` via `JCCBatchEsbInterface.invokeService`. This service component handles the equipment provision service contract equipment change procedure completion processing. The actual CRUD operations against persistent storage (database tables) are performed within the `KKSV053201SC` service layer, not in this method.
- This method reads data from the input map (`getString` operations) and invokes a service that performs Create/Update operations downstream.

## 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: `printBusinessErrorLog` [-], `printBusinessErrorLog` [-], `printBusinessErrorLog` [-], `printBusinessErrorLog` [-], `printDebugLog` [-], `printDebugLog` [-], `printDebugLog` [-], `printDebugLog` [-], `printDebugLog` [-], `invokeService` [-], `invokeService` [-], `invokeService` [-], `invokeService` [-], `invokeService` [-], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Caller: JBSbatKKKktsvKkChgTtdkFin | `JBSbatKKKktsvKkChgTtdkFin.execute` -> `execKKSV0532(inMap)` | `invokeService [C/U] KKSV053201SC`, `getString [R] KKTK_SVC_KEI_NO` |

## 6. Per-Branch Detail Blocks

**Block 1** — [ASSIGNMENT] Extract input fields from `inMap` (L103)

The method begins by extracting four key fields from the input service interface map. These represent the core data for the equipment change procedure completion.

| # | Type | Code |
|---|------|------|
| 1 | GET | `kktkSvcKeiNoStr = inMap.getString(JBSbatKKIFM163.KKTK_SVC_KEI_NO)` // Equipment provision service contract number |
| 2 | GET | `geneAddDtmStr = inMap.getString(JBSbatKKIFM163.GENE_ADD_DTM)` // Generation registration datetime |
| 3 | GET | `rsvAplyYmdStr = inMap.getString(JBSbatKKIFM163.RSV_APLY_YMD)` // Reservation application date |
| 4 | GET | `lastUpdDtmStr = inMap.getString(JBSbatKKIFM163.UPD_DTM_BF)` // Pre-update datetime |

**Block 2** — [ASSIGNMENT] Construct request maps (L114)

Prepares the parameter map, input map, and data map structures needed for the service invocation.

| # | Type | Code |
|---|------|------|
| 1 | NEW | `paramMap0532 = new HashMap<String, Object>()` // Parameter map for service invocation |
| 2 | SET | `paramMap0532.put(JCCBatchEsbInterface.TELEGRAM_INFO_USECASE_ID, "KKSV0532")` // Set use case ID to KKSV0532 |
| 3 | NEW | `inputMap0532 = new HashMap<String, Object>()` // Input map for service data |
| 4 | NEW | `dataMap0532 = new HashMap<String, Object>()` // Data map for business data |

**Block 3** — [ASSIGNMENT] Populate data map with business parameters (L121)

Maps extracted input values into the data map with appropriate keys expected by the service component.

| # | Type | Code |
|---|------|------|
| 1 | SET | `dataMap0532.put("kktk_svc_kei_no", kktkSvcKeiNoStr)` // Equipment provision service contract number |
| 2 | SET | `dataMap0532.put("gene_add_dtm", geneAddDtmStr)` // Generation registration datetime |
| 3 | SET | `dataMap0532.put("rsv_aply_ymd", rsvAplyYmdStr)` // Reservation application date |
| 4 | SET | `dataMap0532.put("rsv_aply_cd", JBSbatKKConst.RSV_APLY_CD_FIX)` // [RSV_APLY_CD_FIX = "2"] Reservation application code (fixed) |
| 5 | SET | `dataMap0532.put("upd_dtm_bf", lastUpdDtmStr)` // Pre-update datetime |
| 6 | SET | `dataMap0532.put("func_code", "1")` // Function code |

**Block 4** — [ASSIGNMENT] Assemble input map and invoke service (L129)

Creates the service invocation data structure, initializes the output map, and calls the external service.

| # | Type | Code |
|---|------|------|
| 1 | SET | `scTitleOpn = "KKSV053201SC"` // SC title key |
| 2 | SET | `inputMap0532.put(scTitleOpn, dataMap0532)` // Associate data map with SC key |
| 3 | NEW | `outputMapOpn532 = new HashMap<Object, Object>()` // Output map for service results |
| 4 | CALL | `JCCBatchEsbInterface.invokeService(super.commonItem, paramMap0532, inputMap0532, outputMapOpn532)` // Invoke equipment change procedure completion service |

**Block 5** — [ASSIGNMENT + CALL] Extract return code and log (L140)

Retrieves the return code from the service output and logs it for diagnostic purposes.

| # | Type | Code |
|---|------|------|
| 1 | GET | `returnCode = (String)outputMapOpn532.get("RETURN_CODE")` // Extract return code |
| 2 | CALL | `super.logPrint.printDebugLog("★RETURN_CODE：" + returnCode)` // Log return code |

**Block 6** — [IF] Check return code for errors (L143)

> If the service returns a non-zero return code (indicating an error), log a business error with the return code and equipment provision service contract number.

| # | Type | Code |
|---|------|------|
| 1 | COND | `!"0000".equals(returnCode)` // Non-zero return code indicates error |

**Block 6.1** — [ELSE branch — ERROR HANDLING] (L146)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `super.logPrint.printBusinessErrorLog(JPCBatchMessageConstant.EKKB0010CW, new String[]{"CC error occurred (Return Code): " + returnCode + " Equipment provision service number: " + kktkSvcKeiNoStr})` // Log business error EKKB0010CW |

**Block 7** — [RETURN] Return service result (L153)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return outputMapOpn532` // Return the service processing result map |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `kktk_svc_kei_no` | Field | Equipment Provision Service Contract Number — the unique identifier for a service contract line in the equipment provision system |
| `gene_add_dtm` | Field | Generation Registration Datetime — the timestamp when the contract line was originally created/registered |
| `rsv_aply_ymd` | Field | Reservation Application Date — the date on which the reservation is applied |
| `rsv_aply_cd` | Field | Reservation Application Code — code indicating reservation status (`2` = fixed/applied) |
| `upd_dtm_bf` | Field | Update Datetime Before — the datetime prior to the current update (used for optimistic concurrency or audit) |
| `func_code` | Field | Function Code — identifier for the function/module invoking this processing (`1` = standard equipment change procedure) |
| `KKSV0532` | Use Case | Equipment Provision Service Contract Equipment Change Procedure — the batch processing use case for completing equipment change procedures |
| `KKSV053201SC` | SC Code | Service Component for Equipment Change Procedure Completion — the service component that performs the actual business logic for this operation |
| `RSV_APLY_CD_FIX` | Constant | Reservation Application Code Fixed Value — the constant value `"2"` that represents a fixed/applied reservation |
| `KKTK_SVC_KEI_NO` | Constant | Interface Map Key — the key used to retrieve the equipment provision service contract number from the input map |
| `GENE_ADD_DTM` | Constant | Interface Map Key — the key used to retrieve the generation registration datetime from the input map |
| `RSV_APLY_YMD` | Constant | Interface Map Key — the key used to retrieve the reservation application date from the input map |
| `UPD_DTM_BF` | Constant | Interface Map Key — the key used to retrieve the pre-update datetime from the input map |
| `RETURN_CODE` | Field | Service Return Code — the result code returned by the invoked service (`0000` = success, non-zero = error) |
| `EKKB0010CW` | Constant | Business Error Message Key — the error message key logged when a service interface error occurs |
| TELEGAM_INFO_USECASE_ID | Constant | Interface Key — the key used to set the use case ID in the parameter map for the service invocation |
| Equipment Provision Service | Domain | A telecom service provisioning system that manages customer equipment contracts and their changes |
| Equipment Change Procedure | Domain | The business process for completing modifications to an existing equipment provision service contract |
| KK | Prefix | Koukan (交換) — a domain prefix used in this codebase for telecom exchange/provisioning related entities |
| SV | Prefix | Service — short for Service, used in batch/screen naming conventions |
| SC | Abbreviation | Service Component — a service layer component that encapsulates business logic |
| CBS | Abbreviation | Component Business Service — a service component in the CBS architecture layer |
| JBSbat | Package | Java Batch Service — the batch service package prefix |
| JCCBatchEsbInterface | Class | Common Component Batch ESB Interface — the enterprise service bus interface for invoking services in the batch context |
| JBSbatServiceInterfaceMap | Class | Java Batch Service Interface Map — the data transfer object used to pass data between batch components and services |
| JBSbatKKConst | Class | Java Batch Service Korea Constants — constant definitions for batch service processing |
| JPCBatchMessageConstant | Class | Java Platform Common Batch Message Constants — constant definitions for batch error/success messages |
| KKTK_SVC_KEI_NO | Field | KK Equipment Provision Service Contract Number — the contract number identifier for equipment provision services |
| JBSbatKKIFM163 | Class | Java Batch Service Korea Interface Map 163 — interface field definitions for KK batch operations |
