# Business Logic — KKA14901SFLogic.commonKnrnChkForOneStop() [216 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKA14901SF.KKA14901SFLogic` |
| Layer | Service / Screen Logic (Controller-adjacent Service Layer) |
| Module | `KKA14901SF` (Package: `eo.web.webview.KKA14901SF`) |

## 1. Role

`commonKnrnChkForOneStop` is the central common-related-check method for the One Stop (ワンストップ) service migration flow in Japan Koku (日本国) telecom operations. Its primary business purpose is to validate that a customer's selected service is eligible for migration (異動 — idō) under the One Stop API interface, and to prepare all necessary pre-check data before a migration request can proceed. The method acts as a gatekeeper: if any validation fails, it returns `false` and sets an appropriate error XML message; if all checks pass, it returns `true`.

The method performs five major phases of processing. First, it extracts core identifiers (sysid, service contract number, user ID) from the request map and calls **KKSV0820** to validate existence of these identifiers and build a code classification list. Second, it calls **KKSV0061** to retrieve supplementary service information and **KKSV0062** to fetch the service migration eligibility data, including the processing group code (prcGrpCd) that determines whether additional service plan data (KKSV006212SC) is needed. Third, it iterates through the service contract history list to check if any contract is currently in the "service provision in progress" state (svc_kei_stat = "100"), setting a flag (`svcTkRrkFlg`) to indicate this. Fourth, it calls **KKSV0463** to determine the migration division and reason code selection options, and **KKSV0551** to determine the migration reason broad classification switching. Finally, it validates the migration reason code pair (via `checkIdoRsnCdPair`) and the service migration eligibility (via `checkSvcKeiIdoPsb`).

The method handles multiple service types implicitly through the processing group codes (prcGrpCd) it retrieves — including mobile Wi-Fi (07), EMobile (08), UQ WiMAX (09), and fixed-line telephone (10). It implements a **guard-clause pattern** (early return on validation failure) and a **delegation pattern** where it delegates each validation phase to specific SC (Service Component) operations.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["commonKnrnChkForOneStop()"])
    START --> BEAN["Get Service Form Bean"]
    BEAN --> EXTRACT["Extract sysid, svcKeiNo, userId from requestMap"]
    EXTRACT --> OPE["Get opeDate from JCCWebCommon"]
    OPE --> KKSV0820_SETUP["Setup KKSV0820 params and mappers"]
    KKSV0820_SETUP --> KKSV0820_INVOKE["invokeService KKSV0820"]
    KKSV0820_INVOKE --> CHK_SYSID{checkExistSysid}
    CHK_SYSID -->|false| RET_E5013["setReturnXml E5013"]
    RET_E5013 --> RET_FALSE_1["return false"]
    CHK_SYSID -->|true| CHK_SVC{checkExistSvcKeiNo}
    CHK_SVC -->|false| RET_E5014["setReturnXml E5014"]
    RET_E5014 --> RET_FALSE_2["return false"]
    CHK_SVC -->|true| CHK_UID{checkExistUserId}
    CHK_UID -->|false| RET_E5015["setReturnXml E5015"]
    RET_E5015 --> RET_FALSE_3["return false"]
    CHK_UID -->|true| EXTRACT_CD["Extract cdDivListMap from output"]
    EXTRACT_CD --> OSBEAN["Create OneStopDataBeanAccess, set messages"]
    OSBEAN --> KKSV0061_SETUP["Setup KKSV0061 mappers (01,02,03)"]
    KKSV0061_SETUP --> KKSV0061_INVOKE["invokeService KKSV0061"]
    KKSV0061_INVOKE --> KKSV0061_GET["get KKSV006101-04SC from output"]
    KKSV0061_GET --> KKSV0062_SETUP["Setup KKSV0062 mappers (01-12,21-23)"]
    KKSV0062_SETUP --> KKSV0062_INVOKE["invokeService KKSV0062"]
    KKSV0062_INVOKE --> KKSV0062_GET["get KKSV006201,05,07-11,21 from output"]
    KKSV0062_GET --> PRC_CHK{prcGrpCd in 07,08,09,10?}
    PRC_CHK -->|true| GET_12["get KKSV006212SC"]
    PRC_CHK -->|false| GET_23["get KKSV006223SC"]
    GET_12 --> GET_23
    GET_23 --> SVC_STAT_LOOP["Loop service contract history list"]
    SVC_STAT_LOOP --> SVC_STAT_CHK{svcKeiStat = 100?}
    SVC_STAT_CHK -->|true| SET_FLG["svcTkRrkFlg = 1"]
    SET_FLG --> SVC_BREAK["break loop"]
    SVC_STAT_CHK -->|false| NEXT_ITEM{"next item?"}
    NEXT_ITEM -->|yes| SVC_STAT_LOOP
    NEXT_ITEM -->|no| KKSV0463_SETUP["Setup KKSV0463 mapper"]
    SVC_BREAK --> KKSV0463_SETUP
    KKSV0463_SETUP --> KKSV0463_INVOKE["invokeService KKSV0463"]
    KKSV0463_INVOKE --> KKSV0551_SETUP["Setup KKSV0551 mapper"]
    KKSV0551_SETUP --> KKSV0551_INVOKE["invokeService KKSV0551"]
    KKSV0551_INVOKE --> CHK_PAIR{checkIdoRsnCdPair}
    CHK_PAIR -->|false| RET_E5016["setReturnXml E5016"]
    RET_E5016 --> RET_FALSE_4["return false"]
    CHK_PAIR -->|true| CHK_MIG{checkSvcKeiIdoPsb}
    CHK_MIG -->|false| RET_E5002["setReturnXml E5002"]
    RET_E5002 --> RET_FALSE_5["return false"]
    CHK_MIG -->|true| RET_TRUE["return true"]
    RET_FALSE_1 --> END(["END"])
    RET_FALSE_2 --> END
    RET_FALSE_3 --> END
    RET_FALSE_4 --> END
    RET_FALSE_5 --> END
    RET_TRUE --> END
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | This method takes no parameters. All input data is sourced from instance fields and the request map. |

