# Business Logic — JKKWrisvcAutoAplyGetSvcInfoCC.editRetEKK0081A010() [241 LOC]

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

## 1. Role

### JKKWrisvcAutoAplyGetSvcInfoCC.editRetEKK0081A010()

This method performs **down-mapping processing for the service contract unique inquiry** (サービス契約一意照会の下りマッピング処理), transforming raw data returned from a service component call into a structured output format ready for the presentation layer. The method operates on a `CAANMsg` template array that was previously populated by the `EKK0081A010CBS` service component (the service contract inquiry CBS), and it normalizes the result into a hierarchy of service group objects (`svcKeiGrpMap`) containing individual service contract line items (`svcKeiList`). It supports **four business operations** based on the `addChgeDiv` discriminator: registration (`"01"`), plan change (`"02"`), and cancellation (`"05"`), plus the default inquiry case. When handling plan changes, it grafts pre-modification service detail values from `inpSvcKeiMap` (the original service contract snapshot) onto the output. The method implements a **router/dispatch pattern** — branching its behavior based on `addChgeDiv` to selectively attach cancellation reason codes or pre-change data. It also coordinates with work areas (`CC_WORK_AREA_NAME_KEISHA`, `CC_WORK_AREA_NAME_MSKM`, `CC_WORK_AREA_NAME_WRI_GET_INFO`) that are shared across the discount service automatic application screen workflow, ensuring that the system ID and service contract list are persisted for subsequent processing steps. Its role in the larger system is a **dedicated data transformer** called by `getSvcInfo()`, which is the main entry point for the discount service automatic application information retrieval screen.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["editRetEKK0081A010"])
    START --> EXTRACT1["Extract TEMPLATE_LIST_KEY from msgList"]
    EXTRACT1 --> EXTRACT_RETCD["Extract RET_CD_INT_KEY as returnCode"]
    EXTRACT_RETCD --> GET_INMAP["Get inMap from param.getData"]

    GET_INMAP --> CHECK_INMAP{inMap is null}
    CHECK_INMAP -->|Yes| CREATE_INMAP["Create new HashMap set into param"]
    CHECK_INMAP -->|No| GET_WORKAREA["Get workMap from param.getMappingWorkArea"]
    CREATE_INMAP --> GET_WORKAREA

    GET_WORKAREA --> CHECK_WORK{workMap is null}
    CHECK_WORK -->|No| WORK_EXTRACT["Extract workDataMapKeisha, workDataMapMskm"]
    CHECK_WORK -->|Yes| GET_SYSID["Get sysid from inMap"]
    WORK_EXTRACT --> CHECK_WORKWRI{workDataMapWrib is null}
    CHECK_WORKWRI -->|Yes| INIT_WRI["Create new workDataMapWrib put into workMap"]
    CHECK_WORKWRI -->|No| GET_SVC_LIST["Get workSvcKeiList from workDataMapWrib"]
    INIT_WRI --> GET_SVC_LIST
    GET_SVC_LIST --> CHECK_SVC_LIST{workSvcKeiList is null}
    CHECK_SVC_LIST -->|Yes| INIT_SVC_LIST["Create new ArrayList put into workDataMapWrib"]
    CHECK_SVC_LIST -->|No| GET_SYSID
    INIT_SVC_LIST --> GET_SYSID

    GET_SYSID --> CHECK_SYSID{sysid is null or empty}
    CHECK_SYSID -->|Yes| GET_SYSID_WORK{workDataMapKeisha not null}
    GET_SYSID --> SET_SYSID_OUT["outputMap.put sysid workDataMapWrib.put sysid"]
    GET_SYSID_WORK -->|Yes| SET_SYSID_WORK["sysid from workDataMapKeisha"]
    GET_SYSID_WORK -->|No| SET_SYSID_OUT
    SET_SYSID_WORK --> SET_SYSID_OUT

    SET_SYSID_OUT --> SET_ADDCHGE["outputMap.put add_chge_div"]
    SET_ADDCHGE --> GET_MSKM["Get mskmNo from inMap"]
    GET_MSKM --> CHECK_MSKM{mskmNo is null or empty}
    CHECK_MSKM -->|Yes| GET_MSKM_WORK{workDataMapMskm not null}
    GET_MSKM --> SET_MSKM["outputMap.put mskm_no"]
    GET_MSKM_WORK -->|Yes| SET_MSKM_WORK["mskmNo from workDataMapMskm"]
    GET_MSKM_WORK -->|No| SET_MSKM
    SET_MSKM_WORK --> SET_MSKM

    SET_MSKM --> SET_FIELDS["Set mskm_sbt_cd ido_div func_code into outputMap"]
    SET_FIELDS --> CHECK_CANCEL{addChgeDiv equals 05}
    CHECK_CANCEL -->|Yes| SET_CANCEL["outputMap.put svc_cancel_rsn_cd"]
    CHECK_CANCEL -->|No| INIT_SVC_LIST_OUT
    SET_CANCEL --> INIT_SVC_LIST_OUT

    INIT_SVC_LIST_OUT["Initialize svcKeiGrpList add svcKeiGrpMap set grp_div=00"]
    INIT_SVC_LIST_OUT --> INIT_CHILD["Initialize svcKeiList under svcKeiGrpMap"]
    INIT_CHILD --> CHECK_TEMPLATE{templateArray valid}
    CHECK_TEMPLATE -->|No| SET_KOJIHI["Set optional kojihi_kap_operate_stat"]
    CHECK_TEMPLATE -->|Yes| EXTRACT_CHILD["Get childTemplate from templateArray[0]"]

    EXTRACT_CHILD --> SET_TG_KET["svcKeiMap.put tg_kei_skbt_cd=01"]
    SET_TG_KET --> EXTRACT_SVC_FIELDS["Extract svc_kei_no svc_kei_stat svc_cd prc_grp_cd pcrs_cd pplan_cd mskm_dtl_no"]
    EXTRACT_SVC_FIELDS --> BOTH_MAPS["Put values into both svcKeiMap and workSvcKeiMap"]

    BOTH_MAPS --> CHECK_PLAN{addChgeDiv equals 02}
    CHECK_PLAN -->|Yes| SET_PCHANGE["Set chge_bf fields from inpSvcKeiMap"]
    CHECK_PLAN -->|No| ADD_SVC_LIST
    SET_PCHANGE --> ADD_SVC_LIST

    ADD_SVC_LIST["svcKeiList.add svcKeiMap"]
    ADD_SVC_LIST --> CHECK_REG_PLAN{addChgeDiv equals 01 or 02}
    CHECK_REG_PLAN -->|Yes| ADD_WORK_LIST["workSvcKeiList.add workSvcKeiMap"]
    CHECK_REG_PLAN -->|No| SET_KOJIHI
    ADD_WORK_LIST --> SET_KOJIHI

    SET_KOJIHI["Set optional kojihi_kap_operate_stat into outputMap"]
    SET_KOJIHI --> SET_ERR["call editErrInfoEKK0081A010"]
    SET_ERR --> GET_ERR_LIST["Get errList from param.getControlMapData ERROR_INFO"]
    GET_ERR_LIST --> SET_ERR_MAP["param.setControlMapData ERROR_INFO TemplateErrorUtil.getErrorInfo"]
    SET_ERR_MAP --> RETURN_END["Return param"]
    RETURN_END --> END(["end"])
