# Business Logic — JCKCustAddBnktUpdCC.executeDslSeikyOpSvcKei() [72 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JCKCustAddBnktUpdCC` |
| Layer | CC/Common Component (Business logic shared component) |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JCKCustAddBnktUpdCC.executeDslSeikyOpSvcKei()

This method performs the end-to-end business operation of cancelling a billing option service contract (請求オプションサービス契約解約) in the Fujitsu Futurity telecommunications order management system. Specifically, it handles the full cancellation lifecycle for DSL billing option service contracts, which are optional add-on services tied to a customer's primary internet access line (such as FTTH — Fiber To The Home).

The method follows a three-phase sequential processing pattern: (1) it queries the billing schedule event list to obtain the latest event date, (2) it executes the cancellation transaction via CBS (EKK0441C230), which records the service cancellation with its effective date, reason code, and timing metadata, and (3) it confirms the cancellation via a second CBS call (EKK0441C240), ensuring the cancellation is persisted with the generated timestamp from step two. This two-phase approach (execute-then-confirm) is a common idempotency and audit trail pattern in the system's CBS layer.

The method serves as a shared utility component called by multiple screen controllers and CBS handlers that perform DSL billing option service contract cancellation. It does not branch by service type — it unconditionally processes the cancellation for the DSL billing option service contract identified by `seiopsvc_kei_no`. Its role in the larger system is as the business logic coordinator between the presentation layer (screens/batches) and the CBS persistence layer, assembling input parameters, orchestrating CBS calls in the correct sequence, and extracting key return values for downstream processing.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeDslSeikyOpSvcKei"])
    STEP1["1. Billing Schedule Event List Inquiry
ECH0501B010CBS"]
    STEP1B["Extract EVENT_YMD from response"]
    STEP2["2. Get Service Charge End Date
getSvcChrgEndYmd()"]
    STEP3["3. Retrieve seiopsvc_kei_no
from workMap"]
    STEP4["4. Billing Option Service Contract Cancellation
EKK0441C230CBS"]
    STEP4B["Extract GENE_ADD_DTM, UPD_DTM from response"]
    STEP5["5. Billing Option Service Contract Cancellation Confirmation
EKK0441C240CBS"]
    END_NODE["Return / Next"]

    START --> STEP1
    STEP1 --> STEP1B
    STEP1B --> STEP2
    STEP2 --> STEP3
    STEP3 --> STEP4
    STEP4 --> STEP4B
    STEP4B --> STEP5
    STEP5 --> END_NODE
```

**Processing summary:** The method executes a strict sequential pipeline with no conditional branching. Each step depends on the output of the previous step or on input parameters.

1. **Billing Schedule Event List Inquiry (ECH0501B010CBS):** Queries the billing schedule event list using the operation date (`opeDate`) and event code `"03"` (event code). The `FUNC_CD_1 = "1"` indicates the standard function pattern. The `TEMPLATE_ID_ECH0501B010 = "ECH0501B010"` identifies the CBS template.
2. **Extract EVENT_YMD:** From the response list, the first entry's `EVENT_YMD` field is extracted. This represents the billing schedule event date.
3. **Service Charge End Date Retrieval:** Calls `getSvcChrgEndYmd()` to compute the service charge end date using the operation date and the event date from step 2.
4. **Retrieve seiopsvc_kei_no:** Extracts the billing option service contract number (`seiopsvc_kei_no`) from the work area mapping.
5. **Cancellation Execution (EKK0441C230CBS):** Executes the billing option service contract cancellation with the contract number, detail number, service end date, service charge end date, service cancellation date, cancellation reason code `SVC_DLRE_RSN_CD_VALUE_01 = "01"` (ordinary cancellation / 通常解約), move classification, and previous update timestamp.
6. **Extract timestamps:** Retrieves `GENE_ADD_DTM` (generation registration timestamp) and `UPD_DTM` (update timestamp) from the cancellation response for use in confirmation.
7. **Cancellation Confirmation (EKK0441C240CBS):** Confirms the cancellation using the same parameters plus the `GENE_ADD_DTM` and `UPD_DTM` from the previous step's response.
8. **Return:** The method returns void; processing continues in the caller.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle providing the transactional context and connection to the database. Required for all CBS invocations. |
| 2 | `param` | `IRequestParameterReadWrite` | Request parameter object that carries mapping work area data (including `seiopsvc_kei_no`), and is passed to CBS calls for input/output data exchange. |
| 3 | `scCall` | `ServiceComponentRequestInvoker` | Service Component invocation handler used to call CBS (EKK0441C230CBS, EKK0441C240CBS, ECH0501B010CBS) through the `callSC` wrapper method. |
| 4 | `fixedText` | `String` | Fixed text configuration string, passed through to CBS calls for template resolution and message formatting. |
| 5 | `opeDate` | `String` | Operation date (運用日) — the business date for the cancellation transaction. Used to query the billing schedule event list (EVENT_STDARDYMD) and as input to service charge end date computation. Format: typically YYYYMMDD. |
| 6 | `seikyKeiNo` | `String` | Billing contract number (請求契約番号) — the top-level billing contract identifier. Passed as a parameter but NOT directly used in this method; it is available to the caller. |
| 7 | `mskmDtlNo` | `String` | Application detail number (申込詳細番号) — the specific line item detail number within the billing option service contract being cancelled. Passed to EKK0441C230CBS as `MSKM_DTL_NO`. |
| 8 | `rsvAplyYmd` | `String` | Reservation application date (予約適用年月日) — the effective date when the service cancellation takes effect. Used as `SVC_ENDYMD`, `SVC_DSL_YMD` (service cancellation date) in both EKK0441C230CBS and EKK0441C240CBS calls. Format: YYYYMMDD. |
| 9 | `idoDiv` | `String` | Move classification (異動区分) — indicates the type of migration/change operation (e.g., transfer, port-in, port-out). Passed to both CBS calls for audit and tracking. |
| 10 | `updDtmBf` | `String` | Billing contract update date before (請求契約更新年月日時分秒) — the pre-update timestamp used for optimistic concurrency control. Passed to EKK0441C230CBS as `UPD_DTM_BF`. |

**External state read:**
- `workMap` (from `param.getMappingWorkArea()`) — contains `HashMap` with key `"WORK"` holding `seiopsvc_kei_no`.

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `callSC(handle, scCall, param, fixedText, ech0501b010In)` | ECH0501B010CBS | Schedule event list (BILLING_SCHEDULE_EVENT) | Reads billing schedule event list to obtain the latest event date (EVENT_YMD). Input: TEMPLATE_ID_ECH0501B010="ECH0501B010", FUNC_CODE="1", KEY_EVENT_CD="03" (event code), KEY_STDARDYMD=opeDate. Output: list of event records; first record's EVENT_YMD is extracted. |
| R | `getSvcChrgEndYmd(param, fixedText, opeDate, ech0501EvevtYmd)` | Internal method | - | Computes the service charge end date based on the operation date and billing schedule event date. Returns a date string (YYYYMMDD format). |
| R | `param.getMappingWorkArea()` | - | - | Reads the work area map from the request parameter to retrieve `seiopsvc_kei_no`. |
| R | `workDataMap.get("seiopsvc_kei_no")` | - | - | Retrieves the billing option service contract number from the work data map. |
| U | `callSC(handle, scCall, param, fixedText, ekk0441c230In)` | EKK0441C230CBS | SEIOPSVC_KEI (Billing Option Service Contract) | Executes the billing option service contract cancellation. Updates the contract with service end date, service charge end date, service cancellation date, cancellation reason code "01" (ordinary cancellation / 通常解約), and move classification. Returns generation registration timestamp (GENE_ADD_DTM) and update timestamp (UPD_DTM). |
| C | `callSC(handle, scCall, param, fixedText, ekk0441c240In)` | EKK0441C240CBS | SEIOPSVC_KEI_IS (Billing Option Service Contract Cancellation History) | Confirms the billing option service contract cancellation, writing the cancellation record with all relevant dates, timestamps, and reason codes to the cancellation history table. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS: JCKCustAddBnktUpdCC.execDslSeikyOpSvcKei() | `execDslSeikyOpSvcKei()` -> `executeDslSeikyOpSvcKei()` | `callSC [R] ECH0501B010CBS`, `callSC [U] EKK0441C230CBS`, `callSC [C] EKK0441C240CBS` |

**Note:** `execDslSeikyOpSvcKei` is a package-private wrapper method within the same class (`JCKCustAddBnktUpdCC`) that delegates to `executeDslSeikyOpSvcKei`. It is the only direct caller found in the codebase. No screen entry points were found within 8 hops of this method — it is invoked as part of a CBS-level operation.

## 6. Per-Branch Detail Blocks

**Block 1** — [EXEC] `(ECH0501B010CBS — Billing Schedule Event List Inquiry) (L2034)`

> Queries the billing schedule event list to obtain the latest billing event date. This is the first step in the cancellation process, providing the event date needed to compute the service charge end date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ech0501b010In` = new `Object[][]` with input parameters [-> `TEMPLATE_ID_ECH0501B010 = "ECH0501B010"`, `FUNC_CD_1 = "1"` (JPCModelConstant), `KEY_EVENT_CD = "03"` (event code / イベントコード), `KEY_STDARDYMD = opeDate` (operation date / 運用日)] |
| 2 | CALL | `callSC(handle, scCall, param, fixedText, ech0501b010In)` → returns `CAANMsg[]` [-> ECH0501B010CBS] |
| 3 | SET | `ech0501b010Out` = `.getCAANMsgList(ECH0501B010CBSMsg.ECH0501B010CBSMSG1LIST)` [extract list from response] |
| 4 | SET | `ech0501EvevtYmd` = `ech0501b010Out[0].getString(ECH0501B010CBSMsg1List.EVENT_YMD)` [billing schedule event date] |

**Block 2** — [EXEC] `(getSvcChrgEndYmd — Service Charge End Date Retrieval) (L2044)`

> Computes the service charge end date by calling the internal `getSvcChrgEndYmd()` helper method. This method uses the operation date and billing event date to determine when service charges should end.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `svcChrgEndYmd` = `getSvcChrgEndYmd(param, fixedText, opeDate, ech0501EvevtYmd)` [compute service charge end date / サービス課金終了年月日] |

**Block 3** — [EXEC] `(Work Area Retrieval) (L2046-2051)`

> Extracts the billing option service contract number (`seiopsvc_kei_no`) from the work area mapping. This number identifies which service contract is being cancelled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `workMap` = `(Map) param.getMappingWorkArea()` [retrieve work area mapping] |
| 2 | SET | `workDataMap` = `(HashMap) workMap.get("WORK")` [get WORK sub-map] |
| 3 | SET | `seiopsvcKeiNo` = `(String) workDataMap.get("seiopsvc_kei_no")` [billing option service contract number / 請求オプションサービス契約番号] |

**Block 4** — [EXEC] `(EKK0441C230CBS — Billing Option Service Contract Cancellation) (L2054)`

> Executes the billing option service contract cancellation. This is the core cancellation operation that updates the contract status to cancelled with the specified end date, reason code, and metadata. The method prepares 13 input parameters including the template ID, function code, contract number, detail number, service end date, service charge end date, service cancellation date, cancellation reason code, move classification, and pre-update timestamp. Note: the commented-out `PLAN_END_SBT_CD` parameter (`PLAN_END_SBT_CD_VALUE_2 = "2"`, plan end type code — 2: termination by cancellation / 解約による終了) is intentionally excluded.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0441c230In` = new `Object[][]` with 13 input pairs: [-> `TEMPLATE_ID_EKK0441C230 = "EKK0441C230"`, `FUNC_CD_1 = "1"`, `SEIOPSVC_KEI_NO = seiopsvcKeiNo` (billing option service contract number / 請求オプションサービス契約番号), `MSKM_DTL_NO = mskmDtlNo` (application detail number / 申込詳細番号), `SVC_ENDYMD = rsvAplyYmd` (service end date / サービス終了年月日), `SVC_CHRG_ENDYMD = svcChrgEndYmd` (service charge end date / サービス課金終了年月日), `SVC_DSL_YMD = rsvAplyYmd` (service cancellation date / サービス解約年月日), `SVC_DLRE_CD = SVC_DLRE_RSN_CD_VALUE_01 = "01"` (service cancellation reason code — 01: ordinary cancellation / 通常解約), `IDO_DIV = idoDiv` (move classification / 異動区分), `UPD_DTM_BF = updDtmBf` (billing contract update date before / 請求契約更新年月日時分秒)] |
| 2 | CALL | `ekk0441c230Out` = `callSC(handle, scCall, param, fixedText, ekk0441c230In)` → returns `CAANMsg` [-> EKK0441C230CBS — UPDATE operation] |
| 3 | SET | `c230OutGeneAddDtm` = `ekk0441c230Out.getString(EKK0441C230CBSMsg.GENE_ADD_DTM)` [generation registration timestamp / 世代登録年月日時分秒] |
| 4 | SET | `c230OutUpdDtm` = `ekk0441c230Out.getString(EKK0441C230CBSMsg.UPD_DTM)` [update timestamp / 更新年月日時分秒] |

**Block 5** — [EXEC] `(EKK0441C240CBS — Billing Option Service Contract Cancellation Confirmation) (L2073)`

> Confirms the billing option service contract cancellation by calling EKK0441C240CBS. This writes a confirmation record to the cancellation history table, using the timestamps returned from the cancellation execution (Block 4, steps 3-4) to ensure audit trail consistency. The input mirrors the cancellation parameters but uses `c230OutUpdDtm` as the `UPD_DTM_BF` instead of the original `updDtmBf`, ensuring the confirmation is tied to the exact cancellation record.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0441c240In` = new `Object[][]` with 10 input pairs: [-> `TEMPLATE_ID_EKK0441C240 = "EKK0441C240"`, `FUNC_CD_1 = "1"`, `SEIOPSVC_KEI_NO = seiopsvcKeiNo` (billing option service contract number / 請求オプションサービス契約番号), `GENE_ADD_DTM = c230OutGeneAddDtm` (generation registration timestamp from cancellation / 請求オプションサービス契約解約.世代登録年月日時分秒), `SVC_ENDYMD = rsvAplyYmd` (service end date / サービス終了年月日), `SVC_CHRG_ENDYMD = svcChrgEndYmd` (service charge end date / サービス課金終了年月日), `SVC_DSL_YMD = rsvAplyYmd` (service cancellation date / サービス解約年月日), `SVC_DLRE_CD = SVC_DLRE_RSN_CD_VALUE_01 = "01"` (service cancellation reason code — 01: ordinary cancellation / 通常解約), `UPD_DTM_BF = c230OutUpdDtm` (billing option service contract cancellation update timestamp / 請求オプションサービス契約解約.更新年月日時分秒)] |
| 2 | CALL | `callSC(handle, scCall, param, fixedText, ekk0441c240In)` [-> EKK0441C240CBS — CREATE confirmation record] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `seiopsvc_kei_no` | Field | Billing option service contract number (請求オプションサービス契約番号) — unique identifier for a billing option service contract line item. |
| `mskmDtlNo` | Field | Application detail number (申込詳細番号) — specific detail line item number within a service contract application. |
| `rsvAplyYmd` | Field | Reservation application date (予約適用年月日) — the effective date when a service change (cancellation, modification) takes effect. |
| `opeDate` | Field | Operation date (運用日) — the business processing date for the transaction. |
| `idoDiv` | Field | Move classification (異動区分) — categorizes the type of migration/change operation (transfer, port-in, port-out, etc.). |
| `updDtmBf` | Field | Billing contract update date before (請求契約更新年月日時分秒) — the pre-update timestamp used for optimistic concurrency control on the billing contract record. |
| `svcChrgEndYmd` | Field | Service charge end date (サービス課金終了年月日) — the date when service charges stop, computed from the billing schedule event date and operation date. |
| `GENE_ADD_DTM` | Field | Generation registration timestamp (世代登録年月日時分秒) — the timestamp when a new version/record generation was created in the database. |
| `EVENT_YMD` | Field | Event date (イベント年月日) — the date of the billing schedule event, used as a reference point for charge calculations. |
| SOD | Acronym | Service Order Data — the telecom order fulfillment system entity model. |
| FTTH | Business term | Fiber To The Home — fiber-optic internet access service. Billing option service contracts are add-on services tied to FTTH primary lines. |
| CBS | Acronym | Component Business Service — the service component layer that handles database persistence and core business rules. Called via `callSC()` wrapper. |
| SC Code | Acronym | Service Component Code — an identifier like `EKK0441C230` used to identify specific business component services. |
| FUNC_CD_1 | Constant | Function code value `"1"` (JPCModelConstant.FUNC_CD_1) — standard function pattern used for CBS calls. |
| KEY_EVENT_CD = "03" | Constant | Event code `"03"` — refers to event code (イベントコード) in the billing schedule event list query. |
| SVC_DLRE_RSN_CD_VALUE_01 | Constant | Service cancellation reason code `"01"` — ordinary cancellation (通常解約), the standard cancellation type when a customer voluntarily terminates a service. |
| PLAN_END_SBT_CD_VALUE_2 | Constant | Plan end type code `"2"` — plan termination by cancellation (解約による終了). Commented out in this method, indicating this code was considered but not applied. |
| TEMPLATE_ID_ECH0501B010 | Constant | CBS template ID `"ECH0501B010"` — billing schedule event list inquiry template. |
| TEMPLATE_ID_EKK0441C230 | Constant | CBS template ID `"EKK0441C230"` — billing option service contract cancellation execution template. |
| TEMPLATE_ID_EKK0441C240 | Constant | CBS template ID `"EKK0441C240"` — billing option service contract cancellation confirmation template. |
| ECH0501B010CBS | CBS | Billing Schedule Event List Inquiry — retrieves the latest billing schedule event date. |
| EKK0441C230CBS | CBS | Billing Option Service Contract Cancellation — executes the cancellation of a billing option service contract. |
| EKK0441C240CBS | CBS | Billing Option Service Contract Cancellation Confirmation — confirms and writes the cancellation record to the history table. |
| CAANMsg | Type | Canonical message object — the standard message container used for CBS input/output. |
| SEIOPSVC_KEI | Entity | Billing option service contract entity/table — stores billing option service contract records. |
| SEIOPSVC_KEI_IS | Entity | Billing option service contract cancellation history entity/table — stores cancellation records for audit trail. |
| BILLING_SCHEDULE_EVENT | Entity | Billing schedule event entity/table — stores billing schedule event records queried by ECH0501B010CBS. |
| workMap | Field | Work area mapping — a `Map` retrieved from `IRequestParameterReadWrite.getMappingWorkArea()` that holds intermediate processing data. |
| WORK | Key | Map key `"WORK"` used to access the work data `HashMap` within the work area mapping. |