### Instance fields and external state read by this method:

| No | Source | Type | Business Description |
|----|--------|------|---------------------|
| 1 | `requestMap` | `Map<String, Object>` | Request parameters — holds `sysid` (system ID), `svc_kei_no` (service contract number), `user_id` (user identifier), `ido_rsn_dbri_cd` (migration reason broad classification code), `ido_rsn_cbri_cd` (migration reason medium classification code) |
| 2 | `warnList` | `List<Map<String, String>>` | Warning/error list for collecting error messages during validation |
| 3 | `funcCode` | `String` | Function code — identifies the calling function context |
| 4 | `cdDivListMap` | `Map<String, List<Map<String, String>>>` | Code classification list map — stores code subdivision results from KKSV0820 |
| 5 | `svcTkRrkFlg` | `String` | Service provision history flag — set to "1" if any service contract is in "service provision in progress" state, "0" otherwise |
| 6 | `IF_ID` | `static final String` | Interface ID constant, value `"KKIFE274"` |
| 7 | `OS_IDO_DIV` | `static final String` | One Stop migration division, value `"00031"` (Option setting) |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C | `KKSV0820_KKSV0820OPDBMapper.setKKSV082001CC` | KKSV082001CC | SYSID, SVC_KEI_NO, USER_ID existence check data | Sets up KKSV0820 check parameters including sysid, svc_kei_no, userId and code subdivision list |
| R | `KKSV0820_KKSV0820OPDBMapper` → `invokeService` | KKSV0820OP | - | Calls KKSV0820 to validate existence of sysid, service contract number, user ID |
| C | `KKSV0061_KKSV0061OPDBMapper.setKKSV006101SC` | KKSV006101SC | - | Sets up KKSV0061 phase 1 (func_cd=1) — supplementary service info retrieval |
| C | `KKSV0061_KKSV0061OPDBMapper.setKKSV006102SC` | KKSV006102SC | - | Sets up KKSV0061 phase 2 (func_cd=3) — supplementary service info detail |
| C | `KKSV0061_KKSV0061OPDBMapper.setKKSV006103SC` | KKSV006103SC | - | Sets up KKSV0061 phase 3 (func_cd=3) — additional supplementary data |
| R | `KKSV0061_KKSV0061OPDBMapper` → `invokeService` | KKSV0061OP | - | Calls KKSV0061 to retrieve supplementary service information |
| R | `KKSV0061_KKSV0061OPDBMapper.getKKSV006101SC` | KKSV006101SC | - | Retrieves KKSV0061 phase 1 output data |
| R | `KKSV0061_KKSV0061OPDBMapper.getKKSV006102SC` | KKSV006102SC | - | Retrieves KKSV0061 phase 2 output data |
| R | `KKSV0061_KKSV0061OPDBMapper.getKKSV006103SC` | KKSV006103SC | - | Retrieves KKSV0061 phase 3 output data |
| R | `KKSV0061_KKSV0061OPDBMapper.getKKSV006104SC` | KKSV006104SC | - | Retrieves KKSV0061 phase 4 output data (additional fields) |
| C | `KKSV0062_KKSV0062OPDBMapper.setKKSV006201SC` | KKSV006201SC | - | Sets up KKSV0062 phase 1 (func_cd=2) — service migration eligibility |
| C | `KKSV0062_KKSV0062OPDBMapper.setKKSV006202SC` | KKSV006202SC | - | Sets up KKSV0062 phase 2 (func_cd=1) — service contract info |
| C | `KKSV0062_KKSV0062OPDBMapper.setKKSV006203SC` | KKSV006203SC | - | Sets up KKSV0062 phase 3 (func_cd=1) — service detail info |
| C | `KKSV0062_KKSV0062OPDBMapper.setKKSV006205SC` | KKSV006205SC | - | Sets up KKSV0062 phase 5 (func_cd=1) — plan code info |
| C | `KKSV0062_KKSV0062OPDBMapper.setKKSV006206SC` | KKSV006206SC | - | Sets up KKSV0062 phase 6 (func_cd=1) — price group code info |
| C | `KKSV0062_KKSV0062OPDBMapper.setKKSV006207SC` | KKSV006207SC | - | Sets up KKSV0062 phase 7 (func_cd=6) — contract status info |
| C | `KKSV0062_KKSV0062OPDBMapper.setKKSV006208SC` | KKSV006208SC | - | Sets up KKSV0062 phase 8 (func_cd=2) — additional contract info |
| C | `KKSV0062_KKSV0062OPDBMapper.setKKSV006209SC` | KKSV006209SC | - | Sets up KKSV0062 phase 9 (func_cd=1) — service status info |
| C | `KKSV0062_KKSV0062OPDBMapper.setKKSV006210SC` | KKSV006210SC | - | Sets up KKSV0062 phase 10 (func_cd=2) — migration info |
| C | `KKSV0062_KKSV0062OPDBMapper.setKKSV006212SC` | KKSV006212SC | - | Sets up KKSV0062 phase 12 (func_cd=1) — additional price data |
| C | `KKSV0062_KKSV0062OPDBMapper.setKKSV006221SC` | KKSV006221SC | - | Sets up KKSV0062 phase 21 (func_cd=1) — supplementary data |
| C | `KKSV0062_KKSV0062OPDBMapper.setKKSV006222CC` | KKSV006222CC | - | Sets up KKSV0062 phase 22 (func_cd=1) — contract status (ANK-2687) |
| C | `KKSV0062_KKSV0062OPDBMapper.setKKSV006223SC` | KKSV006223SC | - | Sets up KKSV0062 phase 23 (func_cd=2) — service contract history (IT1-2016) |
| R | `KKSV0062_KKSV0062OPDBMapper` → `invokeService` | KKSV0062OP | - | Calls KKSV0062 to retrieve service migration eligibility and contract data |
| R | `KKSV0062_KKSV0062OPDBMapper.getKKSV006201SC` | KKSV006201SC | KK_T_SVKEI_HAKU (service provision record) | Retrieves KKSV0062 phase 1 — includes EKK0081A010CBSMsg1List with prcGrpCd |
| R | `KKSV0062_KKSV0062OPDBMapper.getKKSV006205SC` | KKSV006205SC | - | Retrieves KKSV0062 phase 5 output data |
| R | `KKSV0062_KKSV0062OPDBMapper.getKKSV006207SC` | KKSV006207SC | - | Retrieves KKSV0062 phase 7 output data |
| R | `KKSV0062_KKSV0062OPDBMapper.getKKSV006208SC` | KKSV006208SC | - | Retrieves KKSV0062 phase 8 output data |
| R | `KKSV0062_KKSV0062OPDBMapper.getKKSV006209SC` | KKSV006209SC | - | Retrieves KKSV0062 phase 9 output data |
| R | `KKSV0062_KKSV0062OPDBMapper.getKKSV006210SC` | KKSV006210SC | - | Retrieves KKSV0062 phase 10 output data |
| R | `KKSV0062_KKSV0062OPDBMapper.getKKSV006211SC` | KKSV006211SC | - | Retrieves KKSV0062 phase 11 output data |
| R | `KKSV0062_KKSV0062OPDBMapper.getKKSV006221SC` | KKSV006221SC | - | Retrieves KKSV0062 phase 21 output data |
| R | `KKSV0062_KKSV0062OPDBMapper.getKKSV006212SC` | KKSV006212SC | - | Conditionally retrieves KKSV0062 phase 12 (price group detail) |
| R | `KKSV0062_KKSV0062OPDBMapper.getKKSV006223SC` | KKSV006223SC | EKK0081B024CBS (service contract history) | Retrieves KKSV0062 phase 23 — includes EKK0081B024CBSMsg1List with svc_kei_stat |
| C | `KKSV0463_KKSV0463OPDBMapper.setKKSV046301SC` | KKSV046301SC | - | Sets up KKSV0463 (func_cd=1) — migration division selection with reason code switching |
| R | `KKSV0463_KKSV0463OPDBMapper` → `invokeService` | KKSV0463OP | - | Calls KKSV0463 to determine migration division and reason code selection |
| C | `KKSV0551_KKSV0551OPDBMapper.setKKSV055101SC` | KKSV055101SC | - | Sets up KKSV0551 (func_cd=1) — migration reason broad classification switching with reason code |
| R | `KKSV0551_KKSV0551OPDBMapper` → `invokeService` | KKSV0551OP | - | Calls KKSV0551 to determine migration reason broad classification |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Logic: KKA14901SFLogic.apiControl | `apiControl` → `commonKnrnChkForOneStop` | `checkExistSysid [R] -`, `checkExistSvcKeiNo [R] -`, `checkExistUserId [R] -`, `checkIdoRsnCdPair [R] -`, `checkSvcKeiIdoPsb [R] -`, `setReturnXml [-] -`, `invokeService [R] KKSV0820OP`, `invokeService [R] KKSV0061OP`, `invokeService [R] KKSV0062OP`, `invokeService [R] KKSV0463OP`, `invokeService [R] KKSV0551OP` |

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Initialize data beans and extract parameters (L686)