```

**Processing Flow Summary:**

1. **Template Extraction** — The method extracts the `CAANMsg` template array and return code from the `msgList` result map using keys from `JCMConstants`.
2. **In-Map Acquisition** — It retrieves the input data map from `param` keyed by `fixedText` (the service message identifier), creating it if missing.
3. **Work Area Initialization** — It accesses a shared work area map from the request parameter, extracting per-component work maps (`JKKAddKeishaServiceCCWork`, `JKKAddMskmServiceCCWork`, `JKKWrisvcAutoAplyGetSvcInfoCCWork`) and ensuring the service contract list (`svc_kei_list`) exists.
4. **System ID Resolution** — It obtains the `sysid` from the input map; if empty, it falls back to the Keisha (company) work map. This is the tenant/organization identifier.
5. **Application Number Resolution** — Similar fallback logic: `mskmNo` (application number / 申請番号) is taken from the input map or the Mskm work map.
6. **Auxiliary Fields** — Sets `mskm_sbt_cd`, `ido_div`, `func_code` into the output map.
7. **Conditional: Cancellation** — If `addChgeDiv` equals `"05"` (cancellation), the cancellation reason code (`svc_cancel_rsn_cd`) is also copied from the input.
8. **Service Contract List Structure** — Initializes a service group list (`svc_kei_grp_list`), creates a group map with `grp_div = "00"`, and initializes the inner `svc_kei_list`.
9. **Template Iteration** — If the CBS returned child templates, it iterates over the first one, extracting all service contract fields (`svc_kei_no`, `svc_kei_stat`, `svc_cd`, `prc_grp_cd`, `pcrs_cd`, `pplan_cd`, `mskm_dtl_no`) with null-safe getters.
10. **Conditional: Plan Change** — If `addChgeDiv` equals `"02"` (plan change), it grafts pre-change snapshot data (`chge_bf_*`) from `inpSvcKeiMap`.
11. **Conditional: Registration/Plan Change Work List** — If `addChgeDiv` is `"01"` or `"02"`, the extracted work map is appended to the shared `workSvcKeiList`.
12. **Optional Work Field** — Sets `kojihi_kap_operate_stat` if present (IT1-2018-0000086 enhancement for construction cost request).
13. **Error Handling** — Delegates to `editErrInfoEKK0081A010` to format error info, then consolidates it via `TemplateErrorUtil.getErrorInfo` into the control map.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `msgList` | `Map<?, ?>` | Service interface execution result — contains the `CAANMsg` template array returned from the EKK0081A010CBS service component call, along with a return code. This is the raw inbound payload that the method transforms. |
| 2 | `param` | `IRequestParameterReadWrite` | Request parameter object — the mutable container carrying data across the request processing pipeline. Used to read/write work areas, control map data (errors), and the `fixedText`-keyed input map. |
| 3 | `fixedText` | `String` | Service message identifier — acts as a key into `param` to locate the input data map containing request-level fields like `sysid`, `mskm_no`, `mskm_sbt_cd`, `ido_div`, `func_code`. Represents the screen/service message context. |
| 4 | `addChgeDiv` | `String` | Registration/Change discriminator — controls which branch the method takes. `"01"` = new registration (新規登録), `"02"` = plan change (プラン変更), `"05"` = cancellation (キャンセル). Determines whether cancellation reason codes or pre-change snapshots are attached. |
| 5 | `outputMap` | `HashMap` | Output parameter storage map — receives the resolved business data: `sysid`, `add_chge_div`, `mskm_no`, `mskm_sbt_cd`, `ido_div`, `func_code`, `svc_cancel_rsn_cd` (if applicable), `svc_kei_grp_list`, and `kojihi_kap_operate_stat`. |
| 6 | `inpSvcKeiMap` | `HashMap` | Input service contract information map — holds the **pre-change snapshot** of service contract detail data. Used only when `addChgeDiv = "02"` (plan change) to set `chge_bf_svc_cd`, `chge_bf_prc_grp_cd`, `chge_bf_pcrs_cd`, `chge_bf_pplan_cd`. May be `null` for non-plan-change scenarios. |

**Instance Fields Read (from the class itself):** None directly — all constants are static or local.

**Constant Values Used:**

| Constant | Resolved Value | Business Meaning |
|----------|---------------|------------------|
| `JCMConstants.TEMPLATE_LIST_KEY` | `"TEMPLATE_LIST"` (standard) | Key to retrieve `CAANMsg[]` template array from `msgList` |
| `JCMConstants.RET_CD_INT_KEY` | `"RET_CD"` (standard) | Key to retrieve return code as Integer from `msgList` |
| `CC_WORK_AREA_NAME_KEISHA` | `"JKKAddKeishaServiceCCWork"` | Work area name for company (keisha / 会社) data map |
| `CC_WORK_AREA_NAME_MSKM` | `"JKKAddMskmServiceCCWork"` | Work area name for application (mskm / 申請) data map |
| `CC_WORK_AREA_NAME_WRI_GET_INFO` | `"JKKWrisvcAutoAplyGetSvcInfoCCWork"` | Work area name for this method's write info data map |
| `SCControlMapKeys.ERROR_INFO` | `"ERROR_INFO"` (standard) | Control map key for error information list |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `KKW12701SFLogic.getData` | EKK0081A010CBS | `KK_T_SVC_KEI` (Service Contract master), `KK_M_SVC_CD` (Service Code master), `KK_M_PRC_GRP_CD` (Pricing Group master) | Reads service contract inquiry data returned via CAANMsg template from the EKK0081A010CBS service component. The template contains: `SVC_KEI_NO`, `SVC_KEI_STAT`, `SVC_CD`, `PRC_GRP_CD`, `PCRS_CD`, `PPLAN_CD`, `MSKM_DTL_NO`. |
| U | `JKKWrisvcAutoAplyGetSvcInfoCC.editErrInfoEKK0081A010` | EKK0081A010 | - | Updates error information by converting the `returnCode` into a formatted return message and service component error message. Sets the error state into the response. |
| R | `TemplateErrorUtil.getErrorInfo` | - | - | Reads error info list from the `msgList` and the existing `errList` to consolidate all error details into the final error info structure. |
| U | `param.setControlMapData` | - | - | Updates the control map in the request parameter with the consolidated error information. |
| R | `param.getControlMapData` | - | - | Reads existing error list from the control map before consolidation. |

**CRUD Classification Rationale:**

- This method is primarily a **Read** and **Update** method. It reads data from the `msgList` (CBS template), extracts service contract fields from CAANMsg, and reads auxiliary data from work maps. It then **updates** the `outputMap` and `param` with the transformed data.
- No Create or Delete operations — this is a pure inquiry/return mapping method.
- The CBS call (`EKK0081A010CBS`) that populated the template occurs **before** this method is invoked (in `getSvcInfo()`), so the actual DB read happened upstream.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `JKKWrisvcAutoAplyGetSvcInfoCC.getSvcInfo()` | `getSvcInfo()` -> `scCall.run(...)` -> `EKK0081A010CBS` -> `editRetEKK0081A010` | `getErrorInfo [R]`, `editErrInfoEKK0081A010 [U]`, `TemplateErrorUtil.getErrorInfo [R]` |

**Caller Details:**

The only direct caller is `getSvcInfo(SessionHandle, IRequestParameterReadWrite, String)` in the same class. This method is the main public entry point:
- It calls `setSCInputCommonData()` to prepare the service component input parameters.
- It iterates over `cancel_inf_list` from the input map, calling `editInEKK0081A010()` for each cancellation to get a template, then invoking the SC via `scCall.run()`, and passing the result to `editRetEKK0081A010()` with `addChgeDiv = "05"` (cancellation).
- The method also has a separate registration/change path (not cancellation) where `editRetEKK0081A010()` would be called with `"01"` or `"02"`.

**Terminal Operations from this Method:**

| Terminal Operation | Direction | Description |
|--------------------|-----------|-------------|
| `editErrInfoEKK0081A010` | U | Formats return code and CBS error into error info structure |
| `getErrorInfo` (TemplateErrorUtil) | R | Consolidates error info from msgList and existing errList |
| `getControlMapData(ERROR_INFO)` | R | Retrieves existing error list for consolidation |
| `setControlMapData(ERROR_INFO)` | U | Writes consolidated error info back to param |

## 6. Per-Branch Detail Blocks

### Block 1 — [EXTRACT] (L397)

> Extracts the template array and return code from the msgList result map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `templates = (CAANMsg[])msgList.get(JCMConstants.TEMPLATE_LIST_KEY)` |
| 2 | SET | `template = templates[0]` |
| 3 | SET | `returnCode = msgList.get(JCMConstants.RET_CD_INT_KEY)` |

### Block 2 — [IF-ELSE] `inMap == null` (L403)

> Acquires the input data map from param keyed by fixedText. Creates it if not present.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inMap = (HashMap)param.getData(fixedText)` |
| 2 | IF | `inMap == null` → [L404] |
| 2.1 | SET | `inMap = new HashMap()` |
| 2.2 | EXEC | `param.setData(fixedText, inMap)` |

