# Business Logic — JBSbatACTaiikiLmtTchiTrgtMake.addTsrckJsk() [36 LOC]

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

## 1. Role

### JBSbatACTaiikiLmtTchiTrgtMake.addTsrckJsk()

This method registers FTTH (Fiber To The Home) communication volume exceeded records by invoking an external service component. It serves as the single-point service invocation wrapper for recording instances where a customer's actual communication traffic volume has exceeded the contracted threshold, triggering the need for an exceedance notification. The method implements the **delegation pattern**: it assembles the business data into a structured request envelope (paramMap with usecase ID and inputMap with SC-titled data), delegates the actual business processing to the ESb (Enterprise Service Bus) infrastructure via `JCCBatchEsbInterface.invokeService`, then extracts and validates the return code from the response. If the service returns an abnormal (non-success) return code, the method delegates error reporting to `JACbatRknBusinessUtil.esbErrOutputPrc`. The method is called from the batch's `execute()` method when an FTTH communication volume exceeded record is not yet present in the system and a communication volume exceeded notification setting has been found in the master data — effectively closing the loop by persisting the fact that an exceedance was detected. It uses a **routing/dispatch design** through the SC Title key (`ACSV003501SC`) to direct the service bus to the correct service component handler.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["addTsrckJsk(dataMap)"])
    STEP1["Debug Log [S][addTsrckJsk]"]
    STEP2["Create paramMap"]
    STEP3["Set USECASE_ID = ACSV0035"]
    STEP4["Create inputMap"]
    STEP5["Put dataMap with key SC_TITLE = ACSV003501SC"]
    STEP6["Create outputMap"]
    STEP7["Invoke Service invokeService(paramMap, inputMap, outputMap)"]
    STEP8["Get Return Code from outputMap"]
    CONDITION{Return Code SUCCESS?}
    STEP9["Debug Log: Abnormal case"]
    STEP10["Error Output esbErrOutputPrc"]
    STEP11["Debug Log returnCode and outputMap"]
    STEP12["Debug Log [E][addTsrckJsk]"]
    END(["Return void"])

    START --> STEP1 --> STEP2 --> STEP3 --> STEP4 --> STEP5 --> STEP6 --> STEP7 --> STEP8 --> CONDITION
    CONDITION -->|Yes| STEP11
    CONDITION -->|No| STEP9 --> STEP10 --> STEP11 --> STEP12 --> END
```

**CRITICAL — Constant Resolution:**

| Constant | Resolved Value | Business Meaning |
|----------|---------------|------------------|
| `USECASE_ID` | `"ACSV0035"` | Usecase ID for FTTH Communication Volume Exceeded Record Registration |
| `SC_TITLE` | `"ACSV003501SC"` | SC Title for FTTH Communication Volume Exceeded Record Registration |

**Processing Summary:**
1. Enter method and emit entry debug log.
2. Build a `paramMap` holding the usecase ID (`ACSV0035`) to identify this processing context to the service bus.
3. Build an `inputMap` that wraps the incoming `dataMap` (the actual FTTH traffic data) under the SC Title key (`ACSV003501SC`), allowing the service bus to route to the correct handler.
4. Create an empty `outputMap` to receive the service response.
5. Invoke the external service via `JCCBatchEsbInterface.invokeService()`, passing the prepared maps. The service performs the actual registration of the FTTH communication volume exceeded record.
6. Extract the return code from the output map.
7. If the return code does **not** equal the success code (`JCCBatchEsbInterface.RETURN_CODE_SUCCESS`), emit a debug log indicating an abnormal case, then call `JACbatRknBusinessUtil.esbErrOutputPrc()` to report the error with the usecase ID, return code, and full output map.
8. Regardless of success or failure, emit debug logs showing the final return code and output map content, then exit.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `dataMap` | `HashMap<String, String>` | A map containing the FTTH communication traffic exceeded record data. The keys correspond to fields such as customer code (`PCRS_CD`), financial service code (`PRC_SVC_CD`), pre-reflection total communication volume (`TUSHINRYOGKEI_MAE`), and post-reflection total communication volume (`TUSHINRYOGKEI_ATO`). This data represents the detected exceedance event that needs to be registered in the downstream system via the service invocation. |
| — | `super.commonItem` | `JBSbatCommonItem` | Inherited batch common item containing batch execution context (operation date, batch run parameters, etc.) passed to the service invocation. |
| — | `USECASE_ID` | `String` (constant) | The usecase identifier `"ACSV0035"` that labels this processing flow to the ESb infrastructure. |
| — | `SC_TITLE` | `String` (constant) | The service component title `"ACSV003501SC"` used as the map key to route the request to the correct service handler. |
| — | `super.logPrint` | `LogPrint` (inherited) | Logging context inherited from the parent batch service class, used for debug log emission. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JCCBatchEsbInterface.invokeService` | ACSV003501SC | FTTH Tsrck Jsk (registration target) | Invokes the external service component to register the FTTH communication volume exceeded record. The SC Code `ACSV003501SC` routes to the service that handles the actual record creation/persistence. |
| R | `JCCBatchEsbInterface.getReturnCode` | ACSV003501SC | - | Extracts the return code from the service output map to determine if the registration succeeded. |
| - | `JACbatDebugLogUtil.printDebugLog` | - | - | Utility method for debug log output at entry and exit points. |
| - | `JACbatRknBusinessUtil.esbErrOutputPrc` | - | - | Error output processing — called when the service returns a non-success code, responsible for logging/reporting the service invocation failure. |