| # | Type | Code |
|---|------|------|
| 1 | SET | `bean = super.getServiceFormBean()` // Get the service form DataBean [-> X31SDataBeanAccess] |
| 2 | SET | `paramBean = {bean}` // Wrap bean in array for mapper calls |
| 3 | SET | `sysid = requestMap.get("sysid")` // System ID — unique system identifier for One Stop API |
| 4 | SET | `svcKeiNo = requestMap.get("svc_kei_no")` // Service contract number — the customer's selected service contract ID |
| 5 | SET | `userId = requestMap.get("user_id")` // User identifier — the requesting customer's user ID |
| 6 | SET | `idoDiv = OS_IDO_DIV` // Migration division = "00031" (Option setting — fixed for One Stop) [-> IDO_DIV_VALUE_00031] |
| 7 | SET | `idoRsnDbriCd = requestMap.get("ido_rsn_dbri_cd")` // Migration reason broad classification code |
| 8 | SET | `idoRsnCbriCd = requestMap.get("ido_rsn_cbri_cd")` // Migration reason medium classification code |
| 9 | SET | `cdSbtList = new ArrayList<String>()` // Initialize code subdivision list |
| 10 | SET | `opeDate = JCCWebCommon.getOpeDate(this, null)` // Get current operation date |

**Block 2** — [IF] SYSID existence check (L724)

