# Business Logic — JKKWrisvcAutoAplyCCMapper.callEKK0841B004_1() [329 LOC]

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

## 1. Role

### JKKWrisvcAutoAplyCCMapper.callEKK0841B004_1()

This method serves as the primary adapter between the discount service auto-application component (`JKKWrisvcAutoAplyCC`) and the back-end CBS (Common Business Service) EKK0841B004, which queries the "Discount Service Conditions List Inquiry (for Discount Use)" service interface. Its core business purpose is to retrieve all discount service records whose conditions are satisfied by a given subscription record type at a specified reference date (基準年月日). Specifically, it queries for discount services that are eligible for automatic application (自動適用) against the subscription type (申込種別) passed in via `ccMap`.

The method implements the **rout/dispatch design pattern**: it gathers filtering parameters from the work area map (`ccMap`), constructs a CBS request message through the `KKSV0313_KKSV0313OP_EKK0841B004BSMapper`, invokes the CBS service via `ServiceComponentRequestInvoker.run()`, then transforms the flat CBS response list into a hierarchical nested structure — each discount service record is paired with its associated application conditions and target services. This mapping separates CC-level business objects from the flat SC-level message format.

The returned `setList` contains fully assembled discount service records (each with nested condition and target-service sub-lists), which are consumed by the callers (`setCrsChgAndBatchAutoWrib` and `setWribSvc`) to evaluate and apply automatic discounts during contract change processing, batch processing, and new subscription workflows.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["callEKK0841B004_1"])
    START --> MAP_NAME["Build mapName from ccMapNm + KKSV031382SC"]
    MAP_NAME --> IN_MAP["Create inMap, cmnParam.setData(mapName, inMap)"]
    IN_MAP --> PUT_PARAMS["Put funcCd, ymd, auto-aply optnty_cd='2', mskm_sbt_cd, typeCd into inMap"]
    PUT_PARAMS --> CP_GRDUP["Get cpGrdup array from ccMap, build comma-separated string"]
    CP_GRDUP --> REMOVE_COMMA["substring(1) to remove leading comma, put into KEY_WRIB_SVC_CD"]
    REMOVE_COMMA --> PUT_CPGRP["Put KEY_WRSV_APLY_JKN_SBT_CD = CD01360_GREAD_UP_CP='08' into inMap"]
    PUT_CPGRP --> MAPPER_NEW["Create KKSV0313_KKSV0841B004BSMapper(mapName)"]
    MAPPER_NEW --> EDIT_IN["mapper.editInMsg(cmnParam) -> paramMap"]
    EDIT_IN --> SC_CALL["ServiceComponentRequestInvoker.run(paramMap, cmnHandle) -> result"]
    SC_CALL --> EDIT_RP["cmnParam = mapper.editResultRP(result, cmnParam)"]
    EDIT_RP --> CHECK_RESULT["checkExecutionResult(result)"]
    CHECK_RESULT --> OUT_MAP["Get outMap from cmnParam.getData(mapName)"]
    OUT_MAP --> GET_LIST["Get EKK0841B004CBSMSG1LIST from outMap -> list"]
    GET_LIST --> INIT_WORK["Init wribSvcList, ccMapWribSvc, wrisvcAplyJknList, WrisvcTgSvcList"]
    INIT_WORK --> FOR_START["For each outMapWribSvc in list"]
    FOR_START --> CHECK_KBN_1{DATA_KBN='1'}
    CHECK_KBN_1 -->|Yes| BUILD_SVC["Populate ccMapWribSvc with discount service fields"]
    CHECK_KBN_1 -->|No| CHECK_KBN_2{DATA_KBN='2'}
    BUILD_SVC --> CHECK_KBN_2
    CHECK_KBN_2 -->|Yes| BUILD_JOKEN["Populate wrisvcAplyJkn with application condition fields, add to wrisvcAplyJknList"]
    CHECK_KBN_2 -->|No| CHECK_KBN_3{DATA_KBN='3'}
    BUILD_JOKEN --> CHECK_KBN_3
    CHECK_KBN_3 -->|Yes| BUILD_TGSVC["Populate WrisvcTgSvc with target service fields, add to WrisvcTgSvcList"]
    CHECK_KBN_3 -->|No| FINAL_CHECK
    BUILD_TGSVC --> FINAL_CHECK{Is last record OR new WRIB_SVC_CD?}
    FINAL_CHECK -->|Yes| CLOSE_SVC["Put wrisvcAplyJknList and WrisvcTgSvcList into ccMapWribSvc, add to setList, reset lists"]
    FINAL_CHECK -->|No| FOR_NEXT
    CLOSE_SVC --> FOR_NEXT
    FOR_NEXT --> FOR_START
    FOR_START --> RETURN["Return setList"]
    RETURN --> END(["end"])
