# Business Logic — JKKTelnoInfoAddCC.executeHtelTelnoAdd() [4089 LOC]

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

## 1. Role

### JKKTelnoInfoAddCC.executeHtelTelnoAdd()

This method implements the **Hootel (Fiber Phone) / Number Addition processing** (光電話・番号追加処理). It is the central orchestration method for adding a new phone number to a fiber-optic broadband customer's existing service contract within the K-Opticom eo customer infrastructure system.

The method handles two primary service categories based on the `idoDiv` (migration division) field: (1) **Plain number addition** (IDO_DIV_HTELNOADD = "13") where a customer requests an additional phone number to an existing contract, and (2) **Address migration with number addition** (IDO_DIV_ADCHGADD = "16" / IDO_DIV_ADCHGFIX = "17") where a customer is moving and adding a phone number simultaneously.

The method implements a **routing/dispatch design pattern** — it first performs a series of read/consistency checks against multiple service contracts and agreements, then branches into distinct registration paths: (a) temporary registration (kariTourokuFlg ON), (b) direct registration (kariTourokuFlg OFF), and (c) equipment provider provisioning (newVAFlg true) triggering multi-router and home gateway setup.

The method serves as a **shared utility** called primarily by JKKAdchgTelInfoChgCC.addTelnoInfo() for address-change-related phone number additions.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeHtelTelnoAdd(handle, param, fixedText)"])
    START --> INIT["init(param, fixedText)"]
    INIT --> EXTRACT["Extract target data: funcCode, idoDiv, svcKeiNo, svcKeiUcwkNo, telno, bmpUm, kariTourokuFlg, newTaknkikiModelCd, newKikiChgNo, dobanitenNo, portNo, sysid, bmpKojiKiboYmdH"]
    EXTRACT --> EKK0081["EKK0081A010: Service Contract Agreement"]
    EKK0081 --> GET_RESULTS["Get svcKeiStat, svcStaYmd, svcChrgStaymd, pplanCd, tkHoshikiKeiNo, pcrsCd"]
    GET_RESULTS --> CHECK_IDO{"idoDiv equals ADCHGADD or ADCHGFIX?"}
    CHECK_IDO -->|Yes: Address migration| EXTRACT_PPLAN["Extract pplanCd, tkHoshikiKeiNo, seikyKeiNo from param"]
    CHECK_IDO -->|No: Plain number addition| EKK0191["EKK0191A010: Service Detail Agreement (eo Phone)"]
    EXTRACT_PPLAN --> CHECK_SEIKY{"seikyKeiNo is null?"}
    CHECK_SEIKY -->|Yes| CALL_SEIKY["EKK0491B005: Invoice Contract List by SYSID"]
    CHECK_SEIKY -->|No| EKK0191
    CALL_SEIKY --> SET_SEIKY["Set seikyKeiNo from result list"]
    SET_SEIKY --> EKK0191
    EKK0191 --> CHECK_SVCUCWK{"svcKeiUcwkNo is not null?"}
    CHECK_SVCUCWK -->|Yes| GET_BFTELNO["Get bfTelno, bfBmpUm, bfKikiChgNo, kk0191GeneAddDtm"]
    CHECK_SVCUCWK -->|No| WORK_MAP["Create work map with update timestamps"]
    GET_BFTELNO --> WORK_MAP
    WORK_MAP --> CHECK_KKTOKENVI{"kktkSvcKeiNo is not null?"}
    CHECK_KKTOKENVI -->|Yes| EKK0341A["EKK0341A010: Equipment Provider Service Contract"]
    CHECK_KKTOKENVI -->|No| SET_NEWVA["newVAFlg = true"]
    EKK0341A --> GET_EQUIP["Get kiki_seizo_no, kikiChgNo, kktkSvcCd2, tgTknKktkSvcKeiStat"]
    GET_EQUIP --> SET_NEWVA
    SET_NEWVA --> EKK0191B["EKK0191B001: Service Detail List by svcKeiNo"]
    EKK0191B --> FIND_1ST["Find 1st detail: bf_va_chg_model_cd, bf_va_chg_chg_no, svcKeiUcwkNo_1, MSKM_DTL_NO"]
    FIND_1ST --> CHECK_NEWVA{"newVAFlg is true?"}
    CHECK_NEWVA -->|Yes| EKK0341B["EKK0341B002: Equipment Provider Service List"]
    CHECK_NEWVA -->|No| CHECK_MSKM_DTL
    EKK0341B --> FIND_PREV["Find previous VA contract by kiki_chg_no match"]
    FIND_PREV --> EKK0341A_AGAIN["EKK0341A010 on previous VA if found"]
    EKK0341A_AGAIN --> CHECK_MSKM_DTL{"work has MSKM_DTL_NO?"}
    CHECK_MSKM_DTL -->|Yes| EKK0021["EKK0021A010: Application Detail Agreement"]
    CHECK_MSKM_DTL -->|No| CHECK_DOBA{"dobanitenNo is not null?"}
    EKK0021 --> GET_MSKM["Get mskmNo, kk0011UpdDtm, mskmYmd"]
    GET_MSKM --> CHECK_DOBA
    CHECK_DOBA -->|Yes| ETU0021["ETU0021A010: Number Portability Agreement"]
    CHECK_DOBA -->|No| EKK0251["EKK0251B003: Service Contract Line Detail List (current)"]
    ETU0021 --> EKK0251
    EKK0251 --> GET_KAISEN["Get svcKeiKaisenUcwkNo, kaisenAdCd"]
    GET_KAISEN --> EKK0301["EZM0301A010: Bureau Agreement (kyokuNo from telno prefix)"]
    EKK0301 --> EZM0091["EZM0091A010: Location Number Division Agreement"]
    EZM0091 --> INPUT_CHECK{"checkHtelTelnoAdd() returns error?"}
    INPUT_CHECK -->|Yes| RETURN_PARAM["Return param (error)"]
    INPUT_CHECK -->|No| CHECK_TELNO["checkTelno: Telno master check"]
    CHECK_TELNO --> TEL_ERROR{"ERR_ARI?"}
    TEL_ERROR -->|Yes| RETURN_PARAM2["Return param (error)"]
    TEL_ERROR -->|No| TEL_WARN{"WARNING_ARI?"}
    TEL_WARN -->|No| CHECK_ADDTEL{"telno changed AND bmpUm=ARI?"}
    TEL_WARN -->|Yes| UPD_TELNO["updTelno: Update telno master"]
    CHECK_ADDTEL -->|Yes| ADD_TELNO["addTelno: Add telno master"]
    CHECK_ADDTEL -->|No| CHECK_DELTEL{"bfTelno changed AND bfBmpUm=ARI?"}
    ADD_TELNO --> CHECK_DELTEL
    UPD_TELNO --> CHECK_DELTEL
    CHECK_DELTEL -->|Yes| DEL_TELNO["delTelno: Delete old telno master"]
    CHECK_DELTEL -->|No| CHECK_KARI{"kariTourokuFlg == FLG_ON?"}
    DEL_TELNO --> CHECK_KARI
    CHECK_KARI -->|Yes| ADD_KARI1["addKari: Temporary registration"]
    CHECK_KARI -->|No| ADD_KARI2["addKari: Direct registration"]
    ADD_KARI1 --> MULTI_ROUTER["Multi-router creation logic"]
    ADD_KARI2 --> FUNC1_CHECK{"funcCode == FUNC_CD_1?"}
    MULTI_ROUTER --> PROG_REG["addPrgHtelTelnoAdd: Progress registration"]
    PROG_REG --> END_RETURN["Return param"]
    FUNC1_CHECK --> SVC_STAT_CHECK{"svcKeiStat >= 030 (settlement)?"}
    SVC_STAT_CHECK -->|Yes| EKK0191C030["EKK0191C030: Service Detail Settlement"]
    SVC_STAT_CHECK -->|No| EKK0191C010["EKK0191C010: Service Detail Review"]
    EKK0191C030 --> STAT100{"svcKeiStat == 100 (in service)?"}
    EKK0191C010 --> UCWK_START["ucwkStartFlg = true"]
    STAT100 --> UCWK_START
    UCWK_START --> SIP_CHECK{"sip_user_id not null?"}
    SIP_CHECK -->|Yes| ADD_SIP["addSipUserId"]
    SIP_CHECK -->|No| PPLAN_CHECK{"pcrsCd == 2-ban?"}
    ADD_SIP --> PPLAN_CHECK
    PPLAN_CHECK -->|No| STAT100_PLAN{"svcKeiStat == 100?"}
    PPLAN_CHECK -->|Yes| SKIP_PLAN["Skip plan change"]
    STAT100_PLAN -->|Yes| EKK0081C110["EKK0081C110: Service Plan Change"]
    STAT100_PLAN -->|No| EKK0081C100["EKK0081C100: Handling Plan Change"]
    EKK0081C110 --> SOKUJI{"sokujiHaneiFlg AND (ADCHGADD or ADCHGFIX)?"}
    EKK0081C100 --> OPTIONS_SETUP["Option setup: Billing limit, Phone notification"]
    SOKUJI -->|Yes| EKK0081C120["EKK0081C120: Plan Change Confirm (immediate)"]
    SOKUJI -->|No| EKK0081C120_SKIP["Skip plan confirm"]
    EKK0081C120 --> END_RETURN3["Return param"]
    EKK0081C120_SKIP --> END_RETURN3
    OPTIONS_SETUP --> SETUP_B022["B022 phone notification option setup"]
    SETUP_B022 --> ADCHGFIX_OPT{"idoDiv == ADCHGFIX?"}
    ADCHGFIX_OPT -->|Yes| OPT_START_ALL["Start all options + sub-option activation"]
    ADCHGFIX_OPT -->|No| BMP_KOJI["BmpKoji: Phone line work registration"]
    OPT_START_ALL --> END_RETURN4["Return param"]
    BMP_KOJI --> ADD_TAIORRK["addTaiorrk: NTT application notification"]
    ADD_TAIORRK --> NOT_ADCHG{"not ADCHGADD/ADCHGFIX?"}
    NOT_ADCHG -->|Yes| EKK0021C040["EKK0021C040: Application Detail Change"]
    NOT_ADCHG -->|No| END_RETURN5["Return param"]
    EKK0021C040 --> EKK0021C060["EKK0021C060: Application Detail Review"]
    EKK0021C060 --> END_RETURN5
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | handle | SessionHandle | Session manager handle containing database connections, transaction context, and user identity information. Used for all SC service calls. |
| 2 | param | IRequestParameterReadWrite | Parameter object containing the model group data (target data maps, work maps) and control map (error codes, message queues). All extracted business fields (telno, svcKeiNo, funcCode, etc.) are read from or written back to this object. |
| 3 | fixedText | String | User-defined string used as a data key to identify the target data section within the param object. Passed to init(), used to extract trgtData, and propagated through subsidiary methods. |