> Check if the sysid was successfully resolved by KKSV0820. If missing, return error E5013.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `!JKKOneStopApiCommonUtil.checkExistSysid(kksv0820OutputMap)` // Returns true if sysid is missing |
| 1.1 | EXEC | `JKKOneStopApiCommonUtil.setReturnXml(this, "E5013", warnList, funcCode, IF_ID)` // Set error XML with code E5013 — "SYSID not found" |
| 1.2 | RETURN | `return false` // Validation failed — do not proceed with migration |

**Block 3** — [IF] Service contract number existence check (L731)

> Check if the service contract number was successfully resolved by KKSV0820. If missing, return error E5014.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `!JKKOneStopApiCommonUtil.checkExistSvcKeiNo(kksv0820OutputMap)` // Returns true if svc_kei_no is missing |
| 1.1 | EXEC | `JKKOneStopApiCommonUtil.setReturnXml(this, "E5014", warnList, funcCode, IF_ID)` // Set error XML with code E5014 — "Service contract number not found" |
| 1.2 | RETURN | `return false` // Validation failed |

**Block 4** — [IF] User ID existence check (L738)

> Check if the user ID was successfully resolved by KKSV0820. If missing, return error E5015.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `!JKKOneStopApiCommonUtil.checkExistUserId(kksv0820OutputMap)` // Returns true if user_id is missing |
| 1.1 | EXEC | `JKKOneStopApiCommonUtil.setReturnXml(this, "E5015", warnList, funcCode, IF_ID)` // Set error XML with code E5015 — "User ID not found" |
| 1.2 | RETURN | `return false` // Validation failed |

