# Business Logic — JBSbatKKSvkeiuwDelTgCst.isOverDate() [31 LOC]

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

## 1. Role

### JBSbatKKSvkeiuwDelTgCst.isOverDate()

The `isOverDate` method performs a **date-based expiration check** in the context of batch-driven service contract cancellation processing. It determines whether a given service end date, when extended by a configurable number of days (e.g., a grace period for old authentication ID usage or a restoration possible period), has already passed relative to the current operation date (operational date). This is a shared utility method — it is **not** a screen entry point but is called internally by two cancellation target data setup methods (`setDelTrgtDataIn` for internet services and `setDelTrgtDataTel` for telephone services) to gate whether a service contract line item should continue processing toward deletion or should be skipped early. If the extended end date has already passed, the method returns `true`, causing the caller to exit the cancellation processing branch for that record; if the extended end date is still in the future, it returns `false`, allowing processing to continue.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["isOverDate(params)"])
    CHECK_NULL["strDate == null"]
    RETURN_NULL["Return true"]
    PARSE_DATE["Parse strDate to intYear, intMonth, intDate"]
    SET_LAST["lastDate = Calendar.getInstance()"]
    SET_LAST_VAL["lastDate.set(intYear, intMonth-1, intDate)"]
    ADD_DAYS["lastDate.add(Calendar.DATE, Integer.parseInt(strDay))"]
    PARSE_OPE["Parse super.opeDate to intOpeYear, intOpeMonth, intOpeDate"]
    SET_OPE["calOpeDate = Calendar.getInstance()"]
    SET_OPE_VAL["calOpeDate.set(intOpeYear, intOpeMonth-1, intOpeDate)"]
    COMPARE["lastDate.compareTo(calOpeDate) > 0"]
    RETURN_TRUE["Return true"]
    RETURN_FALSE["Return false"]
    END_NODE(["Return / Next"])

    START --> CHECK_NULL
    CHECK_NULL -->|true| RETURN_NULL
    CHECK_NULL -->|false| PARSE_DATE
    PARSE_DATE --> SET_LAST
    SET_LAST --> SET_LAST_VAL
    SET_LAST_VAL --> ADD_DAYS
    ADD_DAYS --> PARSE_OPE
    PARSE_OPE --> SET_OPE
    SET_OPE --> SET_OPE_VAL
    SET_OPE_VAL --> COMPARE
    COMPARE -->|true| RETURN_TRUE
    COMPARE -->|false| RETURN_FALSE
    RETURN_NULL --> END_NODE
    RETURN_TRUE --> END_NODE
    RETURN_FALSE --> END_NODE
```

**Processing overview:**
1. **Null guard**: If `strDate` (service end date) is `null`, return `true` — treat a null end date as "already over."
2. **Parse input date**: Extract year (chars 0–3), month (chars 4–5), and day (chars 6–7) from `strDate`, then build a `Calendar` representing the service end date. Add the number of days from `strDay` to compute the extended expiration date.
3. **Parse operation date**: Extract year, month, and day from the inherited `super.opeDate` field (set from the batch's common item), then build a `Calendar` for the current operation date.
4. **Compare**: If the extended expiration date is strictly after the operation date, return `true` (overdue); otherwise return `false` (not yet overdue).

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `strDate` | `String` | Service end date in YYYYMMDD format (e.g., "20260628"). Represents the date when the service contract officially ends. If `null`, the method immediately returns `true`, treating the service as already expired. This value comes from the `SVC_ENDYMD` field of the `JBSbatKK_T_SVC_KEI` entity (service contract master table). |
| 2 | `strDay` | `String` | Number of additional days to add to the service end date (e.g., grace period days). In practice, this carries values such as the "old authentication ID usage period" (old ninsho ID use allowance days) obtained from `ZM_M_WORK_PARAM_KNRI` work parameter table, or the "restoration possible period" obtained from `KK_M_PRC_GRP` price group table. It is parsed as an integer and added to the end date via `Calendar.add()`. |

**External state read:**
| Source | Field | Type | Business Description |
|--------|-------|------|---------------------|
| Inherited field | `super.opeDate` | `String` | The current operation date (running date of the batch), also in YYYYMMDD format. Set from the `JBSbatCommonDBInterface.getOpeDate()` method in the parent class `JBSbatBusinessService`. Represents the date on which the batch process is executing and serves as the reference "today" for the comparison. |

## 4. CRUD Operations / Called Services

The `isOverDate` method itself performs **no database operations**. It is a pure computation method that reads only local parameters and the inherited `opeDate` field. The method performs no SC calls, no entity reads, and no SQL execution.

The pre-computed evidence from the code analysis graph includes several `getInstance` and `substring` calls, but these belong to **other methods** within the same class (such as `setDelTrgtDataIn`, `setDelTrgtDataTel`, and `isDelTrgtNoDataTel`) — not to `isOverDate` itself.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | (none) | - | - | `isOverDate` is a pure calculation method with no CRUD operations, SC calls, or DB accesses. |

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 3 methods.
Terminal operations from this method: (none — pure computation).

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: `JBSbatKKSvkeiuwDelTgCst` | `processService` -> `setDelTrgtDataIn` -> `isOverDate` | (none — pure computation) |
| 2 | Batch: `JBSbatKKSvkeiuwDelTgCst` | `processService` -> `setDelTrgtDataTel` -> `isOverDate` | (none — pure computation) |

**Call Chain Detail:**
The batch class `JBSbatKKSvkeiuwDelTgCst` processes service contract cancellation targets. It dispatches by service type:
- For **internet services** (`JBSbatKKConst.SVC_CD_IN_SVC`), it calls `setDelTrgtDataIn()`, which internally calls `isOverDate()` to check whether the old authentication ID grace period has expired.
- For **telephone services** (`JBSbatKKConst.SVC_CD_TEL_SVC`), it calls `setDelTrgtDataTel()`, which internally calls `isOverDate()` to check whether the restoration possible period has expired.

No screen (KKSV*) entry points exist within 8 hops — this method is exclusively a batch utility.

## 6. Per-Branch Detail Blocks

**Block 1** — [IF] `(strDate == null)` (L873)

> Null guard: if the service end date is null, treat the service as already expired (overdue). This is a defensive check to handle missing or unset end dates by defaulting to "over" rather than throwing a NullPointerException.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true;` // If end date is null, treat as already expired |