### Instance Fields Read

| Field | Type | Business Description |
|-------|------|---------------------|
| telInfoMapper | JKKTelnoInfoAddMapperCC | Mapper component providing all input message construction methods (editInMsgEKK*, editInMsgEZM*, etc.) and template management for SC calls. |
| check_tel_status | String | Protected field storing the result of telno master validation (ERR_NASI=0, WARNING_ARI=1, ERR_ARI=2). Used across the method for conditional branching. |
| global_fixedText | String | Protected field set by init(), stores the fixedText for use in subsidiary methods. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | telInfoMapper.editInMsgEKK0081A010 + callSvcInter | EKK0081A010SC | KK_T_SVC_KEI | Service Contract Agreement — retrieves service status, billing start date, pricing plan code, package contract number, and provider code. |
| R | telInfoMapper.editInMsgEKK0191A010 + callSvcInter | EKK0191A010SC | KK_T_SVC_KEI_UCWK | Service Detail Agreement (eo Phone) — retrieves previous phone number, bmp flag, and VA equipment change number. |
| R | telInfoMapper.editInMsgEKK0491B005 + callSvcInter | EKK0491B005SC | KK_T_SEIKY_KEI | Invoice Contract List by SYSID — used during address migration to retrieve invoice contract number. |
| R | telInfoMapper.editInMsgEKK0341A010 + callSvcInter | EKK0341A010SC | KK_T_KKTK_SVC_KEI | Equipment Provider Service Contract — retrieves equipment production number, equipment change number, service code, and service status. |
| R | telInfoMapper.editInMsgEKK0341B002 + callSvcInter | EKK0341B002SC | KK_T_KKTK_SVC_KEI | Equipment Provider Service List — lists all equipment provider services for a given service number. |
| R | telInfoMapper.editInMsgEKK0191B001 + callSvcInter | EKK0191B001SC | KK_T_SVC_KEI_UCWK | Service Detail List by svcKeiNo — iterates to find the 1st service detail and previous VA model code. |
| R | telInfoMapper.editInMsgEKK0021A010 + callSvcInter | EKK0021A010SC | KK_T_MSKM_DTL | Application Detail Agreement — retrieves application number and last update timestamp. |
| R | telInfoMapper.editInMsgETU0021A010 + callSvcInter | ETU0021A010SC | KK_T_DOBA | Number Portability Agreement — checks portability status for number port-in cases. |
| R | telInfoMapper.editInMsgEKK0251B003 + callSvcInter | EKK0251B003SC | KK_T_SVC_KEI_Kaisen | Service Contract Line Detail List (current) — retrieves continuation work number and location address code. |
| R | telInfoMapper.editInMsgEZM0301A010 + callSvcInter | EZM0301A010SC | ZM_M_KYOKU | Bureau Agreement — retrieves number section code from the first 6 digits of the phone number. |
| R | telInfoMapper.editInMsgEZM0091A010 + callSvcInter | EZM0091A010SC | ZM_M_NO_KUKAKU | Location Number Division Agreement — validates location/number division for the given address. |
| U | telInfoMapper.editInMsgEKK0191C030 + callSvcInter | EKK0191C030SC | KK_T_SVC_KEI_UCWK | Service Detail Settlement — settles the service detail after contract completion. |
| U | telInfoMapper.editInMsgEKK0191C010 + callSvcInter | EKK0191C010SC | KK_T_SVC_KEI_UCWK | Service Detail Review — reviews the service detail when not yet at settlement. |
| U | telInfoMapper.editInMsgEKK0191C050 + callSvcInter | EKK0191C050SC | KK_T_SVC_KEI_UCWK | Service Detail Use Start — starts the service detail usage when all conditions are met. |
| U | telInfoMapper.editInMsgEKK0081C110 + callSvcInter | EKK0081C110SC | KK_T_KK0081_PLAN | Service Plan Change — changes the billing plan for the service contract. |
| U | telInfoMapper.editInMsgEKK0081C100 + callSvcInter | EKK0081C100SC | KK_T_KK0081_PLAN | Service Handling Plan Change — changes the handling plan when not yet in service. |
| U | telInfoMapper.editInMsgEKK0081C120 + callSvcInter | EKK0081C120SC | KK_T_KK0081_PLAN | Plan Change Confirm — confirms the plan change for immediate reflection (address migration case). |
| U | telInfoMapper.editInMsgEKK0161A010 + callSvcInter | EKK0161A010SC | KK_T_SVC_KEI_UCWK | Service Detail Agreement (for option setup) — retrieves the latest service detail status. |
| R | telInfoMapper.editInMsgEKK0351B002 + callSvcInter | EKK0351B002SC | KK_T_OP_SVC_KEI | Option Service Contract List — searches for existing billing limit notification option (B072) or phone notification option (B022). |
| C | telInfoMapper.editInMsgEKK0371D010 + callSvcInter | EKK0371D010SC | KK_T_OP_SVC_KEI | Option Service Contract Registration — registers a new option service contract (billing limit or phone notification). |
| U | telInfoMapper.editInMsgEKK0371C030 + callSvcInter | EKK0371C030SC | KK_T_OP_SVC_KEI | Option Service Contract Review-Settlement — reviews and settles the option service contract. |
| U | telInfoMapper.editInMsgEKK0371C040 + callSvcInter | EKK0371C040SC | KK_T_OP_SVC_KEI | Option Service Contract Use Start — starts the option service for settlement-confirmed cases. |
| U | telInfoMapper.editInMsgEKK0371C010 + callSvcInter | EKK0371C010SC | KK_T_OP_SVC_KEI | Option Service Contract Review — reviews the option service contract when not yet settled. |
| U | telInfoMapper.editInMsgEKK0351C220 + callSvcInter | EKK0351C220SC | KK_T_OP_SVC_KEI | Option Service Contract Cancel — cancels an existing phone notification option when duplicate phone number is added. |
| U | telInfoMapper.editInMsgEKK0351B001 + callSvcInter | EKK0351B001SC | KK_T_OP_SVC_KEI | Option Service Contract List (by detail) — lists all options for address migration confirmation case. |
| U | telInfoMapper.editInMsgEKK0021C040 + callSvcInter | EKK0021C040SC | KK_T_MSKM_DTL | Application Detail Change — changes application detail info after direct registration. |
| U | telInfoMapper.editInMsgEKK0021C060 + callSvcInter | EKK0021C060SC | KK_T_MSKM_DTL | Application Detail Review and Follow-up Request — requests follow-up processing for application details. |
| U | telInfoMapper.editInMsgEKK0341C030 + callSvcInter | EKK0341C030SC | KK_T_KKTK_SVC_KEI | Equipment Provider Service Contract Review — reviews the equipment provider service contract. |
| U | telInfoMapper.editInMsgEKK0341C040 + callSvcInter | EKK0341C040SC | KK_T_KKTK_SVC_KEI | Equipment Provider Service Contract Settlement — settles the equipment provider service contract. |
| U | telInfoMapper.editInMsgEKK0341C050 + callSvcInter | EKK0341C050SC | KK_T_KKTK_SVC_KEI | Equipment Provider Service Contract Use Start — starts the equipment provider service. |
| U | telInfoMapper.editInEKK0341C330 + callSvcInter | EKK0341C330SC | KK_T_KKTK_SVC_KEI | Equipment Provider Service Contract Cancel (pre-review) — cancels before settlement. |
| U | telInfoMapper.editInEKK0341C340 + callSvcInter | EKK0341C340SC | KK_T_KKTK_SVC_KEI | Equipment Provider Service Contract Cancellation — performs actual cancellation. |
| U | telInfoMapper.editInEKK0341C350 + callSvcInter | EKK0341C350SC | KK_T_KKTK_SVC_KEI | Equipment Provider Service Contract Cancellation (post-review) — cancels after settlement. |
| C | telInfoMapper.editInEKK0341D010 + callSvcInter | EKK0341D010SC | KK_T_KKTK_SVC_KEI | Equipment Provider Service Contract Registration — registers new equipment provider service. |
| U | telInfoMapper.editInMsgEKK0191C060 + callSvcInter | EKK0191C060SC | KK_T_SVC_KEI_UCWK | Service Detail Information Change — updates service detail with new equipment model and change number. |
| U | telInfoMapper.editInMsgEKK2811D010 + callSvcInter | EKK2811D010SC | KK_T_KKOP_SVC_KEI | Equipment Option Service Contract Registration — registers VA or router option service contract. |
| U | telInfoMapper.editInMsgEKK2811C030 + callSvcInter | EKK2811C030SC | KK_T_KKOP_SVC_KEI | Equipment Option Service Contract Review — reviews the equipment option service. |
| U | telInfoMapper.editInMsgEKK2811C050 + callSvcInter | EKK2811C050SC | KK_T_KKOP_SVC_KEI | Equipment Option Service Contract Use Start — starts the equipment option service. |
| R | telInfoMapper.editInMsgEKK2811B010 + callSvcInter | EKK2811B010SC | KK_T_KKOP_SVC_KEI | Equipment Option Service Contract List — lists equipment option services for multi-router validation. |
| R | telInfoMapper.editInMsgEKK0241B001 + callSvcInter | EKK0241B001SC | KK_T_SVC_KEI_Kaisen | Service Contract Line Detail List — lists service lines for equipment registration. |
| R | telInfoMapper.setECK0011A010 + callSvcInter | ECK0011A010SC | KK_T_KYAKU | Customer Search — searches customer by SYSID for equipment registration. |
| R | JKKBpCommon.searchKaisuwKktkSvcKei | EKK0341B504SC | KK_T_KKTK_SVC_KEI | Equipment Provider Service Consultation Search — searches for multi-router services. |
| R | callSvcInter (EKK1681B001) | EKK1681B001SC | KK_T_IDO_RSV | Migration Reservation List — finds migration reservation records for cancellation. |
| U | callSvcInter (EKK1681C010) | EKK1681C010SC | KK_T_IDO_RSV | Migration Reservation Detail Change — updates migration reservation state to cleared. |
| R | callSvcInter (EDK0011B080) | EDK0011B080SC | KK_T_HAISO | Delivery List — lists deliveries for a service contract to check delivery status. |
| U | callSvcInter (S-IF: EKK0431C030) | EKK0431C030SC | KK_T_SBOP_SVC_KEI | Sub-option Service Contract Change — changes sub-option service during address migration confirmation. |
| U | callSvcInter (S-IF: EKK0431C040) | EKK0431C040SC | KK_T_SBOP_SVC_KEI | Sub-option Service Contract Use Start — starts sub-option service during address migration confirmation. |
| R | callSvcInter (EKK0401B001) | EKK0401B001SC | KK_T_SBOP_SVC_KEI | Sub-option Service Contract List — lists sub-option services for activation. |
| C | JKKAdchgOptionPackRunCC.adChgOptionPackMain | ANK-2056-00-00 | Multiple | Option Pack Registration during address change registration — registers option service packs for phone number addition. |
| R | JCCBPCommon.getOpeDate | - | - | Gets operation date for use in migration reservation update. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | JKKAdchgTelInfoChgCC | JKKAdchgTelInfoChgCC.addTelnoInfo() -> JKKTelnoInfoAddCC.executeHtelTelnoAdd | EKK0081A010SC [R] KK_T_SVC_KEI, EKK0191A010SC [R] KK_T_SVC_KEI_UCWK, EKK0341A010SC [R] KK_T_KKTK_SVC_KEI, EKK0081C110SC [U] KK_T_KK0081_PLAN, EKK0371D010SC [C] KK_T_OP_SVC_KEI |