```

**Processing flow description:**

1. **Request parameter construction (CC -> SC mapping):** The method builds a map name from the instance field `ccMapNm` and the constant `KKSV031382SC`. It creates an input map and populates it with the function code, reference date (基準年月日), auto-application priority code (`"2"` from `WRIB_APLY_OPTNTY_CD_AUTO_APLY`), subscription type code (from `ccMap`), discount type code (`typeCd`), and a comma-separated list of discount service codes derived from the `KK_CP_GRDUP` array. It also sets the application condition type to `"08"` (Read-up CP group).

2. **CBS service invocation:** The method instantiates the `KKSV0313_KKSV0313OP_EKK0841B004BSMapper`, calls `editInMsg` to build the CBS request message, executes the CBS via `ServiceComponentRequestInvoker.run()`, and then calls `editResultRP` to parse the response back into the work map.

3. **Response transformation (SC -> CC mapping):** The flat CBS response list is iterated in order. Each record carries a `DATA_KBN` (data classification) field that determines how it is processed:
   - **DATA_KBN = "1"** (Discount Service): A new discount service record is initialized and populated with 11 fields including service code, type, name, upper limit count, aging period, priority model/type/kind codes, display order, and application/registration condition codes.
   - **DATA_KBN = "2"** (Discount Service Application Condition): An application condition record is built with 7 fields (condition type, number, and 5 condition values) and appended to the current discount service's condition list.
   - **DATA_KBN = "3"** (Discount Service Target Service): A target service record is built with 21 fields describing which services the discount applies to (service code, price group, course, plan, options, sub-options, equipment services, billing-related fields, and before-change fields).

4. **Record boundary detection:** When the current record is the last in the list, or when a new record has a different `WRIB_SVC_CD` from the previous one, the accumulated condition list and target service list are attached to the current discount service record and added to `setList`. The nested lists are then reset for the next group.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `ccMap` | `HashMap<String, Object>` | Work area map carrying the full business context of the discount auto-application process. Contains the subscription type code (`MSKM_SBT_CD`), the grouped-up discount service code array (`KK_CP_GRDUP`), and is used to store the resulting discount service list (`WRIB_SVC_LIST`) after processing. |
| 2 | `funcCd` | `String` | Function code identifying the calling business context (e.g., contract change, batch auto-application). Passed directly to the CBS as the function discriminator. |
| 3 | `ymd` | `String` | Reference date in YYYYMMDD format (基準年月日). The CBS uses this date to determine which discount service conditions are valid — a condition is only applicable if it is effective on this date. |
| 4 | `typeCd` | `String` | Discount type code (割引タイプコード) that restricts the query to a specific category of discounts (e.g., network discount, equipment discount, plan discount). |
| 5 | `setList` | `ArrayList<HashMap<String, Object>>` | Output parameter that accumulates the fully assembled discount service records (each with nested condition and target-service sub-lists). Populated in-place and returned. |

**Instance fields read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `ccMapNm` | `String` | Base name for the context map key used to store/retrieve data in the shared parameter map. |
| `cmnParam` | `IRequestParameterReadWrite` | Shared request parameter map used to pass data between CC components and the CBS mapper. |
| `cmnHandle` | `SessionHandle` | Session handle for the CBS invocation. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| U | `KKSV0313_KKSV0313OP_EKK0841B004BSMapper.editInMsg` | EKK0841B004 | - | Transforms CC-level parameters into CBS request message format. Updates input message with function code, reference date, auto-application priority, subscription type, discount type, discount service codes, and application condition type. |
| R | `ServiceComponentRequestInvoker.run` | EKK0841B004 | EKK0841B004CBS | Executes the CBS service EKK0841B004 (Discount Service Conditions List Inquiry for Discount Use). Queries the discount service master table, discount service condition table, and discount service target service table to find records matching the provided filters. |
| U | `KKSV0313_KKSV0313OP_EKK0841B004BSMapper.editResultRP` | EKK0841B004 | - | Parses the CBS response back into the CC work map (`cmnParam`), converting CBS message fields to CC-level keys. |
| - | `JKKWrisvcAutoAplyCCMapper.checkExecutionResult` | EKK0841B004 | - | Validates the CBS execution result and throws an exception if the status indicates an error. |

## 5. Dependency Trace

### Caller Analysis

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Component:JKKWrisvcAutoAplyCC.setCrsChgAndBatchAutoWrib | `setCrsChgAndBatchAutoWrib` -> `getMapper().callEKK0841B004_1(ccMap, FUNC_CD_1, mskmYmd, type, wriSvcList)` | `ServiceComponentRequestInvoker.run [R] EKK0841B004CBS (discount service records)` |
| 2 | Component:JKKWrisvcAutoAplyCC.setWribSvc | `setWribSvc` -> `getMapper().callEKK0841B004_1(ccMap, FUNC_CD_1, ymd, type, setList)` | `ServiceComponentRequestInvoker.run [R] EKK0841B004CBS (discount service records)` |

### Terminal operations from this method

| # | Terminal Operation | Type | Entity / Target |
|---|-------------------|------|-----------------|
| 1 | `ServiceComponentRequestInvoker.run` | R | EKK0841B004CBS (Discount service condition inquiry — reads discount service master, condition, and target service tables) |
| 2 | `KKSV0313_KKSV0313OP_EKK0841B004BSMapper.editInMsg` | U | CBS request message transformation |
| 3 | `KKSV0313_KKSV0313OP_EKK0841B004BSMapper.editResultRP` | U | CBS response message transformation |
| 4 | `checkExecutionResult` | - | Error status validation |

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Build map name and create input map (L11523)

> Constructs the CBS context map name and initializes the input parameter map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mapName = this.ccMapNm + KKSV0313_KKSV0313OP.KKSV031382SC` |
| 2 | SET | `inMap = new HashMap<String, Object>()` |
| 3 | EXEC | `this.cmnParam.setData(mapName, inMap)` |

