# Business Logic — JBSbatKKSmtvlIdoInfSksi.getSvcDslYmd() [98 LOC]

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

## 1. Role

### JBSbatKKSmtvlIdoInfSksi.getSvcDslYmd()

This method determines and returns the **service cancellation date** (`svcDslYmd`) based on the current **progress status** (`prgStat`) of a customer's service contract lifecycle. It is a core routing/dispatch utility used within the smart-bill synchronization mismatch notification system — specifically, when assembling the outbound error notification file sent to KDDI (the parent carrier). The method implements a status-based dispatch pattern: it inspects the single `prgStat` parameter, routes to one of five business branches (Investigation Cancellation, Contract Completion, Forced Contract Completion, Cancellation Completion, or Suspension Start Completion), and additionally handles the Construction Temporary Cancellation status introduced in issue IT1-2018-0000100. Each branch selects the appropriate date field as the authoritative cancellation date — which varies depending on which contractual event occurred (e.g., a cancellation completion uses `svcCancelYmd`, while a suspension uses `svcPauseYmd`). The method also enforces non-null validation on the resolved date, emitting a business error log (EKKB0010CW) when the expected date field is missing. It is called internally by `setOutMapBothUpd()`, `setOutMapNetUpd()`, and `setOutMapTelUpd()` — the three output map builders that construct the data sent to KDDI for each service type (both-up, network-only, and telephone-only contracts).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START["getSvcDslYmd(params)"] --> COND_PRG["Check prgStat value"]

    COND_PRG --> SHOSA_CL["PRG_STAT_SHOSA_CL = 0901"]
    COND_PRG --> DSL_FIN["PRG_STAT_DSL_FIN = 1304"]
    COND_PRG --> KSI_DSL_FIN["PRG_STAT_KSI_DSL_FIN = 2203"]
    COND_PRG --> CNCL_FIN["PRG_STAT_CNCL_FIN = 1201"]
    COND_PRG --> PAUSE_STA_FIN["PRG_STAT_PAUSE_STA_FIN = 2401"]
    COND_PRG --> KARI_CNCL["PRG_STAT_KARI_CNCL = 9706"]
    COND_PRG --> OTHER["prgStat = null or other"]

    SHOSA_CL --> SET_SHOSA["Set svcDslYmd = shosaClYmd"]
    SET_SHOSA --> CHK_SHOSA["shosaClYmd is null or empty?"]
    CHK_SHOSA --> SHOSA_NULL["Yes: print error log"]
    CHK_SHOSA --> SHOSA_OK["No: ok"]
    SHOSA_NULL --> RETURN_SVC
    SHOSA_OK --> RETURN_SVC

    DSL_FIN --> SET_DSL["Set svcDslYmd = svcDslKisanYmd"]
    KSI_DSL_FIN --> SET_KSI
    SET_KSI --> SET_DSL
    SET_DSL --> CHK_DSL["svcDslKisanYmd is null or empty?"]
    CHK_DSL --> DSL_NULL["Yes: print error log"]
    CHK_DSL --> DSL_OK["No: ok"]
    DSL_NULL --> RETURN_SVC
    DSL_OK --> RETURN_SVC

    CNCL_FIN --> COND_STAT["Check svcKeiStat value"]
    COND_STAT --> STAT_ZM["STAT_DSL_ZM = 910"]
    COND_STAT --> STAT_OTHER["Other status"]

    STAT_ZM --> SET_STAT_ZM["Set svcDslYmd = svcDslKisanYmd"]
    SET_STAT_ZM --> CHK_STAT_ZM["svcDslKisanYmd is null or empty?"]
    CHK_STAT_ZM --> STAT_ZM_NULL["Yes: print error log"]
    CHK_STAT_ZM --> STAT_ZM_OK["No: ok"]
    STAT_ZM_NULL --> RETURN_SVC
    STAT_ZM_OK --> RETURN_SVC

    STAT_OTHER --> SET_CNCL["Set svcDslYmd = svcCancelYmd"]
    SET_CNCL --> CHK_CNCL["svcCancelYmd is null or empty?"]
    CHK_CNCL --> CNCL_NULL["Yes: print error log"]
    CHK_CNCL --> CNCL_OK["No: ok"]
    CNCL_NULL --> RETURN_SVC
    CNCL_OK --> RETURN_SVC

    PAUSE_STA_FIN --> SET_PAUSE["Set svcDslYmd = svcPauseYmd"]
    SET_PAUSE --> CHK_PAUSE["svcPauseYmd is null or empty?"]
    CHK_PAUSE --> PAUSE_NULL["Yes: print error log"]
    CHK_PAUSE --> PAUSE_OK["No: ok"]
    PAUSE_NULL --> RETURN_SVC
    PAUSE_OK --> RETURN_SVC

    KARI_CNCL --> SET_KARI["Set svcDslYmd = krCnclUkYmd"]
    SET_KARI --> CHK_KARI["kjKrCnclFlg != CD01714_KARI_CANCEL OR krCnclUkYmd is null or empty?"]
    CHK_KARI --> KARI_NULL["Yes: print error log"]
    CHK_KARI --> KARI_OK["No: ok"]
    KARI_NULL --> RETURN_SVC
    KARI_OK --> RETURN_SVC

    OTHER --> RETURN_SVC["Return svcDslYmd"]
