feat: project skeleton + DB migrations V1-V12 + ga-common framework

- Gradle multi-module: ga-common, ga-core, ga-api, ga-batch, ga-admin
- Flyway V1-V12: org/product/rule/receive/ledger/settle/batch/code/menu/system + seed
- ga-common (complete):
  - model: ApiResponse, PageResponse, SearchParam, TreeNode
  - exception: ErrorCode, BizException, GlobalExceptionHandler
  - annotation + aop: @RequirePermission, @DataChangeLog, ApiLog
  - auth + security: JWT, SecurityConfig
  - mybatis: BaseMapper, EncryptTypeHandler, JsonTypeHandler, AuditInterceptor
  - code (Redis cached) / menu (RBAC tree) / file / system / notification
  - excel: SXSSF+Cursor export, SAX+batch import (1M/700K rows)
  - util: Date/Money/Mask/Encrypt/Security
This commit is contained in:
GA Pro
2026-05-09 21:29:18 +09:00
parent c716f5eb70
commit cef4e48e27
100 changed files with 4914 additions and 0 deletions
@@ -0,0 +1,60 @@
package com.ga.common.notification;
import com.ga.common.exception.BizException;
import com.ga.common.exception.ErrorCode;
import com.ga.common.util.SecurityUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
@RequiredArgsConstructor
public class NotificationService {
private final NotificationMapper mapper;
public List<NotificationVO> myNotifications() {
Long userId = SecurityUtil.getCurrentUserId();
if (userId == null) throw new BizException(ErrorCode.UNAUTHORIZED);
return mapper.selectByUser(userId);
}
public int unreadCount() {
Long userId = SecurityUtil.getCurrentUserId();
if (userId == null) return 0;
return mapper.countUnread(userId);
}
@Transactional
public void markRead(Long notiId) {
Long userId = SecurityUtil.getCurrentUserId();
if (userId == null) throw new BizException(ErrorCode.UNAUTHORIZED);
mapper.markRead(notiId, userId);
}
@Transactional
public void markAllRead() {
Long userId = SecurityUtil.getCurrentUserId();
if (userId == null) throw new BizException(ErrorCode.UNAUTHORIZED);
mapper.markAllRead(userId);
}
@Transactional
public void send(Long userId, String type, String title, String content, String linkUrl) {
NotificationVO vo = new NotificationVO();
vo.setUserId(userId);
vo.setNotiType(type);
vo.setTitle(title);
vo.setContent(content);
vo.setLinkUrl(linkUrl);
mapper.insert(vo);
}
@Transactional
public void sendBatch(List<NotificationVO> list) {
if (list == null || list.isEmpty()) return;
mapper.insertBatch(list);
}
}