**Terminal operations reached from this method:**
- getString [R] — EKK0191B001CBSMsg1List.SVC_KEI_UCWK_STAT, SVC_KEI_UCWK_NO, VA_TAKNKIKI_MODEL_CD, VA_KIKI_CHG_NO
- getString [R] — EKK0341B002CBSMsg1List.KKTK_SVC_CD, KKTK_SVC_KEI_NO
- getString [R] — EKK0341A010CBSMsg1List.KKTK_SVC_CD, KKTK_SVC_KEI_STAT
- getString [R] — EKK0241B001CBSMsg1List data
- getString [R] — EKK0351B002CBSMsg1List.OP_SVC_KEI_NO
- callSvcInter [-] — 50+ service component invocations
- editInMsgEKK0081C030 [U] — Equipment Provider Service Contract Change (via updatePcrsKkopSearch)
- executeOnuKojiAnken [-] — ONU construction inquiry (via called methods)
- updMskmShoDtlNoForOnuEx [-] — Application detail update for ONU (via called methods)
- setData [-] — Various data setting methods in subsidiary objects

## 6. Per-Branch Detail Blocks

**Block 1** — [IF] `idoDiv == IDO_DIV_ADCHGADD or IDO_DIV_ADCHGFIX` (L1327)

> When migrating address, extract pricing plan and package contract number directly from the param instead of relying on SC results, since the migration screen may not have this data populated.

