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:
@@ -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 })),
|
||||
};
|
||||
@@ -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')),
|
||||
};
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user