feat: 更新项目配置及业务模块
- 添加热部署依赖(spring-boot-devtools) - 更新数据库配置(192.168.1.203/oademo) - 添加新业务模块(TpClientFund, TpDeptCost, TpDeptReport) - 更新MySQL驱动版本到8.4.0 - 完善工作流模块及其他业务代码
This commit is contained in:
107
scripts/install_maven.ps1
Normal file
107
scripts/install_maven.ps1
Normal file
@@ -0,0 +1,107 @@
|
||||
<#
|
||||
Windows PowerShell script to install Maven 3.6.x+ (binary) on Windows.
|
||||
This script downloads the binary, extracts it, sets MAVEN_HOME and PATH for the user,
|
||||
and verifies mvn -version. ASCII-only messages to minimize encoding issues.
|
||||
Usage:
|
||||
powershell -ExecutionPolicy Bypass -File scripts/install_maven.ps1 -Version 3.6.3
|
||||
powershell -ExecutionPolicy Bypass -File scripts/install_maven.ps1 -Version latest
|
||||
Notes:
|
||||
- Version must be a specific 3.6.x (currently supports 3.6.3).
|
||||
- InstallDir defaults to C:\Program Files\Maven.
|
||||
- ApiKey is accepted for future use; not used by Maven itself.
|
||||
"""
|
||||
#>
|
||||
|
||||
param(
|
||||
[ValidateSet("latest","3.6.3")]
|
||||
[string]$Version = "3.6.3",
|
||||
[string]$InstallDir = "C:\\Program Files\\Maven",
|
||||
[string]$ApiKey = $null
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Write-Host "Installing Maven..."
|
||||
|
||||
if (-Not (Test-Path $InstallDir)) {
|
||||
try {
|
||||
New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null
|
||||
} catch {
|
||||
$InstallDir = Join-Path $env:USERPROFILE "maven"
|
||||
if (-Not (Test-Path $InstallDir)) {
|
||||
New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($Version -eq "latest") {
|
||||
Write-Error "Latest version not auto-resolved in this script. Please specify 3.6.3."
|
||||
exit 1
|
||||
}
|
||||
|
||||
$zipName = "apache-maven-$Version-bin.zip"
|
||||
$url = "https://archive.apache.org/dist/maven/maven-3/$Version/binaries/$zipName"
|
||||
$tempZip = Join-Path $env:TEMP $zipName
|
||||
$destDir = Join-Path $InstallDir "apache-maven-$Version"
|
||||
|
||||
if (Test-Path $destDir) {
|
||||
Write-Host "Maven already installed at $destDir"; exit 0
|
||||
}
|
||||
|
||||
Write-Host "Downloading Maven $Version..."
|
||||
$maxRetries = 3
|
||||
$attempt = 0
|
||||
while ($attempt -lt $maxRetries) {
|
||||
try {
|
||||
Invoke-WebRequest -Uri $url -OutFile $tempZip -ErrorAction Stop
|
||||
break
|
||||
} catch {
|
||||
$attempt++
|
||||
if ($attempt -ge $maxRetries) {
|
||||
Write-Error "Failed to download Maven after $maxRetries attempts. Please check network and proxy settings."
|
||||
exit 1
|
||||
}
|
||||
Write-Warning "Download failed. Retrying ($attempt/$maxRetries)..."
|
||||
Start-Sleep -Seconds 5
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Extracting to $InstallDir..."
|
||||
Expand-Archive -Path $tempZip -DestinationPath $InstallDir -Force
|
||||
|
||||
$mavenHome = (Join-Path $InstallDir "apache-maven-$Version").TrimEnd('\\')
|
||||
if (-Not (Test-Path $mavenHome)) {
|
||||
Write-Error "Extraction failed: Maven directory not found: $mavenHome"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Set MAVEN_HOME and PATH (user scope)
|
||||
Write-Host "Configuring environment variables..."
|
||||
[Environment]::SetEnvironmentVariable("MAVEN_HOME", $mavenHome, [EnvironmentVariableTarget]::User)
|
||||
$binPath = Join-Path $mavenHome "bin"
|
||||
$sep = [System.IO.Path]::PathSeparator
|
||||
$pathValue = [Environment]::GetEnvironmentVariable("PATH", [EnvironmentVariableTarget]::User)
|
||||
if (-not ($pathValue -and $pathValue -like "*$binPath*")) {
|
||||
if (-not $pathValue) { $newPath = $binPath } else { $newPath = $pathValue + $sep + $binPath }
|
||||
[Environment]::SetEnvironmentVariable("PATH", $newPath, [EnvironmentVariableTarget]::User)
|
||||
Write-Host "PATH updated to include $binPath"
|
||||
} else {
|
||||
Write-Host "PATH already includes Maven bin: $binPath"
|
||||
}
|
||||
|
||||
Write-Host "Verifying mvn version..."
|
||||
try {
|
||||
$mvnVer = & "$mavenHome\\bin\\mvn" -version
|
||||
Write-Host $mvnVer
|
||||
} catch {
|
||||
Write-Error "Could not run mvn. Ensure PATH is set correctly and reopen a new terminal."
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "Maven installation complete."
|
||||
|
||||
if (-not [string]::IsNullOrEmpty($ApiKey)) {
|
||||
Write-Host "Note: API key provided, but not used by Maven."
|
||||
}
|
||||
|
||||
Exit 0
|
||||
88
scripts/install_opencode_supermemory.ps1
Normal file
88
scripts/install_opencode_supermemory.ps1
Normal file
@@ -0,0 +1,88 @@
|
||||
<#
|
||||
OpenCode 插件安装脚本:install_opencode_supermemory.ps1
|
||||
功能:在 Windows 环境下,使用本地 bun.exe 安装 opencode-supermemory 插件,支持指定版本或 latest,并可注入 SUPERMEMORY_API_KEY。
|
||||
用法示例:
|
||||
- 指定版本安装:powershell -ExecutionPolicy Bypass -File scripts\install_opencode_supermemory.ps1 -Version 3.3.8 -ApiKey "sm_你的密钥"
|
||||
- 安装最新版本:powershell -ExecutionPolicy Bypass -File scripts\install_opencode_supermemory.ps1 -Version latest
|
||||
#>
|
||||
|
||||
param(
|
||||
[ValidateSet("latest","3.3.8")]
|
||||
[string]$Version = "3.3.8",
|
||||
[string]$BunExePath = "C:\\Soft\\bun-windows-x64\\bun.exe",
|
||||
[string]$ApiKey
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Write-Host "---------- OpenCode: Install opencode-supermemory ----------"
|
||||
|
||||
if (-Not (Test-Path $BunExePath)) {
|
||||
Write-Error "Bun 可执行文件未找到:$BunExePath"
|
||||
Write-Host "请确保 bun.exe 位于该路径,或调整参数 -BunExePath。"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 1) 将 Bun 目录加入用户 PATH(确保会话后续可用)
|
||||
$bunDir = [System.IO.Path]::GetDirectoryName($BunExePath)
|
||||
try {
|
||||
$currentPath = [Environment]::GetEnvironmentVariable("PATH", [EnvironmentVariableTarget]::User)
|
||||
$paths = @($currentPath -split ";" | Where-Object { $_ -and $_ -ne $null })
|
||||
if (-Not ($paths -contains $bunDir)) {
|
||||
$newPath = $currentPath + ";" + $bunDir
|
||||
[Environment]::SetEnvironmentVariable("PATH", $newPath, [EnvironmentVariableTarget]::User)
|
||||
Write-Host "PATH 已更新,已包含 Bun 目录:$bunDir (用户作用域)"
|
||||
} else {
|
||||
Write-Host "PATH 已包含 Bun 目录:$bunDir"
|
||||
}
|
||||
} catch {
|
||||
Write-Warning "无法更新 PATH:$($_.Exception.Message)"
|
||||
}
|
||||
|
||||
# 2) 验证 bun 与 bunx 是否可用
|
||||
try {
|
||||
$bunVer = & "${BunExePath}" --version
|
||||
Write-Host "Bun 版本:$bunVer"
|
||||
$bunxPath = Join-Path $bunDir "bunx.exe"
|
||||
if (Test-Path $bunxPath) {
|
||||
$bunxVer = & "$bunxPath" --version
|
||||
Write-Host "Bunx 版本:$bunxVer"
|
||||
} else {
|
||||
Write-Host "未找到 bunx.exe,将使用 bun.exe 进行安装。"
|
||||
}
|
||||
} catch {
|
||||
Write-Error "无法验证 Bun:$($_.Exception.Message)"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 3) 安装插件
|
||||
if ($Version -eq "latest") {
|
||||
$installTarget = "opencode-supermemory@latest install"
|
||||
} else {
|
||||
$installTarget = "opencode-supermemory@${Version} install"
|
||||
}
|
||||
|
||||
try {
|
||||
if (Test-Path (Join-Path $bunDir "bunx.exe")) {
|
||||
& (Join-Path $bunDir "bunx.exe") $installTarget
|
||||
} else {
|
||||
& (Join-Path $bunDir "bun.exe") $installTarget
|
||||
}
|
||||
} catch {
|
||||
Write-Error "安装插件失败: $($_.Exception.Message)"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 4) 设置 SUPERMEMORY_API_KEY(若提供)
|
||||
if (-not [string]::IsNullOrEmpty($ApiKey)) {
|
||||
[Environment]::SetEnvironmentVariable("SUPERMEMORY_API_KEY", $ApiKey, [EnvironmentVariableTarget]::User)
|
||||
Write-Host "SUPERMEMORY_API_KEY 已设置(用户级变量)"
|
||||
} elseif ($Env:SUPERMEMORY_API_KEY) {
|
||||
Write-Host "检测到已有 SUPERMEMORY_API_KEY 环境变量。"
|
||||
} else {
|
||||
Write-Host "未提供 SUPERMEMORY_API_KEY。若要使用云记忆,请提供密钥。"
|
||||
}
|
||||
|
||||
Write-Host "安装流程完成。请重新打开终端以刷新 PATH 与环境变量。"
|
||||
|
||||
Exit 0
|
||||
Reference in New Issue
Block a user