| # | Type | Code |
|---|------|------|
| 1 | SET | pplanCd = trgtData.get(PPLAN_CD) // Extract from input param for address migration |
| 2 | SET | tkHoshikiKeiNo = trgtData.get(TK_HOSHIKI_KEI_NO) // Extract package contract number from input param |

**Block 2** — [IF] `idoDiv == ADCHGADD/ADCHGFIX AND seikyKeiNo is null` (L1346)

> During address change registration, if the invoice contract number is not set from the screen, query the invoice contract list by SYSID to find the correct invoice contract associated with the service contract.

| # | Type | Code |
|---|------|------|
| 1 | SET | template = new CAANMsg(EKK0491B005CBSMsg.class.getName()) // Create invoice contract template |
| 2 | EXEC | telInfoMapper.fillCAANMSGNullMapping(template, ...) // Initialize template with nulls |
| 3 | EXEC | telInfoMapper.editInMsgBasicCmn(param, template) // Set common parameters |
| 4 | SET | template.set(TEMPLATEID, "EKK0491B005") // Set SIF template ID |
| 5 | SET | template.set(FUNC_CODE, JPCModelConstant.FUNC_CD_1) // Set function code |
| 6 | SET | template.set(KEY_SYSID, sysid) // Set SYSID as key |
| 7 | EXEC | inMap = telInfoMapper.editInMsgCmn(param, template) // Build input message |
| 8 | CALL | outMapEKK0491B005 = callSvcInter(handle, param, inMap) // Call invoice contract list SC |
| 9 | EXEC | Loop through results to match svcKeiNo and extract seikyKeiNo |
| 10 | SET | trgtData.put(SEIKY_KEI_NO, seikyKeiNo) // Set the resolved invoice contract number |