**Block 2** — [SET] Populate CC -> SC parameters (L11529)

> Maps caller parameters into CBS request keys. This is the CC-to-SC mapping phase.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inMap.put(FUNC_CODE, funcCd)` |
| 2 | SET | `inMap.put(KEY_KJNYMD, ymd)` |
| 3 | SET | `inMap.put(KEY_WRIB_APLY_OPTNTY_CD, WRIB_APLY_OPTNTY_CD_AUTO_APLY="2")` |
| 4 | SET | `inMap.put(KEY_MSKM_SBT_CD, (String)ccMap.get(MSKM_SBT_CD))` |
| 5 | SET | `inMap.put(KEY_WRIB_TYPE_CD, typeCd)` |

**Block 3** — [FOR] Build comma-separated discount service codes (L11537)

> Reads the grouped-up discount service code array from ccMap and builds a comma-delimited string by prepending a comma to each element. The leading comma is later stripped.

| # | Type | Code |
|---|------|------|
| 1 | SET | `cpGrdup = (String[])ccMap.get(KK_CP_GRDUP)` |
| 2 | SET | `sbCpGrdup = new StringBuffer()` |
| 3 | FOR | `for (int i = 0; i < cpGrdup.length; i++)` |
| 4 | EXEC | `sbCpGrdup.append(",")` |
| 5 | EXEC | `sbCpGrdup.append(cpGrdup[i])` |

**Block 4** — [SET] Strip leading comma and finalize input parameters (L11546)

> Removes the leading comma via `substring(1)` and sets the application condition type code.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inMap.put(KEY_WRIB_SVC_CD, sbCpGrdup.toString().substring(1))` |
| 2 | SET | `inMap.put(KEY_WRSV_APLY_JKN_SBT_CD, CD01360_GREAD_UP_CP="08")` |

**Block 5** — [EXEC] Invoke CBS service (L11553)

