# Business Logic — JBSbatKKSmtvlIdoInfSksi.setOutMapNetUpd() [293 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKSmtvlIdoInfSksi` |
| Layer | Service (Batch) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKSmtvlIdoInfSksi.setOutMapNetUpd()

This method performs the **network-only smart balance (smbalance) discrepancy synchronization** processing — it generates and updates the discrepancy notification file (KDDI Discount Contract Discrepancy Notification) for network (internet) services. In K-Opticom's telecom operations, the "smbalance discrepancy sync" is a nightly batch reconciliation that compares K-Opticom's internal service contract records against KDDI's (partner carrier) records to detect mismatches such as missing contracts, timing discrepancies, or cancellation state differences.

The method handles the **network service path exclusively** (as opposed to the parallel `setOutMapTelUpd` which handles telephone services). It queries the internal `KK_T_TAJGSWKEI_TGKEI` table to find telco carrier service information, determines which telco line to use when multiple exist (by priority via `getTchiTelnoJun`), and builds a complete output record for the smart balance discrepancy notification file (`JBSbatKKIFM238`). If telco data exists, it also fetches and validates the previous KDDI discrepancy notification state from `KK_T_KDDI_WKEI_IDT` to ensure consistency.

The method follows a **builder pattern**: it constructs the output map incrementally through a series of `outMap.setString()` calls, each populating a specific file field with derived or queried data. It implements a **delegation pattern** by routing computation to helper methods (`getNetSvcSbt`, `getSvcKeiUmuFlg`, `getTelSvcSbt`, `getSvcDslYmd`, `convSvcChrgStaymd`, `setKjKrCncl`) that encapsulate service status determination logic. This is a **shared utility method** called by `mainProp()`, the batch entry point.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setOutMapNetUpd(netMap)"])

    START --> INIT["outMap = new JBSbatServiceInterfaceMap"]
    INIT --> FETCHTEL["Fetch telco info from KK_T_TAJGSWKEI_TGKEI
executeKK_T_TAJGSWKEI_TGKEI_KK_SELECT_002"]
    FETCHTEL --> COLLECTTEL["Collect all rows into telList"]
    COLLECTTEL --> TELCOUNT{"telList > 0?"}

    TELCOUNT -->|Yes| EXTRACT["Extract telco fields
(pcrsCd, tel1/2SvcChrgStaymd, tel1/2ShosaYmd)"]
    EXTRACT --> JUDGETEL{"getTchiTelnoJun(...) == 1?"}
    JUDGETEL -->|Yes| TEL0["telMap = telList.get(0)"]
    JUDGETEL -->|No| TEL1["telMap = telList.get(1)"]
    TEL0 --> DFLG
    TEL1 --> DFLG

    TELCOUNT -->|No| DFLGTRUE["dslFlg = true"]

    DFLG["Check DSL flag from telMap
DSL_TAJGS_TCH_YMD"]
    DFLGTRUE --> DSLCHK{"YMD_DEF.equals(TEL_TAJGS_TCH_YMD)?"}
    DFLG --> DSLCHK

    DSLCHK -->|Yes (20991231)| DFLGFALSE["dslFlg = false
(no telco data)"]
    DFLGFALSE --> COMMON
    DSLCHK -->|No (actual date)| DFLGTRUE2["dslFlg = true"]
    DFLGTRUE2 --> COMMON

    COMMON["outMapCommon(...) — common header setup
(netSvcSbt, prcGrpCd, pcrsCd, pplanCd)"]
    COMMON --> NETFIELDS["Set network output fields
(KDDI_WKEI_IDT_NO, JIGYOSHA_KEI_KNRI_NO, NET_SVC_KEI_UMU_FLG,
 NET_SVC_STP_FLG, NET_SVC_SBT, NET_SVC_MSKM_YMD,
 NET_SVC_CHRG_STAYMD, NET_SVC_DSL_YMD, NET_SVC_DLRE)"]

    NETFIELDS --> DSLFLGCHK{"dslFlg == true?"}

    DSLFLGCHK -->|Yes| FETCHIDT["Fetch previous KDDI notification
from KK_T_KDDI_WKEI_IDT
executeKK_T_KDDI_WKEI_IDT_KK_SELECT_002"]
    DSLFLGCHK -->|No| DEFTEL["Set default telco fields
UMU_ARI, SVC_STP_FLG_RIYO, TEL_SVC_1_SBT"]

    FETCHIDT --> IDTCHECK{"telTchMap != null?"}

    IDTCHECK -->|Yes| TELFIELDS["Extract telco fields from telMap
telPrgStat, telShosaClYmd, telSvcDslKisanYmd,
telSvcCancelYmd, telSvcPauseYmd,
telSmtvlDslCnclRsnCd, telSvcKeiStat"]
    IDTCHECK -->|No| TELMAPCHK

    TELFIELDS --> SETKJK["setKjKrCncl(telMap)
Set work provisional cancellation fields"]
    SETKJK --> TELSET["Set telco output fields
(TEL1_SVC_KEI_UMU_FLG, TEL1_SVC_STP_FLG,
 TEL1_SVC_SBT, TEL1_SVC_MSKM_YMD,
 TEL1_SVC_CHRG_STAYMD, TEL1_SVC_DSL_YMD,
 TEL1_SVC_DLRE)"]
    TELSET --> ERRCHECK1{"telKeiUmu != UMU_NASI?"}

    DEFTEL --> TELMAPCHK{"telMap != null?"}
    TELMAPCHK -->|Yes| TELCHRG["Set TEL1_SVC_MSKM_YMD, TEL1_SVC_CHRG_STAYMD
(convSvcChrgStaymd)"]
    TELMAPCHK -->|No| WRIBPRC
    TELCHRG --> WRIBPRC["Set WRIBPRC_GRP_CD from netMap"]

    ERRCHECK1 -->|Yes| ERRCHECK2{"telSvcDslYmd is null?"}
    ERRCHECK1 -->|No (UMU_NASI) | WRIBPRC
    ERRCHECK2 -->|Yes| ERRCHECK3{"telSvcDlre is null?"}
    ERRCHECK2 -->|No| WRIBPRC
    ERRCHECK3 -->|Yes| ERRSET["Set errFlg=true, return null
log error EKKB0010CW"]
    ERRCHECK3 -->|No| WRIBPRC
    ERRSET --> RETURN

    WRIBPRC --> UPDATE["updateTchNcsr1(netMap, dslFlg)
Update telco contract table"]
    UPDATE --> RETURN(["return outMap"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `netMap` | `JBSbatServiceInterfaceMap` | Input map carrying the network service contract data for a single customer record being processed. Contains service order identifiers (`KDDI_WKEI_IDT_NO`, `SMTVL_IDO_DTL_CD`, `SMTVL_DSL_CNCL_RSN_CD`), service contract fields (`SVC_KEI_NO`, `PRC_GRP_CD`, `PCRS_CD`, `PPLAN_CD`, `PRG_STAT`, `SHOSA_CL_YMD`, `SVC_DSL_KISAN_YMD`, `SVC_CANCEL_YMD`, `SVC_PAUSE_YMD`, `SVC_KEI_STAT`, `SHOSA_YMD`, `SVC_CHRG_STAYMD`), telco management number (`TAJGS_WRIB_KEI_NO`, `TAJGSWKEI_TGKEI_NO`, `KDDI_VAL_CD`), and provisional cancellation data (`KJ_KR_CNCL_FLG`, `KR_CNCL_UK_YMD`). This map originates from the batch entry point `mainProp()`. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `super.opeDate` | `String` | System processing date (used as SQL parameter for date-sliced queries) |
| `db_KK_T_TAJGSWKEI_TGKEI` | `JBSbatCommonDBInterface` | Database accessor for telco carrier service information table |
| `db_KK_T_KDDI_WKEI_IDT` | `JBSbatCommonDBInterface` | Database accessor for KDDI discount contract discrepancy notification table |
| `super.commonItem` | `JBSbatCommonItem` | Common batch processing item — used for logging and error flag setting |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `executeKK_T_TAJGSWKEI_TGKEI_KK_SELECT_002` | - | `KK_T_TAJGSWKEI_TGKEI` | Reads telco carrier service information (discount contract service target service) filtered by operation date and management numbers |
| R | `db_KK_T_TAJGSWKEI_TGKEI.selectNext()` | - | `KK_T_TAJGSWKEI_TGKEI` | Iterates through result set to collect all matching telco records |
| R | `getTchiTelnoJun` | - | - | Determines which telco line has priority (returns 1 for first line, 2 for second) based on service charge start date and review date |
| R | `netMap.getString(...)` | - | - | Reads input network map fields (SVC_KEI_NO, PRG_STAT, SHOSA_CL_YMD, etc.) |
| R | `telMap.get(...)` | - | - | Reads extracted telco line data (SHOSA_YMD, SVC_CHRG_STAYMD, SVC_KEI_NO, SVC_KEI_STAT, etc.) |
| - | `outMapCommon` | - | - | Sets common output header fields (netSvcSbt, prcGrpCd, pcrsCd, pplanCd) |
| - | `outMap.setString(...)` | - | - | Populates output map fields for the smart balance discrepancy file |
| R | `getSvcKeiUmuFlg` | - | - | Determines if network service contract exists (UMU_ARI="1" or UMU_NASI="0") based on PRG_STAT |
| R | `getSvcStpFlg` | - | - | Determines network service stop flag (0=using, 2=stopped) based on service usage flag |
| R | `getNetSvcSbt` | - | - | Determines network service type (smart balance target="000002" or non-target="000001") based on usage flag and plan code |
| R | `getTelSvcSbt` | - | - | Determines telco service type based on network service output fields |
| R | `convSvcChrgStaymd` | - | - | Converts service charge start date — handles null or default date conversion |
| R | `getSvcDslYmd` | - | - | Determines network/telco service cancellation date based on PRG_STAT, review dates, cancellation/pause dates, service status, and provisional cancellation data |
| R | `getSvcDlre` | - | - | Determines service cancellation reason code based on smtvlDslCnclRsnCd |
| R | `isNull` | - | - | Null check helper for string values (telSvcDslYmd, telSvcDlre) |
| R | `executeKK_T_KDDI_WKEI_IDT_KK_SELECT_002` | - | `KK_T_KDDI_WKEI_IDT` | Reads previous KDDI discount contract discrepancy notification record (when dslFlg=true) |
| R | `telTchMap.getString(...)` | - | `KK_T_KDDI_WKEI_IDT` | Reads fields from the fetched previous notification record |
| - | `setKjKrCncl` | - | - | Sets provisional cancellation fields (KJ_KR_CNCL_FLG, KR_CNCL_UK_YMD) into telMap |
| - | `commonItem.getLogPrint().printBusinessErrorLog` | - | - | Logs business error with code EKKB0010CW when validation fails |
| - | `super.commonItem.setErrFlg` | - | - | Sets global error flag to abort processing |
| U | `updateTchNcsr1` | - | `KK_T_TAJGSWKEI_TGKEI` | Updates telco contract table with the processed output data |

## 5. Dependency Trace

### Caller trace:

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: `JBSbatKKSmtvlIdoInfSksi.mainProp()` | `mainProp()` -> `setOutMapNetUpd(netMap)` | `updateTchNcsr1 [U] KK_T_TAJGSWKEI_TGKEI`, `setString [-] JBSbatKKIFM238 fields`, `getString [R] netMap fields`, `executeKK_T_TAJGSWKEI_TGKEI_KK_SELECT_002 [R] KK_T_TAJGSWKEI_TGKEI`, `executeKK_T_KDDI_WKEI_IDT_KK_SELECT_002 [R] KK_T_KDDI_WKEI_IDT`, `convSvcChrgStaymd [-] date conversion`, `setKjKrCncl [-] provisional cancellation` |

### Terminal operations trace (what this method ultimately calls):

| Terminal Operation | CRUD | Entity / DB | Business Description |
|--------------------|------|-------------|---------------------|
| `updateTchNcsr1` | U | `KK_T_TAJGSWKEI_TGKEI` | Updates telco contract service target service table with processed discrepancy data |
| `setString` | - | `JBSbatKKIFM238` output file fields | Writes network and telco service discrepancy fields to the output file |
| `getString` | R | `netMap` input fields | Reads service contract and notification identifiers from input map |
| `executeKK_T_TAJGSWKEI_TGKEI_KK_SELECT_002` | R | `KK_T_TAJGSWKEI_TGKEI` | Queries telco carrier service information |
| `executeKK_T_KDDI_WKEI_IDT_KK_SELECT_002` | R | `KK_T_KDDI_WKEI_IDT` | Queries previous KDDI discrepancy notification state |
| `convSvcChrgStaymd` | - | - | Converts service charge start date, handling null/default values |
| `setKjKrCncl` | - | - | Sets provisional cancellation fields into telco map |

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] `outMap = new JBSbatServiceInterfaceMap()` (L1471)

> Initializes the output map for the smart balance discrepancy notification file.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outMap = new JBSbatServiceInterfaceMap()` |

**Block 2** — [CALL] Fetch telco carrier info from KK_T_TAJGSWKEI_TGKEI (L1474–1483)

> Retrieves telco carrier service information for the given customer contract, used to determine if there's an associated telephone service and which line to prioritize.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param[] = {opeDate, opeDate, netMap.getString(TAJGS_WRIB_KEI_NO), netMap.getString(TAJGSWKEI_TGKEI_NO), opeDate, opeDate}` // Build SQL parameters from operation date and management numbers |
| 2 | CALL | `executeKK_T_TAJGSWKEI_TGKEI_KK_SELECT_002(param)` // Query KK_T_TAJGSWKEI_TGKEI with 6 params |
| 3 | CALL | `db_KK_T_TAJGSWKEI_TGKEI.selectNext()` // Get first result set row |
| 4 | SET | `telList = new ArrayList<HashMap>()` // Initialize collection for multiple telco records |
| 5 | WHILE | `while (rstMap != null) { telList.add((HashMap)rstMap.getMap()); rstMap = db.selectNext(); }` // Collect all rows |

**Block 3** — [IF] Branch on telco record count (L1485)

> When multiple telco carrier records exist, determine which line (first or second) is the primary one using priority logic based on service charge start date and review date.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (null != telList && telList.size() > 0)` // Has telco data |
| 2 | SET | `pcrsCd = telList.get(0).get(PCRS_CD)` // Get contract code from first line |
| 3 | SET | `tel1SvcChrgStaymd = telList.get(0).get(SVC_CHRG_STAYMD)` // Charge start date of first line |
| 4 | SET | `tel2SvcChrgStaymd = null` // Default: no second line |
| 5 | SET | `tel1ShosaYmd = telList.get(0).get(SHOSA_YMD)` // Review date of first line |
| 6 | SET | `tel2ShosaYmd = null` // Default: no second line |

**Block 3.1** — [IF-ELSE] Two or more telco lines exist (L1498)

> When a second telco line exists, extract its charge start date and review date for comparison.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (1 < telList.size())` // Second line exists |
| 2 | SET | `tel2SvcChrgStaymd = telList.get(1).get(SVC_CHRG_STAYMD)` // Charge start date of second line |
| 3 | SET | `tel2ShosaYmd = telList.get(1).get(SHOSA_YMD)` // Review date of second line |

**Block 3.2** — [IF-ELSE] Priority determination via getTchiTelnoJun (L1506)

> Determines which telco line to use as the primary. `getTchiTelnoJun` returns 1 when the first line has priority (based on service charge start date comparison and review date).

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (1 == getTchiTelnoJun(pcrsCd, tel1SvcChrgStaymd, tel2SvcChrgStaymd, tel1ShosaYmd, tel2ShosaYmd))` // First line is primary |
| 2 | SET | `telMap = telList.get(0)` // Use first telco line |
| 3 | ELSE | `telMap = telList.get(1)` // Use second telco line |

**Block 4** — [IF] DSL flag determination (L1520–1525)

> Checks if the telco contract has been dissolved (`DSL_TAJGS_TCH_YMD = 20991231`). If the dissolution date is the default "end of time" value, the contract has NOT been dissolved yet (dslFlg = true). Otherwise, it has been dissolved (dslFlg = false).

| # | Type | Code |
|---|------|------|
| 1 | SET | `dslFlg = true` // Default: not dissolved |
| 2 | IF | `if (YMD_DEF.equals((String)telMap.get(DSL_TAJGS_TCH_YMD)))` // `[YMD_DEF = "20991231"]` — default end date means still active |
| 3 | SET | `dslFlg = false` // Contract has been dissolved |

**Block 5** — [SET] Extract network service fields from netMap (L1533–1552)

> Reads all required service contract and notification data from the input map for building the output record.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcKeiNo = netMap.getString(SVC_KEI_NO)` // Service contract number |
| 2 | SET | `prcGrpCd = netMap.getString(PRC_GRP_CD)` // Pricing group code |
| 3 | SET | `pcrsCd = netMap.getString(PCRS_CD)` // Contract code |
| 4 | SET | `pplanCd = netMap.getString(PPLAN_CD)` // Pricing plan code |
| 5 | SET | `prgStat = netMap.getString(PRG_STAT)` // Program status (determines service existence) |
| 6 | SET | `shosaClYmd = netMap.getString(SHOSA_CL_YMD)` // Review closing date |
| 7 | SET | `svcDslKisanYmd = netMap.getString(SVC_DSL_KISAN_YMD)` // Service dissolution proposal date |
| 8 | SET | `svcCancelYmd = netMap.getString(SVC_CANCEL_YMD)` // Service cancellation date |
| 9 | SET | `svcPauseYmd = netMap.getString(SVC_PAUSE_YMD)` // Service suspension date |
| 10 | SET | `smtvlDslCnclRsnCd = netMap.getString(SMTVL_DSL_CNCL_RSN_CD)` // Smart balance dissolution reason code |
| 11 | SET | `svcKeiStat = netMap.getString(SVC_KEI_STAT)` // Service contract status (e.g., "220" stopped, "020" reviewed, "910" dissolved) |
| 12 | SET | `kjKrCnclFlg = netMap.getString(KJ_KR_CNCL_FLG)` // Work provisional cancellation flag |
| 13 | SET | `krCnclUkYmd = netMap.getString(KR_CNCL_UK_YMD)` // Provisional cancellation receipt date |

**Block 6** — [CALL] Common output setup (L1555)

> Sets common output header fields shared between network and telco processing.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `outMapCommon(outMap, svcKeiNo, prcGrpCd, pcrsCd, pplanCd)` |

**Block 7** — [SET] Set network output fields (L1556–1604)

> Populates the output map with network service discrepancy data. This is the core data transformation of the method.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outMap.setString(KDDI_WKEI_IDT_NO_NET, netMap.getString(KDDI_WKEI_IDT_NO))` // KDDI discount contract discrepancy number |
| 2 | SET | `outMap.setString(JIGYOSHA_KEI_KNRI_NO, netMap.getString(KDDI_JGS_KEI_KANRI_NO))` // Enterprise contract management number |
| 3 | SET | `netSvcKeiUmuFlg = getSvcKeiUmuFlg(prgStat)` // [UMU_NASI = "0", UMU_ARI = "1"] — service existence flag |
| 4 | SET | `outMap.setString(NET_SVC_KEI_UMU_FLG, netSvcKeiUmuFlg)` // Network service contract existence flag |
| 5 | SET | `outMap.setString(NET_SVC_STP_FLG, getSvcStpFlg(netSvcKeiUmuFlg))` // [SVC_STP_FLG_RIYO = "0"] — service stop flag |
| 6 | SET | `outMap.setString(NET_SVC_SBT, getNetSvcSbt(netSvcKeiUmuFlg, netMap.getString(EOHNT_PPLAN_TIKI_SKCD)))` // [NET_SVC_SBT_TG = "000002", NET_SVC_SBT_TGG = "000001"] — network service type |
| 7 | SET | `outMap.setString(NET_SVC_MSKM_YMD, netMap.getString(SHOSA_YMD))` // Network service application date |
| 8 | SET | `outMap.setString(NET_SVC_CHRG_STAYMD, convSvcChrgStaymd(netMap.getString(SVC_CHRG_STAYMD)))` // Converted charge start date |
| 9 | SET | `outMap.setString(NET_SVC_DSL_YMD, getSvcDslYmd(prgStat, shosaClYmd, svcDslKisanYmd, svcCancelYmd, svcPauseYmd, svcKeiStat, kjKrCnclFlg, krCnclUkYmd))` // Service dissolution date |
| 10 | SET | `outMap.setString(NET_SVC_DLRE, getSvcDlre(outMap, smtvlDslCnclRsnCd, "0"))` // Dissolution reason ("0" = network path) |

**Block 8** — [IF] DSL flag branching — telco processing path (L1607–1745)

> When the telco contract has NOT been dissolved (`dslFlg == true`), fetch and validate telco discrepancy notification data.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (dslFlg == true)` // Telco contract still active |

**Block 8.1** — [IF] Fetch previous KDDI notification when telMap exists (L1610–1623)

> If telMap was populated (telco data existed), query the previous KDDI discrepancy notification record.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (null != telMap && telMap.containsKey(SVC_KEI_NO))` // telMap has service contract number |
| 2 | SET | `idtParam[] = {netMap.getString(TAJGS_WRIB_KEI_NO), telMap.get(SVC_KEI_NO)}` // Notification lookup parameters |
| 3 | CALL | `executeKK_T_KDDI_WKEI_IDT_KK_SELECT_002(idtParam)` // Query KK_T_KDDI_WKEI_IDT |
| 4 | SET | `telTchMap = db_KK_T_KDDI_WKEI_IDT.selectNext()` // Get previous notification record |

**Block 8.2** — [IF] Process previous notification record (L1625)

> When a previous notification record exists, extract telco detail fields and validate them.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (telTchMap != null)` // Previous notification found |
| 2 | SET | `telPrgStat = telTchMap.getString(PRG_STAT)` |
| 3 | SET | `telShosaClYmd = telMap.get(SHOSA_CL_YMD)` |
| 4 | SET | `telSvcDslKisanYmd = telMap.get(SVC_DSL_KISAN_YMD)` |
| 5 | SET | `telSvcCancelYmd = telMap.get(SVC_CANCEL_YMD)` |
| 6 | SET | `telSvcPauseYmd = telMap.get(SVC_PAUSE_YMD)` |
| 7 | SET | `telSmtvlDslCnclRsnCd = telTchMap.getString(SMTVL_DSL_CNCL_RSN_CD)` |
| 8 | SET | `telSvcKeiStat = telMap.get(SVC_KEI_STAT)` // Service contract status |
| 9 | CALL | `setKjKrCncl(telMap)` // Set work provisional cancellation fields |
| 10 | SET | `telKjKrCnclFlg = telMap.get(KJ_KR_CNCL_FLG)` |
| 11 | SET | `telKrCnclUkYmd = telMap.get(KR_CNCL_UK_YMD)` |
| 12 | SET | `telSvcKeiUmuFlg = getSvcKeiUmuFlg(telPrgStat)` // Telco service existence flag |
| 13 | SET | `outMap.setString(TEL1_SVC_KEI_UMU_FLG, telSvcKeiUmuFlg)` |
| 14 | SET | `outMap.setString(TEL1_SVC_STP_FLG, getSvcStpFlg(telSvcKeiUmuFlg))` |
| 15 | SET | `outMap.setString(TEL1_SVC_SBT, getTelSvcSbt(outMap))` |
| 16 | SET | `outMap.setString(TEL1_SVC_MSKM_YMD, telMap.get(SHOSA_YMD))` |
| 17 | SET | `outMap.setString(TEL1_SVC_CHRG_STAYMD, convSvcChrgStaymd(telMap.get(SVC_CHRG_STAYMD)))` |
| 18 | SET | `outMap.setString(TEL1_SVC_DSL_YMD, getSvcDslYmd(telPrgStat, telShosaClYmd, telSvcDslKisanYmd, telSvcCancelYmd, telSvcPauseYmd, telSvcKeiStat, telKjKrCnclFlg, telKrCnclUkYmd))` |
| 19 | SET | `outMap.setString(TEL1_SVC_DLRE, getSvcDlre(outMap, telSmtvlDslCnclRsnCd, "1"))` // "1" = telco path |

**Block 8.3** — [IF] Error validation: service existence (L1692–1701)

> Validates that when telco service is indicated as existing (`TEL1_SVC_KEI_UMU_FLG != "0"`), the contract data is consistent. This prevents records where a service exists is claimed but contract data is missing.

| # | Type | Code |
|---|------|------|
| 1 | SET | `telKeiUmu = outMap.getString(TEL1_SVC_KEI_UMU_FLG)` |
| 2 | SET | `idtNo = outMap.getString(KDDI_WKEI_IDT_NO_NET)` |
| 3 | IF | `if (!UMU_NASI.equals(telKeiUmu))` // `[UMU_NASI = "0"]` — service exists |
| 4 | EXEC | `commonItem.getLogPrint().printBusinessErrorLog(EKKB0010CW, "KDDI_WKEI_IDT_NO: " + idtNo + ", no telco service contract")` // Business error |
| 5 | EXEC | `super.commonItem.setErrFlg(true)` // Set error flag |
| 6 | RETURN | `return null` // Abort processing |

**Block 8.4** — [IF] Error validation: dissolution date missing (L1703–1712)

> Validates that the telco service dissolution date is set. An existing service must have a dissolution date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `telSvcDslYmd = outMap.getString(TEL1_SVC_DSL_YMD)` |
| 2 | IF | `if (isNull(telSvcDslYmd))` // Null check |
| 3 | EXEC | `printBusinessErrorLog(EKKB0010CW, "KDDI_WKEI_IDT_NO: " + idtNo + ", telco service dissolution date not set")` |
| 4 | EXEC | `setErrFlg(true)` |
| 5 | RETURN | `return null` |

**Block 8.5** — [IF] Error validation: dissolution reason missing (L1714–1723)

> Validates that the telco service dissolution reason is set. An existing service must have a dissolution reason.

| # | Type | Code |
|---|------|------|
| 1 | SET | `telSvcDlre = outMap.getString(TEL1_SVC_DLRE)` |
| 2 | IF | `if (isNull(telSvcDlre))` // Null check |
| 3 | EXEC | `printBusinessErrorLog(EKKB0010CW, "KDDI_WKEI_IDT_NO: " + idtNo + ", telco service dissolution reason not set")` |
| 4 | EXEC | `setErrFlg(true)` |
| 5 | RETURN | `return null` |

**Block 9** — [ELSE] Default telco fields when dslFlg is false (L1725–1731)

> When the telco contract has been dissolved (`dslFlg == false`), set default telco output values: service exists with no stop, type = partner carrier telephone service.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outMap.setString(TEL1_SVC_KEI_UMU_FLG, UMU_ARI)` // `[UMU_ARI = "1"]` — service exists |
| 2 | SET | `outMap.setString(TEL1_SVC_STP_FLG, SVC_STP_FLG_RIYO)` // `[SVC_STP_FLG_RIYO = "0"]` — service in use |
| 3 | SET | `outMap.setString(TEL1_SVC_SBT, TEL_SVC_1_SBT)` // `[TEL_SVC_1_SBT = "100005"]` — partner carrier telephone service |

**Block 10** — [IF] Set telMap-derived fields when telMap exists (L1734–1742)

> When `telMap` is populated (telco data was found in KK_T_TAJGSWKEI_TGKEI), set additional telco-specific output fields from the extracted data.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (null != telMap)` // telMap has data |
| 2 | SET | `outMap.setString(TEL1_SVC_MSKM_YMD, telMap.get(SHOSA_YMD))` // Telco application date |
| 3 | SET | `outMap.setString(TEL1_SVC_CHRG_STAYMD, convSvcChrgStaymd(telMap.get(SVC_CHRG_STAYMD)))` // Converted charge start date |

**Block 11** — [SET] Set WRIBPRC_GRP_CD from netMap (L1743)

> Sets the discount service target contract code from the input map into the output.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outMap.setString(WRIBPRC_GRP_CD, netMap.getString(KDDI_VAL_CD))` |

**Block 12** — [CALL] Update telco contract table (L1747–1750)

> Persists the processed discrepancy data back to the telco contract table. This was moved earlier in the method (from after block 11 to before return) in version v11.01.00 to ensure the update happens before any potential early return.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `updateTchNcsr1(netMap, dslFlg)` |

**Block 13** — [RETURN] Return completed output map (L1752)

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

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `setOutMapNetUpd` | Method | Network-only smart balance discrepancy output and update processing |
| `netMap` | Field | Input map carrying network service contract data for one customer record |
| `outMap` | Field | Output map being built for the smart balance discrepancy notification file |
| `dslFlg` | Field | DSL (dissolution) flag — true means telco contract is still active (not dissolved) |
| `telList` | Field | Collection of all telco carrier service records for this customer |
| `telMap` | Field | Selected telco record map (one of the telList entries, chosen by priority) |
| `telTchMap` | Field | Previous KDDI discrepancy notification record from KK_T_KDDI_WKEI_IDT |
| `pcrsCd` | Field | Contract code (PCRS_CD) — identifies the customer's service contract type |
| `prgStat` | Field | Program status — determines service existence and state (e.g., registered, completed, error) |
| `svcKeiStat` | Field | Service contract status — "220" (stopped), "020" (reviewed), "910" (dissolved) |
| `svcKeiNo` | Field | Service contract number — unique internal identifier for a service contract |
| `svcChrgStaymd` | Field | Service charge start date — when billing begins for this service |
| `shosaClYmd` | Field | Review closing date — date when review process was completed |
| `shosaYmd` | Field | Review date — date of the review inspection |
| `shosaDslFinCdOk` | Field | Review dissolution completion code — "1" means dissolution OK |
| `smtvlDslCnclRsnCd` | Field | Smart balance dissolution reason code — why the service is being dissolved |
| `smtvlIdoDtlCd` | Field | Smart balance detail migration code — type of smart balance operation |
| `kjKrCnclFlg` | Field | Work provisional cancellation flag — whether a work provisional cancellation is pending |
| `krCnclUkYmd` | Field | Provisional cancellation receipt date — when provisional cancellation was received |
| `pcrscd` | Field | Pricing contract code |
| `pplanCd` | Field | Pricing plan code |
| `prcGrpCd` | Field | Pricing group code |
| `kddiWkeiIdtNo` | Field | KDDI discount contract discrepancy notification number |
| `jigyoshaKeiKnriNo` | Field | Enterprise contract management number |
| `taijsWribKeiNo` | Field | Telco discount contract management number |
| `tajgswKeiTgKeiNo` | Field | Telco service target service number |
| `kddiValCd` | Field | KDDI value code — discount service target contract code |
| `WRIBPRC_GRP_CD` | Field | Discount pricing group code in output file |
| `YMD_DEF` | Constant | Default date "20991231" — represents "no end date" or "still active" |
| `UMU_NASI` | Constant | "0" — service does NOT exist (unused) |
| `UMU_ARI` | Constant | "1" — service EXISTS (used) |
| `SVC_STP_FLG_RIYO` | Constant | "0" — service is in use (not stopped) |
| `TEL_SVC_1_SBT` | Constant | "100005" — partner carrier telephone service type code |
| `NET_SVC_SBT_TG` | Constant | "000002" — smart balance target network service type |
| `NET_SVC_SBT_TGG` | Constant | "000001" — non-smart-balance network service type |
| `STAT_STP_CHU` | Constant | "220" — service status: stopped |
| `STAT_SHOSA_ZM` | Constant | "020" — service status: reviewed |
| `STAT_DSL_ZM` | Constant | "910" — service status: dissolved |
| `EKKB0010CW` | Constant | Business error code — logged when telco service contract data is inconsistent |
| `KK_T_SVC_KEI` | DB Table | Service contract information table — internal K-Opticom service records |
| `KK_T_TAJGSWKEI_TGKEI` | DB Table | Telco discount contract service target service table — telco carrier service data |
| `KK_T_KDDI_WKEI_IDT` | DB Table | KDDI discount contract discrepancy notification table — partner notification records |
| `KK_T_SVC_KEI_UCWK` | DB Table | Service contract detail work table — service line item details |
| `KU_T_KOJIAK` | DB Table | Work project table — provisional cancellation / work data |
| `KKIFM238` | File | Smart balance discrepancy notification file format definition class |
| Smart Balance (smbalance) | Business term | K-Opticom's service management platform that handles customer service orders including registration, migration, and cancellation |
| Discrepancy Sync (Fudo Renkai) | Business term | Nightly batch reconciliation between K-Opticom's internal records and KDDI's records to detect mismatches |
| Discrepancy Notification (Wkei Tsuuchi) | Business term | File sent to KDDI reporting differences found during reconciliation |
| Provisional Cancellation (Kari Cancel) | Business term | Temporary cancellation processing — a placeholder state before final cancellation |
| Service Charge Start Date (Kinka Kaishi YMD) | Business term | Date when billing/service charges begin for a service contract |
| Dissolution (Kaisan) | Business term | Service contract cancellation/termination |
| Telco (Denwa) | Business term | Telephone service (as distinct from network/internet service) |
| Review (Shosa) | Business term | Inspection/review process in the service order lifecycle |
| `getTchiTelnoJun` | Method | Determine priority order of telco lines — returns 1 for first priority, 2 for second |
| `getSvcKeiUmuFlg` | Method | Determine service contract existence flag based on program status |
| `getSvcStpFlg` | Method | Determine service stop flag (0=in use, 2=stopped) based on usage flag |
| `getNetSvcSbt` | Method | Determine network service type code (smart balance target or not) |
| `getTelSvcSbt` | Method | Determine telco service type code based on network output fields |
| `getSvcDslYmd` | Method | Determine service dissolution date based on multiple status/date fields |
| `getSvcDlre` | Method | Determine service dissolution reason code |
| `convSvcChrgStaymd` | Method | Convert service charge start date — handles null and default date values |
| `setKjKrCncl` | Method | Set provisional cancellation fields into telco map |
| `outMapCommon` | Method | Set common output header fields (netSvcSbt, prcGrpCd, pcrsCd, pplanCd) |
| `updateTchNcsr1` | Method | Update telco contract table with processed discrepancy data |
| `mainProp` | Method | Batch entry point that calls setOutMapNetUpd and setOutMapTelUpd |