```

### Branch Descriptions

1. **Investigation Cancellation (`PRG_STAT_SHOSA_CL = "0901"`)**: The service cancellation date is the investigation cancellation date (`shosaClYmd`) — i.e., the date on which the prior contract's eligibility review was cancelled.
2. **Contract Completion / Forced Contract Completion (`PRG_STAT_DSL_FIN = "1304"` or `PRG_STAT_KSI_DSL_FIN = "2203"`)**: The cancellation date is the service cancellation base date (`svcDslKisanYmd`) — the date from which the cancellation is calculated.
3. **Cancellation Completion (`PRG_STAT_CNCL_FIN = "1201"`)**: A two-level sub-branch. If the service contract status (`svcKeiStat`) is `STAT_DSL_ZM = "910"` (Contract Cancelled), the cancellation date is `svcDslKisanYmd`. Otherwise, it is `svcCancelYmd` (the service cancellation date).
4. **Suspension Start Completion (`PRG_STAT_PAUSE_STA_FIN = "2401"`)**: The cancellation date is the service suspension date (`svcPauseYmd`) — used when suspension is treated as a form of cancellation.
5. **Construction Temporary Cancellation (`PRG_STAT_KARI_CNCL = "9706"`)**: A newly added branch (IT1-2018-0000100). The cancellation date is the temporary cancellation reception date (`krCnclUkYmd`). However, the error log is also emitted if `kjKrCnclFlg` does not equal `CD01714_KARI_CANCEL = "1"` (Temporary Cancellation flag is not set).

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `prgStat` | `String` | Progress status — identifies which lifecycle stage the service contract is in. Determines the routing branch. Possible values: `"0901"` (Investigation Cancellation), `"1304"` (Contract Completion), `"2203"` (Forced Contract Completion), `"1201"` (Cancellation Completion), `"2401"` (Suspension Start Completion), `"9706"` (Construction Temporary Cancellation), or `null`/other (no resolution). |
| 2 | `shosaClYmd` | `String` | Investigation cancellation date (照査取消年月日) — the date on which the prior contract's eligibility review was cancelled. Used when `prgStat` indicates investigation cancellation. |
| 3 | `svcDslKisanYmd` | `String` | Service cancellation base date (解約起算日) — the date from which a service cancellation takes effect (i.e., the anniversary date used to calculate the cancellation timing). Used for contract completion, forced contract completion, and cancelled-contract statuses. |
| 4 | `svcCancelYmd` | `String` | Service cancellation date (サービスキャンセル年月日) — the actual date the service was cancelled. Used when `prgStat` is cancellation completion and the contract status is NOT "contract cancelled." |
| 5 | `svcPauseYmd` | `String` | Service suspension date (サービス休止年月日) — the date the service was suspended. Used when `prgStat` indicates suspension start completion. |
| 6 | `svcKeiStat` | `String` | Service contract status (サービス契約ステータス) — the current status of the service contract. When `prgStat` is cancellation completion, this sub-branches: `"910"` means the contract is fully cancelled (解約済), and any other value means a partial or pending cancellation. |
| 7 | `kjKrCnclFlg` | `String` | Construction temporary cancellation flag (工事仮キャンセルフラグ) — introduced in IT1-2018-0000100. When equal to `"1"` (CD01714_KARI_CANCEL = Temporary Cancellation), indicates a temporary cancellation was performed during construction. Used alongside `prgStat = "9706"`. |
| 8 | `krCnclUkYmd` | `String` | Temporary cancellation reception date (仮キャンセル受付年月日) — the date the temporary cancellation request was received. Used when `prgStat` is `"9706"` (Construction Temporary Cancellation). |

**External state read:**
- `commonItem.getLogPrint()` — the logging infrastructure used to emit business error logs via `printBusinessErrorLog()` on validation failures.

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKBatOneTimeLogWriter.printBusinessErrorLog` | JKKBatOneTimeLogWriter | - | Emits a business error log via the one-time log writer when the resolved cancellation date is null or empty |
| - | `JKKHttpCommunicator.printBusinessErrorLog` | JKKHttpCommunicator | - | Emits a business error log via the HTTP communicator when the resolved cancellation date is null or empty |
| - | `JBSbatKKEMoneyTktnIraiRnk.printBusinessErrorLog` | JBSbatKKEMoneyTktnIraiRnk | - | Emits a business error log via the money tracking receipt routing component |
| - | `JBSbatKKEMoneyTktnTkyoTchMailSksi.printBusinessErrorLog` | JBSbatKKEMoneyTktnTkyoTchMailSksi | - | Emits a business error log via the money tracking Tokyo-touch mail service component |

