Merge commit '64698fb97e39f5b35b0fd05012f94833dead1522' into iipbs/wr/dev
This commit is contained in:
@@ -50,42 +50,56 @@ const hasuListFetch = async (
|
|||||||
page: number,
|
page: number,
|
||||||
returnType: ReturnType,
|
returnType: ReturnType,
|
||||||
searchNm: string | undefined,
|
searchNm: string | undefined,
|
||||||
year: string,
|
fromDate: string,
|
||||||
|
toDate: string,
|
||||||
flcts: string[]
|
flcts: string[]
|
||||||
) => {
|
) => {
|
||||||
let url = `/prcsFclt/ruseInfo/`;
|
let url = '';
|
||||||
|
let filteredFclt = flcts;
|
||||||
|
const filterData = returnType.sigunValue !== '0' ? returnType.sigunValue : returnType.sidoValue
|
||||||
|
|
||||||
|
if (filterData !== '0')
|
||||||
|
filteredFclt = flcts.filter((fclt: string) => {
|
||||||
|
return filterData.length == 2 ? fclt.slice(0, 2) === filterData : fclt.slice(0, 5) === filterData
|
||||||
|
})
|
||||||
if (returnType.partValue === "A") {
|
if (returnType.partValue === "A") {
|
||||||
url += `${page}/5/${returnType.partValue}/${
|
url += `${returnType.partValue}/${
|
||||||
// returnType.sidoValue ? returnType.sidoValue : returnType.sigunValue
|
// returnType.sidoValue ? returnType.sidoValue : returnType.sigunValue
|
||||||
returnType.sigunValue !== '0' ? returnType.sigunValue : returnType.sidoValue
|
returnType.sigunValue !== '0' ? returnType.sigunValue : returnType.sidoValue
|
||||||
}/0/1/SW`
|
}/0/1/SW`
|
||||||
|
|
||||||
|
if (filterData !== '0')
|
||||||
|
filteredFclt = flcts.filter((fclt: string) => {
|
||||||
|
return filterData.length == 2 ? fclt.slice(0, 2) === filterData : fclt.slice(0, 5) === filterData
|
||||||
|
})
|
||||||
} else if (returnType.partValue === "R") {
|
} else if (returnType.partValue === "R") {
|
||||||
url += `${page}/5/${returnType.partValue}/${returnType.regionValue
|
url += `${returnType.partValue}/${returnType.regionValue
|
||||||
? returnType.regionValue
|
? returnType.regionValue
|
||||||
: returnType.unitWaterShedValue
|
: returnType.unitWaterShedValue
|
||||||
? returnType.unitWaterShedValue
|
? returnType.unitWaterShedValue
|
||||||
: returnType.middleRegionValue
|
: returnType.middleRegionValue
|
||||||
}/0/1/SW`
|
}/0/1/SW`
|
||||||
} else if (returnType.partValue === 'G') {
|
} else if (returnType.partValue === 'G') {
|
||||||
url += `${page}/5/${returnType.envPartValue}/${returnType.sigunValue !== '0' ? returnType.sigunValue : returnType.sidoValue}/0/1/SW`
|
url += `${returnType.envPartValue}/${returnType.sigunValue !== '0' ? returnType.sigunValue : returnType.sidoValue}/0/1/SW`
|
||||||
|
if (filterData !== '0')
|
||||||
|
filteredFclt = flcts.filter((fclt: string) => {
|
||||||
|
return filterData.length == 2 ? fclt.slice(0, 2) === filterData : fclt.slice(0, 5) === filterData
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
url += `1/2/A/0/0/1/SW`
|
url += `A/0/0/1/SW`
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchNm && searchNm?.length > 0) {
|
if (searchNm && searchNm?.length > 0) {
|
||||||
url += "/" + searchNm
|
url += "/" + searchNm
|
||||||
}
|
}
|
||||||
|
const pbnList = await postFectch(`/prcsFclt/ruseInfo/1/${filteredFclt.length}/` + url, filteredFclt, fetchType.COMMON);
|
||||||
const pbnList = await postFectch(url, flcts, fetchType.COMMON);
|
const checkRuseFcltList = searchNm && searchNm?.length > 0 ? pbnList.data.map((item) => item.bscFctCd) : filteredFclt
|
||||||
const getRuseList = await postFectch(
|
const getRuseList = await postFectch(
|
||||||
`/reuseFc/pubDetailList/${year}`,
|
`/reuseFc/pubDetailPrfList/${fromDate}/${toDate}/${filterData}/${page}/5`,
|
||||||
flcts,
|
checkRuseFcltList,
|
||||||
fetchType.WR
|
fetchType.WR
|
||||||
);
|
);
|
||||||
let count = 0;
|
|
||||||
const checkWrRegListRes = getRuseList.data;
|
const checkWrRegListRes = getRuseList.data;
|
||||||
|
|
||||||
const data: WaterReuseFacility[] = checkWrRegListRes.map(
|
const data: WaterReuseFacility[] = checkWrRegListRes.map(
|
||||||
(item: FcPrfType) => {
|
(item: FcPrfType) => {
|
||||||
if (!item.prfList || item.prfList.length === 0) {
|
if (!item.prfList || item.prfList.length === 0) {
|
||||||
@@ -96,7 +110,6 @@ const hasuListFetch = async (
|
|||||||
fclt.bscFctCd === item.pbnstRuseFcltId.substring(0, 11)
|
fclt.bscFctCd === item.pbnstRuseFcltId.substring(0, 11)
|
||||||
);
|
);
|
||||||
if (findData) {
|
if (findData) {
|
||||||
count++;
|
|
||||||
return {
|
return {
|
||||||
sido: findData?.sido || '-',
|
sido: findData?.sido || '-',
|
||||||
gugun: findData?.gugun || '-',
|
gugun: findData?.gugun || '-',
|
||||||
@@ -104,12 +117,12 @@ const hasuListFetch = async (
|
|||||||
ruseUtztnFcltNm: item?.ruseUtztnFcltNm || '-',
|
ruseUtztnFcltNm: item?.ruseUtztnFcltNm || '-',
|
||||||
pbnstRuseFcltId: item?.pbnstRuseFcltId || '-',
|
pbnstRuseFcltId: item?.pbnstRuseFcltId || '-',
|
||||||
bscFctCd: findData?.bscFctCd || '-',
|
bscFctCd: findData?.bscFctCd || '-',
|
||||||
count
|
prfList: item.prfList,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
).filter(Boolean);
|
).filter(Boolean);
|
||||||
return data;
|
return {data: data, count: getRuseList.count};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions = (
|
export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions = (
|
||||||
@@ -175,29 +188,17 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
|
|||||||
page,
|
page,
|
||||||
returnType,
|
returnType,
|
||||||
fcltNm,
|
fcltNm,
|
||||||
|
fromDate,
|
||||||
toDate,
|
toDate,
|
||||||
fclts);
|
fclts);
|
||||||
// const bscFctCdList = prfmncRes.map((item: any) => {
|
|
||||||
// return item.bscFctCd;
|
|
||||||
// })
|
|
||||||
const bscFctCdList = prfmncRes
|
|
||||||
.map((item: any) => item.bscFctCd)
|
|
||||||
.filter((value, index, self) => self.indexOf(value) === index);
|
|
||||||
// const bscFctCdList = [...new Set(prfmncRes.map((item: any) => item.bscFctCd))];
|
|
||||||
|
|
||||||
|
|
||||||
const res = await postFectch(
|
|
||||||
`/reuseFc/pubDetailList/${fromDate}/${toDate}`,
|
|
||||||
bscFctCdList,
|
|
||||||
`wr`,
|
|
||||||
)
|
|
||||||
let inUsageSum = 0;
|
let inUsageSum = 0;
|
||||||
let outUsageSum = 0;
|
let outUsageSum = 0;
|
||||||
let year = "";
|
let year = "";
|
||||||
const yearsData = [] as any
|
const yearsData = [] as any
|
||||||
|
|
||||||
res.data.forEach((item: any) => {
|
prfmncRes.data.forEach((item: any) => {
|
||||||
if (item.prfList.length === 0) {
|
if (!item.prfList || item.prfList.length === 0) {
|
||||||
const year: string = ""; // 연도 정보가 없으면 빈 문자열, 필요시 item에서 추출.
|
const year: string = ""; // 연도 정보가 없으면 빈 문자열, 필요시 item에서 추출.
|
||||||
const yearVal: { [key: string]: any } = { year: year, pbnstRuseFcltId: item.pbnstRuseFcltId ?? "", ruseUtztnFcltNm: item.ruseUtztnFcltNm ?? "" };
|
const yearVal: { [key: string]: any } = { year: year, pbnstRuseFcltId: item.pbnstRuseFcltId ?? "", ruseUtztnFcltNm: item.ruseUtztnFcltNm ?? "" };
|
||||||
yearVal[`${year}inUsage`] = 0;
|
yearVal[`${year}inUsage`] = 0;
|
||||||
@@ -205,7 +206,7 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
|
|||||||
yearVal[`${year}total`] = 0;
|
yearVal[`${year}total`] = 0;
|
||||||
yearsData.push(yearVal);
|
yearsData.push(yearVal);
|
||||||
}
|
}
|
||||||
item.prfList.forEach((acc) => {
|
item.prfList?.forEach((acc: any) => {
|
||||||
year = acc.ym?.substring(0, 4) ?? "";
|
year = acc.ym?.substring(0, 4) ?? "";
|
||||||
inUsageSum =
|
inUsageSum =
|
||||||
(acc.wshwtr ?? 0) + //조경용수
|
(acc.wshwtr ?? 0) + //조경용수
|
||||||
@@ -273,7 +274,7 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
|
|||||||
|
|
||||||
// prfmncRes 정보 merge
|
// prfmncRes 정보 merge
|
||||||
const resData = Object.values(mergedMap).map((item: any) => {
|
const resData = Object.values(mergedMap).map((item: any) => {
|
||||||
const match = prfmncRes.find((res) => res.pbnstRuseFcltId === item.pbnstRuseFcltId);
|
const match = prfmncRes.data.find((res) => res.pbnstRuseFcltId === item.pbnstRuseFcltId);
|
||||||
return match ? { ...item, ...match } : item;
|
return match ? { ...item, ...match } : item;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -282,10 +283,10 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
|
|||||||
pbnstPrfmncSttn: {
|
pbnstPrfmncSttn: {
|
||||||
...state.pbnstPrfmncSttn,
|
...state.pbnstPrfmncSttn,
|
||||||
// prfmncRes: prfmncRes,
|
// prfmncRes: prfmncRes,
|
||||||
prfmncResCount: fclts.length - 5,
|
prfmncResCount: prfmncRes.count,
|
||||||
isInit: false,
|
isInit: false,
|
||||||
prfmncRes: resData,
|
prfmncRes: resData,
|
||||||
rawData: res.data
|
rawData: prfmncRes.data
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
} catch (errorHasu) {
|
} catch (errorHasu) {
|
||||||
|
|||||||
Reference in New Issue
Block a user