**Block 3** — [IF] `!isNull(svcKeiUcwkNo)` (L1411)

> If a service detail number already exists, retrieve the previous phone number, bmp flag, and VA equipment change number to determine what changed.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | inMapEKK0191A010 = telInfoMapper.editInMsgEKK0191A010(param, svcKeiUcwkNo) |
| 2 | CALL | outMapEKK0191A010 = callSvcInter(handle, param, inMapEKK0191A010) |
| 3 | SET | svcKeiUcwkNoWork = svcKeiUcwkNo |
| 4 | SET | kk0191GeneAddDtm = getRsltMsgListValue(outMap, GENE_ADD_DTM) |
| 5 | SET | bfTelno = getRsltMsgListValue(outMap, TELNO) |
| 6 | SET | bfBmpUm = getRsltMsgListValue(outMap, BMP_UM) |
| 7 | SET | bfKikiChgNo = getRsltMsgListValue(outMap, VA_KIKI_CHG_NO) |

**Block 4** — [IF] `!isNull(kktkSvcKeiNo)` (L1472)

> If an equipment provider service contract exists, retrieve its details including equipment production number, change number, service code, and status.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | inMapEKK0341A010 = telInfoMapper.editInMsgEKK0341A010(param, kktkSvcKeiNo) |
| 2 | CALL | outMapEKK0341A010 = callSvcInter(handle, param, inMapEKK0341A010) |
| 3 | SET | chbf_kktsvkei_gene_add_dtm = getRsltMsgListValue(outMap, GENE_ADD_DTM) |
| 4 | SET | kiki_seizo_no = getRsltMsgListValue(outMap, KIKI_SEIZO_NO) |
| 5 | SET | kikiChgNo = getRsltMsgListValue(outMap, KIKI_CHG_NO) |
| 6 | SET | kktkSvcCd2 = getRsltMsgListValue(outMap, KKTK_SVC_CD) |
| 7 | SET | tgTknKktkSvcKeiStat = getRsltMsgListValue(outMap, KKTK_SVC_KEI_STAT) |