> Creates the BS mapper, builds the CBS request, executes the CBS, and parses the response.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mapper = new KKSV0313_KKSV0313OP_EKK0841B004BSMapper(mapName)` |
| 2 | CALL | `paramMap = mapper.editInMsg(this.cmnParam)` |
| 3 | SET | `scCall = new ServiceComponentRequestInvoker()` |
| 4 | CALL | `result = scCall.run(paramMap, this.cmnHandle)` |
| 5 | SET | `this.cmnParam = mapper.editResultRP(result, this.cmnParam)` |
| 6 | CALL | `checkExecutionResult(result)` |

**Block 6** — [SET] Extract response list (L11565)

> Retrieves the CBS response list from the work map and initializes working lists for the hierarchical transformation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outMap = (HashMap)this.cmnParam.getData(mapName)` |
| 2 | SET | `list = (ArrayList<HashMap<String, Object>>)outMap.get(EKK0841B004CBSMSG1LIST)` |
| 3 | SET | `wribSvcList = (ArrayList)ccMap.get(WRIB_SVC_LIST)` |
| 4 | IF | `if (wribSvcList == null)` |
| 5 | SET | `wribSvcList = new ArrayList()`, `ccMap.put(WRIB_SVC_LIST, wribSvcList)` |
| 6 | ELSE | `wribSvcList.clear()` |
| 7 | SET | `ccMapWribSvc = new HashMap()` |
| 8 | SET | `wrisvcAplyJknList = new ArrayList()` |
| 9 | SET | `WrisvcTgSvcList = new ArrayList()` |
| 10 | SET | `ccMapWribSvcCnt = 0` |

**Block 7** — [FOR] Iterate over CBS response records (L11576)

> Main processing loop. Iterates over each record returned from the CBS, classifying by `DATA_KBN` to build the hierarchical discount service structure.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ccMapWribSvcCnt++` |
| 2 | FOR | `for (HashMap<String, Object> outMapWribSvc : list)` |

**Block 7.1** — [IF] DATA_KBN = "1" (Discount Service) (L11612)

> When the data classification indicates a discount service header record, populate the discount service fields into `ccMapWribSvc`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ccMapWribSvc = new HashMap()` |
| 2 | SET | `ccMapWribSvc.put(WRIB_SVC_CD, outMapWribSvc.get(WRIB_SVC_CD))` |
| 3 | SET | `ccMapWribSvc.put(WRIB_TYPE_CD, outMapWribSvc.get(WRIB_TYPE_CD))` |
| 4 | SET | `ccMapWribSvc.put(WRIB_SVC_NM, outMapWribSvc.get(WRIB_SVC_NM))` |
| 5 | SET | `ccMapWribSvc.put(UPPL_APLY_CNT, outMapWribSvc.get(UPPL_APLY_CNT))` |
| 6 | SET | `ccMapWribSvc.put(WRIB_AGING_PRD, outMapWribSvc.get(WRIB_AGING_PRD))` |
| 7 | SET | `ccMapWribSvc.put(UPPL_KEI_CNT, outMapWribSvc.get(UPPL_KEI_CNT))` |
| 8 | SET | `ccMapWribSvc.put(DSP_JUN, outMapWribSvc.get(DSP_JUN))` |
| 9 | SET | `ccMapWribSvc.put(YUSEN_JUN_MDL_CD, outMapWribSvc.get(YUSEN_JUN_MDL_CD))` |
| 10 | SET | `ccMapWribSvc.put(YUSEN_JUN_KIND_CD, outMapWribSvc.get(YUSEN_JUN_KIND_CD))` |
| 11 | SET | `ccMapWribSvc.put(YUSEN_JUN_TYPE_CD, outMapWribSvc.get(YUSEN_JUN_TYPE_CD))` |
| 12 | SET | `ccMapWribSvc.put(YUSEN_JUN_TYPE_JUN, outMapWribSvc.get(YUSEN_JUN_TYPE_JUN))` |
| 13 | SET | `ccMapWribSvc.put(APLY_JOKEN_CD, outMapWribSvc.get(APLY_JOKEN_CD))` |
| 14 | SET | `ccMapWribSvc.put(WRIB_ADD_JOKEN_CD, outMapWribSvc.get(WRIB_ADD_JOKEN_CD))` |

**Block 7.2** — [IF] DATA_KBN = "2" (Discount Service Application Condition) (L11666)

> When the data classification indicates an application condition sub-record, build the condition map with 7 fields and append it to the current discount service's condition list.