---

**Block 2** — [SEQUENTIAL PROCESSING] `(Parse input date)` (L877–882)

> Parse the `strDate` string (YYYYMMDD format) into year, month, and day components, then build a `Calendar` object representing the service end date. Add the number of days from `strDay` to compute the extended expiration date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `intYear = Integer.parseInt(strDate.substring(0, 4))` // Extract year (4 digits) |
| 2 | SET | `intMonth = Integer.parseInt(strDate.substring(4, 6))` // Extract month (2 digits) |
| 3 | SET | `intDate = Integer.parseInt(strDate.substring(6, 8))` // Extract day (2 digits) |
| 4 | SET | `lastDate = Calendar.getInstance()` // Create new calendar instance |
| 5 | EXEC | `lastDate.set(intYear, intMonth - 1, intDate)` // Set date (month 0-indexed in Java Calendar) |
| 6 | EXEC | `lastDate.add(Calendar.DATE, Integer.parseInt(strDay))` // Add grace days to get extended expiration |

---

**Block 3** — [SEQUENTIAL PROCESSING] `(Parse operation date)` (L884–888)

> Parse the inherited `super.opeDate` field (YYYYMMDD format) into year, month, and day components, then build a `Calendar` object representing the current operation date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `intOpeYear = Integer.parseInt(super.opeDate.substring(0, 4))` // Extract batch operation year |
| 2 | SET | `intOpeMonth = Integer.parseInt(super.opeDate.substring(4, 6))` // Extract batch operation month |
| 3 | SET | `intOpeDate = Integer.parseInt(super.opeDate.substring(6, 8))` // Extract batch operation day |
| 4 | SET | `calOpeDate = Calendar.getInstance()` // Create new calendar instance |
| 5 | EXEC | `calOpeDate.set(intOpeYear, intOpeMonth - 1, intOpeDate)` // Set operation date (month 0-indexed) |

---

**Block 4** — [IF/ELSE] `(lastDate.compareTo(calOpeDate) > 0)` (L893)

> Compare the extended expiration date (`lastDate`) with the operation date (`calOpeDate`). If the extended expiration is strictly after the operation date, the service has passed its grace period (overdue).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `lastDate.compareTo(calOpeDate) > 0` // Returns positive if lastDate is after calOpeDate |
| 2 | RETURN | `return true;` // [THEN] Extended end date > operation date — service is over (L894) |
| 3 | RETURN | `return false;` // [ELSE] Extended end date <= operation date — service is not yet over (L897) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `strDate` | Parameter | Service end date — the date (YYYYMMDD) when the service contract officially ends, stored in `JBSbatKK_T_SVC_KEI.SVC_ENDYMD`. |
| `strDay` | Parameter | Grace period days — the number of additional days to extend past the service end date. In internet service branch, this is the "old authentication ID usage allowance days" from the work parameter table. In telephone service branch, this is the "restoration possible period" from the price group table. |
| `opeDate` | Field | Operation date — the current batch execution date (YYYYMMDD), inherited from `JBSbatBusinessService.opeDate`. Serves as the "today" reference for all date comparisons. |
| `lastDate` | Variable | Extended service end date — the service end date plus the grace period days. Represents the final date by which the service is still considered active. |
| `calOpeDate` | Variable | Operation date calendar — the batch's current running date as a Calendar object, used for comparison. |
| JBSbatKKSvkeiuwDelTgCst | Class | Service contract cancellation target extraction batch — processes deletion targets for service contracts (both internet and telephone services). |
| setDelTrgtDataIn | Method | Internet service cancellation target data setup — retrieves old authentication ID usage grace period and checks expiration. |
| setDelTrgtDataTel | Method | Telephone service cancellation target data setup — retrieves restoration possible period and checks expiration. |
| JBSbatKKConst | Constant class | Shared batch constants including service codes (`SVC_CD_IN_SVC`, `SVC_CD_TEL_SVC`) and order type codes (`ORDER_SBT_CD_NET`). |
| SVC_CD_IN_SVC | Constant | Internet service code — identifies internet (fiber) service contracts. |
| SVC_CD_TEL_SVC | Constant | Telephone service code — identifies telephone (voice) service contracts. |
| ZM_M_WORK_PARAM_KNRI | Table | Work parameter management table — stores batch-configurable parameters such as the old authentication ID usage period days. |
| KK_M_PRC_GRP | Table | Price group master table — stores pricing-related configuration including restoration possible periods. |
| JBSbatKK_T_SVC_KEI | Table | Service contract master table (K-Opticom) — contains service contract records with end dates (`SVC_ENDYMD`). |
| JBSbatKK_T_SVC_KEI_UCWK | Table | Service contract line item table — contains service detail work records (contract lines). |
| KK_T_SVKEIUW_EOH_NET | Table | Service contract details table (eO Light Network) — stores internet service contract line item records. |
| KK_T_SVKEIUW_EOH_TEL | Table | Service contract details table (eO Light Telephone) — stores telephone service contract line item records. |
| Calendar | Java class | Java `java.util.Calendar` — used for date arithmetic (setting, adding days, comparing dates). |
