feat: ga-core + ga-api + ga-batch + V13-V15 + Docker + frontend skeleton

ga-core (22 tables):
- user/role: VO + Mapper + XML (login + RBAC)
- org: Grade, Organization (CTE recursive tree), Agent + history
- product: InsuranceCompany, Product, Contract
- rule: CommissionRate, PayoutRule, OverrideRule, ChargebackRule, ExceptionTypeCode
- receive: CompanyProfile, FieldMapping, CodeMapping, RawCommissionData, ParseError
- ledger: Recruit, Maintain, Exception (batch insert + cursor)
- settle: SettleMaster (UPSERT), Override, Chargeback, Payment, Reconciliation, BatchJobLog
- All XMLs use EncryptTypeHandler for PII fields

ga-api:
- AuthController: login (lock on N fails), refresh, me, password, logout
- Domain controllers: Agent, Organization, Contract, Company, Product, Rule,
  Receive, Ledger (recruit/maintain/exception + approve), Settle (confirm/hold/release),
  Payment, User, Role (matrix), BatchTrigger
- All use @RequirePermission + @DataChangeLog

ga-batch:
- MonthlySettlementJob: 8 Steps (receiveData, transformData, reconcile,
  calcRecruit, calcMaintain, chargebackException, calcOverride, aggregate)
- DataReceiver strategy + ManualReceiver, MappingEngine stub
- CommissionCalculator (pct/tax via MoneyUtil), JobLauncherController

DB V13~V15:
- V13: 14 indexes (settle_master, ledgers, contract, chargeback, payment, raw, logs)
- V14: create_monthly_partition() helper function
- V15: v_agent_monthly_summary, v_org_settle_summary, v_chargeback_risk views

Infra:
- docker-compose: postgres + redis + api + batch + frontend
- Multi-stage Dockerfile (gradle build → JRE)