**Block 5** — [SET] Extract code subdivision list from KKSV0820 output (L745)

| # | Type | Code |
|---|------|------|
| 1 | SET | `kksv082001ccMap = kksv0820OutputMap.get("KKSV082001CC")` // Get KKSV082001CC phase output |
| 2 | SET | `codeMeishoKanriMap = kksv082001ccMap.get("codeMeishoKanriMap")` // Get code name management map |
| 3 | SET | `cdDivListMap = codeMeishoKanriMap.get("rslt_cd_sbt_map")` // Store subdivision result map in instance field |

**Block 6** — [SET] Create OneStopDataBeanAccess and set migration context messages (L748)

> Set up the message-based data bean with migration context: system ID, selected service contract number, operation date, and service contract number (IT1-2016 addition).

| # | Type | Code |
|---|------|------|
| 1 | SET | `osBean = new OneStopDataBeanAccess()` // Create One Stop data bean for message-based communication |
| 2 | EXEC | `osBean.sendMessageString("SSSI", DATABEAN_SET_VALUE, sysid)` // Set system ID message |
| 3 | EXEC | `osBean.sendMessageString("選択サービス契約番号", DATABEAN_SET_VALUE, svcKeiNo)` // Set selected service contract number |
| 4 | EXEC | `osBean.sendMessageString("運用日付", DATABEAN_SET_VALUE, opeDate)` // Set operation date |
| 5 | EXEC | `osBean.sendMessageString("サービス契約番号", DATABEAN_SET_VALUE, svcKeiNo)` // Set service contract number — IT1-2016-0000100 addition |
| 6 | SET | `paramOsBean = {osBean}` // Wrap bean in array for mapper calls |

**Block 7** — [SET] KKSV0061 phase setup — supplementary service info (L758)

