Merge branch 'iipbs/st/dev' of https://www.onasys.co.kr:3000/ONAANDALL/frontend into iipbs/st/dev
This commit is contained in:
@@ -8,14 +8,15 @@ import {
|
||||
type RowSelectionState,
|
||||
useReactTable,
|
||||
} from "@tanstack/react-table";
|
||||
import type { AxiosError } from "axios";
|
||||
|
||||
import { client } from "@/shared/api/client";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import { useAlertStore, useMutationWrapper } from "@/shared/lib";
|
||||
import type { ApiErrorResponse } from "@/shared/model";
|
||||
import {
|
||||
type AdstZoneResponseDto,
|
||||
type BusinessSendRequest,
|
||||
type BusinessSendResponse,
|
||||
noticeTalkSendingApi,
|
||||
type SelectedRecipient,
|
||||
type SewerStUserItem,
|
||||
useNtftalkTemplateList,
|
||||
@@ -122,10 +123,26 @@ function NtitlkSndng() {
|
||||
const [previewRecipient, setPreviewRecipient] =
|
||||
useState<SelectedRecipient | null>(null);
|
||||
const [isPreviewOpen, setIsPreviewOpen] = useState(false);
|
||||
const [isSending, setIsSending] = useState(false);
|
||||
const [userListRowSelection, setUserListRowSelection] =
|
||||
useState<RowSelectionState>({});
|
||||
|
||||
const sendMutation = useMutationWrapper<
|
||||
BusinessSendResponse,
|
||||
AxiosError<ApiErrorResponse>,
|
||||
BusinessSendRequest
|
||||
>({
|
||||
mutationFn: (payload) => noticeTalkSendingApi.sendBusiness(payload),
|
||||
onSuccess: (data) => {
|
||||
if (!data.success) {
|
||||
alert(data.message || "알림톡 발송 요청에 실패했습니다.");
|
||||
return;
|
||||
}
|
||||
alert(data.message || "알림톡 발송이 요청되었습니다.");
|
||||
setSelectedRecipients([]);
|
||||
setCommonVariableValues({});
|
||||
},
|
||||
});
|
||||
|
||||
const { data: templatePageData } = useNtftalkTemplateList();
|
||||
const templates = templatePageData?.content ?? [];
|
||||
|
||||
@@ -321,7 +338,7 @@ function NtitlkSndng() {
|
||||
}),
|
||||
);
|
||||
if (missingVariable) {
|
||||
alert("필수 변수값이 입력되지 않은 발송 대상이 있습니다.");
|
||||
alert("변수값이 입력되지 않은 발송 대상이 있습니다.");
|
||||
return;
|
||||
}
|
||||
if (
|
||||
@@ -331,34 +348,13 @@ function NtitlkSndng() {
|
||||
)
|
||||
return;
|
||||
|
||||
const payload: BusinessSendRequest = {
|
||||
sendMutation.mutate({
|
||||
templateCode: selectedTemplateCode,
|
||||
callback: "032-590-4000",
|
||||
recipients: selectedRecipients.map((recipient) =>
|
||||
getMergedVariables(recipient, commonVariableValues),
|
||||
),
|
||||
};
|
||||
|
||||
try {
|
||||
setIsSending(true);
|
||||
const response = await client.post<BusinessSendResponse>(
|
||||
`${ENDPOINT.NTFTALK_SERVICE.ATA_SEND}/business`,
|
||||
payload,
|
||||
);
|
||||
const data = response.data;
|
||||
if (!data.success) {
|
||||
alert(data.message || "알림톡 발송 요청에 실패했습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
alert(data.message || `알림톡 발송이 요청되었습니다.`);
|
||||
setSelectedRecipients([]);
|
||||
setCommonVariableValues({});
|
||||
} catch {
|
||||
alert("알림톡 발송 중 오류가 발생했습니다.");
|
||||
} finally {
|
||||
setIsSending(false);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -567,7 +563,8 @@ function NtitlkSndng() {
|
||||
color="green"
|
||||
onClick={handleSend}
|
||||
disabled={
|
||||
isSending || selectedRecipients.length === 0
|
||||
sendMutation.isPending ||
|
||||
selectedRecipients.length === 0
|
||||
}
|
||||
>
|
||||
발송
|
||||
|
||||
@@ -20,18 +20,18 @@ import { ENDPOINT } from "@/shared/config";
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import type { ApiErrorResponse } from "@/shared/model";
|
||||
import { CodeSelect } from "@/entities/code";
|
||||
import type {
|
||||
AnalysisRequestPayload,
|
||||
AnalysisResponseDto,
|
||||
StAnlsMstResponse,
|
||||
StAnlsMstSearchParams,
|
||||
StAnlsOutlierListResponse,
|
||||
import {
|
||||
analysisApi,
|
||||
type AnalysisRequestPayload,
|
||||
type AnalysisResponseDto,
|
||||
type StAnlsMstResponse,
|
||||
type StAnlsMstSearchParams,
|
||||
type StAnlsOutlierListResponse,
|
||||
statisticsAnalysisMasterService,
|
||||
verificationHistoryColumns,
|
||||
type VerificationTargetCodeResponse,
|
||||
verificationTargetManagementApi,
|
||||
} from "@/entities/statistics";
|
||||
import { verificationHistoryColumns } from "@/entities/statistics";
|
||||
import { analysisApi } from "@/entities/statistics/api/analysis-api";
|
||||
import { stAnlsMstApi } from "@/entities/statistics/api/statistics-analysis-master-api";
|
||||
import { verificationTargetManagementApi } from "@/entities/statistics/api/verification-target-management-service";
|
||||
import type { VerificationTargetCodeResponse } from "@/entities/statistics/model/verification-target-management-interface";
|
||||
import {
|
||||
Button,
|
||||
Checkbox,
|
||||
@@ -102,7 +102,7 @@ function toNumber(value: string): number {
|
||||
return Number.isNaN(parsed) ? 0 : parsed;
|
||||
}
|
||||
|
||||
const HbStatisticsVerification = () => {
|
||||
export default function HbStatisticsVerification() {
|
||||
const { setMessage: alert } = useAlertStore((state) => state);
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
@@ -114,10 +114,10 @@ const HbStatisticsVerification = () => {
|
||||
|
||||
const [verifyType, setVerifyType] = useState<VerifyType>("ALL");
|
||||
const [formState, setFormState] = useState<VerificationFormState>({
|
||||
mu: "0",
|
||||
percentile: "0",
|
||||
a: "0",
|
||||
c: "0",
|
||||
mu: "",
|
||||
percentile: "",
|
||||
a: "",
|
||||
c: "",
|
||||
verificationYear: defaultYear,
|
||||
});
|
||||
const [selectedTargets, setSelectedTargets] = useState<string[]>([]);
|
||||
@@ -207,7 +207,9 @@ const HbStatisticsVerification = () => {
|
||||
params.verifyDtEnd = dayjs(to).format("YYYY-MM-DD");
|
||||
}
|
||||
|
||||
return stAnlsMstApi.getAnalysisHistoryList(params);
|
||||
return statisticsAnalysisMasterService.getAnalysisHistoryList(
|
||||
params,
|
||||
);
|
||||
},
|
||||
refetchInterval: (query) => {
|
||||
const data = query.state.data;
|
||||
@@ -248,9 +250,10 @@ const HbStatisticsVerification = () => {
|
||||
],
|
||||
queryFn: async () => {
|
||||
if (!outlierDialog.anlsSn) return [];
|
||||
const response = await stAnlsMstApi.getOutlierList(
|
||||
outlierDialog.anlsSn,
|
||||
);
|
||||
const response =
|
||||
await statisticsAnalysisMasterService.getOutlierList(
|
||||
outlierDialog.anlsSn,
|
||||
);
|
||||
return response;
|
||||
},
|
||||
enabled: outlierDialog.open && !!outlierDialog.anlsSn,
|
||||
@@ -556,11 +559,14 @@ const HbStatisticsVerification = () => {
|
||||
|
||||
<div className="space-y-3">
|
||||
<div className="flex items-center gap-4">
|
||||
<Label className="w-32 text-label">
|
||||
μ
|
||||
<Label className="w-48 whitespace-nowrap text-label">
|
||||
중요도 계수(μ)
|
||||
</Label>
|
||||
<Input
|
||||
type="number"
|
||||
min="0"
|
||||
max="1"
|
||||
step="0.1"
|
||||
value={formState.mu}
|
||||
onChange={(event) =>
|
||||
handleFormChange(
|
||||
@@ -569,15 +575,19 @@ const HbStatisticsVerification = () => {
|
||||
)
|
||||
}
|
||||
className="flex-1"
|
||||
placeholder="(0 ~ 1, 0.1 단위)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-4">
|
||||
<Label className="w-32 text-label">
|
||||
Percentile
|
||||
<Label className="w-48 text-label">
|
||||
백분위수 기준값(pct)
|
||||
</Label>
|
||||
<Input
|
||||
type="number"
|
||||
min="0"
|
||||
max="0.5"
|
||||
step="0.01"
|
||||
value={formState.percentile}
|
||||
onChange={(event) =>
|
||||
handleFormChange(
|
||||
@@ -586,15 +596,19 @@ const HbStatisticsVerification = () => {
|
||||
)
|
||||
}
|
||||
className="flex-1"
|
||||
placeholder="(0 ~ 0.5, 0.01 단위)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-4">
|
||||
<Label className="w-32 text-label">
|
||||
A
|
||||
<Label className="w-48 text-label">
|
||||
스케일 조정 계수(A)
|
||||
</Label>
|
||||
<Input
|
||||
type="number"
|
||||
min="0"
|
||||
max="1"
|
||||
step="0.01"
|
||||
value={formState.a}
|
||||
onChange={(event) =>
|
||||
handleFormChange(
|
||||
@@ -603,15 +617,19 @@ const HbStatisticsVerification = () => {
|
||||
)
|
||||
}
|
||||
className="flex-1"
|
||||
placeholder="(0 ~ 1, 0.01 단위)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-4">
|
||||
<Label className="w-32 text-label">
|
||||
C
|
||||
<Label className="w-48 text-label">
|
||||
임계 계수(c)
|
||||
</Label>
|
||||
<Input
|
||||
type="number"
|
||||
min="0"
|
||||
max="100"
|
||||
step="1"
|
||||
value={formState.c}
|
||||
onChange={(event) =>
|
||||
handleFormChange(
|
||||
@@ -620,6 +638,7 @@ const HbStatisticsVerification = () => {
|
||||
)
|
||||
}
|
||||
className="flex-1"
|
||||
placeholder="(0 ~ 100, 1 단위)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -771,6 +790,4 @@ const HbStatisticsVerification = () => {
|
||||
</Dialog>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default HbStatisticsVerification;
|
||||
}
|
||||
|
||||
@@ -24,25 +24,21 @@ import dayjs from "dayjs";
|
||||
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import { CodeSelect } from "@/entities/code";
|
||||
import type {
|
||||
AdstZoneResponseDto,
|
||||
StAnlsMstResponse,
|
||||
StAnlsMstSearchParams,
|
||||
StAnlsRsltResponse,
|
||||
} from "@/entities/statistics";
|
||||
import {
|
||||
type AdstZoneResponseDto,
|
||||
IMR_DETAIL_VISIBLE_COLUMNS_BY_STATS_CD,
|
||||
IMR_DETAIL_VISIBLE_COLUMNS_DEFAULT,
|
||||
imrApi,
|
||||
imrDetailGridColumnInfo,
|
||||
imrVerificationHistoryColumns,
|
||||
} from "@/entities/statistics";
|
||||
import { imrApi } from "@/entities/statistics/api/imr-api";
|
||||
import {
|
||||
type StAnlsMstResponse,
|
||||
type StAnlsMstSearchParams,
|
||||
stAnlsRsltApi,
|
||||
type StAnlsRsltResponse,
|
||||
statisticsAnalysisMasterService,
|
||||
useStAnlsSidoCombo,
|
||||
useStAnlsSigunguCombo,
|
||||
} from "@/entities/statistics/api/queries";
|
||||
import { stAnlsMstApi } from "@/entities/statistics/api/statistics-analysis-master-api";
|
||||
import { stAnlsRsltApi } from "@/entities/statistics/api/statistics-analysis-result-api";
|
||||
} from "@/entities/statistics";
|
||||
import {
|
||||
Button,
|
||||
DataTable,
|
||||
@@ -144,7 +140,7 @@ const ImrVerificationHistory = () => {
|
||||
historyPagination,
|
||||
],
|
||||
queryFn: () =>
|
||||
stAnlsMstApi.getImrAnalysisMasterList({
|
||||
statisticsAnalysisMasterService.getImrAnalysisMasterList({
|
||||
...appliedSearchParams,
|
||||
page: historyPagination.pageIndex,
|
||||
size: historyPagination.pageSize,
|
||||
|
||||
@@ -4,7 +4,6 @@ import { useEffect, useState } from "react";
|
||||
import { Controller, useForm } from "react-hook-form";
|
||||
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { Search } from "lucide-react";
|
||||
|
||||
import { CodeSelect } from "@/entities/code/ui/code-select";
|
||||
import { verificationTargetManagementApi } from "@/entities/statistics/api/verification-target-management-service";
|
||||
@@ -368,7 +367,7 @@ export function VerificationTargetDialog({
|
||||
type="number"
|
||||
min="0"
|
||||
max="0.5"
|
||||
step="0.1"
|
||||
step="0.01"
|
||||
value={
|
||||
field.value ??
|
||||
""
|
||||
@@ -385,7 +384,7 @@ export function VerificationTargetDialog({
|
||||
: null,
|
||||
)
|
||||
}
|
||||
placeholder="(0 ~ 0.5, 0.1 단위)"
|
||||
placeholder="(0 ~ 0.5, 0.01 단위)"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -1,6 +1,18 @@
|
||||
import React, { useState } from "react";
|
||||
|
||||
import type { StAnlsDtlResponse } from "@/entities/statistics";
|
||||
import { useConfirm } from "@frontend-opensource/use-react-hooks";
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import type { AxiosError } from "axios";
|
||||
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import { useAlertStore, useMutationWrapper } from "@/shared/lib";
|
||||
import type { ApiErrorResponse } from "@/shared/model";
|
||||
import type {
|
||||
StAnlsDtlConfirmRequest,
|
||||
StAnlsDtlConfirmResponse,
|
||||
StAnlsDtlResponse,
|
||||
} from "@/entities/statistics";
|
||||
import { statisticsAnalysisDetailService } from "@/entities/statistics";
|
||||
import { Button } from "@common/components";
|
||||
|
||||
import Indicators from "./Indicators";
|
||||
@@ -38,6 +50,47 @@ const HbVerificationDetail: React.FC<HbVerificationDetailProps> = ({
|
||||
vrfcTrgtNm: string;
|
||||
} | null>(null);
|
||||
|
||||
const queryClient = useQueryClient();
|
||||
const { setMessage: alert } = useAlertStore((state) => state);
|
||||
const { confirm } = useConfirm();
|
||||
|
||||
const confirmMutation = useMutationWrapper<
|
||||
StAnlsDtlConfirmResponse,
|
||||
AxiosError<ApiErrorResponse>,
|
||||
StAnlsDtlConfirmRequest
|
||||
>({
|
||||
mutationFn: (payload) =>
|
||||
statisticsAnalysisDetailService.confirmDetail(payload),
|
||||
onSuccess: async () => {
|
||||
setCheckedSns([]);
|
||||
|
||||
await Promise.all([
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [
|
||||
ENDPOINT.STATVERIFY_SERVICE.ST_ANLS_DTL,
|
||||
"list",
|
||||
anlsSn,
|
||||
],
|
||||
}),
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [ENDPOINT.STATVERIFY_SERVICE.ST_ANLS_MST],
|
||||
}),
|
||||
]);
|
||||
},
|
||||
});
|
||||
|
||||
const handleConfirmClick = async () => {
|
||||
if (checkedSns.length === 0) return;
|
||||
|
||||
if (!(await confirm("검증확정 처리하시겠습니까?"))) return;
|
||||
|
||||
const vrfcTrgtSnList = checkedSns
|
||||
.map((value) => Number(value))
|
||||
.filter((value) => !Number.isNaN(value));
|
||||
|
||||
confirmMutation.mutate({ anlsSn, vrfcTrgtSnList });
|
||||
};
|
||||
|
||||
const handleTargetSelect = (row: StAnlsDtlResponse) => {
|
||||
setSelectedVrfcTrgtSn(String(row.vrfcTrgtSn));
|
||||
setSelectedTargetInfo({
|
||||
@@ -70,7 +123,14 @@ const HbVerificationDetail: React.FC<HbVerificationDetailProps> = ({
|
||||
검증 상세
|
||||
</h2>
|
||||
</div>
|
||||
<Button disabled={checkedSns.length === 0}>검증확정</Button>
|
||||
<Button
|
||||
disabled={
|
||||
checkedSns.length === 0 || confirmMutation.isPending
|
||||
}
|
||||
onClick={handleConfirmClick}
|
||||
>
|
||||
검증확정
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-4">
|
||||
|
||||
@@ -6,7 +6,7 @@ import { getCoreRowModel, useReactTable } from "@tanstack/react-table";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import type { StAnlsDtlResponse } from "@/entities/statistics";
|
||||
import { getVerificationListColumns } from "@/entities/statistics";
|
||||
import { stAnlsDtlApi } from "@/entities/statistics/api/statistics-analysis-detail-api";
|
||||
import { statisticsAnalysisDetailService } from "@/entities/statistics/api/statistics-analysis-detail-service";
|
||||
import { DataTable } from "@common/components";
|
||||
|
||||
interface VerificationListProps {
|
||||
@@ -27,7 +27,11 @@ const VerificationList: React.FC<VerificationListProps> = ({
|
||||
const { data: detailData, isLoading } = useQuery({
|
||||
queryKey: [ENDPOINT.STATVERIFY_SERVICE.ST_ANLS_DTL, "list", anlsSn],
|
||||
queryFn: () =>
|
||||
stAnlsDtlApi.getDetailList({ anlsSn, page: 0, size: 100 }),
|
||||
statisticsAnalysisDetailService.getDetailList({
|
||||
anlsSn,
|
||||
page: 0,
|
||||
size: 100,
|
||||
}),
|
||||
enabled: !!anlsSn,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user