### Block 3 — [IF] `workMap != null` (L412)

> Acquires work area maps from the shared mapping work area. Initializes sub-containers if missing.

| # | Type | Code |
|---|------|------|
| 1 | SET | `workMap = param.getMappingWorkArea()` |
| 2 | IF | `workMap != null` → [L413] |
| 2.1 | SET | `workDataMapKeisha = (HashMap)workMap.get(CC_WORK_AREA_NAME_KEISHA)` [-> `"JKKAddKeishaServiceCCWork"`] |
| 2.2 | SET | `workDataMapMskm = (HashMap)workMap.get(CC_WORK_AREA_NAME_MSKM)` [-> `"JKKAddMskmServiceCCWork"`] |
| 2.3 | SET | `workDataMapWrib = (HashMap)workMap.get(CC_WORK_AREA_NAME_WRI_GET_INFO)` [-> `"JKKWrisvcAutoAplyGetSvcInfoCCWork"`] |
| 2.4 | IF | `null == workDataMapWrib` → [L418] |
| 2.4.1 | SET | `workDataMapWrib = new HashMap()` |
| 2.4.2 | EXEC | `workMap.put(CC_WORK_AREA_NAME_WRI_GET_INFO, workDataMapWrib)` |
| 2.5 | SET | `workSvcKeiList = (ArrayList)workDataMapWrib.get("svc_kei_list")` |
| 2.6 | IF | `null == workSvcKeiList` → [L425] |
| 2.6.1 | SET | `workSvcKeiList = new ArrayList()` |
| 2.6.2 | EXEC | `workDataMapWrib.put("svc_kei_list", workSvcKeiList)` |