> KKSV0061 retrieves supplementary service information. Three phases (01, 02, 03) are invoked with different function codes.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kksv0061ParamMap.put(TELEGRAM_INFO_USECASE_ID, UCID_KKSV0061)` // Set use case ID |
| 2 | SET | `kksv0061ParamMap.put(TELEGRAM_INFO_OPERATION_ID, OPID_KKSV0061OP)` // Set operation ID |
| 3 | SET | `kksv0061Mapper = new KKSV0061_KKSV0061OPDBMapper()` // Create mapper instance |
| 4 | SET | `kksv0061Mapper.setKKSV006101SC(paramOsBean, inputMap, FUNC_CD_1)` // Phase 1: basic info |
| 5 | SET | `kksv0061Mapper.setKKSV006102SC(paramOsBean, inputMap, FUNC_CD_3)` // Phase 2: detailed info |
| 6 | SET | `kksv0061Mapper.setKKSV006103SC(paramOsBean, inputMap, FUNC_CD_3)` // Phase 3: supplementary data |
| 7 | EXEC | `invokeService(kksv0061ParamMap, kksv0061InputMap, kksv0061OutputMap)` // Execute KKSV0061 |

**Block 8** — [SET] KKSV0061 phase mapping — retrieve output data (L768)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `kksv0061Mapper.getKKSV006101SC(paramOsBean, kksv0061OutputMap)` // Retrieve phase 1 result |
| 2 | EXEC | `kksv0061Mapper.getKKSV006102SC(paramOsBean, kksv0061OutputMap)` // Retrieve phase 2 result |
| 3 | EXEC | `kksv0061Mapper.getKKSV006103SC(paramOsBean, kksv0061OutputMap)` // Retrieve phase 3 result |
| 4 | EXEC | `kksv0061Mapper.getKKSV006104SC(paramOsBean, kksv0061OutputMap)` // Retrieve phase 4 result |

**Block 9** — [SET] KKSV0062 phase setup — service migration eligibility (L778)

> KKSV0062 is the core service migration eligibility check. It includes 12 phases plus two additional phases added by IT1-2016 and ANK-2687.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kksv0062ParamMap.put(TELEGRAM_INFO_USECASE_ID, UCID_KKSV0062)` |
| 2 | SET | `kksv0062ParamMap.put(TELEGRAM_INFO_OPERATION_ID, OPID_KKSV0062OP)` |
| 3 | SET | `kksv0062Mapper = new KKSV0062_KKSV0062OPDBMapper()` |
| 4 | SET | `kksv0062Mapper.setKKSV006201SC(paramOsBean, inputMap, FUNC_CD_2)` // Phase 1: migration eligibility |
| 5 | SET | `kksv0062Mapper.setKKSV006202SC(paramOsBean, inputMap, FUNC_CD_1)` // Phase 2: contract info |
| 6 | SET | `kksv0062Mapper.setKKSV006203SC(paramOsBean, inputMap, FUNC_CD_1)` // Phase 3: service detail |
| 7 | SET | `kksv0062Mapper.setKKSV006205SC(paramOsBean, inputMap, FUNC_CD_1)` // Phase 5: plan code |
| 8 | SET | `kksv0062Mapper.setKKSV006206SC(paramOsBean, inputMap, FUNC_CD_1)` // Phase 6: price group |
| 9 | SET | `kksv0062Mapper.setKKSV006207SC(paramOsBean, inputMap, FUNC_CD_6)` // Phase 7: contract status |
| 10 | SET | `kksv0062Mapper.setKKSV006208SC(paramOsBean, inputMap, FUNC_CD_2)` // Phase 8: contract detail |
| 11 | SET | `kksv0062Mapper.setKKSV006209SC(paramOsBean, inputMap, FUNC_CD_1)` // Phase 9: service status |
| 12 | SET | `kksv0062Mapper.setKKSV006210SC(paramOsBean, inputMap, FUNC_CD_2)` // Phase 10: migration info |
| 13 | SET | `kksv0062Mapper.setKKSV006212SC(paramOsBean, inputMap, FUNC_CD_1)` // Phase 12: additional price |
| 14 | SET | `kksv0062Mapper.setKKSV006221SC(paramOsBean, inputMap, FUNC_CD_1)` // Phase 21: supplementary |
| 15 | SET | `kksv0062Mapper.setKKSV006222CC(paramOsBean, inputMap, FUNC_CD_1)` // Phase 22: ANK-2687 addition |
| 16 | SET | `kksv0062Mapper.setKKSV006223SC(paramOsBean, inputMap, FUNC_CD_2)` // Phase 23: IT1-2016 addition — contract history |
| 17 | EXEC | `invokeService(kksv0062ParamMap, kksv0062InputMap, kksv0062OutputMap)` // Execute KKSV0062 |

**Block 10** — [SET] KKSV0062 phase mapping — retrieve output data (L802)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `kksv0062Mapper.getKKSV006201SC(...)` // Retrieve phase 1 |
| 2 | EXEC | `kksv0062Mapper.getKKSV006205SC(...)` // Retrieve phase 5 |
| 3 | EXEC | `kksv0062Mapper.getKKSV006207SC(...)` // Retrieve phase 7 |
| 4 | EXEC | `kksv0062Mapper.getKKSV006209SC(...)` // Retrieve phase 9 |
| 5 | EXEC | `kksv0062Mapper.getKKSV006210SC(...)` // Retrieve phase 10 |
| 6 | EXEC | `kksv0062Mapper.getKKSV006211SC(...)` // Retrieve phase 11 |
| 7 | EXEC | `kksv0062Mapper.getKKSV006208SC(...)` // Retrieve phase 8 |
| 8 | EXEC | `kksv0062Mapper.getKKSV006221SC(...)` // Retrieve phase 21 |

**Block 11** — [SET] Extract prcGrpCd from KKSV006201SC output (L810)