**Block 5** — [IF] `isNull(kktkSvcKeiNo)` (L1487)

> No equipment provider service contract exists. Set newVAFlg = true to trigger new equipment provisioning logic.

| # | Type | Code |
|---|------|------|
| 1 | SET | newVAFlg = true // No existing equipment provider service |

**Block 6** — [FOR] Iterate EKK0191B001 result list (L1518)

> Iterate through the service detail list to find the 1st (primary) service detail entry that is not in a terminated/cancelled state, capturing previous VA model code and change number.

| # | Type | Code |
|---|------|------|
| 1 | SET | rsltMsgEKK0191B001 = rsltMsgEKK0191B001List[i] |
| 2 | SET | tmpSvcKeiUcwkStat = getString(SVC_KEI_UCWK_STAT) |
| 3 | SET | tmpSvcKeiUcwkNo = getString(SVC_KEI_UCWK_NO) |
| 4 | IF | tmpSvcKeiUcwkStat NOT equal 910(Resigned) AND NOT 920(Cancelled) AND NOT equal svcKeiUcwkNo |
| 4.1 | SET | bf_va_chg_model_cd = getString(VA_TAKNKIKI_MODEL_CD) |
| 4.2 | SET | bf_va_chg_chg_no = getString(VA_KIKI_CHG_NO) |
| 4.3 | SET | svcKeiUcwkNo_1 = tmpSvcKeiUcwkNo // Store 1st detail number |
| 5 | IF | tmpSvcKeiUcwkNo equals svcKeiUcwkNo (current detail) |
| 5.1 | SET | work.put(MSKM_DTL_NO, getString(MSKM_DTL_NO)) // Store application detail number |

**Block 7** — [IF] `newVAFlg` (L1551)

> When new VA flag is true, search for the previous VA contract by equipment change number in the equipment provider service list.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | inMapEKK0341B002 = telInfoMapper.editInMsgEKK0341B002(param, svcKeiNo, FUNC_CD_1) |
| 2 | CALL | outMapEKK0341B002 = callSvcInter(handle, param, inMapEKK0341B002) |
| 3 | FOR | Iterate equipment provider service list |
| 3.1 | IF | bf_va_chg_chg_no equals current KIKI_CHG_NO |
| 3.1.1 | SET | bf_va_chg_kktk_svc_kei_no = getString(KKTK_SVC_KEI_NO) |
| 3.1.2 | SET | kiki_chg_no = getString(KIKI_CHG_NO) |
| 3.1.3 | BREAK | Found previous VA contract |
| 4 | IF | bf_va_chg_kktk_svc_kei_no is not null |
| 4.1 | EXEC | inMapEKK0341A010 = telInfoMapper.editInMsgEKK0341A010(param, bf_va_chg_kktk_svc_kei_no) |
| 4.2 | CALL | outMapEKK0341A010 = callSvcInter(handle, param, inMapEKK0341A010) |
| 4.3 | SET | kiki_seizo_no = getRsltMsgListValue(outMap, KIKI_SEIZO_NO) |

**Block 8** — [IF] `work has MSKM_DTL_NO` (L1606)

> When an application detail number exists, retrieve the application detail agreement and set the application number and update timestamps in the work map.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | inMapEKK0021A010 = telInfoMapper.editInMsgEKK0021A010(param, msdkmDtlNo) |
| 2 | CALL | tmpOutMapEKK0021A010 = callSvcInter(handle, param, inMapEKK0021A010) |
| 3 | SET | mskmNo = getRsltMsgListValue(outMap, MSKM_NO) |
| 4 | SET | work.put(KK0011_UPD_DTM, getRsltMsgListValue(outMap, LAST_UPD_DTM)) |
| 5 | SET | work.put(MSKM_YMD, getRsltMsgListValue(outMap, MSKM_YMD)) |
| 6 | SET | work.put(MSKM_NO, mskmNo) |

**Block 9** — [IF] `!isNull(dobanitenNo)` (L1631)

> When a number portability number is specified, execute the number portability agreement check.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | inMapETU0021A010 = telInfoMapper.editInMsgETU0021A010(param, dobanitenNo) |
| 2 | CALL | outMapETU0021A010 = callSvcInter(handle, param, inMapETU0021A010) |

**Block 10** — [IF] `checkHtelTelnoAdd()` returns error (L1681)

> When input validation fails, return the param immediately without proceeding with registration.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | checkHtelTelnoAdd(trgtData, outMapEKK0191A010, outMapETU0021A010, outMapEZM0091A010, funcCode, newVAFlg, handle, param, svcKeiNo) |
| 2 | RETURN | Return param (error detected) |

**Block 11** — [IF] `telno exists AND bmpUm == ARI` (L1697)

> When a phone number is specified with phone number feature enabled, validate the telno master.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | check_tel_status = checkTelno(handle, param, trgtData, telno) |
| 2 | IF | ERR_ARI -> Return param (error) |
| 3 | IF | WARNING_ARI AND telno changed -> updTelno (update telno master, ANK-4494-00-00 both-way support) |
| 4 | IF | telno changed AND bmpUm == ARI AND NOT WARNING_ARI -> addTelno (add telno master) |
| 5 | IF | bfTelno changed AND bfBmpUm == ARI AND NOT WARNING_ARI -> delTelno (delete old telno master) |

**Block 12** — [IF] `kariTourokuFlg == FLG_ON` (L1740)