### Block 4 — [IF] `sysid` fallback (L430)

> Resolves system ID. Falls back to Keisha work map if empty — handles the case of new registration where sysid is not yet in the input map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sysid = (String)inMap.get("sysid")` |
| 2 | IF | `null == sysid || "".equals(sysid)` → [L431] |
| 2.1 | IF | `null != workDataMapKeisha` → [L433] |
| 2.1.1 | SET | `sysid = (String)workDataMapKeisha.get("sysid")` |
| 3 | EXEC | `outputMap.put("sysid", sysid)` |
| 4 | EXEC | `workDataMapWrib.put("sysid", sysid)` |

### Block 5 — [SET] `add_chge_div` (L439)

> Copies the registration/change discriminator into output.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `outputMap.put("add_chge_div", addChgeDiv)` |

### Block 6 — [IF] `mskmNo` fallback (L442)

> Resolves application number. Falls back to Mskm work map if empty — same pattern as sysid resolution.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mskmNo = (String)inMap.get("mskm_no")` |
| 2 | IF | `null == mskmNo || "".equals(mskmNo)` → [L443] |
| 2.1 | IF | `null != workDataMapMskm` → [L445] |
| 2.1.1 | SET | `mskmNo = (String)workDataMapMskm.get("mskm_no")` |
| 3 | EXEC | `outputMap.put("mskm_no", mskmNo)` |