> Navigate through the output map to extract the processing group code (prcGrpCd) from the first entry of the EKK0081A010CBSMsg1List. This code determines if additional price group data is needed.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kksv006201scMap = kksv0062OutputMap.get("KKSV006201SC")` |
| 2 | SET | `ekk0081a010List = kksv006201scMap.get("EKK0081A010CBSMsg1List")` // List of CBS messages for service provision records |
| 3 | SET | `ekk0081a010Map = (first element of list or null)` // Null-safe first element |
| 4 | SET | `prcGrpCd = ekk0081a010Map.get("prc_grp_cd")` // Processing group code |

**Block 12** — [IF] Conditional price group data retrieval (L814)

> If the processing group code is 07 (Mobile Wi-Fi), 08 (EMobile), 09 (UQ WiMAX), or 10 (Fixed Telephone), additionally retrieve phase 12 data. These groups represent mobile/WiFi service types that require additional price data.

| # | Type | Code |
|---|------|------|
| 1 | SET | `[-> PRC_GRP_CD_MOB_WIFI = "07"]` (Mobile Wi-Fi) |
| 1 | SET | `[-> PRC_GRP_CD_MOB_EM = "08"]` (EMobile) |
| 1 | SET | `[-> PRC_GRP_CD_MOB_UQ = "09"]` (UQ WiMAX) |
| 1 | SET | `[-> PRC_GRP_CD_TEL = "10"]` (Fixed Telephone) |
| 2 | EXEC | `kksv0062Mapper.getKKSV006212SC(...)` // Conditionally retrieve additional price group data |

**Block 13** — [SET] IT1-2016 addition: retrieve contract history (L819)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `kksv0062Mapper.getKKSV006223SC(...)` // Retrieve service contract history |
| 2 | SET | `kksv006223scMap = kksv0062OutputMap.get("KKSV006223SC")` |
| 3 | SET | `eKK0081B024List = kksv006223scMap.get("EKK0081B024CBSMsg1List")` // Service contract history list |
| 4 | SET | `eKK0081B024Map = null` // Current history item |
| 5 | SET | `svcKeiStat = ""` // Service contract status |

**Block 14** — [FOR] Iterate through service contract history list (L825)

> Iterate through the service contract history list to check if any contract is in "service provision in progress" state (svc_kei_stat = "100"). If found, set svcTkRrkFlg to "1" and break.

| # | Type | Code |
|---|------|------|
| 1 | SET | `for (int i = 0; i < eKK0081B024List.size(); i++)` // Loop through history items |
| 2 | SET | `eKK0081B024Map = eKK0081B024List.get(i)` // Get current history item |
| 3 | SET | `svcKeiStat = eKK0081B024Map.get("svc_kei_stat")` // Get service contract status code |

**Block 14.1** — [IF] Check for active service contract (L832)

> If svc_kei_stat equals "100" (Service Provision in Progress), set the service provision history flag to "1" and break the loop. This indicates the customer currently has an active service contract.

| # | Type | Code |
|---|------|------|
| 1 | SET | `[-> SVC_KEI_STAT_100 = "100"]` (Service Provision in Progress) |
| 2 | EXEC | `JKKCommonConst.SVC_KEI_STAT_100.equals(svcKeiStat)` // Check if service is actively provisioned |
| 2.1 | SET | `svcTkRrkFlg = "1"` // Set flag: service provision history exists |
| 2.2 | RETURN | `break` // Exit loop — active contract found |

**Block 15** — [SET] KKSV0463 setup — migration division selection with reason code switching (L843)

> KKSV0463 determines the migration division and switches the migration reason codes. Called with the fixed One Stop migration division (OS_IDO_DIV = "00031").

| # | Type | Code |
|---|------|------|
| 1 | SET | `kksv0463ParamMap.put(TELEGRAM_INFO_USECASE_ID, UCID_KKSV0463)` |
| 2 | SET | `kksv0463ParamMap.put(TELEGRAM_INFO_OPERATION_ID, OPID_KKSV0463OP)` |
| 3 | SET | `kksv0463Mapper = new KKSV0463_KKSV0463OPDBMapper()` |
| 4 | SET | `kksv0463Mapper.setKKSV046301SC(paramOsBean, inputMap, FUNC_CD_1, idoDiv)` // With migration division "00031" [-> OS_IDO_DIV] |
| 5 | EXEC | `invokeService(kksv0463ParamMap, kksv0463InputMap, kksv0463OutputMap)` // Execute KKSV0463 |

**Block 16** — [SET] KKSV0551 setup — migration reason broad classification switching (L854)

> KKSV0551 determines the migration reason broad classification. Called with the migration reason broad classification code (idoRsnDbriCd).

| # | Type | Code |
|---|------|------|
| 1 | SET | `kksv0551ParamMap.put(TELEGRAM_INFO_USECASE_ID, UCID_KKSV0551)` |
| 2 | SET | `kksv0551ParamMap.put(TELEGRAM_INFO_OPERATION_ID, OPID_KKSV0551OP)` |
| 3 | SET | `kksv0551Mapper = new KKSV0551_KKSV0551OPDBMapper()` |
| 4 | SET | `kksv0551Mapper.setKKSV055101SC(paramOsBean, inputMap, FUNC_CD_1, idoRsnDbriCd)` // With reason broad classification code |
| 5 | EXEC | `invokeService(kksv0551ParamMap, kksv0551InputMap, kksv0551OutputMap)` // Execute KKSV0551 |

**Block 17** — [IF] Migration reason code pair validation (L864)

> Validate that the migration reason broad classification code (from kksv0463 output) and medium classification code (idoRsnCbriCd) form a valid pair. If invalid, return error E5016.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `!JKKOneStopApiCommonUtil.checkIdoRsnCdPair(kksv0463OutputMap, kksv0551OutputMap, osBean, idoRsnDbriCd, idoRsnCbriCd)` // Validate reason code pair |
| 1.1 | EXEC | `JKKOneStopApiCommonUtil.setReturnXml(this, "E5016", warnList, funcCode, IF_ID)` // Set error XML with code E5016 — "Invalid migration reason code pair" |
| 1.2 | RETURN | `return false` // Validation failed |

**Block 18** — [IF] Service migration eligibility check (L872)

> Final check: determine if the service contract is eligible for migration based on all gathered data. If not eligible, return error E5002.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `!JKKOneStopApiCommonUtil.checkSvcKeiIdoPsb(kksv0062OutputMap, osBean, idoDiv)` // Check if service is migration-eligible |
| 1.1 | EXEC | `JKKOneStopApiCommonUtil.setReturnXml(this, "E5002", warnList, funcCode, IF_ID)` // Set error XML with code E5002 — "Service not eligible for migration" |
| 1.2 | RETURN | `return false` // Migration not permitted |

**Block 19** — [RETURN] All checks passed (L878)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true` // All validations passed — One Stop migration is permitted |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `sysid` | Field | System ID — unique identifier for a system/service instance in the One Stop API |
| `svc_kei_no` | Field | Service contract number — the customer's selected service contract identifier |
| `user_id` | Field | User ID — the customer's account identifier for authentication and validation |
| `ido_div` | Field | Migration division — classifies the type of migration (異動区分). Value "00031" means Option Setting |
| `ido_rsn_dbri_cd` | Field | Migration reason broad classification code — top-level migration reason category (異動理由大分類コード) |
| `ido_rsn_cbri_cd` | Field | Migration reason medium classification code — second-level migration reason category (異動理由中分類コード) |
| `opeDate` | Field | Operation date — the current business processing date used for data validation |
| `cdSbtList` | Field | Code subdivision list — list of code subdivisions obtained during KKSV0820 |
| `cdDivListMap` | Field | Code subdivision list map — map storing code subdivision results from KKSV082001CC |
| `prc_grp_cd` | Field | Processing group code — classifies the pricing/service type (e.g., 07=Mobile Wi-Fi, 08=EMobile, 09=UQ WiMAX, 10=Fixed Telephone) |
| `svc_kei_stat` | Field | Service contract status — status code of a service contract. "100" = Service Provision in Progress |
| `svcTkRrkFlg` | Field | Service provision history flag — "1" if any contract is actively provisioned, "0" otherwise |
| `E5002` | Error | Service migration eligibility error — the selected service is not eligible for migration |
| `E5013` | Error | SYSID not found — the system ID could not be validated |
| `E5014` | Error | Service contract number not found — the service contract number could not be validated |
| `E5015` | Error | User ID not found — the user ID could not be validated |
| `E5016` | Error | Invalid migration reason code pair — the broad and medium classification codes do not form a valid pair |
| One Stop (ワンストップ) | Business term | Japan Koku's One Stop API service — a unified interface for customers to perform multiple service migrations (porting, changes) in a single request |
| 異動 (Idō) | Business term | Migration/Porting — the process of transferring a service contract between providers or changing service options |
| KKSVxxxx | Screen code | Japan Koku service screen code prefix — KKSV0061, KKSV0062, KKSV0463, KKSV0551, KKSV0820 are screen SCs for service data retrieval and migration checks |
| KKIFE274 | Constant | Interface ID for One Stop migration checks |
| EKK0081A010CBS | CBS Code | Service provision record CBS — provides processing group code and service provision data |
| EKK0081B024CBS | CBS Code | Service contract history CBS — provides service contract history with status information |
| FUNC_CD_1 | Constant | Function code 1 — basic data retrieval |
| FUNC_CD_2 | Constant | Function code 2 — detailed data retrieval |
| FUNC_CD_3 | Constant | Function code 3 — supplementary data retrieval |
| FUNC_CD_6 | Constant | Function code 6 — special retrieval (used for contract status in KKSV006207) |
