지도점검 등록 날짜 형태에 . 들어올경우 제거

This commit is contained in:
leedj312
2025-05-21 10:03:54 +09:00
parent df153c94dd
commit 4703fab8e9
3 changed files with 28 additions and 14 deletions
@@ -87,6 +87,11 @@ export const buildingToExcelType = (
export const excelToRainChkData = (excelData: any, year: string) => {
const rainChkgdData: rainChkZodType[] = excelData.map((item: any) => {
if (item["점검일"] !== undefined) {
const checkYmd = item["점검일"].replace(/\./g, "")
let vltnDt = item["과태료 부과일(위반일)"]
if (vltnDt !== undefined) {
vltnDt = vltnDt .replace(/\./g, "")
}
const makeGuidDetail = Array.from({ length: 12 }, (_, i) => {
let month = `${i + 1}`;
const splyData = item[`보급_${month}월`];
@@ -95,16 +100,17 @@ export const excelToRainChkData = (excelData: any, year: string) => {
return {
utztnUsgCd: item["이용용도"],
ym: year + month,
chckYmd: item["점검일"],
splyUswtrUtztnQnt: splyData !== "" ? splyData : 0,
ruseFcltUtztnQnt: ruseData !== "" ? ruseData : 0,
chckYmd: checkYmd,
splyUswtrUtztnQnt: splyData !== undefined ? splyData : 0,
ruseFcltUtztnQnt: ruseData !== undefined ? ruseData : 0,
flg: "RNB",
};
});
return {
bdstRuseFcltFk: Number(item["NO"]),
chckYmd: item["점검일"],
chckYmd: checkYmd,
spwtPositn: item["유량측정방법"],
rgtr: TEST_UUID,
oilqMeasMthd: item["운영관리형태"],
@@ -118,7 +124,7 @@ export const excelToRainChkData = (excelData: any, year: string) => {
trbt: Number(item["탁도"]) ?? 0,
grssClfg: Number(item["총대장균군수"]) ?? 0,
etc: item["기타"] ?? "", // 필드 누락 방지
vltnDt: item["과태료 부과일(위반일)"],
vltnDt: vltnDt,
vltnMttr: item["위반사항"],
levyAmt: Number(item["과태료부과금액(천원)"]) ?? 0,
rgtr: TEST_UUID,
@@ -127,6 +127,9 @@ export const excelToRswtGuideData = (excelData: any, year: string) => {
const rainChkgdData: rswtChkZodType[] = excelData
.map((item: any) => {
if (item["점검일"] !== undefined) {
const checkYmd = item["점검일"].replace(/\./g, "")
const makeGuidDetail = Array.from({ length: 12 }, (_, i) => {
let month = `${i + 1}`;
const splyData = item[`대체수_${month}월`];
@@ -134,7 +137,7 @@ export const excelToRswtGuideData = (excelData: any, year: string) => {
if (month.length < 2) month = "0" + month;
return {
ym: year + month,
chckYmd: item["점검일"],
chckYmd: checkYmd,
splyUswtrUtztnQnt: splyData !== "" ? splyData : 0,
ruseFcltUtztnQnt: rswtData !== "" ? rswtData : 0,
};
@@ -142,7 +145,7 @@ export const excelToRswtGuideData = (excelData: any, year: string) => {
return {
bdstRuseFcltFk: Number(item["NO"]),
chckYmd: item["점검일"],
chckYmd:checkYmd,
utztnUsgCd: item["이용용도"],
spwtPositn: item["유량측정방법"],
rgtr: TEST_UUID,
@@ -163,7 +166,14 @@ export const excelToRswtPolution = (excelData: any, year: string) => {
const rainChkgdData: rswtChkZodType[] = excelData
.map((item: any) => {
if (item["점검일"] !== undefined) {
console.log("item ", item)
const checkYmd = item["점검일"].replace(/\./g, "")
let vltnDt = item["과태료 부과일(위반일)"]
if (vltnDt !== undefined) {
vltnDt = vltnDt .replace(/\./g, "")
}
const makePoluttion = Array.from({ length: 4 }, (_, i) => {
let quarter = `${i+1}`;
const grssClfgUswtr = item[`${quarter}분기_총대장균군수`];
@@ -180,7 +190,7 @@ export const excelToRswtPolution = (excelData: any, year: string) => {
return {
node: quarter,
chckYmd: item["점검일"],
chckYmd: checkYmd,
grssClfgUswtr: grssClfgUswtr !== "" ? grssClfgUswtr : 0,
combResdch: combResdch !== "" ? combResdch : 0,
trbt: trbt !== "" ? trbt : 0,
@@ -198,7 +208,7 @@ export const excelToRswtPolution = (excelData: any, year: string) => {
return {
bdstRuseFcltFk: Number(item["NO"]),
chckYmd: item["점검일"],
chckYmd: checkYmd,
utztnUsgCd: item["이용용도"],
spwtPositn: item["유량측정방법"],
rgtr: TEST_UUID,
@@ -210,7 +220,7 @@ export const excelToRswtPolution = (excelData: any, year: string) => {
rswtrDetails: [
{
utztnUsgCd: item["이용용도"],
vltnDt: item["과태료 부과일(위반일)"],
vltnDt:vltnDt,
vltnMttr: item["위반사항"],
levyAmt: Number(item["과태료 부과금액(천원)"]) ?? 0,
rgtr: TEST_UUID,
@@ -98,9 +98,6 @@ export default function ChkgdExcel({ type }: { type: string }) {
}
});
console.log("total data ", totalData)
console.log("polutionData data ", polutionData)
const guideKey = new Set(guideData.map(keyGenerator));
const onlypolution = polutionData.filter(
@@ -146,6 +143,7 @@ export default function ChkgdExcel({ type }: { type: string }) {
});
return;
} else {
rainChkExcelDataUPload(excelData as rainChkZodType[]);
}
} else if (type === "RST") {