### Block 7 — [SET] Auxiliary fields (L450)

> Copies supplementary fields into the output map.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `outputMap.put("mskm_sbt_cd", inMap.get("mskm_sbt_cd"))` |
| 2 | EXEC | `outputMap.put("ido_div", inMap.get("ido_div"))` |
| 3 | EXEC | `outputMap.put("func_code", inMap.get("func_code"))` |

### Block 8 — [IF] Cancellation reason code [addChgeDiv == "05"] (L458)

> Branch condition: `addChgeDiv` equals `"05"` (キャンセル / Cancellation). When cancelling, the cancellation reason code must be set into the output.

| # | Type | Code |
|---|------|------|
| 1 | IF | `"05".equals(addChgeDiv)` → [L458] |
| 1.1 | EXEC | `outputMap.put("svc_cancel_rsn_cd", inMap.get("svc_cancel_rsn_cd"))` |

### Block 9 — [SET] Service contract list structure (L465)

> Initializes the output service contract list structure — a list of groups, each containing a list of service contract items.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcKeiGrpList = (ArrayList)outputMap.get("svc_kei_grp_list")` |
| 2 | IF | `null == svcKeiGrpList` → [L466] |
| 2.1 | SET | `svcKeiGrpList = new ArrayList()` |
| 2.2 | EXEC | `outputMap.put("svc_kei_grp_list", svcKeiGrpList)` |
| 3 | SET | `svcKeiGrpMap = new HashMap<String, Object>()` |
| 4 | EXEC | `svcKeiGrpList.add(svcKeiGrpMap)` |
| 5 | EXEC | `svcKeiGrpMap.put("grp_div", "00")` |
| 6 | SET | `svcKeiList = (ArrayList)svcKeiGrpMap.get("svc_kei_list")` |
| 7 | IF | `null == svcKeiList` → [L477] |
| 7.1 | SET | `svcKeiList = new ArrayList()` |
| 7.2 | EXEC | `svcKeiGrpMap.put("svc_kei_list", svcKeiList)` |

### Block 10 — [IF] Template iteration [templateArray valid] (L481)

> Processes child templates from the CBS response. Extracts each service contract detail field.

| # | Type | Code |
|---|------|------|
| 1 | SET | `templateArray = template.getCAANMsgList(EKK0081A010CBSMsg.EKK0081A010CBSMSG1LIST)` |
| 2 | IF | `templateArray != null && 1 <= templateArray.length` → [L482] |
| 2.1 | SET | `childTemplate = templateArray[0]` |
| 2.2 | SET | `svcKeiMap = new HashMap()` |
| 2.3 | SET | `workSvcKeiMap = new HashMap()` |

#### Block 10.1 — [SET] Target contract type code (L487)

> Marks this service contract as a primary service contract (サービス契約).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `svcKeiMap.put("tg_kei_skbt_cd", "01")` [→ `"01": サービス契約`] |

#### Block 10.2 — [IF-ELSE] svc_kei_no extraction (L490)

> Extracts service contract number (サービス契約番号) with null safety.

| # | Type | Code |
|---|------|------|
| 1 | IF | `childTemplate.isNull(EKK0081A010CBSMsg1List.SVC_KEI_NO)` → [L490] |
| 1.1 | SET | `svcKeiMap.put("svc_kei_no", "")` |
| 1.2 | SET | `workSvcKeiMap.put("svc_kei_no", "")` |
| 2 | IF-ELSE | [L494] |
| 2.1 | SET | `svcKeiMap.put("svc_kei_no", childTemplate.getString(EKK0081A010CBSMsg1List.SVC_KEI_NO))` |
| 2.2 | SET | `workSvcKeiMap.put("svc_kei_no", childTemplate.getString(EKK0081A010CBSMsg1List.SVC_KEI_NO))` |

#### Block 10.3 — [IF-ELSE] svc_kei_stat extraction (L499)

> Extracts service contract status (サービス契約ステータス).

| # | Type | Code |
|---|------|------|
| 1 | IF | `childTemplate.isNull(EKK0081A010CBSMsg1List.SVC_KEI_STAT)` → [L499] |
| 1.1 | SET | `svcKeiMap.put("svc_kei_stat", "")` |
| 2 | IF-ELSE | [L503] |
| 2.1 | SET | `svcKeiMap.put("svc_kei_stat", childTemplate.getString(EKK0081A010CBSMsg1List.SVC_KEI_STAT))` |

#### Block 10.4 — [IF-ELSE] svc_cd extraction (L508)

> Extracts service code (サービスコード) — the type of telecom service (e.g., FTTH, Mail).

| # | Type | Code |
|---|------|------|
| 1 | IF | `childTemplate.isNull(EKK0081A010CBSMsg1List.SVC_CD)` → [L508] |
| 1.1 | SET | `svcKeiMap.put("svc_cd", "")` |
| 1.2 | SET | `workSvcKeiMap.put("svc_cd", "")` |
| 2 | IF-ELSE | [L514] |
| 2.1 | SET | `svcKeiMap.put("svc_cd", childTemplate.getString(EKK0081A010CBSMsg1List.SVC_CD))` |
| 2.2 | SET | `workSvcKeiMap.put("svc_cd", childTemplate.getString(EKK0081A010CBSMsg1List.SVC_CD))` |

#### Block 10.5 — [IF-ELSE] prc_grp_cd extraction (L519)

> Extracts pricing group code (料金グループコード).

| # | Type | Code |
|---|------|------|
| 1 | IF | `childTemplate.isNull(EKK0081A010CBSMsg1List.PRC_GRP_CD)` → [L519] |
| 1.1 | SET | `svcKeiMap.put("prc_grp_cd", "")` |
| 1.2 | SET | `workSvcKeiMap.put("prc_grp_cd", "")` |
| 2 | IF-ELSE | [L525] |
| 2.1 | SET | `svcKeiMap.put("prc_grp_cd", childTemplate.getString(EKK0081A010CBSMsg1List.PRC_GRP_CD))` |
| 2.2 | SET | `workSvcKeiMap.put("prc_grp_cd", childTemplate.getString(EKK0081A010CBSMsg1List.PRC_GRP_CD))` |

#### Block 10.6 — [IF-ELSE] pcrs_cd extraction (L530)

> Extracts price course code (料金コースコード).

| # | Type | Code |
|---|------|------|
| 1 | IF | `childTemplate.isNull(EKK0081A010CBSMsg1List.PCRS_CD)` → [L530] |
| 1.1 | SET | `svcKeiMap.put("pcrs_cd", "")` |
| 1.2 | SET | `workSvcKeiMap.put("pcrs_cd", "")` |
| 2 | IF-ELSE | [L536] |
| 2.1 | SET | `svcKeiMap.put("pcrs_cd", childTemplate.getString(EKK0081A010CBSMsg1List.PCRS_CD))` |
| 2.2 | SET | `workSvcKeiMap.put("pcrs_cd", childTemplate.getString(EKK0081A010CBSMsg1List.PCRS_CD))` |

#### Block 10.7 — [IF-ELSE] pplan_cd extraction (L541)

> Extracts price plan code (料金プランコード).

| # | Type | Code |
|---|------|------|
| 1 | IF | `childTemplate.isNull(EKK0081A010CBSMsg1List.PPLAN_CD)` → [L541] |
| 1.1 | SET | `svcKeiMap.put("pplan_cd", "")` |
| 1.2 | SET | `workSvcKeiMap.put("pplan_cd", "")` |
| 2 | IF-ELSE | [L547] |
| 2.1 | SET | `svcKeiMap.put("pplan_cd", childTemplate.getString(EKK0081A010CBSMsg1List.PPLAN_CD))` |
| 2.2 | SET | `workSvcKeiMap.put("pplan_cd", childTemplate.getString(EKK0081A010CBSMsg1List.PPLAN_CD))` |

#### Block 10.8 — [IF-ELSE] mskm_dtl_no extraction (L552)

> Extracts application detail number (申請明細番号).

| # | Type | Code |
|---|------|------|
| 1 | IF | `childTemplate.isNull(EKK0081A010CBSMsg1List.MSKM_DTL_NO)` → [L552] |
| 1.1 | SET | `svcKeiMap.put("mskm_dtl_no", "")` |
| 1.2 | SET | `workSvcKeiMap.put("mskm_dtl_no", "")` |
| 2 | IF-ELSE | [L558] |
| 2.1 | SET | `svcKeiMap.put("mskm_dtl_no", childTemplate.getString(EKK0081A010CBSMsg1List.MSKM_DTL_NO))` |
| 2.2 | SET | `workSvcKeiMap.put("mskm_dtl_no", childTemplate.getString(EKK0081A010CBSMsg1List.MSKM_DTL_NO))` |

#### Block 10.9 — [IF] Plan change pre-change data [addChgeDiv == "02"] (L563)

> Branch condition: `addChgeDiv` equals `"02"` (プラン変更 / Plan Change). When changing a plan, the pre-change service details must be recorded for audit/reference.

| # | Type | Code |
|---|------|------|
| 1 | IF | `"02".equals(addChgeDiv)` → [L563] |
| 1.1 | EXEC | `svcKeiMap.put("chge_bf_svc_cd", inpSvcKeiMap.get("chge_bf_svc_cd"))` [→ "変更前サービスコード / Pre-change service code"] |
| 1.2 | EXEC | `svcKeiMap.put("chge_bf_prc_grp_cd", inpSvcKeiMap.get("chge_bf_prc_grp_cd"))` [→ "変更前料金グループコード"] |
| 1.3 | EXEC | `svcKeiMap.put("chge_bf_pcrs_cd", inpSvcKeiMap.get("chge_bf_pcrs_cd"))` [→ "変更前料金コースコード"] |
| 1.4 | EXEC | `svcKeiMap.put("chge_bf_pplan_cd", inpSvcKeiMap.get("chge_bf_pplan_cd"))` [→ "変更前料金プランコード"] |

#### Block 10.10 — [SET] Add to service list (L571)

> Appends the extracted service contract map to the output list.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `svcKeiList.add(svcKeiMap)` |
| 2 | IF | `"01".equals(addChgeDiv) \|\| "02".equals(addChgeDiv)` → [L573] [→ `"01": 新規登録 / New Registration`, `"02": プラン変更 / Plan Change`] |
| 2.1 | EXEC | `workSvcKeiList.add(workSvcKeiMap)` |

### Block 11 — [IF] Optional field kojihi_kap_operate_stat (L579)

> IT1-2018-0000086 ADD: Sets the construction cost request operate status if present. This was added to fix a bug where the subsidy amount was not released for municipal NP operators on the construction inspection screen.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kojihiKapOperateStat = (String)inMap.get("kojihi_kap_operate_stat")` |
| 2 | IF | `!(kojihiKapOperateStat == null)` → [L580] |
| 2.1 | EXEC | `outputMap.put("kojihi_kap_operate_stat", kojihiKapOperateStat)` |

