조사사업 등록·결과 업로드 및 관로·맨홀 종합집계 화면 구현

This commit is contained in:
kiminchan
2026-07-23 17:06:01 +09:00
parent ec60a05b01
commit 477426c384
27 changed files with 3376 additions and 11 deletions
@@ -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,
};
});
};