[st] - fix: 입력단 날짜 데이터 값 없을 시 null 처리

This commit is contained in:
2026-06-30 15:56:47 +09:00
parent f50de743e3
commit 1236a24b61
9 changed files with 60 additions and 33 deletions
@@ -38,7 +38,7 @@ import type {
import type { SearchFormValues } from "@/components/type/SearchForm.type";
import { doList } from "@/components/util/column/input/DoList";
import { toGridRows } from "@/components/util/grid/gridFunction";
import { formatCompactYmdForGrid, toCompactYmd } from "@/components/util/grid/ymdFormat";
import { formatCompactYmdForGrid, toCompactYmdOrNull } from "@/components/util/grid/ymdFormat";
import { statisticsInputExcretaTreatmentFacilityApi } from "@/entities/statistics/api/input/statistics-input-excreta-treatment-facility-service";
import { statisticsInputSewSupplyRateApi } from "@/entities/statistics/api/input/statistics-input-sew-supply-rate-service";
import { statisticsApi } from "@/entities/statistics/api/statistics-service";
@@ -199,8 +199,8 @@ function toGridNumber(value: string | number | null | undefined): number {
return Number.isFinite(n) ? n : 0;
}
function toApiYmd(value: string | number | Date | null | undefined): string {
return toCompactYmd(value);
function toApiYmd(value: string | number | Date | null | undefined): string | null {
return toCompactYmdOrNull(value);
}
function resolveExcretaTreatmentFacilityAdmdst(
@@ -38,7 +38,7 @@ import type {
import type { SearchFormValues } from "@/components/type/SearchForm.type";
import { doList } from "@/components/util/column/input/DoList";
import { toGridRows } from "@/components/util/grid/gridFunction";
import { formatCompactYmdForGrid, toCompactYmd } from "@/components/util/grid/ymdFormat";
import { formatCompactYmdForGrid, toCompactYmdOrNull } from "@/components/util/grid/ymdFormat";
import { statisticsInputPumpingStationApi } from "@/entities/statistics/api/input/statistics-input-pumping-station-service";
import { statisticsInputSewSupplyRateApi } from "@/entities/statistics/api/input/statistics-input-sew-supply-rate-service";
import { statisticsApi } from "@/entities/statistics/api/statistics-service";
@@ -230,7 +230,7 @@ function buildPumpingStationSaveItem(
fcltNm: String(row.fcltNm ?? ""),
pumpSeNm: String(row.pumpSeNm ?? ""),
fcltPstnCn: String(row.fcltPstnCn ?? ""),
oprtngStrtYmd: toCompactYmd(row.oprtngStrtYmd),
oprtngStrtYmd: toCompactYmdOrNull(row.oprtngStrtYmd),
planMltvArea: toGridNumber(row.planMltvArea),
sndyArea: toGridNumber(row.sndyArea),
rainArea: toGridNumber(row.rainArea),
@@ -45,7 +45,7 @@ import { toGridRows } from "@/components/util/grid/gridFunction";
import {
formatCompactYmdForGrid,
normalizeOxYnValue,
toCompactYmd,
toCompactYmdOrNull,
} from "@/components/util/grid/ymdFormat";
import { statisticsInputSewageReservoirPumpApi } from "@/entities/statistics/api/input/statistics-input-sewage-reservoir-pump-service";
import { statisticsInputSewSupplyRateApi } from "@/entities/statistics/api/input/statistics-input-sew-supply-rate-service";
@@ -308,7 +308,7 @@ function buildSewageReservoirSaveItem(
fcltSn: fcltSn,
fcltNm: String(row.fcltNm ?? ""),
fcltPstnCn: String(row.fcltPstnCn ?? ""),
oprtngStrtYmd: toCompactYmd(row.oprtngStrtYmd),
oprtngStrtYmd: toCompactYmdOrNull(row.oprtngStrtYmd),
planDesignFreqCnt: toGridNumber(row.planDesignFreqCnt),
fldngPrvtnYn: normalizeOxYnValue(row.fldngPrvtnYn),
wqPlltnMtgtYn: normalizeOxYnValue(row.wqPlltnMtgtYn),
@@ -363,7 +363,7 @@ function buildRainfallPumpStationSaveItem(
fcltNm: String(row.fcltNm ?? ""),
fcltPstnCn: String(row.fcltPstnCn ?? ""),
fcltyKndCn: String(row.fcltyKndCn ?? ""),
oprtngStrtYmd: toCompactYmd(row.oprtngStrtYmd),
oprtngStrtYmd: toCompactYmdOrNull(row.oprtngStrtYmd),
planDesignFreqCnt: toGridNumber(row.planDesignFreqCnt),
wtrStrgZoneArea: toGridNumber(row.wtrStrgZoneArea),
rsvrYn: String(row.rsvrYn ? (row.rsvrYn === "무" ? "N" : "Y") : ""),
@@ -38,7 +38,7 @@ import { RecycledWaterStatusInpColumn } from "@/components/util/column/input/wat
import { TreatWaterReuseBusinessApprStatusInpColumn } from "@/components/util/column/input/waterReuse/TreatWaterReuseBusinessApprStatusInpColumn";
import { TreatWaterReuseDesignConstStatusInpColumn } from "@/components/util/column/input/waterReuse/TreatWaterReuseDesignConstStatusInpColumn";
import { toGridRows } from "@/components/util/grid/gridFunction";
import { formatCompactYmdForGrid, toCompactYmd } from "@/components/util/grid/ymdFormat";
import { formatCompactYmdForGrid, toCompactYmdOrNull } from "@/components/util/grid/ymdFormat";
import { statisticsInputWaterReuseApi } from "@/entities/statistics/api/input/statistics-input-water-reuse-service";
import { statisticsInputSewSupplyRateApi } from "@/entities/statistics/api/input/statistics-input-sew-supply-rate-service";
import { statisticsApi } from "@/entities/statistics/api/statistics-service";
@@ -297,8 +297,8 @@ function buildRecycledWaterStatusSaveItem(
bldgSeCn: String(row.bldgSeCn ?? "").trim(),
fcltPstnCn: String(row.fcltPstnCn ?? "").trim(),
lglTrgtYn: String(row.lglTrgtYn ?? "").trim(),
cmptnStrtYmd: toCompactYmd(row.cmptnStrtYmd),
oprtngStrtYmd: toCompactYmd(row.oprtngStrtYmd),
cmptnStrtYmd: toCompactYmdOrNull(row.cmptnStrtYmd),
oprtngStrtYmd: toCompactYmdOrNull(row.oprtngStrtYmd),
archWholArea: toGridNumber(row.archWholArea),
prcsCpct: toGridNumber(row.prcsCpct),
wtrUseQnt: toGridNumber(row.wtrUseQnt),
@@ -323,7 +323,7 @@ function buildRainFallUtilFactStatusSaveItem(
bdstTypCn: String(row.bdstTypCn ?? "").trim(),
fcltPstnCn: String(row.fcltPstnCn ?? "").trim(),
lglTrgtYn: String(row.lglTrgtYn ?? "").trim(),
cmptYmd: toCompactYmd(row.cmptYmd),
cmptYmd: toCompactYmdOrNull(row.cmptYmd),
instlAmt: toGridNumber(row.instlAmt),
rcptMynCn: String(row.rcptMynCn ?? "").trim(),
filtrPrcsFcltYnExpln: String(row.filtrPrcsFcltYnExpln ?? "").trim(),
@@ -347,7 +347,7 @@ function buildTreatWaterReuseDesignConstStatusSaveItem(
bplcNm: String(row.bplcNm ?? "").trim(),
rprsvNm: String(row.rprsvNm ?? "").trim(),
bplcPstnCn: String(row.bplcPstnCn ?? "").trim(),
coRegYmd: toCompactYmd(row.coRegYmd),
coRegYmd: toCompactYmdOrNull(row.coRegYmd),
rmrk: nullableTrimmedString(row.rmrk),
};
}
@@ -364,7 +364,7 @@ function buildTreatWaterReuseBusinessApprStatusSaveItem(
bplcNm: String(row.bplcNm ?? "").trim(),
rprsvNm: String(row.rprsvNm ?? "").trim(),
bplcPstnCn: String(row.bplcPstnCn ?? "").trim(),
coRegYmd: toCompactYmd(row.coRegYmd),
coRegYmd: toCompactYmdOrNull(row.coRegYmd),
rmrk: nullableTrimmedString(row.rmrk),
};
}
@@ -381,8 +381,8 @@ function buildPublicSewageTreatWaterReuseSaveItem(
wholPrcsQnt: toGridNumber(row.wholPrcsQnt),
lglYn: String(row.lglYn ?? "").trim(),
instlYn: String(row.instlYn ?? "").trim(),
oprtngStrtYmd: toCompactYmd(row.oprtngStrtYmd),
instlAprvYmd: toCompactYmd(row.instlAprvYmd),
oprtngStrtYmd: toCompactYmdOrNull(row.oprtngStrtYmd),
instlAprvYmd: toCompactYmdOrNull(row.instlAprvYmd),
rprcsFcltCpct: toGridNumber(row.rprcsFcltCpct),
mtcnsNm: String(row.mtcnsNm ?? "").trim(),
ruswtPplLen: toGridNumber(row.ruswtPplLen),
@@ -62,6 +62,14 @@ export function toCompactYmd(
return "";
}
/** 그리드·API 값 → 8자리 일자(yyyyMMdd). 없거나 유효하지 않으면 null */
export function toCompactYmdOrNull(
value: string | number | Date | null | undefined,
): string | null {
const compact = toCompactYmd(value);
return compact === "" ? null : compact;
}
/** 설치목적 등 O/X 표기 → 대문자 O 또는 X (그 외는 원문 유지) */
export function normalizeOxYnValue(
value: string | number | null | undefined,
@@ -97,8 +97,11 @@ export interface ExcretaTreatmentFacilityRequestParams {
*/
export type ExcretaTreatmentFacilitySaveItem = Omit<
ExcretaTreatmentFacilityItem,
"sggNm" | "verificationResult"
>;
"sggNm" | "verificationResult" | "cmptnStrtYmd" | "oprtngStrtYmd"
> & {
cmptnStrtYmd: string | null;
oprtngStrtYmd: string | null;
};
/** 분뇨처리시설(ST00070001) 저장 API 요청 */
export interface ExcretaTreatmentFacilitySaveRequest {
@@ -106,7 +106,10 @@ export type PumpingStationSaveItem = Omit<
| "exlnQnt"
| "drtwPumpGrssPpqty"
| "exlnPumpGrssPpqty"
>;
| "oprtngStrtYmd"
> & {
oprtngStrtYmd: string | null;
};
/** 펌프장(ST00050001) 저장 API 요청 */
export interface PumpingStationSaveRequest {
@@ -172,8 +172,10 @@ export interface SewageReservoirRequestParams {
*/
export type SewageReservoirSaveItem = Omit<
SewageReservoirItem,
"sggNm" | "verificationResult"
>;
"sggNm" | "verificationResult" | "oprtngStrtYmd"
> & {
oprtngStrtYmd: string | null;
};
/** 하수저류시설(ST00040001) 저장 API 요청 */
export interface SewageReservoirSaveRequest {
@@ -229,8 +231,10 @@ export interface SewageReservoirSubmitResponse {
*/
export type RainfallPumpStationSaveItem = Omit<
RainfallPumpStationItem,
"sggNm" | "verificationResult"
>;
"sggNm" | "verificationResult" | "oprtngStrtYmd"
> & {
oprtngStrtYmd: string | null;
};
/**
* 빗물펌프장(ST00040002) 저장 API 요청
@@ -113,8 +113,8 @@ export interface PublicSewageTreatWaterReuseSaveItem {
wholPrcsQnt: number;
lglYn: string;
instlYn: string;
oprtngStrtYmd: string;
instlAprvYmd: string;
oprtngStrtYmd: string | null;
instlAprvYmd: string | null;
rprcsFcltCpct: number;
mtcnsNm: string;
ruswtPplLen: number;
@@ -209,8 +209,11 @@ export type RecycledWaterStatusApiResponse = ApiResponse<RecycledWaterStatusResp
/** ST00100002 저장 — `saveList` / `deleteList` 항목 (`sggNm`·검증결과 제외) */
export type RecycledWaterStatusSaveItem = Omit<
RecycledWaterStatusItem,
"sggNm" | "verificationResult"
>;
"sggNm" | "verificationResult" | "cmptnStrtYmd" | "oprtngStrtYmd"
> & {
cmptnStrtYmd: string | null;
oprtngStrtYmd: string | null;
};
/** ST00100002 저장 API 요청 */
export interface RecycledWaterStatusSaveRequest {
@@ -300,8 +303,10 @@ export type RainFallUtilFactStatusApiResponse =
/** ST00100003 저장 — `saveList` / `deleteList` 항목 (`sggNm`·검증결과 제외) */
export type RainFallUtilFactStatusSaveItem = Omit<
RainFallUtilFactStatusItem,
"sggNm" | "verificationResult"
>;
"sggNm" | "verificationResult" | "cmptYmd"
> & {
cmptYmd: string | null;
};
/** ST00100003 저장 API 요청 */
export interface RainFallUtilFactStatusSaveRequest {
@@ -383,8 +388,10 @@ export type TreatWaterReuseDesignConstStatusApiResponse =
/** ST00100004 저장 — `saveList` / `deleteList` 항목 (`sggNm`·검증결과 제외) */
export type TreatWaterReuseDesignConstStatusSaveItem = Omit<
TreatWaterReuseDesignConstStatusItem,
"sggNm" | "verificationResult"
>;
"sggNm" | "verificationResult" | "coRegYmd"
> & {
coRegYmd: string | null;
};
/** ST00100004 저장 API 요청 */
export interface TreatWaterReuseDesignConstStatusSaveRequest {
@@ -467,8 +474,10 @@ export type TreatWaterReuseBusinessApprStatusApiResponse =
/** ST00100005 저장 — `saveList` / `deleteList` 항목 (`sggNm`·검증결과 제외) */
export type TreatWaterReuseBusinessApprStatusSaveItem = Omit<
TreatWaterReuseBusinessApprStatusItem,
"sggNm" | "verificationResult"
>;
"sggNm" | "verificationResult" | "coRegYmd"
> & {
coRegYmd: string | null;
};
/** ST00100005 저장 API 요청 */
export interface TreatWaterReuseBusinessApprStatusSaveRequest {