### Block 12 — [CALL] Error information setup (L586)

> Delegates error info formatting to the dedicated error handler.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `editErrInfoEKK0081A010(param, template, (Integer)returnCode, fixedText)` // Sets error info in param |

### Block 13 — [IF] Error list initialization (L589)

> Initializes the error list from the control map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `errList = (ArrayList<Object>)param.getControlMapData(SCControlMapKeys.ERROR_INFO)` |
| 2 | IF | `errList == null` → [L591] |
| 2.1 | SET | `errList = new ArrayList<Object>()` |

### Block 14 — [SET] Error map consolidation (L596)

> Sets the final error info by merging msgList errors with existing errList.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `param.setControlMapData(SCControlMapKeys.ERROR_INFO, TemplateErrorUtil.getErrorInfo(msgList, errList))` |

### Block 15 — [RETURN] (L598)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return param` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service contract number — unique identifier for a service contract line item |
| `svc_kei_stat` | Field | Service contract status — indicates the current lifecycle state (e.g., active, suspended, cancelled) |
| `svc_cd` | Field | Service code — classifies the type of telecom service (e.g., FTTH broadband, email service) |
| `prc_grp_cd` | Field | Pricing group code — groups services into a pricing tier/category for billing |
| `pcrs_cd` | Field | Price course code — identifies a specific pricing tier within a pricing group |
| `pplan_cd` | Field | Price plan code — identifies a specific subscription plan (e.g., basic, premium) |
| `mskm_no` | Field | Application number — the unique ID for a service application/registration request (申請番号) |
| `mskm_sbt_cd` | Field | Application type code — classifies the type of application (e.g., new, change, cancellation) |
| `mskm_dtl_no` | Field | Application detail number — line item number within an application |
| `ido_div` | Field | Migration/change type discriminator — indicates whether this is a new registration, change, or cancellation |
| `func_code` | Field | Function code — identifies which screen/function invoked this processing |
| `tg_kei_skbt_cd` | Field | Target contract type code — distinguishes between service contracts (`"01"`) and other contract types |
| `grp_div` | Field | Group discriminator — structural field separating service contract groups (set to `"00"` for standard) |
| `add_chge_div` | Field | Registration/Change discriminator — `"01"` = new registration (新規登録), `"02"` = plan change (プラン変更), `"05"` = cancellation (キャンセル) |
| `svc_cancel_rsn_cd` | Field | Service cancellation reason code — the coded reason why a service was cancelled |
| `chge_bf_svc_cd` | Field | Pre-change service code — service code before a plan modification (変更前サービスコード) |
| `chge_bf_prc_grp_cd` | Field | Pre-change pricing group code — pricing group before a plan modification (変更前料金グループコード) |
| `chge_bf_pcrs_cd` | Field | Pre-change price course code — price course before a plan modification (変更前料金コースコード) |
| `chge_bf_pplan_cd` | Field | Pre-change price plan code — price plan before a plan modification (変更前料金プランコード) |
| `kojihi_kap_operate_stat` | Field | Construction cost request operate status — relates to subsidy/financial assistance for municipal NP operators (工事費割賦請求) |
| `sysid` | Field | System ID — tenant/organization identifier |
| `svc_kei_grp_list` | Field | Service contract group list — hierarchical container of service contract groups, each with its own service list |
| `svc_kei_list` | Field | Service contract list — list of service contract detail maps within a group |
| `workSvcKeiList` | Field | Work-area service contract list — shared list for registration and plan change operations, persisted across method calls |
| CAANMsg | Type | Fujitsu's message/data container class — holds key-value pairs of response fields from CBS calls |
| CBS | Acronym | Component-Based System — the service component layer that invokes business logic |
| SC | Acronym | Service Component — the service component code identifier (e.g., EKK0081A010CBS) |
| `EKK0081A010CBS` | SC Code | Service Contract Inquiry CBS — the service component that retrieves service contract detail data |
| FTTH | Business term | Fiber To The Home — fiber-optic broadband internet service offered by K-Opticom |
| `JKKAddKeishaServiceCCWork` | Constant | Work area map name for company (keisha / 会社) data — holds sysid and related entity data |
| `JKKAddMskmServiceCCWork` | Constant | Work area map name for application (mskm / 申請) data — holds mskm_no and related data |
| `JKKWrisvcAutoAplyGetSvcInfoCCWork` | Constant | Work area map name for this method's write info — holds svc_kei_list and sysid for the written service info flow |
| K-Opticom | Business term | Japanese telecommunications operator — the business domain for this system (K-Opticom customer base system) |
| EO (eo) | Business term | K-Opticom's brand name for its consumer telecommunications services (eo light, eo email, etc.) |
| Discount Service (割引サービス) | Business term | Promotional pricing services that reduce standard rates, often tied to bundle contracts or municipal subsidies |
| Automatic Application (自動適用) | Business concept | The system automatically applies discount services to contracts based on eligibility criteria |
| Service Contract Unique Inquiry (サービス契約一意照会) | Business operation | A single-lookup query that retrieves all detail fields for a specific service contract |
