feat: MappingEngine + Override 실제 로직 + 프론트 주요 화면

Backend:
- MappingEngine: company_field_mapping 기반 동적 변환 구현
  - raw_content(JSON) → 표준 원장 (TRIM/UPPER/LOWER/DATE/DIVIDE/MULTIPLY/CODE_MAP)
  - policy_no 로 contract 매칭 → contract_id/agent_id 자동
  - 실패 시 parse_error_log 자동 적재
- Recruit/Maintain Mapper.sumByAgentMonth 추가
- OrganizationMapper.selectAncestorIds (CTE 재귀 상향) 추가
- CalcOverrideStep 실제 동작:
  * lower agent 의 모집+유지 합계를 base 로 사용
  * 자기 조직 → 상위 조직 순으로 to_grade 직급 ACTIVE 설계사 탐색
  * (lowerOrgId, toGrade) 캐싱

Frontend (주요 화면):
- 공통 컴포넌트:
  * CodeSelect (공통코드 드롭다운, React Query 캐시)
  * CodeBadge (상태 색상 자동 매핑)
  * MoneyText (천단위 콤마, 음수 빨강, 부호 옵션)
  * PermissionButton (권한 없으면 미렌더)
  * SearchForm (조건 배열 → 자동 폼)
  * ExcelExportButton (blob 다운로드)
  * PageContainer
- 훅: useCommonCodes, usePermission (메뉴별 boolean)
- API 모듈: agent, contract, ledger, settle, code
- 페이지: AgentList, ContractList, RecruitLedger, SettleList
  * SettleList: 월 요약 카드 + 확정/보류 액션 + 권한 체크
- 라우터: /org/agents, /contracts, /ledger/recruit, /settle

V16 fix:
- PAYMENT 메뉴는 V12 에서 level1 directory 로 생성됨 → V16 에서 PAGE 로 UPDATE 후 권한 매트릭스 적용 (자식으로 또 만들면 unique 충돌)
This commit is contained in:
GA Pro
2026-05-09 22:38:10 +09:00
parent d4433a8e46
commit 98eb231950
28 changed files with 1165 additions and 39 deletions
+79
View File
@@ -0,0 +1,79 @@
import { useState } from 'react';
import { Table } from 'antd';
import { useQuery } from '@tanstack/react-query';
import { useNavigate } from 'react-router-dom';
import PageContainer from '@/components/common/PageContainer';
import SearchForm from '@/components/common/SearchForm';
import CodeBadge from '@/components/common/CodeBadge';
import MoneyText from '@/components/common/MoneyText';
import PermissionButton from '@/components/common/PermissionButton';
import ExcelExportButton from '@/components/common/ExcelExportButton';
import { agentApi, AgentResp, AgentSearchParam } from '@/api/agent';
export default function AgentList() {
const navigate = useNavigate();
const [param, setParam] = useState<AgentSearchParam>({ pageNum: 1, pageSize: 20 });
const { data, isLoading } = useQuery({
queryKey: ['agent', 'list', param],
queryFn: () => agentApi.list(param),
});
return (
<PageContainer
title="설계사 관리"
extra={
<div>
<PermissionButton menuCode="ORG_AGENT" permCode="CREATE" type="primary"
onClick={() => navigate('/org/agents/new')} style={{ marginRight: 8 }}>
</PermissionButton>
<ExcelExportButton url="/api/agents/export" params={param} fileName="설계사목록" />
</div>
}
>
<SearchForm
conditions={[
{ type: 'text', name: 'searchKeyword', label: '설계사명' },
{ type: 'code', name: 'status', label: '상태', groupCode: 'AGENT_STATUS' },
]}
onSearch={(v) => setParam({ ...param, ...v, pageNum: 1 })}
onReset={() => setParam({ pageNum: 1, pageSize: 20 })}
/>
<Table<AgentResp>
rowKey="agentId"
loading={isLoading}
dataSource={data?.list}
pagination={{
current: param.pageNum,
pageSize: param.pageSize,
total: data?.total,
showSizeChanger: true,
onChange: (page, size) => setParam({ ...param, pageNum: page, pageSize: size }),
}}
onRow={(r) => ({ onClick: () => navigate(`/org/agents/${r.agentId}`) })}
columns={[
{ title: '설계사명', dataIndex: 'agentName', width: 120 },
{ title: '사번', dataIndex: 'licenseNo', width: 120 },
{ title: '소속', dataIndex: 'orgName', width: 200 },
{ title: '직급', dataIndex: 'gradeName', width: 100 },
{ title: '전화번호', dataIndex: 'phone', width: 140 },
{
title: '상태', dataIndex: 'status', width: 100,
render: (v) => <CodeBadge groupCode="AGENT_STATUS" value={v} />,
},
{
title: '계약수', dataIndex: 'contractCount', align: 'right', width: 90,
render: (v) => <MoneyText value={v} />,
},
{
title: '누적수수료', dataIndex: 'totalCommission', align: 'right', width: 130,
render: (v) => <MoneyText value={v} />,
},
{ title: '입사일', dataIndex: 'joinDate', width: 110 },
]}
/>
</PageContainer>
);
}