Commit ffad7c0f 孙克

添加文档

1 个父辈 7e1e2684
提交 ffad7c0f 的 流水线 #1 失败 于 0 秒
正在显示 38 个修改的文件 包含 1399 行增加156 行删除
# EditorConfig 配置文件
# 用于统一不同编辑器和IDE之间的代码风格设置
# 根目录配置文件,停止向上查找
root = true
# 适用于所有文件
[*]
# 字符集
charset = utf-8
# 缩进风格:空格
indent_style = space
# 缩进大小
indent_size = 4
# 换行符风格(Unix风格)
end_of_line = lf
# 文件结尾添加换行
insert_final_newline = true
# 删除行尾空格
trim_trailing_whitespace = true
# 最大行长度
max_line_length = 120
# 适用于Java文件
[*.java]
# 缩进大小
indent_size = 4
# 块注释样式
block_comment_start = /*
block_comment = *
block_comment_end = */
# 单行注释样式
line_comment = //
# 适用于XML文件
[*.xml]
# 缩进大小
indent_size = 4
# 特殊处理XML注释
block_comment_start = <!--
block_comment_end = -->
# 适用于属性文件
[*.properties]
# 字符集(支持中文等Unicode字符)
charset = utf-8
# 缩进大小
indent_size = 4
# 适用于YAML配置文件
[*.yml]
# 缩进大小(YAML推荐使用2个空格)
indent_size = 2
# 适用于Markdown文件
[*.md]
# 行尾空格可能有特殊含义(如强制换行)
trim_trailing_whitespace = false
# 最大行长度(Markdown通常不强制限制行长度)
max_line_length = off
# 适用于Shell脚本
[*.sh]
# 使用Unix换行符
end_of_line = lf
# 确保文件具有执行权限
insert_final_newline = true
# 适用于批处理文件(Windows)
[*.bat]
# 使用Windows换行符
end_of_line = crlf
# 适用于日志文件
[*.log]
# 不修改日志文件的行尾和空格
trim_trailing_whitespace = false
insert_final_newline = false
\ No newline at end of file \ No newline at end of file
# GitLab CI/CD 配置文件
# Spring Boot Maven项目的CI/CD流水线
variables:
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
MAVEN_CLI_OPTS: "-s .m2/settings.xml --batch-mode"
stages:
- build
- test
- code-quality
- package
- deploy
# 缓存Maven依赖
cache:
paths:
- .m2/repository/
- target/
# 构建阶段
build:
stage: build
image: maven:3.8.6-eclipse-temurin-11
script:
- 'mkdir -p .m2'
- 'echo "<settings><localRepository>.m2/repository</localRepository></settings>" > .m2/settings.xml'
- mvn $MAVEN_CLI_OPTS compile
artifacts:
paths:
- target/classes/
- target/test-classes/
expire_in: 1 day
# 测试阶段
test:
stage: test
image: maven:3.8.6-eclipse-temurin-11
script:
- mvn $MAVEN_CLI_OPTS test
artifacts:
reports:
junit: target/surefire-reports/TEST-*.xml
paths:
- target/surefire-reports/
- target/jacoco-report/
expire_in: 1 day
# 代码质量分析阶段
sonarqube-check:
stage: code-quality
image: maven:3.8.6-eclipse-temurin-11
script:
- mvn $MAVEN_CLI_OPTS verify sonar:sonar -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_TOKEN
only:
- main
- develop
- merge_requests
checkstyle:
stage: code-quality
image: maven:3.8.6-eclipse-temurin-11
script:
- mvn $MAVEN_CLI_OPTS checkstyle:check
artifacts:
paths:
- target/checkstyle-result.xml
when: always
expire_in: 1 day
spotbugs:
stage: code-quality
image: maven:3.8.6-eclipse-temurin-11
script:
- mvn $MAVEN_CLI_OPTS com.github.spotbugs:spotbugs-maven-plugin:4.5.3.0:check
artifacts:
paths:
- target/spotbugsXml.xml
when: always
expire_in: 1 day
# 打包阶段
package:
stage: package
image: maven:3.8.6-eclipse-temurin-11
script:
- mvn $MAVEN_CLI_OPTS package -DskipTests
artifacts:
paths:
- target/*.jar
expire_in: 1 week
# 开发环境部署
deploy-dev:
stage: deploy
image: alpine:latest
script:
- apk add --no-cache openssh-client
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -H "$SSH_HOST" >> ~/.ssh/known_hosts
- scp target/*.jar "$SSH_USER@$SSH_HOST:$DEPLOY_PATH_DEV"
environment:
name: development
only:
- develop
when: manual
# 生产环境部署
deploy-prod:
stage: deploy
image: alpine:latest
script:
- apk add --no-cache openssh-client
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -H "$SSH_HOST" >> ~/.ssh/known_hosts
- scp target/*.jar "$SSH_USER@$SSH_HOST:$DEPLOY_PATH_PROD"
environment:
name: production
only:
- main
when: manual
\ No newline at end of file \ No newline at end of file
# 贡献指南
欢迎参与 SMF Core 项目的开发和贡献!本指南将帮助您了解如何有效地参与到项目中来。
## 行为准则
我们期望所有参与者遵循以下行为准则:
- 使用友好和包容性的语言
- 尊重不同的观点和经验
- 优雅地接受建设性批评
- 专注于对社区最有利的事情
- 对其他社区成员表示同理心
## 如何贡献
### 报告 Bug
如果您发现了 bug,请在 GitHub/GitLab 的 Issue 页面创建一个新的 issue,并包括以下信息:
- 简明扼要的标题
- 详细的问题描述
- 复现步骤
- 预期行为
- 实际行为
- 环境信息(操作系统、Java 版本、Spring Boot 版本等)
- 如有可能,附上日志或截图
### 功能请求
我们欢迎新功能的建议,请在 GitHub/GitLab 的 Issue 页面创建一个新的 issue,并包括:
- 功能描述
- 为什么需要这个功能
- 可能的实现方案
### 提交代码
1. **Fork 仓库**
- 点击仓库页面上的 Fork 按钮
2. **克隆仓库**
```bash
git clone https://github.com/YOUR_USERNAME/smf-core.git
cd smf-core
```
3. **创建分支**
```bash
git checkout -b feature/your-feature-name
# 或者修复 bug 时
git checkout -b bugfix/your-bugfix-name
```
4. **安装依赖**
```bash
./mvnw install
```
5. **编写代码**
- 遵循项目的代码风格
- 为新功能编写单元测试
- 确保所有测试通过
6. **提交更改**
```bash
git add .
git commit -m "描述您的更改:feat/fix: 具体内容"
```
提交信息应遵循以下格式:
- `feat: 新功能描述` - 新功能
- `fix: 修复内容描述` - Bug 修复
- `docs: 文档更新描述` - 文档更改
- `style: 代码风格更新` - 不影响功能的代码风格更改
- `refactor: 重构描述` - 既不修复 bug 也不添加功能的更改
- `test: 测试更新描述` - 添加或更新测试
- `chore: 构建任务更新` - 更改构建过程或辅助工具
7. **推送更改**
```bash
git push origin feature/your-feature-name
```
8. **创建 Pull Request**
- 回到您的 Fork 仓库
- 点击 "New Pull Request"
- 选择您的分支和目标分支(通常是 develop 分支)
- 填写 Pull Request 描述,包括:
- 更改的内容
- 解决的问题
- 任何需要注意的事项
### 代码审查流程
1. 提交 Pull Request 后,项目维护者将进行代码审查
2. 您可能需要根据反馈进行一些修改
3. 审查通过后,维护者将合并您的代码
## 开发规范
### 代码风格
- 遵循项目中的 Checkstyle 配置(checkstyle.xml)
- 使用 4 个空格进行缩进(不要使用制表符)
- 类名使用 PascalCase
- 方法名和变量名使用 camelCase
- 常量名使用全大写,单词间用下划线分隔
- 每个方法不超过 30 行代码
- 避免复杂的嵌套结构(最多 3 层嵌套)
### 测试要求
- 为所有新功能编写单元测试
- 确保测试覆盖率至少达到 80%
- 使用 JUnit 5 和 Mockito 进行测试
- 测试方法名应清晰描述测试内容
### 文档要求
- 为所有公共类和方法添加 Javadoc 注释
- 大型更改需要更新相关文档
- 添加适当的 README 和示例
## 开发环境设置
### 前提条件
- JDK 11 或更高版本
- Maven 3.6 或更高版本
- Git
- IDE(推荐 IntelliJ IDEA 或 Eclipse)
### 环境配置
1. 克隆仓库
```bash
git clone https://github.com/neotel/smf-core.git
```
2. 导入到 IDE
- IntelliJ IDEA: 选择 Import Project -> Maven
- Eclipse: Import -> Existing Maven Projects
3. 运行应用
```bash
./mvnw spring-boot:run
```
或者在 IDE 中运行 SmfCoreApplication 类
4. 运行测试
```bash
./mvnw test
```
5. 代码质量检查
```bash
./mvnw verify
```
## 版本控制规范
我们使用 Git Flow 分支管理策略:
- `main` - 生产环境稳定分支
- `develop` - 开发主分支
- `feature/*` - 新功能开发分支
- `bugfix/*` - Bug 修复分支
- `release/*` - 版本发布准备分支
- `hotfix/*` - 生产环境紧急修复分支
## 联系方式
如果您有任何问题或需要帮助,可以通过以下方式联系我们:
- 项目 Issue 页面
- 电子邮件:[support@neotel.com](mailto:support@neotel.com)
---
感谢您对 SMF Core 项目的贡献!
\ No newline at end of file \ No newline at end of file
# 安全策略
## 安全漏洞披露政策
SMF Core 项目重视安全问题,我们鼓励安全研究人员和用户报告潜在的安全漏洞。本政策描述了如何报告安全漏洞、我们的响应流程,以及我们对安全问题的处理方式。
## 支持的版本
以下版本的 SMF Core 目前接受安全漏洞报告并获得安全更新:
| 版本 | 支持状态 |
|------|----------|
| 1.0.x | ✅ 完全支持 |
| 0.9.x | ⚠️ 仅关键安全更新 |
| < 0.9.0 | ❌ 不再支持 |
## 如何报告安全漏洞
我们强烈建议在公开披露安全漏洞之前,先通过以下方式私下联系我们的安全团队,以便我们能够在漏洞被公开前修复问题。
### 报告方式
请通过电子邮件报告安全漏洞:
**电子邮件**: [security@neotel.com](mailto:security@neotel.com)
### 报告内容
为了帮助我们更好地理解和修复安全漏洞,请在报告中包含以下信息:
- 漏洞的详细描述
- 受影响的版本
- 复现漏洞的详细步骤
- 可能的影响
- 任何已知的缓解措施或临时解决方案
- 您的联系信息(如果您希望收到反馈)
## 我们的响应流程
我们承诺对安全漏洞报告做出及时响应:
1. **确认接收**(1-2个工作日内):
- 我们会在收到安全漏洞报告后的1-2个工作日内确认接收
- 我们会提供一个唯一的跟踪ID用于后续沟通
2. **评估漏洞**(3-5个工作日内):
- 我们的安全团队将评估漏洞的严重程度和影响范围
- 我们将确定是否将其归类为安全漏洞以及其优先级
3. **制定修复方案**(根据漏洞复杂度,5-10个工作日):
- 我们将开发和测试修复方案
- 对于严重漏洞,我们会尽快提供修复
4. **发布修复**
- 我们将在适当的版本中发布安全修复
- 对于严重漏洞,可能会发布紧急安全补丁
5. **公开披露**
- 在漏洞被修复后,我们会公开披露漏洞的详细信息
- 我们会在发布说明中致谢报告漏洞的安全研究人员(征得同意后)
## 漏洞严重程度分类
我们根据以下标准对安全漏洞进行分类:
| 严重程度 | 描述 | 预期修复时间 |
|---------|------|------------|
| **严重** | 允许远程代码执行、完全系统入侵或敏感数据大规模泄露的漏洞 | 7天内 |
| **高** | 可能导致权限提升、数据泄露或服务中断的漏洞 | 14天内 |
| **中** | 可能被利用但影响有限的漏洞 | 30天内 |
| **低** | 安全最佳实践的轻微偏差,几乎不可能被利用 | 下一个常规版本 |
## 安全更新发布
- 安全更新将通过标准的版本发布流程提供
- 我们会在发布说明中明确标识安全更新
- 对于严重的安全问题,我们可能会发布专门的安全公告
## 安全最佳实践
为了确保 SMF Core 部署的安全性,我们建议遵循以下最佳实践:
### 部署安全
- 始终使用最新版本的 SMF Core
- 定期应用安全更新
- 使用 HTTPS 加密传输数据
- 在生产环境中使用强密码和多因素认证
- 限制对管理接口的访问
### 配置安全
- 避免在配置文件中存储敏感信息(使用环境变量或密钥管理服务)
- 禁用不必要的功能和服务
- 配置适当的日志级别以监控可疑活动
- 遵循最小权限原则配置访问控制
### 数据安全
- 加密存储敏感数据
- 实施适当的数据备份策略
- 遵循数据保留策略,定期清理不再需要的数据
## 责任豁免
SMF Core 项目按"原样"提供,不提供任何形式的明示或暗示的保证。我们不对因使用或无法使用本项目而导致的任何直接、间接、偶然、特殊或后果性损害承担责任。
## 安全团队联系信息
如有任何疑问,请联系我们的安全团队:
**电子邮件**: [security@neotel.com](mailto:security@neotel.com)
---
本安全策略最后更新日期:2023年12月1日
\ No newline at end of file \ No newline at end of file
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" "https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<!-- 基本配置 -->
<property name="severity" value="warning"/>
<property name="fileExtensions" value="java"/>
<!-- 编码检查 -->
<module name="NewlineAtEndOfFile"/>
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="minimum" value="1"/>
<property name="maximum" value="unbounded"/>
<property name="message" value="Line has trailing spaces."/>
</module>
<!-- 文件长度和结构检查 -->
<module name="LineLength">
<property name="max" value="120"/>
<property name="ignorePattern" value="^package.*|^import.*|^@.*|.*http://.*|.*https://.*"/>
</module>
<!-- Java代码检查 -->
<module name="TreeWalker">
<!-- 命名规范 -->
<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName">
<property name="format" value="^[A-Z][a-zA-Z0-9]*$"/>
</module>
<!-- 代码结构 -->
<module name="EmptyBlock">
<property name="option" value="TEXT"/>
<property name="tokens" value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_DO"/>
</module>
<module name="LeftCurly"/>
<module name="RightCurly"/>
<module name="Indentation">
<property name="basicOffset" value="4"/>
<property name="braceAdjustment" value="0"/>
<property name="caseIndentation" value="4"/>
<property name="throwsIndentation" value="4"/>
<property name="lineWrappingIndentation" value="8"/>
</module>
<!-- 变量和方法 -->
<module name="AvoidStarImport"/>
<module name="IllegalImport"/>
<module name="RedundantImport"/>
<module name="UnusedImports"/>
<module name="ArrayTypeStyle"/>
<module name="UpperEll"/>
<!-- 代码质量 -->
<module name="EqualsHashCode"/>
<module name="StringLiteralEquality"/>
<module name="CovariantEquals"/>
<module name="OverloadMethodsDeclarationOrder"/>
<module name="ParameterAssignment"/>
<module name="FinalParameters">
<property name="tokens" value="METHOD_DEF, CTOR_DEF, LITERAL_CATCH"/>
</module>
<!-- 注释相关 -->
<module name="JavadocType">
<property name="scope" value="public"/>
</module>
<module name="JavadocMethod">
<property name="scope" value="public"/>
<property name="allowMissingThrowsTags" value="true"/>
</module>
<module name="JavadocVariable">
<property name="scope" value="public"/>
<property name="tokens" value="VARIABLE_DEF, ENUM_CONSTANT_DEF"/>
</module>
<!-- 控制流 -->
<module name="NestedIfDepth">
<property name="max" value="3"/>
</module>
<module name="NestedTryDepth">
<property name="max" value="2"/>
</module>
<module name="CyclomaticComplexity">
<property name="max" value="10"/>
</module>
<!-- 其他规则 -->
<module name="MissingDeprecated"/>
<module name="MissingOverride"/>
<module name="MultipleVariableDeclarations"/>
<module name="FallThrough"/>
<module name="MagicNumber">
<property name="ignoreNumbers" value="-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100, 1000"/>
<property name="ignoreAnnotation" value="true"/>
</module>
<module name="ModifierOrder"/>
</module>
</module>
\ No newline at end of file \ No newline at end of file
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
- **JDK**: JDK 1.8 或更高版本 - **JDK**: JDK 1.8 或更高版本
- **Maven**: Maven 3.6 或更高版本 - **Maven**: Maven 3.6 或更高版本
- **数据库**: MongoDB 4.0+ - **数据库**: MongoDB 4.0+
- **Redis**: Redis 5.0+ (可选,用于缓存)
- **IDE**: 推荐IntelliJ IDEA或Eclipse - **IDE**: 推荐IntelliJ IDEA或Eclipse
- **操作系统**: Windows, Linux 或 macOS - **操作系统**: Windows, Linux 或 macOS
...@@ -35,16 +34,6 @@ GRANT ALL PRIVILEGES ON smf_core.* TO 'smf_user'@'localhost'; ...@@ -35,16 +34,6 @@ GRANT ALL PRIVILEGES ON smf_core.* TO 'smf_user'@'localhost';
FLUSH PRIVILEGES; FLUSH PRIVILEGES;
``` ```
2. 修改数据库连接配置:
编辑 `src/main/resources/application-dev.yml` 文件,更新数据库连接信息:
```yaml
spring:
datasource:
url: jdbc:mysql://localhost:3306/smf_core?useUnicode=true&characterEncoding=UTF-8
username: smf_user
password: smf_password
``` ```
#### 2.2 MongoDB配置 #### 2.2 MongoDB配置
......
# SMF Core 脚本集合
本目录包含 SMF Core 项目的各种自动化脚本,用于简化开发、构建、测试和部署流程。
## 脚本目录结构
```
scripts/
├── build.sh # 构建脚本,用于编译、测试和打包项目
├── clean.sh # 清理脚本,用于删除构建文件和临时文件
├── README.md # 脚本说明文档(当前文件)
├── code-quality/ # 代码质量相关脚本
│ └── check-code.sh # 运行代码质量分析工具
├── development/ # 开发环境相关脚本
│ ├── setup-env.sh # 设置开发环境、配置文件
│ └── start-dev.sh # 启动开发服务器
└── deploy/ # 部署相关脚本
└── deploy-dev.sh # 部署到开发环境
```
## 使用方法
### 构建项目
```bash
# 运行构建脚本(编译、测试、打包)
./scripts/build.sh
```
### 设置开发环境
```bash
# 设置开发环境
./scripts/development/setup-env.sh
# 启动开发服务器
./scripts/development/start-dev.sh
```
### 清理项目
```bash
# 清理构建文件和临时文件
./scripts/clean.sh
```
### 检查代码质量
```bash
# 运行代码质量检查(Checkstyle、SpotBugs等)
./scripts/code-quality/check-code.sh
```
### 部署应用
```bash
# 部署到开发环境
./scripts/deploy/deploy-dev.sh
```
## 前提条件
- **Maven**: 所有脚本都需要 Maven 3.6+ 才能运行
- **Java**: JDK 11 或更高版本
- **部署脚本**: SSH 访问权限(用于远程部署)
## 脚本权限
首次使用脚本前,确保脚本具有执行权限:
```bash
chmod +x ./scripts/*.sh
chmod +x ./scripts/*/*.sh
```
## 自定义配置
大多数脚本都包含可自定义的配置变量,位于脚本顶部。根据您的环境需求,可以调整这些变量。
## 注意事项
1. 始终确保您了解脚本的作用再执行它
2. 某些脚本可能会修改文件或执行远程操作
3. 在生产环境使用前,建议在测试环境验证脚本的行为
4. 保持脚本更新,随着项目发展调整脚本功能
\ No newline at end of file \ No newline at end of file
#!/bin/bash
# SMF Core 项目构建脚本
# 此脚本用于编译、测试和打包项目
# 错误时退出
set -e
echo "========================================"
echo "开始构建 SMF Core 项目"
echo "========================================"
# 项目根目录
PROJECT_ROOT=$(dirname "$(dirname "$0")")
cd "$PROJECT_ROOT"
echo "检查 Maven 是否安装..."
if ! command -v mvn &> /dev/null; then
echo "错误: Maven 未安装或不在 PATH 中"
echo "请安装 Maven 3.6+ 并将其添加到 PATH 环境变量"
exit 1
fi
MAVEN_VERSION=$(mvn -version | grep "Apache Maven" | awk '{print $3}')
echo "检测到 Maven 版本: $MAVEN_VERSION"
echo "\n清理项目..."
mvn clean
echo "\n编译项目..."
mvn compile
echo "\n运行测试..."
mvn test
echo "\n打包项目..."
mvn package -DskipTests
echo "\n生成源码包..."
mvn source:jar -DskipTests
echo "\n========================================"
echo "构建完成!"
echo "========================================"
echo "可执行 JAR 文件位置: $(find target -name "*.jar" | grep -v "sources.jar" | grep -v "tests.jar")"
echo "源码包位置: $(find target -name "*-sources.jar")"
\ No newline at end of file \ No newline at end of file
#!/bin/bash
# SMF Core 项目清理脚本
# 此脚本用于清理构建文件、临时文件和缓存
# 错误时退出
set -e
echo "========================================"
echo "开始清理 SMF Core 项目"
echo "========================================"
# 项目根目录
PROJECT_ROOT=$(dirname "$0")
cd "$PROJECT_ROOT"
echo "运行 Maven 清理..."
mvn clean
echo "\n清理 Maven 本地仓库缓存..."
find .m2/repository -name "*.lastUpdated" -delete 2>/dev/null || true
find .m2/repository -name "resolver-status.properties" -delete 2>/dev/null || true
echo "\n清理 IDE 临时文件..."
find . -name ".idea" -type d -exec rm -rf {} \; 2>/dev/null || true
find . -name "*.iml" -delete 2>/dev/null || true
find . -name ".classpath" -delete 2>/dev/null || true
find . -name ".project" -delete 2>/dev/null || true
find . -name "*.launch" -delete 2>/dev/null || true
find . -name "atlassian-ide-plugin.xml" -delete 2>/dev/null || true
find . -name "com_crashlytics_export_strings.xml" -delete 2>/dev/null || true
find . -name "crashlytics.properties" -delete 2>/dev/null || true
find . -name "crashlytics-build.properties" -delete 2>/dev/null || true
echo "\n清理操作系统生成的文件..."
find . -name "Thumbs.db" -delete 2>/dev/null || true
find . -name ".DS_Store" -delete 2>/dev/null || true
find . -name "__MACOSX" -type d -exec rm -rf {} \; 2>/dev/null || true
echo "\n清理日志文件..."
rm -rf logs/* 2>/dev/null || true
# 清理测试报告目录
echo "\n清理测试报告..."
rm -rf target/surefire-reports/ 2>/dev/null || true
rm -rf target/failsafe-reports/ 2>/dev/null || true
echo "\n========================================"
echo "清理完成!"
echo "========================================"
echo "项目已恢复到初始状态,所有构建文件和临时文件已删除。"
\ No newline at end of file \ No newline at end of file
#!/bin/bash
# SMF Core 代码质量检查脚本
# 此脚本用于运行各种代码质量分析工具
# 错误时退出
set -e
echo "========================================"
echo "开始 SMF Core 代码质量检查"
echo "========================================"
# 项目根目录
PROJECT_ROOT=$(dirname "$(dirname "$0")")
cd "$PROJECT_ROOT"
# 检查 Maven 是否安装
if ! command -v mvn &> /dev/null; then
echo "错误: Maven 未安装或不在 PATH 中"
echo "请安装 Maven 3.6+ 并将其添加到 PATH 环境变量"
exit 1
fi
# 创建报告目录
mkdir -p reports/code-quality
# 1. 运行 Checkstyle 检查
echo "\n1. 运行 Checkstyle 代码风格检查..."
mvn checkstyle:check
if [ -f "target/checkstyle-result.xml" ]; then
cp target/checkstyle-result.xml reports/code-quality/
echo "Checkstyle 报告已保存至: reports/code-quality/checkstyle-result.xml"
fi
# 2. 运行 SpotBugs 检查
echo "\n2. 运行 SpotBugs 静态代码分析..."
mvn com.github.spotbugs:spotbugs-maven-plugin:4.5.3.0:check
if [ -f "target/spotbugsXml.xml" ]; then
cp target/spotbugsXml.xml reports/code-quality/
echo "SpotBugs 报告已保存至: reports/code-quality/spotbugsXml.xml"
fi
# 3. 运行 PMD 检查(如果在 pom.xml 中配置了)
echo "\n3. 运行 PMD 代码复杂度分析..."
mvn pmd:check || echo "警告: PMD 检查失败,可能未在 pom.xml 中配置"
if [ -f "target/pmd.xml" ]; then
cp target/pmd.xml reports/code-quality/
echo "PMD 报告已保存至: reports/code-quality/pmd.xml"
fi
# 4. 生成测试覆盖率报告
echo "\n4. 生成测试覆盖率报告..."
mvn test jacoco:report
if [ -d "target/site/jacoco" ]; then
cp -r target/site/jacoco reports/code-quality/
echo "测试覆盖率报告已保存至: reports/code-quality/jacoco/index.html"
fi
# 5. 运行 SonarQube 分析(如果有配置)
echo "\n5. 检查是否有 SonarQube 配置..."
if [ -f "sonar-project.properties" ]; then
echo "运行 SonarQube 分析..."
if command -v sonar-scanner &> /dev/null; then
sonar-scanner
elif command -v mvn &> /dev/null; then
mvn sonar:sonar || echo "警告: SonarQube 分析失败,请确保 SonarQube 服务可用"
else
echo "跳过 SonarQube 分析: 未找到 sonar-scanner 或 Maven"
fi
else
echo "跳过 SonarQube 分析: 未找到 sonar-project.properties 文件"
fi
echo "\n========================================"
echo "代码质量检查完成!"
echo "========================================"
echo "报告位置: $PROJECT_ROOT/reports/code-quality/"
echo "\n检查结果摘要:"
echo "- Checkstyle: $(grep -o "severity=\"error\"" reports/code-quality/checkstyle-result.xml 2>/dev/null | wc -l || echo "未找到报告") 个错误"
echo "- SpotBugs: $(grep -o "priority=\"1\"" reports/code-quality/spotbugsXml.xml 2>/dev/null | wc -l || echo "未找到报告") 个高优先级问题"
if [ -d "reports/code-quality/jacoco" ]; then
COVERAGE=$(grep -A 1 "lineRate" reports/code-quality/jacoco/jacoco.xml | tail -1 | sed 's/.*\(\([0-9]\+\.[0-9]\+\)\).*/\1/')
echo "- 测试覆盖率: ${COVERAGE}%"
else
echo "- 测试覆盖率: 未生成报告"
fi
\ No newline at end of file \ No newline at end of file
#!/bin/bash
# SMF Core 开发环境部署脚本
# 此脚本用于将应用部署到开发环境服务器
# 错误时退出
set -e
echo "========================================"
echo "开始部署 SMF Core 到开发环境"
echo "========================================"
# 项目根目录
PROJECT_ROOT=$(dirname "$(dirname "$0")")
cd "$PROJECT_ROOT"
# 部署配置
DEPLOY_HOST="dev-server.example.com" # 开发服务器主机名或IP
DEPLOY_USER="deploy" # 部署用户名
DEPLOY_PATH="/opt/smf-core" # 部署路径
APP_NAME="smf-core" # 应用名称
# 构建配置
BUILD_PROFILE="dev" # Maven 构建配置
JAR_PATH="target/*.jar" # JAR 文件路径
# 检查是否存在构建好的 JAR 文件
if [ ! "$(ls -A $JAR_PATH 2>/dev/null)" ]; then
echo "未找到构建好的 JAR 文件,开始构建项目..."
mvn clean package -DskipTests -P$BUILD_PROFILE
fi
# 获取最新的 JAR 文件
JAR_FILE=$(ls -t $JAR_PATH | head -n 1)
JAR_FILENAME=$(basename "$JAR_FILE")
TIMESTAMP=$(date +"%Y%m%d%H%M%S")
DEPLOY_JAR_NAME="${APP_NAME}-${TIMESTAMP}.jar"
echo "\n准备部署: $JAR_FILENAME"
echo "部署目标: $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH"
# 检查 SSH 连接
echo "\n检查 SSH 连接..."
if ! ssh -q -o BatchMode=yes -o ConnectTimeout=5 "$DEPLOY_USER@$DEPLOY_HOST" 'echo 2>/dev/null'; then
echo "错误: 无法连接到 $DEPLOY_HOST"
echo "请确保您有正确的 SSH 密钥并已添加到 authorized_keys"
exit 1
fi
# 创建远程目录
echo "\n创建远程目录..."
ssh "$DEPLOY_USER@$DEPLOY_HOST" "mkdir -p $DEPLOY_PATH $DEPLOY_PATH/logs $DEPLOY_PATH/backups"
# 备份当前部署
echo "\n备份当前部署..."
ssh "$DEPLOY_USER@$DEPLOY_HOST" "\
if [ -f '$DEPLOY_PATH/${APP_NAME}.jar' ]; then \
cp '$DEPLOY_PATH/${APP_NAME}.jar' '$DEPLOY_PATH/backups/${APP_NAME}-$(date +\"%Y%m%d%H%M%S\").jar.bak'; \
fi"
# 上传 JAR 文件
echo "\n上传应用到服务器..."
scp "$JAR_FILE" "$DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/$DEPLOY_JAR_NAME"
# 创建符号链接指向最新版本
echo "\n更新符号链接..."
ssh "$DEPLOY_USER@$DEPLOY_HOST" "\
ln -sf '$DEPLOY_PATH/$DEPLOY_JAR_NAME' '$DEPLOY_PATH/${APP_NAME}.jar'; \
ls -la '$DEPLOY_PATH/${APP_NAME}.jar'"
# 创建或更新启动脚本
echo "\n更新启动脚本..."
cat > start.sh << 'EOF'
#!/bin/bash
# SMF Core 启动脚本
APP_NAME="smf-core"
APP_HOME="'"$DEPLOY_PATH"'"
JAR_FILE="$APP_HOME/${APP_NAME}.jar"
LOG_FILE="$APP_HOME/logs/${APP_NAME}.log"
# 设置 Java 选项
JAVA_OPTS="-Xms512m -Xmx1024m -Dspring.profiles.active=$BUILD_PROFILE"
# 检查是否已在运行
if pgrep -f "$JAR_FILE" &> /dev/null; then
echo "$APP_NAME 已经在运行,请先停止它"
exit 1
fi
# 启动应用
echo "启动 $APP_NAME..."
nohup java $JAVA_OPTS -jar "$JAR_FILE" > "$LOG_FILE" 2>&1 &
# 输出进程信息
echo "$APP_NAME 已启动,PID: $!"
EOF
# 上传启动脚本
scp start.sh "$DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/"
ssh "$DEPLOY_USER@$DEPLOY_HOST" "chmod +x $DEPLOY_PATH/start.sh"
rm start.sh
# 创建或更新停止脚本
echo "\n更新停止脚本..."
cat > stop.sh << 'EOF'
#!/bin/bash
# SMF Core 停止脚本
APP_NAME="smf-core"
APP_HOME="'"$DEPLOY_PATH"'"
JAR_FILE="$APP_HOME/${APP_NAME}.jar"
# 查找进程 ID
PID=$(pgrep -f "$JAR_FILE")
if [ -z "$PID" ]; then
echo "$APP_NAME 未在运行"
exit 1
fi
# 停止进程
echo "停止 $APP_NAME,PID: $PID..."
kill $PID
# 等待进程结束
count=0
max_count=30 # 最多等待 30 秒
while pgrep -f "$JAR_FILE" &> /dev/null; do
if [ $count -eq $max_count ]; then
echo "强制终止进程..."
kill -9 $PID
break
fi
count=$((count+1))
sleep 1
done
echo "$APP_NAME 已停止"
EOF
# 上传停止脚本
scp stop.sh "$DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/"
ssh "$DEPLOY_USER@$DEPLOY_HOST" "chmod +x $DEPLOY_PATH/stop.sh"
rm stop.sh
# 停止当前运行的实例
echo "\n停止当前运行的实例..."
ssh "$DEPLOY_USER@$DEPLOY_HOST" "$DEPLOY_PATH/stop.sh || true"
# 启动新实例
echo "\n启动新实例..."
ssh "$DEPLOY_USER@$DEPLOY_HOST" "$DEPLOY_PATH/start.sh"
echo "\n等待应用启动..."
sleep 5
# 检查部署状态
echo "\n检查部署状态..."
DEPLOY_STATUS=$(ssh "$DEPLOY_USER@$DEPLOY_HOST" "pgrep -f '$DEPLOY_PATH/${APP_NAME}.jar' &> /dev/null; echo \$?")
if [ "$DEPLOY_STATUS" -eq "0" ]; then
echo "\n========================================"
echo "部署成功!"
echo "========================================"
echo "应用名称: $APP_NAME"
echo "部署路径: $DEPLOY_PATH"
echo "应用文件: $DEPLOY_PATH/${APP_NAME}.jar"
echo "日志文件: $DEPLOY_PATH/logs/${APP_NAME}.log"
echo "启动命令: $DEPLOY_PATH/start.sh"
echo "停止命令: $DEPLOY_PATH/stop.sh"
else
echo "\n========================================"
echo "部署失败!"
echo "========================================"
echo "请检查日志文件: $DEPLOY_PATH/logs/${APP_NAME}.log"
exit 1
fi
\ No newline at end of file \ No newline at end of file
#!/bin/bash
# SMF Core 开发环境设置脚本
# 此脚本用于设置开发环境、安装依赖和配置开发环境
# 错误时退出
set -e
echo "========================================"
echo "开始设置 SMF Core 开发环境"
echo "========================================"
# 项目根目录
PROJECT_ROOT=$(dirname "$(dirname "$0")")
cd "$PROJECT_ROOT"
echo "创建开发配置文件..."
if [ ! -f "src/main/resources/config/application-dev.yml" ]; then
echo "创建开发配置文件 src/main/resources/config/application-dev.yml"
mkdir -p src/main/resources/config
cat > src/main/resources/config/application-dev.yml << 'EOF'
spring:
profiles:
active: dev
datasource:
url: jdbc:h2:mem:testdb
driver-class-name: org.h2.Driver
username: sa
password:
jpa:
database-platform: org.hibernate.dialect.H2Dialect
hibernate:
ddl-auto: update
show-sql: true
properties:
hibernate:
format_sql: true
h2:
console:
enabled: true
path: /h2-console
settings:
web-allow-others: false
server:
port: 8080
servlet:
context-path: /smf-core
# 日志配置
logging:
level:
root: INFO
com.neotel.smfcore: DEBUG
EOF
fi
echo "\n设置测试资源目录..."
mkdir -p src/test/resources
if [ ! -f "src/test/resources/application.yml" ]; then
echo "创建测试配置文件 src/test/resources/application.yml"
cat > src/test/resources/application.yml << 'EOF'
spring:
profiles:
active: test
datasource:
url: jdbc:h2:mem:testdb
driver-class-name: org.h2.Driver
username: sa
password:
jpa:
database-platform: org.hibernate.dialect.H2Dialect
hibernate:
ddl-auto: create-drop
show-sql: false
server:
port: 8081
servlet:
context-path: /smf-core
# 测试日志配置
logging:
level:
root: WARN
com.neotel.smfcore: DEBUG
EOF
fi
echo "\n安装项目依赖..."
mvn dependency:resolve
echo "\n验证项目结构..."
mvn validate
echo "\n========================================"
echo "开发环境设置完成!"
echo "========================================"
echo "可以使用 ./scripts/development/start-dev.sh 启动开发服务器"
echo "使用 H2 控制台: http://localhost:8080/smf-core/h2-console"
echo "用户名: sa, 密码: 空"
\ No newline at end of file \ No newline at end of file
#!/bin/bash
# SMF Core 开发服务器启动脚本
# 此脚本用于启动开发环境的应用服务器
# 错误时退出
set -e
echo "========================================"
echo "启动 SMF Core 开发服务器"
echo "========================================"
# 项目根目录
PROJECT_ROOT=$(dirname "$(dirname "$0")")
cd "$PROJECT_ROOT"
# 检查是否已编译
if [ ! -d "target/classes" ]; then
echo "检测到项目尚未编译,正在编译..."
mvn compile
fi
echo "\n启动开发服务器..."
echo "使用配置: application-dev.yml"
echo "访问地址: http://localhost:8080/smf-core"
echo "H2 控制台: http://localhost:8080/smf-core/h2-console"
echo "\n按 Ctrl+C 停止服务器"
echo "========================================"
# 使用 Spring Boot Maven 插件运行应用
mvn spring-boot:run -Dspring-boot.run.profiles=dev
\ No newline at end of file \ No newline at end of file
#!/bin/bash
# SMF Core 脚本权限设置脚本
# 此脚本用于确保所有脚本文件都具有可执行权限
echo "========================================"
echo "设置 SMF Core 脚本执行权限"
echo "========================================"
# 项目根目录
SCRIPT_DIR=$(dirname "$0")
cd "$SCRIPT_DIR"
# 查找并设置所有 .sh 文件的执行权限
echo "\n设置脚本文件的执行权限..."
find . -name "*.sh" -type f | while read script_file; do
if [ -f "$script_file" ]; then
echo "设置 $script_file 可执行权限"
chmod +x "$script_file"
fi
done
echo "\n权限设置完成!"
echo "\n现在您可以直接运行这些脚本,例如:"
echo " ./build.sh"
echo " ./development/start-dev.sh"
echo " ./deploy/deploy-dev.sh"
echo "\n有关脚本使用方法的详细信息,请参阅 README.md 文件。"
\ No newline at end of file \ No newline at end of file
# SonarQube项目配置文件
# 项目基本信息
sonar.projectKey=smf-core
sonar.projectName=SMF Core
sonar.projectVersion=1.0.0
# 源码和测试文件路径
sonar.sources=src/main/java
sonar.tests=src/test/java
sonar.java.binaries=target/classes
# 排除不需要分析的文件
sonar.exclusions=**/target/**/*,**/generated-sources/**/*,**/resources/**/*.properties
sonar.test.exclusions=**/src/test/java/**/*Test.java
# 代码覆盖率配置
sonar.jacoco.reportPaths=target/jacoco.exec
sonar.java.coveragePlugin=jacoco
# 编码设置
sonar.sourceEncoding=UTF-8
# 代码质量规则设置
sonar.java.checkstyle.reportPaths=target/checkstyle-result.xml
sonar.java.spotbugs.reportPaths=target/spotbugsXml.xml
# 复杂度和重复代码阈值
sonar.cpd.exclusions=**/test/**
sonar.cpd.minimumLines=10
sonar.cpd.minimumTokens=100
# 代码质量门禁设置(可在SonarQube界面覆盖)
sonar.qualitygate.wait=true
sonar.qualitygate.timeout=300
# 额外Java配置
sonar.java.source=11
sonar.java.target=11
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<FindBugsFilter>
<!-- 忽略特定包或类的所有警告 --<
<Match package="~com\.neotel\.smfcore\.apiGateway\.agv\..*" />
<Match package="~com\.neotel\.smfcore\.businessServices\.inList\..*" />
<!-- 忽略测试类中的警告 -->
<Match class="~.*Test" />
<Match class="~.*Tests" />
<Match class="~.*IT" />
<!-- 忽略序列化相关警告 --<
<Match bug="SE_NO_SERIALVERSIONID">
<Class name="~com\.neotel\.smfcore\.shared\..*" />
</Match>
<!-- 忽略未使用参数警告,特别是在接口方法和回调中 --<
<Match bug="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD">
<Class name="~com\.neotel\.smfcore\.apiGateway\..*" />
</Match>
<!-- 忽略可能的空指针警告,对于已知安全的场景 --<
<Match bug="NP_NULL_ON_SOME_PATH">
<Class name="~com\.neotel\.smfcore\.businessServices\..*" />
<Method name="~get.*" />
</Match>
<!-- 忽略不必要的同步警告,对于线程安全集合 --<
<Match bug="DL_SYNCHRONIZATION_ON_SHARED_CONSTANT"<
<Class name="~com\.neotel\.smfcore\.shared\.utils\..*" />
</Match>
<!-- 忽略StringBuffer线程安全警告,已知单线程使用场景 --<
<Match bug="DM_STRING_TO_STRINGBUFFER">
<Class name="~com\.neotel\.smfcore\.businessServices\..*" />
</Match>
<!-- 忽略可能的资源泄露警告,已知try-with-resources已使用 --<
<Match bug="OBL_UNSATISFIED_OBLIGATION">
<Class name="~com\.neotel\.smfcore\.integrations\..*" />
</Match>
<!-- 忽略未使用的私有方法,用于预留扩展点 --<
<Match bug="UPM_UNCALLED_PRIVATE_METHOD">
<Class name="~com\.neotel\.smfcore\.smfPlatform\..*" />
</Match>
<!-- 忽略常量条件警告,在配置类中常见 --<
<Match bug="DLS_DEAD_LOCAL_STORE">
<Class name="~com\.neotel\.smfcore\.shared\.config\..*" />
</Match>
<!-- 忽略构造函数调用中初始化字段的警告 --<
<Match bug="SS_SHOULD_BE_STATIC">
<Class name="~com\.neotel\.smfcore\.shared\.base\..*" />
</Match>
<!-- 忽略可能的内存泄漏警告,在单例模式中常见 --<
<Match bug="LEAK_DETECTED_IN_ACTION_PERFORMED">
<Class name="~com\.neotel\.smfcore\.smfPlatform\.dashboard\..*" />
</Match>
</FindBugsFilter>
\ No newline at end of file \ No newline at end of file
package com.neotel.smfcore.smfPlatform.system.rest; package com.neotel.smfcore.smfPlatform.system.rest;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.apiGateway.device.common.util.DataCache;
import com.neotel.smfcore.shared.bean.ResultBean; import com.neotel.smfcore.shared.bean.ResultBean;
import com.neotel.smfcore.shared.exception.ValidateException; import com.neotel.smfcore.shared.exception.ValidateException;
import com.neotel.smfcore.shared.utils.Constants; import com.neotel.smfcore.shared.utils.Constants;
import com.neotel.smfcore.shared.utils.SecurityUtils; import com.neotel.smfcore.shared.utils.SecurityUtils;
import com.neotel.smfcore.apiGateway.device.common.util.DataCache;
import com.neotel.smfcore.smfPlatform.system.rest.bean.dto.ClientSettingDto;
import com.neotel.smfcore.smfPlatform.security.annotation.AnonymousGetMapping; import com.neotel.smfcore.smfPlatform.security.annotation.AnonymousGetMapping;
import com.neotel.smfcore.smfPlatform.security.annotation.AnonymousPutMapping; import com.neotel.smfcore.smfPlatform.security.annotation.AnonymousPutMapping;
import com.neotel.smfcore.smfPlatform.system.rest.bean.dto.ClientSettingDto;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
......
...@@ -6,14 +6,13 @@ import com.neotel.smfcore.shared.base.IExcelDownLoad; ...@@ -6,14 +6,13 @@ import com.neotel.smfcore.shared.base.IExcelDownLoad;
import com.neotel.smfcore.shared.bean.PageData; import com.neotel.smfcore.shared.bean.PageData;
import com.neotel.smfcore.shared.utils.FileUtil; import com.neotel.smfcore.shared.utils.FileUtil;
import com.neotel.smfcore.shared.utils.QueryHelp; import com.neotel.smfcore.shared.utils.QueryHelp;
import com.neotel.smfcore.apiGateway.device.common.enums.BOX_STATUS;
import com.neotel.smfcore.smfPlatform.language.util.MessageUtils; import com.neotel.smfcore.smfPlatform.language.util.MessageUtils;
import com.neotel.smfcore.smfPlatform.security.annotation.AnonymousAccess;
import com.neotel.smfcore.smfPlatform.system.rest.bean.dto.MaterialTraceDto; import com.neotel.smfcore.smfPlatform.system.rest.bean.dto.MaterialTraceDto;
import com.neotel.smfcore.smfPlatform.system.rest.bean.mapstruct.MaterialTraceMapper; import com.neotel.smfcore.smfPlatform.system.rest.bean.mapstruct.MaterialTraceMapper;
import com.neotel.smfcore.smfPlatform.system.rest.bean.query.MaterialTraceQueryCondition; import com.neotel.smfcore.smfPlatform.system.rest.bean.query.MaterialTraceQueryCondition;
import com.neotel.smfcore.smfPlatform.system.service.manager.IMaterialTraceManager; import com.neotel.smfcore.smfPlatform.system.service.manager.IMaterialTraceManager;
import com.neotel.smfcore.smfPlatform.system.service.po.MaterialTrace; import com.neotel.smfcore.smfPlatform.system.service.po.MaterialTrace;
import com.neotel.smfcore.smfPlatform.security.annotation.AnonymousAccess;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
......
package com.neotel.smfcore.smfPlatform.system.rest; package com.neotel.smfcore.smfPlatform.system.rest;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.apiGateway.device.common.util.DataCache;
import com.neotel.smfcore.businessServices.storage.enums.DeviceType;
import com.neotel.smfcore.businessServices.storage.service.po.Storage;
import com.neotel.smfcore.shared.bean.ResultBean; import com.neotel.smfcore.shared.bean.ResultBean;
import com.neotel.smfcore.shared.csv.CsvReader; import com.neotel.smfcore.shared.csv.CsvReader;
import com.neotel.smfcore.shared.excel.ExcelReader; import com.neotel.smfcore.shared.excel.ExcelReader;
import com.neotel.smfcore.shared.exception.ValidateException; import com.neotel.smfcore.shared.exception.ValidateException;
import com.neotel.smfcore.shared.utils.*; import com.neotel.smfcore.shared.utils.Constants;
import com.neotel.smfcore.apiGateway.device.common.util.DataCache; import com.neotel.smfcore.shared.utils.DateUtil;
import com.neotel.smfcore.businessServices.storage.enums.DeviceType; import com.neotel.smfcore.shared.utils.FileUtil;
import com.neotel.smfcore.businessServices.storage.service.po.Storage; import com.neotel.smfcore.shared.utils.StringUtils;
import com.neotel.smfcore.smfPlatform.security.annotation.AnonymousAccess;
import com.neotel.smfcore.smfPlatform.security.bean.FileProperties;
import com.neotel.smfcore.smfPlatform.system.bean.OrderSetting; import com.neotel.smfcore.smfPlatform.system.bean.OrderSetting;
import com.neotel.smfcore.smfPlatform.system.rest.bean.dto.SysSettingsDto; import com.neotel.smfcore.smfPlatform.system.rest.bean.dto.SysSettingsDto;
import com.neotel.smfcore.smfPlatform.system.service.po.Settings; import com.neotel.smfcore.smfPlatform.system.service.po.Settings;
import com.neotel.smfcore.smfPlatform.system.util.DbBackupService; import com.neotel.smfcore.smfPlatform.system.util.DbBackupService;
import com.neotel.smfcore.smfPlatform.security.annotation.AnonymousAccess;
import com.neotel.smfcore.smfPlatform.security.bean.FileProperties;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
......
...@@ -4,28 +4,27 @@ package com.neotel.smfcore.smfPlatform.system.rest; ...@@ -4,28 +4,27 @@ package com.neotel.smfcore.smfPlatform.system.rest;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.neotel.smfcore.apiGateway.device.common.enums.OP_STATUS; import com.neotel.smfcore.apiGateway.device.common.enums.OP_STATUS;
import com.neotel.smfcore.apiGateway.device.common.util.DataCache;
import com.neotel.smfcore.businessServices.storage.service.po.Storage;
import com.neotel.smfcore.shared.base.IExcelDownLoad; import com.neotel.smfcore.shared.base.IExcelDownLoad;
import com.neotel.smfcore.shared.bean.PageData; import com.neotel.smfcore.shared.bean.PageData;
import com.neotel.smfcore.shared.exception.ValidateException; import com.neotel.smfcore.shared.exception.ValidateException;
import com.neotel.smfcore.shared.utils.FileUtil; import com.neotel.smfcore.shared.utils.FileUtil;
import com.neotel.smfcore.shared.utils.QueryHelp; import com.neotel.smfcore.shared.utils.QueryHelp;
import com.neotel.smfcore.shared.utils.SecurityUtils; import com.neotel.smfcore.shared.utils.SecurityUtils;
import com.neotel.smfcore.apiGateway.device.common.enums.BOX_STATUS;
import com.neotel.smfcore.apiGateway.device.common.util.DataCache;
import com.neotel.smfcore.smfPlatform.language.service.nanager.ILanguageMsgManager; import com.neotel.smfcore.smfPlatform.language.service.nanager.ILanguageMsgManager;
import com.neotel.smfcore.smfPlatform.language.util.MessageUtils; import com.neotel.smfcore.smfPlatform.language.util.MessageUtils;
import com.neotel.smfcore.businessServices.storage.service.po.Storage; import com.neotel.smfcore.smfPlatform.security.annotation.AnonymousAccess;
import com.neotel.smfcore.smfPlatform.security.annotation.AnonymousDeleteMapping;
import com.neotel.smfcore.smfPlatform.security.annotation.AnonymousGetMapping;
import com.neotel.smfcore.smfPlatform.security.service.manager.IUserManager;
import com.neotel.smfcore.smfPlatform.security.service.po.User;
import com.neotel.smfcore.smfPlatform.system.rest.bean.dto.TaskDto; import com.neotel.smfcore.smfPlatform.system.rest.bean.dto.TaskDto;
import com.neotel.smfcore.smfPlatform.system.rest.bean.mapstruct.TaskMapper; import com.neotel.smfcore.smfPlatform.system.rest.bean.mapstruct.TaskMapper;
import com.neotel.smfcore.smfPlatform.system.rest.bean.query.TaskQueryCondition; import com.neotel.smfcore.smfPlatform.system.rest.bean.query.TaskQueryCondition;
import com.neotel.smfcore.smfPlatform.system.service.manager.IDataLogManager; import com.neotel.smfcore.smfPlatform.system.service.manager.IDataLogManager;
import com.neotel.smfcore.smfPlatform.system.service.po.DataLog; import com.neotel.smfcore.smfPlatform.system.service.po.DataLog;
import com.neotel.smfcore.smfPlatform.system.util.TaskService; import com.neotel.smfcore.smfPlatform.system.util.TaskService;
import com.neotel.smfcore.smfPlatform.security.annotation.AnonymousAccess;
import com.neotel.smfcore.smfPlatform.security.annotation.AnonymousDeleteMapping;
import com.neotel.smfcore.smfPlatform.security.annotation.AnonymousGetMapping;
import com.neotel.smfcore.smfPlatform.security.service.manager.IUserManager;
import com.neotel.smfcore.smfPlatform.security.service.po.User;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
...@@ -48,12 +47,6 @@ import java.text.SimpleDateFormat; ...@@ -48,12 +47,6 @@ import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
/**
* 任务管理控制器
* 处理系统任务相关的REST API请求
* @author SMF Core Team
* @date 2022-03-07
*/
@Slf4j @Slf4j
@Api(tags = "任务管理") @Api(tags = "任务管理")
@RestController @RestController
......
package com.neotel.smfcore.smfPlatform.system.service.dao; package com.neotel.smfcore.smfPlatform.system.service.dao;
import com.neotel.smfcore.shared.base.IBaseDao; import com.neotel.smfcore.shared.base.IBaseDao;
public interface ICacheItemDao extends IBaseDao { public interface ICacheItemDao extends IBaseDao {
......
package com.neotel.smfcore.smfPlatform.system.service.dao; package com.neotel.smfcore.smfPlatform.system.service.dao;
import com.neotel.smfcore.shared.base.IBaseDao;
import com.neotel.smfcore.businessServices.reporting.bean.ChartItem; import com.neotel.smfcore.businessServices.reporting.bean.ChartItem;
import com.neotel.smfcore.smfPlatform.system.service.po.DataLog;
import com.neotel.smfcore.integrations.custom.micron20031.bean.SpDailyLog; import com.neotel.smfcore.integrations.custom.micron20031.bean.SpDailyLog;
import com.neotel.smfcore.shared.base.IBaseDao;
import com.neotel.smfcore.smfPlatform.system.service.po.DataLog;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
public interface IDataLogDao extends IBaseDao { public interface IDataLogDao extends IBaseDao {
List<ChartItem> putInChart(Date startDay, Date endDay, String partNumber,List<String> cids); List<ChartItem> putInChart(Date startDay, Date endDay, String partNumber, List<String> cids);
List<ChartItem> checkOutChart(Date startDay, Date endDay, String partNumber,List<String> cids); List<ChartItem> checkOutChart(Date startDay, Date endDay, String partNumber,List<String> cids);
List<DataLog> findHistory(String bid, int num); List<DataLog> findHistory(String bid, int num);
List<SpDailyLog> getSpDailyLogs(Date start,Date end, String inoutType); List<SpDailyLog> getSpDailyLogs(Date start, Date end, String inoutType);
List<SpDailyLog> getSpPnSummaryLists(String inoutType); List<SpDailyLog> getSpPnSummaryLists(String inoutType);
} }
package com.neotel.smfcore.smfPlatform.system.service.dao; package com.neotel.smfcore.smfPlatform.system.service.dao;
import com.neotel.smfcore.shared.base.IBaseDao; import com.neotel.smfcore.shared.base.IBaseDao;
public interface IHumitureDao extends IBaseDao { public interface IHumitureDao extends IBaseDao {
......
package com.neotel.smfcore.smfPlatform.system.service.dao; package com.neotel.smfcore.smfPlatform.system.service.dao;
import com.neotel.smfcore.shared.base.IBaseDao; import com.neotel.smfcore.shared.base.IBaseDao;
public interface IMaterialTraceDao extends IBaseDao { public interface IMaterialTraceDao extends IBaseDao {
......
package com.neotel.smfcore.smfPlatform.system.service.dao; package com.neotel.smfcore.smfPlatform.system.service.dao;
import com.neotel.smfcore.shared.base.IBaseDao; import com.neotel.smfcore.shared.base.IBaseDao;
public interface ISettingsDao extends IBaseDao { public interface ISettingsDao extends IBaseDao {
......
package com.neotel.smfcore.smfPlatform.system.service.dao.impl; package com.neotel.smfcore.smfPlatform.system.service.dao.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.apiGateway.device.common.enums.OP;
import com.neotel.smfcore.apiGateway.device.common.enums.OP_STATUS; import com.neotel.smfcore.apiGateway.device.common.enums.OP_STATUS;
import com.neotel.smfcore.businessServices.reporting.bean.ChartItem;
import com.neotel.smfcore.integrations.custom.micron20031.bean.SpDailyLog;
import com.neotel.smfcore.shared.base.AbstractBaseDao; import com.neotel.smfcore.shared.base.AbstractBaseDao;
import com.neotel.smfcore.shared.utils.DateUtil; import com.neotel.smfcore.shared.utils.DateUtil;
import com.neotel.smfcore.apiGateway.device.common.enums.OP;
import com.neotel.smfcore.apiGateway.device.common.enums.BOX_STATUS;
import com.neotel.smfcore.businessServices.reporting.bean.ChartItem;
import com.neotel.smfcore.smfPlatform.system.service.dao.IDataLogDao; import com.neotel.smfcore.smfPlatform.system.service.dao.IDataLogDao;
import com.neotel.smfcore.smfPlatform.system.service.po.DataLog; import com.neotel.smfcore.smfPlatform.system.service.po.DataLog;
import com.neotel.smfcore.integrations.custom.micron20031.bean.SpDailyLog;
import org.apache.logging.log4j.util.Strings; import org.apache.logging.log4j.util.Strings;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.aggregation.Aggregation; import org.springframework.data.mongodb.core.aggregation.Aggregation;
...@@ -29,7 +28,7 @@ public class DataLogDaoImpl extends AbstractBaseDao implements IDataLogDao { ...@@ -29,7 +28,7 @@ public class DataLogDaoImpl extends AbstractBaseDao implements IDataLogDao {
} }
@Override @Override
public List<ChartItem> putInChart(Date fromTime, Date toTime,String partNumber,List<String> cids){ public List<ChartItem> putInChart(Date fromTime, Date toTime, String partNumber, List<String> cids){
return chart(fromTime, toTime, OP.PUT_IN,partNumber,cids); return chart(fromTime, toTime, OP.PUT_IN,partNumber,cids);
} }
...@@ -72,7 +71,7 @@ public class DataLogDaoImpl extends AbstractBaseDao implements IDataLogDao { ...@@ -72,7 +71,7 @@ public class DataLogDaoImpl extends AbstractBaseDao implements IDataLogDao {
} }
@Override @Override
public List<SpDailyLog> getSpDailyLogs(Date start,Date end, String inoutType) { public List<SpDailyLog> getSpDailyLogs(Date start, Date end, String inoutType) {
Criteria criteria = Criteria.where("updateDate").gte(start).lte(end); Criteria criteria = Criteria.where("updateDate").gte(start).lte(end);
if (ObjectUtil.isNotEmpty(inoutType)) { if (ObjectUtil.isNotEmpty(inoutType)) {
criteria = criteria.and("inOutType").is(inoutType); criteria = criteria.and("inOutType").is(inoutType);
......
package com.neotel.smfcore.smfPlatform.system.service.manager; package com.neotel.smfcore.smfPlatform.system.service.manager;
import com.neotel.smfcore.integrations.custom.micron20031.bean.SpDailyLog;
import com.neotel.smfcore.shared.base.IBaseManager; import com.neotel.smfcore.shared.base.IBaseManager;
import com.neotel.smfcore.smfPlatform.system.service.po.DataLog; import com.neotel.smfcore.smfPlatform.system.service.po.DataLog;
import com.neotel.smfcore.integrations.custom.micron20031.bean.SpDailyLog;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
......
package com.neotel.smfcore.smfPlatform.system.service.manager.impl; package com.neotel.smfcore.smfPlatform.system.service.manager.impl;
import com.neotel.smfcore.apiGateway.device.common.enums.OP_STATUS; import com.neotel.smfcore.apiGateway.device.common.enums.OP_STATUS;
import com.neotel.smfcore.integrations.custom.micron20031.bean.SpDailyLog;
import com.neotel.smfcore.shared.bean.PageData; import com.neotel.smfcore.shared.bean.PageData;
import com.neotel.smfcore.shared.exception.ValidateException; import com.neotel.smfcore.shared.exception.ValidateException;
import com.neotel.smfcore.apiGateway.device.common.enums.BOX_STATUS;
import com.neotel.smfcore.smfPlatform.system.service.dao.IDataLogDao; import com.neotel.smfcore.smfPlatform.system.service.dao.IDataLogDao;
import com.neotel.smfcore.smfPlatform.system.service.manager.IDataLogManager; import com.neotel.smfcore.smfPlatform.system.service.manager.IDataLogManager;
import com.neotel.smfcore.smfPlatform.system.service.po.DataLog; import com.neotel.smfcore.smfPlatform.system.service.po.DataLog;
import com.neotel.smfcore.integrations.custom.micron20031.bean.SpDailyLog;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Criteria;
......
...@@ -2,13 +2,12 @@ package com.neotel.smfcore.smfPlatform.system.service.po; ...@@ -2,13 +2,12 @@ package com.neotel.smfcore.smfPlatform.system.service.po;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.neotel.smfcore.apiGateway.device.common.enums.OP;
import com.neotel.smfcore.apiGateway.device.common.enums.OP_STATUS; import com.neotel.smfcore.apiGateway.device.common.enums.OP_STATUS;
import com.neotel.smfcore.shared.base.BasePo;
import com.neotel.smfcore.businessServices.barcode.service.po.Barcode; import com.neotel.smfcore.businessServices.barcode.service.po.Barcode;
import com.neotel.smfcore.apiGateway.device.common.enums.OP;
import com.neotel.smfcore.apiGateway.device.common.enums.BOX_STATUS;
import com.neotel.smfcore.businessServices.storage.service.po.Storage; import com.neotel.smfcore.businessServices.storage.service.po.Storage;
import com.neotel.smfcore.businessServices.storage.service.po.StoragePos; import com.neotel.smfcore.businessServices.storage.service.po.StoragePos;
import com.neotel.smfcore.shared.base.BasePo;
import com.neotel.smfcore.smfPlatform.system.bean.MSDAppendInfo; import com.neotel.smfcore.smfPlatform.system.bean.MSDAppendInfo;
import lombok.Data; import lombok.Data;
import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Document;
...@@ -19,11 +18,6 @@ import java.util.HashMap; ...@@ -19,11 +18,6 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* 数据日志实体类
* @author SMF Core Team
* @date 2022-03-07
*/
@Data @Data
@Document @Document
public class DataLog extends BasePo implements Serializable ,Comparable<DataLog> { public class DataLog extends BasePo implements Serializable ,Comparable<DataLog> {
......
package com.neotel.smfcore.smfPlatform.system.service.po; package com.neotel.smfcore.smfPlatform.system.service.po;
import com.neotel.smfcore.shared.base.BasePo; import com.neotel.smfcore.shared.base.BasePo;
import lombok.Data;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Document;
......
package com.neotel.smfcore.smfPlatform.system.service.po; package com.neotel.smfcore.smfPlatform.system.service.po;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.neotel.smfcore.shared.base.BasePo;
import com.neotel.smfcore.businessServices.barcode.bean.BarcodeRuleDetail; import com.neotel.smfcore.businessServices.barcode.bean.BarcodeRuleDetail;
import com.neotel.smfcore.shared.base.BasePo;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
......
package com.neotel.smfcore.smfPlatform.system.util; package com.neotel.smfcore.smfPlatform.system.util;
import com.neotel.smfcore.shared.utils.Constants;
import com.neotel.smfcore.shared.utils.DateUtil;
import com.neotel.smfcore.apiGateway.device.common.util.DataCache; import com.neotel.smfcore.apiGateway.device.common.util.DataCache;
import com.neotel.smfcore.businessServices.inList.service.po.InList; import com.neotel.smfcore.businessServices.inList.service.po.InList;
import com.neotel.smfcore.businessServices.inList.service.po.InListItem; import com.neotel.smfcore.businessServices.inList.service.po.InListItem;
import com.neotel.smfcore.smfPlatform.message.service.po.Message;
import com.neotel.smfcore.businessServices.order.service.po.LiteOrder; import com.neotel.smfcore.businessServices.order.service.po.LiteOrder;
import com.neotel.smfcore.businessServices.order.service.po.LiteOrderItem; import com.neotel.smfcore.businessServices.order.service.po.LiteOrderItem;
import com.neotel.smfcore.shared.utils.Constants;
import com.neotel.smfcore.shared.utils.DateUtil;
import com.neotel.smfcore.smfPlatform.message.service.po.Message;
import com.neotel.smfcore.smfPlatform.system.service.dao.IAlarmInfoDao; import com.neotel.smfcore.smfPlatform.system.service.dao.IAlarmInfoDao;
import com.neotel.smfcore.smfPlatform.system.service.po.AlarmInfo; import com.neotel.smfcore.smfPlatform.system.service.po.AlarmInfo;
import com.neotel.smfcore.smfPlatform.system.service.po.DataLog; import com.neotel.smfcore.smfPlatform.system.service.po.DataLog;
...@@ -31,12 +31,6 @@ import java.util.concurrent.TimeUnit; ...@@ -31,12 +31,6 @@ import java.util.concurrent.TimeUnit;
* @author sunke * @author sunke
* @date 2023/1/31 10:02 AM * @date 2023/1/31 10:02 AM
*/ */
/**
* 数据库备份服务
* 负责系统数据的自动备份和管理
* @author SMF Core Team
* @date 2022-03-04
*/
@Slf4j @Slf4j
@Service @Service
public class DbBackupService { public class DbBackupService {
......
...@@ -3,17 +3,17 @@ package com.neotel.smfcore.smfPlatform.system.util; ...@@ -3,17 +3,17 @@ package com.neotel.smfcore.smfPlatform.system.util;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.neotel.smfcore.apiGateway.device.common.bean.MsgInfo;
import com.neotel.smfcore.apiGateway.device.common.bean.StatusBean;
import com.neotel.smfcore.apiGateway.device.common.util.DataCache;
import com.neotel.smfcore.businessServices.storage.service.po.Storage;
import com.neotel.smfcore.integrations.apiInteraction.api.SmfApi;
import com.neotel.smfcore.shared.init.MenuInit; import com.neotel.smfcore.shared.init.MenuInit;
import com.neotel.smfcore.shared.utils.SecurityUtils; import com.neotel.smfcore.shared.utils.SecurityUtils;
import com.neotel.smfcore.shared.utils.StringUtils; import com.neotel.smfcore.shared.utils.StringUtils;
import com.neotel.smfcore.integrations.apiInteraction.api.SmfApi;
import com.neotel.smfcore.smfPlatform.dashboard.bean.dto.box.MesInfoDto; import com.neotel.smfcore.smfPlatform.dashboard.bean.dto.box.MesInfoDto;
import com.neotel.smfcore.apiGateway.device.common.bean.MsgInfo;
import com.neotel.smfcore.apiGateway.device.common.bean.StatusBean;
import com.neotel.smfcore.apiGateway.device.common.util.DataCache;
import com.neotel.smfcore.smfPlatform.message.enums.MessageType; import com.neotel.smfcore.smfPlatform.message.enums.MessageType;
import com.neotel.smfcore.smfPlatform.message.util.DeviceMessageUtil; import com.neotel.smfcore.smfPlatform.message.util.DeviceMessageUtil;
import com.neotel.smfcore.businessServices.storage.service.po.Storage;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -232,7 +232,7 @@ public class DevicesStatusUtil { ...@@ -232,7 +232,7 @@ public class DevicesStatusUtil {
if (newMsg) { if (newMsg) {
String msgType= msg.getType(); String msgType= msg.getType();
if(ObjectUtil.isEmpty(msgType)){ if(ObjectUtil.isEmpty(msgType)){
msgType=MessageType.ERROR.name(); msgType= MessageType.ERROR.name();
} }
DeviceMessageUtil.addDeviceMessage(cid, msgType, msg.getMoudle(), msg.getMsgKey(), msg.getMsg(), msg.getMsgParam(),msg.getAlarmType(),msg.getAlarmCode()); DeviceMessageUtil.addDeviceMessage(cid, msgType, msg.getMoudle(), msg.getMsgKey(), msg.getMsg(), msg.getMsgParam(),msg.getAlarmType(),msg.getAlarmCode());
} }
......
...@@ -3,8 +3,8 @@ package com.neotel.smfcore.smfPlatform.system.util; ...@@ -3,8 +3,8 @@ package com.neotel.smfcore.smfPlatform.system.util;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.neotel.smfcore.smfPlatform.dashboard.bean.dto.box.MesInfoDto;
import com.neotel.smfcore.apiGateway.equipment.bean.EquipStatusBean; import com.neotel.smfcore.apiGateway.equipment.bean.EquipStatusBean;
import com.neotel.smfcore.smfPlatform.dashboard.bean.dto.box.MesInfoDto;
import com.neotel.smfcore.smfPlatform.message.util.DeviceMessageUtil; import com.neotel.smfcore.smfPlatform.message.util.DeviceMessageUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -39,7 +39,7 @@ public class EquipStatusUtil { ...@@ -39,7 +39,7 @@ public class EquipStatusUtil {
} }
public static void updateNsMesInfo(String cid,MesInfoDto nsMesInfo) { public static void updateNsMesInfo(String cid, MesInfoDto nsMesInfo) {
if(nsMesInfo==null){ if(nsMesInfo==null){
return; return;
} }
......
...@@ -4,22 +4,13 @@ import cn.hutool.core.util.ObjectUtil; ...@@ -4,22 +4,13 @@ import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.neotel.smfcore.apiGateway.device.common.bean.StatusBean;
import com.neotel.smfcore.apiGateway.device.common.enums.OP;
import com.neotel.smfcore.apiGateway.device.common.enums.OP_STATUS; import com.neotel.smfcore.apiGateway.device.common.enums.OP_STATUS;
import com.neotel.smfcore.shared.exception.ValidateException; import com.neotel.smfcore.apiGateway.device.common.util.DataCache;
import com.neotel.smfcore.shared.utils.Constants;
import com.neotel.smfcore.shared.utils.ReelLockPosUtil;
import com.neotel.smfcore.shared.utils.SecurityUtils;
import com.neotel.smfcore.shared.utils.StringUtils;
import com.neotel.smfcore.integrations.apiInteraction.api.SmfApi;
import com.neotel.smfcore.businessServices.barcode.enums.COMPONENT_TYPE; import com.neotel.smfcore.businessServices.barcode.enums.COMPONENT_TYPE;
import com.neotel.smfcore.businessServices.barcode.service.manager.IBarcodeManager; import com.neotel.smfcore.businessServices.barcode.service.manager.IBarcodeManager;
import com.neotel.smfcore.businessServices.barcode.service.po.Barcode; import com.neotel.smfcore.businessServices.barcode.service.po.Barcode;
import com.neotel.smfcore.apiGateway.device.common.bean.StatusBean;
import com.neotel.smfcore.apiGateway.device.common.enums.OP;
import com.neotel.smfcore.apiGateway.device.common.enums.BOX_STATUS;
import com.neotel.smfcore.apiGateway.device.common.util.DataCache;
import com.neotel.smfcore.smfPlatform.language.util.MessageUtils;
import com.neotel.smfcore.smfPlatform.message.util.DeviceMessageUtil;
import com.neotel.smfcore.businessServices.order.LiteOrderCache; import com.neotel.smfcore.businessServices.order.LiteOrderCache;
import com.neotel.smfcore.businessServices.selfAudit.util.SelfAuditUtil; import com.neotel.smfcore.businessServices.selfAudit.util.SelfAuditUtil;
import com.neotel.smfcore.businessServices.storage.enums.CHECKOUT_TYPE; import com.neotel.smfcore.businessServices.storage.enums.CHECKOUT_TYPE;
...@@ -27,6 +18,14 @@ import com.neotel.smfcore.businessServices.storage.rest.dto.TacticsOutDto; ...@@ -27,6 +18,14 @@ import com.neotel.smfcore.businessServices.storage.rest.dto.TacticsOutDto;
import com.neotel.smfcore.businessServices.storage.service.manager.IStoragePosManager; import com.neotel.smfcore.businessServices.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.businessServices.storage.service.po.Storage; import com.neotel.smfcore.businessServices.storage.service.po.Storage;
import com.neotel.smfcore.businessServices.storage.service.po.StoragePos; import com.neotel.smfcore.businessServices.storage.service.po.StoragePos;
import com.neotel.smfcore.integrations.apiInteraction.api.SmfApi;
import com.neotel.smfcore.shared.exception.ValidateException;
import com.neotel.smfcore.shared.utils.Constants;
import com.neotel.smfcore.shared.utils.ReelLockPosUtil;
import com.neotel.smfcore.shared.utils.SecurityUtils;
import com.neotel.smfcore.shared.utils.StringUtils;
import com.neotel.smfcore.smfPlatform.language.util.MessageUtils;
import com.neotel.smfcore.smfPlatform.message.util.DeviceMessageUtil;
import com.neotel.smfcore.smfPlatform.system.service.dao.IDataLogDao; import com.neotel.smfcore.smfPlatform.system.service.dao.IDataLogDao;
import com.neotel.smfcore.smfPlatform.system.service.po.DataLog; import com.neotel.smfcore.smfPlatform.system.service.po.DataLog;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -37,10 +36,7 @@ import java.util.*; ...@@ -37,10 +36,7 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* 任务服务类,负责管理系统中的各类任务队列和任务状态 * Created by sunke on 2021/7/13.
*
* @author SMF Core Team
* @date 2022-03-14
*/ */
@Service @Service
@Slf4j @Slf4j
...@@ -341,33 +337,12 @@ public class TaskService { ...@@ -341,33 +337,12 @@ public class TaskService {
} }
return resultTasks; return resultTasks;
} }
/**
* 查找已完成的入库任务
* @param cid 设备ID
* @param posName 位置名称
* @return 任务对象
*/
public DataLog findFinishedPutInTask(String cid, String posName){ public DataLog findFinishedPutInTask(String cid, String posName){
return findFinishedTask(cid,posName,"",true); return findFinishedTask(cid,posName,"",true);
} }
/**
* 查找已完成的出库任务
* @param cid 设备ID
* @param posName 位置名称
* @return 任务对象
*/
public DataLog findFinishedOutTask(String cid, String posName){ public DataLog findFinishedOutTask(String cid, String posName){
return findFinishedTask(cid,posName,"",false); return findFinishedTask(cid,posName,"",false);
} }
/**
* 根据条码查找已完成的入库任务
* @param cid 设备ID
* @param posName 位置名称
* @param barcode 条码
* @return 任务对象
*/
public DataLog findFinishedPutInTask(String cid, String posName,String barcode){ public DataLog findFinishedPutInTask(String cid, String posName,String barcode){
return findFinishedTask(cid,posName,barcode,true); return findFinishedTask(cid,posName,barcode,true);
} }
...@@ -459,21 +434,13 @@ public class TaskService { ...@@ -459,21 +434,13 @@ public class TaskService {
} }
return null; return null;
} }
/**
* 查找正在执行的任务
* @param cid 设备ID
* @param posName 位置名称
* @return 任务对象
*/
public DataLog findExecutingTask(String cid, String posName ) { public DataLog findExecutingTask(String cid, String posName ) {
return findExecutingTask(cid,posName,""); return findExecutingTask(cid,posName,"");
} }
/** /**
* 判断指定设备是否有指定类型的正在执行的任务 * 是否有正在执行的任务
* @param cid 设备ID *
* @param type 任务类型 * @return
* @return 是否有执行中的任务
*/ */
public boolean hasExecutingTask(String cid, int type) { public boolean hasExecutingTask(String cid, int type) {
for (DataLog task : taskMap.values()) { for (DataLog task : taskMap.values()) {
...@@ -553,8 +520,7 @@ public class TaskService { ...@@ -553,8 +520,7 @@ public class TaskService {
public StatusBean checkOut(Storage storage, StatusBean statusBean) { public StatusBean checkOut(Storage storage, StatusBean statusBean) {
try { try {
//准备更新暂停出入库 //准备更新暂停出入库
Boolean stopOut = dataCache.getCache(Constants.CACHE_StopOut); if (dataCache.getCache(Constants.CACHE_StopOut)) {
if (stopOut) {
return statusBean; return statusBean;
} }
String cid = storage.getCid(); String cid = storage.getCid();
......
20220225修改:
1.工单出库界面调整
2.增加:物料管理->物料入库菜 页面
3.增加:设置->料架设置 页面
20220228 增加接口:
/service/store/cidIsExists
客户端判断CID是否存在,参数:cid,返回值code=0表示存在,其他值表示不存在
/service/store/uploadStoragePos
客户端上传料仓库位列表,参数:cid,posList (库位列表)
处理:判断料仓是否存在,不存在时自动创建料仓。料仓无库位时自动上传库位,有库位时不处理。
20220228:
1.菜单页面调整。
2.库位页面调整。
3.登录页面增加语言切换。
4.共享文件夹页面调整。
20220304:
个人中心增加进入调试模式功能。
20220307:
启用禁用库位增加操作日志。
20220314:
增加移动料架:NLM,入库时自动推荐库位,无合适库位时自动合并库位。
20220318:
安全库存和 呆滞物料功能
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!