조사사업 등록·결과 업로드 및 관로·맨홀 종합집계 화면 구현
This commit is contained in:
@@ -0,0 +1,210 @@
|
||||
/** Spring Page 응답에서 조사사업 화면이 사용하는 공통 페이징 계약이다. */
|
||||
export interface ExmnPage<T> {
|
||||
content: T[];
|
||||
totalElements: number;
|
||||
number: number;
|
||||
size: number;
|
||||
totalPages?: number;
|
||||
}
|
||||
|
||||
/** 조사사업 목록과 선택 컨텍스트에서 사용하는 사업 기본정보다. */
|
||||
export interface ExmnBusiness {
|
||||
exmnBizId: string;
|
||||
bizYr: string;
|
||||
bizNm: string;
|
||||
bizCycl: number | null;
|
||||
ctpvNm: string;
|
||||
sggNm: string;
|
||||
trtdstCnt: number;
|
||||
prcisExmnPrlg: number;
|
||||
tpco: number;
|
||||
bizRptpAtchFileCd?: string | null;
|
||||
bizRptpAtchFileId?: string | null;
|
||||
reportYn?: "Y" | "N";
|
||||
}
|
||||
|
||||
/** 사업에 연결된 활성 처리분구 정보다. */
|
||||
export interface ExmnBusinessDistrict {
|
||||
trtdstId: string;
|
||||
trtdstNm: string;
|
||||
pplExmnSheetNm?: string | null;
|
||||
mnhlExmnSheetNm?: string | null;
|
||||
}
|
||||
|
||||
/** 파일 구분별 첨부서비스 키 쌍이다. */
|
||||
export interface ExmnAttachmentKey {
|
||||
atflCd: string;
|
||||
atflId: string;
|
||||
fileName?: string;
|
||||
}
|
||||
|
||||
/** 조사사업 상세 응답이다. */
|
||||
export interface ExmnBusinessDetail extends ExmnBusiness {
|
||||
trtdstIds: string[];
|
||||
districts: ExmnBusinessDistrict[];
|
||||
attachments?: Partial<Record<ExmnFileType, ExmnAttachmentKey>>;
|
||||
}
|
||||
|
||||
/** 사업 목록의 입력 조건과 서버 페이징·정렬 조건이다. */
|
||||
export interface ExmnBusinessSearchParams {
|
||||
bizCycl?: string;
|
||||
bizYr?: string;
|
||||
ctpvNm?: string;
|
||||
sggNm?: string;
|
||||
bizNm?: string;
|
||||
page: number;
|
||||
size: number;
|
||||
sort?: string;
|
||||
}
|
||||
|
||||
/** 사업 신규 등록·수정 요청의 공통 계약이다. */
|
||||
export interface ExmnBusinessSaveRequest {
|
||||
bizYr: string;
|
||||
bizNm: string;
|
||||
bizCycl: number;
|
||||
ctpvNm: string;
|
||||
sggNm: string;
|
||||
prcisExmnPrlg: number;
|
||||
tpco: number;
|
||||
trtdstIds: string[];
|
||||
}
|
||||
|
||||
/** 처리분구별 PPL/MNHL 양식 시트 생성 결과다. */
|
||||
export interface ExmnTemplateResult {
|
||||
pplSheetNames: string[];
|
||||
mnhlSheetNames: string[];
|
||||
}
|
||||
|
||||
/** 조사사업에서 관리하는 파일의 업무 구분이다. */
|
||||
export type ExmnFileType =
|
||||
| "EXMN_EXCEL"
|
||||
| "PPL_EXMN_EXCEL"
|
||||
| "MNHL_EXMN_EXCEL"
|
||||
| "BIZ_REPORT"
|
||||
| "LOCATION_MAP";
|
||||
|
||||
/** 파일 검토에서 원본 위치까지 식별하는 단일 오류다. */
|
||||
export interface ExmnImportValidationError {
|
||||
sheetName?: string | null;
|
||||
rowNumber?: number | null;
|
||||
trtdstId?: string | null;
|
||||
trtdstNm?: string | null;
|
||||
gisManagementNo?: string | null;
|
||||
fieldPath?: string | null;
|
||||
code: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
/** PPL/MNHL 파일 검토 결과다. */
|
||||
export interface ExmnImportValidationResult {
|
||||
valid: boolean;
|
||||
fileHash: string;
|
||||
summary: {
|
||||
pplCount: number;
|
||||
mnhlCount: number;
|
||||
};
|
||||
errors: ExmnImportValidationError[];
|
||||
}
|
||||
|
||||
/** 최종 저장 후 시설·미사용·집계 처리 건수다. */
|
||||
export interface ExmnImportCommitResult {
|
||||
savedCount: number;
|
||||
unusedCount: number;
|
||||
summaryCount: number;
|
||||
}
|
||||
|
||||
/** 처리분구별 PPL 조사 집계 행이다. */
|
||||
export interface PplSummaryRow {
|
||||
trtdstId: string;
|
||||
trtdstNm: string;
|
||||
trgtPrlg: number;
|
||||
drvngDstnc: number;
|
||||
pplExmnWholAnmlyArtclCnt: number;
|
||||
pplExmnStrctDfcCnt: number;
|
||||
pplExmnOperDfcCnt: number;
|
||||
pplExmnEtcCnt: number;
|
||||
}
|
||||
|
||||
/** 조사현황 화면에서 관로(PPL)·맨홀(MNHL)을 구분하는 작업유형이다. */
|
||||
export type ExmnJobType = "PPL" | "MNHL";
|
||||
|
||||
/** 사업 선택 후 처리분구별 관로·맨홀 집계를 표시하는 조사 상세현황 행이다. */
|
||||
export interface ExmnSectionSummaryRow {
|
||||
trtdstId: string;
|
||||
trtdstNm: string;
|
||||
trgtPrlg: number;
|
||||
drvngDstnc: number;
|
||||
pplExmnWholAnmlyArtclCnt: number;
|
||||
pplExmnStrctDfcCnt: number;
|
||||
pplExmnOperDfcCnt: number;
|
||||
pplExmnEtcCnt: number;
|
||||
mnhlExmnWholAnmlyArtclCnt: number;
|
||||
mnhlExmnStrctDfcCnt: number;
|
||||
mnhlExmnOperDfcCnt: number;
|
||||
mnhlExmnEtcCnt: number;
|
||||
}
|
||||
|
||||
/** PPL 상세 목록 조회 조건이다. */
|
||||
export interface PplFacilitySearchParams {
|
||||
exmnBizId: string;
|
||||
trtdstId?: string;
|
||||
sectionType?: string;
|
||||
gisManagementNo?: string;
|
||||
structuralGrade?: string;
|
||||
operationalGrade?: string;
|
||||
defectType?: "ALL" | "STRUCTURAL" | "OPERATIONAL" | "ETC";
|
||||
page: number;
|
||||
size: number;
|
||||
sort?: string;
|
||||
}
|
||||
|
||||
/** 관로 단위 구간의 상태·결함 상세 기록이다. */
|
||||
export interface PplUnitDetail {
|
||||
detailSeq: number;
|
||||
positionM: number;
|
||||
code: string;
|
||||
recordType: "STATUS" | "DEFECT";
|
||||
statusGroup?: string | null;
|
||||
type?: "STRUCTURAL" | "OPERATIONAL" | null;
|
||||
severity?: string | null;
|
||||
occurrencePosition?: string | null;
|
||||
infiltrationBonus?: number | null;
|
||||
continuous?: boolean | null;
|
||||
structuralScore?: number | null;
|
||||
operationalScore?: number | null;
|
||||
}
|
||||
|
||||
/** 서버가 JSONB를 정규화해 반환하는 PPL 단위 구간이다. */
|
||||
export interface PplUnitSection {
|
||||
unitSeq: number;
|
||||
startPositionM: number;
|
||||
unitLengthM: number;
|
||||
structuralScore: number;
|
||||
structuralGrade: number | string;
|
||||
operationalScore: number;
|
||||
operationalGrade: number | string;
|
||||
surveyStopReason?: string | null;
|
||||
remark?: string | null;
|
||||
details: PplUnitDetail[];
|
||||
}
|
||||
|
||||
/** PPL 시설 목록과 상세 모달에서 사용하는 정규화 응답이다. */
|
||||
export interface PplFacility {
|
||||
exmnFcltyId: string;
|
||||
exmnBizId: string;
|
||||
trtdstId: string;
|
||||
trtdstNm: string;
|
||||
rptpNo: string;
|
||||
exmnFcltyGisMngNo: string;
|
||||
upstmMnhlNo?: string | null;
|
||||
dnstmMnhlNo?: string | null;
|
||||
drgptnCd?: string | null;
|
||||
pptyCd?: string | null;
|
||||
spcfctCd?: string | null;
|
||||
prlg?: number | null;
|
||||
drvngDstnc?: number | null;
|
||||
strctDfcGrdCd?: string | null;
|
||||
operDfcGrdCd?: string | null;
|
||||
wholAnmlyArtclCnt?: number | null;
|
||||
unitSections?: PplUnitSection[];
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
import type {
|
||||
ExmnBusiness,
|
||||
ExmnBusinessDetail,
|
||||
ExmnImportValidationResult,
|
||||
ExmnJobType,
|
||||
ExmnSectionSummaryRow,
|
||||
} from "./exmn-business-types";
|
||||
import type { TrtdstSettingDto } from "./trtdst-types";
|
||||
|
||||
/** 백엔드 데이터가 준비되기 전 명시적 sample=Y 화면 검증에서만 사용하는 조사사업 목록이다. */
|
||||
export const EXMN_SAMPLE_BUSINESSES: ExmnBusiness[] = [
|
||||
{
|
||||
exmnBizId: "SAMPLE-BIZ-001",
|
||||
bizYr: "2026",
|
||||
bizNm: "2026년 양평군 노후 하수관로 정밀조사사업",
|
||||
bizCycl: 3,
|
||||
ctpvNm: "경기도",
|
||||
sggNm: "양평군",
|
||||
trtdstCnt: 10,
|
||||
prcisExmnPrlg: 18.42,
|
||||
tpco: 1_250_000_000,
|
||||
reportYn: "Y",
|
||||
bizRptpAtchFileCd: "SAMPLE",
|
||||
bizRptpAtchFileId: "SAMPLE-REPORT-001",
|
||||
},
|
||||
{
|
||||
exmnBizId: "SAMPLE-BIZ-002",
|
||||
bizYr: "2025",
|
||||
bizNm: "2025년 이천시 하수관로 CCTV 조사사업",
|
||||
bizCycl: 2,
|
||||
ctpvNm: "경기도",
|
||||
sggNm: "이천시",
|
||||
trtdstCnt: 10,
|
||||
prcisExmnPrlg: 12.75,
|
||||
tpco: 890_000_000,
|
||||
reportYn: "N",
|
||||
},
|
||||
{
|
||||
exmnBizId: "SAMPLE-BIZ-003",
|
||||
bizYr: "2024",
|
||||
bizNm: "2024년 원주시 관로·맨홀 정밀조사사업",
|
||||
bizCycl: 1,
|
||||
ctpvNm: "강원특별자치도",
|
||||
sggNm: "원주시",
|
||||
trtdstCnt: 10,
|
||||
prcisExmnPrlg: 15.1,
|
||||
tpco: 1_030_000_000,
|
||||
reportYn: "Y",
|
||||
bizRptpAtchFileCd: "SAMPLE",
|
||||
bizRptpAtchFileId: "SAMPLE-REPORT-003",
|
||||
},
|
||||
{
|
||||
exmnBizId: "SAMPLE-BIZ-004",
|
||||
bizYr: "2023",
|
||||
bizNm: "2023년 청주시 하수관로 정밀조사사업",
|
||||
bizCycl: 4,
|
||||
ctpvNm: "충청북도",
|
||||
sggNm: "청주시",
|
||||
trtdstCnt: 10,
|
||||
prcisExmnPrlg: 9.86,
|
||||
tpco: 760_000_000,
|
||||
reportYn: "N",
|
||||
},
|
||||
];
|
||||
|
||||
/** 사업등록 팝업의 체크박스·가나다순 정렬을 검증하는 활성 처리분구 샘플이다. */
|
||||
export const EXMN_SAMPLE_TRTDST_SETTINGS: TrtdstSettingDto[] = [
|
||||
"갈산처리분구",
|
||||
"개군처리분구",
|
||||
"공흥처리분구",
|
||||
"국수처리분구",
|
||||
"단월처리분구",
|
||||
"덕평처리분구",
|
||||
"문호처리분구",
|
||||
"백안처리분구",
|
||||
"서종처리분구",
|
||||
"양근처리분구",
|
||||
"양동처리분구",
|
||||
"양서처리분구",
|
||||
"오빈처리분구",
|
||||
"용문처리분구",
|
||||
"용천처리분구",
|
||||
"지평처리분구",
|
||||
"청운처리분구",
|
||||
"회현처리분구",
|
||||
"강상처리분구",
|
||||
"강하처리분구",
|
||||
"옥천처리분구",
|
||||
].map((trtdstNm, index) => ({
|
||||
trtdstId: `SAMPLE-TRTDST-${String(index + 1).padStart(2, "0")}`,
|
||||
ctpvNm: "경기도",
|
||||
sggNm: "양평군",
|
||||
trtdstNm,
|
||||
useYn: "Y",
|
||||
}));
|
||||
|
||||
/** 선택 사업의 처리분구와 첨부 영역을 팝업에서 확인할 수 있도록 상세 샘플을 만든다. */
|
||||
export const getExmnSampleBusinessDetail = (
|
||||
exmnBizId: string,
|
||||
fallbackBusiness?: ExmnBusiness,
|
||||
): ExmnBusinessDetail => {
|
||||
const business = EXMN_SAMPLE_BUSINESSES.find((item) => item.exmnBizId === exmnBizId)
|
||||
?? fallbackBusiness
|
||||
?? EXMN_SAMPLE_BUSINESSES[0];
|
||||
const districts = EXMN_SAMPLE_TRTDST_SETTINGS.slice(0, business.trtdstCnt).map((item) => ({
|
||||
trtdstId: item.trtdstId,
|
||||
trtdstNm: item.trtdstNm,
|
||||
pplExmnSheetNm: `${item.trtdstNm}_PPL`,
|
||||
mnhlExmnSheetNm: `${item.trtdstNm}_MNHL`,
|
||||
}));
|
||||
|
||||
return {
|
||||
...business,
|
||||
trtdstIds: districts.map((item) => item.trtdstId),
|
||||
districts,
|
||||
};
|
||||
};
|
||||
|
||||
/** 결과등록 팝업의 데이터 검토·저장 활성 상태를 확인하는 정상 샘플 결과다. */
|
||||
export const EXMN_SAMPLE_IMPORT_VALIDATION: ExmnImportValidationResult = {
|
||||
valid: true,
|
||||
fileHash: "SAMPLE-FILE-HASH-PREVIEW",
|
||||
summary: {
|
||||
pplCount: 24,
|
||||
mnhlCount: 12,
|
||||
},
|
||||
errors: [],
|
||||
};
|
||||
|
||||
/** 조사현황의 사업 행 선택과 관로·맨홀 탭 전환을 검증하는 처리분구 집계 샘플이다. */
|
||||
export const getExmnSampleSectionSummaries = (
|
||||
exmnBizId: string,
|
||||
jobType: ExmnJobType,
|
||||
): ExmnSectionSummaryRow[] => {
|
||||
const business = EXMN_SAMPLE_BUSINESSES.find((item) => item.exmnBizId === exmnBizId)
|
||||
?? EXMN_SAMPLE_BUSINESSES[0];
|
||||
const districts = EXMN_SAMPLE_TRTDST_SETTINGS.slice(0, business.trtdstCnt);
|
||||
|
||||
return districts.map((district, index) => {
|
||||
const scale = index + 1;
|
||||
const pplStructural = 21 * scale;
|
||||
const pplOperational = 7 * scale;
|
||||
const pplEtc = 2 * scale;
|
||||
const mnhlStructural = 5 * scale;
|
||||
const mnhlOperational = 3 * scale;
|
||||
const mnhlEtc = scale;
|
||||
|
||||
return {
|
||||
trtdstId: district.trtdstId,
|
||||
trtdstNm: district.trtdstNm,
|
||||
trgtPrlg: Number((business.prcisExmnPrlg * 1000 / districts.length).toFixed(1)),
|
||||
drvngDstnc: Number((business.prcisExmnPrlg * 930 / districts.length).toFixed(1)),
|
||||
pplExmnWholAnmlyArtclCnt: jobType === "PPL" ? pplStructural + pplOperational + pplEtc : 0,
|
||||
pplExmnStrctDfcCnt: jobType === "PPL" ? pplStructural : 0,
|
||||
pplExmnOperDfcCnt: jobType === "PPL" ? pplOperational : 0,
|
||||
pplExmnEtcCnt: jobType === "PPL" ? pplEtc : 0,
|
||||
mnhlExmnWholAnmlyArtclCnt: jobType === "MNHL" ? mnhlStructural + mnhlOperational + mnhlEtc : 0,
|
||||
mnhlExmnStrctDfcCnt: jobType === "MNHL" ? mnhlStructural : 0,
|
||||
mnhlExmnOperDfcCnt: jobType === "MNHL" ? mnhlOperational : 0,
|
||||
mnhlExmnEtcCnt: jobType === "MNHL" ? mnhlEtc : 0,
|
||||
};
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user