# Business Logic — JFUAddKktSvcKeiCC.editOutEKK0341D010() [241 LOC]

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

## 1. Role

### JFUAddKktSvcKeiCC.editOutEKK0341D010()

This method performs the **outward mapping (downstream data mapping)** for equipment-provided service contract registration records returned from a Service Component (SC) call. Its business purpose is to transform raw template data (`CAANMsg`) received from the SC layer into the data structures expected by the presentation tier — specifically, it maps service contract fields (contract number, status, add date, last update date, invalid flag, etc.) into a work-area `HashMap` keyed by the `fixedText` prefix (e.g., `"EKK0341D010Net"` for FTTH network equipment, `"EKK0341D010Onu"` for ONU, `"EKK0341D010Vonu"` for VONU).

The method implements a **delegation + routing** design pattern. It reads the SC return template, copies all 12 service contract fields into `dataMap`, then (since 2012/04/24) additionally builds a structured service contract list entry for the discount service automatic application feature — populating target contract identification code (`"06"`), status `"010"` (Accepted/Received), and related price/service subtype codes. It delegates error information extraction to `editErrInfoEKK0341D010Msg()` and aggregates all error records via `TemplateErrorUtil.getErrorInfo()`.

In the larger system, this method acts as a **shared downstream mapper** called by `addKktSvcKei()` for each equipment-provided service contract record (Net, ONU, VONU variants). It ensures screen data consistency between the SC layer and the UI layer for the equipment-provided service registration flow (EKK0341).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["editOutEKK0341D010(msgList, param, fixedText)"])

    START --> GET_TEMPLATES["Get CAANMsg[] templates from msgList[JCMConstants.TEMPLATE_LIST_KEY]"]
    GET_TEMPLATES --> GET_RETURN_CODE["Get returnCode from msgList[JCMConstants.RET_CD_INT_KEY]"]
    GET_RETURN_CODE --> GET_WORKMAP["Get workMap = param.getMappingWorkArea()"]

    GET_WORKMAP --> WORKMAP_NULL{"workMap == null?"}
    WORKMAP_NULL -->|Yes| INIT_WORKMAP["workMap = new HashMap(); param.setMappingWorkArea(workMap)"]
    WORKMAP_NULL -->|No| GET_DATAMAP
    INIT_WORKMAP --> GET_DATAMAP["Get dataMap = param.getData(fixedText)"]

    GET_DATAMAP --> DATAMAP_NULL{"dataMap == null?"}
    DATAMAP_NULL -->|Yes| INIT_DATAMAP["dataMap = new HashMap(); param.setData(fixedText, dataMap)"]
    DATAMAP_NULL -->|No| INIT_STRUCTURES
    INIT_DATAMAP --> INIT_STRUCTURES["Initialize: wriSvcAutoAplyMap, svcKeiGrpListMap, svcKeiListMap, svcKeiList, sysId, mskmNo"]

    INIT_STRUCTURES --> OUT_MAP_1["dataMap.put(kktk_svc_kei_no, template value or empty)"]
    OUT_MAP_1 --> OUT_MAP_2["dataMap.put(gene_add_dtm, template value or empty)"]
    OUT_MAP_2 --> OUT_MAP_3["dataMap.put(kktk_svc_kei_stat, template value or empty)"]
    OUT_MAP_3 --> OUT_MAP_4["dataMap.put(ftrial_prd_endymd, template value or empty)"]
    OUT_MAP_4 --> OUT_MAP_5["dataMap.put(hosho_end_ymd, template value or empty)"]
    OUT_MAP_5 --> OUT_MAP_6["dataMap.put(rsv_aply_ymd, template value or empty)"]
    OUT_MAP_6 --> OUT_MAP_7["dataMap.put(rsv_aply_cd, template value or empty)"]
    OUT_MAP_7 --> OUT_MAP_8["dataMap.put(add_dtm, template value or empty)"]
    OUT_MAP_8 --> OUT_MAP_9["dataMap.put(add_opeacnt, template value or empty)"]
    OUT_MAP_9 --> OUT_MAP_10["dataMap.put(upd_dtm, template value or empty)"]
    OUT_MAP_10 --> OUT_MAP_11["dataMap.put(upd_opeacnt, template value or empty)"]
    OUT_MAP_11 --> OUT_MAP_12["dataMap.put(mk_flg, template value or empty)"]

    OUT_MAP_12 --> SVC_GROUP["svcKeiGrpListMap = (HashMap)svcKeiGrpList.get(0)"]
    SVC_GROUP --> SVC_GRP_MAP{"svcKeiGrpListMap.containsKey(SVC_KEI_LIST)?"}
    SVC_GRP_MAP -->|Yes| GET_SVC_LIST["svcKeiList = (ArrayList)svcKeiGrpListMap.get(SVC_KEI_LIST)"]
    SVC_GRP_MAP -->|No| SKIP_GET
    GET_SVC_LIST --> SKIP_GET

    SKIP_GET --> SYSID_CHECK{"wriSvcAutoAplyMap.containsKey(sysid)?"}
    SYSID_CHECK -->|Yes| GET_SYSID["sysId = wriSvcAutoAplyMap.get(sysid)"]
    SYSID_CHECK -->|No| SYSID_EMPTY_CHECK_1
    GET_SYSID --> SYSID_EMPTY_CHECK_1{"sysId empty?"}
    SYSID_EMPTY_CHECK_1 -->|Yes| SET_SYSID["wriSvcAutoAplyMap.put(sysid, addKeishaServiceCCWorkMap.get(sysid))"]
    SYSID_EMPTY_CHECK_1 -->|No| MSKM_CHECK
    SET_SYSID --> MSKM_CHECK{"wriSvcAutoAplyMap.containsKey(mskm_no)?"}

    MSKM_CHECK -->|Yes| GET_MSKM["mskmNo = wriSvcAutoAplyMap.get(mskm_no)"]
    MSKM_CHECK -->|No| MSKM_EMPTY_CHECK_2
    GET_MSKM --> MSKM_EMPTY_CHECK_2{"mskmNo empty?"}
    MSKM_EMPTY_CHECK_2 -->|Yes| SET_MSKM["wriSvcAutoAplyMap.put(mskm_no, addMskmSCWork.get(mskm_no))"]
    MSKM_EMPTY_CHECK_2 -->|No| BUILD_SVC_LIST_MAP
    SET_MSKM --> BUILD_SVC_LIST_MAP

    BUILD_SVC_LIST_MAP["Build svcKeiListMap: tg_kei_skbt_cd=06, kktk_svc_kei_stat=010, pcrs_cd, pplan_cd, kktk_svc_cd, kktk_sbt_cd"]
    BUILD_SVC_LIST_MAP --> ADD_TO_LIST["svcKeiList.add(svcKeiListMap)"]
    ADD_TO_LIST --> ADD_TO_GROUP{"svcKeiGrpListMap.containsKey(SVC_KEI_LIST)?"}
    ADD_TO_GROUP -->|No| PUT_TO_GROUP["svcKeiGrpListMap.put(SVC_KEI_LIST, svcKeiList)"]
    ADD_TO_GROUP -->|Yes| SKIP_PUT
    PUT_TO_GROUP --> SKIP_PUT

    SKIP_PUT --> EDIT_ERR["editErrInfoEKK0341D010Msg(param, template, returnCode, fixedText)"]
    EDIT_ERR --> GET_ERR_LIST["errList = param.getControlMapData(SCControlMapKeys.ERROR_INFO)"]
    GET_ERR_LIST --> ERR_LIST_NULL{"errList == null?"}
    ERR_LIST_NULL -->|Yes| INIT_ERR_LIST["errList = new ArrayList<Object>()"]
    ERR_LIST_NULL -->|No| SET_ERR_INFO
    INIT_ERR_LIST --> SET_ERR_INFO["param.setControlMapData(ERROR_INFO, TemplateErrorUtil.getErrorInfo(msgList, errList))"]

    SET_ERR_INFO --> RETURN["Return param"]
    RETURN --> END(["END"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `msgList` | `Map<?, ?>` | The message list returned from the SC (Service Component) layer. Contains the SC response template (`CAANMsg[]` at `JCMConstants.TEMPLATE_LIST_KEY`) and the return code (`Integer` at `JCMConstants.RET_CD_INT_KEY`). Used as the source of all service contract data and error status. |
| 2 | `param` | `IRequestParameterReadWrite` | The request/response parameter object that carries mapping work areas, data maps, and control map data (error info). It is mutated in-place: work map and data map are initialized if null, service contract fields are written, and error info is aggregated before the same object is returned. |
| 3 | `fixedText` | `String` | The fixed text key that identifies the service message context (e.g., `"EKK0341D010Net"`, `"EKK0341D010Onu"`, `"EKK0341D010Vonu"`). Used as the key to read/write `dataMap` and to identify error records. Determines which equipment-provided service contract record is being mapped. |

### Instance Fields Read

| Field Name | Type | Business Description |
|------------|------|---------------------|
| `CC_WORK_AREA_NAME_KEISHA` | `String` = `"JFUAddKeishaServiceCCWork"` | Work area key for customer/contractor service information, used to fallback `sysId` when not present in discount auto-apply map. |
| `CC_WORK_AREA_NAME_MSKM` | `String` = `"JFUAddMskmSCWork"` | Work area key for application number (mskm) service component data, used to fallback `mskmNo` when not present in discount auto-apply map. |
| `CC_WRI_SVC_AUTO_APLY_MAP` | `String` = `"JKKWrisvcAutoAplyCCMap"` | Map key for discount service automatic application CC work area, holding `sysid` and `mskm_no` for auto-application logic. |
| `SVC_KEI_GRP_LIST` | `String` = `"svc_kei_grp_list"` | Key for service contract group list within the discount auto-apply map. Groups service contracts by category. |
| `SVC_KEI_LIST` | `String` = `"svc_kei_list"` | Key for service contract list within a group map. Contains individual service contract records to be passed downstream. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JACBatCommon.isNull` | JACBatCommon | - | Calls `isNull` in `JACBatCommon` for null-check utility |
| - | `JACbatRknBusinessUtil.isNull` | JACbatRknBusiness | - | Calls `isNull` in `JACbatRknBusinessUtil` for null-check utility |
| - | `JCHbatSeikyKaknoBusinessUtil.isNull` | JCHbatSeikyKaknoBusiness | - | Calls `isNull` in `JCHbatSeikyKaknoBusinessUtil` for null-check utility |
| R | `JBSbatACECBuyIfTrkm.getErrorInfo` | JBSbatACECBuyIfTrkm | - | Calls `getErrorInfo` in `JBSbatACECBuyIfTrkm` |
| - | `JBSbatACInsentetivePrcInfoSaksei.isNull` | JBSbatACInsentetivePrcInfoSaksei | - | Calls `isNull` in `JBSbatACInsentetivePrcInfoSaksei` |
| R | `JBSbatACKojiChrgInfoTrkm.getErrorInfo` | JBSbatACKojiChrgInfoTrkm | - | Calls `getErrorInfo` in `JBSbatACKojiChrgInfoTrkm` |
| - | `JBSbatAKCHSeikyYsoInfMake.isNull` | JBSbatAKCHSeikyYsoInfMake | - | Calls `isNull` in `JBSbatAKCHSeikyYsoInfMake` |
| - | `JBSbatAKKshkmRsltInfoTukiawsday.setData` | JBSbatAKKshkmRsltInfoTukiawsday | - | Calls `setData` in `JBSbatAKKshkmRsltInfoTukiawsday` |
| - | `JBSbatAKKshkmRsltInfoTukiaws.setData` | JBSbatAKKshkmRsltInfoTukiaws | - | Calls `setData` in `JBSbatAKKshkmRsltInfoTukiaws` |
| - | `JBSbatAKKshkmRsltInfoTukiawsRealSkh.setData` | JBSbatAKKshkmRsltInfoTukiawsRealSkh | - | Calls `setData` in `JBSbatAKKshkmRsltInfoTukiawsRealSkh` |
| - | `JBSbatAKKshkmRsltInfTkCvsNCnsl.setData` | JBSbatAKKshkmRsltInfTkCvsNCnsl | - | Calls `setData` in `JBSbatAKKshkmRsltInfTkCvsNCnsl` |
| R | `JBSbatDKNyukaFinAdd.getData` | JBSbatDKNyukaFinAdd | - | Calls `getData` in `JBSbatDKNyukaFinAdd` |
| R | `JBSbatFUCaseFileRnkData.getString` | JBSbatFUCaseFileRnkData | - | Calls `getString` in `JBSbatFUCaseFileRnkData` |
| R | `JBSbatFUMoveNaviData.getString` | JBSbatFUMoveNaviData | - | Calls `getString` in `JBSbatFUMoveNaviData` |
| - | `JBSbatKKGetCTITelno.setData` | JBSbatKKGetCTITelno | - | Calls `setData` in `JBSbatKKGetCTITelno` |
| R | `JBSbatZMAdDataSet.getString` | JBSbatZMAdDataSet | - | Calls `getString` in `JBSbatZMAdDataSet` |
| U | `JFUAddKktSvcKeiCC.editErrInfoEKK0341D010Msg` | JFUAddKktSvcKeiCC | - | Calls `editErrInfoEKK0341D010Msg` to map error fields from SC template into the data map |
| R | `JFUeoTelOpTransferCC.getData` | JFUeoTelOpTransferCC | - | Calls `getData` in `JFUeoTelOpTransferCC` |
| R | `JFUTransferCC.getData` | JFUTransferCC | - | Calls `getData` in `JFUTransferCC` |
| R | `JFUTransferListToListCC.getData` | JFUTransferListToListCC | - | Calls `getData` in `JFUTransferListToListCC` |
| R | `JESC0101B010TPMA.getString` | JESC0101B010TPMA | - | Calls `getString` in `JESC0101B010TPMA` |
| R | `JESC0101B020TPMA.getString` | JESC0101B020TPMA | - | Calls `getString` in `JESC0101B020TPMA` |
| R | `KKW12701SFLogic.getData` | KKW12701SFLogic | - | Calls `getData` in `KKW12701SFLogic` |
| R | `ApiBpInterface.getErrorInfo` | ApiBpInterface | - | Calls `getErrorInfo` in `ApiBpInterface` |
| R | `TemplateErrorUtil.getErrorInfo` | TemplateErrorUtil | - | Aggregates error information from msgList and errList into a consolidated error info structure |
| R | `CAANMsg.isNull` | CAANMsg (EKK0341D010CBSMsg fields) | - | Checks whether each SC return field is null (KKTK_SVC_KEI_NO, GENE_ADD_DTM, etc.) |
| R | `CAANMsg.getString` | CAANMsg (EKK0341D010CBSMsg fields) | - | Retrieves the string value of each SC return field |
| R | `CAANMsg.getInt` | CAANMsg (EKK0341D010CBSMsg.STATUS) | - | Gets status code from SC template |

### Method-Specific Analysis

This method performs no direct database CRUD. It is a **pure data mapper** operating on the SC return template and parameter objects. The key CRUD-like operations are:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `CAANMsg.getString` / `CAANMsg.isNull` | EKK0341D010CBS | - | Reads 12 service contract fields (contract number, add date/time, status, trial period end, guarantee end, reservation apply date/code, registration date/time/operator, update date/time/operator, invalid flag) from SC template |
| U | `JFUAddKktSvcKeiCC.editErrInfoEKK0341D010Msg` | EKK0341D010CBS | - | Updates error info map with error fields from SC template (service code, price code, plan code, etc.) — maps up to ~20 error fields |
| U | `param.setControlMapData(ERROR_INFO)` | - | ControlMap | Updates the error info control map with consolidated error data from TemplateErrorUtil.getErrorInfo() |
| U | `param.setData(fixedText, dataMap)` | - | WorkArea | Sets the downstream data map containing mapped service contract fields into param |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CC:JFUAddKktSvcKeiCC.addKktSvcKei() | `addKktSvcKei()` -> `editOutEKK0341D010()` | `CAANMsg.getString [R]`, `CAANMsg.isNull [-]`, `editErrInfoEKK0341D010Msg [U]`, `TemplateErrorUtil.getErrorInfo [R]` |

### Call Chain Details

**Caller: `JFUAddKktSvcKeiCC.addKktSvcKei()`** (same class, line ~283/310/322)

The `addKktSvcKei()` method invokes `editOutEKK0341D010()` for three equipment variants:
- **Net (FTTH)** — `editOutEKK0341D010(result, param, "EKK0341D010Net")` — maps network equipment service contract data
- **ONU** — `editOutEKK0341D010(result, param, "EKK0341D010Onu")` — maps ONU (Optical Network Unit) service contract data
- **VONU** — `editOutEKK0341D010(result, param, "EKK0341D010Vonu")` — maps VONU (Vertical ONU) service contract data

Each invocation follows the pattern: call SC (Service Component) -> receive `msgList` -> call `editOutEKK0341D010()` -> map data to param.

### Terminal Operations Summary

| Terminal | Type | Entity/Description |
|----------|------|-------------------|
| `CAANMsg.getString` | Read | Reads 12 SC template fields (contract number, dates, status, flags) |
| `CAANMsg.isNull` | Check | Null-checks 12 SC template fields |
| `editErrInfoEKK0341D010Msg` | Update | Maps ~20 error fields from SC template into dataMap |
| `CAANMsg.getInt` | Read | Reads status code from SC template |
| `TemplateErrorUtil.getErrorInfo` | Read | Aggregates error info from msgList and errList |
| `param.setControlMapData` | Update | Stores consolidated error info in control map |
| `param.setData` | Update | Stores mapped data map into param |
| `param.getMappingWorkArea` | Read | Retrieves work area map for customer/application info |
| `param.getData` | Read | Retrieves data map for the given fixedText key |

## 6. Per-Branch Detail Blocks

**Block 1** — IF `workMap == null` (L1553)

> Initialize the work area if not yet present.

| # | Type | Code |
|---|------|------|
| 1 | SET | `workMap = new HashMap()` // [-> CC_WORK_AREA_NAME = "JFUAddSvcKeiTelCCWork" context] |
| 2 | EXEC | `param.setMappingWorkArea(workMap)` |

**Block 2** — IF `dataMap == null` (L1560)

> Initialize the data map for the given fixedText key if not yet present.

| # | Type | Code |
|---|------|------|
| 1 | SET | `dataMap = new HashMap()` |
| 2 | EXEC | `param.setData(fixedText, dataMap)` | [-> fixedText: "EKK0341D010Net"/"EKK0341D010Onu"/"EKK0341D010Vonu"] |

**Block 3** — Structured Initialization (L1569–1594)

> Initialize all supporting structures for discount service auto-application and field extraction.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sysId = ""` |
| 2 | SET | `mskmNo = ""` |
| 3 | SET | `addKeishaServiceCCWorkMap = (HashMap)workMap.get(CC_WORK_AREA_NAME_KEISHA)` | [-> "JFUAddKeishaServiceCCWork"] |
| 4 | SET | `addMskmSCWork = (HashMap)workMap.get(CC_WORK_AREA_NAME_MSKM)` | [-> "JFUAddMskmSCWork"] |
| 5 | SET | `wriSvcAutoAplyMap = (HashMap)param.getData(CC_WRI_SVC_AUTO_APLY_MAP)` | [-> "JKKWrisvcAutoAplyCCMap"] |
| 6 | SET | `svcKeiGrpListMap = new HashMap()` |
| 7 | SET | `svcKeiGrpList = (ArrayList)wriSvcAutoAplyMap.get(SVC_KEI_GRP_LIST)` | [-> "svc_kei_grp_list"] |
| 8 | SET | `svcKeiListMap = new HashMap()` |
| 9 | SET | `svcKeiList = new ArrayList()` |

**Block 4** — Downstream Mapping: kktk_svc_kei_no (L1597–1608)

> Map equipment-provided service contract number. Null values become empty strings.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.isNull(EKK0341D010CBSMsg.KKTK_SVC_KEI_NO)` [Field: Equipment-provided service contract number] |
| 2 | SET | `dataMap.put("kktk_svc_kei_no", "")` | [null branch] |
| 2 | SET | `svcKeiListMap.put("kktk_svc_kei_no", "")` | [null branch, discount auto-apply] |
| 3 | SET | `dataMap.put("kktk_svc_kei_no", template.getString(EKK0341D010CBSMsg.KKTK_SVC_KEI_NO))` | [non-null branch] |
| 4 | SET | `svcKeiListMap.put("kktk_svc_kei_no", template.getString(EKK0341D010CBSMsg.KKTK_SVC_KEI_NO))` | [non-null branch, discount auto-apply] |

**Block 5** — Downstream Mapping: gene_add_dtm (L1610–1617)

> Map generation/add date/time stamp.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.isNull(EKK0341D010CBSMsg.GENE_ADD_DTM)` [Field: Generation add date/time] |
| 2 | SET | `dataMap.put("gene_add_dtm", "")` | [null branch] |
| 3 | SET | `dataMap.put("gene_add_dtm", template.getString(EKK0341D010CBSMsg.GENE_ADD_DTM))` | [non-null branch] |

**Block 6** — Downstream Mapping: kktk_svc_kei_stat (L1619–1626)

> Map equipment-provided service contract status.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.isNull(EKK0341D010CBSMsg.KKTK_SVC_KEI_STAT)` [Field: Equipment-provided service contract status] |
| 2 | SET | `dataMap.put("kktk_svc_kei_stat", "")` | [null branch] |
| 3 | SET | `dataMap.put("kktk_svc_kei_stat", template.getString(EKK0341D010CBSMsg.KKTK_SVC_KEI_STAT))` | [non-null branch] |

**Block 7** — Downstream Mapping: ftrial_prd_endymd (L1628–1635)

> Map trial period end date.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.isNull(EKK0341D010CBSMsg.FTRIAL_PRD_ENDYMD)` [Field: Trial period end date] |
| 2 | SET | `dataMap.put("ftrial_prd_endymd", "")` | [null branch] |
| 3 | SET | `dataMap.put("ftrial_prd_endymd", template.getString(EKK0341D010CBSMsg.FTRIAL_PRD_ENDYMD))` | [non-null branch] |

**Block 8** — Downstream Mapping: hosho_end_ymd (L1637–1644)

> Map guarantee end date.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.isNull(EKK0341D010CBSMsg.HOSHO_END_YMD)` [Field: Guarantee end date] |
| 2 | SET | `dataMap.put("hosho_end_ymd", "")` | [null branch] |
| 3 | SET | `dataMap.put("hosho_end_ymd", template.getString(EKK0341D010CBSMsg.HOSHO_END_YMD))` | [non-null branch] |

**Block 9** — Downstream Mapping: rsv_aply_ymd (L1646–1653)

> Map reservation apply date.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.isNull(EKK0341D010CBSMsg.RSV_APLY_YMD)` [Field: Reservation apply date] |
| 2 | SET | `dataMap.put("rsv_aply_ymd", "")` | [null branch] |
| 3 | SET | `dataMap.put("rsv_aply_ymd", template.getString(EKK0341D010CBSMsg.RSV_APLY_YMD))` | [non-null branch] |

**Block 10** — Downstream Mapping: rsv_aply_cd (L1655–1662)

> Map reservation apply code.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.isNull(EKK0341D010CBSMsg.RSV_APLY_CD)` [Field: Reservation apply code] |
| 2 | SET | `dataMap.put("rsv_aply_cd", "")` | [null branch] |
| 3 | SET | `dataMap.put("rsv_aply_cd", template.getString(EKK0341D010CBSMsg.RSV_APLY_CD))` | [non-null branch] |

**Block 11** — Downstream Mapping: add_dtm (L1664–1671)

> Map registration date/time stamp.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.isNull(EKK0341D010CBSMsg.ADD_DTM)` [Field: Registration date/time] |
| 2 | SET | `dataMap.put("add_dtm", "")` | [null branch] |
| 3 | SET | `dataMap.put("add_dtm", template.getString(EKK0341D010CBSMsg.ADD_DTM))` | [non-null branch] |

**Block 12** — Downstream Mapping: add_opeacnt (L1673–1680)

> Map registration operator account.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.isNull(EKK0341D010CBSMsg.ADD_OPEACNT)` [Field: Registration operator account] |
| 2 | SET | `dataMap.put("add_opeacnt", "")` | [null branch] |
| 3 | SET | `dataMap.put("add_opeacnt", template.getString(EKK0341D010CBSMsg.ADD_OPEACNT))` | [non-null branch] |

**Block 13** — Downstream Mapping: upd_dtm (L1682–1689)

> Map update date/time stamp.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.isNull(EKK0341D010CBSMsg.UPD_DTM)` [Field: Update date/time] |
| 2 | SET | `dataMap.put("upd_dtm", "")` | [null branch] |
| 3 | SET | `dataMap.put("upd_dtm", template.getString(EKK0341D010CBSMsg.UPD_DTM))` | [non-null branch] |

**Block 14** — Downstream Mapping: upd_opeacnt (L1691–1698)

> Map update operator account.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.isNull(EKK0341D010CBSMsg.UPD_OPEACNT)` [Field: Update operator account] |
| 2 | SET | `dataMap.put("upd_opeacnt", "")` | [null branch] |
| 3 | SET | `dataMap.put("upd_opeacnt", template.getString(EKK0341D010CBSMsg.UPD_OPEACNT))` | [non-null branch] |

**Block 15** — Downstream Mapping: mk_flg (L1700–1707)

> Map invalid flag (unusable/unregistered flag).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.isNull(EKK0341D010CBSMsg.MK_FLG)` [Field: Invalid flag] |
| 2 | SET | `dataMap.put("mk_flg", "")` | [null branch] |
| 3 | SET | `dataMap.put("mk_flg", template.getString(EKK0341D010CBSMsg.MK_FLG))` | [non-null branch] |

**Block 16** — Discount Service Auto-Application: Group List Processing (L1710–1717)

> Extract service contract group list map from the discount auto-apply map. Since 2012/04/24, supports automatic discount service application by building structured service contract lists.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcKeiGrpListMap = (HashMap)svcKeiGrpList.get(0)` [-> first element of svc_kei_grp_list] |
| 2 | IF | `svcKeiGrpListMap.containsKey(SVC_KEI_LIST)` |
| 3 | SET | `svcKeiList = (ArrayList)svcKeiGrpListMap.get(SVC_KEI_LIST)` | [-> "svc_kei_list"] |

**Block 17** — sysId Fallback (L1720–1727)

> Set system ID for discount service auto-application. Falls back to customer service work area if not set.

| # | Type | Code |
|---|------|------|
| 1 | IF | `wriSvcAutoAplyMap.containsKey("sysid")` |
| 2 | SET | `sysId = (String)wriSvcAutoAplyMap.get("sysid")` |
| 3 | IF | `"\"".equals(sysId)` |
| 4 | SET | `wriSvcAutoAplyMap.put("sysid", (String)addKeishaServiceCCWorkMap.get("sysid"))` | [fallback from JFUAddKeishaServiceCCWork] |

**Block 18** — mskmNo Fallback (L1729–1736)

> Set application number (mskm_no) for discount service auto-application. Falls back to application SC work area if not set.

| # | Type | Code |
|---|------|------|
| 1 | IF | `wriSvcAutoAplyMap.containsKey("mskm_no")` |
| 2 | SET | `mskmNo = (String)wriSvcAutoAplyMap.get("mskm_no")` |
| 3 | IF | `"\"".equals(mskmNo)` |
| 4 | SET | `wriSvcAutoAplyMap.put("mskm_no", (String)addMskmSCWork.get("mskm_no"))` | [fallback from JFUAddMskmSCWork] |

**Block 19** — Build svcKeiListMap (L1738–1752)

> Build a structured service contract list entry for discount service auto-application. The target contract identification code is always `"06"` and status is always `"010"` (Accepted).

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcKeiListMap.put("tg_kei_skbt_cd", "06")` | [Target contract identification code: 06] |
| 2 | SET | `svcKeiListMap.put("kktk_svc_kei_stat", "010")` | [Equipment-provided service contract status: 010 = Accepted] |
| 3 | SET | `svcKeiListMap.put("pcrs_cd", dataMap.get("pcrs_cd"))` | [Price code from dataMap] |
| 4 | SET | `svcKeiListMap.put("pplan_cd", dataMap.get("pplan_cd"))` | [Price plan code from dataMap] |
| 5 | SET | `svcKeiListMap.put("kktk_svc_cd", dataMap.get("kktk_svc_cd"))` | [Equipment-provided service code from dataMap] |
| 6 | SET | `svcKeiListMap.put("kktk_sbt_cd", dataMap.get("kktk_sbt_cd"))` | [Equipment-provided subtype code from dataMap] |

**Block 20** — Add svcKeiListMap to svcKeiList (L1755)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `svcKeiList.add(svcKeiListMap)` |

**Block 21** — Conditional Group Add (L1759–1763)

> If the service contract group list map does not yet contain a service contract list, add the newly built list.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!svcKeiGrpListMap.containsKey(SVC_KEI_LIST)` [-> "svc_kei_list"] |
| 2 | SET | `svcKeiGrpListMap.put(SVC_KEI_LIST, svcKeiList)` |

**Block 22** — Error Information Mapping (L1766)

> Delegate error info extraction to the private helper method. Maps error fields from the SC template into the data map.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `editErrInfoEKK0341D010Msg(param, template, (Integer)returnCode, fixedText)` | [-> private method, maps ~20 error fields from EKK0341D010CBSMsg] |

**Block 23** — Error Info List Initialization (L1769–1773)

> Get or initialize the error info list from the control map.

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

**Block 24** — Consolidate Error Info (L1776)

> Store consolidated error information into the control map using TemplateErrorUtil.

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

**Block 25** — Return (L1778)

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

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `kktk_svc_kei_no` | Field | Equipment-provided service contract number — the unique identifier for a service contract record in the equipment-provided services domain |
| `gene_add_dtm` | Field | Generation/add date/time stamp — when the service contract record was initially created |
| `kktk_svc_kei_stat` | Field | Equipment-provided service contract status — current state of the contract (e.g., "010" = Accepted/Received) |
| `ftrial_prd_endymd` | Field | Trial period end date — the date when any free trial period for the service expires |
| `hosho_end_ymd` | Field | Guarantee end date — the date when the service guarantee/warranty period expires |
| `rsv_aply_ymd` | Field | Reservation apply date — the date when a reservation application was submitted |
| `rsv_aply_cd` | Field | Reservation apply code — classification code for the type of reservation applied |
| `add_dtm` | Field | Registration date/time — timestamp of the registration operation |
| `add_opeacnt` | Field | Registration operator account — ID of the operator who performed the registration |
| `upd_dtm` | Field | Update date/time — timestamp of the last update operation |
| `upd_opeacnt` | Field | Update operator account — ID of the operator who performed the last update |
| `mk_flg` | Field | Invalid flag — flag indicating whether the record is marked as invalid/unusable (unregister flag) |
| `tg_kei_skbt_cd` | Field | Target contract identification code — classification code for the target contract type (`"06"` = service contract with internal line details) |
| `pcrs_cd` | Field | Price code — the pricing classification code for the service |
| `pplan_cd` | Field | Price plan code — the specific pricing plan applied to the service |
| `kktk_svc_cd` | Field | Equipment-provided service code — code identifying the specific equipment-provided service type |
| `kktk_sbt_cd` | Field | Equipment-provided subtype code — code identifying the subtype of equipment-provided service |
| `sysid` | Field | System ID — identifier for the system involved in discount service auto-application |
| `mskm_no` | Field | Application number — the application (mskm) number associated with the service contract |
| `svc_kei_grp_list` | Field | Service contract group list — grouped list of service contracts used in discount auto-application |
| `svc_kei_list` | Field | Service contract list — the individual service contract records within a group |
| `EKK0341D010Net` | Constant | Fixed text key for FTTH network equipment service contract mapping |
| `EKK0341D010Onu` | Constant | Fixed text key for ONU (Optical Network Unit) equipment service contract mapping |
| `EKK0341D010Vonu` | Constant | Fixed text key for VONU (Vertical ONU) equipment service contract mapping |
| `JCMConstants.TEMPLATE_LIST_KEY` | Constant | Key to retrieve CAANMsg[] templates from the SC return message list |
| `JCMConstants.RET_CD_INT_KEY` | Constant | Key to retrieve return code (Integer) from the SC return message list |
| `JFUAddKeishaServiceCCWork` | Constant | Work area map key for customer/contractor service information |
| `JFUAddMskmSCWork` | Constant | Work area map key for application number service component data |
| `JKKWrisvcAutoAplyCCMap` | Constant | Map key for discount service automatic application CC work area |
| SC | Acronym | Service Component — the data access/business logic layer that interacts with the database |
| CAANMsg | Class | Fujitsu's message wrapper class for SC request/response data, providing `isNull()`, `getString()`, `getInt()` methods |
| CC | Acronym | Common Component — a shared component class extending AbstractCommonComponent, handling cross-cutting concerns like data mapping |
| IRequestParameterReadWrite | Interface | Request/response parameter interface for passing data between screen, CC, and SC layers |
| FTTH | Business term | Fiber To The Home — fiber-optic internet broadband service |
| ONU | Business term | Optical Network Unit — end-user terminal device for FTTH fiber service |
| VONU | Business term | Vertical ONU — vertically integrated ONU device combining multiple functions |
| templateStatus | Field | SC template status code extracted from EKK0341D010CBSMsg.STATUS |
| bpStatus | Field | Business platform return code extracted from control map |
| TMCK_ERR_STATUS | Constant | Error status threshold value = 1000 for template error checking |
| OYA_KEI_SKBT_CD_02 | Constant | Parent contract identification code: `"02"` = Service contract with internal line details |
| CD00134_C42 | Constant | Legacy wireless code: `"C42"` = Network (unused in this method) |