| # | Type | Code |
|---|------|------|
| 1 | SET | `wrisvcAplyJkn = new HashMap()` |
| 2 | SET | `wrisvcAplyJkn.put(WRSV_APLY_JKN_SBT_CD, outMapWribSvc.get(WRSV_APLY_JKN_SBT_CD))` |
| 3 | SET | `wrisvcAplyJkn.put(WRSV_APLY_JKN_NO, outMapWribSvc.get(WRSV_APLY_JKN_NO))` |
| 4 | SET | `wrisvcAplyJkn.put(WRSV_APLY_JKN_VALUE_1, outMapWribSvc.get(WRSV_APLY_JKN_VALUE_1))` |
| 5 | SET | `wrisvcAplyJkn.put(WRSV_APLY_JKN_VALUE_2, outMapWribSvc.get(WRSV_APLY_JKN_VALUE_2))` |
| 6 | SET | `wrisvcAplyJkn.put(WRSV_APLY_JKN_VALUE_3, outMapWribSvc.get(WRSV_APLY_JKN_VALUE_3))` |
| 7 | SET | `wrisvcAplyJkn.put(WRSV_APLY_JKN_VALUE_4, outMapWribSvc.get(WRSV_APLY_JKN_VALUE_4))` |
| 8 | SET | `wrisvcAplyJkn.put(WRSV_APLY_JKN_VALUE_5, outMapWribSvc.get(WRSV_APLY_JKN_VALUE_5))` |
| 9 | EXEC | `wrisvcAplyJknList.add(wrisvcAplyJkn)` |

**Block 7.3** — [IF] DATA_KBN = "3" (Discount Service Target Service) (L11701)

> When the data classification indicates a target service sub-record, build the target service map with 21 fields (including 12 before-change fields) and append it to the current discount service's target service list.

| # | Type | Code |
|---|------|------|
| 1 | SET | `WrisvcTgSvc = new HashMap()` |
| 2 | SET | `WrisvcTgSvc.put(WRIB_SVC_TRGT_SVC_CD, outMapWribSvc.get(WRIB_SVC_TRGT_SVC_CD))` |
| 3 | SET | `WrisvcTgSvc.put(APLY_JOKEN_GRP, outMapWribSvc.get(APLY_JOKEN_GRP))` |
| 4 | SET | `WrisvcTgSvc.put(SVC_CD, outMapWribSvc.get(SVC_CD))` |
| 5 | SET | `WrisvcTgSvc.put(PRC_GRP_CD, outMapWribSvc.get(PRC_GRP_CD))` |
| 6 | SET | `WrisvcTgSvc.put(PCRS_CD, outMapWribSvc.get(PCRS_CD))` |
| 7 | SET | `WrisvcTgSvc.put(PPLAN_CD, outMapWribSvc.get(PPLAN_CD))` |
| 8 | SET | `WrisvcTgSvc.put(OP_SVC_CD, outMapWribSvc.get(OP_SVC_CD))` |
| 9 | SET | `WrisvcTgSvc.put(SBOP_SVC_CD, outMapWribSvc.get(SBOP_SVC_CD))` |
| 10 | SET | `WrisvcTgSvc.put(KKTK_SVC_CD, outMapWribSvc.get(KKTK_SVC_CD))` |
| 11 | SET | `WrisvcTgSvc.put(KKTK_SBT_CD, outMapWribSvc.get(KKTK_SBT_CD))` |
| 12 | SET | `WrisvcTgSvc.put(SEIOPSVC_CD, outMapWribSvc.get(SEIOPSVC_CD))` |
| 13 | SET | `WrisvcTgSvc.put(CHGE_BF_SVC_CD, outMapWribSvc.get(CHGE_BF_SVC_CD))` |
| 14 | SET | `WrisvcTgSvc.put(CHGE_BF_PRC_GRP_CD, outMapWribSvc.get(CHGE_BF_PRC_GRP_CD))` |
| 15 | SET | `WrisvcTgSvc.put(CHGE_BF_PCRS_CD, outMapWribSvc.get(CHGE_BF_PCRS_CD))` |
| 16 | SET | `WrisvcTgSvc.put(CHGE_BF_PPLAN_CD, outMapWribSvc.get(CHGE_BF_PPLAN_CD))` |
| 17 | SET | `WrisvcTgSvc.put(CHGE_BF_OP_SVC_CD, outMapWribSvc.get(CHGE_BF_OP_SVC_CD))` |
| 18 | SET | `WrisvcTgSvc.put(CHGE_BF_SBOP_SVC_CD, outMapWribSvc.get(CHGE_BF_SBOP_SVC_CD))` |
| 19 | SET | `WrisvcTgSvc.put(CHGE_BF_KKTK_SVC_CD, outMapWribSvc.get(CHGE_BF_KKTK_SVC_CD))` |
| 20 | SET | `WrisvcTgSvc.put(CHGE_BF_KKTK_SBT_CD, outMapWribSvc.get(CHGE_BF_KKTK_SBT_CD))` |
| 21 | SET | `WrisvcTgSvc.put(CHGE_BF_SEIOPSVC_CD, outMapWribSvc.get(CHGE_BF_SEIOPSVC_CD))` |
| 22 | SET | `WrisvcTgSvc.put(SVC_KEI_YEAR_CNT, outMapWribSvc.get(SVC_KEI_YEAR_CNT))` |
| 23 | SET | `WrisvcTgSvc.put(TRGT_KEI_SVC_CNT, outMapWribSvc.get(TRGT_KEI_SVC_CNT))` |
| 24 | SET | `WrisvcTgSvc.put(TRGT_KEI_SVC_UPPL, outMapWribSvc.get(TRGT_KEI_SVC_UPPL))` |
| 25 | SET | `WrisvcTgSvc.put(TRGT_SVC_HAMBET_CD, outMapWribSvc.get(TRGT_SVC_HAMBET_CD))` |
| 26 | SET | `WrisvcTgSvc.put(UPPL_AUTO_APLY_KH, outMapWribSvc.get(UPPL_AUTO_APLY_KH))` |
| 27 | SET | `WrisvcTgSvc.put(KKOP_SVC_CD, outMapWribSvc.get(KKOP_SVC_CD))` |
| 28 | SET | `WrisvcTgSvc.put(CHGE_BF_KKOP_SVC_CD, outMapWribSvc.get(CHGE_BF_KKOP_SVC_CD))` |
| 29 | EXEC | `WrisvcTgSvcList.add(WrisvcTgSvc)` |