> When temporary registration flag is ON, perform temporary registration processing including the new VA flag branch for multi-router creation during address migration confirmation.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | addKari(handle, param, fixedText, trgtData, kariTourokuFlg, funcCode, idoDiv, outMapEKK0191A010, tmpOutMapEKK0021A010, work, pplanCd, tkHoshikiKeiNo, svcKeiStat) |
| 2 | IF | funcCode == FUNC_CD_1 AND not address migration (IT1-2014-000023) |
| 2.1 | EXEC | Re-query service detail agreement and equipment provider service list |
| 2.2 | FOR | Determine VA1/VA2 port flags based on service codes (C004/C04 = VA1, C004/C05 = VA2) |
| 2.3 | IF | va1PortFlg AND !takinoFlg AND !va2PortFlg -> Create multi-router |
| 2.3.1 | EXEC | EKK0241B001: Service Contract Line Detail List |
| 2.3.2 | EXEC | ECK0011A010: Customer Search |
| 2.3.3 | EXEC | EKK0341D010: Equipment Provider Service Contract Registration |
| 2.3.4 | EXEC | EKK2811D010: VA2 Port Equipment Option Registration |
| 2.4 | IF | va1PortFlg AND takinoFlg AND (C024 or HGW) -> VA option validation |
| 2.4.1 | EXEC | EKK2811B010: Equipment Option Service List |
| 2.4.2 | IF | !vaOpFlg -> EKK2811D010: Register VA option |
| 2.5 | EXEC | EKK0341B504: Multi-router service consultation search |
| 2.6 | IF | C024 or HGW service code with active status -> takinoFlg = true |
| 3 | EXEC | addPrgHtelTelnoAdd(handle, param, fixedText, null, trgtData, svcKeiUcwkNo, mskmDtlNo, kariTourokuFlg) |

**Block 13** — [ELSE - kariTourokuFlg OFF] (L1874)

> Direct registration path without temporary registration flag. Executes full service settlement, plan change, option activation, and equipment provisioning in one pass.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | addKari(handle, param, fixedText, trgtData, kariTourokuFlg, funcCode, idoDiv, outMapEKK0191A010, tmpOutMapEKK0021A010, work, pplanCd, tkHoshikiKeiNo, svcKeiStat) |
| 2 | IF | funcCode == FUNC_CD_1 |
| 2.1 | IF | svcKeiStat >= 030 (settlement) -> EKK0191C030: Service Detail Settlement |
| 2.2 | IF | svcKeiStat == 100 (in service) AND (equipment produced OR address migration) AND !newVAFlg -> EKK0191C050: Service Detail Use Start |
| 2.3 | IF | sip_user_id exists -> addSipUserId(handle, param, trgtData, sip_user_id) |
| 2.4 | IF | idoDiv == ADCHGADD (address change registration) |
| 2.4.1 | EXEC | JKKAdchgOptionPackRunCC.adChgOptionPackMain: Register option packs for phone number addition |
| 2.5 | IF | pcrsCd == 2-ban -> Skip plan change |
| 2.6 | IF | svcKeiStat == 100 -> EKK0081C110: Service Plan Change |
| 2.6.1 | IF | sokujiHaneiFlg AND (ADCHGADD or ADCHGFIX) -> EKK0081C120: Plan Change Confirm |
| 2.7 | IF | svcKeiStat != 100 -> EKK0081C100: Handling Plan Change |
| 2.8 | IF | ANK-1578-00-00 (Takino router R0 or S0) -> updatePcrsKkopSearch + updateKkopPcrsImmidiate for immediate plan code change |
| 2.9 | IF | funcCode == FUNC_CD_1 |
| 2.9.1 | EXEC | EKK0161A010: Service Detail Agreement (for option setup) |
| 2.9.2 | EXEC | EKK0351B002 B072: Billing limit notification option search |
| 2.9.3 | IF | opSvcKeiNoB072 is null -> EKK0371D010: Register billing limit notification option |
| 2.9.4 | IF | settlement status -> EKK0371C030/C040: Option review-settlement/start |
| 2.9.5 | IF | B022 phone notification enabled -> EKK0371D010: Register phone notification option |
| 2.9.6 | IF | B022 exists -> EKK0351C220: Cancel existing B022 option |
| 2.9.7 | IF | idoDiv == ADCHGFIX -> Start all options + sub-option activation via S-IF (EKK0401, EKK0431) |
| 2.10 | IF | bmpUm == ARI AND NOT address migration -> EKK0191C050: Service Detail Use Start |
| 2.11 | IF | NOT ADCHGADD/ADCHGFIX AND tmpOutMapEKK0021A010 != null |
| 2.11.1 | EXEC | EKK0021C040: Application Detail Change |
| 2.11.2 | EXEC | EKK0021C060: Application Detail Review and Follow-up Request |
| 2.12 | IF | bmpUm == ARI -> addBmpKoji: Phone line work registration |
| 2.13 | IF | bmpUm == ARI -> addTaiorrk: NTT application notification |
| 2.14 | IF | newVAFlg -> Full multi-router/equipment provisioning path (EKK0341B002, EKK0241B001, ECK0011A010, EKK0341D010, EKK2811D010, EKK0341C050, EKK0191C060) |
| 2.15 | IF | NOT newVAFlg AND (C024 or C025) -> Full BBR router cancellation/registration path |