**Note:** This method contains no direct database reads, writes, or service component calls (no SC/CBS invocations). It is a pure deterministic dispatcher — a stateless date-resolution utility. The only external interaction is error logging via `printBusinessErrorLog`, which delegates to the applicable logging implementation depending on the calling context.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Method: `setOutMapBothUpd` | `setOutMapBothUpd` -> `getSvcDslYmd` | `printBusinessErrorLog` [-] |
| 2 | Method: `setOutMapNetUpd` | `setOutMapNetUpd` -> `getSvcDslYmd` | `printBusinessErrorLog` [-] |
| 3 | Method: `setOutMapTelUpd` | `setOutMapTelUpd` -> `getSvcDslYmd` | `printBusinessErrorLog` [-] |

All three callers (`setOutMapBothUpd`, `setOutMapNetUpd`, `setOutMapTelUpd`) are internal batch processing methods within the same class `JBSbatKKSmtvlIdoInfSksi`. They are responsible for building the outbound output map data for the smart-bill synchronization mismatch notification file:
- `setOutMapBothUpd` — for both network and telephone contracts
- `setOutMapNetUpd` — for network-only contracts
- `setOutMapTelUpd` — for telephone-only contracts

No screen or batch entry points were found within 8 hops. The method is a private utility called exclusively by the class's own output-map builders, serving as a date-resolution helper in the KDDI mismatch notification data assembly pipeline.

## 6. Per-Branch Detail Blocks

**Block 1** — [IF] `(PRG_STAT_SHOSA_CL.equals(prgStat))` [PRG_STAT_SHOSA_CL = "0901" (Investigation Cancellation)] (L2521)

> Business: When the progress status indicates investigation cancellation, the cancellation date is the investigation cancellation date itself.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcDslYmd = shosaClYmd` // Assign investigation cancellation date |
| 2 | IF | `shosaClYmd == null || "".equals(shosaClYmd)` (L2524) — is the date empty? |

**Block 1.1** — [nested IF] `(shosaClYmd is null or empty)` (L2524)

> Business: Validation check — if the investigation cancellation date is missing, emit an error.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `commonItem.getLogPrint().printBusinessErrorLog(JPCBatchMessageConstant.EKKB0010CW, new String[]{"進捗ステータス：" + prgStat + " において、サービス解約年月日が取得できません。"})` // EMIT BUSINESS ERROR LOG: "Cannot obtain service cancellation date in progress status: {prgStat}" |

---

**Block 2** — [ELSE-IF] `(PRG_STAT_DSL_FIN.equals(prgStat) || PRG_STAT_KSI_DSL_FIN.equals(prgStat))` [PRG_STAT_DSL_FIN = "1304" (Contract Completion), PRG_STAT_KSI_DSL_FIN = "2203" (Forced Contract Completion)] (L2533)

> Business: When the progress status indicates either contract completion or forced contract completion, the cancellation date is the service cancellation base date (解約起算日).

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcDslYmd = svcDslKisanYmd` // Assign service cancellation base date |
| 2 | IF | `svcDslKisanYmd == null || "".equals(svcDslKisanYmd)` (L2536) — is the base date empty? |

**Block 2.1** — [nested IF] `(svcDslKisanYmd is null or empty)` (L2536)

> Business: Validation check — if the service cancellation base date is missing, emit an error.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `commonItem.getLogPrint().printBusinessErrorLog(JPCBatchMessageConstant.EKKB0010CW, new String[]{"進捗ステータス：" + prgStat + " において、サービス解約年月日が取得できません。"})` // EMIT BUSINESS ERROR LOG: "Cannot obtain service cancellation date in progress status: {prgStat}" |

---