**Block 7.4** — [IF] Record boundary check — finalize current discount service (L11806)

> When the current record is the last in the list, OR when the WRIB_SVC_CD changes (indicating the start of a new discount service group), finalize the current discount service by attaching its nested condition and target-service lists, add it to `setList`, and reset the nested lists.

| # | Type | Code |
|---|------|------|
| 1 | IF | `ccMapWribSvcCnt == list.size()` (last record) OR `("1".equals(next DATA_KBN) AND next WRIB_SVC_CD != current WRIB_SVC_CD)` (new service group) |
| 2 | SET | `ccMapWribSvc.put(WRSV_APLY_JKN_LIST, wrisvcAplyJknList)` |
| 3 | SET | `ccMapWribSvc.put(WRISVC_TG_SVC_LIST, WrisvcTgSvcList)` |
| 4 | EXEC | `setList.add(ccMapWribSvc)` |
| 5 | SET | `wrisvcAplyJknList = new ArrayList()` |
| 6 | SET | `WrisvcTgSvcList = new ArrayList()` |

**Block 8** — [RETURN] Return assembled result (L11819)

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

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `WRIB_SVC_CD` | Field | Discount service code — unique identifier for a discount service configuration (e.g., network discount, equipment discount, plan discount) |
| `WRIB_TYPE_CD` | Field | Discount type code — categorizes the discount (e.g., percentage-based, fixed amount) |
| `WRIB_SVC_NM` | Field | Discount service name — human-readable description of the discount |
| `UPPL_APLY_CNT` | Field | Upper limit application count — maximum number of times a discount can be applied to a single contract |
| `WRIB_AGING_PRD` | Field | Discount aging period — duration (in months) for which the discount remains valid after application |
| `UPPL_KEI_CNT` | Field | Upper limit contract count — maximum number of contracts eligible for this discount |
| `DSP_JUN` | Field | Display order — sort priority for displaying the discount in UI lists |
| `YUSEN_JUN_MDL_CD` | Field | Discount priority model code — determines which discount takes precedence when multiple apply |
| `YUSEN_JUN_KIND_CD` | Field | Discount priority type code — category of precedence evaluation |
| `YUSEN_JUN_TYPE_CD` | Field | Discount priority subtype code — granular precedence discriminator |
| `YUSEN_JUN_TYPE_JUN` | Field | Discount priority subtype order — fine-grained sort within a priority subtype |
| `APLY_JOKEN_CD` | Field | Application condition code — code defining eligibility criteria for the discount |
| `WRIB_ADD_JOKEN_CD` | Field | Discount registration condition code — additional criteria for when the discount is registered |
| `WRSV_APLY_JKN_SBT_CD` | Field | Discount service application condition subtype code — classifies the type of application condition |
| `WRSV_APLY_JKN_NO` | Field | Discount service application condition number — sequential number of a condition within a discount |
| `WRSV_APLY_JKN_VALUE_1` through `WRSV_APLY_JKN_VALUE_5` | Field | Discount service application condition value 1-5 — up to five condition values defining eligibility |
| `WRIB_SVC_TRGT_SVC_CD` | Field | Discount service target service code — identifies which services the discount applies to |
| `APLY_JOKEN_GRP` | Field | Application condition group — groups conditions that must be satisfied together |
| `SVC_CD` | Field | Service code — identifies a telecom service (e.g., FTTH, mobile, IP phone) |
| `PRC_GRP_CD` | Field | Price group code — billing category for the service |
| `PCRS_CD` | Field | Course code — specific service plan/course |
| `PPLAN_CD` | Field | Price plan code — pricing tier |
| `OP_SVC_CD` | Field | Option service code — optional add-on service |
| `SBOP_SVC_CD` | Field | Sub-option service code — sub-add-on service |
| `KKTK_SVC_CD` | Field | Equipment provision service code — hardware/device service (e.g., router, STB) |
| `KKTK_SBT_CD` | Field | Equipment provision type code — type of equipment service |
| `SEIOPSVC_CD` | Field | Billing option service code — billing-related optional service |
| `CHGE_BF_*` | Fields | Before-change values — the previous state of a field before a contract change (used for comparison during changes) |
| `SVC_KEI_YEAR_CNT` | Field | Service contract year count — number of years a service contract has been active |
| `TRGT_KEI_SVC_CNT` | Field | Target contract service count — number of target contracts/services |
| `TRGT_KEI_SVC_UPPL` | Field | Target contract service upper limit — maximum count of eligible target contracts |
| `TRGT_SVC_HAMBET_CD` | Field | Target service discrimination code — discriminator for target service matching |
| `UPPL_AUTO_APLY_KH` | Field | Upper limit over-application possibility — flag indicating if the discount can exceed its upper limit via auto-application |
| `KKOP_SVC_CD` | Field | Equipment option service code — equipment-related optional service |
| `DATA_KBN` | Field | Data classification — indicates record type: "1"=Discount Service, "2"=Application Condition, "3"=Target Service |
| `cd01360_gread_up_cp` | Constant | Read-up CP application condition type code = "08" — identifies read-up CP (Change Plan) as the application condition category |
| `WRIB_APLY_OPTNTY_CD_AUTO_APLY` | Constant | Auto-application priority code = "2" — filters the CBS to only return auto-applicable discounts |
| `mskm_sbt_cd` | Field | Subscription type code — classifies the type of subscription/contract being evaluated |
| `KK_CP_GRDUP` | Field | Grouped-up CP code array — array of service codes grouped together for bundled discount eligibility |
| `ccMap` | Field | Work area map — shared HashMap carrying all business context data for the discount auto-application process |
| `setList` | Field | Output discount service list — accumulated list of fully assembled discount service records with nested conditions and target services |
| `ymd` | Field | Reference date (基準年月日) — YYYYMMDD formatted date used to filter valid discount service records |
| `EKK0841B004` | SC Code | Discount Service Conditions List Inquiry (for Discount Use) CBS — queries discount service master, conditions, and target service tables |
| `KKSV031382SC` | Constant | Service interface key identifier for the discount service contract list inquiry (for discount use) |
| CBS | Acronym | Common Business Service — back-end service layer executing database queries |
| CC | Acronym | Common Component — shared business logic components in the K-Opticom customer core system |
| SC | Acronym | Service Component — service component layer interacting with the CBS |
| CP | Acronym | Coupon/Condition/Concession Plan — promotional discount configuration |
| K-Opticom | Business term | Japanese telecommunications carrier providing broadband, mobile, and VoIP services |
