Merge remote-tracking branch 'origin/feature/sein' into iipbs/st/dev

This commit is contained in:
2026-06-30 14:40:51 +09:00
25 changed files with 2486 additions and 5 deletions
@@ -0,0 +1,242 @@
import { ENDPOINT } from "@/shared/config";
import { stClient } from "@/shared/api/client";
import type {
DomesticPopulationListResponse,
DomesticPopulationFinalResponse,
UpperCodesByNameResponse,
DomesticPopulationMappingItem,
} from "../model/ppltn/statistics-domestic-population-interface";
// 1. 응답 데이터의 타입을 정의합니다 (이미 정의된 것이 있다면 그것을 사용하세요)
interface ChartDataResponse {
status: string;
data: {
X_AXIS: string[];
TOT: number[];
ORIGIN_MALE: (number | null)[];
ORIGIN_FEMALE: (number | null)[];
FOREIGN_MALE: (number | null)[];
FOREIGN_FEMALE: (number | null)[];
};
message?: string;
}
export class StatisticsPpltnApiService {
/** 내국인 엑셀 임시 업로드 */
public async uploadDomesticPopulationExcel(
file: File,
statsYr: string,
): Promise<{ status: string; message?: string }> {
const formData = new FormData();
formData.append("file", file);
formData.append("statsYr", statsYr);
const response = await stClient.post<{ status: string; message?: string }>(
`${ENDPOINT.ST_SERVICE.PPLTN}/domestic-population-excel`,
formData,
{ headers: { "Content-Type": "multipart/form-data" } },
);
return response.data;
}
/** 내국인 임시 적재 리스트 조회
* @param opt1 "1" = 전체 리스트(좌측), "2" = 미매핑 리스트(우측)
*/
public async getDomesticPopulationList(
statsYr: string,
opt1: "1" | "2",
): Promise<DomesticPopulationListResponse> {
const response = await stClient.get<DomesticPopulationListResponse>(
`${ENDPOINT.ST_SERVICE.PPLTN}/domestic-population-list`,
{ params: { statsYr, opt1 } },
);
return response.data;
}
/** 내국인 최종 마스터 반영 */
public async saveDomesticPopulationFinal(
statsYr: string,
regList: DomesticPopulationMappingItem[],
): Promise<DomesticPopulationFinalResponse> {
const response = await stClient.post<DomesticPopulationFinalResponse>(
`${ENDPOINT.ST_SERVICE.PPLTN}/domestic-population-final`,
{ YR: statsYr, regList },
);
return response.data;
}
/** 미매핑 행 클릭 시 상위 코드 후보 조회 */
public async getUpperCodesByName(
statsYr: string,
admdstNm: string,
admdstCd: string
): Promise<UpperCodesByNameResponse> {
// GET 요청으로 변경하고 params 객체를 추가합니다.
const response = await stClient.get<UpperCodesByNameResponse>(
`${ENDPOINT.ST_SERVICE.PPLTN}/upper-codes-by-name`,
{
params: { statsYr, admdstNm,admdstCd }
},
);
return response.data;
}
/* ════════════════════════════════════
외국인
════════════════════════════════════ */
/** 외국인 엑셀 임시 업로드 */
public async uploadForeignPopulationExcel(
file: File,
statsYr: string,
): Promise<{ status: string; message?: string }> {
const formData = new FormData();
formData.append("file", file);
formData.append("statsYr", statsYr);
const response = await stClient.post<{ status: string; message?: string }>(
`${ENDPOINT.ST_SERVICE.PPLTN}/foreign-population-excel`,
formData,
{ headers: { "Content-Type": "multipart/form-data" } },
);
return response.data;
}
/** 외국인 임시 적재 리스트 조회
* @param opt1 "1" = 전체 리스트(좌측), "2" = 미매핑 리스트(우측)
*/
public async getForeignPopulationList(
statsYr: string,
opt1: "1" | "2",
): Promise<{ status: string; data: object[]; message?: string }> {
const response = await stClient.get<{ status: string; data: object[]; message?: string }>(
`${ENDPOINT.ST_SERVICE.PPLTN}/foreign-population-list`,
{ params: { statsYr, opt1 } },
);
return response.data;
}
/** 외국인 최종 마스터 반영 */
public async saveForeignPopulationFinal(
statsYr: string,
regList: DomesticPopulationMappingItem[],
): Promise<{ status: string; message?: string }> {
const response = await stClient.post<{ status: string; message?: string }>(
`${ENDPOINT.ST_SERVICE.PPLTN}/foreign-population-final`,
{ statsYr, regList },
);
return response.data;
}
/* ════════════════════════════════════
행정동갱신
════════════════════════════════════ */
/** 행정동 갱신 — 감축/추가 행정구역 조회
* @param opt1 "1" = 추가된 행정구역, "2" = 감축된 행정구역
*/
public async searchChangedArea(
statsYr: string,
opt1: "1" | "2",
): Promise<{ status: string; data: object[]; message?: string }> {
const response = await stClient.get<{ status: string; data: object[]; message?: string }>(
`${ENDPOINT.ST_SERVICE.PPLTN}/admdst-renewal/search`,
{ params: { statsYr, opt1 } },
);
return response.data;
}
/** 행정동 갱신 — 감축/추가 반영 */
public async saveChangedArea(
reducedList: object[],
addedList: object[],
): Promise<{ status: string; message?: string }> {
const response = await stClient.post<{ status: string; message?: string }>(
`${ENDPOINT.ST_SERVICE.PPLTN}/admdst-renewal/save`,
{ reducedList, addedList },
);
return response.data;
}
// /** 행정동 갱신 — 법정동코드 후보 조회 (행정동명 클릭 시) */
// public async getRenewalUpperCodesByName(
// statsYr: string,
// admdstNm: string,
// ): Promise<UpperCodesByNameResponse> {
// const response = await stClient.get<UpperCodesByNameResponse>(
// `${ENDPOINT.ST_SERVICE.PPLTN}/admdst-renewal/upper-codes-by-name`,
// {
// params: { statsYr, admdstNm }
// },
// );
// return response.data;
// }
/** 행정동 갱신 — 법정동코드 후보 조회 */
public async getLawCdsByName(
adstCd : string,
): Promise<UpperCodesByNameResponse> {
const response = await stClient.get<UpperCodesByNameResponse>(
`${ENDPOINT.ST_SERVICE.PPLTN}/admdst-renewal/law-codes-by-name`,
{
params: { adstCd }
},
);
return response.data;
}
/* ════════════════════════════════════
행정인구현황
════════════════════════════════════ */
/** 행정인구현황 — 체크박스 조건에 따른 인구 현황 조회 */
public async searchPopByEachCondition(
statsYr: string,
oMale: boolean,
oFemale: boolean,
fMale: boolean,
fFemale: boolean,
): Promise<{ status: string; data: object[]; message?: string }> {
const response = await stClient.get<{ status: string; data: object[]; message?: string }>(
`${ENDPOINT.ST_SERVICE.PPLTN}/admdst-renewal/pop-by-condition`,
{
params: {
statsYr,
oMale: oMale ? "TRUE" : "FALSE",
oFemale: oFemale ? "TRUE" : "FALSE",
fMale: fMale ? "TRUE" : "FALSE",
fFemale: fFemale ? "TRUE" : "FALSE",
}
},
);
return response.data;
}
/** 행정인구현황 시각화 — 기준연도 기준 최대 5년치 차트 데이터 조회 */
public async getChartDatas1(
statsYr: string,
oMale: boolean,
oFemale: boolean,
fMale: boolean,
fFemale: boolean,
): Promise<ChartDataResponse> {
const response = await stClient.get<ChartDataResponse>(
`${ENDPOINT.ST_SERVICE.PPLTN}/admdst-renewal/chart-datas`,
{
params: {
statsYr,
oMale: oMale ? "TRUE" : "FALSE",
oFemale: oFemale ? "TRUE" : "FALSE",
fMale: fMale ? "TRUE" : "FALSE",
fFemale: fFemale ? "TRUE" : "FALSE",
}
},
);
return response.data;
}
}
export const statisticsPpltnApi = new StatisticsPpltnApiService();
@@ -0,0 +1,70 @@
import type { ApiResponse } from "@/entities/statistics/model/statistics-interface";
/* ══════════════════════════════════════════════════
16. 통계인구관리 > 내국인 인구 관련 인터페이스
══════════════════════════════════════════════════ */
/** 내국인 인구 임시 적재 행 (좌측 전체 리스트 / 우측 미매핑 리스트 공통) */
export interface DomesticPopulationItem {
statsYr: string; // 통계연도
admdstCd: string; // 행정구역코드
admdstNm: string; // 행정구역명
domplWholPpltnCnt: number; // 내국인 합계 인구수
domplMlPpltnCnt: number; // 내국인 남성 인구수
domplFmlPpltnCnt: number; // 내국인 여성 인구수
/** 미매핑 리스트 전용 - 매핑 대상 행정구역코드 (상위코드) */
mpinCd: string;
}
/** 엑셀 업로드 요청 파라미터 */
export interface DomesticPopulationUploadParams {
file: File;
statsYr: string;
}
/** 임시 적재 리스트 조회 요청 파라미터 */
export interface DomesticPopulationListParams {
statsYr: string;
/** 1: 전체 리스트(좌측), 2: 미매핑 리스트(우측) */
opt1: '1' | '2';
}
/** 수동 매핑 후 최종 반영 요청 파라미터 */
export interface DomesticPopulationFinalParams {
YR: string;
/** 수동 매핑된 행 목록 (admdstCd → subAdmdstCd 매핑 정보) */
regList: DomesticPopulationMappingItem[];
}
/** 수동 매핑 단건 아이템 */
export interface DomesticPopulationMappingItem {
statsYr: string;
admdstCd: string;
admdstNm: string;
subAdmdstCd: string;
}
/** 내국인/외국인 상위 코드 후보 조회 요청 */
export interface UpperCodesByNameParams {
statsYr: string;
admdstNm: string;
}
/** 내국인/외국인 상위 코드 후보 단건 아이템 */
export interface UpperCodeCandidateItem {
admdstCd: string; // 행정동코드
admdstNm: string; // 행정동명
[key: string]: string;
}
/** 행정동 갱신 법정동코드 후보 단건 아이템 */
export interface LawCodeCandidateItem {
lawCd: string; // 법정동코드
lawNm: string; // 법정동명
[key: string]: string;
}
/* ── API 응답 타입 ── */
export type DomesticPopulationListResponse = ApiResponse<DomesticPopulationItem[]>;
export type DomesticPopulationFinalResponse = ApiResponse<string>;
export type UpperCodesByNameResponse = ApiResponse<UpperCodeCandidateItem[]>;
@@ -31,7 +31,7 @@ export interface cancelSubmitResponse {
export interface ApiResponse<T> {
status: string;
data: T;
data?: T;
message?: string;
}