**Notes:**
- The actual **Create (C)** operation on the database is performed inside the service component `ACSV003501SC` (not visible in this method). This method is the service invocation layer that delegates to it.
- `RETURN_CODE_SUCCESS` is the expected success return code constant defined in `JCCBatchEsbInterface`.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSbatACTaiikiLmtTchiTrgtMake | `JBSbatACTaiikiLmtTchiTrgtMake.execute()` → `addTsrckJsk(dataMap)` | `invokeService ACSV003501SC [C] FTTH Tsrck Jsk record` |

**Notes:**
- This method is a **private** method called exclusively from `execute()` within the same class (`JBSbatACTaiikiLmtTchiTrgtMake`).
- It is **not** called by any screen (KKSV*) or external batch — it is an internal helper used during the batch's main processing flow.
- The batch is triggered when FTTH communication volume exceeded records are absent and notification settings exist, and this method registers the detected exceedance.

## 6. Per-Branch Detail Blocks

### Block 1 — METHOD ENTRY (L288)

> Enter the `addTsrckJsk` method. The FTTH communication volume exceeded record registration service invocation begins.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap = new HashMap<String, String>()` // Create parameter map [L292] |
| 2 | EXEC | `JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][addTsrckJsk]")` // Entry debug log [L290] |

### Block 2 — PARAMAP CONSTRUCTION (L292–294)

> Build the parameter map that identifies the usecase to the service bus.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap = new HashMap<String, String>()` // Allocate paramMap for usecase identification [L292] |
| 2 | EXEC | `paramMap.put(JCCBatchEsbInterface.TELEGRAM_INFO_USECASE_ID, USECASE_ID)` // Set usecase ID [-> USECASE_ID = "ACSV0035"] [L294] |

### Block 3 — INPUTMAP CONSTRUCTION (L297–300)

> Build the input map that wraps the business data under the SC Title key for service routing.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inputMap = new HashMap<String, HashMap<String, String>>()` // Create inputMap for business data [L297] |
| 2 | EXEC | `inputMap.put(SC_TITLE, dataMap)` // Register dataMap with key [-> SC_TITLE = "ACSV003501SC"] [L300] |

### Block 4 — OUTPUTMAP CREATION (L303)

> Create the output map to receive the service response.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outputMap = new HashMap<Object, Object>()` // Create outputMap for service result [L303] |

### Block 5 — SERVICE INVOCATION (L306)

> Invoke the external service component via the ESb interface. The actual FTTH communication volume exceeded record registration is performed inside the service component `ACSV003501SC`.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JCCBatchEsbInterface.invokeService(super.commonItem, paramMap, inputMap, outputMap)` // Invoke service [SC: ACSV003501SC] [L306] |

### Block 6 — RETURN CODE EXTRACTION (L308)

> Extract the return code from the output map to determine if the service invocation succeeded.

| # | Type | Code |
|---|------|------|
| 1 | SET | `returnCode = JCCBatchEsbInterface.getReturnCode(outputMap)` // Get return code from output [L308] |

### Block 7 — ERROR HANDLING [IF] `(returnCode != RETURN_CODE_SUCCESS)` (L310)

