feat: incar 갭 반영 수수료/운영 14개 도메인 풀스택 + 배치통합 + 신입교육자료
incar CMS(116메뉴) 벤치마킹 갭분석으로 ga-pro에 없던 14개 도메인을 풀스택 추가. P7 수수료 계산 7종 (V88~V96): - 수입수수료+수지차, 소개·이관수수료, 정착지원금, 인정실적+환산율, 시상, 생보운영지원수수료, 지점장수당 - 각 rule/ledger + 공식(보험료×요율, 수입−지급 등) Service 내장 P8 운영/정산 7종 (V97~V105): - 단계마감, 본사정산, 등급평가, 공동계약, 보증보험, 적립금, 수수료시뮬레이터 - close/reopen/apply/simulate/upsert 등 액션 + 손익·잔액·등급 산정 로직 배치 통합 (V106): - settle_master.other_commission_total 컬럼 추가(DEFAULT 0, 백필) - 설계사 지급성 9종 원장 aggregateByAgent → AggregateStep gross 합산 - 빈 원장 0 → 기존 정산결과·무결성 불변(비파괴적) 테스트: P7/P8 Service 공식 단위테스트 21건(ga-api:test 57건 전체 통과) 프론트: 화면 14개 + React.lazy 코드 스플리팅(단일 4MB → 130+ 청크) 문서: DOMAIN_GAP_P7/P8.md, 신입교육_보험과수수료_완전기초.md, DOMAIN_KNOWLEDGE/HANDOFF 갱신 검증: 전체 ./gradlew build(test 포함) SUCCESSFUL, Flyway V88~V106 success, GET+액션POST smoke 5xx 0건, 9개 집계쿼리 SQL 유효성 확인, 공식 런타임 실측. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,145 @@
|
||||
import { useState } from 'react';
|
||||
import { Alert, Form, Input, InputNumber, Modal, Space, Tag, message } from 'antd';
|
||||
import { ProCard } from '@ant-design/pro-components';
|
||||
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import type { ColDef } from '@ag-grid-community/core';
|
||||
import PageContainer from '@/components/common/PageContainer';
|
||||
import SearchForm from '@/components/common/SearchForm';
|
||||
import DataGrid from '@/components/common/DataGrid';
|
||||
import PermissionButton from '@/components/common/PermissionButton';
|
||||
import { operationApi, JointContractRow } from '@/api/operation';
|
||||
import { GRAY, RADIUS, SHADOW } from '@/theme/tokens';
|
||||
|
||||
const cardStyle = { background: '#fff', borderRadius: RADIUS.lg, border: `1px solid ${GRAY[100]}`, boxShadow: SHADOW.sm };
|
||||
|
||||
const ROLE_LABEL: Record<string, string> = { LEAD: '주설계사', SUB: '공동설계사' };
|
||||
const ROLE_COLOR: Record<string, string> = { LEAD: 'blue', SUB: 'default' };
|
||||
|
||||
const COLS: ColDef<JointContractRow>[] = [
|
||||
{ field: 'contractNo', headerName: '계약번호', width: 160 },
|
||||
{ field: 'agentName', headerName: '설계사', width: 130 },
|
||||
{ field: 'role', headerName: '역할', width: 120,
|
||||
cellRenderer: (p: { value: string }) => (
|
||||
<Tag color={ROLE_COLOR[p.value] ?? 'default'}>{ROLE_LABEL[p.value] ?? p.value}</Tag>
|
||||
) },
|
||||
{ field: 'shareRate', headerName: '지분율(%)', width: 120, type: 'numericColumn',
|
||||
valueFormatter: (p) => `${((p.value as number) * 100).toFixed(2)}%` },
|
||||
{ field: 'createdAt', headerName: '등록일', flex: 1 },
|
||||
];
|
||||
|
||||
export default function JointContract() {
|
||||
const qc = useQueryClient();
|
||||
const [searchParams, setSearchParams] = useState<{ contractNo?: string; agentName?: string }>({});
|
||||
const [modalOpen, setModalOpen] = useState(false);
|
||||
const [editingRow, setEditingRow] = useState<JointContractRow | null>(null);
|
||||
const [form] = Form.useForm();
|
||||
|
||||
const { data, isLoading, isError } = useQuery({
|
||||
queryKey: ['joint-contract', 'list', searchParams],
|
||||
queryFn: () => operationApi.jointContractList(searchParams),
|
||||
retry: false,
|
||||
});
|
||||
|
||||
const rows = data?.list ?? [];
|
||||
|
||||
const openCreate = () => { setEditingRow(null); form.resetFields(); setModalOpen(true); };
|
||||
const openEdit = (row: JointContractRow) => { setEditingRow(row); form.setFieldsValue({ ...row, shareRate: (row.shareRate as number) * 100 }); setModalOpen(true); };
|
||||
|
||||
const handleSave = async () => {
|
||||
const values = await form.validateFields();
|
||||
// shareRate: UI는 % 단위 → 백엔드는 0~1
|
||||
const body = { ...values, shareRate: (values.shareRate as number) / 100 };
|
||||
try {
|
||||
if (editingRow) {
|
||||
await operationApi.jointContractUpdate(editingRow.jointId, body);
|
||||
message.success('수정 완료');
|
||||
} else {
|
||||
await operationApi.jointContractCreate(body);
|
||||
message.success('등록 완료');
|
||||
}
|
||||
qc.invalidateQueries({ queryKey: ['joint-contract', 'list'] });
|
||||
setModalOpen(false);
|
||||
} catch (err: unknown) {
|
||||
// E411: 지분율 합계 초과
|
||||
const e = err as { code?: string; message?: string };
|
||||
if (e?.code === 'E411') {
|
||||
message.error(e.message ?? '지분율 합계가 1을 초과합니다');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const handleDelete = (id: number) => Modal.confirm({
|
||||
title: '공동계약 삭제', content: '삭제하시겠습니까?',
|
||||
onOk: async () => {
|
||||
await operationApi.jointContractDelete(id);
|
||||
message.success('삭제 완료');
|
||||
qc.invalidateQueries({ queryKey: ['joint-contract', 'list'] });
|
||||
},
|
||||
});
|
||||
|
||||
const actionCol: ColDef<JointContractRow> = {
|
||||
headerName: '액션', width: 160, pinned: 'right',
|
||||
cellRenderer: (p: { data: JointContractRow }) => (
|
||||
<Space>
|
||||
<PermissionButton menuCode="JOINT_CONTRACT" permCode="UPDATE" size="small" onClick={() => openEdit(p.data)}>수정</PermissionButton>
|
||||
<PermissionButton menuCode="JOINT_CONTRACT" permCode="DELETE" size="small" danger onClick={() => handleDelete(p.data.jointId)}>삭제</PermissionButton>
|
||||
</Space>
|
||||
),
|
||||
};
|
||||
|
||||
return (
|
||||
<PageContainer title="공동계약" description="공동 모집 계약 지분율 관리">
|
||||
{isError && (
|
||||
<Alert type="warning" showIcon message="API 미응답" description="/api/joint-contracts 를 확인하세요." style={{ marginBottom: 16 }} />
|
||||
)}
|
||||
|
||||
<SearchForm
|
||||
conditions={[
|
||||
{ type: 'text', name: 'contractNo', label: '계약번호', span: 6 },
|
||||
{ type: 'text', name: 'agentName', label: '설계사명', span: 6 },
|
||||
]}
|
||||
onSearch={(v) => setSearchParams({ contractNo: v.contractNo as string, agentName: v.agentName as string })}
|
||||
onReset={() => setSearchParams({})}
|
||||
/>
|
||||
|
||||
<ProCard style={cardStyle}>
|
||||
<div style={{ marginBottom: 12 }}>
|
||||
<PermissionButton menuCode="JOINT_CONTRACT" permCode="CREATE" type="primary" onClick={openCreate}>
|
||||
+ 공동계약 등록
|
||||
</PermissionButton>
|
||||
</div>
|
||||
<DataGrid<JointContractRow>
|
||||
rows={rows}
|
||||
columns={[...COLS, actionCol]}
|
||||
loading={isLoading}
|
||||
height={520}
|
||||
rowKey="jointId"
|
||||
/>
|
||||
</ProCard>
|
||||
|
||||
<Modal
|
||||
title={editingRow ? '공동계약 수정' : '공동계약 등록'}
|
||||
open={modalOpen}
|
||||
onOk={handleSave}
|
||||
onCancel={() => setModalOpen(false)}
|
||||
okText="저장"
|
||||
cancelText="취소"
|
||||
>
|
||||
<Form form={form} layout="vertical">
|
||||
<Form.Item name="contractId" label="계약ID" rules={[{ required: true }]}>
|
||||
<InputNumber style={{ width: '100%' }} min={1} />
|
||||
</Form.Item>
|
||||
<Form.Item name="agentId" label="설계사ID" rules={[{ required: true }]}>
|
||||
<InputNumber style={{ width: '100%' }} min={1} />
|
||||
</Form.Item>
|
||||
<Form.Item name="role" label="역할" rules={[{ required: true }]}>
|
||||
<Input placeholder="LEAD / SUB" />
|
||||
</Form.Item>
|
||||
<Form.Item name="shareRate" label="지분율(%)" rules={[{ required: true }]}>
|
||||
<InputNumber style={{ width: '100%' }} min={0} max={100} step={0.01} addonAfter="%" />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
</PageContainer>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user