# Business Logic — JKKKikiKaifukuWrisvcCC.execKktkSvcKeiInfoKaifuku() [36 LOC]

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

## 1. Role

### JKKKikiKaifukuWrisvcCC.execKktkSvcKeiInfoKaifuku()

This method prepares and dispatches the **discount automatic application for equipment-provided service contract recovery** (機器提供サービス契約回復の割引CC呼び出し). In the K-Opticom customer core system, when a service contract that was previously suspended or cancelled is being **recovered** (i.e., reinstated), the system must apply any applicable discount rules to the restored service line items. This method acts as a **parameter assembler** — it extracts service contract details from the `ekk0341a010Msg` CAANMsg (the message structure carrying equipment-provided service contract registration information) and populates a `paramMap` with all the fields required by the downstream discount auto-application handler (`execWrisvcAutoAply`).

The method implements a **delegation pattern**: it does not perform business logic itself beyond data assembly. It reads fields from the incoming CAAN message, sets fixed values for certain metadata (such as `tg_kei_skbt_cd = "06"` for the target contract type, and `add_chge_div = "04"` indicating the "recovery" operation division), then delegates all actual discount processing to `execWrisvcAutoAply`. This keeps the method thin, testable, and focused purely on data preparation for a single operational path.

It is called exclusively from `JKKKikiKaifukuWrisvcCC.execKikiTorokuWrisvc()` when the function code equals `"1"` (registration mode), meaning this method is a **conditional sub-handler** within a larger service contract registration workflow.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["execKktkSvcKeiInfoKaifuku(params)"])

    START --> CREATE["Create paramMap HashMap"]

    CREATE --> SET_TG["Set tg_kei_skbt_cd = 06
(Target contract type code)"]

    SET_TG --> SET_SVC_NO["Set svc_kei_ucwk_no = empty
(Service contract detail number)"]

    SET_SVC_NO --> SET_KKTK_NO["Set kktk_svc_kei_no
From ekk0341a010Msg
(KKTK_SVC_KEI_NO field)"]

    SET_KKTK_NO --> SET_SVC_STAT["Set svc_kei_ucwk_stat = empty
(Service contract detail status)"]

    SET_SVC_STAT --> SET_KKTK_STAT["Set kktk_svc_kei_stat
From ekk0341a010Msg
(KKTK_SVC_KEI_STAT field)"]

    SET_KKTK_STAT --> SET_KKTK_CD["Set kktk_svc_cd
From ekk0341a010Msg
(KKTK_SVC_CD field)"]

    SET_KKTK_CD --> SET_KKTK_SBT["Set kktk_sbt_cd
From ekk0341a010Msg
(KKTK_SBT_CD field)"]

    SET_KKTK_SBT --> SET_PCRS["Set pcrs_cd
From ekk0341a010Msg
(PCRS_CD field)"]

    SET_PCRS --> SET_PPLAN["Set pplan_cd
From ekk0341a010Msg
(PPLAN_CD field)"]

    SET_PPLAN --> SET_ADDCHG["Set add_chge_div = 04
(Registration/Change division: Recovery)"]

    SET_ADDCHG --> CALL_APPLY["Call execWrisvcAutoAply
With paramMap, dataMapKey, mskmNo"]

    CALL_APPLY --> END_NODE(["Return void"])

    START --> CREATE --> SET_TG --> SET_SVC_NO --> SET_KKTK_NO --> SET_SVC_STAT --> SET_KKTK_STAT --> SET_KKTK_CD --> SET_KKTK_SBT --> SET_PCRS --> SET_PPLAN --> SET_ADDCHG --> CALL_APPLY --> END_NODE
```

This method executes a **linear, sequential data-assembly pipeline**:
1. Creates a new `HashMap` for the parameter map.
2. Populates 9 key-value pairs into the map — each with a business-meaningful key and either a fixed literal or a value extracted from the incoming `CAANMsg`.
3. Delegates to `execWrisvcAutoAply` with the fully assembled parameter map and remaining context parameters.

There are **no conditional branches, loops, or exception handling** within this method. All logic is purely data preparation.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle for the current transaction context. Provides connection management and transaction boundaries for any DB operations triggered downstream. |
| 2 | `scCall` | `ServiceComponentRequestInvoker` | Service Component invocation bridge used to call remote or local service components. While passed into this method, it is **not used** directly here — it propagates to the downstream `execWrisvcAutoAply` call. |
| 3 | `param` | `IRequestParameterReadWrite` | Request parameter container holding key-value data exchanged across CC (Common Component) boundaries. Used by downstream auto-application logic to set and retrieve working data. |
| 4 | `dataMapKey` | `String` | Key used to locate the working HashMap within the `param` container. This key serves as the data map identifier for the current request context. |
| 5 | `ekk0341a010Msg` | `CAANMsg` | CAAN message object carrying the **equipment-provided service contract registration data** (機器提供サービス契約情報). Contains fields such as service contract number, status, service code, service subtype code, price code, and price plan code — all extracted by this method for the discount auto-application. |
| 6 | `mskmNo` | `String` | Application number (申請番号) — the unique identifier for the service contract application/order being processed. Used to link the discount application to the correct order record. |

**No instance fields or external state** are read directly by this method. All data flows through the method parameters.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKKikiKaifukuWrisvcCC.execWrisvcAutoAply` | - | - | Delegates to `execWrisvcAutoAply` for automatic discount application processing on recovered service contracts |
| R | `EKK0341A010CBSMsg1List.getString` | EKK0341A010CBSMsg1List | - | Extracts `KKTK_SVC_KEI_NO` (equipment-provided service contract number) from the CAAN message |
| R | `EKK0341A010CBSMsg1List.getString` | EKK0341A010CBSMsg1List | - | Extracts `KKTK_SVC_KEI_STAT` (equipment-provided service contract status) from the CAAN message |
| R | `EKK0341A010CBSMsg1List.getString` | EKK0341A010CBSMsg1List | - | Extracts `KKTK_SVC_CD` (equipment-provided service code) from the CAAN message |
| R | `EKK0341A010CBSMsg1List.getString` | EKK0341A010CBSMsg1List | - | Extracts `KKTK_SBT_CD` (equipment-provided subtype code) from the CAAN message |
| R | `EKK0341A010CBSMsg1List.getString` | EKK0341A010CBSMsg1List | - | Extracts `PCRS_CD` (price code) from the CAAN message |
| R | `EKK0341A010CBSMsg1List.getString` | EKK0341A010CBSMsg1List | - | Extracts `PPLAN_CD` (price plan code) from the CAAN message |

**Classification rationale:**
- This method performs **no direct database CRUD operations**. It only assembles a parameter map and delegates to `execWrisvcAutoAply`.
- All CBS reads are from the in-memory `CAANMsg` object (`ekk0341a010Msg`), extracting 6 string fields via `getString()`. These are message payload reads, not database queries.
- The single business method call is `execWrisvcAutoAply`, which is a **write** operation (automatic discount application to a service contract) — but the actual DB operations occur in that downstream method, not here.

## 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: `execWrisvcAutoAply` [-], `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 | Class:JKKKikiKaifukuWrisvcCC | `execKikiTorokuWrisvc()` [func_code == "1"] -> `execKktkSvcKeiInfoKaifuku()` | `execWrisvcAutoAply` [write], `getString` [R] x6 |

**Caller details:**
- `JKKKikiKaifukuWrisvcCC.execKikiTorokuWrisvc()` — The service contract registration method. It checks if `func_code` equals `FUNC_CODE_1` ("1", registration mode), and if so, retrieves the `ekk0341a010Msg` from the temporary data map under key `TEMPLATE_ID_EKK0341A010`, then invokes `execKktkSvcKeiInfoKaifuku` to handle the discount application for the recovered service contract.
- The caller is a private method in the same class; this is an internal workflow dispatch, not a screen entry point.
- There are **no screen-level or batch entry points** (no `KKSV*` class methods) calling this method directly.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET/ASSIGN] `paramMap` initialization (L265)

> Creates a new HashMap to hold the parameter map for the discount auto-application call. This is the data container that bridges this method to `execWrisvcAutoAply`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap = new HashMap<String, Object>()` // Parameter container for discount auto-application |

**Block 2** — [SET] Individual setup fields — fixed values (L268–269)

> Sets the target contract type code and the service contract detail number. `tg_kei_skbt_cd = "06"` identifies this as an equipment-provided service contract (機器提供サービス契約). The service contract detail number is left empty as this is a recovery operation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap.put("tg_kei_skbt_cd", "06")` // Target contract type code = "06" (equipment-provided service) [-> "06"] |
| 2 | SET | `paramMap.put("svc_kei_ucwk_no", "")` // Service contract detail number = empty [-> ""] |

**Block 3** — [SET] Individual setup fields — from message (L271–272)

> Extracts the equipment-provided service contract number from the CAAN message and stores it in the parameter map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap.put("kktk_svc_kei_no", ekk0341a010Msg.getString(EKK0341A010CBSMsg1List.KKTK_SVC_KEI_NO))` // Equipment-provided service contract number [-> KKTK_SVC_KEI_NO = "kktk_svc_kei_no"] |
| 2 | SET | `paramMap.put("svc_kei_ucwk_stat", "")` // Service contract detail status = empty [-> ""] |

**Block 4** — [SET] Individual setup fields — contract metadata (L274–279)

> Extracts the service contract status, service code, and service subtype code from the CAAN message. These fields identify the specific service being recovered.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap.put("kktk_svc_kei_stat", ekk0341a010Msg.getString(EKK0341A010CBSMsg1List.KKTK_SVC_KEI_STAT))` // Equipment-provided service contract status [-> KKTK_SVC_KEI_STAT = "kktk_svc_kei_stat"] |
| 2 | SET | `paramMap.put("kktk_svc_cd", ekk0341a010Msg.getString(EKK0341A010CBSMsg1List.KKTK_SVC_CD))` // Equipment-provided service code [-> KKTK_SVC_CD = "kktk_svc_cd"] |
| 3 | SET | `paramMap.put("kktk_sbt_cd", ekk0341a010Msg.getString(EKK0341A010CBSMsg1List.KKTK_SBT_CD))` // Equipment-provided subtype code [-> KKTK_SBT_CD = "kktk_sbt_cd"] |

**Block 5** — [SET] Individual setup fields — pricing metadata (L281–282)

> Extracts the price code and price plan code from the CAAN message. These determine which pricing and discount rules apply to the recovered service.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap.put("pcrs_cd", ekk0341a010Msg.getString(EKK0341A010CBSMsg1List.PCRS_CD))` // Price code [-> PCRSD_CD = "pcrs_cd"] |
| 2 | SET | `paramMap.put("pplan_cd", ekk0341a010Msg.getString(EKK0341A010CBSMsg1List.PPLAN_CD))` // Price plan code [-> PPLAN_CD = "pplan_cd"] |

**Block 6** — [SET] Individual setup fields — operation division (L284)

> Sets `add_chge_div` to `"04"`, which represents the **recovery** (回復) operation in the registration/change division classification. This tells the discount auto-application handler that this is a service contract recovery, not a new registration or modification.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap.put("add_chge_div", "04")` // Registration/Change division = "04" (Recovery / 回復) [-> "04"] |

**Block 7** — [CALL] Delegated discount application (L286)

> Delegates to `execWrisvcAutoAply` with the fully assembled parameter map. This downstream method processes the automatic application of discounts to the recovered service contract, using all the fields prepared in this method plus the working data from the parameter container.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `execWrisvcAutoAply(handle, param, ekk0341a010Msg, paramMap, dataMapKey, mskmNo)` // Automatic discount application for recovered service contract |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `tg_kei_skbt_cd` | Field | Target contract subtype code — identifies the type of service contract. Value "06" denotes equipment-provided service (機器提供サービス) |
| `svc_kei_ucwk_no` | Field | Service contract detail work number — internal tracking ID for a specific service contract line item. Left empty for recovery operations |
| `svc_kei_ucwk_stat` | Field | Service contract detail work status — operational status of the service contract detail. Left empty for recovery operations |
| `kktk_svc_kei_no` | Field | Equipment-provided service contract number (機器提供サービス契約番号) — unique identifier for the equipment-provided service contract being recovered |
| `kktk_svc_kei_stat` | Field | Equipment-provided service contract status (機器提供サービス契約ステータス) — current operational status of the service contract |
| `kktk_svc_cd` | Field | Equipment-provided service code (機器提供サービスコード) — code identifying the type of equipment-provided service (e.g., FTTH, Mail) |
| `kktk_sbt_cd` | Field | Equipment-provided subtype code (機器提供種別コード) — subtype classification within the equipment-provided service category |
| `pcrs_cd` | Field | Price code (料金コード) — pricing code that determines the rate structure for the service |
| `pplan_cd` | Field | Price plan code (料金プランコード) — pricing plan identifier that selects the specific tariff/plan for the service |
| `add_chge_div` | Field | Registration/Change division (登録/変更区分) — operation type discriminator. Value "04" means **Recovery** (回復), i.e., reinstating a previously suspended/cancelled contract |
| `mskm_no` | Field | Application number (申請番号) — unique application/order ID for the customer's service contract application |
| `ekk0341a010Msg` | Field | CAAN message object for equipment-provided service contract registration (機器提供サービス契約情報) — carries all service contract fields extracted during this method |
| `func_code` | Field | Function code — operation mode identifier. Value "1" (FUNC_CODE_1) indicates registration mode |
| EKK0341A010 | BS Code | Equipment-provided service contract registration/change BS code — the service component for equipment-provided service contract management |
| `execWrisvcAutoAply` | Method | Automatic discount application for recovered service contract (割引サービス自動適用) — downstream method that applies discount rules to restored service contracts |
| `JKKKikiKaifukuWrisvcCC` | Class | Equipment-provided service contract recovery discount CC (機器提供サービス契約回復割引CC) — common component for handling discount logic during service contract recovery |
| `JKKikiTorokuWrisvc` | Method | Equipment-provided service contract registration (機器提供サービス契約登録) — the parent method that calls this method when processing recovery with discount application |
| CAANMsg | Type | Common Application ANdling Message — Fujitsu middleware message container for data exchange between system components |
| SC | Abbreviation | Service Component — a service layer module that encapsulates business logic and data access |
| CC | Abbreviation | Common Component — a shared utility or processing component used across multiple screens/workflows |
| paramMap | Variable | Parameter map — HashMap carrying service contract data to the discount auto-application handler |