ga-frontend (skeleton):
- Vite + React 18 + TypeScript + AntD 5 + AG Grid + React Query + Zustand
- API request layer (axios + JWT), LoginPage, MainLayout (dynamic menu), Dashboard
- nginx.conf for /api proxying
This commit is contained in:
GA Pro
2026-05-09 22:00:53 +09:00
parent cef4e48e27
commit 7f3c564605
147 changed files with 6987 additions and 79 deletions
+21
View File
@@ -0,0 +1,21 @@
import { Routes, Route, Navigate } from 'react-router-dom';
import LoginPage from '@/pages/LoginPage';
import MainLayout from '@/layouts/MainLayout';
import Dashboard from '@/pages/Dashboard';
function RequireAuth({ children }: { children: React.ReactNode }) {
const token = localStorage.getItem('accessToken');
return token ? <>{children}</> : <Navigate to="/login" replace />;
}
export default function App() {
return (
<Routes>
<Route path="/login" element={<LoginPage />} />
<Route path="/" element={<RequireAuth><MainLayout /></RequireAuth>}>
<Route index element={<Dashboard />} />
{/* TODO: 추가 페이지는 동적 라우팅으로 확장 */}
</Route>
</Routes>
);
}
+39
View File
@@ -0,0 +1,39 @@
import api, { unwrap } from './request';
export interface LoginReq {
loginId: string;
password: string;
}
export interface LoginResp {
accessToken: string;
refreshToken?: string;
accessTokenExpiresIn: number;
userId: number;
loginId: string;
userName: string;
roles: string[];
}
export interface UserResp {
userId: number;
loginId: string;
userName: string;
email?: string;
phone?: string;
agentId?: number;
agentName?: string;
orgName?: string;
status: string;
roleCodes?: string[];
}
export const authApi = {
login: (req: LoginReq) => unwrap<LoginResp>(api.post('/api/auth/login', req)),
refresh: (refreshToken: string) =>
unwrap<LoginResp>(api.post('/api/auth/refresh', { refreshToken })),
me: () => unwrap<UserResp>(api.get('/api/auth/me')),
logout: () => unwrap<void>(api.post('/api/auth/logout')),
changePassword: (oldPassword: string, newPassword: string) =>
unwrap<void>(api.post('/api/auth/password', { oldPassword, newPassword })),
};
+21
View File
@@ -0,0 +1,21 @@
import api, { unwrap } from './request';
export interface MenuResp {
menuId: number;
parentMenuId?: number;
menuCode: string;
menuName: string;
menuType: 'DIRECTORY' | 'PAGE' | 'LINK';
menuPath?: string;
menuIcon?: string;
componentPath?: string;
menuLevel: number;
sortOrder: number;
permissions: string[];
children: MenuResp[];
}
export const menuApi = {
myMenus: () => unwrap<MenuResp[]>(api.get('/api/menus/my')),
tree: () => unwrap<MenuResp[]>(api.get('/api/menus/tree')),
};
+61
View File
@@ -0,0 +1,61 @@
import axios, { AxiosError } from 'axios';
import { message } from 'antd';
export interface ApiResponse<T> {
success: boolean;
code: string;
message: string;
data: T;
timestamp: string;
}
export interface PageResponse<T> {
list: T[];
pageNum: number;
pageSize: number;
total: number;
pages: number;
}
const api = axios.create({
baseURL: import.meta.env.VITE_API_URL ?? '',
timeout: 60_000,
});
api.interceptors.request.use((config) => {
const token = localStorage.getItem('accessToken');
if (token) config.headers.Authorization = `Bearer ${token}`;
return config;
});
api.interceptors.response.use(
(res) => {
const body = res.data;
if (body && typeof body === 'object' && 'success' in body && body.success === false) {
message.error(body.message ?? '오류가 발생했습니다');
return Promise.reject(body);
}
return res;
},
(err: AxiosError<ApiResponse<unknown>>) => {
const status = err.response?.status;
const body = err.response?.data;
if (status === 401) {
localStorage.removeItem('accessToken');
window.location.href = '/login';
} else if (status === 403) {
message.error(body?.message ?? '권한이 없습니다');
} else {
message.error(body?.message ?? err.message ?? '서버 오류');
}
return Promise.reject(err);
},
);
export default api;
/** ApiResponse<T> 의 data 만 풀어서 반환 */
export async function unwrap<T>(p: Promise<{ data: ApiResponse<T> }>): Promise<T> {
const res = await p;
return res.data.data;
}
+5
View File
@@ -0,0 +1,5 @@
html, body, #root { height: 100%; margin: 0; padding: 0; }
body {
font-family: -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", sans-serif;
background: #f5f5f5;
}
+72
View File
@@ -0,0 +1,72 @@
import { Layout, Menu, Dropdown, Badge, Space, Avatar, Button } from 'antd';
import { useNavigate, Outlet } from 'react-router-dom';
import { useQuery } from '@tanstack/react-query';
import { BellOutlined, UserOutlined, LogoutOutlined } from '@ant-design/icons';
import { menuApi, MenuResp } from '@/api/menu';
import { authApi } from '@/api/auth';
import { useAuthStore } from '@/stores/auth';
const { Header, Sider, Content } = Layout;
function toMenuItems(menus: MenuResp[]): any[] {
return menus.map((m) => ({
key: m.menuPath ?? m.menuCode,
label: m.menuName,
children: m.children?.length ? toMenuItems(m.children) : undefined,
}));
}
export default function MainLayout() {
const navigate = useNavigate();
const auth = useAuthStore();
const { data: menus = [] } = useQuery({
queryKey: ['menu', 'my'],
queryFn: menuApi.myMenus,
});
const handleLogout = async () => {
try { await authApi.logout(); } catch { /* ignore */ }
localStorage.removeItem('accessToken');
localStorage.removeItem('refreshToken');
auth.clear();
navigate('/login');
};
return (
<Layout style={{ minHeight: '100vh' }}>
<Header style={{ display: 'flex', justifyContent: 'space-between',
background: '#001529', color: '#fff' }}>
<div style={{ fontSize: 18, fontWeight: 600 }}>GA </div>
<Space>
<Badge count={0}>
<Button type="text" icon={<BellOutlined style={{ color: '#fff' }} />} />
</Badge>
<Dropdown menu={{
items: [
{ key: 'logout', label: '로그아웃', icon: <LogoutOutlined />, onClick: handleLogout },
],
}}>
<Space style={{ color: '#fff', cursor: 'pointer' }}>
<Avatar size="small" icon={<UserOutlined />} />
{auth.userName ?? auth.loginId}
</Space>
</Dropdown>
</Space>
</Header>
<Layout>
<Sider width={240} theme="light">
<Menu
mode="inline"
items={toMenuItems(menus)}
onClick={({ key }) => navigate(String(key))}
style={{ borderRight: 0, height: '100%' }}
/>
</Sider>
<Content style={{ padding: 24 }}>
<Outlet />
</Content>
</Layout>
</Layout>
);
}
+25
View File
@@ -0,0 +1,25 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ConfigProvider } from 'antd';
import koKR from 'antd/locale/ko_KR';
import 'dayjs/locale/ko';
import App from './App';
import './index.css';
const queryClient = new QueryClient({
defaultOptions: { queries: { retry: 1, staleTime: 30_000 } },
});
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<ConfigProvider locale={koKR}>
<QueryClientProvider client={queryClient}>
<BrowserRouter>
<App />
</BrowserRouter>
</QueryClientProvider>
</ConfigProvider>
</React.StrictMode>,
);
+25
View File
@@ -0,0 +1,25 @@
import { Card, Col, Row, Statistic, Typography } from 'antd';
const { Title } = Typography;
export default function Dashboard() {
return (
<>
<Title level={3}></Title>
<Row gutter={16}>
<Col span={6}>
<Card><Statistic title="이번 달 정산 건수" value={0} suffix="건" /></Card>
</Col>
<Col span={6}>
<Card><Statistic title="확정 대기" value={0} suffix="건" /></Card>
</Col>
<Col span={6}>
<Card><Statistic title="지급 완료" value={0} suffix="건" /></Card>
</Col>
<Col span={6}>
<Card><Statistic title="대사 차이" value={0} suffix="건" valueStyle={{ color: '#cf1322' }} /></Card>
</Col>
</Row>
</>
);
}
+42
View File
@@ -0,0 +1,42 @@
import { Button, Card, Form, Input, message } from 'antd';
import { useNavigate } from 'react-router-dom';
import { authApi } from '@/api/auth';
import { useAuthStore } from '@/stores/auth';
export default function LoginPage() {
const navigate = useNavigate();
const setAuth = useAuthStore((s) => s.setAuth);
const onFinish = async (values: { loginId: string; password: string }) => {
try {
const resp = await authApi.login(values);
localStorage.setItem('accessToken', resp.accessToken);
if (resp.refreshToken) localStorage.setItem('refreshToken', resp.refreshToken);
setAuth({
userId: resp.userId, loginId: resp.loginId,
userName: resp.userName, roles: resp.roles,
});
message.success(`${resp.userName}님 환영합니다`);
navigate('/');
} catch {
// 인터셉터에서 메시지 처리
}
};
return (
<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center',
minHeight: '100vh' }}>
<Card title="GA 수수료 정산 솔루션" style={{ width: 400 }}>
<Form layout="vertical" onFinish={onFinish}>
<Form.Item label="아이디" name="loginId" rules={[{ required: true }]}>
<Input autoFocus />
</Form.Item>
<Form.Item label="비밀번호" name="password" rules={[{ required: true }]}>
<Input.Password />
</Form.Item>
<Button type="primary" htmlType="submit" block></Button>
</Form>
</Card>
</div>
);
}
+22
View File
@@ -0,0 +1,22 @@
import { create } from 'zustand';
import { persist } from 'zustand/middleware';
interface AuthState {
userId?: number;
loginId?: string;
userName?: string;
roles: string[];
setAuth: (data: { userId: number; loginId: string; userName: string; roles: string[] }) => void;
clear: () => void;
}
export const useAuthStore = create<AuthState>()(
persist(
(set) => ({
roles: [],
setAuth: (d) => set({ ...d }),
clear: () => set({ userId: undefined, loginId: undefined, userName: undefined, roles: [] }),
}),
{ name: 'ga-auth' },
),
);