170 lines
5.4 KiB
TypeScript
170 lines
5.4 KiB
TypeScript
import { client, stClient } from "@/shared/api/client";
|
|
import { ENDPOINT } from "@/shared/config";
|
|
|
|
import {
|
|
type ApiResponse,
|
|
type cancelSubmitRequest,
|
|
type cancelSubmitResponse,
|
|
type getReviewOpinionDetailRequest,
|
|
type getReviewOpinionDetailResponse,
|
|
type ImrRequest,
|
|
type ReviewOpinionSaveRequest,
|
|
type ReviewOpinionSaveResponse,
|
|
type ReviewReturnSaveRequest,
|
|
type ReviewReturnSaveResponse,
|
|
type ReviewSubmitRequest,
|
|
type ReviewSubmitResponse,
|
|
type VerificationResultListRequest,
|
|
type VerificationResultListResponse,
|
|
type SearchCondition,
|
|
type Sgg,
|
|
type StatisticsLogDetailResponse,
|
|
type StatisticsLogRequest,
|
|
type StatisticsLogResponse,
|
|
type StatisticsService,
|
|
type SubmitExceptionRequest,
|
|
type SubmitExceptionResponse,
|
|
type ImrResponse,
|
|
type ImrStatusResponse,
|
|
} from "../model/statistics-interface";
|
|
|
|
export class StatisticsApiService implements StatisticsService {
|
|
public async getSidoList(params?: {
|
|
instSeCd?: string;
|
|
}): Promise<ApiResponse<SearchCondition>> {
|
|
const response = await stClient.get<ApiResponse<SearchCondition>>(
|
|
`${ENDPOINT.ST_SERVICE.COMMON}/search-condition`,
|
|
{ params },
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async getSggList(
|
|
sidoName: string,
|
|
params?: { instSeCd?: string; gugunSkipYn?: "Y" | "N" },
|
|
): Promise<ApiResponse<Sgg[]>> {
|
|
const response = await stClient.get<ApiResponse<Sgg[]>>(
|
|
`${ENDPOINT.ST_SERVICE.COMMON}/sgg`,
|
|
{ params: { sidoName, ...params } },
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async getSggAllList(
|
|
sidoName: string,
|
|
params?: { instSeCd?: string; gugunSkipYn?: "Y" | "N" },
|
|
): Promise<ApiResponse<Sgg[]>> {
|
|
const response = await stClient.get<ApiResponse<Sgg[]>>(
|
|
`${ENDPOINT.ST_SERVICE.COMMON}/sgg-all`,
|
|
{ params: { sidoName, ...params } },
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
// 입력 - 제출 취소
|
|
public async cancelSubmit(
|
|
param: cancelSubmitRequest,
|
|
): Promise<cancelSubmitResponse> {
|
|
const response = await stClient.put<cancelSubmitResponse>(
|
|
`${ENDPOINT.ST_SERVICE.INPUTCOMMON}/cancel-submit`,
|
|
param,
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async callImrService(param: ImrRequest): Promise<ImrResponse> {
|
|
const response = await client.post<ImrResponse>(
|
|
`${ENDPOINT.STATVERIFY_SERVICE.IMR}`,
|
|
param,
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async getImrStatus(param: string): Promise<ImrStatusResponse> {
|
|
const response = await client.get<ImrStatusResponse>(
|
|
`${ENDPOINT.STATVERIFY_SERVICE.IMR}/status/${param}`,
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
// 예외 제출
|
|
public async submitException(
|
|
param: SubmitExceptionRequest,
|
|
): Promise<SubmitExceptionResponse> {
|
|
const response = await stClient.post<SubmitExceptionResponse>(
|
|
`${ENDPOINT.ST_SERVICE.INPUTCOMMON}/submit-exception`,
|
|
param,
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async getLogList(
|
|
param: StatisticsLogRequest,
|
|
): Promise<StatisticsLogResponse> {
|
|
const response = await stClient.get<StatisticsLogResponse>(
|
|
`${ENDPOINT.ST_SERVICE.INPUTCOMMON}/logs`,
|
|
{ params: param },
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async getLogDetail(
|
|
param: string,
|
|
): Promise<StatisticsLogDetailResponse> {
|
|
const response = await stClient.get<StatisticsLogDetailResponse>(
|
|
`${ENDPOINT.ST_SERVICE.INPUTCOMMON}/logs/${param}`,
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async saveReviewOpinion(
|
|
param: ReviewOpinionSaveRequest,
|
|
): Promise<ReviewOpinionSaveResponse> {
|
|
const response = await stClient.post<ReviewOpinionSaveResponse>(
|
|
`${ENDPOINT.ST_SERVICE.REVIEW}/opinion-save`,
|
|
param,
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async getReviewOpinionDetail(
|
|
param: getReviewOpinionDetailRequest,
|
|
): Promise<getReviewOpinionDetailResponse> {
|
|
const response = await stClient.get<getReviewOpinionDetailResponse>(
|
|
`${ENDPOINT.ST_SERVICE.REVIEW}/opinion-select`,
|
|
{ params: param },
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async saveReviewReturn(
|
|
param: ReviewReturnSaveRequest,
|
|
): Promise<ReviewReturnSaveResponse> {
|
|
const response = await stClient.post<ReviewReturnSaveResponse>(
|
|
`${ENDPOINT.ST_SERVICE.REVIEW}/return`,
|
|
param,
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async submitReview(
|
|
param: ReviewSubmitRequest,
|
|
): Promise<ReviewSubmitResponse> {
|
|
const response = await stClient.post<ReviewSubmitResponse>(
|
|
`${ENDPOINT.ST_SERVICE.REVIEW}/submit`,
|
|
param,
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async getVerificationResultList(param: VerificationResultListRequest): Promise<VerificationResultListResponse> {
|
|
const response = await stClient.get<VerificationResultListResponse>(
|
|
`${ENDPOINT.ST_SERVICE.INPUTVERIFY}/results`,
|
|
{ params: param },
|
|
);
|
|
return response.data;
|
|
}
|
|
}
|
|
|
|
export const statisticsApi = new StatisticsApiService();
|