Ether PMS - 项目管理系统
Go to file
chiguyong 473bf5b81e refactor: DDD架构完善+测试mock配置修复
- 完善Service接口DDD分层架构
- 修复EquipmentHealthServiceTest mock配置
- 修复WorkOrderServiceTest状态转换测试mock
- 修复MaintenanceTaskServiceTest mock配置
- 修复SystemType枚举测试(FIRE→FIRE_PROTECTION)
- 添加工单事件监听器测试
- 添加工单状态历史测试
- 添加维保到期提醒功能

Tests: 100 passed, 0 failures
2026-05-19 14:33:34 +08:00
.docs/code-review/2026-04-26 docs: 更新Code Review分析报告 - 结论为误报 2026-04-26 19:03:01 +08:00
module-asset refactor: DDD架构完善+测试mock配置修复 2026-05-19 14:33:34 +08:00
module-auth refactor: DDD架构完善+测试mock配置修复 2026-05-19 14:33:34 +08:00
module-common refactor: DDD架构完善+测试mock配置修复 2026-05-19 14:33:34 +08:00
module-finance initial: ether-pms project skeleton 2026-03-17 21:44:46 +08:00
module-mdm refactor: DDD架构完善+测试mock配置修复 2026-05-19 14:33:34 +08:00
module-wo refactor: DDD架构完善+测试mock配置修复 2026-05-19 14:33:34 +08:00
pms-starter chore: 更新设备管理、工单完成等功能 2026-04-23 15:42:29 +08:00
scripts refactor: 重构模块结构,将设备/运维相关代码移至module-asset和module-wo 2026-04-06 15:41:11 +08:00
sql chore: 更新设备管理、工单完成等功能 2026-04-23 15:42:29 +08:00
.env chore: 更新设备管理、工单完成等功能 2026-04-23 15:42:29 +08:00
.env.example chore: 更新设备管理、工单完成等功能 2026-04-23 15:42:29 +08:00
.gitignore chore: 添加.gitignore排除target和临时文件 2026-03-22 01:36:32 +08:00
COMPOSITE_INDEXES_REPORT.md chore: 更新设备管理、工单完成等功能 2026-04-23 15:42:29 +08:00
HashPassword.class feat: add equipment extension fields to SpaceNode entity 2026-03-23 23:53:55 +08:00
HashPassword.java feat: add equipment extension fields to SpaceNode entity 2026-03-23 23:53:55 +08:00
README.md chore: 更新设备管理、工单完成等功能 2026-04-23 15:42:29 +08:00
pom.xml refactor: DDD架构完善+测试mock配置修复 2026-05-19 14:33:34 +08:00

README.md

ether-pms

Ether Project Management System

快速开始

前置要求

  • Java 17+
  • Maven 3.8+
  • PostgreSQL 14+
  • Node.js 18+ (用于前端开发)

安装与配置

1. 克隆项目

git clone <repository-url>
cd ether-pms

2. 配置环境变量(重要!)

必须配置 JWT Secret否则应用无法启动

# 复制环境变量模板
cp .env.example .env

# 编辑 .env 文件,设置 JWT Secret
# 生成安全的 JWT 密钥:
openssl rand -base64 64

# 将生成的密钥填入 .env 文件的 JWT_SECRET= 后面

3. 配置数据库

编辑 pms-starter/src/main/resources/application.yml 或通过环境变量配置数据库连接:

# 在 .env 文件中添加
SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/ether_pms
SPRING_DATASOURCE_USERNAME=your_db_user
SPRING_DATASOURCE_PASSWORD=your_password

4. 启动后端服务

# 编译项目
mvn clean install -DskipTests

# 启动应用(确保已设置环境变量)
export $(cat .env | xargs)
mvn spring-boot:run -pl pms-starter

应用将在 http://localhost:8080 启动。


安全配置指南 (重要)

JWT Secret 配置

JWT Secret 是系统安全的核心配置,必须在生产环境中正确配置

为什么这很重要?

  • JWT Secret 用于签名和验证用户 Token
  • 如果 Secret 被泄露或使用弱密钥,攻击者可以伪造任意用户身份(包括管理员)
  • 这是 P0 级别的安全问题

如何生成安全的 Secret

# 推荐方式:使用 OpenSSL 生成 64 字节 Base64 编码的随机密钥
openssl rand -base64 64

# 输出示例:
# x7K9mP2vQ4wR8tY1uI5oA0sD3fG6hJ9kL2nB4cV7bX0zQ1wE5rT8yU3iO6pA1sD==

配置验证规则

应用启动时会自动进行以下安全检查:

检查项 要求 行为
Secret 是否为空 不能为空 阻止启动,显示详细错误信息
是否使用默认值 不能使用已知弱密钥 阻止启动,列出检测到的值
Secret 长度 建议 >= 32 字符 显示警告(不阻止启动)

常见错误及解决方案

错误 1: JWT Secret 未配置

============================================
致命错误: JWT Secret 未配置!
============================================

解决方法:

# 生成密钥
openssl rand -base64 64 > /tmp/jwt_secret.txt

# 设置环境变量
export JWT_SECRET=$(cat /tmp/jwt_secret.txt)

# 删除临时文件(安全起见)
rm /tmp/jwt_secret.txt

错误 2: 使用了不安全的默认值

安全警告: 检测到不安全的 JWT Secret
当前值: my-secret-key-2024

解决方法: 重新生成新的随机密钥并更新配置(参考上述步骤)。

生产环境最佳实践

  1. 使用密码管理器: 推荐 HashiCorp Vault、AWS Secrets Manager 等
  2. 定期轮换: 建议每 90 天更换一次 JWT Secret
  3. 权限控制: 确保 .env 文件权限为 600
    chmod 600 .env
    
  4. 不要提交到 Git: 确保 .gitignore 包含 .env
  5. 监控日志: 关注应用启动时的安全警告信息

项目结构

Add your files

cd existing_repo
git remote add origin http://8.153.107.96/ether/ether-pms.git
git branch -M main
git push -uf origin main

Integrate with your tools

Collaborate with your team

Test and Deploy

Use the built-in continuous integration in GitLab.


Editing this README

When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to makeareadme.com for this template.

Suggestions for a good README

Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.

Name

Choose a self-explaining name for your project.

Description

Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.

Badges

On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.

Visuals

Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.

Installation

Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.

Usage

Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.

Support

Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.

Roadmap

If you have ideas for releases in the future, it is a good idea to list them in the README.

Contributing

State if you are open to contributions and what your requirements are for accepting them.

For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.

You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.

Authors and acknowledgment

Show your appreciation to those who have contributed to the project.

License

For open source projects, say how it is licensed.

Project status

If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.