**Block 3** — [ELSE-IF] `(PRG_STAT_CNCL_FIN.equals(prgStat))` [PRG_STAT_CNCL_FIN = "1201" (Cancellation Completion)] (L2545)

> Business: When the progress status indicates cancellation completion, further branch on the service contract status to determine the correct cancellation date.

| # | Type | Code |
|---|------|------|
| 1 | IF | `STAT_DSL_ZM.equals(svcKeiStat)` (L2550) — is the contract status "Contract Cancelled"? |

**Block 3.1** — [nested IF-THEN] `(STAT_DSL_ZM.equals(svcKeiStat))` [STAT_DSL_ZM = "910" (Contract Cancelled / 解約済)] (L2550)

> Business: If the contract status is fully cancelled, the cancellation date is the service cancellation base date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcDslYmd = svcDslKisanYmd` // Assign service cancellation base date |
| 2 | IF | `svcDslKisanYmd == null || "".equals(svcDslKisanYmd)` (L2553) — is the base date empty? |

**Block 3.1.1** — [nested IF] `(svcDslKisanYmd is null or empty)` (L2553)

> Business: Validation check — if the service cancellation base date is missing, emit an error.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `commonItem.getLogPrint().printBusinessErrorLog(JPCBatchMessageConstant.EKKB0010CW, new String[]{"進捗ステータス：" + prgStat + " において、サービス解約年月日が取得できません。"})` // EMIT BUSINESS ERROR LOG: "Cannot obtain service cancellation date in progress status: {prgStat}" |

**Block 3.2** — [nested ELSE] `(svcKeiStat != STAT_DSL_ZM)` (L2560)

> Business: If the contract status is NOT fully cancelled, use the service cancellation date instead (e.g., a partial or pending cancellation).

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcDslYmd = svcCancelYmd` // Assign service cancellation date |
| 2 | IF | `svcCancelYmd == null || "".equals(svcCancelYmd)` (L2563) — is the cancellation date empty? |

**Block 3.2.1** — [nested IF] `(svcCancelYmd is null or empty)` (L2563)

> Business: Validation check — if the service cancellation date is missing, emit an error.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `commonItem.getLogPrint().printBusinessErrorLog(JPCBatchMessageConstant.EKKB0010CW, new String[]{"進捗ステータス：" + prgStat + " において、サービス解約年月日が取得できません。"})` // EMIT BUSINESS ERROR LOG: "Cannot obtain service cancellation date in progress status: {prgStat}" |

---

**Block 4** — [ELSE-IF] `(PRG_STAT_PAUSE_STA_FIN.equals(prgStat))` [PRG_STAT_PAUSE_STA_FIN = "2401" (Suspension Start Completion / 休止開始完了)] (L2575)

> Business: When the progress status indicates suspension start completion, the cancellation date is the service suspension date (サービス休止年月日). In this business context, suspension is treated as a form of cancellation for notification purposes.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcDslYmd = svcPauseYmd` // Assign service suspension date |
| 2 | IF | `svcPauseYmd == null || "".equals(svcPauseYmd)` (L2578) — is the suspension date empty? |

**Block 4.1** — [nested IF] `(svcPauseYmd is null or empty)` (L2578)

> Business: Validation check — if the service suspension date is missing, emit an error.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `commonItem.getLogPrint().printBusinessErrorLog(JPCBatchMessageConstant.EKKB0010CW, new String[]{"進捗ステータス：" + prgStat + " において、サービス解約年月日が取得できません。"})` // EMIT BUSINESS ERROR LOG: "Cannot obtain service cancellation date in progress status: {prgStat}" |

---

**Block 5** — [ELSE-IF] `(PRG_STAT_KARI_CNCL.equals(prgStat))` [PRG_STAT_KARI_CNCL = "9706" (Construction Temporary Cancellation / 工事仮キャンセル受付)] (L2588)

> Business: When the progress status indicates construction temporary cancellation, the cancellation date is the temporary cancellation reception date (仮キャンセル受付年月日). This branch was added in IT1-2018-0000100 to handle temporary cancellations during construction that were previously not reflected in the smart-bill synchronization mismatch notification file.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcDslYmd = krCnclUkYmd` // Assign temporary cancellation reception date |
| 2 | IF | `!JKUStrConst.CD01714_KARI_CANCEL.equals(kjKrCnclFlg) || krCnclUkYmd == null || "".equals(krCnclUkYmd)` (L2591) — is the temp cancel flag NOT "1" OR is the reception date empty? |