> If the service returns a non-success code, treat this as an abnormal termination and report the error.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][addTsrckJsk][正常以外の場合]")` // Debug log for non-success case [L312] |
| 2 | CALL | `JACbatRknBusinessUtil.esbErrOutputPrc(USECASE_ID, returnCode, outputMap, this.logPrint)` // Error output processing [L314] |

**CONSTANT:** `[JCCBatchEsbInterface.RETURN_CODE_SUCCESS = "success-like code"]`

### Block 8 — EXIT DEBUG LOGS (L316–318)

> Regardless of the service outcome, emit debug logs showing the final state.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][addTsrckJsk][returnCode=" + returnCode + "]")` [L316] |
| 2 | EXEC | `JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][addTsrckJsk][returnCode=" + outputMap.toString() + "]")` [L317] |
| 3 | EXEC | `JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][addTsrckJsk]")` // Exit debug log [L318] |
| 4 | RETURN | `return` // Return void [L319] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `addTsrckJsk` | Method | Register FTTH Communication Volume Exceeded Record — registration of detected communication traffic exceedance events |
| `dataMap` | Parameter | Input data map containing FTTH communication traffic fields (customer code, service code, pre/post-reflection volumes) |
| `paramMap` | Local Variable | Parameter map for service invocation — holds the usecase ID for ESb routing |
| `inputMap` | Local Variable | Input map for service invocation — wraps business data under the SC Title key |
| `outputMap` | Local Variable | Output map from service invocation — holds the service response including the return code |
| `USECASE_ID` | Constant | Usecase identifier `"ACSV0035"` — identifies the FTTH Communication Volume Exceeded Record Registration processing flow |
| `SC_TITLE` | Constant | Service Component Title `"ACSV003501SC"` — routes the request to the correct service handler within the ESb |
| FTTH | Business Term | Fiber To The Home — fiber-optic broadband internet service provided by K-Opticom |
| `TsrckJsk` | Abbreviation | Tsūshinryō Chōka Jisseki Tosyoku — Communication Volume Exceeded Record Registration |
| `TSRYO` | Abbreviation | Tsūshinryō — Communication Volume / Traffic Volume |
| `CKT` | Abbreviation | Chōka — Exceeded / Over |
| `CSETE` | Abbreviation | Settei — Setting / Configuration |
| `PCRS_CD` | Field | Customer Code — the financial customer identifier (e.g., from `JBSbatACIFM214.PCRS_CD`) |
| `PRC_SVC_CD` | Field | Financial Service Code — the service type code associated with the customer (e.g., from `JBSbatACIFM214.PRC_SVC_CD`) |
| `TUSHINRYOGKEI_MAE` | Field | Pre-Reflection Total Communication Volume — communication traffic volume before the current reflection cycle (from `JBSbatACIFM214.TUSHINRYOGKEI_MAE`) |
| `TUSHINRYOGKEI_ATO` | Field | Post-Reflection Total Communication Volume — communication traffic volume after the current reflection cycle (from `JBSbatACIFM214.TUSHINRYOGKEI_ATO`) |
| `JSK_FLG` | Field | Registration Flag — indicates whether an FTTH communication volume exceeded record already exists (empty string means "not yet registered") |
| `AC_M_TSRYO_CKTCSETE` | Table | Communication Volume Exceeded Notification Setting Master Table — stores notification threshold settings per customer and service type |
| `ACSV0035` | Usecase ID | Use case identifier for the FTTH Communication Volume Exceeded Record Registration service flow |
| `ACSV003501SC` | SC Code | Service Component code for the FTTH Communication Volume Exceeded Record Registration handler |
| `JCCBatchEsbInterface` | Class | Batch ESb (Enterprise Service Bus) Interface — utility for invoking external services and extracting return codes |
| `RETURN_CODE_SUCCESS` | Constant | Expected success return code value returned by the service upon successful registration |
| `esbErrOutputPrc` | Method | ESb Error Output Processing — utility that reports service invocation failures with usecase ID, return code, and output data |
| `JBSbatBusinessService` | Class | Parent batch business service class — provides common batch infrastructure (commonItem, logPrint, etc.) |
| `commonItem` | Field | Batch common item — shared batch execution context passed to services |
| `logPrint` | Field | Logging context — inherited from parent class for debug log emission |