**Block 14** — [END] (L5304)

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

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| 光電話 (Kootel) | Field | Hootel / Fiber Phone — K-Opticom's fiber-optic telephone service using FTTH (Fiber To The Home) infrastructure |
| 番号追加 (Hango Tsuika) | Field | Number Addition — Adding a new phone number to an existing service contract |
| idoDiv | Field | Migration Division — Indicates the type of change: 13 (number addition), 16 (address change registration), 17 (address change confirmation) |
| svcKeiNo | Field | Service Contract Number — The primary identifier for a customer's broadband service contract |
| svcKeiUcwkNo | Field | Service Detail Number — The identifier for a service contract detail line item (e.g., phone line) |
| kktkSvcKeiNo | Field | Equipment Provider Service Contract Number — Identifies the physical equipment (home gateway, router) service associated with the broadband contract |
| telno | Field | Phone Number — The actual telephone number being added or modified |
| bmpUm | Field | Phone Number Feature Present/Absent — Flag indicating whether phone number service is enabled (ARI = present/true, NASI = absent/false) |
| kariTourokuFlg | Field | Temporary Registration Flag — When ON, records are created with a pending status; when OFF, records are committed directly |
| newVAFlg | Field | New VA Flag — True when no existing equipment provider service contract is found, triggering new equipment provisioning |
| bf_va_chg_model_cd | Field | Before-Change VA Model Code — The model code of the previous VA (Virtual Apartment/home gateway) equipment |
| bf_va_chg_chg_no | Field | Before-Change VA Change Number — The change tracking number of the previous VA equipment |
| bfTelno / bfBmpUm / bfKikiChgNo | Field | Previous Values — Store the phone number, bmp flag, and VA change number before the current operation, used to detect what changed |
| dobanitenNo | Field | Number Portability Number — Used when the customer is porting in a phone number from another carrier |
| portNo | Field | Port Number — The specific port number assigned when multiple phone numbers share a single VA (ANK-2953-00-00) |
| sysid | Field | System ID — Customer or location identifier used to look up invoice contracts and customer data |
| bmpKojiKiboYmdH | Field | Phone Line Work Request DateTime — When the customer requests a phone line construction/installation date |
| pplanCd | Field | Pricing Plan Code — The billing plan code for the service contract |
| tkHoshikiKeiNo | Field | Package Contract Number — The bundled service contract number for package deals |
| pcrsCd | Field | Provider Contract Code — Identifies the service provider and type (e.g., 2-ban = secondary line) |
| sip_user_id | Field | SIP User ID — Session Initiation Protocol user identifier for VoIP configuration |
| funcCode | Field | Function Code — Identifies the operation type: FUNC_CD_1 = general function, FUNC_CD_2 = screen function, FUNC_CD_8 = equipment search |
| sokujiHaneiFlg | Field | Immediate Reflection Flag — Controls whether plan changes take effect immediately or at the next billing cycle (ANK-4494-00-00, OM-2014-0001659) |
| EKK0081A010 | SC Code | Service Contract Agreement SC — Retrieves service contract status and billing start date |
| EKK0191A010 | SC Code | Service Detail Agreement (eo Phone) SC — Retrieves service detail information for phone lines |
| EKK0191B001 | SC Code | Service Detail List by Service Number SC — Lists all service detail lines for a service contract |
| EKK0341A010 | SC Code | Equipment Provider Service Contract SC — Retrieves equipment provider service contract details |
| EKK0341B002 | SC Code | Equipment Provider Service List SC — Lists equipment provider services |
| EKK0371D010 | SC Code | Option Service Contract Registration SC — Registers new option service contracts (billing limit notification, phone notification) |
| EKK0351B002 | SC Code | Option Service Contract List SC — Searches for existing option service contracts |
| EKK2811D010 | SC Code | Equipment Option Service Contract Registration SC — Registers VA or multi-router option services |
| EDK0011B080 | SC Code | Delivery List SC — Lists delivery records for equipment provisioning |
| EKK1681B001 | SC Code | Migration Reservation List SC — Lists migration reservations |
| EKK1681C010 | SC Code | Migration Reservation Detail Change SC — Updates migration reservation state |
| FTTH | Business term | Fiber To The Home — Fiber-optic broadband access technology connecting to the customer premises |
| VA | Acronym | Virtual Apartment / Home Gateway — The customer-premises equipment (CPE) providing WiFi/router functionality for the broadband service. Also referred to as "katukiki" (home equipment) |
| 多機能ルーター (Takino Router) | Business term | Multi-Function Router — A combined home gateway and router device. Service code C024 = Takino router, C025 = Home Gateway (eo Home Gateway), S0 = Takino (new model) |
| HGW | Acronym | Home Gateway — K-Opticom's branded home gateway/router device for FTTH services |
| BBR | Business term | BroadBand Route — Refers to the broadband network route/contract. Service code C004 = hootel VA service |
| 振舞い (Burumai) | Field | Service behavior/disposition — Refers to the service contract status and handling actions (review, settlement, cancellation) |
| 振舞変更 (Burumai Henkou) | Field | Service Behavior Change — Changing the service contract status through the settlement lifecycle |
| 照会 (Shoukai) | Field | Review/Inquiry — Service contract status indicating the contract has been reviewed but not yet settled |
| 締結 (Teikketsu) | Field | Settlement/Execution — Service contract status indicating the contract has been formally executed |
| 使用開始 (Shiyou Kaishi) | Field | Use Start — Service contract status indicating the service is actively in use |
| 解約 (Kaiyaku) | Field | Cancellation — Service contract cancellation |
| 仮登録 (Kari Touroku) | Field | Temporary Registration — A pending registration state where records are created but not yet finalized |
| NTT受付番号 | Field | NTT Reception Number — The number assigned by NTT when applying for phone line installation |
| 番ポ (Bampo) | Field | Phone Line Work / Installation — Short for "hanga po" (port number related work), referring to the physical phone line installation work ordered through NTT |
