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