fo: 총인시설여부 수정

This commit is contained in:
dongsilove
2026-01-07 11:15:43 +09:00
parent a0ad12af49
commit b57858c5ef
+72 -61
View File
@@ -749,14 +749,14 @@ const fetchMainGraph = async (searchYear: string | undefined, fcltyCd: string |
// 수질 데이터 청천시, 강우시 재계산
const calcWaterQltyData = async (data: any[], searchYear: string | undefined, fcltyCd: string | undefined, mainGraphData: any) => {
const operList = {
inflBod: {yearTot: 0, yearAvg: 0, yearMax: 0, yearMin: 9999999}, // 유입BOD
inflTN: {yearTot: 0, yearAvg: 0, yearMax: 0, yearMin: 9999999}, // 유입TN
inflTP: {yearTot: 0, yearAvg: 0, yearMax: 0, yearMin: 9999999}, // 유입TP
efflBod: {yearTot: 0, yearAvg: 0, yearMax: 0, yearMin: 9999999}, // 방류BOD
efflTN: {yearTot: 0, yearAvg: 0, yearMax: 0, yearMin: 9999999}, // 방류TN
efflTP: {yearTot: 0, yearAvg: 0, yearMax: 0, yearMin: 9999999}, // 방류TP
tpInflTp: {yearTot: 0, yearAvg: 0, yearMax: 0, yearMin: 9999999}, //총인 유입수질 TP(mg/L)
const operList = {
inflBod: { yearTot: 0, yearAvg: 0, yearMax: 0, yearMin: 9999999 }, // 유입BOD
inflTN: { yearTot: 0, yearAvg: 0, yearMax: 0, yearMin: 9999999 }, // 유입TN
inflTP: { yearTot: 0, yearAvg: 0, yearMax: 0, yearMin: 9999999 }, // 유입TP
efflBod: { yearTot: 0, yearAvg: 0, yearMax: 0, yearMin: 9999999 }, // 방류BOD
efflTN: { yearTot: 0, yearAvg: 0, yearMax: 0, yearMin: 9999999 }, // 방류TN
efflTP: { yearTot: 0, yearAvg: 0, yearMax: 0, yearMin: 9999999 }, // 방류TP
tpInflTp: { yearTot: 0, yearAvg: 0, yearMax: 0, yearMin: 9999999 }, //총인 유입수질 TP(mg/L)
};
const nullToZero = (value: any) => {
return value === null || value === undefined || value === '' ? 0 : Number(value);
@@ -962,11 +962,11 @@ const calcWaterQltyData = async (data: any[], searchYear: string | undefined, fc
operList.tpInflTp.yearAvg = operList.tpInflTp.yearTot / totalDay;
orgData[5].yearAvg = qltyDataSetting(operList.inflBod.yearTot, totalDay, 1); // 연간 유입BOD
orgData[6].yearAvg = qltyDataSetting(operList.efflBod.yearTot,totalDay, 1); // 연간 방류BOD
orgData[7].yearAvg = qltyDataSetting(operList.inflTN.yearTot,totalDay, 3); // 연간 유입TN
orgData[8].yearAvg = qltyDataSetting(operList.efflTN.yearTot,totalDay, 3); // 연간 방류TN
orgData[9].yearAvg = qltyDataSetting(operList.inflTP.yearTot,totalDay, 3); // 연간 유입TP
orgData[10].yearAvg = qltyDataSetting(operList.efflTP.yearTot,totalDay, 3); // 연간 방류TP
orgData[6].yearAvg = qltyDataSetting(operList.efflBod.yearTot, totalDay, 1); // 연간 방류BOD
orgData[7].yearAvg = qltyDataSetting(operList.inflTN.yearTot, totalDay, 3); // 연간 유입TN
orgData[8].yearAvg = qltyDataSetting(operList.efflTN.yearTot, totalDay, 3); // 연간 방류TN
orgData[9].yearAvg = qltyDataSetting(operList.inflTP.yearTot, totalDay, 3); // 연간 유입TP
orgData[10].yearAvg = qltyDataSetting(operList.efflTP.yearTot, totalDay, 3); // 연간 방류TP
//총인설비
orgData[11].yearAvg = qltyDataSetting(operList.tpInflTp.yearTot, noNullYearDay, 3); // 연간 총인 유입수질 TP
orgData[12].yearAvg = qltyDataSetting(operList.efflTP.yearTot, totalDay, 3); // 연간 총인 유입수질 TP
@@ -1060,7 +1060,7 @@ const calcWaterQltyData = async (data: any[], searchYear: string | undefined, fc
orgData[11].winterSunnyMin = chungchunTpInflMin === 99999999 ? '0.000' : roundUp(chungchunTpInflMin, 3).toFixed(3);
orgData[12].winterSunnyMin = chungchunEfflTpMin === 99999999 ? '0.000' : roundUp(chungchunEfflTpMin, 3).toFixed(3);
return orgData;
} else {
@@ -1463,27 +1463,37 @@ export const dashBoardReducer = (
// const res = await fetchOperationStatus(searchYear, fcltyCd); // /dashBoard/mngInfo/
// const data = res.data;
const operList = {
inFlow : {yearTot: 0, yearAvg: 0, yearMax: 0, yearMin: 9999999
const operList = {
inFlow: {
yearTot: 0, yearAvg: 0, yearMax: 0, yearMin: 9999999
, summerTot: 0, summerAvg: 0, summerRainy: 0, summerSunny: 0
, winterTot: 0, winterAvg: 0, winterSunny: 0, winterSunnyMax: 0, winterSunnyMin: 9999999
, groundTot: 0, groundSummer: 0, groundWinter: 0, rdii: 0, rdiiRainAmt: 0},
inflAmt: {yearTot: 0, yearAvg: 0, yearMax: 0, yearMin: 9999999, yearSunny: 0
, groundTot: 0, groundSummer: 0, groundWinter: 0, rdii: 0, rdiiRainAmt: 0
},
inflAmt: {
yearTot: 0, yearAvg: 0, yearMax: 0, yearMin: 9999999, yearSunny: 0
, summerTot: 0, summerAvg: 0, summerRainy: 0, summerSunny: 0
, winterTot: 0, winterAvg: 0, winterSunny: 0, winterSunnyMax: 0, winterSunnyMin: 9999999
, groundTot: 0, groundSummer: 0, groundWinter: 0, rdii: 0, rdiiRainAmt: 0},
sumFlow: {yearTot: 0, yearAvg: 0, yearMax: 0, yearMin: 9999999
, groundTot: 0, groundSummer: 0, groundWinter: 0, rdii: 0, rdiiRainAmt: 0
},
sumFlow: {
yearTot: 0, yearAvg: 0, yearMax: 0, yearMin: 9999999
, summerTot: 0, summerAvg: 0, summerRainy: 0, summerSunny: 0
, winterTot: 0, winterAvg: 0, winterSunny: 0, winterSunnyMax: 0, winterSunnyMin: 9999999
, groundTot: 0, groundSummer: 0, groundWinter: 0, rdii: 0, rdiiRainAmt: 0},
returnFlow: {yearTot: 0, yearAvg: 0, yearMax: 0, yearMin: 9999999
, groundTot: 0, groundSummer: 0, groundWinter: 0, rdii: 0, rdiiRainAmt: 0
},
returnFlow: {
yearTot: 0, yearAvg: 0, yearMax: 0, yearMin: 9999999
, summerTot: 0, summerAvg: 0, summerRainy: 0, summerSunny: 0
, winterTot: 0, winterAvg: 0, winterSunny: 0, winterSunnyMax: 0, winterSunnyMin: 9999999
, groundTot: 0, groundSummer: 0, groundWinter: 0, rdii: 0, rdiiRainAmt: 0},
efflFlow: {yearTot: 0, yearAvg: 0, yearMax: 0, yearMin: 9999999
, groundTot: 0, groundSummer: 0, groundWinter: 0, rdii: 0, rdiiRainAmt: 0
},
efflFlow: {
yearTot: 0, yearAvg: 0, yearMax: 0, yearMin: 9999999
, summerTot: 0, summerAvg: 0, summerRainy: 0, summerSunny: 0
, winterTot: 0, winterAvg: 0, winterSunny: 0, winterSunnyMax: 0, winterSunnyMin: 9999999
, groundTot: 0, groundSummer: 0, groundWinter: 0, rdii: 0, rdiiRainAmt: 0},
, groundTot: 0, groundSummer: 0, groundWinter: 0, rdii: 0, rdiiRainAmt: 0
},
};
const clone = (arr: any[]) => arr?.map(v => ({ ...v })) ?? [];
@@ -1492,11 +1502,11 @@ export const dashBoardReducer = (
if (operationalStatusList) {
// 유량 - 유입
if (operationalStatusList?.[0]) {
// 연계처리수
let yearDay = 0, summerDay = 0, winterDay = 0; // 연간 일수, 하절기 일수, 동절기 일수
let summerRainDay = 0, summerChungchunDay = 0, winterChungchuDay = 0; // 하절기 강우 일수, 하절기 청천 일수, 동절기 청천 일수
// 연계처리수,지하수유입량
const bscFctCd = fcltyCd;
const res2 = await fetchFlowRateModalList(bscFctCd, searchYear); // /fclt/flow/ - 일별 유량 조회
@@ -1506,7 +1516,7 @@ export const dashBoardReducer = (
let cntSunnyDay = 0; // 청천일 수
// let chungcunSumFlow = 0; // 연간 청천 순수하수
let rainEffectDay = 0;
yearDay = res2.data ? res2.data.length : 1;
res2.data.forEach((item: any) => { // --일별 유량 start
@@ -1516,7 +1526,7 @@ export const dashBoardReducer = (
const inflAmnt = item.inflAmnt && item.inflAmnt !== 'x' ? Number(item.inflAmnt.toString().trim()) : 0;
const returnAmnt = item.returnAmnt && item.returnAmnt !== 'x' ? Number(item.returnAmnt.toString().trim()) : 0;
const efflAmnt = item.efflAmnt && item.efflAmnt !== 'x' ? Number(item.efflAmnt.toString().trim()) : 0;
if (item.infoRnDay == null) item.infoRnDay = 0;
if (item.infoRnDay >= 3) {
rainEffectDay = 2;
@@ -1608,41 +1618,41 @@ export const dashBoardReducer = (
}); // --일별 유량 end
// 연간 평균
operList.inFlow.yearAvg = (yearDay > 0)? operList.inFlow.yearTot / yearDay : 0;
operList.inflAmt.yearAvg = (yearDay > 0)? operList.inflAmt.yearTot / yearDay : 0;
operList.sumFlow.yearAvg = (yearDay > 0)? operList.sumFlow.yearTot / yearDay : 0;
operList.returnFlow.yearAvg = (yearDay > 0)? operList.returnFlow.yearTot / yearDay : 0;
operList.efflFlow.yearAvg = (yearDay > 0)? operList.efflFlow.yearTot / yearDay : 0;
operList.inFlow.yearAvg = (yearDay > 0) ? operList.inFlow.yearTot / yearDay : 0;
operList.inflAmt.yearAvg = (yearDay > 0) ? operList.inflAmt.yearTot / yearDay : 0;
operList.sumFlow.yearAvg = (yearDay > 0) ? operList.sumFlow.yearTot / yearDay : 0;
operList.returnFlow.yearAvg = (yearDay > 0) ? operList.returnFlow.yearTot / yearDay : 0;
operList.efflFlow.yearAvg = (yearDay > 0) ? operList.efflFlow.yearTot / yearDay : 0;
// 하절기 전기간 평균
operList.inFlow.summerAvg = (summerDay > 0)? operList.inFlow.summerTot / summerDay : 0;
operList.inflAmt.summerAvg = (summerDay > 0)? operList.inflAmt.summerTot / summerDay : 0;
operList.sumFlow.summerAvg = (summerDay > 0)? operList.sumFlow.summerTot / summerDay : 0;
operList.returnFlow.summerAvg = (summerDay > 0)? operList.returnFlow.summerTot / summerDay : 0;
operList.efflFlow.summerAvg = (summerDay > 0)? operList.efflFlow.summerTot / summerDay : 0;
operList.inFlow.summerAvg = (summerDay > 0) ? operList.inFlow.summerTot / summerDay : 0;
operList.inflAmt.summerAvg = (summerDay > 0) ? operList.inflAmt.summerTot / summerDay : 0;
operList.sumFlow.summerAvg = (summerDay > 0) ? operList.sumFlow.summerTot / summerDay : 0;
operList.returnFlow.summerAvg = (summerDay > 0) ? operList.returnFlow.summerTot / summerDay : 0;
operList.efflFlow.summerAvg = (summerDay > 0) ? operList.efflFlow.summerTot / summerDay : 0;
// 하절기 강우시 평균
operList.inFlow.summerRainy = (summerRainDay > 0)? operList.inFlow.summerRainy / summerRainDay : 0;
operList.inflAmt.summerRainy = (summerRainDay > 0)? operList.inflAmt.summerRainy / summerRainDay : 0;
operList.sumFlow.summerRainy = (summerRainDay > 0)? operList.sumFlow.summerRainy / summerRainDay : 0;
operList.returnFlow.summerRainy = (summerRainDay > 0)? operList.returnFlow.summerRainy / summerRainDay : 0;
operList.efflFlow.summerRainy = (summerRainDay > 0)? operList.efflFlow.summerRainy / summerRainDay : 0;
operList.inFlow.summerRainy = (summerRainDay > 0) ? operList.inFlow.summerRainy / summerRainDay : 0;
operList.inflAmt.summerRainy = (summerRainDay > 0) ? operList.inflAmt.summerRainy / summerRainDay : 0;
operList.sumFlow.summerRainy = (summerRainDay > 0) ? operList.sumFlow.summerRainy / summerRainDay : 0;
operList.returnFlow.summerRainy = (summerRainDay > 0) ? operList.returnFlow.summerRainy / summerRainDay : 0;
operList.efflFlow.summerRainy = (summerRainDay > 0) ? operList.efflFlow.summerRainy / summerRainDay : 0;
// 하절기 청천시 평균
operList.inFlow.summerSunny = (summerChungchunDay > 0)? operList.inFlow.summerSunny / summerChungchunDay : 0;
operList.inflAmt.summerSunny = (summerChungchunDay > 0)? operList.inflAmt.summerSunny / summerChungchunDay : 0;
operList.sumFlow.summerSunny = (summerChungchunDay > 0)? operList.sumFlow.summerSunny / summerChungchunDay : 0;
operList.returnFlow.summerSunny = (summerChungchunDay > 0)? operList.returnFlow.summerSunny / summerChungchunDay : 0;
operList.efflFlow.summerSunny = (summerChungchunDay > 0)? operList.efflFlow.summerSunny / summerChungchunDay : 0;
operList.inFlow.summerSunny = (summerChungchunDay > 0) ? operList.inFlow.summerSunny / summerChungchunDay : 0;
operList.inflAmt.summerSunny = (summerChungchunDay > 0) ? operList.inflAmt.summerSunny / summerChungchunDay : 0;
operList.sumFlow.summerSunny = (summerChungchunDay > 0) ? operList.sumFlow.summerSunny / summerChungchunDay : 0;
operList.returnFlow.summerSunny = (summerChungchunDay > 0) ? operList.returnFlow.summerSunny / summerChungchunDay : 0;
operList.efflFlow.summerSunny = (summerChungchunDay > 0) ? operList.efflFlow.summerSunny / summerChungchunDay : 0;
// 동절기 전기간 평균
operList.inFlow.winterAvg = (winterDay > 0)? operList.inFlow.winterTot / winterDay : 0;
operList.inflAmt.winterAvg = (winterDay > 0)? operList.inflAmt.winterTot / winterDay : 0;
operList.sumFlow.winterAvg = (winterDay > 0)? operList.sumFlow.winterTot / winterDay : 0;
operList.returnFlow.winterAvg = (winterDay > 0)? operList.returnFlow.winterTot / winterDay : 0;
operList.efflFlow.winterAvg = (winterDay > 0)? operList.efflFlow.winterTot / winterDay : 0;
operList.inFlow.winterAvg = (winterDay > 0) ? operList.inFlow.winterTot / winterDay : 0;
operList.inflAmt.winterAvg = (winterDay > 0) ? operList.inflAmt.winterTot / winterDay : 0;
operList.sumFlow.winterAvg = (winterDay > 0) ? operList.sumFlow.winterTot / winterDay : 0;
operList.returnFlow.winterAvg = (winterDay > 0) ? operList.returnFlow.winterTot / winterDay : 0;
operList.efflFlow.winterAvg = (winterDay > 0) ? operList.efflFlow.winterTot / winterDay : 0;
// 동절기 청천시 평균
operList.inFlow.winterSunny = (winterChungchuDay > 0)? operList.inFlow.winterSunny / winterChungchuDay : 0;
operList.inflAmt.winterSunny = (winterChungchuDay > 0)? operList.inflAmt.winterSunny / winterChungchuDay : 0;
operList.sumFlow.winterSunny = (winterChungchuDay > 0)? operList.sumFlow.winterSunny / winterChungchuDay : 0;
operList.returnFlow.winterSunny = (winterChungchuDay > 0)? operList.returnFlow.winterSunny / winterChungchuDay : 0;
operList.efflFlow.winterSunny = (winterChungchuDay > 0)? operList.efflFlow.winterSunny / winterChungchuDay : 0;
operList.inFlow.winterSunny = (winterChungchuDay > 0) ? operList.inFlow.winterSunny / winterChungchuDay : 0;
operList.inflAmt.winterSunny = (winterChungchuDay > 0) ? operList.inflAmt.winterSunny / winterChungchuDay : 0;
operList.sumFlow.winterSunny = (winterChungchuDay > 0) ? operList.sumFlow.winterSunny / winterChungchuDay : 0;
operList.returnFlow.winterSunny = (winterChungchuDay > 0) ? operList.returnFlow.winterSunny / winterChungchuDay : 0;
operList.efflFlow.winterSunny = (winterChungchuDay > 0) ? operList.efflFlow.winterSunny / winterChungchuDay : 0;
// 연간 유입 평균 = 하수유입량(순수하수유입량) + 연계처리량 + 반류수유량(m³/일)
operationalStatusList[0].yearAvg = roundUp(operList.inFlow.yearAvg, 0); // 연간 유입 평균 = 하수유입량(순수하수유입량) + 연계처리량 + 반류수유량(m³/일)
@@ -1759,8 +1769,9 @@ export const dashBoardReducer = (
const rtnData = await calcWaterQltyData(operationalStatusList, searchYear, fcltyCd, mainGraphData); // 수질 데이터 청천시, 강우시 재계산
// 총인설비가 없을 경우 제외
console.log('총인시설 여부 : ', mainGraphData.data.wqltObjs?.tpFctYn);
const tpFctYn = mainGraphData.data.wqltObjs?.tpFctYn;
console.log('총인시설 여부 : ', mainGraphData.data.wqltObjs?.[0].tpFctYn);
const tpFctYn = mainGraphData.data.wqltObjs?.[0].tpFctYn;
// console.log('rtnData : ', rtnData);
if (tpFctYn !== 'Y') {