- 新增通知配置、渠道、发送日志三张表(MySQL/SQLite 双建表脚本)及实体、Mapper、Service、Controller - 支持邮箱(SMTP)与 Server 酱两种推送渠道,抽象 NotificationSender 工厂统一发送 - 新增 NotificationScheduler 定时任务,按每天/每周/每月周期检查并推送账单导入提醒 - 新增全局通知链接地址配置(/api/app/notification-url),随提醒一并下发 - 前端系统设置页新增「定时通知」面板,支持周期配置、渠道增删改测、立即发送与发送日志 - 新增 /bill-import 直达页,供提醒链接一键打开账单上传弹窗 - 登录支持 redirect 回跳,仅允许站内路径以防开放重定向
101 lines
3.0 KiB
Groovy
101 lines
3.0 KiB
Groovy
plugins {
|
||
id 'java'
|
||
id 'org.springframework.boot' version '3.3.6'
|
||
id 'io.spring.dependency-management' version '1.1.7'
|
||
}
|
||
|
||
group = 'cn.rosercode'
|
||
version = '0.0.1-SNAPSHOT'
|
||
|
||
java {
|
||
toolchain {
|
||
languageVersion = JavaLanguageVersion.of(21)
|
||
}
|
||
}
|
||
|
||
configurations {
|
||
compileOnly {
|
||
extendsFrom annotationProcessor
|
||
}
|
||
}
|
||
|
||
repositories {
|
||
mavenCentral()
|
||
}
|
||
|
||
dependencies {
|
||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||
implementation 'org.springframework.boot:spring-boot-starter-validation'
|
||
implementation 'org.springframework.boot:spring-boot-starter-mail'
|
||
implementation 'org.springframework.security:spring-security-crypto'
|
||
|
||
implementation 'com.baomidou:mybatis-plus-spring-boot3-starter:3.5.12'
|
||
implementation 'com.baomidou:mybatis-plus-jsqlparser:3.5.12'
|
||
runtimeOnly 'com.mysql:mysql-connector-j'
|
||
// SQLite 驱动,用于本地文件数据库
|
||
runtimeOnly 'org.xerial:sqlite-jdbc:3.46.1.3'
|
||
|
||
implementation 'com.github.xiaoymin:knife4j-openapi3-jakarta-spring-boot-starter:4.5.0'
|
||
|
||
implementation 'com.alibaba:easyexcel:4.0.3'
|
||
implementation 'org.apache.commons:commons-csv:1.12.0'
|
||
|
||
implementation 'io.jsonwebtoken:jjwt-api:0.12.6'
|
||
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.12.6'
|
||
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.12.6'
|
||
|
||
compileOnly 'org.projectlombok:lombok'
|
||
annotationProcessor 'org.projectlombok:lombok'
|
||
|
||
developmentOnly 'org.springframework.boot:spring-boot-devtools'
|
||
|
||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||
}
|
||
|
||
tasks.named('test') {
|
||
useJUnitPlatform()
|
||
}
|
||
|
||
// ===== 前端构建与打包 =====
|
||
def frontendDir = file("${projectDir}/frontend")
|
||
def frontendDistDir = file("${frontendDir}/dist")
|
||
|
||
// 解析 npm 可执行文件:优先使用 NODE_HOME,其次使用 PATH 中的 npm
|
||
def resolveNpm = {
|
||
def nodeHome = System.getenv('NODE_HOME')
|
||
return nodeHome ? "${nodeHome}/bin/npm" : 'npm'
|
||
}
|
||
|
||
// 安装前端依赖(node_modules 存在且 package.json 未变化时自动跳过)
|
||
tasks.register('npmInstall', Exec) {
|
||
group = 'frontend'
|
||
description = '安装前端依赖'
|
||
workingDir frontendDir
|
||
commandLine resolveNpm(), 'install'
|
||
inputs.file("${frontendDir}/package.json")
|
||
outputs.dir("${frontendDir}/node_modules")
|
||
}
|
||
|
||
// 构建前端产物
|
||
tasks.register('frontendBuild', Exec) {
|
||
group = 'frontend'
|
||
description = '构建前端产物(npm run build)'
|
||
dependsOn 'npmInstall'
|
||
workingDir frontendDir
|
||
commandLine resolveNpm(), 'run', 'build'
|
||
inputs.dir("${frontendDir}/src")
|
||
inputs.file("${frontendDir}/package.json")
|
||
inputs.file("${frontendDir}/index.html")
|
||
inputs.file("${frontendDir}/vite.config.ts")
|
||
outputs.dir(frontendDistDir)
|
||
}
|
||
|
||
// 将前端产物打入可执行 jar 的静态资源目录,实现前后端一体化部署
|
||
tasks.named('bootJar') {
|
||
dependsOn 'frontendBuild'
|
||
from(frontendDistDir) {
|
||
into 'BOOT-INF/classes/static'
|
||
}
|
||
}
|