**Block 5.1** — [nested IF] `(kjKrCnclFlg != CD01714_KARI_CANCEL OR krCnclUkYmd is null/empty)` (L2591)

> Business: Validation check — the temporary cancellation reception date is only valid when the construction temporary cancellation flag equals "1" (CD01714_KARI_CANCEL = Temporary Cancellation / 仮キャンセル) AND the reception date is not empty. If either condition fails, emit an error.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `commonItem.getLogPrint().printBusinessErrorLog(JPCBatchMessageConstant.EKKB0010CW, new String[]{"進捗ステータス：" + prgStat + " において、仮キャンセル受付年月日が取得できません。"})` // EMIT BUSINESS ERROR LOG: "Cannot obtain temporary cancellation reception date in progress status: {prgStat}" |

> Note: This error message is different from all other branches — it specifically mentions "仮キャンセル受付年月日" (temporary cancellation reception date) rather than "サービス解約年月日" (service cancellation date).

---

**Block 6** — [implicit ELSE for all branches] (L2597)

> Business: If `prgStat` is `null` or does not match any known status code, `svcDslYmd` remains `null` and is returned as-is. This allows callers to detect an unhandled status by receiving a null value.

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svcDslYmd` | Field | Service cancellation date (サービス解約年月日) — the resolved cancellation date returned by this method, used in KDDI mismatch notification file output |
| `prgStat` | Field | Progress status (進捗ステータス) — identifies the current lifecycle stage of a service contract operation |
| `shosaClYmd` | Field | Investigation cancellation date (照査取消年月日) — the date on which the prior contract's eligibility review (照査) was cancelled |
| `svcDslKisanYmd` | Field | Service cancellation base date (解約起算日) — the base date from which service cancellation takes effect; typically the contract anniversary date |
| `svcCancelYmd` | Field | Service cancellation date (サービスキャンセル年月日) — the actual date a service cancellation request was completed |
| `svcPauseYmd` | Field | Service suspension date (サービス休止年月日) — the date a service was placed into suspended status |
| `svcKeiStat` | Field | Service contract status (サービス契約ステータス) — the current status of the service contract (e.g., active, cancelled, pending) |
| `kjKrCnclFlg` | Field | Construction temporary cancellation flag (工事仮キャンセルフラグ) — flag indicating whether a temporary cancellation was performed during construction |
| `krCnclUkYmd` | Field | Temporary cancellation reception date (仮キャンセル受付年月日) — the date a temporary cancellation request was received |
| `PRG_STAT_SHOSA_CL` | Constant | "0901" — Investigation Cancellation status code (照査取消) |
| `PRG_STAT_DSL_FIN` | Constant | "1304" — Contract Completion status code (解約完了) |
| `PRG_STAT_KSI_DSL_FIN` | Constant | "2203" — Forced Contract Completion status code (強制解約完了) |
| `PRG_STAT_CNCL_FIN` | Constant | "1201" — Cancellation Completion status code (キャンセル完了) |
| `PRG_STAT_PAUSE_STA_FIN` | Constant | "2401" — Suspension Start Completion status code (休止開始完了) |
| `PRG_STAT_KARI_CNCL` | Constant | "9706" — Construction Temporary Cancellation status code (工事仮キャンセル受付) |
| `STAT_DSL_ZM` | Constant | "910" — Contract Cancelled status code (解約済) |
| `CD01714_KARI_CANCEL` | Constant | "1" — Temporary Cancellation flag value (仮キャンセル) from JKUStrConst |
| `EKKB0010CW` | Constant | Business error log message code — indicates a required field could not be obtained |
| KDDI | Business term | K.K. Dena Kogyo — Japan's largest mobile carrier; the parent service provider that K-Opticom (the customer) synchronizes with for contract data |
| Smart-bill Synchronization Mismatch Notification (スマートバリュー異動連携情報) | Business term | The batch process that detects and reports discrepancies between K-Opticom's internal service contract data and what was previously reported to KDDI |
| Both-up contract | Business term | A service contract covering both network and telephone services (ernet + telephone) |
| Net-up / Tel-up contract | Business term | Service contracts covering only network (net) or only telephone (tel) services |
| 照査 (Sousa) | Japanese term | Eligibility review / verification process performed before activating a new service contract |
| 解約起算日 (Kaisai Kisabi) | Japanese term | Contract cancellation start date — the anniversary date from which a service cancellation calculation begins |
| 工事仮キャンセル (Koji Kari-Kan塞尔) | Japanese term | Temporary cancellation during construction — a provisional cancellation recorded when construction is cancelled but may be rescheduled |